Mercurial
annotate third_party/raylib/include/raygui.h @ 279:b3b547563ec7
Add Google connector service and agent wiki
Implement the C/Seobeo Google Drive and Gmail connector with encrypted OAuth storage, Zenbu authentication, browser testing, AI tool discovery, chunked HTTP decoding, and Bazel coverage. Consolidate repository guidance into progressive wiki documentation and enforce arena-first allocation for new first-party C code.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 84c338fd-0939-4bb3-b7f3-1062eb213e5d
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 17 Aug 2026 22:22:36 -0700 |
| parents | 058de208e640 |
| children |
| rev | line source |
|---|---|
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 /******************************************************************************************* |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 * raygui v4.5-dev - A simple and easy-to-use immediate-mode gui library |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 * DESCRIPTION: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 * raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 * available as a standalone library, as long as input and drawing functions are provided |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 * FEATURES: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 * - Immediate-mode gui, minimal retained data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 * - +25 controls provided (basic and advanced) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 * - Styling system for colors, font and metrics |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
13 * - Icons supported, embedded as a 1-bit icons pack |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 * - Standalone mode option (custom input/graphics backend) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 * - Multiple support tools provided for raygui development |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 * POSSIBLE IMPROVEMENTS: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 * - Better standalone mode API for easy plug of custom backends |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 * - Externalize required inputs, allow user easier customization |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 * LIMITATIONS: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 * - No editable multi-line word-wraped text box supported |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 * - No auto-layout mechanism, up to the user to define controls position and size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
24 * - Standalone mode requires library modification and some user work to plug another backend |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
25 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
26 * NOTES: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
27 * - WARNING: GuiLoadStyle() and GuiLoadStyle{Custom}() functions, allocate memory for |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
28 * font atlas recs and glyphs, freeing that memory is (usually) up to the user, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
29 * no unload function is explicitly provided... but note that GuiLoadStyleDefault() unloads |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
30 * by default any previously loaded font (texture, recs, glyphs) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
31 * - Global UI alpha (guiAlpha) is applied inside GuiDrawRectangle() and GuiDrawText() functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
32 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
33 * CONTROLS PROVIDED: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
34 * # Container/separators Controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
35 * - WindowBox --> StatusBar, Panel |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
36 * - GroupBox --> Line |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
37 * - Line |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
38 * - Panel --> StatusBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
39 * - ScrollPanel --> StatusBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
40 * - TabBar --> Button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
41 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
42 * # Basic Controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
43 * - Label |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
44 * - LabelButton --> Label |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
45 * - Button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
46 * - Toggle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
47 * - ToggleGroup --> Toggle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
48 * - ToggleSlider |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
49 * - CheckBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
50 * - ComboBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
51 * - DropdownBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
52 * - TextBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
53 * - ValueBox --> TextBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
54 * - Spinner --> Button, ValueBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
55 * - Slider |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
56 * - SliderBar --> Slider |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
57 * - ProgressBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
58 * - StatusBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
59 * - DummyRec |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
60 * - Grid |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
61 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
62 * # Advance Controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
63 * - ListView |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
64 * - ColorPicker --> ColorPanel, ColorBarHue |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
65 * - MessageBox --> Window, Label, Button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
66 * - TextInputBox --> Window, Label, TextBox, Button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
67 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
68 * It also provides a set of functions for styling the controls based on its properties (size, color) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
69 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
70 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
71 * RAYGUI STYLE (guiStyle): |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
72 * raygui uses a global data array for all gui style properties (allocated on data segment by default), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
73 * when a new style is loaded, it is loaded over the global style... but a default gui style could always be |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
74 * recovered with GuiLoadStyleDefault() function, that overwrites the current style to the default one |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
75 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
76 * The global style array size is fixed and depends on the number of controls and properties: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
77 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
78 * static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
79 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
80 * guiStyle size is by default: 16*(16 + 8) = 384 int = 384*4 bytes = 1536 bytes = 1.5 KB |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
81 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
82 * Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
83 * used for all controls, when any of those base values is set, it is automatically populated to all |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
84 * controls, so, specific control values overwriting generic style should be set after base values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
85 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
86 * After the first BASE set we have the EXTENDED properties (by default guiStyle[16..23]), those |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
87 * properties are actually common to all controls and can not be overwritten individually (like BASE ones) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
88 * Some of those properties are: TEXT_SIZE, TEXT_SPACING, LINE_COLOR, BACKGROUND_COLOR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
89 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
90 * Custom control properties can be defined using the EXTENDED properties for each independent control. |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
91 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
92 * TOOL: rGuiStyler is a visual tool to customize raygui style: github.com/raysan5/rguistyler |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
93 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
94 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
95 * RAYGUI ICONS (guiIcons): |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
96 * raygui could use a global array containing icons data (allocated on data segment by default), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
97 * a custom icons set could be loaded over this array using GuiLoadIcons(), but loaded icons set |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
98 * must be same RAYGUI_ICON_SIZE and no more than RAYGUI_ICON_MAX_ICONS will be loaded |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
99 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
100 * Every icon is codified in binary form, using 1 bit per pixel, so, every 16x16 icon |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
101 * requires 8 integers (16*16/32) to be stored in memory. |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
102 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
103 * When the icon is draw, actually one quad per pixel is drawn if the bit for that pixel is set |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
104 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
105 * The global icons array size is fixed and depends on the number of icons and size: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
106 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
107 * static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
108 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
109 * guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
110 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
111 * TOOL: rGuiIcons is a visual tool to customize/create raygui icons: github.com/raysan5/rguiicons |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
112 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
113 * RAYGUI LAYOUT: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
114 * raygui currently does not provide an auto-layout mechanism like other libraries, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
115 * layouts must be defined manually on controls drawing, providing the right bounds Rectangle for it |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
116 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
117 * TOOL: rGuiLayout is a visual tool to create raygui layouts: github.com/raysan5/rguilayout |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
118 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
119 * CONFIGURATION: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
120 * #define RAYGUI_IMPLEMENTATION |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
121 * Generates the implementation of the library into the included file |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
122 * If not defined, the library is in header only mode and can be included in other headers |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
123 * or source files without problems. But only ONE file should hold the implementation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
124 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
125 * #define RAYGUI_STANDALONE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
126 * Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
127 * internally in the library and input management and drawing functions must be provided by |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
128 * the user (check library implementation for further details) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
129 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
130 * #define RAYGUI_NO_ICONS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
131 * Avoid including embedded ricons data (256 icons, 16x16 pixels, 1-bit per pixel, 2KB) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
132 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
133 * #define RAYGUI_CUSTOM_ICONS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
134 * Includes custom ricons.h header defining a set of custom icons, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
135 * this file can be generated using rGuiIcons tool |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
136 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
137 * #define RAYGUI_DEBUG_RECS_BOUNDS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
138 * Draw control bounds rectangles for debug |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
139 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
140 * #define RAYGUI_DEBUG_TEXT_BOUNDS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
141 * Draw text bounds rectangles for debug |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
142 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
143 * VERSIONS HISTORY: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
144 * 5.0 (xx-Nov-2025) ADDED: Support up to 32 controls (v500) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
145 * ADDED: guiControlExclusiveMode and guiControlExclusiveRec for exclusive modes |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
146 * ADDED: GuiValueBoxFloat() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
147 * ADDED: GuiDropdonwBox() properties: DROPDOWN_ARROW_HIDDEN, DROPDOWN_ROLL_UP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
148 * ADDED: GuiListView() property: LIST_ITEMS_BORDER_WIDTH |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
149 * ADDED: GuiLoadIconsFromMemory() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
150 * ADDED: Multiple new icons |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
151 * REMOVED: GuiSpinner() from controls list, using BUTTON + VALUEBOX properties |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
152 * REMOVED: GuiSliderPro(), functionality was redundant |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
153 * REVIEWED: Controls using text labels to use LABEL properties |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
154 * REVIEWED: Replaced sprintf() by snprintf() for more safety |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
155 * REVIEWED: GuiTabBar(), close tab with mouse middle button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
156 * REVIEWED: GuiScrollPanel(), scroll speed proportional to content |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
157 * REVIEWED: GuiDropdownBox(), support roll up and hidden arrow |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
158 * REVIEWED: GuiTextBox(), cursor position initialization |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
159 * REVIEWED: GuiSliderPro(), control value change check |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
160 * REVIEWED: GuiGrid(), simplified implementation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
161 * REVIEWED: GuiIconText(), increase buffer size and reviewed padding |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
162 * REVIEWED: GuiDrawText(), improved wrap mode drawing |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
163 * REVIEWED: GuiScrollBar(), minor tweaks |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
164 * REVIEWED: GuiProgressBar(), improved borders computing |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
165 * REVIEWED: GuiTextBox(), multiple improvements: autocursor and more |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
166 * REVIEWED: Functions descriptions, removed wrong return value reference |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
167 * REDESIGNED: GuiColorPanel(), improved HSV <-> RGBA convertion |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
168 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
169 * 4.0 (12-Sep-2023) ADDED: GuiToggleSlider() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
170 * ADDED: GuiColorPickerHSV() and GuiColorPanelHSV() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
171 * ADDED: Multiple new icons, mostly compiler related |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
172 * ADDED: New DEFAULT properties: TEXT_LINE_SPACING, TEXT_ALIGNMENT_VERTICAL, TEXT_WRAP_MODE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
173 * ADDED: New enum values: GuiTextAlignment, GuiTextAlignmentVertical, GuiTextWrapMode |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
174 * ADDED: Support loading styles with custom font charset from external file |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
175 * REDESIGNED: GuiTextBox(), support mouse cursor positioning |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
176 * REDESIGNED: GuiDrawText(), support multiline and word-wrap modes (read only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
177 * REDESIGNED: GuiProgressBar() to be more visual, progress affects border color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
178 * REDESIGNED: Global alpha consideration moved to GuiDrawRectangle() and GuiDrawText() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
179 * REDESIGNED: GuiScrollPanel(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
180 * REDESIGNED: GuiToggleGroup(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
181 * REDESIGNED: GuiComboBox(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
182 * REDESIGNED: GuiCheckBox(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
183 * REDESIGNED: GuiSlider(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
184 * REDESIGNED: GuiSliderBar(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
185 * REDESIGNED: GuiProgressBar(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
186 * REDESIGNED: GuiListView(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
187 * REDESIGNED: GuiColorPicker(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
188 * REDESIGNED: GuiColorPanel(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
189 * REDESIGNED: GuiColorBarAlpha(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
190 * REDESIGNED: GuiColorBarHue(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
191 * REDESIGNED: GuiGrid(), get parameters by reference and return result value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
192 * REDESIGNED: GuiGrid(), added extra parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
193 * REDESIGNED: GuiListViewEx(), change parameters order |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
194 * REDESIGNED: All controls return result as int value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
195 * REVIEWED: GuiScrollPanel() to avoid smallish scroll-bars |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
196 * REVIEWED: All examples and specially controls_test_suite |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
197 * RENAMED: gui_file_dialog module to gui_window_file_dialog |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
198 * UPDATED: All styles to include ISO-8859-15 charset (as much as possible) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
199 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
200 * 3.6 (10-May-2023) ADDED: New icon: SAND_TIMER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
201 * ADDED: GuiLoadStyleFromMemory() (binary only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
202 * REVIEWED: GuiScrollBar() horizontal movement key |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
203 * REVIEWED: GuiTextBox() crash on cursor movement |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
204 * REVIEWED: GuiTextBox(), additional inputs support |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
205 * REVIEWED: GuiLabelButton(), avoid text cut |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
206 * REVIEWED: GuiTextInputBox(), password input |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
207 * REVIEWED: Local GetCodepointNext(), aligned with raylib |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
208 * REDESIGNED: GuiSlider*()/GuiScrollBar() to support out-of-bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
209 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
210 * 3.5 (20-Apr-2023) ADDED: GuiTabBar(), based on GuiToggle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
211 * ADDED: Helper functions to split text in separate lines |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
212 * ADDED: Multiple new icons, useful for code editing tools |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
213 * REMOVED: Unneeded icon editing functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
214 * REMOVED: GuiTextBoxMulti(), very limited and broken |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
215 * REMOVED: MeasureTextEx() dependency, logic directly implemented |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
216 * REMOVED: DrawTextEx() dependency, logic directly implemented |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
217 * REVIEWED: GuiScrollBar(), improve mouse-click behaviour |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
218 * REVIEWED: Library header info, more info, better organized |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
219 * REDESIGNED: GuiTextBox() to support cursor movement |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
220 * REDESIGNED: GuiDrawText() to divide drawing by lines |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
221 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
222 * 3.2 (22-May-2022) RENAMED: Some enum values, for unification, avoiding prefixes |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
223 * REMOVED: GuiScrollBar(), only internal |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
224 * REDESIGNED: GuiPanel() to support text parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
225 * REDESIGNED: GuiScrollPanel() to support text parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
226 * REDESIGNED: GuiColorPicker() to support text parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
227 * REDESIGNED: GuiColorPanel() to support text parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
228 * REDESIGNED: GuiColorBarAlpha() to support text parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
229 * REDESIGNED: GuiColorBarHue() to support text parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
230 * REDESIGNED: GuiTextInputBox() to support password |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
231 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
232 * 3.1 (12-Jan-2022) REVIEWED: Default style for consistency (aligned with rGuiLayout v2.5 tool) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
233 * REVIEWED: GuiLoadStyle() to support compressed font atlas image data and unload previous textures |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
234 * REVIEWED: External icons usage logic |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
235 * REVIEWED: GuiLine() for centered alignment when including text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
236 * RENAMED: Multiple controls properties definitions to prepend RAYGUI_ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
237 * RENAMED: RICON_ references to RAYGUI_ICON_ for library consistency |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
238 * Projects updated and multiple tweaks |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
239 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
240 * 3.0 (04-Nov-2021) Integrated ricons data to avoid external file |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
241 * REDESIGNED: GuiTextBoxMulti() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
242 * REMOVED: GuiImageButton*() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
243 * Multiple minor tweaks and bugs corrected |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
244 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
245 * 2.9 (17-Mar-2021) REMOVED: Tooltip API |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
246 * 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
247 * 2.7 (20-Feb-2020) ADDED: Possible tooltips API |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
248 * 2.6 (09-Sep-2019) ADDED: GuiTextInputBox() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
249 * REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
250 * REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
251 * Replaced property INNER_PADDING by TEXT_PADDING, renamed some properties |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
252 * ADDED: 8 new custom styles ready to use |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
253 * Multiple minor tweaks and bugs corrected |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
254 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
255 * 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
256 * 2.3 (29-Apr-2019) ADDED: rIcons auxiliar library and support for it, multiple controls reviewed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
257 * Refactor all controls drawing mechanism to use control state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
258 * 2.2 (05-Feb-2019) ADDED: GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
259 * 2.1 (26-Dec-2018) REDESIGNED: GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
260 * REDESIGNED: Style system (breaking change) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
261 * 2.0 (08-Nov-2018) ADDED: Support controls guiLock and custom fonts |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
262 * REVIEWED: GuiComboBox(), GuiListView()... |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
263 * 1.9 (09-Oct-2018) REVIEWED: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()... |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
264 * 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
265 * 1.5 (21-Jun-2017) Working in an improved styles system |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
266 * 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
267 * 1.3 (12-Jun-2017) Complete redesign of style system |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
268 * 1.1 (01-Jun-2017) Complete review of the library |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
269 * 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
270 * 0.9 (07-Mar-2016) Reviewed and tested by Albert Martos, Ian Eito, Sergio Martinez and Ramon Santamaria |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
271 * 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
272 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
273 * DEPENDENCIES: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
274 * raylib 5.6-dev - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
275 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
276 * STANDALONE MODE: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
277 * By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
278 * with the config flag RAYGUI_STANDALONE. In that case is up to the user to provide another backend to cover library needs |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
279 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
280 * The following functions should be redefined for a custom backend: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
281 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
282 * - Vector2 GetMousePosition(void); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
283 * - float GetMouseWheelMove(void); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
284 * - bool IsMouseButtonDown(int button); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
285 * - bool IsMouseButtonPressed(int button); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
286 * - bool IsMouseButtonReleased(int button); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
287 * - bool IsKeyDown(int key); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
288 * - bool IsKeyPressed(int key); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
289 * - int GetCharPressed(void); // -- GuiTextBox(), GuiValueBox() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
290 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
291 * - void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
292 * - void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
293 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
294 * - Font GetFontDefault(void); // -- GuiLoadStyleDefault() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
295 * - Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
296 * - Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
297 * - void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
298 * - char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
299 * - void UnloadFileText(char *text); // -- GuiLoadStyle(), required to unload charset data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
300 * - const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle(), required to find charset/font file from text .rgs |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
301 * - int *LoadCodepoints(const char *text, int *count); // -- GuiLoadStyle(), required to load required font codepoints list |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
302 * - void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(), required to unload codepoints list |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
303 * - unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
304 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
305 * CONTRIBUTORS: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
306 * Ramon Santamaria: Supervision, review, redesign, update and maintenance |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
307 * Vlad Adrian: Complete rewrite of GuiTextBox() to support extended features (2019) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
308 * Sergio Martinez: Review, testing (2015) and redesign of multiple controls (2018) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
309 * Adria Arranz: Testing and implementation of additional controls (2018) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
310 * Jordi Jorba: Testing and implementation of additional controls (2018) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
311 * Albert Martos: Review and testing of the library (2015) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
312 * Ian Eito: Review and testing of the library (2015) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
313 * Kevin Gato: Initial implementation of basic components (2014) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
314 * Daniel Nicolas: Initial implementation of basic components (2014) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
315 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
316 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
317 * LICENSE: zlib/libpng |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
318 * |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
319 * Copyright (c) 2014-2026 Ramon Santamaria (@raysan5) |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
320 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
321 * This software is provided "as-is", without any express or implied warranty. In no event |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
322 * will the authors be held liable for any damages arising from the use of this software. |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
323 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
324 * Permission is granted to anyone to use this software for any purpose, including commercial |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
325 * applications, and to alter it and redistribute it freely, subject to the following restrictions: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
326 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
327 * 1. The origin of this software must not be misrepresented; you must not claim that you |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
328 * wrote the original software. If you use this software in a product, an acknowledgment |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
329 * in the product documentation would be appreciated but is not required. |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
330 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
331 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
332 * as being the original software. |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
333 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
334 * 3. This notice may not be removed or altered from any source distribution. |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
335 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
336 **********************************************************************************************/ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
337 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
338 #ifndef RAYGUI_H |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
339 #define RAYGUI_H |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
340 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
341 #define RAYGUI_VERSION_MAJOR 4 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
342 #define RAYGUI_VERSION_MINOR 5 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
343 #define RAYGUI_VERSION_PATCH 0 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
344 #define RAYGUI_VERSION "5.0-dev" |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
345 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
346 #if !defined(RAYGUI_STANDALONE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
347 #include "raylib.h" |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
348 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
349 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
350 // Function specifiers in case library is build/used as a shared library (Windows) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
351 // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
352 #if defined(_WIN32) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
353 #if defined(BUILD_LIBTYPE_SHARED) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
354 #define RAYGUIAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
355 #elif defined(USE_LIBTYPE_SHARED) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
356 #define RAYGUIAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
357 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
358 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
359 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
360 // Function specifiers definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
361 #ifndef RAYGUIAPI |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
362 #define RAYGUIAPI // Functions defined as 'extern' by default (implicit specifiers) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
363 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
364 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
365 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
366 // Defines and Macros |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
367 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
368 // Simple log system to avoid printf() calls if required |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
369 // NOTE: Avoiding those calls, also avoids const strings memory usage |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
370 #define RAYGUI_SUPPORT_LOG_INFO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
371 #if defined(RAYGUI_SUPPORT_LOG_INFO) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
372 #define RAYGUI_LOG(...) printf(__VA_ARGS__) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
373 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
374 #define RAYGUI_LOG(...) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
375 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
376 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
377 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
378 // Types and Structures Definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
379 // NOTE: Some types are required for RAYGUI_STANDALONE usage |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
380 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
381 #if defined(RAYGUI_STANDALONE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
382 #ifndef __cplusplus |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
383 // Boolean type |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
384 #ifndef true |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
385 typedef enum { false, true } bool; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
386 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
387 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
388 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
389 // Vector2 type |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
390 typedef struct Vector2 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
391 float x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
392 float y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
393 } Vector2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
394 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
395 // Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
396 typedef struct Vector3 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
397 float x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
398 float y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
399 float z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
400 } Vector3; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
401 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
402 // Color type, RGBA (32bit) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
403 typedef struct Color { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
404 unsigned char r; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
405 unsigned char g; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
406 unsigned char b; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
407 unsigned char a; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
408 } Color; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
409 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
410 // Rectangle type |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
411 typedef struct Rectangle { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
412 float x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
413 float y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
414 float width; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
415 float height; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
416 } Rectangle; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
417 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
418 // TODO: Texture2D type is very coupled to raylib, required by Font type |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
419 // It should be redesigned to be provided by user |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
420 typedef struct Texture { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
421 unsigned int id; // OpenGL texture id |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
422 int width; // Texture base width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
423 int height; // Texture base height |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
424 int mipmaps; // Mipmap levels, 1 by default |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
425 int format; // Data format (PixelFormat type) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
426 } Texture; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
427 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
428 // Texture2D, same as Texture |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
429 typedef Texture Texture2D; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
430 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
431 // Image, pixel data stored in CPU memory (RAM) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
432 typedef struct Image { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
433 void *data; // Image raw data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
434 int width; // Image base width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
435 int height; // Image base height |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
436 int mipmaps; // Mipmap levels, 1 by default |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
437 int format; // Data format (PixelFormat type) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
438 } Image; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
439 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
440 // GlyphInfo, font characters glyphs info |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
441 typedef struct GlyphInfo { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
442 int value; // Character value (Unicode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
443 int offsetX; // Character offset X when drawing |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
444 int offsetY; // Character offset Y when drawing |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
445 int advanceX; // Character advance position X |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
446 Image image; // Character image data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
447 } GlyphInfo; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
448 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
449 // TODO: Font type is very coupled to raylib, mostly required by GuiLoadStyle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
450 // It should be redesigned to be provided by user |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
451 typedef struct Font { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
452 int baseSize; // Base size (default chars height) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
453 int glyphCount; // Number of glyph characters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
454 int glyphPadding; // Padding around the glyph characters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
455 Texture2D texture; // Texture atlas containing the glyphs |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
456 Rectangle *recs; // Rectangles in texture for the glyphs |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
457 GlyphInfo *glyphs; // Glyphs info data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
458 } Font; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
459 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
460 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
461 // Style property |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
462 // NOTE: Used when exporting style as code for convenience |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
463 typedef struct GuiStyleProp { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
464 unsigned short controlId; // Control identifier |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
465 unsigned short propertyId; // Property identifier |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
466 int propertyValue; // Property value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
467 } GuiStyleProp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
468 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
469 /* |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
470 // Controls text style -NOT USED- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
471 // NOTE: Text style is defined by control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
472 typedef struct GuiTextStyle { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
473 unsigned int size; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
474 int charSpacing; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
475 int lineSpacing; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
476 int alignmentH; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
477 int alignmentV; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
478 int padding; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
479 } GuiTextStyle; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
480 */ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
481 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
482 // Result from JUNE_GuiTextBoxEx - includes selection info |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
483 typedef struct JUNE_TextBoxResult { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
484 int result; // Original return value (0 = no change, 1 = mode changed) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
485 int selectionStart; // Start index of selection (-1 if no selection) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
486 int selectionEnd; // End index of selection (-1 if no selection) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
487 } JUNE_TextBoxResult; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
488 |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
489 // Gui control state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
490 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
491 STATE_NORMAL = 0, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
492 STATE_FOCUSED, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
493 STATE_PRESSED, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
494 STATE_DISABLED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
495 } GuiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
496 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
497 // Gui control text alignment |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
498 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
499 TEXT_ALIGN_LEFT = 0, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
500 TEXT_ALIGN_CENTER, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
501 TEXT_ALIGN_RIGHT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
502 } GuiTextAlignment; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
503 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
504 // Gui control text alignment vertical |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
505 // NOTE: Text vertical position inside the text bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
506 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
507 TEXT_ALIGN_TOP = 0, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
508 TEXT_ALIGN_MIDDLE, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
509 TEXT_ALIGN_BOTTOM |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
510 } GuiTextAlignmentVertical; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
511 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
512 // Gui control text wrap mode |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
513 // NOTE: Useful for multiline text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
514 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
515 TEXT_WRAP_NONE = 0, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
516 TEXT_WRAP_CHAR, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
517 TEXT_WRAP_WORD |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
518 } GuiTextWrapMode; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
519 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
520 // Gui controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
521 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
522 // Default -> populates to all controls when set |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
523 DEFAULT = 0, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
524 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
525 // Basic controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
526 LABEL, // Used also for: LABELBUTTON |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
527 BUTTON, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
528 TOGGLE, // Used also for: TOGGLEGROUP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
529 SLIDER, // Used also for: SLIDERBAR, TOGGLESLIDER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
530 PROGRESSBAR, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
531 CHECKBOX, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
532 COMBOBOX, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
533 DROPDOWNBOX, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
534 TEXTBOX, // Used also for: TEXTBOXMULTI |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
535 VALUEBOX, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
536 CONTROL11, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
537 LISTVIEW, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
538 COLORPICKER, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
539 SCROLLBAR, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
540 STATUSBAR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
541 } GuiControl; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
542 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
543 // Gui base properties for every control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
544 // NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
545 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
546 BORDER_COLOR_NORMAL = 0, // Control border color in STATE_NORMAL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
547 BASE_COLOR_NORMAL, // Control base color in STATE_NORMAL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
548 TEXT_COLOR_NORMAL, // Control text color in STATE_NORMAL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
549 BORDER_COLOR_FOCUSED, // Control border color in STATE_FOCUSED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
550 BASE_COLOR_FOCUSED, // Control base color in STATE_FOCUSED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
551 TEXT_COLOR_FOCUSED, // Control text color in STATE_FOCUSED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
552 BORDER_COLOR_PRESSED, // Control border color in STATE_PRESSED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
553 BASE_COLOR_PRESSED, // Control base color in STATE_PRESSED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
554 TEXT_COLOR_PRESSED, // Control text color in STATE_PRESSED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
555 BORDER_COLOR_DISABLED, // Control border color in STATE_DISABLED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
556 BASE_COLOR_DISABLED, // Control base color in STATE_DISABLED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
557 TEXT_COLOR_DISABLED, // Control text color in STATE_DISABLED |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
558 BORDER_WIDTH = 12, // Control border size, 0 for no border |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
559 //TEXT_SIZE, // Control text size (glyphs max height) -> GLOBAL for all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
560 //TEXT_SPACING, // Control text spacing between glyphs -> GLOBAL for all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
561 //TEXT_LINE_SPACING, // Control text spacing between lines -> GLOBAL for all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
562 TEXT_PADDING = 13, // Control text padding, not considering border |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
563 TEXT_ALIGNMENT = 14, // Control text horizontal alignment inside control text bound (after border and padding) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
564 //TEXT_WRAP_MODE // Control text wrap-mode inside text bounds -> GLOBAL for all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
565 } GuiControlProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
566 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
567 // TODO: Which text styling properties should be global or per-control? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
568 // At this moment TEXT_PADDING and TEXT_ALIGNMENT is configured and saved per control while |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
569 // TEXT_SIZE, TEXT_SPACING, TEXT_LINE_SPACING, TEXT_ALIGNMENT_VERTICAL, TEXT_WRAP_MODE are global and |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
570 // should be configured by user as needed while defining the UI layout |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
571 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
572 // Gui extended properties depend on control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
573 // NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default, max 8 properties) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
574 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
575 // DEFAULT extended properties |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
576 // NOTE: Those properties are common to all controls or global |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
577 // WARNING: We only have 8 slots for those properties by default!!! -> New global control: TEXT? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
578 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
579 TEXT_SIZE = 16, // Text size (glyphs max height) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
580 TEXT_SPACING, // Text spacing between glyphs |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
581 LINE_COLOR, // Line control color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
582 BACKGROUND_COLOR, // Background color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
583 TEXT_LINE_SPACING, // Text spacing between lines |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
584 TEXT_ALIGNMENT_VERTICAL, // Text vertical alignment inside text bounds (after border and padding) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
585 TEXT_WRAP_MODE // Text wrap-mode inside text bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
586 //TEXT_DECORATION // Text decoration: 0-None, 1-Underline, 2-Line-through, 3-Overline |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
587 //TEXT_DECORATION_THICK // Text decoration line thickness |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
588 } GuiDefaultProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
589 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
590 // Other possible text properties: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
591 // TEXT_WEIGHT // Normal, Italic, Bold -> Requires specific font change |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
592 // TEXT_INDENT // Text indentation -> Now using TEXT_PADDING... |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
593 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
594 // Label |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
595 //typedef enum { } GuiLabelProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
596 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
597 // Button/Spinner |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
598 //typedef enum { } GuiButtonProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
599 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
600 // Toggle/ToggleGroup |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
601 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
602 GROUP_PADDING = 16, // ToggleGroup separation between toggles |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
603 } GuiToggleProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
604 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
605 // Slider/SliderBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
606 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
607 SLIDER_WIDTH = 16, // Slider size of internal bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
608 SLIDER_PADDING // Slider/SliderBar internal bar padding |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
609 } GuiSliderProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
610 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
611 // ProgressBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
612 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
613 PROGRESS_PADDING = 16, // ProgressBar internal padding |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
614 } GuiProgressBarProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
615 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
616 // ScrollBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
617 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
618 ARROWS_SIZE = 16, // ScrollBar arrows size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
619 ARROWS_VISIBLE, // ScrollBar arrows visible |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
620 SCROLL_SLIDER_PADDING, // ScrollBar slider internal padding |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
621 SCROLL_SLIDER_SIZE, // ScrollBar slider size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
622 SCROLL_PADDING, // ScrollBar scroll padding from arrows |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
623 SCROLL_SPEED, // ScrollBar scrolling speed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
624 } GuiScrollBarProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
625 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
626 // CheckBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
627 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
628 CHECK_PADDING = 16 // CheckBox internal check padding |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
629 } GuiCheckBoxProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
630 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
631 // ComboBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
632 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
633 COMBO_BUTTON_WIDTH = 16, // ComboBox right button width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
634 COMBO_BUTTON_SPACING // ComboBox button separation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
635 } GuiComboBoxProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
636 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
637 // DropdownBox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
638 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
639 ARROW_PADDING = 16, // DropdownBox arrow separation from border and items |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
640 DROPDOWN_ITEMS_SPACING, // DropdownBox items separation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
641 DROPDOWN_ARROW_HIDDEN, // DropdownBox arrow hidden |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
642 DROPDOWN_ROLL_UP // DropdownBox roll up flag (default rolls down) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
643 } GuiDropdownBoxProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
644 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
645 // TextBox/TextBoxMulti/ValueBox/Spinner |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
646 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
647 TEXT_READONLY = 16, // TextBox in read-only mode: 0-text editable, 1-text no-editable |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
648 } GuiTextBoxProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
649 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
650 // ValueBox/Spinner |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
651 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
652 SPINNER_BUTTON_WIDTH = 16, // Spinner left/right buttons width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
653 SPINNER_BUTTON_SPACING, // Spinner buttons separation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
654 } GuiValueBoxProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
655 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
656 // Control11 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
657 //typedef enum { } GuiControl11Property; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
658 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
659 // ListView |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
660 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
661 LIST_ITEMS_HEIGHT = 16, // ListView items height |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
662 LIST_ITEMS_SPACING, // ListView items separation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
663 SCROLLBAR_WIDTH, // ListView scrollbar size (usually width) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
664 SCROLLBAR_SIDE, // ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
665 LIST_ITEMS_BORDER_NORMAL, // ListView items border enabled in normal state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
666 LIST_ITEMS_BORDER_WIDTH // ListView items border width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
667 } GuiListViewProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
668 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
669 // ColorPicker |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
670 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
671 COLOR_SELECTOR_SIZE = 16, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
672 HUEBAR_WIDTH, // ColorPicker right hue bar width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
673 HUEBAR_PADDING, // ColorPicker right hue bar separation from panel |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
674 HUEBAR_SELECTOR_HEIGHT, // ColorPicker right hue bar selector height |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
675 HUEBAR_SELECTOR_OVERFLOW // ColorPicker right hue bar selector overflow |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
676 } GuiColorPickerProperty; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
677 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
678 #define SCROLLBAR_LEFT_SIDE 0 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
679 #define SCROLLBAR_RIGHT_SIDE 1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
680 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
681 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
682 // Global Variables Definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
683 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
684 // ... |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
685 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
686 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
687 // Module Functions Declaration |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
688 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
689 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
690 #if defined(__cplusplus) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
691 extern "C" { // Prevents name mangling of functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
692 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
693 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
694 // Global gui state control functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
695 RAYGUIAPI void GuiEnable(void); // Enable gui controls (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
696 RAYGUIAPI void GuiDisable(void); // Disable gui controls (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
697 RAYGUIAPI void GuiLock(void); // Lock gui controls (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
698 RAYGUIAPI void GuiUnlock(void); // Unlock gui controls (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
699 RAYGUIAPI bool GuiIsLocked(void); // Check if gui is locked (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
700 RAYGUIAPI void GuiSetAlpha(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
701 RAYGUIAPI void GuiSetState(int state); // Set gui state (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
702 RAYGUIAPI int GuiGetState(void); // Get gui state (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
703 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
704 // Font set/get functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
705 RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
706 RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
707 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
708 // Style set/get functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
709 RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
710 RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
711 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
712 // Styles loading functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
713 RAYGUIAPI void GuiLoadStyle(const char *fileName); // Load style file over global style variable (.rgs) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
714 RAYGUIAPI void GuiLoadStyleDefault(void); // Load style default over global style |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
715 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
716 // Tooltips management functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
717 RAYGUIAPI void GuiEnableTooltip(void); // Enable gui tooltips (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
718 RAYGUIAPI void GuiDisableTooltip(void); // Disable gui tooltips (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
719 RAYGUIAPI void GuiSetTooltip(const char *tooltip); // Set tooltip string |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
720 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
721 // Icons functionality |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
722 RAYGUIAPI const char *GuiIconText(int iconId, const char *text); // Get text with icon id prepended (if supported) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
723 #if !defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
724 RAYGUIAPI void GuiSetIconScale(int scale); // Set default icon drawing size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
725 RAYGUIAPI unsigned int *GuiGetIcons(void); // Get raygui icons data pointer |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
726 RAYGUIAPI char **GuiLoadIcons(const char *fileName, bool loadIconsName); // Load raygui icons file (.rgi) into internal icons data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
727 RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color); // Draw icon using pixel size at specified position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
728 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
729 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
730 // Utility functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
731 RAYGUIAPI int GuiGetTextWidth(const char *text); // Get text width considering gui style and icon size (if required) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
732 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
733 // Controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
734 //---------------------------------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
735 // Container/separator controls, useful for controls organization |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
736 RAYGUIAPI int GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
737 RAYGUIAPI int GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
738 RAYGUIAPI int GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
739 RAYGUIAPI int GuiPanel(Rectangle bounds, const char *text); // Panel control, useful to group controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
740 RAYGUIAPI int GuiTabBar(Rectangle bounds, const char **text, int count, int *active); // Tab Bar control, returns TAB to be closed or -1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
741 RAYGUIAPI int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view); // Scroll Panel control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
742 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
743 // Basic controls set |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
744 RAYGUIAPI int GuiLabel(Rectangle bounds, const char *text); // Label control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
745 RAYGUIAPI int GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked |
|
161
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
746 RAYGUIAPI int GuiButtonRounded(Rectangle bounds, const char *text, float roundness, int segments); |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
747 RAYGUIAPI int GuiLabelButton(Rectangle bounds, const char *text); // Label button control, returns true when clicked |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
748 RAYGUIAPI int GuiToggle(Rectangle bounds, const char *text, bool *active); // Toggle Button control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
749 RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int *active); // Toggle Group control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
750 RAYGUIAPI int GuiToggleSlider(Rectangle bounds, const char *text, int *active); // Toggle Slider control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
751 RAYGUIAPI int GuiCheckBox(Rectangle bounds, const char *text, bool *checked); // Check Box control, returns true when active |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
752 RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int *active); // Combo Box control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
753 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
754 RAYGUIAPI int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control |
|
161
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
755 RAYGUIAPI int GuiDropdownBoxRounded(Rectangle bounds, const char *text, int *active, bool editMode, float roundness, int segments); |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
756 RAYGUIAPI int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
757 RAYGUIAPI int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
758 RAYGUIAPI int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float *value, bool editMode); // Value box control for float values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
759 RAYGUIAPI int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
760 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
761 RAYGUIAPI int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
762 RAYGUIAPI int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider Bar control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
763 RAYGUIAPI int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Progress Bar control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
764 RAYGUIAPI int GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
765 RAYGUIAPI int GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
766 RAYGUIAPI int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell); // Grid control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
767 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
768 // Advance controls set |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
769 RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active); // List View control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
770 RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus); // List View with extended parameters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
771 RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
772 RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive); // Text Input Box control, ask for text, supports secret |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
773 RAYGUIAPI int GuiColorPicker(Rectangle bounds, const char *text, Color *color); // Color Picker control (multiple color controls) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
774 RAYGUIAPI int GuiColorPanel(Rectangle bounds, const char *text, Color *color); // Color Panel control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
775 RAYGUIAPI int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha); // Color Bar Alpha control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
776 RAYGUIAPI int GuiColorBarHue(Rectangle bounds, const char *text, float *value); // Color Bar Hue control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
777 RAYGUIAPI int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Picker control that avoids conversion to RGB on each call (multiple color controls) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
778 RAYGUIAPI int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
779 //---------------------------------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
780 |
|
118
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
781 |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
782 // ---- CUSTOM ---- // |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
783 RAYGUIAPI void JUNE_DrawRectangleLinesNoBottom(Rectangle rect, float thickness, Color color); |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
784 |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
785 #if !defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
786 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
787 #if !defined(RAYGUI_CUSTOM_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
788 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
789 // Icons enumeration |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
790 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
791 typedef enum { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
792 ICON_NONE = 0, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
793 ICON_FOLDER_FILE_OPEN = 1, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
794 ICON_FILE_SAVE_CLASSIC = 2, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
795 ICON_FOLDER_OPEN = 3, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
796 ICON_FOLDER_SAVE = 4, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
797 ICON_FILE_OPEN = 5, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
798 ICON_FILE_SAVE = 6, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
799 ICON_FILE_EXPORT = 7, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
800 ICON_FILE_ADD = 8, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
801 ICON_FILE_DELETE = 9, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
802 ICON_FILETYPE_TEXT = 10, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
803 ICON_FILETYPE_AUDIO = 11, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
804 ICON_FILETYPE_IMAGE = 12, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
805 ICON_FILETYPE_PLAY = 13, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
806 ICON_FILETYPE_VIDEO = 14, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
807 ICON_FILETYPE_INFO = 15, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
808 ICON_FILE_COPY = 16, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
809 ICON_FILE_CUT = 17, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
810 ICON_FILE_PASTE = 18, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
811 ICON_CURSOR_HAND = 19, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
812 ICON_CURSOR_POINTER = 20, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
813 ICON_CURSOR_CLASSIC = 21, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
814 ICON_PENCIL = 22, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
815 ICON_PENCIL_BIG = 23, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
816 ICON_BRUSH_CLASSIC = 24, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
817 ICON_BRUSH_PAINTER = 25, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
818 ICON_WATER_DROP = 26, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
819 ICON_COLOR_PICKER = 27, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
820 ICON_RUBBER = 28, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
821 ICON_COLOR_BUCKET = 29, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
822 ICON_TEXT_T = 30, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
823 ICON_TEXT_A = 31, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
824 ICON_SCALE = 32, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
825 ICON_RESIZE = 33, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
826 ICON_FILTER_POINT = 34, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
827 ICON_FILTER_BILINEAR = 35, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
828 ICON_CROP = 36, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
829 ICON_CROP_ALPHA = 37, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
830 ICON_SQUARE_TOGGLE = 38, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
831 ICON_SYMMETRY = 39, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
832 ICON_SYMMETRY_HORIZONTAL = 40, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
833 ICON_SYMMETRY_VERTICAL = 41, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
834 ICON_LENS = 42, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
835 ICON_LENS_BIG = 43, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
836 ICON_EYE_ON = 44, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
837 ICON_EYE_OFF = 45, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
838 ICON_FILTER_TOP = 46, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
839 ICON_FILTER = 47, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
840 ICON_TARGET_POINT = 48, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
841 ICON_TARGET_SMALL = 49, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
842 ICON_TARGET_BIG = 50, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
843 ICON_TARGET_MOVE = 51, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
844 ICON_CURSOR_MOVE = 52, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
845 ICON_CURSOR_SCALE = 53, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
846 ICON_CURSOR_SCALE_RIGHT = 54, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
847 ICON_CURSOR_SCALE_LEFT = 55, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
848 ICON_UNDO = 56, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
849 ICON_REDO = 57, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
850 ICON_REREDO = 58, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
851 ICON_MUTATE = 59, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
852 ICON_ROTATE = 60, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
853 ICON_REPEAT = 61, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
854 ICON_SHUFFLE = 62, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
855 ICON_EMPTYBOX = 63, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
856 ICON_TARGET = 64, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
857 ICON_TARGET_SMALL_FILL = 65, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
858 ICON_TARGET_BIG_FILL = 66, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
859 ICON_TARGET_MOVE_FILL = 67, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
860 ICON_CURSOR_MOVE_FILL = 68, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
861 ICON_CURSOR_SCALE_FILL = 69, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
862 ICON_CURSOR_SCALE_RIGHT_FILL = 70, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
863 ICON_CURSOR_SCALE_LEFT_FILL = 71, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
864 ICON_UNDO_FILL = 72, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
865 ICON_REDO_FILL = 73, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
866 ICON_REREDO_FILL = 74, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
867 ICON_MUTATE_FILL = 75, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
868 ICON_ROTATE_FILL = 76, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
869 ICON_REPEAT_FILL = 77, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
870 ICON_SHUFFLE_FILL = 78, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
871 ICON_EMPTYBOX_SMALL = 79, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
872 ICON_BOX = 80, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
873 ICON_BOX_TOP = 81, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
874 ICON_BOX_TOP_RIGHT = 82, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
875 ICON_BOX_RIGHT = 83, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
876 ICON_BOX_BOTTOM_RIGHT = 84, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
877 ICON_BOX_BOTTOM = 85, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
878 ICON_BOX_BOTTOM_LEFT = 86, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
879 ICON_BOX_LEFT = 87, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
880 ICON_BOX_TOP_LEFT = 88, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
881 ICON_BOX_CENTER = 89, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
882 ICON_BOX_CIRCLE_MASK = 90, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
883 ICON_POT = 91, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
884 ICON_ALPHA_MULTIPLY = 92, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
885 ICON_ALPHA_CLEAR = 93, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
886 ICON_DITHERING = 94, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
887 ICON_MIPMAPS = 95, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
888 ICON_BOX_GRID = 96, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
889 ICON_GRID = 97, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
890 ICON_BOX_CORNERS_SMALL = 98, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
891 ICON_BOX_CORNERS_BIG = 99, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
892 ICON_FOUR_BOXES = 100, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
893 ICON_GRID_FILL = 101, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
894 ICON_BOX_MULTISIZE = 102, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
895 ICON_ZOOM_SMALL = 103, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
896 ICON_ZOOM_MEDIUM = 104, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
897 ICON_ZOOM_BIG = 105, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
898 ICON_ZOOM_ALL = 106, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
899 ICON_ZOOM_CENTER = 107, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
900 ICON_BOX_DOTS_SMALL = 108, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
901 ICON_BOX_DOTS_BIG = 109, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
902 ICON_BOX_CONCENTRIC = 110, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
903 ICON_BOX_GRID_BIG = 111, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
904 ICON_OK_TICK = 112, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
905 ICON_CROSS = 113, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
906 ICON_ARROW_LEFT = 114, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
907 ICON_ARROW_RIGHT = 115, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
908 ICON_ARROW_DOWN = 116, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
909 ICON_ARROW_UP = 117, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
910 ICON_ARROW_LEFT_FILL = 118, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
911 ICON_ARROW_RIGHT_FILL = 119, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
912 ICON_ARROW_DOWN_FILL = 120, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
913 ICON_ARROW_UP_FILL = 121, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
914 ICON_AUDIO = 122, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
915 ICON_FX = 123, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
916 ICON_WAVE = 124, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
917 ICON_WAVE_SINUS = 125, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
918 ICON_WAVE_SQUARE = 126, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
919 ICON_WAVE_TRIANGULAR = 127, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
920 ICON_CROSS_SMALL = 128, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
921 ICON_PLAYER_PREVIOUS = 129, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
922 ICON_PLAYER_PLAY_BACK = 130, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
923 ICON_PLAYER_PLAY = 131, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
924 ICON_PLAYER_PAUSE = 132, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
925 ICON_PLAYER_STOP = 133, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
926 ICON_PLAYER_NEXT = 134, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
927 ICON_PLAYER_RECORD = 135, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
928 ICON_MAGNET = 136, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
929 ICON_LOCK_CLOSE = 137, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
930 ICON_LOCK_OPEN = 138, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
931 ICON_CLOCK = 139, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
932 ICON_TOOLS = 140, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
933 ICON_GEAR = 141, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
934 ICON_GEAR_BIG = 142, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
935 ICON_BIN = 143, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
936 ICON_HAND_POINTER = 144, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
937 ICON_LASER = 145, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
938 ICON_COIN = 146, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
939 ICON_EXPLOSION = 147, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
940 ICON_1UP = 148, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
941 ICON_PLAYER = 149, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
942 ICON_PLAYER_JUMP = 150, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
943 ICON_KEY = 151, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
944 ICON_DEMON = 152, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
945 ICON_TEXT_POPUP = 153, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
946 ICON_GEAR_EX = 154, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
947 ICON_CRACK = 155, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
948 ICON_CRACK_POINTS = 156, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
949 ICON_STAR = 157, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
950 ICON_DOOR = 158, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
951 ICON_EXIT = 159, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
952 ICON_MODE_2D = 160, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
953 ICON_MODE_3D = 161, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
954 ICON_CUBE = 162, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
955 ICON_CUBE_FACE_TOP = 163, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
956 ICON_CUBE_FACE_LEFT = 164, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
957 ICON_CUBE_FACE_FRONT = 165, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
958 ICON_CUBE_FACE_BOTTOM = 166, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
959 ICON_CUBE_FACE_RIGHT = 167, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
960 ICON_CUBE_FACE_BACK = 168, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
961 ICON_CAMERA = 169, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
962 ICON_SPECIAL = 170, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
963 ICON_LINK_NET = 171, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
964 ICON_LINK_BOXES = 172, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
965 ICON_LINK_MULTI = 173, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
966 ICON_LINK = 174, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
967 ICON_LINK_BROKE = 175, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
968 ICON_TEXT_NOTES = 176, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
969 ICON_NOTEBOOK = 177, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
970 ICON_SUITCASE = 178, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
971 ICON_SUITCASE_ZIP = 179, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
972 ICON_MAILBOX = 180, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
973 ICON_MONITOR = 181, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
974 ICON_PRINTER = 182, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
975 ICON_PHOTO_CAMERA = 183, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
976 ICON_PHOTO_CAMERA_FLASH = 184, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
977 ICON_HOUSE = 185, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
978 ICON_HEART = 186, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
979 ICON_CORNER = 187, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
980 ICON_VERTICAL_BARS = 188, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
981 ICON_VERTICAL_BARS_FILL = 189, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
982 ICON_LIFE_BARS = 190, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
983 ICON_INFO = 191, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
984 ICON_CROSSLINE = 192, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
985 ICON_HELP = 193, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
986 ICON_FILETYPE_ALPHA = 194, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
987 ICON_FILETYPE_HOME = 195, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
988 ICON_LAYERS_VISIBLE = 196, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
989 ICON_LAYERS = 197, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
990 ICON_WINDOW = 198, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
991 ICON_HIDPI = 199, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
992 ICON_FILETYPE_BINARY = 200, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
993 ICON_HEX = 201, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
994 ICON_SHIELD = 202, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
995 ICON_FILE_NEW = 203, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
996 ICON_FOLDER_ADD = 204, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
997 ICON_ALARM = 205, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
998 ICON_CPU = 206, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
999 ICON_ROM = 207, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1000 ICON_STEP_OVER = 208, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1001 ICON_STEP_INTO = 209, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1002 ICON_STEP_OUT = 210, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1003 ICON_RESTART = 211, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1004 ICON_BREAKPOINT_ON = 212, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1005 ICON_BREAKPOINT_OFF = 213, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1006 ICON_BURGER_MENU = 214, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1007 ICON_CASE_SENSITIVE = 215, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1008 ICON_REG_EXP = 216, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1009 ICON_FOLDER = 217, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1010 ICON_FILE = 218, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1011 ICON_SAND_TIMER = 219, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1012 ICON_WARNING = 220, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1013 ICON_HELP_BOX = 221, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1014 ICON_INFO_BOX = 222, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1015 ICON_PRIORITY = 223, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1016 ICON_LAYERS_ISO = 224, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1017 ICON_LAYERS2 = 225, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1018 ICON_MLAYERS = 226, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1019 ICON_MAPS = 227, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1020 ICON_HOT = 228, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1021 ICON_LABEL = 229, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1022 ICON_NAME_ID = 230, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1023 ICON_SLICING = 231, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1024 ICON_MANUAL_CONTROL = 232, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1025 ICON_COLLISION = 233, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1026 ICON_CIRCLE_ADD = 234, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1027 ICON_CIRCLE_ADD_FILL = 235, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1028 ICON_CIRCLE_WARNING = 236, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1029 ICON_CIRCLE_WARNING_FILL = 237, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1030 ICON_BOX_MORE = 238, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1031 ICON_BOX_MORE_FILL = 239, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1032 ICON_BOX_MINUS = 240, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1033 ICON_BOX_MINUS_FILL = 241, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1034 ICON_UNION = 242, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1035 ICON_INTERSECTION = 243, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1036 ICON_DIFFERENCE = 244, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1037 ICON_SPHERE = 245, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1038 ICON_CYLINDER = 246, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1039 ICON_CONE = 247, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1040 ICON_ELLIPSOID = 248, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1041 ICON_CAPSULE = 249, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1042 ICON_250 = 250, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1043 ICON_251 = 251, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1044 ICON_252 = 252, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1045 ICON_253 = 253, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1046 ICON_254 = 254, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1047 ICON_255 = 255 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1048 } GuiIconName; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1049 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1050 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1051 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1052 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1053 #if defined(__cplusplus) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1054 } // Prevents name mangling of functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1055 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1056 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1057 #endif // RAYGUI_H |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1058 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1059 /*********************************************************************************** |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1060 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1061 * RAYGUI IMPLEMENTATION |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1062 * |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1063 ************************************************************************************/ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1064 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1065 #if defined(RAYGUI_IMPLEMENTATION) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1066 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1067 #include <ctype.h> // required for: isspace() [GuiTextBox()] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1068 #include <stdio.h> // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), snprintf(), vsprintf() [GuiLoadStyle(), GuiLoadIcons()] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1069 #include <string.h> // Required for: strlen() [GuiTextBox(), GuiValueBox()], memset(), memcpy() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1070 #include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [TextFormat()] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1071 #include <math.h> // Required for: roundf() [GuiColorPicker()] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1072 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1073 // Allow custom memory allocators |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1074 #if defined(RAYGUI_MALLOC) || defined(RAYGUI_CALLOC) || defined(RAYGUI_FREE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1075 #if !defined(RAYGUI_MALLOC) || !defined(RAYGUI_CALLOC) || !defined(RAYGUI_FREE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1076 #error "RAYGUI: if RAYGUI_MALLOC, RAYGUI_CALLOC, or RAYGUI_FREE is customized, all three must be customized" |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1077 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1078 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1079 #include <stdlib.h> // Required for: malloc(), calloc(), free() [GuiLoadStyle(), GuiLoadIcons()] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1080 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1081 #define RAYGUI_MALLOC(sz) malloc(sz) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1082 #define RAYGUI_CALLOC(n,sz) calloc(n,sz) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1083 #define RAYGUI_FREE(p) free(p) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1084 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1085 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1086 #ifdef __cplusplus |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1087 #define RAYGUI_CLITERAL(name) name |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1088 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1089 #define RAYGUI_CLITERAL(name) (name) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1090 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1091 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1092 // Check if two rectangles are equal, used to validate a slider bounds as an id |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1093 #ifndef CHECK_BOUNDS_ID |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1094 #define CHECK_BOUNDS_ID(src, dst) (((int)src.x == (int)dst.x) && ((int)src.y == (int)dst.y) && ((int)src.width == (int)dst.width) && ((int)src.height == (int)dst.height)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1095 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1096 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1097 #if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1098 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1099 // Embedded icons, no external file provided |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1100 #define RAYGUI_ICON_SIZE 16 // Size of icons in pixels (squared) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1101 #define RAYGUI_ICON_MAX_ICONS 256 // Maximum number of icons |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1102 #define RAYGUI_ICON_MAX_NAME_LENGTH 32 // Maximum length of icon name id |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1103 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1104 // Icons data is defined by bit array (every bit represents one pixel) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1105 // Those arrays are stored as unsigned int data arrays, so, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1106 // every array element defines 32 pixels (bits) of information |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1107 // One icon is defined by 8 int, (8 int*32 bit = 256 bit = 16*16 pixels) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1108 // NOTE: Number of elemens depend on RAYGUI_ICON_SIZE (by default 16x16 pixels) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1109 #define RAYGUI_ICON_DATA_ELEMENTS (RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1110 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1111 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1112 // Icons data for all gui possible icons (allocated on data segment by default) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1113 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1114 // NOTE 1: Every icon is codified in binary form, using 1 bit per pixel, so, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1115 // every 16x16 icon requires 8 integers (16*16/32) to be stored |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1116 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1117 // NOTE 2: A different icon set could be loaded over this array using GuiLoadIcons(), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1118 // but loaded icons set must be same RAYGUI_ICON_SIZE and no more than RAYGUI_ICON_MAX_ICONS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1119 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1120 // guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1121 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1122 static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1123 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_NONE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1124 0x3ff80000, 0x2f082008, 0x2042207e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x00007ffe, // ICON_FOLDER_FILE_OPEN |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1125 0x3ffe0000, 0x44226422, 0x400247e2, 0x5ffa4002, 0x57ea500a, 0x500a500a, 0x40025ffa, 0x00007ffe, // ICON_FILE_SAVE_CLASSIC |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1126 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024002, 0x44424282, 0x793e4102, 0x00000100, // ICON_FOLDER_OPEN |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1127 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024102, 0x44424102, 0x793e4282, 0x00000000, // ICON_FOLDER_SAVE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1128 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x24442284, 0x21042104, 0x20042104, 0x00003ffc, // ICON_FILE_OPEN |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1129 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x21042104, 0x22842444, 0x20042104, 0x00003ffc, // ICON_FILE_SAVE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1130 0x3ff00000, 0x201c2010, 0x00042004, 0x20041004, 0x20844784, 0x00841384, 0x20042784, 0x00003ffc, // ICON_FILE_EXPORT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1131 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x22042204, 0x22042f84, 0x20042204, 0x00003ffc, // ICON_FILE_ADD |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1132 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x25042884, 0x25042204, 0x20042884, 0x00003ffc, // ICON_FILE_DELETE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1133 0x3ff00000, 0x201c2010, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // ICON_FILETYPE_TEXT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1134 0x3ff00000, 0x201c2010, 0x27042004, 0x244424c4, 0x26442444, 0x20642664, 0x20042004, 0x00003ffc, // ICON_FILETYPE_AUDIO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1135 0x3ff00000, 0x201c2010, 0x26042604, 0x20042004, 0x35442884, 0x2414222c, 0x20042004, 0x00003ffc, // ICON_FILETYPE_IMAGE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1136 0x3ff00000, 0x201c2010, 0x20c42004, 0x22442144, 0x22442444, 0x20c42144, 0x20042004, 0x00003ffc, // ICON_FILETYPE_PLAY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1137 0x3ff00000, 0x3ffc2ff0, 0x3f3c2ff4, 0x3dbc2eb4, 0x3dbc2bb4, 0x3f3c2eb4, 0x3ffc2ff4, 0x00002ff4, // ICON_FILETYPE_VIDEO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1138 0x3ff00000, 0x201c2010, 0x21842184, 0x21842004, 0x21842184, 0x21842184, 0x20042184, 0x00003ffc, // ICON_FILETYPE_INFO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1139 0x0ff00000, 0x381c0810, 0x28042804, 0x28042804, 0x28042804, 0x28042804, 0x20102ffc, 0x00003ff0, // ICON_FILE_COPY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1140 0x00000000, 0x701c0000, 0x079c1e14, 0x55a000f0, 0x079c00f0, 0x701c1e14, 0x00000000, 0x00000000, // ICON_FILE_CUT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1141 0x01c00000, 0x13e41bec, 0x3f841004, 0x204420c4, 0x20442044, 0x20442044, 0x207c2044, 0x00003fc0, // ICON_FILE_PASTE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1142 0x00000000, 0x3aa00fe0, 0x2abc2aa0, 0x2aa42aa4, 0x20042aa4, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_CURSOR_HAND |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1143 0x00000000, 0x003c000c, 0x030800c8, 0x30100c10, 0x10202020, 0x04400840, 0x01800280, 0x00000000, // ICON_CURSOR_POINTER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1144 0x00000000, 0x00180000, 0x01f00078, 0x03e007f0, 0x07c003e0, 0x04000e40, 0x00000000, 0x00000000, // ICON_CURSOR_CLASSIC |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1145 0x00000000, 0x04000000, 0x11000a00, 0x04400a80, 0x01100220, 0x00580088, 0x00000038, 0x00000000, // ICON_PENCIL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1146 0x04000000, 0x15000a00, 0x50402880, 0x14102820, 0x05040a08, 0x015c028c, 0x007c00bc, 0x00000000, // ICON_PENCIL_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1147 0x01c00000, 0x01400140, 0x01400140, 0x0ff80140, 0x0ff80808, 0x0aa80808, 0x0aa80aa8, 0x00000ff8, // ICON_BRUSH_CLASSIC |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1148 0x1ffc0000, 0x5ffc7ffe, 0x40004000, 0x00807f80, 0x01c001c0, 0x01c001c0, 0x01c001c0, 0x00000080, // ICON_BRUSH_PAINTER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1149 0x00000000, 0x00800000, 0x01c00080, 0x03e001c0, 0x07f003e0, 0x036006f0, 0x000001c0, 0x00000000, // ICON_WATER_DROP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1150 0x00000000, 0x3e003800, 0x1f803f80, 0x0c201e40, 0x02080c10, 0x00840104, 0x00380044, 0x00000000, // ICON_COLOR_PICKER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1151 0x00000000, 0x07800300, 0x1fe00fc0, 0x3f883fd0, 0x0e021f04, 0x02040402, 0x00f00108, 0x00000000, // ICON_RUBBER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1152 0x00c00000, 0x02800140, 0x08200440, 0x20081010, 0x2ffe3004, 0x03f807fc, 0x00e001f0, 0x00000040, // ICON_COLOR_BUCKET |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1153 0x00000000, 0x21843ffc, 0x01800180, 0x01800180, 0x01800180, 0x01800180, 0x03c00180, 0x00000000, // ICON_TEXT_T |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1154 0x00800000, 0x01400180, 0x06200340, 0x0c100620, 0x1ff80c10, 0x380c1808, 0x70067004, 0x0000f80f, // ICON_TEXT_A |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1155 0x78000000, 0x50004000, 0x00004800, 0x03c003c0, 0x03c003c0, 0x00100000, 0x0002000a, 0x0000000e, // ICON_SCALE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1156 0x75560000, 0x5e004002, 0x54001002, 0x41001202, 0x408200fe, 0x40820082, 0x40820082, 0x00006afe, // ICON_RESIZE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1157 0x00000000, 0x3f003f00, 0x3f003f00, 0x3f003f00, 0x00400080, 0x001c0020, 0x001c001c, 0x00000000, // ICON_FILTER_POINT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1158 0x6d800000, 0x00004080, 0x40804080, 0x40800000, 0x00406d80, 0x001c0020, 0x001c001c, 0x00000000, // ICON_FILTER_BILINEAR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1159 0x40080000, 0x1ffe2008, 0x14081008, 0x11081208, 0x10481088, 0x10081028, 0x10047ff8, 0x00001002, // ICON_CROP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1160 0x00100000, 0x3ffc0010, 0x2ab03550, 0x22b02550, 0x20b02150, 0x20302050, 0x2000fff0, 0x00002000, // ICON_CROP_ALPHA |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1161 0x40000000, 0x1ff82000, 0x04082808, 0x01082208, 0x00482088, 0x00182028, 0x35542008, 0x00000002, // ICON_SQUARE_TOGGLE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1162 0x00000000, 0x02800280, 0x06c006c0, 0x0ea00ee0, 0x1e901eb0, 0x3e883e98, 0x7efc7e8c, 0x00000000, // ICON_SYMMETRY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1163 0x01000000, 0x05600100, 0x1d480d50, 0x7d423d44, 0x3d447d42, 0x0d501d48, 0x01000560, 0x00000100, // ICON_SYMMETRY_HORIZONTAL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1164 0x01800000, 0x04200240, 0x10080810, 0x00001ff8, 0x00007ffe, 0x0ff01ff8, 0x03c007e0, 0x00000180, // ICON_SYMMETRY_VERTICAL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1165 0x00000000, 0x010800f0, 0x02040204, 0x02040204, 0x07f00308, 0x1c000e00, 0x30003800, 0x00000000, // ICON_LENS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1166 0x00000000, 0x061803f0, 0x08240c0c, 0x08040814, 0x0c0c0804, 0x23f01618, 0x18002400, 0x00000000, // ICON_LENS_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1167 0x00000000, 0x00000000, 0x1c7007c0, 0x638e3398, 0x1c703398, 0x000007c0, 0x00000000, 0x00000000, // ICON_EYE_ON |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1168 0x00000000, 0x10002000, 0x04700fc0, 0x610e3218, 0x1c703098, 0x001007a0, 0x00000008, 0x00000000, // ICON_EYE_OFF |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1169 0x00000000, 0x00007ffc, 0x40047ffc, 0x10102008, 0x04400820, 0x02800280, 0x02800280, 0x00000100, // ICON_FILTER_TOP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1170 0x00000000, 0x40027ffe, 0x10082004, 0x04200810, 0x02400240, 0x02400240, 0x01400240, 0x000000c0, // ICON_FILTER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1171 0x00800000, 0x00800080, 0x00000080, 0x3c9e0000, 0x00000000, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_POINT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1172 0x00800000, 0x00800080, 0x00800080, 0x3f7e01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_SMALL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1173 0x00800000, 0x00800080, 0x03e00080, 0x3e3e0220, 0x03e00220, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1174 0x01000000, 0x04400280, 0x01000100, 0x43842008, 0x43849ab2, 0x01002008, 0x04400100, 0x01000280, // ICON_TARGET_MOVE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1175 0x01000000, 0x04400280, 0x01000100, 0x41042108, 0x41049ff2, 0x01002108, 0x04400100, 0x01000280, // ICON_CURSOR_MOVE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1176 0x781e0000, 0x500a4002, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x4002500a, 0x0000781e, // ICON_CURSOR_SCALE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1177 0x00000000, 0x20003c00, 0x24002800, 0x01000200, 0x00400080, 0x00140024, 0x003c0004, 0x00000000, // ICON_CURSOR_SCALE_RIGHT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1178 0x00000000, 0x0004003c, 0x00240014, 0x00800040, 0x02000100, 0x28002400, 0x3c002000, 0x00000000, // ICON_CURSOR_SCALE_LEFT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1179 0x00000000, 0x00100020, 0x10101fc8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // ICON_UNDO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1180 0x00000000, 0x08000400, 0x080813f8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // ICON_REDO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1181 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3f902020, 0x00400020, 0x00000000, // ICON_REREDO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1182 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3fc82010, 0x00200010, 0x00000000, // ICON_MUTATE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1183 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18101020, 0x00100fc8, 0x00000020, // ICON_ROTATE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1184 0x00000000, 0x04000200, 0x240429fc, 0x20042204, 0x20442004, 0x3f942024, 0x00400020, 0x00000000, // ICON_REPEAT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1185 0x00000000, 0x20001000, 0x22104c0e, 0x00801120, 0x11200040, 0x4c0e2210, 0x10002000, 0x00000000, // ICON_SHUFFLE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1186 0x7ffe0000, 0x50024002, 0x44024802, 0x41024202, 0x40424082, 0x40124022, 0x4002400a, 0x00007ffe, // ICON_EMPTYBOX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1187 0x00800000, 0x03e00080, 0x08080490, 0x3c9e0808, 0x08080808, 0x03e00490, 0x00800080, 0x00000000, // ICON_TARGET |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1188 0x00800000, 0x00800080, 0x00800080, 0x3ffe01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_SMALL_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1189 0x00800000, 0x00800080, 0x03e00080, 0x3ffe03e0, 0x03e003e0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_BIG_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1190 0x01000000, 0x07c00380, 0x01000100, 0x638c2008, 0x638cfbbe, 0x01002008, 0x07c00100, 0x01000380, // ICON_TARGET_MOVE_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1191 0x01000000, 0x07c00380, 0x01000100, 0x610c2108, 0x610cfffe, 0x01002108, 0x07c00100, 0x01000380, // ICON_CURSOR_MOVE_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1192 0x781e0000, 0x6006700e, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x700e6006, 0x0000781e, // ICON_CURSOR_SCALE_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1193 0x00000000, 0x38003c00, 0x24003000, 0x01000200, 0x00400080, 0x000c0024, 0x003c001c, 0x00000000, // ICON_CURSOR_SCALE_RIGHT_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1194 0x00000000, 0x001c003c, 0x0024000c, 0x00800040, 0x02000100, 0x30002400, 0x3c003800, 0x00000000, // ICON_CURSOR_SCALE_LEFT_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1195 0x00000000, 0x00300020, 0x10301ff8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // ICON_UNDO_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1196 0x00000000, 0x0c000400, 0x0c081ff8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // ICON_REDO_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1197 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3ff02060, 0x00400060, 0x00000000, // ICON_REREDO_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1198 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3ff82030, 0x00200030, 0x00000000, // ICON_MUTATE_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1199 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18301020, 0x00300ff8, 0x00000020, // ICON_ROTATE_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1200 0x00000000, 0x06000200, 0x26042ffc, 0x20042204, 0x20442004, 0x3ff42064, 0x00400060, 0x00000000, // ICON_REPEAT_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1201 0x00000000, 0x30001000, 0x32107c0e, 0x00801120, 0x11200040, 0x7c0e3210, 0x10003000, 0x00000000, // ICON_SHUFFLE_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1202 0x00000000, 0x30043ffc, 0x24042804, 0x21042204, 0x20442084, 0x20142024, 0x3ffc200c, 0x00000000, // ICON_EMPTYBOX_SMALL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1203 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1204 0x00000000, 0x23c43ffc, 0x23c423c4, 0x200423c4, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1205 0x00000000, 0x3e043ffc, 0x3e043e04, 0x20043e04, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP_RIGHT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1206 0x00000000, 0x20043ffc, 0x20042004, 0x3e043e04, 0x3e043e04, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_RIGHT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1207 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x3e042004, 0x3e043e04, 0x3ffc3e04, 0x00000000, // ICON_BOX_BOTTOM_RIGHT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1208 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x23c42004, 0x23c423c4, 0x3ffc23c4, 0x00000000, // ICON_BOX_BOTTOM |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1209 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x207c2004, 0x207c207c, 0x3ffc207c, 0x00000000, // ICON_BOX_BOTTOM_LEFT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1210 0x00000000, 0x20043ffc, 0x20042004, 0x207c207c, 0x207c207c, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_LEFT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1211 0x00000000, 0x207c3ffc, 0x207c207c, 0x2004207c, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP_LEFT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1212 0x00000000, 0x20043ffc, 0x20042004, 0x23c423c4, 0x23c423c4, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_CENTER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1213 0x7ffe0000, 0x40024002, 0x47e24182, 0x4ff247e2, 0x47e24ff2, 0x418247e2, 0x40024002, 0x00007ffe, // ICON_BOX_CIRCLE_MASK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1214 0x7fff0000, 0x40014001, 0x40014001, 0x49555ddd, 0x4945495d, 0x400149c5, 0x40014001, 0x00007fff, // ICON_POT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1215 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x404e40ce, 0x48125432, 0x4006540e, 0x00007ffe, // ICON_ALPHA_MULTIPLY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1216 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x5c4e40ce, 0x44124432, 0x40065c0e, 0x00007ffe, // ICON_ALPHA_CLEAR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1217 0x7ffe0000, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x00007ffe, // ICON_DITHERING |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1218 0x07fe0000, 0x1ffa0002, 0x7fea000a, 0x402a402a, 0x5b2a512a, 0x5128552a, 0x40205128, 0x00007fe0, // ICON_MIPMAPS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1219 0x00000000, 0x1ff80000, 0x12481248, 0x12481ff8, 0x1ff81248, 0x12481248, 0x00001ff8, 0x00000000, // ICON_BOX_GRID |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1220 0x12480000, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x00001248, // ICON_GRID |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1221 0x00000000, 0x1c380000, 0x1c3817e8, 0x08100810, 0x08100810, 0x17e81c38, 0x00001c38, 0x00000000, // ICON_BOX_CORNERS_SMALL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1222 0x700e0000, 0x700e5ffa, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x5ffa700e, 0x0000700e, // ICON_BOX_CORNERS_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1223 0x3f7e0000, 0x21422142, 0x21422142, 0x00003f7e, 0x21423f7e, 0x21422142, 0x3f7e2142, 0x00000000, // ICON_FOUR_BOXES |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1224 0x00000000, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x00000000, // ICON_GRID_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1225 0x7ffe0000, 0x7ffe7ffe, 0x77fe7000, 0x77fe77fe, 0x777e7700, 0x777e777e, 0x777e777e, 0x0000777e, // ICON_BOX_MULTISIZE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1226 0x781e0000, 0x40024002, 0x00004002, 0x01800000, 0x00000180, 0x40020000, 0x40024002, 0x0000781e, // ICON_ZOOM_SMALL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1227 0x781e0000, 0x40024002, 0x00004002, 0x03c003c0, 0x03c003c0, 0x40020000, 0x40024002, 0x0000781e, // ICON_ZOOM_MEDIUM |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1228 0x781e0000, 0x40024002, 0x07e04002, 0x07e007e0, 0x07e007e0, 0x400207e0, 0x40024002, 0x0000781e, // ICON_ZOOM_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1229 0x781e0000, 0x5ffa4002, 0x1ff85ffa, 0x1ff81ff8, 0x1ff81ff8, 0x5ffa1ff8, 0x40025ffa, 0x0000781e, // ICON_ZOOM_ALL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1230 0x00000000, 0x2004381c, 0x00002004, 0x00000000, 0x00000000, 0x20040000, 0x381c2004, 0x00000000, // ICON_ZOOM_CENTER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1231 0x00000000, 0x1db80000, 0x10081008, 0x10080000, 0x00001008, 0x10081008, 0x00001db8, 0x00000000, // ICON_BOX_DOTS_SMALL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1232 0x35560000, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x35562002, 0x00000000, // ICON_BOX_DOTS_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1233 0x7ffe0000, 0x40024002, 0x48124ff2, 0x49924812, 0x48124992, 0x4ff24812, 0x40024002, 0x00007ffe, // ICON_BOX_CONCENTRIC |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1234 0x00000000, 0x10841ffc, 0x10841084, 0x1ffc1084, 0x10841084, 0x10841084, 0x00001ffc, 0x00000000, // ICON_BOX_GRID_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1235 0x00000000, 0x00000000, 0x10000000, 0x04000800, 0x01040200, 0x00500088, 0x00000020, 0x00000000, // ICON_OK_TICK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1236 0x00000000, 0x10080000, 0x04200810, 0x01800240, 0x02400180, 0x08100420, 0x00001008, 0x00000000, // ICON_CROSS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1237 0x00000000, 0x02000000, 0x00800100, 0x00200040, 0x00200010, 0x00800040, 0x02000100, 0x00000000, // ICON_ARROW_LEFT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1238 0x00000000, 0x00400000, 0x01000080, 0x04000200, 0x04000800, 0x01000200, 0x00400080, 0x00000000, // ICON_ARROW_RIGHT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1239 0x00000000, 0x00000000, 0x00000000, 0x08081004, 0x02200410, 0x00800140, 0x00000000, 0x00000000, // ICON_ARROW_DOWN |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1240 0x00000000, 0x00000000, 0x01400080, 0x04100220, 0x10040808, 0x00000000, 0x00000000, 0x00000000, // ICON_ARROW_UP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1241 0x00000000, 0x02000000, 0x03800300, 0x03e003c0, 0x03e003f0, 0x038003c0, 0x02000300, 0x00000000, // ICON_ARROW_LEFT_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1242 0x00000000, 0x00400000, 0x01c000c0, 0x07c003c0, 0x07c00fc0, 0x01c003c0, 0x004000c0, 0x00000000, // ICON_ARROW_RIGHT_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1243 0x00000000, 0x00000000, 0x00000000, 0x0ff81ffc, 0x03e007f0, 0x008001c0, 0x00000000, 0x00000000, // ICON_ARROW_DOWN_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1244 0x00000000, 0x00000000, 0x01c00080, 0x07f003e0, 0x1ffc0ff8, 0x00000000, 0x00000000, 0x00000000, // ICON_ARROW_UP_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1245 0x00000000, 0x18a008c0, 0x32881290, 0x24822686, 0x26862482, 0x12903288, 0x08c018a0, 0x00000000, // ICON_AUDIO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1246 0x00000000, 0x04800780, 0x004000c0, 0x662000f0, 0x08103c30, 0x130a0e18, 0x0000318e, 0x00000000, // ICON_FX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1247 0x00000000, 0x00800000, 0x08880888, 0x2aaa0a8a, 0x0a8a2aaa, 0x08880888, 0x00000080, 0x00000000, // ICON_WAVE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1248 0x00000000, 0x00600000, 0x01080090, 0x02040108, 0x42044204, 0x24022402, 0x00001800, 0x00000000, // ICON_WAVE_SINUS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1249 0x00000000, 0x07f80000, 0x04080408, 0x04080408, 0x04080408, 0x7c0e0408, 0x00000000, 0x00000000, // ICON_WAVE_SQUARE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1250 0x00000000, 0x00000000, 0x00a00040, 0x22084110, 0x08021404, 0x00000000, 0x00000000, 0x00000000, // ICON_WAVE_TRIANGULAR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1251 0x00000000, 0x00000000, 0x04200000, 0x01800240, 0x02400180, 0x00000420, 0x00000000, 0x00000000, // ICON_CROSS_SMALL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1252 0x00000000, 0x18380000, 0x12281428, 0x10a81128, 0x112810a8, 0x14281228, 0x00001838, 0x00000000, // ICON_PLAYER_PREVIOUS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1253 0x00000000, 0x18000000, 0x11801600, 0x10181060, 0x10601018, 0x16001180, 0x00001800, 0x00000000, // ICON_PLAYER_PLAY_BACK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1254 0x00000000, 0x00180000, 0x01880068, 0x18080608, 0x06081808, 0x00680188, 0x00000018, 0x00000000, // ICON_PLAYER_PLAY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1255 0x00000000, 0x1e780000, 0x12481248, 0x12481248, 0x12481248, 0x12481248, 0x00001e78, 0x00000000, // ICON_PLAYER_PAUSE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1256 0x00000000, 0x1ff80000, 0x10081008, 0x10081008, 0x10081008, 0x10081008, 0x00001ff8, 0x00000000, // ICON_PLAYER_STOP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1257 0x00000000, 0x1c180000, 0x14481428, 0x15081488, 0x14881508, 0x14281448, 0x00001c18, 0x00000000, // ICON_PLAYER_NEXT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1258 0x00000000, 0x03c00000, 0x08100420, 0x10081008, 0x10081008, 0x04200810, 0x000003c0, 0x00000000, // ICON_PLAYER_RECORD |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1259 0x00000000, 0x0c3007e0, 0x13c81818, 0x14281668, 0x14281428, 0x1c381c38, 0x08102244, 0x00000000, // ICON_MAGNET |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1260 0x07c00000, 0x08200820, 0x3ff80820, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // ICON_LOCK_CLOSE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1261 0x07c00000, 0x08000800, 0x3ff80800, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // ICON_LOCK_OPEN |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1262 0x01c00000, 0x0c180770, 0x3086188c, 0x60832082, 0x60034781, 0x30062002, 0x0c18180c, 0x01c00770, // ICON_CLOCK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1263 0x0a200000, 0x1b201b20, 0x04200e20, 0x04200420, 0x04700420, 0x0e700e70, 0x0e700e70, 0x04200e70, // ICON_TOOLS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1264 0x01800000, 0x3bdc318c, 0x0ff01ff8, 0x7c3e1e78, 0x1e787c3e, 0x1ff80ff0, 0x318c3bdc, 0x00000180, // ICON_GEAR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1265 0x01800000, 0x3ffc318c, 0x1c381ff8, 0x781e1818, 0x1818781e, 0x1ff81c38, 0x318c3ffc, 0x00000180, // ICON_GEAR_BIG |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1266 0x00000000, 0x08080ff8, 0x08081ffc, 0x0aa80aa8, 0x0aa80aa8, 0x0aa80aa8, 0x08080aa8, 0x00000ff8, // ICON_BIN |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1267 0x00000000, 0x00000000, 0x20043ffc, 0x08043f84, 0x04040f84, 0x04040784, 0x000007fc, 0x00000000, // ICON_HAND_POINTER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1268 0x00000000, 0x24400400, 0x00001480, 0x6efe0e00, 0x00000e00, 0x24401480, 0x00000400, 0x00000000, // ICON_LASER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1269 0x00000000, 0x03c00000, 0x08300460, 0x11181118, 0x11181118, 0x04600830, 0x000003c0, 0x00000000, // ICON_COIN |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1270 0x00000000, 0x10880080, 0x06c00810, 0x366c07e0, 0x07e00240, 0x00001768, 0x04200240, 0x00000000, // ICON_EXPLOSION |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1271 0x00000000, 0x3d280000, 0x2528252c, 0x3d282528, 0x05280528, 0x05e80528, 0x00000000, 0x00000000, // ICON_1UP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1272 0x01800000, 0x03c003c0, 0x018003c0, 0x0ff007e0, 0x0bd00bd0, 0x0a500bd0, 0x02400240, 0x02400240, // ICON_PLAYER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1273 0x01800000, 0x03c003c0, 0x118013c0, 0x03c81ff8, 0x07c003c8, 0x04400440, 0x0c080478, 0x00000000, // ICON_PLAYER_JUMP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1274 0x3ff80000, 0x30183ff8, 0x30183018, 0x3ff83ff8, 0x03000300, 0x03c003c0, 0x03e00300, 0x000003e0, // ICON_KEY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1275 0x3ff80000, 0x3ff83ff8, 0x33983ff8, 0x3ff83398, 0x3ff83ff8, 0x00000540, 0x0fe00aa0, 0x00000fe0, // ICON_DEMON |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1276 0x00000000, 0x0ff00000, 0x20041008, 0x25442004, 0x10082004, 0x06000bf0, 0x00000300, 0x00000000, // ICON_TEXT_POPUP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1277 0x00000000, 0x11440000, 0x07f00be8, 0x1c1c0e38, 0x1c1c0c18, 0x07f00e38, 0x11440be8, 0x00000000, // ICON_GEAR_EX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1278 0x00000000, 0x20080000, 0x0c601010, 0x07c00fe0, 0x07c007c0, 0x0c600fe0, 0x20081010, 0x00000000, // ICON_CRACK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1279 0x00000000, 0x20080000, 0x0c601010, 0x04400fe0, 0x04405554, 0x0c600fe0, 0x20081010, 0x00000000, // ICON_CRACK_POINTS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1280 0x00000000, 0x00800080, 0x01c001c0, 0x1ffc3ffe, 0x03e007f0, 0x07f003e0, 0x0c180770, 0x00000808, // ICON_STAR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1281 0x0ff00000, 0x08180810, 0x08100818, 0x0a100810, 0x08180810, 0x08100818, 0x08100810, 0x00001ff8, // ICON_DOOR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1282 0x0ff00000, 0x08100810, 0x08100810, 0x10100010, 0x4f902010, 0x10102010, 0x08100010, 0x00000ff0, // ICON_EXIT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1283 0x00040000, 0x001f000e, 0x0ef40004, 0x12f41284, 0x0ef41214, 0x10040004, 0x7ffc3004, 0x10003000, // ICON_MODE_2D |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1284 0x78040000, 0x501f600e, 0x0ef44004, 0x12f41284, 0x0ef41284, 0x10140004, 0x7ffc300c, 0x10003000, // ICON_MODE_3D |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1285 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // ICON_CUBE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1286 0x7fe00000, 0x5ff87ff0, 0x47fe4ffc, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_TOP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1287 0x7fe00000, 0x50386030, 0x47c2483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // ICON_CUBE_FACE_LEFT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1288 0x7fe00000, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // ICON_CUBE_FACE_FRONT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1289 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3bf27be2, 0x0bfe1bfa, 0x000007fe, // ICON_CUBE_FACE_BOTTOM |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1290 0x7fe00000, 0x70286030, 0x7ffe7804, 0x7c227c02, 0x7c227c22, 0x3c127de2, 0x0c061c0a, 0x000007fe, // ICON_CUBE_FACE_RIGHT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1291 0x7fe00000, 0x6fe85ff0, 0x781e77e4, 0x7be27be2, 0x7be27be2, 0x24127be2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_BACK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1292 0x00000000, 0x2a0233fe, 0x22022602, 0x22022202, 0x2a022602, 0x00a033fe, 0x02080110, 0x00000000, // ICON_CAMERA |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1293 0x00000000, 0x200c3ffc, 0x000c000c, 0x3ffc000c, 0x30003000, 0x30003000, 0x3ffc3004, 0x00000000, // ICON_SPECIAL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1294 0x00000000, 0x0022003e, 0x012201e2, 0x0100013e, 0x01000100, 0x79000100, 0x4f004900, 0x00007800, // ICON_LINK_NET |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1295 0x00000000, 0x44007c00, 0x45004600, 0x00627cbe, 0x00620022, 0x45007cbe, 0x44004600, 0x00007c00, // ICON_LINK_BOXES |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1296 0x00000000, 0x0044007c, 0x0010007c, 0x3f100010, 0x3f1021f0, 0x3f100010, 0x3f0021f0, 0x00000000, // ICON_LINK_MULTI |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1297 0x00000000, 0x0044007c, 0x00440044, 0x0010007c, 0x00100010, 0x44107c10, 0x440047f0, 0x00007c00, // ICON_LINK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1298 0x00000000, 0x0044007c, 0x00440044, 0x0000007c, 0x00000010, 0x44007c10, 0x44004550, 0x00007c00, // ICON_LINK_BROKE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1299 0x02a00000, 0x22a43ffc, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // ICON_TEXT_NOTES |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1300 0x3ffc0000, 0x20042004, 0x245e27c4, 0x27c42444, 0x2004201e, 0x201e2004, 0x20042004, 0x00003ffc, // ICON_NOTEBOOK |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1301 0x00000000, 0x07e00000, 0x04200420, 0x24243ffc, 0x24242424, 0x24242424, 0x3ffc2424, 0x00000000, // ICON_SUITCASE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1302 0x00000000, 0x0fe00000, 0x08200820, 0x40047ffc, 0x7ffc5554, 0x40045554, 0x7ffc4004, 0x00000000, // ICON_SUITCASE_ZIP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1303 0x00000000, 0x20043ffc, 0x3ffc2004, 0x13c81008, 0x100813c8, 0x10081008, 0x1ff81008, 0x00000000, // ICON_MAILBOX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1304 0x00000000, 0x40027ffe, 0x5ffa5ffa, 0x5ffa5ffa, 0x40025ffa, 0x03c07ffe, 0x1ff81ff8, 0x00000000, // ICON_MONITOR |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1305 0x0ff00000, 0x6bfe7ffe, 0x7ffe7ffe, 0x68167ffe, 0x08106816, 0x08100810, 0x0ff00810, 0x00000000, // ICON_PRINTER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1306 0x3ff80000, 0xfffe2008, 0x870a8002, 0x904a888a, 0x904a904a, 0x870a888a, 0xfffe8002, 0x00000000, // ICON_PHOTO_CAMERA |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1307 0x0fc00000, 0xfcfe0cd8, 0x8002fffe, 0x84428382, 0x84428442, 0x80028382, 0xfffe8002, 0x00000000, // ICON_PHOTO_CAMERA_FLASH |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1308 0x00000000, 0x02400180, 0x08100420, 0x20041008, 0x23c42004, 0x22442244, 0x3ffc2244, 0x00000000, // ICON_HOUSE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1309 0x00000000, 0x1c700000, 0x3ff83ef8, 0x3ff83ff8, 0x0fe01ff0, 0x038007c0, 0x00000100, 0x00000000, // ICON_HEART |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1310 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0xe000c000, // ICON_CORNER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1311 0x00000000, 0x14001c00, 0x15c01400, 0x15401540, 0x155c1540, 0x15541554, 0x1ddc1554, 0x00000000, // ICON_VERTICAL_BARS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1312 0x00000000, 0x03000300, 0x1b001b00, 0x1b601b60, 0x1b6c1b60, 0x1b6c1b6c, 0x1b6c1b6c, 0x00000000, // ICON_VERTICAL_BARS_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1313 0x00000000, 0x00000000, 0x403e7ffe, 0x7ffe403e, 0x7ffe0000, 0x43fe43fe, 0x00007ffe, 0x00000000, // ICON_LIFE_BARS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1314 0x7ffc0000, 0x43844004, 0x43844284, 0x43844004, 0x42844284, 0x42844284, 0x40044384, 0x00007ffc, // ICON_INFO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1315 0x40008000, 0x10002000, 0x04000800, 0x01000200, 0x00400080, 0x00100020, 0x00040008, 0x00010002, // ICON_CROSSLINE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1316 0x00000000, 0x1ff01ff0, 0x18301830, 0x1f001830, 0x03001f00, 0x00000300, 0x03000300, 0x00000000, // ICON_HELP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1317 0x3ff00000, 0x2abc3550, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x00003ffc, // ICON_FILETYPE_ALPHA |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1318 0x3ff00000, 0x201c2010, 0x22442184, 0x28142424, 0x29942814, 0x2ff42994, 0x20042004, 0x00003ffc, // ICON_FILETYPE_HOME |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1319 0x07fe0000, 0x04020402, 0x7fe20402, 0x44224422, 0x44224422, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_LAYERS_VISIBLE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1320 0x07fe0000, 0x04020402, 0x7c020402, 0x44024402, 0x44024402, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_LAYERS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1321 0x00000000, 0x40027ffe, 0x7ffe4002, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // ICON_WINDOW |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1322 0x09100000, 0x09f00910, 0x09100910, 0x00000910, 0x24a2779e, 0x27a224a2, 0x709e20a2, 0x00000000, // ICON_HIDPI |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1323 0x3ff00000, 0x201c2010, 0x2a842e84, 0x2e842a84, 0x2ba42004, 0x2aa42aa4, 0x20042ba4, 0x00003ffc, // ICON_FILETYPE_BINARY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1324 0x00000000, 0x00000000, 0x00120012, 0x4a5e4bd2, 0x485233d2, 0x00004bd2, 0x00000000, 0x00000000, // ICON_HEX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1325 0x01800000, 0x381c0660, 0x23c42004, 0x23c42044, 0x13c82204, 0x08101008, 0x02400420, 0x00000180, // ICON_SHIELD |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1326 0x007e0000, 0x20023fc2, 0x40227fe2, 0x400a403a, 0x400a400a, 0x400a400a, 0x4008400e, 0x00007ff8, // ICON_FILE_NEW |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1327 0x00000000, 0x0042007e, 0x40027fc2, 0x44024002, 0x5f024402, 0x44024402, 0x7ffe4002, 0x00000000, // ICON_FOLDER_ADD |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1328 0x44220000, 0x12482244, 0xf3cf0000, 0x14280420, 0x48122424, 0x08100810, 0x1ff81008, 0x03c00420, // ICON_ALARM |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1329 0x0aa00000, 0x1ff80aa0, 0x1068700e, 0x1008706e, 0x1008700e, 0x1008700e, 0x0aa01ff8, 0x00000aa0, // ICON_CPU |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1330 0x07e00000, 0x04201db8, 0x04a01c38, 0x04a01d38, 0x04a01d38, 0x04a01d38, 0x04201d38, 0x000007e0, // ICON_ROM |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1331 0x00000000, 0x03c00000, 0x3c382ff0, 0x3c04380c, 0x01800000, 0x03c003c0, 0x00000180, 0x00000000, // ICON_STEP_OVER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1332 0x01800000, 0x01800180, 0x01800180, 0x03c007e0, 0x00000180, 0x01800000, 0x03c003c0, 0x00000180, // ICON_STEP_INTO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1333 0x01800000, 0x07e003c0, 0x01800180, 0x01800180, 0x00000180, 0x01800000, 0x03c003c0, 0x00000180, // ICON_STEP_OUT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1334 0x00000000, 0x0ff003c0, 0x181c1c34, 0x303c301c, 0x30003000, 0x1c301800, 0x03c00ff0, 0x00000000, // ICON_RESTART |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1335 0x00000000, 0x00000000, 0x07e003c0, 0x0ff00ff0, 0x0ff00ff0, 0x03c007e0, 0x00000000, 0x00000000, // ICON_BREAKPOINT_ON |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1336 0x00000000, 0x00000000, 0x042003c0, 0x08100810, 0x08100810, 0x03c00420, 0x00000000, 0x00000000, // ICON_BREAKPOINT_OFF |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1337 0x00000000, 0x00000000, 0x1ff81ff8, 0x1ff80000, 0x00001ff8, 0x1ff81ff8, 0x00000000, 0x00000000, // ICON_BURGER_MENU |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1338 0x00000000, 0x00000000, 0x00880070, 0x0c880088, 0x1e8810f8, 0x3e881288, 0x00000000, 0x00000000, // ICON_CASE_SENSITIVE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1339 0x00000000, 0x02000000, 0x07000a80, 0x07001fc0, 0x02000a80, 0x00300030, 0x00000000, 0x00000000, // ICON_REG_EXP |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1340 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // ICON_FOLDER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1341 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x00003ffc, // ICON_FILE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1342 0x1ff00000, 0x20082008, 0x17d02fe8, 0x05400ba0, 0x09200540, 0x23881010, 0x2fe827c8, 0x00001ff0, // ICON_SAND_TIMER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1343 0x01800000, 0x02400240, 0x05a00420, 0x09900990, 0x11881188, 0x21842004, 0x40024182, 0x00003ffc, // ICON_WARNING |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1344 0x7ffe0000, 0x4ff24002, 0x4c324ff2, 0x4f824c02, 0x41824f82, 0x41824002, 0x40024182, 0x00007ffe, // ICON_HELP_BOX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1345 0x7ffe0000, 0x41824002, 0x40024182, 0x41824182, 0x41824182, 0x41824182, 0x40024182, 0x00007ffe, // ICON_INFO_BOX |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1346 0x01800000, 0x04200240, 0x10080810, 0x7bde2004, 0x0a500a50, 0x08500bd0, 0x08100850, 0x00000ff0, // ICON_PRIORITY |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1347 0x01800000, 0x18180660, 0x80016006, 0x98196006, 0x99996666, 0x19986666, 0x01800660, 0x00000000, // ICON_LAYERS_ISO |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1348 0x07fe0000, 0x1c020402, 0x74021402, 0x54025402, 0x54025402, 0x500857fe, 0x40205ff8, 0x00007fe0, // ICON_LAYERS2 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1349 0x0ffe0000, 0x3ffa0802, 0x7fea200a, 0x402a402a, 0x422a422a, 0x422e422a, 0x40384e28, 0x00007fe0, // ICON_MLAYERS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1350 0x0ffe0000, 0x3ffa0802, 0x7fea200a, 0x402a402a, 0x5b2a512a, 0x512e552a, 0x40385128, 0x00007fe0, // ICON_MAPS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1351 0x04200000, 0x1cf00c60, 0x11f019f0, 0x0f3807b8, 0x1e3c0f3c, 0x1c1c1e1c, 0x1e3c1c1c, 0x00000f70, // ICON_HOT |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1352 0x00000000, 0x20803f00, 0x2a202e40, 0x20082e10, 0x08021004, 0x02040402, 0x00900108, 0x00000060, // ICON_LABEL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1353 0x00000000, 0x042007e0, 0x47e27c3e, 0x4ffa4002, 0x47fa4002, 0x4ffa4002, 0x7ffe4002, 0x00000000, // ICON_NAME_ID |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1354 0x7fe00000, 0x402e4020, 0x43ce5e0a, 0x40504078, 0x438e4078, 0x402e5e0a, 0x7fe04020, 0x00000000, // ICON_SLICING |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1355 0x00000000, 0x40027ffe, 0x47c24002, 0x55425d42, 0x55725542, 0x50125552, 0x10105016, 0x00001ff0, // ICON_MANUAL_CONTROL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1356 0x7ffe0000, 0x43c24002, 0x48124422, 0x500a500a, 0x500a500a, 0x44224812, 0x400243c2, 0x00007ffe, // ICON_COLLISION |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1357 0x03c00000, 0x10080c30, 0x21842184, 0x4ff24182, 0x41824ff2, 0x21842184, 0x0c301008, 0x000003c0, // ICON_CIRCLE_ADD |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1358 0x03c00000, 0x1ff80ff0, 0x3e7c3e7c, 0x700e7e7e, 0x7e7e700e, 0x3e7c3e7c, 0x0ff01ff8, 0x000003c0, // ICON_CIRCLE_ADD_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1359 0x03c00000, 0x10080c30, 0x21842184, 0x41824182, 0x40024182, 0x21842184, 0x0c301008, 0x000003c0, // ICON_CIRCLE_WARNING |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1360 0x03c00000, 0x1ff80ff0, 0x3e7c3e7c, 0x7e7e7e7e, 0x7ffe7e7e, 0x3e7c3e7c, 0x0ff01ff8, 0x000003c0, // ICON_CIRCLE_WARNING_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1361 0x00000000, 0x10041ffc, 0x10841004, 0x13e41084, 0x10841084, 0x10041004, 0x00001ffc, 0x00000000, // ICON_BOX_MORE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1362 0x00000000, 0x1ffc1ffc, 0x1f7c1ffc, 0x1c1c1f7c, 0x1f7c1f7c, 0x1ffc1ffc, 0x00001ffc, 0x00000000, // ICON_BOX_MORE_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1363 0x00000000, 0x1ffc1ffc, 0x1ffc1ffc, 0x1c1c1ffc, 0x1ffc1ffc, 0x1ffc1ffc, 0x00001ffc, 0x00000000, // ICON_BOX_MINUS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1364 0x00000000, 0x10041ffc, 0x10041004, 0x13e41004, 0x10041004, 0x10041004, 0x00001ffc, 0x00000000, // ICON_BOX_MINUS_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1365 0x07fe0000, 0x055606aa, 0x7ff606aa, 0x55766eba, 0x55766eaa, 0x55606ffe, 0x55606aa0, 0x00007fe0, // ICON_UNION |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1366 0x07fe0000, 0x04020402, 0x7fe20402, 0x456246a2, 0x456246a2, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_INTERSECTION |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1367 0x07fe0000, 0x055606aa, 0x7ff606aa, 0x4436442a, 0x4436442a, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_DIFFERENCE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1368 0x03c00000, 0x10080c30, 0x20042004, 0x60064002, 0x47e2581a, 0x20042004, 0x0c301008, 0x000003c0, // ICON_SPHERE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1369 0x03e00000, 0x08080410, 0x0c180808, 0x08080be8, 0x08080808, 0x08080808, 0x04100808, 0x000003e0, // ICON_CYLINDER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1370 0x00800000, 0x01400140, 0x02200220, 0x04100410, 0x08080808, 0x1c1c13e4, 0x08081004, 0x000007f0, // ICON_CONE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1371 0x00000000, 0x07e00000, 0x20841918, 0x40824082, 0x40824082, 0x19182084, 0x000007e0, 0x00000000, // ICON_ELLIPSOID |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1372 0x00000000, 0x00000000, 0x20041ff8, 0x40024002, 0x40024002, 0x1ff82004, 0x00000000, 0x00000000, // ICON_CAPSULE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1373 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_250 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1374 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_251 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1375 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_252 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1376 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_253 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1377 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_254 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1378 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_255 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1379 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1380 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1381 // NOTE: A pointer to current icons array should be defined |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1382 static unsigned int *guiIconsPtr = guiIcons; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1383 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1384 #endif // !RAYGUI_NO_ICONS && !RAYGUI_CUSTOM_ICONS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1385 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1386 #ifndef RAYGUI_ICON_SIZE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1387 #define RAYGUI_ICON_SIZE 0 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1388 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1389 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1390 // WARNING: Those values define the total size of the style data array, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1391 // if changed, previous saved styles could become incompatible |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1392 #define RAYGUI_MAX_CONTROLS 16 // Maximum number of controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1393 #define RAYGUI_MAX_PROPS_BASE 16 // Maximum number of base properties |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1394 #define RAYGUI_MAX_PROPS_EXTENDED 8 // Maximum number of extended properties |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1395 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1396 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1397 // Module Types and Structures Definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1398 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1399 // Gui control property style color element |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1400 typedef enum { BORDER = 0, BASE, TEXT, OTHER } GuiPropertyElement; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1401 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1402 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1403 // Global Variables Definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1404 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1405 static GuiState guiState = STATE_NORMAL; // Gui global state, if !STATE_NORMAL, forces defined state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1406 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1407 static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1408 static bool guiLocked = false; // Gui lock state (no inputs processed) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1409 static float guiAlpha = 1.0f; // Gui controls transparency |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1410 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1411 static unsigned int guiIconScale = 1; // Gui icon default scale (if icons enabled) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1412 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1413 static bool guiTooltip = false; // Tooltip enabled/disabled |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1414 static const char *guiTooltipPtr = NULL; // Tooltip string pointer (string provided by user) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1415 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1416 static bool guiControlExclusiveMode = false; // Gui control exclusive mode (no inputs processed except current control) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1417 static Rectangle guiControlExclusiveRec = { 0 }; // Gui control exclusive bounds rectangle, used as an unique identifier |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1418 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1419 static int textBoxCursorIndex = 0; // Cursor index, shared by all GuiTextBox*() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1420 //static int blinkCursorFrameCounter = 0; // Frame counter for cursor blinking |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1421 static int autoCursorCounter = 0; // Frame counter for automatic repeated cursor movement on key-down (cooldown and delay) |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
1422 static int textBoxSelectionStart = -1; // Selection start index (-1 if no selection) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
1423 static int textBoxSelectionEnd = -1; // Selection end index (-1 if no selection) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
1424 static bool textBoxSelecting = false; // Currently selecting with mouse |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1425 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1426 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1427 // Style data array for all gui style properties (allocated on data segment by default) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1428 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1429 // NOTE 1: First set of BASE properties are generic to all controls but could be individually |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1430 // overwritten per control, first set of EXTENDED properties are generic to all controls and |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1431 // can not be overwritten individually but custom EXTENDED properties can be used by control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1432 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1433 // NOTE 2: A new style set could be loaded over this array using GuiLoadStyle(), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1434 // but default gui style could always be recovered with GuiLoadStyleDefault() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1435 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1436 // guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1437 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1438 static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1439 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1440 static bool guiStyleLoaded = false; // Style loaded flag for lazy style initialization |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1441 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1442 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1443 // Standalone Mode Functions Declaration |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1444 // |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1445 // NOTE: raygui depend on some raylib input and drawing functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1446 // To use raygui as standalone library, below functions must be defined by the user |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1447 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1448 #if defined(RAYGUI_STANDALONE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1449 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1450 #define KEY_RIGHT 262 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1451 #define KEY_LEFT 263 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1452 #define KEY_DOWN 264 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1453 #define KEY_UP 265 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1454 #define KEY_BACKSPACE 259 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1455 #define KEY_ENTER 257 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1456 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1457 #define MOUSE_LEFT_BUTTON 0 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1458 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1459 // Input required functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1460 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1461 static Vector2 GetMousePosition(void); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1462 static float GetMouseWheelMove(void); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1463 static bool IsMouseButtonDown(int button); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1464 static bool IsMouseButtonPressed(int button); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1465 static bool IsMouseButtonReleased(int button); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1466 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1467 static bool IsKeyDown(int key); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1468 static bool IsKeyPressed(int key); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1469 static int GetCharPressed(void); // -- GuiTextBox(), GuiValueBox() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1470 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1471 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1472 // Drawing required functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1473 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1474 static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1475 static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1476 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1477 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1478 // Text required functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1479 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1480 static Font GetFontDefault(void); // -- GuiLoadStyleDefault() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1481 static Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle(), load font |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1482 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1483 static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1484 static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1485 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1486 static char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1487 static void UnloadFileText(char *text); // -- GuiLoadStyle(), required to unload charset data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1488 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1489 static const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle(), required to find charset/font file from text .rgs |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1490 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1491 static int *LoadCodepoints(const char *text, int *count); // -- GuiLoadStyle(), required to load required font codepoints list |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1492 static void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(), required to unload codepoints list |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1493 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1494 static unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1495 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1496 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1497 // raylib functions already implemented in raygui |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1498 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1499 static Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1500 static int ColorToInt(Color color); // Returns hexadecimal value for a Color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1501 static bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1502 static const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed' |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1503 static const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1504 static int TextToInteger(const char *text); // Get integer value from text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1505 static float TextToFloat(const char *text); // Get float value from text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1506 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1507 static int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1508 static const char *CodepointToUTF8(int codepoint, int *byteSize); // Encode codepoint into UTF-8 text (char array size returned as parameter) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1509 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1510 static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); // Draw rectangle vertical gradient |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1511 //------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1512 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1513 #endif // RAYGUI_STANDALONE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1514 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1515 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1516 // Module Internal Functions Declaration |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1517 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1518 static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize); // Load style from memory (binary only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1519 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1520 static Rectangle GetTextBounds(int control, Rectangle bounds); // Get text bounds considering control bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1521 static const char *GetTextIcon(const char *text, int *iconId); // Get text icon if provided and move text cursor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1522 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1523 static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, Color tint); // Gui draw text using default font |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1524 static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color); // Gui draw rectangle using default raygui style |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1525 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1526 static const char **GuiTextSplit(const char *text, char delimiter, int *count, int *textRow); // Split controls text into multiple strings |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1527 static Vector3 ConvertHSVtoRGB(Vector3 hsv); // Convert color data from HSV to RGB |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1528 static Vector3 ConvertRGBtoHSV(Vector3 rgb); // Convert color data from RGB to HSV |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1529 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1530 static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll bar control, used by GuiScrollPanel() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1531 static void GuiTooltip(Rectangle controlRec); // Draw tooltip using control rec position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1532 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1533 static Color GuiFade(Color color, float alpha); // Fade color by an alpha factor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1534 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1535 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1536 // Gui Setup Functions Definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1537 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1538 // Enable gui global state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1539 // NOTE: We check for STATE_DISABLED to avoid messing custom global state setups |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1540 void GuiEnable(void) { if (guiState == STATE_DISABLED) guiState = STATE_NORMAL; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1541 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1542 // Disable gui global state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1543 // NOTE: We check for STATE_NORMAL to avoid messing custom global state setups |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1544 void GuiDisable(void) { if (guiState == STATE_NORMAL) guiState = STATE_DISABLED; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1545 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1546 // Lock gui global state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1547 void GuiLock(void) { guiLocked = true; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1548 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1549 // Unlock gui global state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1550 void GuiUnlock(void) { guiLocked = false; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1551 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1552 // Check if gui is locked (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1553 bool GuiIsLocked(void) { return guiLocked; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1554 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1555 // Set gui controls alpha global state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1556 void GuiSetAlpha(float alpha) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1557 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1558 if (alpha < 0.0f) alpha = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1559 else if (alpha > 1.0f) alpha = 1.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1560 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1561 guiAlpha = alpha; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1562 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1563 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1564 // Set gui state (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1565 void GuiSetState(int state) { guiState = (GuiState)state; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1566 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1567 // Get gui state (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1568 int GuiGetState(void) { return guiState; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1569 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1570 // Set custom gui font |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1571 // NOTE: Font loading/unloading is external to raygui |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1572 void GuiSetFont(Font font) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1573 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1574 if (font.texture.id > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1575 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1576 // NOTE: If we try to setup a font but default style has not been |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1577 // lazily loaded before, it will be overwritten, so we need to force |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1578 // default style loading first |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1579 if (!guiStyleLoaded) GuiLoadStyleDefault(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1580 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1581 guiFont = font; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1582 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1583 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1584 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1585 // Get custom gui font |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1586 Font GuiGetFont(void) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1587 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1588 return guiFont; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1589 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1590 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1591 // Set control style property value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1592 void GuiSetStyle(int control, int property, int value) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1593 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1594 if (!guiStyleLoaded) GuiLoadStyleDefault(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1595 guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1596 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1597 // Default properties are propagated to all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1598 if ((control == 0) && (property < RAYGUI_MAX_PROPS_BASE)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1599 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1600 for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) guiStyle[i*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1601 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1602 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1603 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1604 // Get control style property value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1605 int GuiGetStyle(int control, int property) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1606 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1607 if (!guiStyleLoaded) GuiLoadStyleDefault(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1608 return guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1609 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1610 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1611 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1612 // Gui Controls Functions Definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1613 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1614 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1615 // Window Box control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1616 int GuiWindowBox(Rectangle bounds, const char *title) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1617 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1618 // Window title bar height (including borders) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1619 // NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1620 #if !defined(RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1621 #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1622 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1623 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1624 #if !defined(RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1625 #define RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT 18 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1626 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1627 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1628 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1629 //GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1630 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1631 int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1632 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1633 Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1634 if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1635 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1636 const float vPadding = statusBarHeight/2.0f - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT/2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1637 Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight + 1 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1638 Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT - vPadding, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1639 statusBar.y + vPadding, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT, RAYGUI_WINDOWBOX_CLOSEBUTTON_HEIGHT }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1640 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1641 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1642 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1643 // NOTE: Logic is directly managed by button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1644 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1645 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1646 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1647 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1648 GuiStatusBar(statusBar, title); // Draw window header as status bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1649 GuiPanel(windowPanel, NULL); // Draw window base |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1650 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1651 // Draw window close button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1652 int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1653 int tempTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1654 GuiSetStyle(BUTTON, BORDER_WIDTH, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1655 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1656 #if defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1657 result = GuiButton(closeButtonRec, "x"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1658 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1659 result = GuiButton(closeButtonRec, GuiIconText(ICON_CROSS_SMALL, NULL)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1660 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1661 GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1662 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1663 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1664 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1665 return result; // Window close button clicked: result = 1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1666 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1667 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1668 // Group Box control with text name |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1669 int GuiGroupBox(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1670 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1671 #if !defined(RAYGUI_GROUPBOX_LINE_THICK) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1672 #define RAYGUI_GROUPBOX_LINE_THICK 1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1673 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1674 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1675 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1676 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1677 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1678 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1679 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1680 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1681 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, RAYGUI_GROUPBOX_LINE_THICK }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1682 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1683 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1684 GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y - GuiGetStyle(DEFAULT, TEXT_SIZE)/2, bounds.width, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) }, text); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1685 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1686 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1687 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1688 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1689 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1690 // Line control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1691 int GuiLine(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1692 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1693 #if !defined(RAYGUI_LINE_MARGIN_TEXT) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1694 #define RAYGUI_LINE_MARGIN_TEXT 12 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1695 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1696 #if !defined(RAYGUI_LINE_TEXT_PADDING) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1697 #define RAYGUI_LINE_TEXT_PADDING 4 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1698 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1699 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1700 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1701 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1702 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1703 Color color = GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1704 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1705 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1706 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1707 if (text == NULL) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, bounds.width, 1 }, 0, BLANK, color); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1708 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1709 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1710 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1711 textBounds.width = (float)GuiGetTextWidth(text) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1712 textBounds.height = bounds.height; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1713 textBounds.x = bounds.x + RAYGUI_LINE_MARGIN_TEXT; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1714 textBounds.y = bounds.y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1715 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1716 // Draw line with embedded text label: "--- text --------------" |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1717 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, RAYGUI_LINE_MARGIN_TEXT - RAYGUI_LINE_TEXT_PADDING, 1 }, 0, BLANK, color); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1718 GuiDrawText(text, textBounds, TEXT_ALIGN_LEFT, color); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1719 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + 12 + textBounds.width + 4, bounds.y + bounds.height/2, bounds.width - textBounds.width - RAYGUI_LINE_MARGIN_TEXT - RAYGUI_LINE_TEXT_PADDING, 1 }, 0, BLANK, color); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1720 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1721 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1722 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1723 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1724 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1725 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1726 // Panel control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1727 int GuiPanel(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1728 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1729 #if !defined(RAYGUI_PANEL_BORDER_WIDTH) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1730 #define RAYGUI_PANEL_BORDER_WIDTH 1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1731 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1732 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1733 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1734 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1735 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1736 // Text will be drawn as a header bar (if provided) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1737 Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1738 if ((text != NULL) && (bounds.height < RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f)) bounds.height = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1739 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1740 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1741 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1742 // Move panel bounds after the header bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1743 bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1744 bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1745 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1746 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1747 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1748 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1749 if (text != NULL) GuiStatusBar(statusBar, text); // Draw panel header as status bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1750 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1751 GuiDrawRectangle(bounds, RAYGUI_PANEL_BORDER_WIDTH, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR)), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1752 GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BASE_COLOR_DISABLED : (int)BACKGROUND_COLOR))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1753 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1754 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1755 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1756 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1757 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1758 // Tab Bar control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1759 // NOTE: Using GuiToggle() for the TABS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1760 int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1761 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1762 #define RAYGUI_TABBAR_ITEM_WIDTH 148 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1763 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1764 int result = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1765 //GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1766 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1767 Rectangle tabBounds = { bounds.x, bounds.y, RAYGUI_TABBAR_ITEM_WIDTH, bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1768 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1769 if (*active < 0) *active = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1770 else if (*active > count - 1) *active = count - 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1771 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1772 int offsetX = 0; // Required in case tabs go out of screen |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1773 offsetX = (*active + 2)*RAYGUI_TABBAR_ITEM_WIDTH - GetScreenWidth(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1774 if (offsetX < 0) offsetX = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1775 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1776 bool toggle = false; // Required for individual toggles |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1777 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1778 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1779 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1780 for (int i = 0; i < count; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1781 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1782 tabBounds.x = bounds.x + (RAYGUI_TABBAR_ITEM_WIDTH + 4)*i - offsetX; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1783 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1784 if (tabBounds.x < GetScreenWidth()) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1785 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1786 // Draw tabs as toggle controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1787 int textAlignment = GuiGetStyle(TOGGLE, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1788 int textPadding = GuiGetStyle(TOGGLE, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1789 GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1790 GuiSetStyle(TOGGLE, TEXT_PADDING, 8); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1791 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1792 if (i == (*active)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1793 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1794 toggle = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1795 GuiToggle(tabBounds, text[i], &toggle); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1796 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1797 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1798 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1799 toggle = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1800 GuiToggle(tabBounds, text[i], &toggle); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1801 if (toggle) *active = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1802 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1803 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1804 // Close tab with middle mouse button pressed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1805 if (CheckCollisionPointRec(GetMousePosition(), tabBounds) && IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) result = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1806 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1807 GuiSetStyle(TOGGLE, TEXT_PADDING, textPadding); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1808 GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, textAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1809 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1810 // Draw tab close button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1811 // NOTE: Only draw close button for current tab: if (CheckCollisionPointRec(mousePosition, tabBounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1812 int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1813 int tempTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1814 GuiSetStyle(BUTTON, BORDER_WIDTH, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1815 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1816 #if defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1817 if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, "x")) result = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1818 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1819 if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, GuiIconText(ICON_CROSS_SMALL, NULL))) result = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1820 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1821 GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1822 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1823 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1824 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1825 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1826 // Draw tab-bar bottom line |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1827 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, 1 }, 0, BLANK, GetColor(GuiGetStyle(TOGGLE, BORDER_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1828 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1829 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1830 return result; // Return as result the current TAB closing requested |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1831 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1832 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1833 // Scroll Panel control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1834 int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1835 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1836 #define RAYGUI_MIN_SCROLLBAR_WIDTH 40 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1837 #define RAYGUI_MIN_SCROLLBAR_HEIGHT 40 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1838 #define RAYGUI_MIN_MOUSE_WHEEL_SPEED 20 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1839 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1840 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1841 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1842 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1843 Rectangle temp = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1844 if (view == NULL) view = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1845 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1846 Vector2 scrollPos = { 0.0f, 0.0f }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1847 if (scroll != NULL) scrollPos = *scroll; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1848 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1849 // Text will be drawn as a header bar (if provided) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1850 Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1851 if (bounds.height < RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f) bounds.height = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1852 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1853 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1854 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1855 // Move panel bounds after the header bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1856 bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1857 bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1858 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1859 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1860 bool hasHorizontalScrollBar = (content.width > bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1861 bool hasVerticalScrollBar = (content.height > bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1862 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1863 // Recheck to account for the other scrollbar being visible |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1864 if (!hasHorizontalScrollBar) hasHorizontalScrollBar = (hasVerticalScrollBar && (content.width > (bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1865 if (!hasVerticalScrollBar) hasVerticalScrollBar = (hasHorizontalScrollBar && (content.height > (bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1866 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1867 int horizontalScrollBarWidth = hasHorizontalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1868 int verticalScrollBarWidth = hasVerticalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1869 Rectangle horizontalScrollBar = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1870 (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + verticalScrollBarWidth : (float)bounds.x) + GuiGetStyle(DEFAULT, BORDER_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1871 (float)bounds.y + bounds.height - horizontalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1872 (float)bounds.width - verticalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1873 (float)horizontalScrollBarWidth |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1874 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1875 Rectangle verticalScrollBar = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1876 (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)bounds.x + bounds.width - verticalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH)), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1877 (float)bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1878 (float)verticalScrollBarWidth, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1879 (float)bounds.height - horizontalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1880 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1881 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1882 // Make sure scroll bars have a minimum width/height |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1883 if (horizontalScrollBar.width < RAYGUI_MIN_SCROLLBAR_WIDTH) horizontalScrollBar.width = RAYGUI_MIN_SCROLLBAR_WIDTH; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1884 if (verticalScrollBar.height < RAYGUI_MIN_SCROLLBAR_HEIGHT) verticalScrollBar.height = RAYGUI_MIN_SCROLLBAR_HEIGHT; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1885 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1886 // Calculate view area (area without the scrollbars) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1887 *view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1888 RAYGUI_CLITERAL(Rectangle){ bounds.x + verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth } : |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1889 RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1890 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1891 // Clip view area to the actual content size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1892 if (view->width > content.width) view->width = content.width; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1893 if (view->height > content.height) view->height = content.height; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1894 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1895 float horizontalMin = hasHorizontalScrollBar? ((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1896 float horizontalMax = hasHorizontalScrollBar? content.width - bounds.width + (float)verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH) - (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)verticalScrollBarWidth : 0) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1897 float verticalMin = hasVerticalScrollBar? 0.0f : -1.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1898 float verticalMax = hasVerticalScrollBar? content.height - bounds.height + (float)horizontalScrollBarWidth + (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1899 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1900 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1901 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1902 if ((state != STATE_DISABLED) && !guiLocked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1903 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1904 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1905 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1906 // Check button state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1907 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1908 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1909 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1910 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1911 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1912 #if defined(SUPPORT_SCROLLBAR_KEY_INPUT) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1913 if (hasHorizontalScrollBar) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1914 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1915 if (IsKeyDown(KEY_RIGHT)) scrollPos.x -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1916 if (IsKeyDown(KEY_LEFT)) scrollPos.x += GuiGetStyle(SCROLLBAR, SCROLL_SPEED); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1917 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1918 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1919 if (hasVerticalScrollBar) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1920 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1921 if (IsKeyDown(KEY_DOWN)) scrollPos.y -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1922 if (IsKeyDown(KEY_UP)) scrollPos.y += GuiGetStyle(SCROLLBAR, SCROLL_SPEED); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1923 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1924 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1925 float wheelMove = GetMouseWheelMove(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1926 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1927 // Set scrolling speed with mouse wheel based on ratio between bounds and content |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1928 Vector2 mouseWheelSpeed = { content.width/bounds.width, content.height/bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1929 if (mouseWheelSpeed.x < RAYGUI_MIN_MOUSE_WHEEL_SPEED) mouseWheelSpeed.x = RAYGUI_MIN_MOUSE_WHEEL_SPEED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1930 if (mouseWheelSpeed.y < RAYGUI_MIN_MOUSE_WHEEL_SPEED) mouseWheelSpeed.y = RAYGUI_MIN_MOUSE_WHEEL_SPEED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1931 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1932 // Horizontal and vertical scrolling with mouse wheel |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1933 if (hasHorizontalScrollBar && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_LEFT_SHIFT))) scrollPos.x += wheelMove*mouseWheelSpeed.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1934 else scrollPos.y += wheelMove*mouseWheelSpeed.y; // Vertical scroll |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1935 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1936 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1937 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1938 // Normalize scroll values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1939 if (scrollPos.x > -horizontalMin) scrollPos.x = -horizontalMin; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1940 if (scrollPos.x < -horizontalMax) scrollPos.x = -horizontalMax; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1941 if (scrollPos.y > -verticalMin) scrollPos.y = -verticalMin; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1942 if (scrollPos.y < -verticalMax) scrollPos.y = -verticalMax; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1943 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1944 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1945 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1946 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1947 if (text != NULL) GuiStatusBar(statusBar, text); // Draw panel header as status bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1948 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1949 GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1950 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1951 // Save size of the scrollbar slider |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1952 const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1953 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1954 // Draw horizontal scrollbar if visible |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1955 if (hasHorizontalScrollBar) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1956 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1957 // Change scrollbar slider size to show the diff in size between the content width and the widget width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1958 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth)/(int)content.width)*((int)bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1959 scrollPos.x = (float)-GuiScrollBar(horizontalScrollBar, (int)-scrollPos.x, (int)horizontalMin, (int)horizontalMax); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1960 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1961 else scrollPos.x = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1962 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1963 // Draw vertical scrollbar if visible |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1964 if (hasVerticalScrollBar) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1965 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1966 // Change scrollbar slider size to show the diff in size between the content height and the widget height |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1967 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth)/(int)content.height)*((int)bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1968 scrollPos.y = (float)-GuiScrollBar(verticalScrollBar, (int)-scrollPos.y, (int)verticalMin, (int)verticalMax); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1969 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1970 else scrollPos.y = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1971 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1972 // Draw detail corner rectangle if both scroll bars are visible |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1973 if (hasHorizontalScrollBar && hasVerticalScrollBar) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1974 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1975 Rectangle corner = { (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) + 2) : (horizontalScrollBar.x + horizontalScrollBar.width + 2), verticalScrollBar.y + verticalScrollBar.height + 2, (float)horizontalScrollBarWidth - 4, (float)verticalScrollBarWidth - 4 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1976 GuiDrawRectangle(corner, 0, BLANK, GetColor(GuiGetStyle(LISTVIEW, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1977 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1978 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1979 // Draw scrollbar lines depending on current state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1980 GuiDrawRectangle(bounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), BLANK); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1981 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1982 // Set scrollbar slider size back to the way it was before |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1983 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, slider); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1984 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1985 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1986 if (scroll != NULL) *scroll = scrollPos; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1987 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1988 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1989 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1990 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1991 // Label control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1992 int GuiLabel(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1993 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1994 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1995 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1996 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1997 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1998 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1999 //... |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2000 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2001 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2002 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2003 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2004 GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2005 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2006 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2007 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2008 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2009 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2010 // Button control, returns true when clicked |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2011 int GuiButton(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2012 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2013 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2014 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2015 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2016 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2017 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2018 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2019 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2020 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2021 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2022 // Check button state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2023 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2024 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2025 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2026 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2027 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2028 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2029 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2030 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2031 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2032 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2033 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2034 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2035 GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), GetColor(GuiGetStyle(BUTTON, BASE + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2036 GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), GetColor(GuiGetStyle(BUTTON, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2037 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2038 if (state == STATE_FOCUSED) GuiTooltip(bounds); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2039 //------------------------------------------------------------------ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2040 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2041 return result; // Button pressed: result = 1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2042 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2043 |
|
161
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2044 // JUNE |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2045 int GuiButtonRounded(Rectangle bounds, const char *text, float roundness, int segments) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2046 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2047 int result = 0; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2048 GuiState state = guiState; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2049 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2050 // Update control |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2051 //-------------------------------------------------------------------- |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2052 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2053 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2054 Vector2 mousePoint = GetMousePosition(); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2055 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2056 // Check button state |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2057 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2058 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2059 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2060 else state = STATE_FOCUSED; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2061 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2062 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2063 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2064 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2065 //-------------------------------------------------------------------- |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2066 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2067 // Draw control |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2068 //-------------------------------------------------------------------- |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2069 DrawRectangleRounded(bounds, roundness, segments, GetColor(GuiGetStyle(BUTTON, BASE + (state*3)))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2070 GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), GetColor(GuiGetStyle(BUTTON, TEXT + (state*3)))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2071 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2072 if (state == STATE_FOCUSED) GuiTooltip(bounds); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2073 //------------------------------------------------------------------ |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2074 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2075 return result; // Button pressed: result = 1 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2076 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2077 |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2078 // Label button control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2079 int GuiLabelButton(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2080 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2081 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2082 bool pressed = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2083 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2084 // NOTE: We force bounds.width to be all text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2085 float textWidth = (float)GuiGetTextWidth(text); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2086 if ((bounds.width - 2*GuiGetStyle(LABEL, BORDER_WIDTH) - 2*GuiGetStyle(LABEL, TEXT_PADDING)) < textWidth) bounds.width = textWidth + 2*GuiGetStyle(LABEL, BORDER_WIDTH) + 2*GuiGetStyle(LABEL, TEXT_PADDING) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2087 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2088 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2089 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2090 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2091 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2092 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2093 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2094 // Check checkbox state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2095 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2096 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2097 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2098 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2099 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2100 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2101 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2102 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2103 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2104 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2105 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2106 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2107 GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2108 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2109 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2110 return pressed; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2111 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2112 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2113 // Toggle Button control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2114 int GuiToggle(Rectangle bounds, const char *text, bool *active) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2115 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2116 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2117 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2118 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2119 bool temp = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2120 if (active == NULL) active = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2121 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2122 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2123 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2124 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2125 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2126 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2127 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2128 // Check toggle button state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2129 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2130 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2131 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2132 else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2133 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2134 state = STATE_NORMAL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2135 *active = !(*active); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2136 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2137 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2138 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2139 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2140 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2141 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2142 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2143 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2144 if (state == STATE_NORMAL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2145 { |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2146 if (*active) |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2147 { |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2148 Rectangle tmp = bounds; |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2149 tmp.height += GuiGetStyle(TOGGLE, BORDER_WIDTH); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2150 GuiDrawRectangle( |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2151 tmp, |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2152 0, |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2153 GetColor(GuiGetStyle(TOGGLE, ((*active)? BORDER_COLOR_PRESSED : (BORDER + state*3)))), |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2154 GetColor(GuiGetStyle(TOGGLE, ((*active)? BASE_COLOR_PRESSED : (BASE + state*3)))) |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2155 ); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2156 JUNE_DrawRectangleLinesNoBottom( |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2157 bounds, |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2158 GuiGetStyle(TOGGLE, BORDER_WIDTH), |
|
118
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2159 GetColor(GuiGetStyle(TOGGLE, ((*active)? BORDER_COLOR_PRESSED : (BORDER + state*3)))) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2160 ); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2161 } |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2162 else |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2163 { |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2164 GuiDrawRectangle( |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2165 bounds, |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2166 GuiGetStyle(TOGGLE, BORDER_WIDTH), |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2167 GetColor(GuiGetStyle(TOGGLE, ((*active)? BORDER_COLOR_PRESSED : (BORDER + state*3)))), |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2168 GetColor(GuiGetStyle(TOGGLE, ((*active)? BASE_COLOR_PRESSED : (BASE + state*3)))) |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2169 ); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2170 } |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2171 GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TOGGLE, ((*active)? TEXT_COLOR_PRESSED : (TEXT + state*3))))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2172 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2173 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2174 { |
|
118
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2175 Rectangle tmp = bounds; |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2176 tmp.height += GuiGetStyle(TOGGLE, BORDER_WIDTH); |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2177 if (*active) |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2178 { |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2179 GuiDrawRectangle( |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2180 tmp, |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2181 0, |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2182 GetColor(GuiGetStyle(TOGGLE, ((*active)? BORDER_COLOR_PRESSED : (BORDER + state*3)))), |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2183 GetColor(GuiGetStyle(TOGGLE, ((*active)? BASE_COLOR_PRESSED : (BASE + state*3)))) |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2184 ); |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2185 JUNE_DrawRectangleLinesNoBottom( |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2186 bounds, |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2187 GuiGetStyle(TOGGLE, BORDER_WIDTH), |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2188 GetColor(GuiGetStyle(TOGGLE, ((*active)? BORDER_COLOR_PRESSED : (BORDER + state*3)))) |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2189 ); |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2190 } |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2191 else |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2192 { |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2193 GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, BORDER + state*3)), GetColor(GuiGetStyle(TOGGLE, BASE + state*3))); |
|
249881ceff7b
[PostDog] Updated some core logic. Will create a bookmark for postdog until the launch as this is annoying to deal with.
June Park <parkjune1995@gmail.com>
parents:
116
diff
changeset
|
2194 } |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2195 GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TOGGLE, TEXT + state*3))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2196 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2197 |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2198 if (state == STATE_FOCUSED) { |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2199 GuiTooltip(bounds); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
2200 } |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2201 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2202 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2203 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2204 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2205 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2206 // Toggle Group control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2207 int GuiToggleGroup(Rectangle bounds, const char *text, int *active) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2208 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2209 #if !defined(RAYGUI_TOGGLEGROUP_MAX_ITEMS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2210 #define RAYGUI_TOGGLEGROUP_MAX_ITEMS 32 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2211 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2212 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2213 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2214 float initBoundsX = bounds.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2215 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2216 int temp = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2217 if (active == NULL) active = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2218 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2219 bool toggle = false; // Required for individual toggles |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2220 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2221 // Get substrings items from text (items pointers) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2222 int rows[RAYGUI_TOGGLEGROUP_MAX_ITEMS] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2223 int itemCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2224 const char **items = GuiTextSplit(text, ';', &itemCount, rows); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2225 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2226 int prevRow = rows[0]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2227 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2228 for (int i = 0; i < itemCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2229 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2230 if (prevRow != rows[i]) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2231 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2232 bounds.x = initBoundsX; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2233 bounds.y += (bounds.height + GuiGetStyle(TOGGLE, GROUP_PADDING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2234 prevRow = rows[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2235 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2236 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2237 if (i == (*active)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2238 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2239 toggle = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2240 GuiToggle(bounds, items[i], &toggle); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2241 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2242 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2243 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2244 toggle = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2245 GuiToggle(bounds, items[i], &toggle); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2246 if (toggle) *active = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2247 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2248 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2249 bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2250 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2251 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2252 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2253 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2254 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2255 // Toggle Slider control extended |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2256 int GuiToggleSlider(Rectangle bounds, const char *text, int *active) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2257 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2258 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2259 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2260 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2261 int temp = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2262 if (active == NULL) active = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2263 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2264 //bool toggle = false; // Required for individual toggles |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2265 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2266 // Get substrings items from text (items pointers) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2267 int itemCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2268 const char **items = NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2269 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2270 if (text != NULL) items = GuiTextSplit(text, ';', &itemCount, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2271 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2272 Rectangle slider = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2273 0, // Calculated later depending on the active toggle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2274 bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2275 (bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - (itemCount + 1)*GuiGetStyle(SLIDER, SLIDER_PADDING))/itemCount, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2276 bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2277 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2278 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2279 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2280 if ((state != STATE_DISABLED) && !guiLocked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2281 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2282 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2283 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2284 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2285 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2286 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2287 else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2288 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2289 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2290 (*active)++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2291 result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2292 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2293 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2294 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2295 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2296 if ((*active) && (state != STATE_FOCUSED)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2297 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2298 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2299 if (*active >= itemCount) *active = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2300 slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH) + (*active + 1)*GuiGetStyle(SLIDER, SLIDER_PADDING) + (*active)*slider.width; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2301 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2302 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2303 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2304 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2305 GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, BORDER + (state*3))), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2306 GetColor(GuiGetStyle(TOGGLE, BASE_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2307 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2308 // Draw internal slider |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2309 if (state == STATE_NORMAL) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2310 else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2311 else if (state == STATE_PRESSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2312 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2313 // Draw text in slider |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2314 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2315 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2316 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2317 textBounds.width = (float)GuiGetTextWidth(text); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2318 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2319 textBounds.x = slider.x + slider.width/2 - textBounds.width/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2320 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2321 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2322 GuiDrawText(items[*active], textBounds, GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, TEXT + (state*3))), guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2323 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2324 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2325 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2326 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2327 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2328 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2329 // Check Box control, returns 1 when state changed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2330 int GuiCheckBox(Rectangle bounds, const char *text, bool *checked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2331 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2332 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2333 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2334 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2335 bool temp = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2336 if (checked == NULL) checked = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2337 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2338 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2339 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2340 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2341 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2342 textBounds.width = (float)GuiGetTextWidth(text) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2343 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2344 textBounds.x = bounds.x + bounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2345 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2346 if (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(CHECKBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2347 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2348 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2349 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2350 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2351 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2352 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2353 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2354 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2355 Rectangle totalBounds = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2356 (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT)? textBounds.x : bounds.x, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2357 bounds.y, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2358 bounds.width + textBounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2359 bounds.height, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2360 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2361 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2362 // Check checkbox state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2363 if (CheckCollisionPointRec(mousePoint, totalBounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2364 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2365 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2366 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2367 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2368 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2369 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2370 *checked = !(*checked); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2371 result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2372 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2373 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2374 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2375 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2376 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2377 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2378 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2379 GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), BLANK); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2380 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2381 if (*checked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2382 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2383 Rectangle check = { bounds.x + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2384 bounds.y + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2385 bounds.width - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2386 bounds.height - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2387 GuiDrawRectangle(check, 0, BLANK, GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2388 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2389 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2390 GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2391 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2392 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2393 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2394 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2395 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2396 // Combo Box control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2397 int GuiComboBox(Rectangle bounds, const char *text, int *active) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2398 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2399 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2400 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2401 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2402 int temp = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2403 if (active == NULL) active = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2404 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2405 bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2406 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2407 Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2408 (float)bounds.y, (float)GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH), (float)bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2409 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2410 // Get substrings items from text (items pointers, lengths and count) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2411 int itemCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2412 const char **items = GuiTextSplit(text, ';', &itemCount, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2413 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2414 if (*active < 0) *active = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2415 else if (*active > (itemCount - 1)) *active = itemCount - 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2416 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2417 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2418 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2419 if ((state != STATE_DISABLED) && !guiLocked && (itemCount > 1) && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2420 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2421 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2422 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2423 if (CheckCollisionPointRec(mousePoint, bounds) || |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2424 CheckCollisionPointRec(mousePoint, selector)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2425 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2426 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2427 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2428 *active += 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2429 if (*active >= itemCount) *active = 0; // Cyclic combobox |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2430 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2431 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2432 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2433 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2434 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2435 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2436 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2437 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2438 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2439 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2440 // Draw combo box main |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2441 GuiDrawRectangle(bounds, GuiGetStyle(COMBOBOX, BORDER_WIDTH), GetColor(GuiGetStyle(COMBOBOX, BORDER + (state*3))), GetColor(GuiGetStyle(COMBOBOX, BASE + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2442 GuiDrawText(items[*active], GetTextBounds(COMBOBOX, bounds), GuiGetStyle(COMBOBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(COMBOBOX, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2443 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2444 // Draw selector using a custom button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2445 // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2446 int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2447 int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2448 GuiSetStyle(BUTTON, BORDER_WIDTH, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2449 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2450 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2451 GuiButton(selector, TextFormat("%i/%i", *active + 1, itemCount)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2452 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2453 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2454 GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2455 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2456 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2457 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2458 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2459 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2460 // Dropdown Box control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2461 // NOTE: Returns mouse click |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2462 int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2463 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2464 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2465 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2466 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2467 int temp = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2468 if (active == NULL) active = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2469 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2470 int itemSelected = *active; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2471 int itemFocused = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2472 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2473 int direction = 0; // Dropdown box open direction: down (default) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2474 if (GuiGetStyle(DROPDOWNBOX, DROPDOWN_ROLL_UP) == 1) direction = 1; // Up |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2475 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2476 // Get substrings items from text (items pointers, lengths and count) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2477 int itemCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2478 const char **items = GuiTextSplit(text, ';', &itemCount, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2479 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2480 Rectangle boundsOpen = bounds; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2481 boundsOpen.height = (itemCount + 1)*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2482 if (direction == 1) boundsOpen.y -= itemCount*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)) + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2483 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2484 Rectangle itemBounds = bounds; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2485 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2486 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2487 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2488 if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1) && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2489 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2490 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2491 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2492 if (editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2493 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2494 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2495 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2496 // Check if mouse has been pressed or released outside limits |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2497 if (!CheckCollisionPointRec(mousePoint, boundsOpen)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2498 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2499 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2500 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2501 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2502 // Check if already selected item has been pressed again |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2503 if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2504 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2505 // Check focused and selected item |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2506 for (int i = 0; i < itemCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2507 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2508 // Update item rectangle y position for next item |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2509 if (direction == 0) itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2510 else itemBounds.y -= (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2511 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2512 if (CheckCollisionPointRec(mousePoint, itemBounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2513 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2514 itemFocused = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2515 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2516 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2517 itemSelected = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2518 result = 1; // Item selected |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2519 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2520 break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2521 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2522 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2523 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2524 itemBounds = bounds; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2525 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2526 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2527 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2528 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2529 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2530 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2531 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2532 result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2533 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2534 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2535 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2536 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2537 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2538 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2539 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2540 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2541 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2542 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2543 if (editMode) GuiPanel(boundsOpen, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2544 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2545 GuiDrawRectangle(bounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2546 GuiDrawText(items[itemSelected], GetTextBounds(DROPDOWNBOX, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2547 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2548 if (editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2549 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2550 // Draw visible items |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2551 for (int i = 0; i < itemCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2552 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2553 // Update item rectangle y position for next item |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2554 if (direction == 0) itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2555 else itemBounds.y -= (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2556 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2557 if (i == itemSelected) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2558 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2559 GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2560 GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2561 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2562 else if (i == itemFocused) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2563 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2564 GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2565 GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2566 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2567 else GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2568 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2569 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2570 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2571 if (!GuiGetStyle(DROPDOWNBOX, DROPDOWN_ARROW_HIDDEN)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2572 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2573 // Draw arrows (using icon if available) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2574 #if defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2575 GuiDrawText("v", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 2, 10, 10 }, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2576 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2577 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2578 GuiDrawText(direction? "#121#" : "#120#", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 6, 10, 10 }, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2579 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); // ICON_ARROW_DOWN_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2580 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2581 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2582 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2583 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2584 *active = itemSelected; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2585 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2586 // TODO: Use result to return more internal states: mouse-press out-of-bounds, mouse-press over selected-item... |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2587 return result; // Mouse click: result = 1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2588 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2589 |
|
161
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2590 // JUNE |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2591 int GuiDropdownBoxRounded(Rectangle bounds, const char *text, int *active, bool editMode, float roundness, int segments) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2592 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2593 int result = 0; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2594 GuiState state = guiState; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2595 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2596 int temp = 0; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2597 if (active == NULL) active = &temp; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2598 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2599 int itemSelected = *active; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2600 int itemFocused = -1; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2601 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2602 int direction = 0; // Dropdown box open direction: down (default) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2603 if (GuiGetStyle(DROPDOWNBOX, DROPDOWN_ROLL_UP) == 1) direction = 1; // Up |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2604 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2605 // Get substrings items from text (items pointers, lengths and count) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2606 int itemCount = 0; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2607 const char **items = GuiTextSplit(text, ';', &itemCount, NULL); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2608 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2609 Rectangle boundsOpen = bounds; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2610 boundsOpen.height = (itemCount + 1)*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2611 if (direction == 1) boundsOpen.y -= itemCount*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)) + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2612 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2613 Rectangle itemBounds = bounds; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2614 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2615 // Update control |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2616 //-------------------------------------------------------------------- |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2617 if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1) && !guiControlExclusiveMode) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2618 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2619 Vector2 mousePoint = GetMousePosition(); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2620 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2621 if (editMode) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2622 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2623 state = STATE_PRESSED; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2624 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2625 // Check if mouse has been pressed or released outside limits |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2626 if (!CheckCollisionPointRec(mousePoint, boundsOpen)) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2627 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2628 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2629 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2630 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2631 // Check if already selected item has been pressed again |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2632 if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2633 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2634 // Check focused and selected item |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2635 for (int i = 0; i < itemCount; i++) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2636 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2637 // Update item rectangle y position for next item |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2638 if (direction == 0) itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2639 else itemBounds.y -= (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2640 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2641 if (CheckCollisionPointRec(mousePoint, itemBounds)) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2642 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2643 itemFocused = i; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2644 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2645 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2646 itemSelected = i; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2647 result = 1; // Item selected |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2648 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2649 break; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2650 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2651 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2652 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2653 itemBounds = bounds; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2654 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2655 else |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2656 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2657 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2658 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2659 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2660 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2661 result = 1; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2662 state = STATE_PRESSED; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2663 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2664 else state = STATE_FOCUSED; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2665 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2666 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2667 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2668 //-------------------------------------------------------------------- |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2669 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2670 // Draw control |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2671 //-------------------------------------------------------------------- |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2672 if (editMode) GuiPanel(boundsOpen, NULL); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2673 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2674 // Main (closed) control: draw rounded background + rounded border |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2675 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2676 int borderWidth = GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2677 Color borderColor = GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2678 Color baseColor = GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2679 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2680 // Filled rounded rect |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2681 DrawRectangleRounded(bounds, roundness, segments, baseColor); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2682 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2683 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2684 GuiDrawText(items[itemSelected], GetTextBounds(DROPDOWNBOX, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2685 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2686 if (editMode) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2687 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2688 // Draw visible items |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2689 for (int i = 0; i < itemCount; i++) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2690 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2691 // Update item rectangle y position for next item |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2692 if (direction == 0) itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2693 else itemBounds.y -= (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2694 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2695 bool isLastVisible = (i == itemCount - 1); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2696 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2697 if (i == itemSelected) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2698 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2699 Color borderColor = GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_PRESSED)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2700 Color baseColor = GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_PRESSED)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2701 int borderWidth = GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2702 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2703 if (isLastVisible) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2704 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2705 DrawRectangleRounded(itemBounds, roundness, segments, baseColor); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2706 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2707 else |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2708 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2709 DrawRectangle(itemBounds.x, itemBounds.y, itemBounds.width, itemBounds.height, baseColor); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2710 if (borderWidth > 0) DrawRectangleLinesEx(itemBounds, borderWidth, borderColor); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2711 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2712 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2713 GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2714 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2715 else if (i == itemFocused) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2716 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2717 Color borderColor = GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_FOCUSED)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2718 Color baseColor = GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_FOCUSED)); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2719 int borderWidth = GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2720 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2721 if (isLastVisible) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2722 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2723 DrawRectangleRounded(itemBounds, roundness, segments, baseColor); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2724 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2725 else |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2726 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2727 DrawRectangle(itemBounds.x, itemBounds.y, itemBounds.width, itemBounds.height, baseColor); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2728 if (borderWidth > 0) DrawRectangleLinesEx(itemBounds, borderWidth, borderColor); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2729 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2730 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2731 GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2732 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2733 else |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2734 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2735 // Normal item: draw only text (background left as panel background), |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2736 // but if you want a visible background for normal items, uncomment the following: |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2737 // DrawRectangle(itemBounds.x, itemBounds.y, itemBounds.width, itemBounds.height, GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_NORMAL))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2738 GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2739 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2740 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2741 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2742 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2743 if (!GuiGetStyle(DROPDOWNBOX, DROPDOWN_ARROW_HIDDEN)) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2744 { |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2745 // Draw arrows (using icon if available) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2746 #if defined(RAYGUI_NO_ICONS) |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2747 GuiDrawText("v", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 2, 10, 10 }, |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2748 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2749 #else |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2750 GuiDrawText(direction? "#121#" : "#120#", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 6, 10, 10 }, |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2751 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); // ICON_ARROW_DOWN_FILL |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2752 #endif |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2753 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2754 //-------------------------------------------------------------------- |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2755 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2756 *active = itemSelected; |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2757 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2758 // TODO: Use result to return more internal states: mouse-press out-of-bounds, mouse-press over selected-item... |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2759 return result; // Mouse click: result = 1 |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2760 } |
|
87d8d3eb3491
[PostDog] WIP to make it more mordern looking
June Park <parkjune1995@gmail.com>
parents:
157
diff
changeset
|
2761 |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2762 // Text Box control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2763 // NOTE: Returns true on ENTER pressed (useful for data validation) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2764 int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2765 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2766 #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2767 #define RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN 20 // Frames to wait for autocursor movement |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2768 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2769 #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2770 #define RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY 1 // Frames delay for autocursor movement |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2771 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2772 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2773 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2774 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2775 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
2776 bool multiline = false; // TODO: Consider multiline text input |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2777 int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2778 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2779 Rectangle textBounds = GetTextBounds(TEXTBOX, bounds); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2780 int textLength = (text != NULL)? (int)strlen(text) : 0; // Get current text length |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2781 int thisCursorIndex = textBoxCursorIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2782 if (thisCursorIndex > textLength) thisCursorIndex = textLength; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
2783 int textWidth = GuiGetTextWidth(text) - GuiGetTextWidth(text + thisCursorIndex); |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2784 int textIndexOffset = 0; // Text index offset to start drawing in the box |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2785 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2786 // Cursor rectangle |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
2787 // NOTE: Position X value should be updated |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2788 Rectangle cursor = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2789 textBounds.x + textWidth + GuiGetStyle(DEFAULT, TEXT_SPACING), |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
2790 textBounds.y + textBounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE), |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2791 2, |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
2792 (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*2 |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2793 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2794 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2795 if (cursor.height >= bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2796 if (cursor.y < (bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH))) cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2797 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2798 // Mouse cursor rectangle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2799 // NOTE: Initialized outside of screen |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2800 Rectangle mouseCursor = cursor; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2801 mouseCursor.x = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2802 mouseCursor.width = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2803 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2804 // Blink-cursor frame counter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2805 //if (!autoCursorMode) blinkCursorFrameCounter++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2806 //else blinkCursorFrameCounter = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2807 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2808 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2809 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2810 // WARNING: Text editing is only supported under certain conditions: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2811 if ((state != STATE_DISABLED) && // Control not disabled |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2812 !GuiGetStyle(TEXTBOX, TEXT_READONLY) && // TextBox not on read-only mode |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2813 !guiLocked && // Gui not locked |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2814 !guiControlExclusiveMode && // No gui slider on dragging |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2815 (wrapMode == TEXT_WRAP_NONE)) // No wrap mode |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2816 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2817 Vector2 mousePosition = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2818 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2819 if (editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2820 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2821 // GLOBAL: Auto-cursor movement logic |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2822 // NOTE: Keystrokes are handled repeatedly when button is held down for some time |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2823 if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_UP) || IsKeyDown(KEY_DOWN) || IsKeyDown(KEY_BACKSPACE) || IsKeyDown(KEY_DELETE)) autoCursorCounter++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2824 else autoCursorCounter = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2825 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2826 bool autoCursorShouldTrigger = (autoCursorCounter > RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN) && ((autoCursorCounter % RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2827 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2828 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2829 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2830 if (textBoxCursorIndex > textLength) textBoxCursorIndex = textLength; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2831 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2832 // If text does not fit in the textbox and current cursor position is out of bounds, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2833 // we add an index offset to text for drawing only what requires depending on cursor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2834 while (textWidth >= textBounds.width) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2835 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2836 int nextCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2837 GetCodepointNext(text + textIndexOffset, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2838 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2839 textIndexOffset += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2840 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2841 textWidth = GuiGetTextWidth(text + textIndexOffset) - GuiGetTextWidth(text + textBoxCursorIndex); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2842 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2843 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2844 int codepoint = GetCharPressed(); // Get Unicode codepoint |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2845 if (multiline && IsKeyPressed(KEY_ENTER)) codepoint = (int)'\n'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2846 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2847 // Encode codepoint as UTF-8 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2848 int codepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2849 const char *charEncoded = CodepointToUTF8(codepoint, &codepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2850 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2851 // Handle text paste action |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2852 if (IsKeyPressed(KEY_V) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2853 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2854 const char *pasteText = GetClipboardText(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2855 if (pasteText != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2856 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2857 int pasteLength = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2858 int pasteCodepoint; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2859 int pasteCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2860 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2861 // Count how many codepoints to copy, stopping at the first unwanted control character |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2862 while (true) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2863 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2864 pasteCodepoint = GetCodepointNext(pasteText + pasteLength, &pasteCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2865 if (textLength + pasteLength + pasteCodepointSize >= textSize) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2866 if (!(multiline && (pasteCodepoint == (int)'\n')) && !(pasteCodepoint >= 32)) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2867 pasteLength += pasteCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2868 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2869 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2870 if (pasteLength > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2871 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2872 // Move forward data from cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2873 for (int i = textLength + pasteLength; i > textBoxCursorIndex; i--) text[i] = text[i - pasteLength]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2874 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2875 // Paste data in at cursor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2876 for (int i = 0; i < pasteLength; i++) text[textBoxCursorIndex + i] = pasteText[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2877 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2878 textBoxCursorIndex += pasteLength; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2879 textLength += pasteLength; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2880 text[textLength] = '\0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2881 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2882 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2883 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2884 else if (((multiline && (codepoint == (int)'\n')) || (codepoint >= 32)) && ((textLength + codepointSize) < textSize)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2885 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2886 // Adding codepoint to text, at current cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2887 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2888 // Move forward data from cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2889 for (int i = (textLength + codepointSize); i > textBoxCursorIndex; i--) text[i] = text[i - codepointSize]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2890 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2891 // Add new codepoint in current cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2892 for (int i = 0; i < codepointSize; i++) text[textBoxCursorIndex + i] = charEncoded[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2893 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2894 textBoxCursorIndex += codepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2895 textLength += codepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2896 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2897 // Make sure text last character is EOL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2898 text[textLength] = '\0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2899 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2900 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2901 // Move cursor to start |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2902 if ((textLength > 0) && IsKeyPressed(KEY_HOME)) textBoxCursorIndex = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2903 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2904 // Move cursor to end |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2905 if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_END)) textBoxCursorIndex = textLength; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2906 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2907 // Delete related codepoints from text, after current cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2908 if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_DELETE) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2909 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2910 int offset = textBoxCursorIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2911 int accCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2912 int nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2913 int nextCodepoint; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2914 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2915 // Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2916 // Not using isalnum() since it only works on ASCII characters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2917 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2918 bool puctuation = ispunct(nextCodepoint & 0xff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2919 while (offset < textLength) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2920 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2921 if ((puctuation && !ispunct(nextCodepoint & 0xff)) || (!puctuation && (isspace(nextCodepoint & 0xff) || ispunct(nextCodepoint & 0xff)))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2922 break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2923 offset += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2924 accCodepointSize += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2925 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2926 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2927 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2928 // Check whitespace to delete (ASCII only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2929 while (offset < textLength) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2930 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2931 if (!isspace(nextCodepoint & 0xff)) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2932 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2933 offset += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2934 accCodepointSize += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2935 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2936 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2937 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2938 // Move text after cursor forward (including final null terminator) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2939 for (int i = offset; i <= textLength; i++) text[i - accCodepointSize] = text[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2940 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2941 textLength -= accCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2942 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2943 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2944 else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && autoCursorShouldTrigger))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2945 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2946 // Delete single codepoint from text, after current cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2947 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2948 int nextCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2949 GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2950 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2951 // Move text after cursor forward (including final null terminator) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2952 for (int i = textBoxCursorIndex + nextCodepointSize; i <= textLength; i++) text[i - nextCodepointSize] = text[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2953 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2954 textLength -= nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2955 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2956 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2957 // Delete related codepoints from text, before current cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2958 if ((textBoxCursorIndex > 0) && IsKeyPressed(KEY_BACKSPACE) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2959 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2960 int offset = textBoxCursorIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2961 int accCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2962 int prevCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2963 int prevCodepoint = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2964 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2965 // Check whitespace to delete (ASCII only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2966 while (offset > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2967 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2968 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2969 if (!isspace(prevCodepoint & 0xff)) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2970 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2971 offset -= prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2972 accCodepointSize += prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2973 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2974 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2975 // Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2976 // Not using isalnum() since it only works on ASCII characters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2977 bool puctuation = ispunct(prevCodepoint & 0xff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2978 while (offset > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2979 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2980 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2981 if ((puctuation && !ispunct(prevCodepoint & 0xff)) || (!puctuation && (isspace(prevCodepoint & 0xff) || ispunct(prevCodepoint & 0xff)))) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2982 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2983 offset -= prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2984 accCodepointSize += prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2985 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2986 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2987 // Move text after cursor forward (including final null terminator) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2988 for (int i = textBoxCursorIndex; i <= textLength; i++) text[i - accCodepointSize] = text[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2989 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2990 textLength -= accCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2991 textBoxCursorIndex -= accCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2992 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2993 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2994 else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && autoCursorShouldTrigger))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2995 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2996 // Delete single codepoint from text, before current cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2997 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2998 int prevCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2999 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3000 GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3001 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3002 // Move text after cursor forward (including final null terminator) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3003 for (int i = textBoxCursorIndex; i <= textLength; i++) text[i - prevCodepointSize] = text[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3004 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3005 textLength -= prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3006 textBoxCursorIndex -= prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3007 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3008 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3009 // Move cursor position with keys |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3010 if ((textBoxCursorIndex > 0) && IsKeyPressed(KEY_LEFT) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3011 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3012 int offset = textBoxCursorIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3013 //int accCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3014 int prevCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3015 int prevCodepoint = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3016 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3017 // Check whitespace to skip (ASCII only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3018 while (offset > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3019 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3020 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3021 if (!isspace(prevCodepoint & 0xff)) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3022 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3023 offset -= prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3024 //accCodepointSize += prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3025 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3026 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3027 // Check characters of the same type to skip (either ASCII punctuation or anything non-whitespace) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3028 // Not using isalnum() since it only works on ASCII characters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3029 bool puctuation = ispunct(prevCodepoint & 0xff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3030 while (offset > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3031 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3032 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3033 if ((puctuation && !ispunct(prevCodepoint & 0xff)) || (!puctuation && (isspace(prevCodepoint & 0xff) || ispunct(prevCodepoint & 0xff)))) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3034 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3035 offset -= prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3036 //accCodepointSize += prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3037 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3038 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3039 textBoxCursorIndex = offset; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3040 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3041 else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_LEFT) || (IsKeyDown(KEY_LEFT) && autoCursorShouldTrigger))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3042 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3043 int prevCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3044 GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3045 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3046 textBoxCursorIndex -= prevCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3047 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3048 else if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_RIGHT) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3049 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3050 int offset = textBoxCursorIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3051 //int accCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3052 int nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3053 int nextCodepoint; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3054 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3055 // Check characters of the same type to skip (either ASCII punctuation or anything non-whitespace) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3056 // Not using isalnum() since it only works on ASCII characters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3057 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3058 bool puctuation = ispunct(nextCodepoint & 0xff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3059 while (offset < textLength) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3060 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3061 if ((puctuation && !ispunct(nextCodepoint & 0xff)) || (!puctuation && (isspace(nextCodepoint & 0xff) || ispunct(nextCodepoint & 0xff)))) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3062 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3063 offset += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3064 //accCodepointSize += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3065 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3066 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3067 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3068 // Check whitespace to skip (ASCII only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3069 while (offset < textLength) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3070 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3071 if (!isspace(nextCodepoint & 0xff)) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3072 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3073 offset += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3074 //accCodepointSize += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3075 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3076 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3077 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3078 textBoxCursorIndex = offset; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3079 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3080 else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_RIGHT) || (IsKeyDown(KEY_RIGHT) && autoCursorShouldTrigger))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3081 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3082 int nextCodepointSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3083 GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3084 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3085 textBoxCursorIndex += nextCodepointSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3086 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3087 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3088 // Move cursor position with mouse |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3089 if (CheckCollisionPointRec(mousePosition, textBounds)) // Mouse hover text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3090 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3091 float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3092 int codepointIndex = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3093 float glyphWidth = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3094 float widthToMouseX = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3095 int mouseCursorIndex = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3096 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3097 for (int i = textIndexOffset; i < textLength; i += codepointSize) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3098 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3099 codepoint = GetCodepointNext(&text[i], &codepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3100 codepointIndex = GetGlyphIndex(guiFont, codepoint); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3101 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3102 if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3103 else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3104 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3105 if (mousePosition.x <= (textBounds.x + (widthToMouseX + glyphWidth/2))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3106 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3107 mouseCursor.x = textBounds.x + widthToMouseX; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3108 mouseCursorIndex = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3109 break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3110 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3111 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3112 widthToMouseX += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3113 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3114 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3115 // Check if mouse cursor is at the last position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3116 int textEndWidth = GuiGetTextWidth(text + textIndexOffset); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3117 if (GetMousePosition().x >= (textBounds.x + textEndWidth - glyphWidth/2)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3118 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3119 mouseCursor.x = textBounds.x + textEndWidth; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3120 mouseCursorIndex = textLength; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3121 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3122 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3123 // Place cursor at required index on mouse click |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3124 if ((mouseCursor.x >= 0) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3125 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3126 cursor.x = mouseCursor.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3127 textBoxCursorIndex = mouseCursorIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3128 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3129 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3130 else mouseCursor.x = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3131 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
3132 // Recalculate cursor position.y depending on textBoxCursorIndex |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
3133 cursor.x = bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GuiGetTextWidth(text + textIndexOffset) - GuiGetTextWidth(text + textBoxCursorIndex) + GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
3134 // if (multiline) GetTextLines(text, &cursor.y); |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3135 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3136 // Finish text editing on ENTER or mouse click outside bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3137 if ((!multiline && IsKeyPressed(KEY_ENTER)) || |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3138 (!CheckCollisionPointRec(mousePosition, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3139 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3140 textBoxCursorIndex = 0; // GLOBAL: Reset the shared cursor index |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3141 autoCursorCounter = 0; // GLOBAL: Reset counter for repeated keystrokes |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3142 result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3143 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3144 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3145 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3146 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3147 if (CheckCollisionPointRec(mousePosition, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3148 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3149 state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3150 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3151 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3152 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3153 textBoxCursorIndex = textLength; // GLOBAL: Place cursor index to the end of current text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3154 autoCursorCounter = 0; // GLOBAL: Reset counter for repeated keystrokes |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3155 result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3156 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3157 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3158 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3159 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3160 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3161 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3162 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3163 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3164 if (state == STATE_PRESSED) |
|
163
058de208e640
[Config] Adding os ignore files.
June Park <parkjune1995@gmail.com>
parents:
161
diff
changeset
|
3165 GuiDrawRectangle(bounds, 0, GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), BLANK); |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3166 else if (state == STATE_DISABLED) |
|
163
058de208e640
[Config] Adding os ignore files.
June Park <parkjune1995@gmail.com>
parents:
161
diff
changeset
|
3167 GuiDrawRectangle(bounds, 0, GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED))); |
|
058de208e640
[Config] Adding os ignore files.
June Park <parkjune1995@gmail.com>
parents:
161
diff
changeset
|
3168 else GuiDrawRectangle(bounds, 0, GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), BLANK); |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3169 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3170 // Draw text considering index offset if required |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3171 // NOTE: Text index offset depends on cursor position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3172 GuiDrawText(text + textIndexOffset, textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3173 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3174 // Draw cursor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3175 if (editMode && !GuiGetStyle(TEXTBOX, TEXT_READONLY)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3176 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3177 //if (autoCursorMode || ((blinkCursorFrameCounter/40)%2 == 0)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3178 GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3179 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3180 // Draw mouse position cursor (if required) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3181 if (mouseCursor.x >= 0) GuiDrawRectangle(mouseCursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3182 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3183 else if (state == STATE_FOCUSED) GuiTooltip(bounds); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3184 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3185 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3186 return result; // Mouse button pressed: result = 1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3187 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3188 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3189 // Text Box control with multiple lines and word-wrap |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3190 // NOTE: This text-box is readonly, no editing supported by default |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3191 bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3192 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3193 bool pressed = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3194 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3195 GuiSetStyle(TEXTBOX, TEXT_READONLY, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3196 GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_WORD); // WARNING: If wrap mode enabled, text editing is not supported |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3197 GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_TOP); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3198 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3199 // TODO: Implement methods to calculate cursor position properly |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3200 pressed = GuiTextBox(bounds, text, textSize, editMode); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3201 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3202 GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_MIDDLE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3203 GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_NONE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3204 GuiSetStyle(TEXTBOX, TEXT_READONLY, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3205 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3206 return pressed; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3207 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3208 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3209 // Spinner control, returns selected value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3210 int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3211 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3212 int result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3213 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3214 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3215 int tempValue = *value; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3216 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3217 Rectangle valueBoxBounds = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3218 bounds.x + GuiGetStyle(VALUEBOX, SPINNER_BUTTON_WIDTH) + GuiGetStyle(VALUEBOX, SPINNER_BUTTON_SPACING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3219 bounds.y, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3220 bounds.width - 2*(GuiGetStyle(VALUEBOX, SPINNER_BUTTON_WIDTH) + GuiGetStyle(VALUEBOX, SPINNER_BUTTON_SPACING)), bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3221 Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(VALUEBOX, SPINNER_BUTTON_WIDTH), (float)bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3222 Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(VALUEBOX, SPINNER_BUTTON_WIDTH), (float)bounds.y, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3223 (float)GuiGetStyle(VALUEBOX, SPINNER_BUTTON_WIDTH), (float)bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3224 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3225 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3226 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3227 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3228 textBounds.width = (float)GuiGetTextWidth(text) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3229 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3230 textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3231 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3232 if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3233 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3234 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3235 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3236 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3237 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3238 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3239 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3240 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3241 // Check spinner state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3242 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3243 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3244 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3245 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3246 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3247 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3248 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3249 #if defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3250 if (GuiButton(leftButtonBound, "<")) tempValue--; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3251 if (GuiButton(rightButtonBound, ">")) tempValue++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3252 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3253 if (GuiButton(leftButtonBound, GuiIconText(ICON_ARROW_LEFT_FILL, NULL))) tempValue--; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3254 if (GuiButton(rightButtonBound, GuiIconText(ICON_ARROW_RIGHT_FILL, NULL))) tempValue++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3255 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3256 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3257 if (!editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3258 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3259 if (tempValue < minValue) tempValue = minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3260 if (tempValue > maxValue) tempValue = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3261 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3262 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3263 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3264 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3265 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3266 result = GuiValueBox(valueBoxBounds, NULL, &tempValue, minValue, maxValue, editMode); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3267 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3268 // Draw value selector custom buttons |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3269 // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3270 int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3271 int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3272 GuiSetStyle(BUTTON, BORDER_WIDTH, GuiGetStyle(VALUEBOX, BORDER_WIDTH)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3273 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3274 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3275 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3276 GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3277 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3278 // Draw text label if provided |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3279 GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3280 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3281 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3282 *value = tempValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3283 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3284 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3285 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3286 // Value Box control, updates input text with numbers |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3287 // NOTE: Requires static variables: frameCounter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3288 int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3289 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3290 #if !defined(RAYGUI_VALUEBOX_MAX_CHARS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3291 #define RAYGUI_VALUEBOX_MAX_CHARS 32 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3292 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3293 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3294 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3295 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3296 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3297 char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3298 snprintf(textValue, RAYGUI_VALUEBOX_MAX_CHARS + 1, "%i", *value); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3299 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3300 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3301 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3302 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3303 textBounds.width = (float)GuiGetTextWidth(text) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3304 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3305 textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3306 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3307 if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3308 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3309 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3310 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3311 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3312 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3313 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3314 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3315 bool valueHasChanged = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3316 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3317 if (editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3318 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3319 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3320 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3321 int keyCount = (int)strlen(textValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3322 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3323 // Add or remove minus symbol |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3324 if (IsKeyPressed(KEY_MINUS)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3325 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3326 if (textValue[0] == '-') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3327 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3328 for (int i = 0 ; i < keyCount; i++) textValue[i] = textValue[i + 1]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3329 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3330 keyCount--; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3331 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3332 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3333 else if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3334 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3335 if (keyCount == 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3336 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3337 textValue[0] = '0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3338 textValue[1] = '\0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3339 keyCount++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3340 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3341 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3342 for (int i = keyCount ; i > -1; i--) textValue[i + 1] = textValue[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3343 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3344 textValue[0] = '-'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3345 keyCount++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3346 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3347 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3348 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3349 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3350 // Add new digit to text value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3351 if ((keyCount >= 0) && (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) && (GuiGetTextWidth(textValue) < bounds.width)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3352 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3353 int key = GetCharPressed(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3354 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3355 // Only allow keys in range [48..57] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3356 if ((key >= 48) && (key <= 57)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3357 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3358 textValue[keyCount] = (char)key; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3359 keyCount++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3360 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3361 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3362 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3363 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3364 // Delete text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3365 if ((keyCount > 0) && IsKeyPressed(KEY_BACKSPACE)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3366 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3367 keyCount--; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3368 textValue[keyCount] = '\0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3369 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3370 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3371 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3372 if (valueHasChanged) *value = TextToInteger(textValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3373 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3374 // NOTE: We are not clamp values until user input finishes |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3375 //if (*value > maxValue) *value = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3376 //else if (*value < minValue) *value = minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3377 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3378 if ((IsKeyPressed(KEY_ENTER) || IsKeyPressed(KEY_KP_ENTER)) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3379 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3380 if (*value > maxValue) *value = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3381 else if (*value < minValue) *value = minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3382 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3383 result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3384 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3385 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3386 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3387 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3388 if (*value > maxValue) *value = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3389 else if (*value < minValue) *value = minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3390 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3391 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3392 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3393 state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3394 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3395 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3396 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3397 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3398 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3399 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3400 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3401 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3402 Color baseColor = BLANK; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3403 if (state == STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3404 else if (state == STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3405 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3406 GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), baseColor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3407 GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3408 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3409 // Draw cursor rectangle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3410 if (editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3411 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3412 // NOTE: ValueBox internal text is always centered |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3413 Rectangle cursor = { bounds.x + GuiGetTextWidth(textValue)/2 + bounds.width/2 + 1, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3414 bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + 2, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3415 2, bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2 - 4 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3416 if (cursor.height > bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3417 GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3418 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3419 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3420 // Draw text label if provided |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3421 GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3422 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3423 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3424 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3425 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3426 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3427 // Floating point Value Box control, updates input val_str with numbers |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3428 // NOTE: Requires static variables: frameCounter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3429 int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float *value, bool editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3430 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3431 #if !defined(RAYGUI_VALUEBOX_MAX_CHARS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3432 #define RAYGUI_VALUEBOX_MAX_CHARS 32 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3433 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3434 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3435 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3436 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3437 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3438 //char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0"; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3439 //snprintf(textValue, sizeof(textValue), "%2.2f", *value); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3440 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3441 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3442 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3443 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3444 textBounds.width = (float)GuiGetTextWidth(text) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3445 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3446 textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3447 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3448 if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3449 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3450 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3451 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3452 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3453 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3454 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3455 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3456 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3457 bool valueHasChanged = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3458 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3459 if (editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3460 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3461 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3462 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3463 int keyCount = (int)strlen(textValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3464 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3465 // Add or remove minus symbol |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3466 if (IsKeyPressed(KEY_MINUS)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3467 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3468 if (textValue[0] == '-') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3469 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3470 for (int i = 0; i < keyCount; i++) textValue[i] = textValue[i + 1]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3471 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3472 keyCount--; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3473 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3474 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3475 else if (keyCount < (RAYGUI_VALUEBOX_MAX_CHARS - 1)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3476 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3477 if (keyCount == 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3478 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3479 textValue[0] = '0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3480 textValue[1] = '\0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3481 keyCount++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3482 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3483 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3484 for (int i = keyCount; i > -1; i--) textValue[i + 1] = textValue[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3485 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3486 textValue[0] = '-'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3487 keyCount++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3488 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3489 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3490 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3491 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3492 // Only allow keys in range [48..57] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3493 if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3494 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3495 if (GuiGetTextWidth(textValue) < bounds.width) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3496 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3497 int key = GetCharPressed(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3498 if (((key >= 48) && (key <= 57)) || |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3499 (key == '.') || |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3500 ((keyCount == 0) && (key == '+')) || // NOTE: Sign can only be in first position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3501 ((keyCount == 0) && (key == '-'))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3502 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3503 textValue[keyCount] = (char)key; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3504 keyCount++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3505 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3506 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3507 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3508 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3509 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3510 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3511 // Pressed backspace |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3512 if (IsKeyPressed(KEY_BACKSPACE)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3513 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3514 if (keyCount > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3515 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3516 keyCount--; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3517 textValue[keyCount] = '\0'; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3518 valueHasChanged = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3519 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3520 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3521 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3522 if (valueHasChanged) *value = TextToFloat(textValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3523 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3524 if ((IsKeyPressed(KEY_ENTER) || IsKeyPressed(KEY_KP_ENTER)) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3525 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3526 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3527 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3528 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3529 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3530 state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3531 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3532 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3533 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3534 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3535 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3536 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3537 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3538 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3539 Color baseColor = BLANK; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3540 if (state == STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3541 else if (state == STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3542 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3543 GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), baseColor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3544 GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3545 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3546 // Draw cursor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3547 if (editMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3548 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3549 // NOTE: ValueBox internal text is always centered |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3550 Rectangle cursor = {bounds.x + GuiGetTextWidth(textValue)/2 + bounds.width/2 + 1, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3551 bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3552 bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH)}; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3553 GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3554 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3555 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3556 // Draw text label if provided |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3557 GuiDrawText(text, textBounds, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3558 (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3559 GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3560 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3561 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3562 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3563 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3564 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3565 // Slider control with pro parameters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3566 // NOTE: Other GuiSlider*() controls use this one |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3567 int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3568 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3569 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3570 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3571 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3572 float temp = (maxValue - minValue)/2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3573 if (value == NULL) value = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3574 float oldValue = *value; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3575 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3576 int sliderWidth = GuiGetStyle(SLIDER, SLIDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3577 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3578 Rectangle slider = { bounds.x, bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3579 0, bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3580 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3581 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3582 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3583 if ((state != STATE_DISABLED) && !guiLocked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3584 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3585 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3586 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3587 if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3588 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3589 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3590 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3591 if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3592 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3593 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3594 // Get equivalent value and slider position from mousePosition.x |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3595 *value = (maxValue - minValue)*((mousePoint.x - bounds.x - sliderWidth/2)/(bounds.width - sliderWidth)) + minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3596 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3597 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3598 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3599 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3600 guiControlExclusiveMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3601 guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3602 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3603 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3604 else if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3605 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3606 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3607 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3608 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3609 guiControlExclusiveMode = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3610 guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3611 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3612 if (!CheckCollisionPointRec(mousePoint, slider)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3613 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3614 // Get equivalent value and slider position from mousePosition.x |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3615 *value = (maxValue - minValue)*((mousePoint.x - bounds.x - sliderWidth/2)/(bounds.width - sliderWidth)) + minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3616 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3617 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3618 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3619 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3620 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3621 if (*value > maxValue) *value = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3622 else if (*value < minValue) *value = minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3623 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3624 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3625 // Control value change check |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3626 if (oldValue == *value) result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3627 else result = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3628 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3629 // Slider bar limits check |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3630 float sliderValue = (((*value - minValue)/(maxValue - minValue))*(bounds.width - sliderWidth - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3631 if (sliderWidth > 0) // Slider |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3632 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3633 slider.x += sliderValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3634 slider.width = (float)sliderWidth; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3635 if (slider.x <= (bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH))) slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3636 else if ((slider.x + slider.width) >= (bounds.x + bounds.width)) slider.x = bounds.x + bounds.width - slider.width - GuiGetStyle(SLIDER, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3637 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3638 else if (sliderWidth == 0) // SliderBar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3639 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3640 slider.x += GuiGetStyle(SLIDER, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3641 slider.width = sliderValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3642 if (slider.width > bounds.width) slider.width = bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3643 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3644 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3645 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3646 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3647 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3648 GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), GetColor(GuiGetStyle(SLIDER, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3649 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3650 // Draw slider internal bar (depends on state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3651 if (state == STATE_NORMAL) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3652 else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3653 else if (state == STATE_PRESSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3654 else if (state == STATE_DISABLED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_DISABLED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3655 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3656 // Draw left/right text if provided |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3657 if (textLeft != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3658 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3659 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3660 textBounds.width = (float)GuiGetTextWidth(textLeft); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3661 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3662 textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SLIDER, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3663 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3664 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3665 GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3666 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3667 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3668 if (textRight != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3669 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3670 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3671 textBounds.width = (float)GuiGetTextWidth(textRight); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3672 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3673 textBounds.x = bounds.x + bounds.width + GuiGetStyle(SLIDER, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3674 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3675 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3676 GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3677 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3678 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3679 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3680 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3681 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3682 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3683 // Slider Bar control extended, returns selected value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3684 int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3685 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3686 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3687 int preSliderWidth = GuiGetStyle(SLIDER, SLIDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3688 GuiSetStyle(SLIDER, SLIDER_WIDTH, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3689 result = GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3690 GuiSetStyle(SLIDER, SLIDER_WIDTH, preSliderWidth); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3691 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3692 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3693 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3694 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3695 // Progress Bar control extended, shows current progress value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3696 int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3697 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3698 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3699 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3700 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3701 float temp = (maxValue - minValue)/2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3702 if (value == NULL) value = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3703 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3704 // Progress bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3705 Rectangle progress = { bounds.x + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3706 bounds.y + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) + GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING), 0, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3707 bounds.height - GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - 2*GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING) -1 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3708 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3709 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3710 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3711 if (*value > maxValue) *value = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3712 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3713 // WARNING: Working with floats could lead to rounding issues |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3714 if ((state != STATE_DISABLED)) progress.width = ((float)*value/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3715 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3716 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3717 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3718 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3719 if (state == STATE_DISABLED) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3720 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3721 GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), BLANK); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3722 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3723 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3724 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3725 if (*value > minValue) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3726 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3727 // Draw progress bar with colored border, more visual |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3728 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3729 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height - 2 }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3730 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3731 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3732 else GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height+GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)-1 }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3733 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3734 if (*value >= maxValue) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.y, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height+GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)-1}, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3735 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3736 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3737 // Draw borders not yet reached by value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3738 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.y, bounds.width - (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - (int)progress.width - 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3739 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.y + bounds.height - 1, bounds.width - (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - (int)progress.width - 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3740 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.y, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height+GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)-1 }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3741 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3742 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3743 // Draw slider internal progress bar (depends on state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3744 GuiDrawRectangle(progress, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3745 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3746 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3747 // Draw left/right text if provided |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3748 if (textLeft != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3749 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3750 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3751 textBounds.width = (float)GuiGetTextWidth(textLeft); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3752 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3753 textBounds.x = bounds.x - textBounds.width - GuiGetStyle(PROGRESSBAR, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3754 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3755 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3756 GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3757 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3758 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3759 if (textRight != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3760 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3761 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3762 textBounds.width = (float)GuiGetTextWidth(textRight); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3763 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3764 textBounds.x = bounds.x + bounds.width + GuiGetStyle(PROGRESSBAR, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3765 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3766 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3767 GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3768 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3769 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3770 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3771 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3772 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3773 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3774 // Status Bar control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3775 int GuiStatusBar(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3776 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3777 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3778 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3779 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3780 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3781 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3782 GuiDrawRectangle(bounds, GuiGetStyle(STATUSBAR, BORDER_WIDTH), GetColor(GuiGetStyle(STATUSBAR, BORDER + (state*3))), GetColor(GuiGetStyle(STATUSBAR, BASE + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3783 GuiDrawText(text, GetTextBounds(STATUSBAR, bounds), GuiGetStyle(STATUSBAR, TEXT_ALIGNMENT), GetColor(GuiGetStyle(STATUSBAR, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3784 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3785 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3786 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3787 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3788 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3789 // Dummy rectangle control, intended for placeholding |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3790 int GuiDummyRec(Rectangle bounds, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3791 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3792 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3793 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3794 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3795 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3796 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3797 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3798 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3799 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3800 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3801 // Check button state |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3802 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3803 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3804 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3805 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3806 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3807 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3808 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3809 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3810 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3811 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3812 GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3813 GuiDrawText(text, GetTextBounds(DEFAULT, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(BUTTON, (state != STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3814 //------------------------------------------------------------------ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3815 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3816 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3817 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3818 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3819 // List View control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3820 int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3821 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3822 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3823 int itemCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3824 const char **items = NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3825 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3826 if (text != NULL) items = GuiTextSplit(text, ';', &itemCount, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3827 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3828 result = GuiListViewEx(bounds, items, itemCount, scrollIndex, active, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3829 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3830 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3831 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3832 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3833 // List View control with extended parameters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3834 int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3835 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3836 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3837 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3838 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3839 int itemFocused = (focus == NULL)? -1 : *focus; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3840 int itemSelected = (active == NULL)? -1 : *active; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3841 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3842 // Check if we need a scroll bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3843 bool useScrollBar = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3844 if ((GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING))*count > bounds.height) useScrollBar = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3845 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3846 // Define base item rectangle [0] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3847 Rectangle itemBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3848 itemBounds.x = bounds.x + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3849 itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3850 itemBounds.width = bounds.width - 2*GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) - GuiGetStyle(DEFAULT, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3851 itemBounds.height = (float)GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3852 if (useScrollBar) itemBounds.width -= GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3853 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3854 // Get items on the list |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3855 int visibleItems = (int)bounds.height/(GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3856 if (visibleItems > count) visibleItems = count; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3857 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3858 int startIndex = (scrollIndex == NULL)? 0 : *scrollIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3859 if ((startIndex < 0) || (startIndex > (count - visibleItems))) startIndex = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3860 int endIndex = startIndex + visibleItems; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3861 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3862 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3863 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3864 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3865 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3866 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3867 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3868 // Check mouse inside list view |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3869 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3870 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3871 state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3872 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3873 // Check focused and selected item |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3874 for (int i = 0; i < visibleItems; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3875 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3876 if (CheckCollisionPointRec(mousePoint, itemBounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3877 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3878 itemFocused = startIndex + i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3879 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3880 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3881 if (itemSelected == (startIndex + i)) itemSelected = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3882 else itemSelected = startIndex + i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3883 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3884 break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3885 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3886 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3887 // Update item rectangle y position for next item |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3888 itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3889 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3890 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3891 if (useScrollBar) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3892 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3893 int wheelMove = (int)GetMouseWheelMove(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3894 startIndex -= wheelMove; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3895 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3896 if (startIndex < 0) startIndex = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3897 else if (startIndex > (count - visibleItems)) startIndex = count - visibleItems; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3898 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3899 endIndex = startIndex + visibleItems; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3900 if (endIndex > count) endIndex = count; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3901 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3902 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3903 else itemFocused = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3904 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3905 // Reset item rectangle y to [0] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3906 itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3907 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3908 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3909 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3910 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3911 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3912 GuiDrawRectangle(bounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3913 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3914 // Draw visible items |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3915 for (int i = 0; ((i < visibleItems) && (text != NULL)); i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3916 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3917 if (GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_NORMAL)) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_NORMAL)), BLANK); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3918 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3919 if (state == STATE_DISABLED) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3920 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3921 if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3922 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3923 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3924 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3925 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3926 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3927 if (((startIndex + i) == itemSelected) && (active != NULL)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3928 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3929 // Draw item selected |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3930 GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3931 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3932 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3933 else if (((startIndex + i) == itemFocused)) // && (focus != NULL)) // NOTE: We want items focused, despite not returned! |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3934 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3935 // Draw item focused |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3936 GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3937 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3938 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3939 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3940 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3941 // Draw item normal (no rectangle) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3942 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3943 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3944 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3945 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3946 // Update item rectangle y position for next item |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3947 itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3948 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3949 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3950 if (useScrollBar) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3951 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3952 Rectangle scrollBarBounds = { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3953 bounds.x + bounds.width - GuiGetStyle(LISTVIEW, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3954 bounds.y + GuiGetStyle(LISTVIEW, BORDER_WIDTH), (float)GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3955 bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3956 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3957 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3958 // Calculate percentage of visible items and apply same percentage to scrollbar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3959 float percentVisible = (float)(endIndex - startIndex)/count; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3960 float sliderSize = bounds.height*percentVisible; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3961 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3962 int prevSliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); // Save default slider size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3963 int prevScrollSpeed = GuiGetStyle(SCROLLBAR, SCROLL_SPEED); // Save default scroll speed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3964 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)sliderSize); // Change slider size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3965 GuiSetStyle(SCROLLBAR, SCROLL_SPEED, count - visibleItems); // Change scroll speed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3966 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3967 startIndex = GuiScrollBar(scrollBarBounds, startIndex, 0, count - visibleItems); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3968 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3969 GuiSetStyle(SCROLLBAR, SCROLL_SPEED, prevScrollSpeed); // Reset scroll speed to default |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3970 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, prevSliderSize); // Reset slider size to default |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3971 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3972 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3973 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3974 if (active != NULL) *active = itemSelected; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3975 if (focus != NULL) *focus = itemFocused; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3976 if (scrollIndex != NULL) *scrollIndex = startIndex; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3977 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3978 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3979 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3980 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3981 // Color Panel control - Color (RGBA) variant |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3982 int GuiColorPanel(Rectangle bounds, const char *text, Color *color) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3983 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3984 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3985 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3986 Vector3 vcolor = { (float)color->r/255.0f, (float)color->g/255.0f, (float)color->b/255.0f }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3987 Vector3 hsv = ConvertRGBtoHSV(vcolor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3988 Vector3 prevHsv = hsv; // workaround to see if GuiColorPanelHSV modifies the hsv |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3989 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3990 GuiColorPanelHSV(bounds, text, &hsv); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3991 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3992 // Check if the hsv was changed, only then change the color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3993 // This is required, because the Color->HSV->Color conversion has precision errors |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3994 // Thus the assignment from HSV to Color should only be made, if the HSV has a new user-entered value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3995 // Otherwise GuiColorPanel would often modify it's color without user input |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3996 // TODO: GuiColorPanelHSV could return 1 if the slider was dragged, to simplify this check |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3997 if (hsv.x != prevHsv.x || hsv.y != prevHsv.y || hsv.z != prevHsv.z) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3998 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3999 Vector3 rgb = ConvertHSVtoRGB(hsv); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4000 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4001 // NOTE: Vector3ToColor() only available on raylib 1.8.1 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4002 *color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4003 (unsigned char)(255.0f*rgb.y), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4004 (unsigned char)(255.0f*rgb.z), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4005 color->a }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4006 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4007 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4008 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4009 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4010 // Color Bar Alpha control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4011 // NOTE: Returns alpha value normalized [0..1] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4012 int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4013 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4014 #if !defined(RAYGUI_COLORBARALPHA_CHECKED_SIZE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4015 #define RAYGUI_COLORBARALPHA_CHECKED_SIZE 10 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4016 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4017 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4018 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4019 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4020 Rectangle selector = { (float)bounds.x + (*alpha)*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4021 (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4022 (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4023 (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4024 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4025 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4026 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4027 if ((state != STATE_DISABLED) && !guiLocked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4028 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4029 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4030 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4031 if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4032 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4033 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4034 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4035 if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4036 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4037 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4038 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4039 *alpha = (mousePoint.x - bounds.x)/bounds.width; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4040 if (*alpha <= 0.0f) *alpha = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4041 if (*alpha >= 1.0f) *alpha = 1.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4042 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4043 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4044 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4045 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4046 guiControlExclusiveMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4047 guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4048 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4049 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4050 else if (CheckCollisionPointRec(mousePoint, bounds) || CheckCollisionPointRec(mousePoint, selector)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4051 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4052 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4053 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4054 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4055 guiControlExclusiveMode = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4056 guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4057 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4058 *alpha = (mousePoint.x - bounds.x)/bounds.width; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4059 if (*alpha <= 0.0f) *alpha = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4060 if (*alpha >= 1.0f) *alpha = 1.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4061 //selector.x = bounds.x + (int)(((alpha - 0)/(100 - 0))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))) - selector.width/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4062 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4063 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4064 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4065 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4066 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4067 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4068 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4069 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4070 // Draw alpha bar: checked background |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4071 if (state != STATE_DISABLED) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4072 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4073 int checksX = (int)bounds.width/RAYGUI_COLORBARALPHA_CHECKED_SIZE; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4074 int checksY = (int)bounds.height/RAYGUI_COLORBARALPHA_CHECKED_SIZE; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4075 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4076 for (int x = 0; x < checksX; x++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4077 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4078 for (int y = 0; y < checksY; y++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4079 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4080 Rectangle check = { bounds.x + x*RAYGUI_COLORBARALPHA_CHECKED_SIZE, bounds.y + y*RAYGUI_COLORBARALPHA_CHECKED_SIZE, RAYGUI_COLORBARALPHA_CHECKED_SIZE, RAYGUI_COLORBARALPHA_CHECKED_SIZE }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4081 GuiDrawRectangle(check, 0, BLANK, ((x + y)%2)? Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.4f) : Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.4f)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4082 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4083 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4084 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4085 DrawRectangleGradientEx(bounds, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4086 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4087 else DrawRectangleGradientEx(bounds, Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4088 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4089 GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4090 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4091 // Draw alpha bar: selector |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4092 GuiDrawRectangle(selector, 0, BLANK, GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4093 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4094 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4095 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4096 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4097 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4098 // Color Bar Hue control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4099 // Returns hue value normalized [0..1] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4100 // NOTE: Other similar bars (for reference): |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4101 // Color GuiColorBarSat() [WHITE->color] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4102 // Color GuiColorBarValue() [BLACK->color], HSV/HSL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4103 // float GuiColorBarLuminance() [BLACK->WHITE] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4104 int GuiColorBarHue(Rectangle bounds, const char *text, float *hue) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4105 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4106 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4107 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4108 Rectangle selector = { (float)bounds.x - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y + (*hue)/360.0f*bounds.height - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2, (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4109 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4110 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4111 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4112 if ((state != STATE_DISABLED) && !guiLocked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4113 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4114 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4115 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4116 if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4117 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4118 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4119 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4120 if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4121 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4122 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4123 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4124 *hue = (mousePoint.y - bounds.y)*360/bounds.height; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4125 if (*hue <= 0.0f) *hue = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4126 if (*hue >= 359.0f) *hue = 359.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4127 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4128 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4129 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4130 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4131 guiControlExclusiveMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4132 guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4133 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4134 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4135 else if (CheckCollisionPointRec(mousePoint, bounds) || CheckCollisionPointRec(mousePoint, selector)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4136 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4137 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4138 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4139 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4140 guiControlExclusiveMode = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4141 guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4142 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4143 *hue = (mousePoint.y - bounds.y)*360/bounds.height; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4144 if (*hue <= 0.0f) *hue = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4145 if (*hue >= 359.0f) *hue = 359.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4146 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4147 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4148 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4149 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4150 /*if (IsKeyDown(KEY_UP)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4151 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4152 hue -= 2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4153 if (hue <= 0.0f) hue = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4154 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4155 else if (IsKeyDown(KEY_DOWN)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4156 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4157 hue += 2.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4158 if (hue >= 360.0f) hue = 360.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4159 }*/ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4160 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4161 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4162 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4163 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4164 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4165 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4166 if (state != STATE_DISABLED) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4167 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4168 // Draw hue bar:color bars |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4169 // TODO: Use directly DrawRectangleGradientEx(bounds, color1, color2, color2, color1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4170 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4171 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + bounds.height/6), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 0, 255 }, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4172 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 2*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 255, 255 }, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4173 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 3*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 255, 255 }, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4174 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 4*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 255, 255 }, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4175 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 5*(bounds.height/6)), (int)bounds.width, (int)(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 0, 255 }, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4176 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4177 else DrawRectangleGradientV((int)bounds.x, (int)bounds.y, (int)bounds.width, (int)bounds.height, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4178 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4179 GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4180 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4181 // Draw hue bar: selector |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4182 GuiDrawRectangle(selector, 0, BLANK, GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4183 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4184 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4185 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4186 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4187 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4188 // Color Picker control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4189 // NOTE: It's divided in multiple controls: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4190 // Color GuiColorPanel(Rectangle bounds, Color color) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4191 // float GuiColorBarAlpha(Rectangle bounds, float alpha) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4192 // float GuiColorBarHue(Rectangle bounds, float value) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4193 // NOTE: bounds define GuiColorPanel() size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4194 // NOTE: this picker converts RGB to HSV, which can cause the Hue control to jump. If you have this problem, consider using the HSV variant instead |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4195 int GuiColorPicker(Rectangle bounds, const char *text, Color *color) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4196 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4197 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4198 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4199 Color temp = { 200, 0, 0, 255 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4200 if (color == NULL) color = &temp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4201 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4202 GuiColorPanel(bounds, NULL, color); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4203 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4204 Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4205 //Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4206 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4207 // NOTE: this conversion can cause low hue-resolution, if the r, g and b value are very similar, which causes the hue bar to shift around when only the GuiColorPanel is used |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4208 Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ (*color).r/255.0f, (*color).g/255.0f, (*color).b/255.0f }); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4209 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4210 GuiColorBarHue(boundsHue, NULL, &hsv.x); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4211 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4212 //color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4213 Vector3 rgb = ConvertHSVtoRGB(hsv); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4214 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4215 *color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), (*color).a }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4216 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4217 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4218 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4219 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4220 // Color Picker control that avoids conversion to RGB and back to HSV on each call, thus avoiding jittering |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4221 // The user can call ConvertHSVtoRGB() to convert *colorHsv value to RGB |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4222 // NOTE: It's divided in multiple controls: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4223 // int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4224 // int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4225 // float GuiColorBarHue(Rectangle bounds, float value) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4226 // NOTE: bounds define GuiColorPanelHSV() size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4227 int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4228 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4229 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4230 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4231 Vector3 tempHsv = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4232 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4233 if (colorHsv == NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4234 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4235 const Vector3 tempColor = { 200.0f/255.0f, 0.0f, 0.0f }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4236 tempHsv = ConvertRGBtoHSV(tempColor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4237 colorHsv = &tempHsv; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4238 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4239 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4240 GuiColorPanelHSV(bounds, NULL, colorHsv); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4241 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4242 const Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4243 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4244 GuiColorBarHue(boundsHue, NULL, &colorHsv->x); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4245 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4246 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4247 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4248 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4249 // Color Panel control - HSV variant |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4250 int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4251 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4252 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4253 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4254 Vector2 pickerSelector = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4255 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4256 const Color colWhite = { 255, 255, 255, 255 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4257 const Color colBlack = { 0, 0, 0, 255 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4258 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4259 pickerSelector.x = bounds.x + (float)colorHsv->y*bounds.width; // HSV: Saturation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4260 pickerSelector.y = bounds.y + (1.0f - (float)colorHsv->z)*bounds.height; // HSV: Value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4261 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4262 Vector3 maxHue = { colorHsv->x, 1.0f, 1.0f }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4263 Vector3 rgbHue = ConvertHSVtoRGB(maxHue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4264 Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4265 (unsigned char)(255.0f*rgbHue.y), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4266 (unsigned char)(255.0f*rgbHue.z), 255 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4267 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4268 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4269 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4270 if ((state != STATE_DISABLED) && !guiLocked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4271 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4272 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4273 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4274 if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4275 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4276 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4277 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4278 if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4279 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4280 pickerSelector = mousePoint; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4281 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4282 if (pickerSelector.x < bounds.x) pickerSelector.x = bounds.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4283 if (pickerSelector.x > bounds.x + bounds.width) pickerSelector.x = bounds.x + bounds.width; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4284 if (pickerSelector.y < bounds.y) pickerSelector.y = bounds.y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4285 if (pickerSelector.y > bounds.y + bounds.height) pickerSelector.y = bounds.y + bounds.height; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4286 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4287 // Calculate color from picker |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4288 Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4289 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4290 colorPick.x /= (float)bounds.width; // Get normalized value on x |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4291 colorPick.y /= (float)bounds.height; // Get normalized value on y |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4292 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4293 colorHsv->y = colorPick.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4294 colorHsv->z = 1.0f - colorPick.y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4295 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4296 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4297 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4298 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4299 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4300 guiControlExclusiveMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4301 guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4302 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4303 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4304 else if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4305 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4306 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4307 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4308 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4309 guiControlExclusiveMode = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4310 guiControlExclusiveRec = bounds; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4311 pickerSelector = mousePoint; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4312 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4313 // Calculate color from picker |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4314 Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4315 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4316 colorPick.x /= (float)bounds.width; // Get normalized value on x |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4317 colorPick.y /= (float)bounds.height; // Get normalized value on y |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4318 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4319 colorHsv->y = colorPick.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4320 colorHsv->z = 1.0f - colorPick.y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4321 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4322 else state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4323 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4324 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4325 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4326 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4327 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4328 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4329 if (state != STATE_DISABLED) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4330 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4331 DrawRectangleGradientEx(bounds, Fade(colWhite, guiAlpha), Fade(colWhite, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4332 DrawRectangleGradientEx(bounds, Fade(colBlack, 0), Fade(colBlack, guiAlpha), Fade(colBlack, guiAlpha), Fade(colBlack, 0)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4333 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4334 // Draw color picker: selector |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4335 Rectangle selector = { pickerSelector.x - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, pickerSelector.y - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE), (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4336 GuiDrawRectangle(selector, 0, BLANK, colWhite); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4337 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4338 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4339 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4340 DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4341 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4342 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4343 GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4344 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4345 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4346 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4347 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4348 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4349 // Message Box control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4350 int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4351 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4352 #if !defined(RAYGUI_MESSAGEBOX_BUTTON_HEIGHT) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4353 #define RAYGUI_MESSAGEBOX_BUTTON_HEIGHT 24 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4354 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4355 #if !defined(RAYGUI_MESSAGEBOX_BUTTON_PADDING) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4356 #define RAYGUI_MESSAGEBOX_BUTTON_PADDING 12 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4357 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4358 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4359 int result = -1; // Returns clicked button from buttons list, 0 refers to closed window button |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4360 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4361 int buttonCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4362 const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4363 Rectangle buttonBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4364 buttonBounds.x = bounds.x + RAYGUI_MESSAGEBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4365 buttonBounds.y = bounds.y + bounds.height - RAYGUI_MESSAGEBOX_BUTTON_HEIGHT - RAYGUI_MESSAGEBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4366 buttonBounds.width = (bounds.width - RAYGUI_MESSAGEBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4367 buttonBounds.height = RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4368 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4369 //int textWidth = GuiGetTextWidth(message) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4370 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4371 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4372 textBounds.x = bounds.x + RAYGUI_MESSAGEBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4373 textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + RAYGUI_MESSAGEBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4374 textBounds.width = bounds.width - RAYGUI_MESSAGEBOX_BUTTON_PADDING*2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4375 textBounds.height = bounds.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 3*RAYGUI_MESSAGEBOX_BUTTON_PADDING - RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4376 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4377 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4378 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4379 if (GuiWindowBox(bounds, title)) result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4380 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4381 int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4382 GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4383 GuiLabel(textBounds, message); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4384 GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4385 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4386 prevTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4387 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4388 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4389 for (int i = 0; i < buttonCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4390 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4391 if (GuiButton(buttonBounds, buttonsText[i])) result = i + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4392 buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4393 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4394 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4395 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevTextAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4396 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4397 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4398 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4399 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4400 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4401 // Text Input Box control, ask for text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4402 int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4403 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4404 #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4405 #define RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT 24 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4406 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4407 #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_PADDING) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4408 #define RAYGUI_TEXTINPUTBOX_BUTTON_PADDING 12 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4409 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4410 #if !defined(RAYGUI_TEXTINPUTBOX_HEIGHT) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4411 #define RAYGUI_TEXTINPUTBOX_HEIGHT 26 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4412 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4413 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4414 // Used to enable text edit mode |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4415 // WARNING: No more than one GuiTextInputBox() should be open at the same time |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4416 static bool textEditMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4417 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4418 int result = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4419 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4420 int buttonCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4421 const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4422 Rectangle buttonBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4423 buttonBounds.x = bounds.x + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4424 buttonBounds.y = bounds.y + bounds.height - RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4425 buttonBounds.width = (bounds.width - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4426 buttonBounds.height = RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4427 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4428 int messageInputHeight = (int)bounds.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT - 2*RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4429 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4430 Rectangle textBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4431 if (message != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4432 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4433 int textSize = GuiGetTextWidth(message) + 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4434 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4435 textBounds.x = bounds.x + bounds.width/2 - textSize/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4436 textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + messageInputHeight/4 - (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4437 textBounds.width = (float)textSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4438 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4439 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4440 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4441 Rectangle textBoxBounds = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4442 textBoxBounds.x = bounds.x + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4443 textBoxBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - RAYGUI_TEXTINPUTBOX_HEIGHT/2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4444 if (message == NULL) textBoxBounds.y = bounds.y + 24 + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4445 else textBoxBounds.y += (messageInputHeight/2 + messageInputHeight/4); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4446 textBoxBounds.width = bounds.width - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING*2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4447 textBoxBounds.height = RAYGUI_TEXTINPUTBOX_HEIGHT; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4448 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4449 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4450 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4451 if (GuiWindowBox(bounds, title)) result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4452 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4453 // Draw message if available |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4454 if (message != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4455 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4456 int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4457 GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4458 GuiLabel(textBounds, message); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4459 GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4460 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4461 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4462 if (secretViewActive != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4463 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4464 static char stars[] = "****************"; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4465 if (GuiTextBox(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x, textBoxBounds.y, textBoxBounds.width - 4 - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.height }, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4466 ((*secretViewActive == 1) || textEditMode)? text : stars, textMaxSize, textEditMode)) textEditMode = !textEditMode; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4467 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4468 GuiToggle(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x + textBoxBounds.width - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.y, RAYGUI_TEXTINPUTBOX_HEIGHT, RAYGUI_TEXTINPUTBOX_HEIGHT }, (*secretViewActive == 1)? "#44#" : "#45#", secretViewActive); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4469 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4470 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4471 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4472 if (GuiTextBox(textBoxBounds, text, textMaxSize, textEditMode)) textEditMode = !textEditMode; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4473 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4474 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4475 int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4476 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4477 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4478 for (int i = 0; i < buttonCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4479 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4480 if (GuiButton(buttonBounds, buttonsText[i])) result = i + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4481 buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4482 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4483 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4484 if (result >= 0) textEditMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4485 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4486 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevBtnTextAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4487 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4488 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4489 return result; // Result is the pressed button index |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4490 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4491 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4492 // Grid control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4493 // NOTE: Returns grid mouse-hover selected cell |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4494 // About drawing lines at subpixel spacing, simple put, not easy solution: |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
4495 // REF: https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster |
|
54
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4496 int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4497 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4498 // Grid lines alpha amount |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4499 #if !defined(RAYGUI_GRID_ALPHA) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4500 #define RAYGUI_GRID_ALPHA 0.15f |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4501 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4502 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4503 int result = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4504 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4505 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4506 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4507 Vector2 currentMouseCell = { -1, -1 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4508 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4509 float spaceWidth = spacing/(float)subdivs; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4510 int linesV = (int)(bounds.width/spaceWidth) + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4511 int linesH = (int)(bounds.height/spaceWidth) + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4512 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4513 int color = GuiGetStyle(DEFAULT, LINE_COLOR); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4514 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4515 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4516 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4517 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4518 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4519 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4520 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4521 // NOTE: Cell values must be the upper left of the cell the mouse is in |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4522 currentMouseCell.x = floorf((mousePoint.x - bounds.x)/spacing); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4523 currentMouseCell.y = floorf((mousePoint.y - bounds.y)/spacing); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4524 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4525 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4526 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4527 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4528 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4529 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4530 if (state == STATE_DISABLED) color = GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4531 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4532 if (subdivs > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4533 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4534 // Draw vertical grid lines |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4535 for (int i = 0; i < linesV; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4536 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4537 Rectangle lineV = { bounds.x + spacing*i/subdivs, bounds.y, 1, bounds.height + 1 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4538 GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0)? GuiFade(GetColor(color), RAYGUI_GRID_ALPHA*4) : GuiFade(GetColor(color), RAYGUI_GRID_ALPHA)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4539 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4540 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4541 // Draw horizontal grid lines |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4542 for (int i = 0; i < linesH; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4543 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4544 Rectangle lineH = { bounds.x, bounds.y + spacing*i/subdivs, bounds.width + 1, 1 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4545 GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0)? GuiFade(GetColor(color), RAYGUI_GRID_ALPHA*4) : GuiFade(GetColor(color), RAYGUI_GRID_ALPHA)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4546 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4547 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4548 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4549 if (mouseCell != NULL) *mouseCell = currentMouseCell; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4550 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4551 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4552 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4553 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4554 // Tooltip management functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4555 // NOTE: Tooltips requires some global variables: tooltipPtr |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4556 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4557 // Enable gui tooltips (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4558 void GuiEnableTooltip(void) { guiTooltip = true; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4559 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4560 // Disable gui tooltips (global state) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4561 void GuiDisableTooltip(void) { guiTooltip = false; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4562 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4563 // Set tooltip string |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4564 void GuiSetTooltip(const char *tooltip) { guiTooltipPtr = tooltip; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4565 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4566 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4567 // Styles loading functions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4568 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4569 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4570 // Load raygui style file (.rgs) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4571 // NOTE: By default a binary file is expected, that file could contain a custom font, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4572 // in that case, custom font image atlas is GRAY+ALPHA and pixel data can be compressed (DEFLATE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4573 void GuiLoadStyle(const char *fileName) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4574 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4575 #define MAX_LINE_BUFFER_SIZE 256 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4576 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4577 bool tryBinary = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4578 if (!guiStyleLoaded) GuiLoadStyleDefault(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4579 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4580 // Try reading the files as text file first |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4581 FILE *rgsFile = fopen(fileName, "rt"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4582 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4583 if (rgsFile != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4584 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4585 char buffer[MAX_LINE_BUFFER_SIZE] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4586 fgets(buffer, MAX_LINE_BUFFER_SIZE, rgsFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4587 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4588 if (buffer[0] == '#') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4589 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4590 int controlId = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4591 int propertyId = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4592 unsigned int propertyValue = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4593 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4594 while (!feof(rgsFile)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4595 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4596 switch (buffer[0]) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4597 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4598 case 'p': |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4599 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4600 // Style property: p <control_id> <property_id> <property_value> <property_name> |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4601 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4602 sscanf(buffer, "p %d %d 0x%x", &controlId, &propertyId, &propertyValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4603 GuiSetStyle(controlId, propertyId, (int)propertyValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4604 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4605 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4606 case 'f': |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4607 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4608 // Style font: f <gen_font_size> <charmap_file> <font_file> |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4609 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4610 int fontSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4611 char charmapFileName[256] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4612 char fontFileName[256] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4613 sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4614 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4615 Font font = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4616 int *codepoints = NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4617 int codepointCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4618 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4619 if (charmapFileName[0] != '0') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4620 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4621 // Load text data from file |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4622 // NOTE: Expected an UTF-8 array of codepoints, no separation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4623 char *textData = LoadFileText(TextFormat("%s/%s", GetDirectoryPath(fileName), charmapFileName)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4624 codepoints = LoadCodepoints(textData, &codepointCount); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4625 UnloadFileText(textData); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4626 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4627 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4628 if (fontFileName[0] != '\0') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4629 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4630 // In case a font is already loaded and it is not default internal font, unload it |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4631 if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4632 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4633 if (codepointCount > 0) font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, codepoints, codepointCount); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4634 else font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0); // Default to 95 standard codepoints |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4635 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4636 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4637 // If font texture not properly loaded, revert to default font and size/spacing |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4638 if (font.texture.id == 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4639 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4640 font = GetFontDefault(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4641 GuiSetStyle(DEFAULT, TEXT_SIZE, 10); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4642 GuiSetStyle(DEFAULT, TEXT_SPACING, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4643 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4644 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4645 UnloadCodepoints(codepoints); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4646 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4647 if ((font.texture.id > 0) && (font.glyphCount > 0)) GuiSetFont(font); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4648 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4649 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4650 default: break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4651 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4652 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4653 fgets(buffer, MAX_LINE_BUFFER_SIZE, rgsFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4654 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4655 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4656 else tryBinary = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4657 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4658 fclose(rgsFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4659 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4660 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4661 if (tryBinary) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4662 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4663 rgsFile = fopen(fileName, "rb"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4664 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4665 if (rgsFile != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4666 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4667 fseek(rgsFile, 0, SEEK_END); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4668 int fileDataSize = ftell(rgsFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4669 fseek(rgsFile, 0, SEEK_SET); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4670 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4671 if (fileDataSize > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4672 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4673 unsigned char *fileData = (unsigned char *)RAYGUI_CALLOC(fileDataSize, sizeof(unsigned char)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4674 fread(fileData, sizeof(unsigned char), fileDataSize, rgsFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4675 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4676 GuiLoadStyleFromMemory(fileData, fileDataSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4677 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4678 RAYGUI_FREE(fileData); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4679 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4680 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4681 fclose(rgsFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4682 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4683 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4684 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4685 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4686 // Load style default over global style |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4687 void GuiLoadStyleDefault(void) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4688 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4689 // We set this variable first to avoid cyclic function calls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4690 // when calling GuiSetStyle() and GuiGetStyle() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4691 guiStyleLoaded = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4692 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4693 // Initialize default LIGHT style property values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4694 // WARNING: Default value are applied to all controls on set but |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4695 // they can be overwritten later on for every custom control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4696 GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, 0x838383ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4697 GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, 0xc9c9c9ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4698 GuiSetStyle(DEFAULT, TEXT_COLOR_NORMAL, 0x686868ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4699 GuiSetStyle(DEFAULT, BORDER_COLOR_FOCUSED, 0x5bb2d9ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4700 GuiSetStyle(DEFAULT, BASE_COLOR_FOCUSED, 0xc9effeff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4701 GuiSetStyle(DEFAULT, TEXT_COLOR_FOCUSED, 0x6c9bbcff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4702 GuiSetStyle(DEFAULT, BORDER_COLOR_PRESSED, 0x0492c7ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4703 GuiSetStyle(DEFAULT, BASE_COLOR_PRESSED, 0x97e8ffff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4704 GuiSetStyle(DEFAULT, TEXT_COLOR_PRESSED, 0x368bafff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4705 GuiSetStyle(DEFAULT, BORDER_COLOR_DISABLED, 0xb5c1c2ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4706 GuiSetStyle(DEFAULT, BASE_COLOR_DISABLED, 0xe6e9e9ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4707 GuiSetStyle(DEFAULT, TEXT_COLOR_DISABLED, 0xaeb7b8ff); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4708 GuiSetStyle(DEFAULT, BORDER_WIDTH, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4709 GuiSetStyle(DEFAULT, TEXT_PADDING, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4710 GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4711 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4712 // Initialize default extended property values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4713 // NOTE: By default, extended property values are initialized to 0 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4714 GuiSetStyle(DEFAULT, TEXT_SIZE, 10); // DEFAULT, shared by all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4715 GuiSetStyle(DEFAULT, TEXT_SPACING, 1); // DEFAULT, shared by all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4716 GuiSetStyle(DEFAULT, LINE_COLOR, 0x90abb5ff); // DEFAULT specific property |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4717 GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0xf5f5f5ff); // DEFAULT specific property |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4718 GuiSetStyle(DEFAULT, TEXT_LINE_SPACING, 15); // DEFAULT, 15 pixels between lines |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4719 GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_MIDDLE); // DEFAULT, text aligned vertically to middle of text-bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4720 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4721 // Initialize control-specific property values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4722 // NOTE: Those properties are in default list but require specific values by control type |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4723 GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4724 GuiSetStyle(BUTTON, BORDER_WIDTH, 2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4725 GuiSetStyle(SLIDER, TEXT_PADDING, 4); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4726 GuiSetStyle(PROGRESSBAR, TEXT_PADDING, 4); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4727 GuiSetStyle(CHECKBOX, TEXT_PADDING, 4); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4728 GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_RIGHT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4729 GuiSetStyle(DROPDOWNBOX, TEXT_PADDING, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4730 GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4731 GuiSetStyle(TEXTBOX, TEXT_PADDING, 4); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4732 GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4733 GuiSetStyle(VALUEBOX, TEXT_PADDING, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4734 GuiSetStyle(VALUEBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4735 GuiSetStyle(STATUSBAR, TEXT_PADDING, 8); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4736 GuiSetStyle(STATUSBAR, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4737 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4738 // Initialize extended property values |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4739 // NOTE: By default, extended property values are initialized to 0 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4740 GuiSetStyle(TOGGLE, GROUP_PADDING, 2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4741 GuiSetStyle(SLIDER, SLIDER_WIDTH, 16); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4742 GuiSetStyle(SLIDER, SLIDER_PADDING, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4743 GuiSetStyle(PROGRESSBAR, PROGRESS_PADDING, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4744 GuiSetStyle(CHECKBOX, CHECK_PADDING, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4745 GuiSetStyle(COMBOBOX, COMBO_BUTTON_WIDTH, 32); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4746 GuiSetStyle(COMBOBOX, COMBO_BUTTON_SPACING, 2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4747 GuiSetStyle(DROPDOWNBOX, ARROW_PADDING, 16); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4748 GuiSetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING, 2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4749 GuiSetStyle(VALUEBOX, SPINNER_BUTTON_WIDTH, 24); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4750 GuiSetStyle(VALUEBOX, SPINNER_BUTTON_SPACING, 2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4751 GuiSetStyle(SCROLLBAR, BORDER_WIDTH, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4752 GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4753 GuiSetStyle(SCROLLBAR, ARROWS_SIZE, 6); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4754 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4755 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, 16); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4756 GuiSetStyle(SCROLLBAR, SCROLL_PADDING, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4757 GuiSetStyle(SCROLLBAR, SCROLL_SPEED, 12); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4758 GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, 28); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4759 GuiSetStyle(LISTVIEW, LIST_ITEMS_SPACING, 2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4760 GuiSetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4761 GuiSetStyle(LISTVIEW, SCROLLBAR_WIDTH, 12); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4762 GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, SCROLLBAR_RIGHT_SIDE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4763 GuiSetStyle(COLORPICKER, COLOR_SELECTOR_SIZE, 8); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4764 GuiSetStyle(COLORPICKER, HUEBAR_WIDTH, 16); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4765 GuiSetStyle(COLORPICKER, HUEBAR_PADDING, 8); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4766 GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT, 8); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4767 GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW, 2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4768 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4769 if (guiFont.texture.id != GetFontDefault().texture.id) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4770 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4771 // Unload previous font texture |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4772 UnloadTexture(guiFont.texture); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4773 RAYGUI_FREE(guiFont.recs); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4774 RAYGUI_FREE(guiFont.glyphs); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4775 guiFont.recs = NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4776 guiFont.glyphs = NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4777 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4778 // Setup default raylib font |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4779 guiFont = GetFontDefault(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4780 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4781 // NOTE: Default raylib font character 95 is a white square |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4782 Rectangle whiteChar = guiFont.recs[95]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4783 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4784 // NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4785 SetShapesTexture(guiFont.texture, RAYGUI_CLITERAL(Rectangle){ whiteChar.x + 1, whiteChar.y + 1, whiteChar.width - 2, whiteChar.height - 2 }); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4786 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4787 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4788 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4789 // Get text with icon id prepended |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4790 // NOTE: Useful to add icons by name id (enum) instead of |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4791 // a number that can change between ricon versions |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4792 const char *GuiIconText(int iconId, const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4793 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4794 #if defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4795 return NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4796 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4797 static char buffer[1024] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4798 static char iconBuffer[16] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4799 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4800 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4801 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4802 memset(buffer, 0, 1024); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4803 snprintf(buffer, 1024, "#%03i#", iconId); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4804 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4805 for (int i = 5; i < 1024; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4806 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4807 buffer[i] = text[i - 5]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4808 if (text[i - 5] == '\0') break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4809 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4810 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4811 return buffer; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4812 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4813 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4814 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4815 snprintf(iconBuffer, 16, "#%03i#", iconId); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4816 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4817 return iconBuffer; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4818 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4819 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4820 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4821 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4822 #if !defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4823 // Get full icons data pointer |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4824 unsigned int *GuiGetIcons(void) { return guiIconsPtr; } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4825 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4826 // Load raygui icons file (.rgi) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4827 // NOTE: In case nameIds are required, they can be requested with loadIconsName, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4828 // they are returned as a guiIconsName[iconCount][RAYGUI_ICON_MAX_NAME_LENGTH], |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4829 // WARNING: guiIconsName[]][] memory should be manually freed! |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4830 char **GuiLoadIcons(const char *fileName, bool loadIconsName) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4831 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4832 // Style File Structure (.rgi) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4833 // ------------------------------------------------------ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4834 // Offset | Size | Type | Description |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4835 // ------------------------------------------------------ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4836 // 0 | 4 | char | Signature: "rGI " |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4837 // 4 | 2 | short | Version: 100 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4838 // 6 | 2 | short | reserved |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4839 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4840 // 8 | 2 | short | Num icons (N) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4841 // 10 | 2 | short | Icons size (Options: 16, 32, 64) (S) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4842 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4843 // Icons name id (32 bytes per name id) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4844 // foreach (icon) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4845 // { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4846 // 12+32*i | 32 | char | Icon NameId |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4847 // } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4848 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4849 // Icons data: One bit per pixel, stored as unsigned int array (depends on icon size) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4850 // S*S pixels/32bit per unsigned int = K unsigned int per icon |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4851 // foreach (icon) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4852 // { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4853 // ... | K | unsigned int | Icon Data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4854 // } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4855 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4856 FILE *rgiFile = fopen(fileName, "rb"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4857 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4858 char **guiIconsName = NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4859 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4860 if (rgiFile != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4861 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4862 char signature[5] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4863 short version = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4864 short reserved = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4865 short iconCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4866 short iconSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4867 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4868 fread(signature, 1, 4, rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4869 fread(&version, sizeof(short), 1, rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4870 fread(&reserved, sizeof(short), 1, rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4871 fread(&iconCount, sizeof(short), 1, rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4872 fread(&iconSize, sizeof(short), 1, rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4873 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4874 if ((signature[0] == 'r') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4875 (signature[1] == 'G') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4876 (signature[2] == 'I') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4877 (signature[3] == ' ')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4878 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4879 if (loadIconsName) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4880 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4881 guiIconsName = (char **)RAYGUI_CALLOC(iconCount, sizeof(char *)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4882 for (int i = 0; i < iconCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4883 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4884 guiIconsName[i] = (char *)RAYGUI_CALLOC(RAYGUI_ICON_MAX_NAME_LENGTH, sizeof(char)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4885 fread(guiIconsName[i], 1, RAYGUI_ICON_MAX_NAME_LENGTH, rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4886 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4887 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4888 else fseek(rgiFile, iconCount*RAYGUI_ICON_MAX_NAME_LENGTH, SEEK_CUR); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4889 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4890 // Read icons data directly over internal icons array |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4891 fread(guiIconsPtr, sizeof(unsigned int), (int)iconCount*((int)iconSize*(int)iconSize/32), rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4892 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4893 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4894 fclose(rgiFile); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4895 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4896 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4897 return guiIconsName; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4898 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4899 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4900 // Load icons from memory |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4901 // WARNING: Binary files only |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4902 char **GuiLoadIconsFromMemory(const unsigned char *fileData, int dataSize, bool loadIconsName) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4903 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4904 unsigned char *fileDataPtr = (unsigned char *)fileData; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4905 char **guiIconsName = NULL; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4906 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4907 char signature[5] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4908 short version = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4909 short reserved = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4910 short iconCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4911 short iconSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4912 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4913 memcpy(signature, fileDataPtr, 4); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4914 memcpy(&version, fileDataPtr + 4, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4915 memcpy(&reserved, fileDataPtr + 4 + 2, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4916 memcpy(&iconCount, fileDataPtr + 4 + 2 + 2, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4917 memcpy(&iconSize, fileDataPtr + 4 + 2 + 2 + 2, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4918 fileDataPtr += 12; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4919 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4920 if ((signature[0] == 'r') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4921 (signature[1] == 'G') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4922 (signature[2] == 'I') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4923 (signature[3] == ' ')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4924 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4925 if (loadIconsName) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4926 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4927 guiIconsName = (char **)RAYGUI_CALLOC(iconCount, sizeof(char *)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4928 for (int i = 0; i < iconCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4929 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4930 guiIconsName[i] = (char *)RAYGUI_CALLOC(RAYGUI_ICON_MAX_NAME_LENGTH, sizeof(char)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4931 memcpy(guiIconsName[i], fileDataPtr, RAYGUI_ICON_MAX_NAME_LENGTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4932 fileDataPtr += RAYGUI_ICON_MAX_NAME_LENGTH; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4933 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4934 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4935 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4936 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4937 // Skip icon name data if not required |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4938 fileDataPtr += iconCount*RAYGUI_ICON_MAX_NAME_LENGTH; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4939 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4940 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4941 int iconDataSize = iconCount*((int)iconSize*(int)iconSize/32)*(int)sizeof(unsigned int); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4942 guiIconsPtr = (unsigned int *)RAYGUI_CALLOC(iconDataSize, 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4943 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4944 memcpy(guiIconsPtr, fileDataPtr, iconDataSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4945 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4946 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4947 return guiIconsName; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4948 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4949 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4950 // Draw selected icon using rectangles pixel-by-pixel |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4951 void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4952 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4953 #define BIT_CHECK(a,b) ((a) & (1u<<(b))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4954 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4955 for (int i = 0, y = 0; i < RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4956 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4957 for (int k = 0; k < 32; k++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4958 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4959 if (BIT_CHECK(guiIconsPtr[iconId*RAYGUI_ICON_DATA_ELEMENTS + i], k)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4960 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4961 #if !defined(RAYGUI_STANDALONE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4962 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ (float)posX + (k%RAYGUI_ICON_SIZE)*pixelSize, (float)posY + y*pixelSize, (float)pixelSize, (float)pixelSize }, 0, BLANK, color); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4963 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4964 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4965 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4966 if ((k == 15) || (k == 31)) y++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4967 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4968 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4969 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4970 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4971 // Set icon drawing size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4972 void GuiSetIconScale(int scale) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4973 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4974 if (scale >= 1) guiIconScale = scale; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4975 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4976 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4977 // Get text width considering gui style and icon size (if required) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4978 int GuiGetTextWidth(const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4979 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4980 #if !defined(ICON_TEXT_PADDING) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4981 #define ICON_TEXT_PADDING 4 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4982 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4983 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4984 Vector2 textSize = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4985 int textIconOffset = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4986 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4987 if ((text != NULL) && (text[0] != '\0')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4988 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4989 if (text[0] == '#') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4990 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4991 for (int i = 1; (i < 5) && (text[i] != '\0'); i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4992 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4993 if (text[i] == '#') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4994 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4995 textIconOffset = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4996 break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4997 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4998 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4999 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5000 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5001 text += textIconOffset; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5002 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5003 // Make sure guiFont is set, GuiGetStyle() initializes it lazynessly |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5004 float fontSize = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5005 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5006 // Custom MeasureText() implementation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5007 if ((guiFont.texture.id > 0) && (text != NULL)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5008 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5009 // Get size in bytes of text, considering end of line and line break |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5010 int size = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5011 for (int i = 0; i < MAX_LINE_BUFFER_SIZE; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5012 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5013 if ((text[i] != '\0') && (text[i] != '\n')) size++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5014 else break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5015 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5016 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5017 float scaleFactor = fontSize/(float)guiFont.baseSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5018 textSize.y = (float)guiFont.baseSize*scaleFactor; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5019 float glyphWidth = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5020 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5021 for (int i = 0, codepointSize = 0; i < size; i += codepointSize) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5022 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5023 int codepoint = GetCodepointNext(&text[i], &codepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5024 int codepointIndex = GetGlyphIndex(guiFont, codepoint); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5025 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5026 if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5027 else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5028 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5029 textSize.x += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5030 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5031 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5032 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5033 if (textIconOffset > 0) textSize.x += (RAYGUI_ICON_SIZE + ICON_TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5034 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5035 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5036 return (int)textSize.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5037 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5038 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5039 #endif // !RAYGUI_NO_ICONS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5040 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5041 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5042 // Module Internal Functions Definition |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5043 //---------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5044 // Load style from memory |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5045 // WARNING: Binary files only |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5046 static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5047 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5048 unsigned char *fileDataPtr = (unsigned char *)fileData; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5049 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5050 char signature[5] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5051 short version = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5052 short reserved = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5053 int propertyCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5054 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5055 memcpy(signature, fileDataPtr, 4); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5056 memcpy(&version, fileDataPtr + 4, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5057 memcpy(&reserved, fileDataPtr + 4 + 2, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5058 memcpy(&propertyCount, fileDataPtr + 4 + 2 + 2, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5059 fileDataPtr += 12; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5060 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5061 if ((signature[0] == 'r') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5062 (signature[1] == 'G') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5063 (signature[2] == 'S') && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5064 (signature[3] == ' ')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5065 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5066 short controlId = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5067 short propertyId = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5068 unsigned int propertyValue = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5069 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5070 for (int i = 0; i < propertyCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5071 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5072 memcpy(&controlId, fileDataPtr, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5073 memcpy(&propertyId, fileDataPtr + 2, sizeof(short)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5074 memcpy(&propertyValue, fileDataPtr + 2 + 2, sizeof(unsigned int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5075 fileDataPtr += 8; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5076 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5077 if (controlId == 0) // DEFAULT control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5078 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5079 // If a DEFAULT property is loaded, it is propagated to all controls |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5080 // NOTE: All DEFAULT properties should be defined first in the file |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5081 GuiSetStyle(0, (int)propertyId, propertyValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5082 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5083 if (propertyId < RAYGUI_MAX_PROPS_BASE) for (int j = 1; j < RAYGUI_MAX_CONTROLS; j++) GuiSetStyle(j, (int)propertyId, propertyValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5084 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5085 else GuiSetStyle((int)controlId, (int)propertyId, propertyValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5086 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5087 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5088 // Font loading is highly dependant on raylib API to load font data and image |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5089 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5090 #if !defined(RAYGUI_STANDALONE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5091 // Load custom font if available |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5092 int fontDataSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5093 memcpy(&fontDataSize, fileDataPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5094 fileDataPtr += 4; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5095 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5096 if (fontDataSize > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5097 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5098 Font font = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5099 int fontType = 0; // 0-Normal, 1-SDF |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5100 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5101 memcpy(&font.baseSize, fileDataPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5102 memcpy(&font.glyphCount, fileDataPtr + 4, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5103 memcpy(&fontType, fileDataPtr + 4 + 4, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5104 fileDataPtr += 12; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5105 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5106 // Load font white rectangle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5107 Rectangle fontWhiteRec = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5108 memcpy(&fontWhiteRec, fileDataPtr, sizeof(Rectangle)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5109 fileDataPtr += 16; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5110 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5111 // Load font image parameters |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5112 int fontImageUncompSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5113 int fontImageCompSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5114 memcpy(&fontImageUncompSize, fileDataPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5115 memcpy(&fontImageCompSize, fileDataPtr + 4, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5116 fileDataPtr += 8; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5117 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5118 Image imFont = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5119 imFont.mipmaps = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5120 memcpy(&imFont.width, fileDataPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5121 memcpy(&imFont.height, fileDataPtr + 4, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5122 memcpy(&imFont.format, fileDataPtr + 4 + 4, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5123 fileDataPtr += 12; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5124 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5125 if ((fontImageCompSize > 0) && (fontImageCompSize != fontImageUncompSize)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5126 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5127 // Compressed font atlas image data (DEFLATE), it requires DecompressData() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5128 int dataUncompSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5129 unsigned char *compData = (unsigned char *)RAYGUI_CALLOC(fontImageCompSize, sizeof(unsigned char)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5130 memcpy(compData, fileDataPtr, fontImageCompSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5131 fileDataPtr += fontImageCompSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5132 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5133 imFont.data = DecompressData(compData, fontImageCompSize, &dataUncompSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5134 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5135 // Security check, dataUncompSize must match the provided fontImageUncompSize |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5136 if (dataUncompSize != fontImageUncompSize) RAYGUI_LOG("WARNING: Uncompressed font atlas image data could be corrupted"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5137 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5138 RAYGUI_FREE(compData); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5139 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5140 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5141 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5142 // Font atlas image data is not compressed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5143 imFont.data = (unsigned char *)RAYGUI_CALLOC(fontImageUncompSize, sizeof(unsigned char)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5144 memcpy(imFont.data, fileDataPtr, fontImageUncompSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5145 fileDataPtr += fontImageUncompSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5146 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5147 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5148 if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5149 font.texture = LoadTextureFromImage(imFont); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5150 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5151 RAYGUI_FREE(imFont.data); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5152 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5153 // Validate font atlas texture was loaded correctly |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5154 if (font.texture.id != 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5155 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5156 // Load font recs data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5157 int recsDataSize = font.glyphCount*sizeof(Rectangle); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5158 int recsDataCompressedSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5159 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5160 // WARNING: Version 400 adds the compression size parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5161 if (version >= 400) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5162 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5163 // RGS files version 400 support compressed recs data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5164 memcpy(&recsDataCompressedSize, fileDataPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5165 fileDataPtr += sizeof(int); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5166 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5167 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5168 if ((recsDataCompressedSize > 0) && (recsDataCompressedSize != recsDataSize)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5169 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5170 // Recs data is compressed, uncompress it |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5171 unsigned char *recsDataCompressed = (unsigned char *)RAYGUI_CALLOC(recsDataCompressedSize, sizeof(unsigned char)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5172 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5173 memcpy(recsDataCompressed, fileDataPtr, recsDataCompressedSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5174 fileDataPtr += recsDataCompressedSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5175 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5176 int recsDataUncompSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5177 font.recs = (Rectangle *)DecompressData(recsDataCompressed, recsDataCompressedSize, &recsDataUncompSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5178 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5179 // Security check, data uncompressed size must match the expected original data size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5180 if (recsDataUncompSize != recsDataSize) RAYGUI_LOG("WARNING: Uncompressed font recs data could be corrupted"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5181 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5182 RAYGUI_FREE(recsDataCompressed); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5183 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5184 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5185 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5186 // Recs data is uncompressed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5187 font.recs = (Rectangle *)RAYGUI_CALLOC(font.glyphCount, sizeof(Rectangle)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5188 for (int i = 0; i < font.glyphCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5189 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5190 memcpy(&font.recs[i], fileDataPtr, sizeof(Rectangle)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5191 fileDataPtr += sizeof(Rectangle); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5192 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5193 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5194 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5195 // Load font glyphs info data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5196 int glyphsDataSize = font.glyphCount*16; // 16 bytes data per glyph |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5197 int glyphsDataCompressedSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5198 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5199 // WARNING: Version 400 adds the compression size parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5200 if (version >= 400) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5201 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5202 // RGS files version 400 support compressed glyphs data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5203 memcpy(&glyphsDataCompressedSize, fileDataPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5204 fileDataPtr += sizeof(int); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5205 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5206 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5207 // Allocate required glyphs space to fill with data |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5208 font.glyphs = (GlyphInfo *)RAYGUI_CALLOC(font.glyphCount, sizeof(GlyphInfo)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5209 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5210 if ((glyphsDataCompressedSize > 0) && (glyphsDataCompressedSize != glyphsDataSize)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5211 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5212 // Glyphs data is compressed, uncompress it |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5213 unsigned char *glypsDataCompressed = (unsigned char *)RAYGUI_CALLOC(glyphsDataCompressedSize, sizeof(unsigned char)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5214 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5215 memcpy(glypsDataCompressed, fileDataPtr, glyphsDataCompressedSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5216 fileDataPtr += glyphsDataCompressedSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5217 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5218 int glyphsDataUncompSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5219 unsigned char *glyphsDataUncomp = DecompressData(glypsDataCompressed, glyphsDataCompressedSize, &glyphsDataUncompSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5220 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5221 // Security check, data uncompressed size must match the expected original data size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5222 if (glyphsDataUncompSize != glyphsDataSize) RAYGUI_LOG("WARNING: Uncompressed font glyphs data could be corrupted"); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5223 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5224 unsigned char *glyphsDataUncompPtr = glyphsDataUncomp; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5225 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5226 for (int i = 0; i < font.glyphCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5227 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5228 memcpy(&font.glyphs[i].value, glyphsDataUncompPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5229 memcpy(&font.glyphs[i].offsetX, glyphsDataUncompPtr + 4, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5230 memcpy(&font.glyphs[i].offsetY, glyphsDataUncompPtr + 8, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5231 memcpy(&font.glyphs[i].advanceX, glyphsDataUncompPtr + 12, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5232 glyphsDataUncompPtr += 16; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5233 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5234 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5235 RAYGUI_FREE(glypsDataCompressed); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5236 RAYGUI_FREE(glyphsDataUncomp); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5237 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5238 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5239 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5240 // Glyphs data is uncompressed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5241 for (int i = 0; i < font.glyphCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5242 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5243 memcpy(&font.glyphs[i].value, fileDataPtr, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5244 memcpy(&font.glyphs[i].offsetX, fileDataPtr + 4, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5245 memcpy(&font.glyphs[i].offsetY, fileDataPtr + 8, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5246 memcpy(&font.glyphs[i].advanceX, fileDataPtr + 12, sizeof(int)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5247 fileDataPtr += 16; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5248 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5249 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5250 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5251 else font = GetFontDefault(); // Fallback in case of errors loading font atlas texture |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5252 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5253 GuiSetFont(font); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5254 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5255 // Set font texture source rectangle to be used as white texture to draw shapes |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5256 // NOTE: It makes possible to draw shapes and text (full UI) in a single draw call |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5257 if ((fontWhiteRec.x > 0) && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5258 (fontWhiteRec.y > 0) && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5259 (fontWhiteRec.width > 0) && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5260 (fontWhiteRec.height > 0)) SetShapesTexture(font.texture, fontWhiteRec); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5261 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5262 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5263 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5264 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5265 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5266 // Get text bounds considering control bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5267 static Rectangle GetTextBounds(int control, Rectangle bounds) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5268 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5269 Rectangle textBounds = bounds; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5270 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5271 textBounds.x = bounds.x + GuiGetStyle(control, BORDER_WIDTH); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5272 textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH) + GuiGetStyle(control, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5273 textBounds.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH) - 2*GuiGetStyle(control, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5274 textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH) - 2*GuiGetStyle(control, TEXT_PADDING); // NOTE: Text is processed line per line! |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5275 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5276 // Depending on control, TEXT_PADDING and TEXT_ALIGNMENT properties could affect the text-bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5277 switch (control) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5278 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5279 case COMBOBOX: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5280 case DROPDOWNBOX: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5281 case LISTVIEW: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5282 // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5283 case SLIDER: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5284 case CHECKBOX: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5285 case VALUEBOX: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5286 case CONTROL11: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5287 // TODO: More special cases (label on side): SLIDER, CHECKBOX, VALUEBOX, SPINNER |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5288 default: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5289 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5290 // TODO: WARNING: TEXT_ALIGNMENT is already considered in GuiDrawText() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5291 if (GuiGetStyle(control, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT) textBounds.x -= GuiGetStyle(control, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5292 else textBounds.x += GuiGetStyle(control, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5293 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5294 break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5295 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5296 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5297 return textBounds; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5298 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5299 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5300 // Get text icon if provided and move text cursor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5301 // NOTE: We support up to 999 values for iconId |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5302 static const char *GetTextIcon(const char *text, int *iconId) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5303 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5304 #if !defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5305 *iconId = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5306 if (text[0] == '#') // Maybe we have an icon! |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5307 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5308 char iconValue[4] = { 0 }; // Maximum length for icon value: 3 digits + '\0' |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5309 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5310 int pos = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5311 while ((pos < 4) && (text[pos] >= '0') && (text[pos] <= '9')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5312 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5313 iconValue[pos - 1] = text[pos]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5314 pos++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5315 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5316 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5317 if (text[pos] == '#') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5318 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5319 *iconId = TextToInteger(iconValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5320 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5321 // Move text pointer after icon |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5322 // WARNING: If only icon provided, it could point to EOL character: '\0' |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5323 if (*iconId >= 0) text += (pos + 1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5324 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5325 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5326 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5327 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5328 return text; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5329 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5330 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5331 // Get text divided into lines (by line-breaks '\n') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5332 // WARNING: It returns pointers to new lines but it does not add NULL ('\0') terminator! |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5333 static const char **GetTextLines(const char *text, int *count) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5334 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5335 #define RAYGUI_MAX_TEXT_LINES 128 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5336 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5337 static const char *lines[RAYGUI_MAX_TEXT_LINES] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5338 for (int i = 0; i < RAYGUI_MAX_TEXT_LINES; i++) lines[i] = NULL; // Init NULL pointers to substrings |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5339 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5340 int textLength = (int)strlen(text); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5341 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5342 lines[0] = text; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5343 *count = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5344 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5345 for (int i = 0, k = 0; (i < textLength) && (*count < RAYGUI_MAX_TEXT_LINES); i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5346 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5347 if (text[i] == '\n') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5348 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5349 k++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5350 lines[k] = &text[i + 1]; // WARNING: next value is valid? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5351 *count += 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5352 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5353 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5354 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5355 return lines; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5356 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5357 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5358 // Get text width to next space for provided string |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5359 static float GetNextSpaceWidth(const char *text, int *nextSpaceIndex) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5360 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5361 float width = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5362 int codepointByteCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5363 int codepoint = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5364 int index = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5365 float glyphWidth = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5366 float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5367 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5368 for (int i = 0; text[i] != '\0'; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5369 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5370 if (text[i] != ' ') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5371 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5372 codepoint = GetCodepoint(&text[i], &codepointByteCount); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5373 index = GetGlyphIndex(guiFont, codepoint); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5374 glyphWidth = (guiFont.glyphs[index].advanceX == 0)? guiFont.recs[index].width*scaleFactor : guiFont.glyphs[index].advanceX*scaleFactor; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5375 width += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5376 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5377 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5378 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5379 *nextSpaceIndex = i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5380 break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5381 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5382 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5383 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5384 return width; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5385 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5386 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5387 // Gui draw text using default font |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5388 static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, Color tint) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5389 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5390 #define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5391 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5392 #if !defined(ICON_TEXT_PADDING) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5393 #define ICON_TEXT_PADDING 4 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5394 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5395 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5396 if ((text == NULL) || (text[0] == '\0')) return; // Security check |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5397 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5398 // PROCEDURE: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5399 // - Text is processed line per line |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5400 // - For every line, horizontal alignment is defined |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5401 // - For all text, vertical alignment is defined (multiline text only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5402 // - For every line, wordwrap mode is checked (useful for GuitextBox(), read-only) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5403 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5404 // Get text lines (using '\n' as delimiter) to be processed individually |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5405 // WARNING: We can't use GuiTextSplit() function because it can be already used |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5406 // before the GuiDrawText() call and its buffer is static, it would be overriden :( |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5407 int lineCount = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5408 const char **lines = GetTextLines(text, &lineCount); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5409 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5410 // Text style variables |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5411 //int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5412 int alignmentVertical = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5413 int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE); // Wrap-mode only available in read-only mode, no for text editing |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5414 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5415 // TODO: WARNING: This totalHeight is not valid for vertical alignment in case of word-wrap |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5416 float totalHeight = (float)(lineCount*GuiGetStyle(DEFAULT, TEXT_SIZE) + (lineCount - 1)*GuiGetStyle(DEFAULT, TEXT_SIZE)/2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5417 float posOffsetY = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5418 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5419 for (int i = 0; i < lineCount; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5420 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5421 int iconId = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5422 lines[i] = GetTextIcon(lines[i], &iconId); // Check text for icon and move cursor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5423 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5424 // Get text position depending on alignment and iconId |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5425 //--------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5426 Vector2 textBoundsPosition = { textBounds.x, textBounds.y }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5427 float textBoundsWidthOffset = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5428 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5429 // NOTE: We get text size after icon has been processed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5430 // WARNING: GuiGetTextWidth() also processes text icon to get width! -> Really needed? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5431 int textSizeX = GuiGetTextWidth(lines[i]); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5432 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5433 // If text requires an icon, add size to measure |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5434 if (iconId >= 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5435 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5436 textSizeX += RAYGUI_ICON_SIZE*guiIconScale; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5437 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5438 // WARNING: If only icon provided, text could be pointing to EOF character: '\0' |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5439 #if !defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5440 if ((lines[i] != NULL) && (lines[i][0] != '\0')) textSizeX += ICON_TEXT_PADDING; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5441 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5442 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5443 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5444 // Check guiTextAlign global variables |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5445 switch (alignment) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5446 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5447 case TEXT_ALIGN_LEFT: textBoundsPosition.x = textBounds.x; break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5448 case TEXT_ALIGN_CENTER: textBoundsPosition.x = textBounds.x + textBounds.width/2 - textSizeX/2; break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5449 case TEXT_ALIGN_RIGHT: textBoundsPosition.x = textBounds.x + textBounds.width - textSizeX; break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5450 default: break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5451 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5452 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5453 if (textSizeX > textBounds.width && (lines[i] != NULL) && (lines[i][0] != '\0')) textBoundsPosition.x = textBounds.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5454 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5455 switch (alignmentVertical) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5456 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5457 // Only valid in case of wordWrap = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5458 case TEXT_ALIGN_TOP: textBoundsPosition.y = textBounds.y + posOffsetY; break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5459 case TEXT_ALIGN_MIDDLE: textBoundsPosition.y = textBounds.y + posOffsetY + textBounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height); break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5460 case TEXT_ALIGN_BOTTOM: textBoundsPosition.y = textBounds.y + posOffsetY + textBounds.height - totalHeight + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height); break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5461 default: break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5462 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5463 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5464 // NOTE: Make sure we get pixel-perfect coordinates, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5465 // In case of decimals we got weird text positioning |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5466 textBoundsPosition.x = (float)((int)textBoundsPosition.x); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5467 textBoundsPosition.y = (float)((int)textBoundsPosition.y); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5468 //--------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5469 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5470 // Draw text (with icon if available) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5471 //--------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5472 #if !defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5473 if (iconId >= 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5474 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5475 // NOTE: We consider icon height, probably different than text size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5476 GuiDrawIcon(iconId, (int)textBoundsPosition.x, (int)(textBounds.y + textBounds.height/2 - RAYGUI_ICON_SIZE*guiIconScale/2 + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height)), guiIconScale, tint); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5477 textBoundsPosition.x += (float)(RAYGUI_ICON_SIZE*guiIconScale + ICON_TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5478 textBoundsWidthOffset = (float)(RAYGUI_ICON_SIZE*guiIconScale + ICON_TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5479 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5480 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5481 // Get size in bytes of text, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5482 // considering end of line and line break |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5483 int lineSize = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5484 for (int c = 0; (lines[i][c] != '\0') && (lines[i][c] != '\n') && (lines[i][c] != '\r'); c++, lineSize++){ } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5485 float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5486 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5487 int lastSpaceIndex = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5488 bool tempWrapCharMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5489 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5490 int textOffsetY = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5491 float textOffsetX = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5492 float glyphWidth = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5493 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5494 int ellipsisWidth = GuiGetTextWidth("..."); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5495 bool textOverflow = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5496 for (int c = 0, codepointSize = 0; c < lineSize; c += codepointSize) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5497 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5498 int codepoint = GetCodepointNext(&lines[i][c], &codepointSize); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5499 int index = GetGlyphIndex(guiFont, codepoint); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5500 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5501 // NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5502 // but we need to draw all of the bad bytes using the '?' symbol moving one byte |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5503 if (codepoint == 0x3f) codepointSize = 1; // TODO: Review not recognized codepoints size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5504 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5505 // Get glyph width to check if it goes out of bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5506 if (guiFont.glyphs[index].advanceX == 0) glyphWidth = ((float)guiFont.recs[index].width*scaleFactor); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5507 else glyphWidth = (float)guiFont.glyphs[index].advanceX*scaleFactor; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5508 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5509 // Wrap mode text measuring, to validate if |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5510 // it can be drawn or a new line is required |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5511 if (wrapMode == TEXT_WRAP_CHAR) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5512 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5513 // Jump to next line if current character reach end of the box limits |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5514 if ((textOffsetX + glyphWidth) > textBounds.width - textBoundsWidthOffset) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5515 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5516 textOffsetX = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5517 textOffsetY += GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5518 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5519 if (tempWrapCharMode) // Wrap at char level when too long words |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5520 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5521 wrapMode = TEXT_WRAP_WORD; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5522 tempWrapCharMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5523 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5524 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5525 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5526 else if (wrapMode == TEXT_WRAP_WORD) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5527 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5528 if (codepoint == 32) lastSpaceIndex = c; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5529 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5530 // Get width to next space in line |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5531 int nextSpaceIndex = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5532 float nextSpaceWidth = GetNextSpaceWidth(lines[i] + c, &nextSpaceIndex); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5533 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5534 int nextSpaceIndex2 = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5535 float nextWordSize = GetNextSpaceWidth(lines[i] + lastSpaceIndex + 1, &nextSpaceIndex2); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5536 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5537 if (nextWordSize > textBounds.width - textBoundsWidthOffset) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5538 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5539 // Considering the case the next word is longer than bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5540 tempWrapCharMode = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5541 wrapMode = TEXT_WRAP_CHAR; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5542 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5543 else if ((textOffsetX + nextSpaceWidth) > textBounds.width - textBoundsWidthOffset) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5544 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5545 textOffsetX = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5546 textOffsetY += GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5547 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5548 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5549 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5550 if (codepoint == '\n') break; // WARNING: Lines are already processed manually, no need to keep drawing after this codepoint |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5551 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5552 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5553 // TODO: There are multiple types of spaces in Unicode, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5554 // maybe it's a good idea to add support for more: http://jkorpela.fi/chars/spaces.html |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5555 if ((codepoint != ' ') && (codepoint != '\t')) // Do not draw codepoints with no glyph |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5556 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5557 if (wrapMode == TEXT_WRAP_NONE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5558 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5559 // Draw only required text glyphs fitting the textBounds.width |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5560 if (textSizeX > textBounds.width) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5561 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5562 if (textOffsetX <= (textBounds.width - glyphWidth - textBoundsWidthOffset - ellipsisWidth)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5563 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5564 DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5565 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5566 else if (!textOverflow) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5567 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5568 textOverflow = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5569 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5570 for (int j = 0; j < ellipsisWidth; j += ellipsisWidth/3) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5571 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5572 DrawTextCodepoint(guiFont, '.', RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX + j, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5573 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5574 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5575 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5576 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5577 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5578 DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5579 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5580 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5581 else if ((wrapMode == TEXT_WRAP_CHAR) || (wrapMode == TEXT_WRAP_WORD)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5582 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5583 // Draw only glyphs inside the bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5584 if ((textBoundsPosition.y + textOffsetY) <= (textBounds.y + textBounds.height - GuiGetStyle(DEFAULT, TEXT_SIZE))) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5585 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5586 DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5587 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5588 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5589 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5590 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5591 if (guiFont.glyphs[index].advanceX == 0) textOffsetX += ((float)guiFont.recs[index].width*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5592 else textOffsetX += ((float)guiFont.glyphs[index].advanceX*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5593 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5594 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5595 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5596 if (wrapMode == TEXT_WRAP_NONE) posOffsetY += (float)GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5597 else if ((wrapMode == TEXT_WRAP_CHAR) || (wrapMode == TEXT_WRAP_WORD)) posOffsetY += (textOffsetY + (float)GuiGetStyle(DEFAULT, TEXT_LINE_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5598 //--------------------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5599 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5600 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5601 #if defined(RAYGUI_DEBUG_TEXT_BOUNDS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5602 GuiDrawRectangle(textBounds, 0, WHITE, Fade(BLUE, 0.4f)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5603 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5604 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5605 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5606 // Gui draw rectangle using default raygui plain style with borders |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5607 static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5608 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5609 if (color.a > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5610 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5611 // Draw rectangle filled with color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5612 DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, GuiFade(color, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5613 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5614 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5615 if (borderWidth > 0) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5616 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5617 // Draw rectangle border lines with color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5618 DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, borderWidth, GuiFade(borderColor, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5619 DrawRectangle((int)rec.x, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, GuiFade(borderColor, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5620 DrawRectangle((int)rec.x + (int)rec.width - borderWidth, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, GuiFade(borderColor, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5621 DrawRectangle((int)rec.x, (int)rec.y + (int)rec.height - borderWidth, (int)rec.width, borderWidth, GuiFade(borderColor, guiAlpha)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5622 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5623 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5624 #if defined(RAYGUI_DEBUG_RECS_BOUNDS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5625 DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, Fade(RED, 0.4f)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5626 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5627 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5628 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5629 // Draw tooltip using control bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5630 static void GuiTooltip(Rectangle controlRec) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5631 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5632 if (!guiLocked && guiTooltip && (guiTooltipPtr != NULL) && !guiControlExclusiveMode) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5633 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5634 Vector2 textSize = MeasureTextEx(GuiGetFont(), guiTooltipPtr, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5635 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5636 if ((controlRec.x + textSize.x + 16) > GetScreenWidth()) controlRec.x -= (textSize.x + 16 - controlRec.width); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5637 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5638 GuiPanel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, GuiGetStyle(DEFAULT, TEXT_SIZE) + 8.0f }, NULL); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5639 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5640 int textPadding = GuiGetStyle(LABEL, TEXT_PADDING); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5641 int textAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5642 GuiSetStyle(LABEL, TEXT_PADDING, 0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5643 GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5644 GuiLabel(RAYGUI_CLITERAL(Rectangle){ controlRec.x, controlRec.y + controlRec.height + 4, textSize.x + 16, GuiGetStyle(DEFAULT, TEXT_SIZE) + 8.0f }, guiTooltipPtr); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5645 GuiSetStyle(LABEL, TEXT_ALIGNMENT, textAlignment); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5646 GuiSetStyle(LABEL, TEXT_PADDING, textPadding); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5647 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5648 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5649 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5650 // Split controls text into multiple strings |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5651 // Also check for multiple columns (required by GuiToggleGroup()) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5652 static const char **GuiTextSplit(const char *text, char delimiter, int *count, int *textRow) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5653 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5654 // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5655 // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5656 // all used memory is static... it has some limitations: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5657 // 1. Maximum number of possible split strings is set by RAYGUI_TEXTSPLIT_MAX_ITEMS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5658 // 2. Maximum size of text to split is RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5659 // NOTE: Those definitions could be externally provided if required |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5660 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5661 // TODO: HACK: GuiTextSplit() - Review how textRows are returned to user |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5662 // textRow is an externally provided array of integers that stores row number for every splitted string |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5663 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5664 #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5665 #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5666 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5667 #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5668 #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5669 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5670 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5671 static const char *result[RAYGUI_TEXTSPLIT_MAX_ITEMS] = { NULL }; // String pointers array (points to buffer data) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5672 static char buffer[RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE] = { 0 }; // Buffer data (text input copy with '\0' added) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5673 memset(buffer, 0, RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5674 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5675 result[0] = buffer; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5676 int counter = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5677 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5678 if (textRow != NULL) textRow[0] = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5679 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5680 // Count how many substrings we have on text and point to every one |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5681 for (int i = 0; i < RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5682 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5683 buffer[i] = text[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5684 if (buffer[i] == '\0') break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5685 else if ((buffer[i] == delimiter) || (buffer[i] == '\n')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5686 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5687 result[counter] = buffer + i + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5688 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5689 if (textRow != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5690 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5691 if (buffer[i] == '\n') textRow[counter] = textRow[counter - 1] + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5692 else textRow[counter] = textRow[counter - 1]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5693 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5694 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5695 buffer[i] = '\0'; // Set an end of string at this point |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5696 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5697 counter++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5698 if (counter >= RAYGUI_TEXTSPLIT_MAX_ITEMS) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5699 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5700 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5701 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5702 *count = counter; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5703 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5704 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5705 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5706 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5707 // Convert color data from RGB to HSV |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5708 // NOTE: Color data should be passed normalized |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5709 static Vector3 ConvertRGBtoHSV(Vector3 rgb) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5710 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5711 Vector3 hsv = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5712 float min = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5713 float max = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5714 float delta = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5715 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5716 min = (rgb.x < rgb.y)? rgb.x : rgb.y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5717 min = (min < rgb.z)? min : rgb.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5718 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5719 max = (rgb.x > rgb.y)? rgb.x : rgb.y; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5720 max = (max > rgb.z)? max : rgb.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5721 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5722 hsv.z = max; // Value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5723 delta = max - min; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5724 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5725 if (delta < 0.00001f) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5726 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5727 hsv.y = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5728 hsv.x = 0.0f; // Undefined, maybe NAN? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5729 return hsv; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5730 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5731 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5732 if (max > 0.0f) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5733 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5734 // NOTE: If max is 0, this divide would cause a crash |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5735 hsv.y = (delta/max); // Saturation |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5736 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5737 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5738 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5739 // NOTE: If max is 0, then r = g = b = 0, s = 0, h is undefined |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5740 hsv.y = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5741 hsv.x = 0.0f; // Undefined, maybe NAN? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5742 return hsv; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5743 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5744 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5745 // NOTE: Comparing float values could not work properly |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5746 if (rgb.x >= max) hsv.x = (rgb.y - rgb.z)/delta; // Between yellow & magenta |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5747 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5748 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5749 if (rgb.y >= max) hsv.x = 2.0f + (rgb.z - rgb.x)/delta; // Between cyan & yellow |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5750 else hsv.x = 4.0f + (rgb.x - rgb.y)/delta; // Between magenta & cyan |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5751 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5752 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5753 hsv.x *= 60.0f; // Convert to degrees |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5754 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5755 if (hsv.x < 0.0f) hsv.x += 360.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5756 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5757 return hsv; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5758 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5759 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5760 // Convert color data from HSV to RGB |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5761 // NOTE: Color data should be passed normalized |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5762 static Vector3 ConvertHSVtoRGB(Vector3 hsv) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5763 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5764 Vector3 rgb = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5765 float hh = 0.0f, p = 0.0f, q = 0.0f, t = 0.0f, ff = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5766 long i = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5767 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5768 // NOTE: Comparing float values could not work properly |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5769 if (hsv.y <= 0.0f) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5770 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5771 rgb.x = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5772 rgb.y = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5773 rgb.z = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5774 return rgb; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5775 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5776 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5777 hh = hsv.x; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5778 if (hh >= 360.0f) hh = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5779 hh /= 60.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5780 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5781 i = (long)hh; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5782 ff = hh - i; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5783 p = hsv.z*(1.0f - hsv.y); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5784 q = hsv.z*(1.0f - (hsv.y*ff)); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5785 t = hsv.z*(1.0f - (hsv.y*(1.0f - ff))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5786 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5787 switch (i) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5788 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5789 case 0: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5790 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5791 rgb.x = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5792 rgb.y = t; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5793 rgb.z = p; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5794 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5795 case 1: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5796 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5797 rgb.x = q; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5798 rgb.y = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5799 rgb.z = p; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5800 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5801 case 2: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5802 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5803 rgb.x = p; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5804 rgb.y = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5805 rgb.z = t; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5806 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5807 case 3: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5808 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5809 rgb.x = p; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5810 rgb.y = q; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5811 rgb.z = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5812 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5813 case 4: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5814 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5815 rgb.x = t; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5816 rgb.y = p; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5817 rgb.z = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5818 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5819 case 5: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5820 default: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5821 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5822 rgb.x = hsv.z; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5823 rgb.y = p; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5824 rgb.z = q; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5825 } break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5826 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5827 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5828 return rgb; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5829 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5830 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5831 // Scroll bar control (used by GuiScrollPanel()) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5832 static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5833 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5834 GuiState state = guiState; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5835 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5836 // Is the scrollbar horizontal or vertical? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5837 bool isVertical = (bounds.width > bounds.height)? false : true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5838 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5839 // The size (width or height depending on scrollbar type) of the spinner buttons |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5840 const int spinnerSize = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)? |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5841 (isVertical? (int)bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) : |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5842 (int)bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)) : 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5843 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5844 // Arrow buttons [<] [>] [∧] [∨] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5845 Rectangle arrowUpLeft = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5846 Rectangle arrowDownRight = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5847 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5848 // Actual area of the scrollbar excluding the arrow buttons |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5849 Rectangle scrollbar = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5850 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5851 // Slider bar that moves --[///]----- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5852 Rectangle slider = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5853 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5854 // Normalize value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5855 if (value > maxValue) value = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5856 if (value < minValue) value = minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5857 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5858 int valueRange = maxValue - minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5859 if (valueRange <= 0) valueRange = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5860 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5861 int sliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5862 if (sliderSize < 1) sliderSize = 1; // TODO: Consider a minimum slider size |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5863 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5864 // Calculate rectangles for all of the components |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5865 arrowUpLeft = RAYGUI_CLITERAL(Rectangle){ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5866 (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5867 (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5868 (float)spinnerSize, (float)spinnerSize }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5869 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5870 if (isVertical) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5871 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5872 arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + bounds.height - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5873 scrollbar = RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), arrowUpLeft.y + arrowUpLeft.height, bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)), bounds.height - arrowUpLeft.height - arrowDownRight.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5874 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5875 // Make sure the slider won't get outside of the scrollbar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5876 sliderSize = (sliderSize >= scrollbar.height)? ((int)scrollbar.height - 2) : sliderSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5877 slider = RAYGUI_CLITERAL(Rectangle){ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5878 bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5879 scrollbar.y + (int)(((float)(value - minValue)/valueRange)*(scrollbar.height - sliderSize)), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5880 bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5881 (float)sliderSize }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5882 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5883 else // horizontal |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5884 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5885 arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + bounds.width - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5886 scrollbar = RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x + arrowUpLeft.width, bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), bounds.width - arrowUpLeft.width - arrowDownRight.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5887 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5888 // Make sure the slider won't get outside of the scrollbar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5889 sliderSize = (sliderSize >= scrollbar.width)? ((int)scrollbar.width - 2) : sliderSize; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5890 slider = RAYGUI_CLITERAL(Rectangle){ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5891 scrollbar.x + (int)(((float)(value - minValue)/valueRange)*(scrollbar.width - sliderSize)), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5892 bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5893 (float)sliderSize, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5894 bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5895 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5896 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5897 // Update control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5898 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5899 if ((state != STATE_DISABLED) && !guiLocked) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5900 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5901 Vector2 mousePoint = GetMousePosition(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5902 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5903 if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5904 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5905 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5906 !CheckCollisionPointRec(mousePoint, arrowUpLeft) && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5907 !CheckCollisionPointRec(mousePoint, arrowDownRight)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5908 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5909 if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5910 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5911 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5912 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5913 if (isVertical) value = (int)(((float)(mousePoint.y - scrollbar.y - slider.height/2)*valueRange)/(scrollbar.height - slider.height) + minValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5914 else value = (int)(((float)(mousePoint.x - scrollbar.x - slider.width/2)*valueRange)/(scrollbar.width - slider.width) + minValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5915 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5916 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5917 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5918 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5919 guiControlExclusiveMode = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5920 guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5921 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5922 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5923 else if (CheckCollisionPointRec(mousePoint, bounds)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5924 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5925 state = STATE_FOCUSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5926 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5927 // Handle mouse wheel |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5928 int wheel = (int)GetMouseWheelMove(); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5929 if (wheel != 0) value += wheel; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5930 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5931 // Handle mouse button down |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5932 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5933 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5934 guiControlExclusiveMode = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5935 guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5936 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5937 // Check arrows click |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5938 if (CheckCollisionPointRec(mousePoint, arrowUpLeft)) value -= valueRange/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5939 else if (CheckCollisionPointRec(mousePoint, arrowDownRight)) value += valueRange/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5940 else if (!CheckCollisionPointRec(mousePoint, slider)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5941 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5942 // If click on scrollbar position but not on slider, place slider directly on that position |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5943 if (isVertical) value = (int)(((float)(mousePoint.y - scrollbar.y - slider.height/2)*valueRange)/(scrollbar.height - slider.height) + minValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5944 else value = (int)(((float)(mousePoint.x - scrollbar.x - slider.width/2)*valueRange)/(scrollbar.width - slider.width) + minValue); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5945 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5946 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5947 state = STATE_PRESSED; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5948 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5949 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5950 // Keyboard control on mouse hover scrollbar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5951 /* |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5952 if (isVertical) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5953 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5954 if (IsKeyDown(KEY_DOWN)) value += 5; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5955 else if (IsKeyDown(KEY_UP)) value -= 5; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5956 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5957 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5958 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5959 if (IsKeyDown(KEY_RIGHT)) value += 5; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5960 else if (IsKeyDown(KEY_LEFT)) value -= 5; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5961 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5962 */ |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5963 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5964 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5965 // Normalize value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5966 if (value > maxValue) value = maxValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5967 if (value < minValue) value = minValue; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5968 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5969 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5970 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5971 // Draw control |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5972 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5973 GuiDrawRectangle(bounds, GuiGetStyle(SCROLLBAR, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED))); // Draw the background |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5974 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5975 GuiDrawRectangle(scrollbar, 0, BLANK, GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL))); // Draw the scrollbar active area background |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5976 GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BORDER + state*3))); // Draw the slider bar |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5977 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5978 // Draw arrows (using icon if available) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5979 if (GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5980 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5981 #if defined(RAYGUI_NO_ICONS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5982 GuiDrawText(isVertical? "^" : "<", |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5983 RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5984 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5985 GuiDrawText(isVertical? "v" : ">", |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5986 RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5987 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5988 #else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5989 GuiDrawText(isVertical? "#121#" : "#118#", |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5990 RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5991 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3))); // ICON_ARROW_UP_FILL / ICON_ARROW_LEFT_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5992 GuiDrawText(isVertical? "#120#" : "#119#", |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5993 RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5994 TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3))); // ICON_ARROW_DOWN_FILL / ICON_ARROW_RIGHT_FILL |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5995 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5996 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5997 //-------------------------------------------------------------------- |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5998 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5999 return value; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6000 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6001 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6002 // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6003 // WARNING: It multiplies current alpha by alpha scale factor |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6004 static Color GuiFade(Color color, float alpha) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6005 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6006 if (alpha < 0.0f) alpha = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6007 else if (alpha > 1.0f) alpha = 1.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6008 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6009 Color result = { color.r, color.g, color.b, (unsigned char)(color.a*alpha) }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6010 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6011 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6012 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6013 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6014 #if defined(RAYGUI_STANDALONE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6015 // Returns a Color struct from hexadecimal value |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6016 static Color GetColor(int hexValue) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6017 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6018 Color color; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6019 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6020 color.r = (unsigned char)(hexValue >> 24) & 0xff; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6021 color.g = (unsigned char)(hexValue >> 16) & 0xff; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6022 color.b = (unsigned char)(hexValue >> 8) & 0xff; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6023 color.a = (unsigned char)hexValue & 0xff; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6024 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6025 return color; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6026 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6027 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6028 // Returns hexadecimal value for a Color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6029 static int ColorToInt(Color color) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6030 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6031 return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6032 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6033 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6034 // Check if point is inside rectangle |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6035 static bool CheckCollisionPointRec(Vector2 point, Rectangle rec) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6036 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6037 bool collision = false; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6038 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6039 if ((point.x >= rec.x) && (point.x <= (rec.x + rec.width)) && |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6040 (point.y >= rec.y) && (point.y <= (rec.y + rec.height))) collision = true; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6041 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6042 return collision; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6043 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6044 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6045 // Formatting of text with variables to 'embed' |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6046 static const char *TextFormat(const char *text, ...) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6047 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6048 #if !defined(RAYGUI_TEXTFORMAT_MAX_SIZE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6049 #define RAYGUI_TEXTFORMAT_MAX_SIZE 256 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6050 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6051 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6052 static char buffer[RAYGUI_TEXTFORMAT_MAX_SIZE]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6053 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6054 va_list args; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6055 va_start(args, text); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6056 vsnprintf(buffer, RAYGUI_TEXTFORMAT_MAX_SIZE, text, args); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6057 va_end(args); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6058 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6059 return buffer; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6060 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6061 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6062 // Draw rectangle with vertical gradient fill color |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6063 // NOTE: This function is only used by GuiColorPicker() |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6064 static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6065 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6066 Rectangle bounds = { (float)posX, (float)posY, (float)width, (float)height }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6067 DrawRectangleGradientEx(bounds, color1, color2, color2, color1); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6068 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6069 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6070 // Split string into multiple strings |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6071 const char **TextSplit(const char *text, char delimiter, int *count) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6072 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6073 // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6074 // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6075 // all used memory is static... it has some limitations: |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6076 // 1. Maximum number of possible split strings is set by RAYGUI_TEXTSPLIT_MAX_ITEMS |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6077 // 2. Maximum size of text to split is RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6078 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6079 #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6080 #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6081 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6082 #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6083 #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6084 #endif |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6085 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6086 static const char *result[RAYGUI_TEXTSPLIT_MAX_ITEMS] = { NULL }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6087 static char buffer[RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6088 memset(buffer, 0, RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6089 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6090 result[0] = buffer; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6091 int counter = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6092 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6093 if (text != NULL) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6094 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6095 counter = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6096 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6097 // Count how many substrings we have on text and point to every one |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6098 for (int i = 0; i < RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE; i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6099 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6100 buffer[i] = text[i]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6101 if (buffer[i] == '\0') break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6102 else if (buffer[i] == delimiter) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6103 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6104 buffer[i] = '\0'; // Set an end of string at this point |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6105 result[counter] = buffer + i + 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6106 counter++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6107 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6108 if (counter == RAYGUI_TEXTSPLIT_MAX_ITEMS) break; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6109 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6110 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6111 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6112 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6113 *count = counter; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6114 return result; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6115 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6116 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6117 // Get integer value from text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6118 // NOTE: This function replaces atoi() [stdlib.h] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6119 static int TextToInteger(const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6120 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6121 int value = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6122 int sign = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6123 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6124 if ((text[0] == '+') || (text[0] == '-')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6125 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6126 if (text[0] == '-') sign = -1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6127 text++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6128 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6129 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6130 for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10 + (int)(text[i] - '0'); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6131 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6132 return value*sign; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6133 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6134 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6135 // Get float value from text |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6136 // NOTE: This function replaces atof() [stdlib.h] |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6137 // WARNING: Only '.' character is understood as decimal point |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6138 static float TextToFloat(const char *text) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6139 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6140 float value = 0.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6141 float sign = 1.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6142 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6143 if ((text[0] == '+') || (text[0] == '-')) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6144 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6145 if (text[0] == '-') sign = -1.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6146 text++; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6147 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6148 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6149 int i = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6150 for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0'); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6151 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6152 if (text[i++] != '.') value *= sign; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6153 else |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6154 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6155 float divisor = 10.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6156 for (; ((text[i] >= '0') && (text[i] <= '9')); i++) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6157 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6158 value += ((float)(text[i] - '0'))/divisor; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6159 divisor = divisor*10.0f; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6160 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6161 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6162 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6163 return value; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6164 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6165 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6166 // Encode codepoint into UTF-8 text (char array size returned as parameter) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6167 static const char *CodepointToUTF8(int codepoint, int *byteSize) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6168 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6169 static char utf8[6] = { 0 }; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6170 int size = 0; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6171 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6172 if (codepoint <= 0x7f) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6173 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6174 utf8[0] = (char)codepoint; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6175 size = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6176 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6177 else if (codepoint <= 0x7ff) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6178 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6179 utf8[0] = (char)(((codepoint >> 6) & 0x1f) | 0xc0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6180 utf8[1] = (char)((codepoint & 0x3f) | 0x80); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6181 size = 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6182 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6183 else if (codepoint <= 0xffff) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6184 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6185 utf8[0] = (char)(((codepoint >> 12) & 0x0f) | 0xe0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6186 utf8[1] = (char)(((codepoint >> 6) & 0x3f) | 0x80); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6187 utf8[2] = (char)((codepoint & 0x3f) | 0x80); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6188 size = 3; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6189 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6190 else if (codepoint <= 0x10ffff) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6191 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6192 utf8[0] = (char)(((codepoint >> 18) & 0x07) | 0xf0); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6193 utf8[1] = (char)(((codepoint >> 12) & 0x3f) | 0x80); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6194 utf8[2] = (char)(((codepoint >> 6) & 0x3f) | 0x80); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6195 utf8[3] = (char)((codepoint & 0x3f) | 0x80); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6196 size = 4; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6197 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6198 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6199 *byteSize = size; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6200 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6201 return utf8; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6202 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6203 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6204 // Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6205 // When a invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6206 // Total number of bytes processed are returned as a parameter |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6207 // NOTE: the standard says U+FFFD should be returned in case of errors |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6208 // but that character is not supported by the default font in raylib |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6209 static int GetCodepointNext(const char *text, int *codepointSize) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6210 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6211 const char *ptr = text; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6212 int codepoint = 0x3f; // Codepoint (defaults to '?') |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6213 *codepointSize = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6214 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6215 // Get current codepoint and bytes processed |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6216 if (0xf0 == (0xf8 & ptr[0])) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6217 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6218 // 4 byte UTF-8 codepoint |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6219 if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6220 codepoint = ((0x07 & ptr[0]) << 18) | ((0x3f & ptr[1]) << 12) | ((0x3f & ptr[2]) << 6) | (0x3f & ptr[3]); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6221 *codepointSize = 4; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6222 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6223 else if (0xe0 == (0xf0 & ptr[0])) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6224 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6225 // 3 byte UTF-8 codepoint |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6226 if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6227 codepoint = ((0x0f & ptr[0]) << 12) | ((0x3f & ptr[1]) << 6) | (0x3f & ptr[2]); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6228 *codepointSize = 3; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6229 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6230 else if (0xc0 == (0xe0 & ptr[0])) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6231 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6232 // 2 byte UTF-8 codepoint |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6233 if ((ptr[1] & 0xC0) ^ 0x80) { return codepoint; } //10xxxxxx checks |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6234 codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]); |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6235 *codepointSize = 2; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6236 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6237 else if (0x00 == (0x80 & ptr[0])) |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6238 { |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6239 // 1 byte UTF-8 codepoint |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6240 codepoint = ptr[0]; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6241 *codepointSize = 1; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6242 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6243 |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6244 return codepoint; |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6245 } |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6246 #endif // RAYGUI_STANDALONE |
|
b3e82d22f961
[PostDog] Initial commit BROKEN
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6247 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6248 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6249 // --- Custom --- // |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6250 int JUNE_GuiButton(Rectangle bounds, const char *text, int borderWidth, Color borderColor) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6251 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6252 int result = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6253 GuiState state = guiState; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6254 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6255 // Update control |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6256 //-------------------------------------------------------------------- |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6257 if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6258 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6259 Vector2 mousePoint = GetMousePosition(); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6260 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6261 // Check button state |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6262 if (CheckCollisionPointRec(mousePoint, bounds)) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6263 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6264 if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6265 else state = STATE_FOCUSED; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6266 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6267 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6268 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6269 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6270 //-------------------------------------------------------------------- |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6271 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6272 // Draw control |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6273 //-------------------------------------------------------------------- |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6274 GuiDrawRectangle(bounds, borderWidth, borderColor, GetColor(GuiGetStyle(BUTTON, BASE + (state*3)))); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6275 GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), GetColor(GuiGetStyle(BUTTON, TEXT + (state*3)))); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6276 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6277 if (state == STATE_FOCUSED) GuiTooltip(bounds); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6278 //------------------------------------------------------------------ |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6279 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6280 return result; // Button pressed: result = 1 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6281 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6282 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6283 JUNE_TextBoxResult JUNE_GuiTextBoxEx(Rectangle bounds, char *text, int textSize, bool editMode) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6284 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6285 #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6286 #define RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN 20 // Frames to wait for autocursor movement |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6287 #endif |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6288 #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6289 #define RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY 1 // Frames delay for autocursor movement |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6290 #endif |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6291 #if !defined(JUNE_MAX_VISUAL_LINES) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6292 #define JUNE_MAX_VISUAL_LINES 256 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6293 #endif |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6294 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6295 JUNE_TextBoxResult resultStruct = { 0, -1, -1 }; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6296 GuiState state = guiState; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6297 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6298 Rectangle textBounds = GetTextBounds(TEXTBOX, bounds); |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6299 int textLength = (text != NULL) ? (int)strlen(text) : 0; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6300 int thisCursorIndex = textBoxCursorIndex; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6301 if (thisCursorIndex > textLength) thisCursorIndex = textLength; |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6302 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6303 // Line height for multiline |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6304 float lineHeight = GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6305 float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE) / (float)guiFont.baseSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6306 float maxLineWidth = textBounds.width - 4; // Small margin |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6307 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6308 // Visual line structure: stores start index of each visual line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6309 int visualLineStarts[JUNE_MAX_VISUAL_LINES]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6310 int visualLineCount = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6311 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6312 // Calculate visual lines (accounting for word wrap) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6313 if (textLength > 0 && maxLineWidth > 0) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6314 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6315 int lineStartIdx = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6316 visualLineStarts[visualLineCount++] = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6317 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6318 int idx = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6319 while (idx < textLength && visualLineCount < JUNE_MAX_VISUAL_LINES) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6320 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6321 // Check for hard newline |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6322 if (text[idx] == '\n') |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6323 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6324 idx++; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6325 if (idx < textLength && visualLineCount < JUNE_MAX_VISUAL_LINES) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6326 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6327 visualLineStarts[visualLineCount++] = idx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6328 lineStartIdx = idx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6329 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6330 continue; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6331 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6332 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6333 // Calculate width from lineStartIdx to current position |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6334 float currentWidth = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6335 int lastSpaceIdx = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6336 int charIdx = lineStartIdx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6337 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6338 while (charIdx < textLength && text[charIdx] != '\n') |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6339 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6340 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6341 int cp = GetCodepointNext(&text[charIdx], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6342 int glyphIdx = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6343 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6344 float glyphWidth; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6345 if (guiFont.glyphs[glyphIdx].advanceX == 0) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6346 glyphWidth = (float)guiFont.recs[glyphIdx].width * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6347 else |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6348 glyphWidth = (float)guiFont.glyphs[glyphIdx].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6349 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6350 if (text[charIdx] == ' ') lastSpaceIdx = charIdx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6351 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6352 if (currentWidth + glyphWidth > maxLineWidth && charIdx > lineStartIdx) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6353 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6354 // Need to wrap |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6355 int wrapIdx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6356 if (lastSpaceIdx > lineStartIdx) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6357 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6358 // Wrap at last space |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6359 wrapIdx = lastSpaceIdx + 1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6360 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6361 else |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6362 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6363 // No space found, wrap at current char |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6364 wrapIdx = charIdx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6365 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6366 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6367 if (visualLineCount < JUNE_MAX_VISUAL_LINES) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6368 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6369 visualLineStarts[visualLineCount++] = wrapIdx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6370 lineStartIdx = wrapIdx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6371 idx = wrapIdx; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6372 lastSpaceIdx = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6373 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6374 break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6375 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6376 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6377 currentWidth += glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6378 charIdx += cpSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6379 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6380 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6381 if (charIdx >= textLength || text[charIdx] == '\n') |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6382 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6383 idx = charIdx; |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6384 } |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6385 } |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6386 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6387 else |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6388 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6389 visualLineStarts[visualLineCount++] = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6390 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6391 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6392 // Helper: Find visual line for a given text index |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6393 int cursorVisualLine = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6394 for (int vl = visualLineCount - 1; vl >= 0; vl--) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6395 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6396 if (thisCursorIndex >= visualLineStarts[vl]) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6397 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6398 cursorVisualLine = vl; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6399 break; |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6400 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6401 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6402 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6403 // Helper: Get end of visual line (exclusive) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6404 int cursorLineStart = visualLineStarts[cursorVisualLine]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6405 int cursorLineEnd = (cursorVisualLine + 1 < visualLineCount) ? visualLineStarts[cursorVisualLine + 1] : textLength; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6406 // Adjust for newline at end |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6407 if (cursorLineEnd > 0 && cursorLineEnd <= textLength && cursorLineEnd > cursorLineStart) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6408 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6409 if (text[cursorLineEnd - 1] == '\n') cursorLineEnd--; |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6410 } |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6411 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6412 // Calculate cursor X position within visual line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6413 float cursorXOffset = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6414 for (int k = cursorLineStart; k < thisCursorIndex && k < textLength; k++) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6415 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6416 if (text[k] == '\n') break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6417 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6418 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6419 int glyphIdx = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6420 float glyphWidth; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6421 if (guiFont.glyphs[glyphIdx].advanceX == 0) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6422 glyphWidth = (float)guiFont.recs[glyphIdx].width * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6423 else |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6424 glyphWidth = (float)guiFont.glyphs[glyphIdx].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6425 cursorXOffset += glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6426 } |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6427 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6428 // Cursor rectangle |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6429 Rectangle cursor = { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6430 textBounds.x + cursorXOffset, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6431 textBounds.y + cursorVisualLine * lineHeight, |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6432 2, |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6433 (float)GuiGetStyle(DEFAULT, TEXT_SIZE) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6434 }; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6435 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6436 if (cursor.height >= bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH) * 2; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6437 if (cursor.y < (bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH))) cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6438 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6439 // Update control |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6440 if ((state != STATE_DISABLED) && |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6441 !GuiGetStyle(TEXTBOX, TEXT_READONLY) && |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6442 !guiLocked && |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6443 !guiControlExclusiveMode) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6444 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6445 Vector2 mousePosition = GetMousePosition(); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6446 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6447 if (editMode) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6448 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6449 if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_UP) || IsKeyDown(KEY_DOWN) || IsKeyDown(KEY_BACKSPACE) || IsKeyDown(KEY_DELETE)) autoCursorCounter++; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6450 else autoCursorCounter = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6451 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6452 bool autoCursorShouldTrigger = (autoCursorCounter > RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN) && ((autoCursorCounter % RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0); |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6453 bool shiftDown = IsKeyDown(KEY_LEFT_SHIFT) || IsKeyDown(KEY_RIGHT_SHIFT); |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6454 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6455 state = STATE_PRESSED; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6456 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6457 if (textBoxCursorIndex > textLength) textBoxCursorIndex = textLength; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6458 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6459 int codepoint = GetCharPressed(); // Get Unicode codepoint |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6460 if (IsKeyPressed(KEY_ENTER)) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6461 codepoint = (int)'\n'; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6462 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6463 // Encode codepoint as UTF-8 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6464 int codepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6465 const char *charEncoded = CodepointToUTF8(codepoint, &codepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6466 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6467 // Helper macro to check if there's an active selection |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6468 #define HAS_SELECTION() (textBoxSelectionStart >= 0 && textBoxSelectionEnd >= 0 && textBoxSelectionStart != textBoxSelectionEnd) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6469 #define SELECTION_MIN() ((textBoxSelectionStart < textBoxSelectionEnd) ? textBoxSelectionStart : textBoxSelectionEnd) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6470 #define SELECTION_MAX() ((textBoxSelectionStart > textBoxSelectionEnd) ? textBoxSelectionStart : textBoxSelectionEnd) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6471 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6472 // Ctrl+A: Select all |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6473 if (IsKeyPressed(KEY_A) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL) || IsKeyDown(KEY_LEFT_SUPER))) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6474 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6475 textBoxSelectionStart = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6476 textBoxSelectionEnd = textLength; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6477 textBoxCursorIndex = textLength; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6478 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6479 // Ctrl+C: Copy selection to clipboard |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6480 else if (IsKeyPressed(KEY_C) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL) || IsKeyDown(KEY_LEFT_SUPER))) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6481 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6482 if (HAS_SELECTION()) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6483 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6484 int selMin = SELECTION_MIN(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6485 int selMax = SELECTION_MAX(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6486 int selLen = selMax - selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6487 char *clipText = (char *)RL_MALLOC(selLen + 1); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6488 if (clipText) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6489 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6490 memcpy(clipText, text + selMin, selLen); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6491 clipText[selLen] = '\0'; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6492 SetClipboardText(clipText); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6493 RL_FREE(clipText); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6494 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6495 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6496 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6497 // Ctrl+X: Cut selection to clipboard |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6498 else if (IsKeyPressed(KEY_X) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL) || IsKeyDown(KEY_LEFT_SUPER))) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6499 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6500 if (HAS_SELECTION()) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6501 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6502 int selMin = SELECTION_MIN(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6503 int selMax = SELECTION_MAX(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6504 int selLen = selMax - selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6505 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6506 // Copy to clipboard |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6507 char *clipText = (char *)RL_MALLOC(selLen + 1); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6508 if (clipText) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6509 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6510 memcpy(clipText, text + selMin, selLen); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6511 clipText[selLen] = '\0'; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6512 SetClipboardText(clipText); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6513 RL_FREE(clipText); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6514 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6515 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6516 // Delete selection |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6517 for (int j = selMax; j <= textLength; j++) text[j - selLen] = text[j]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6518 textLength -= selLen; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6519 textBoxCursorIndex = selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6520 textBoxSelectionStart = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6521 textBoxSelectionEnd = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6522 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6523 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6524 // Ctrl+V: Paste (delete selection first if any) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6525 else if (IsKeyPressed(KEY_V) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL) || IsKeyDown(KEY_LEFT_SUPER))) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6526 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6527 // Delete selection first if any |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6528 if (HAS_SELECTION()) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6529 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6530 int selMin = SELECTION_MIN(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6531 int selMax = SELECTION_MAX(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6532 int selLen = selMax - selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6533 for (int j = selMax; j <= textLength; j++) text[j - selLen] = text[j]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6534 textLength -= selLen; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6535 textBoxCursorIndex = selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6536 textBoxSelectionStart = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6537 textBoxSelectionEnd = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6538 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6539 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6540 const char *pasteText = GetClipboardText(); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6541 if (pasteText != NULL) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6542 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6543 int pasteLength = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6544 int pasteCodepoint; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6545 int pasteCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6546 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6547 while (true) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6548 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6549 pasteCodepoint = GetCodepointNext(pasteText + pasteLength, &pasteCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6550 if (textLength + pasteLength + pasteCodepointSize >= textSize) break; |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6551 if (!((pasteCodepoint == (int)'\n')) && !(pasteCodepoint >= 32)) break; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6552 pasteLength += pasteCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6553 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6554 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6555 if (pasteLength > 0) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6556 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6557 for (int j = textLength + pasteLength; j > textBoxCursorIndex; j--) text[j] = text[j - pasteLength]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6558 for (int j = 0; j < pasteLength; j++) text[textBoxCursorIndex + j] = pasteText[j]; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6559 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6560 textBoxCursorIndex += pasteLength; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6561 textLength += pasteLength; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6562 text[textLength] = '\0'; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6563 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6564 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6565 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6566 else if ((((codepoint == (int)'\n')) || (codepoint >= 32)) && ((textLength + codepointSize) < textSize)) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6567 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6568 // Delete selection first if any |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6569 if (HAS_SELECTION()) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6570 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6571 int selMin = SELECTION_MIN(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6572 int selMax = SELECTION_MAX(); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6573 int selLen = selMax - selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6574 for (int j = selMax; j <= textLength; j++) text[j - selLen] = text[j]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6575 textLength -= selLen; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6576 textBoxCursorIndex = selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6577 textBoxSelectionStart = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6578 textBoxSelectionEnd = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6579 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6580 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6581 // Adding codepoint to text, at current cursor position |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6582 if ((textLength + codepointSize) < textSize) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6583 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6584 for (int j = (textLength + codepointSize); j > textBoxCursorIndex; j--) text[j] = text[j - codepointSize]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6585 for (int j = 0; j < codepointSize; j++) text[textBoxCursorIndex + j] = charEncoded[j]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6586 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6587 textBoxCursorIndex += codepointSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6588 textLength += codepointSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6589 text[textLength] = '\0'; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6590 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6591 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6592 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6593 #undef HAS_SELECTION |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6594 #undef SELECTION_MIN |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6595 #undef SELECTION_MAX |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6596 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6597 // Move cursor to start (with Shift selection support) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6598 if ((textLength > 0) && IsKeyPressed(KEY_HOME)) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6599 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6600 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6601 textBoxCursorIndex = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6602 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6603 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6604 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6605 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6606 // Move cursor to end (with Shift selection support) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6607 if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_END)) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6608 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6609 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6610 textBoxCursorIndex = textLength; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6611 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6612 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6613 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6614 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6615 // Delete selection if any (on Delete or Backspace) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6616 if ((textBoxSelectionStart >= 0 && textBoxSelectionEnd >= 0 && textBoxSelectionStart != textBoxSelectionEnd) && |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6617 (IsKeyPressed(KEY_DELETE) || IsKeyPressed(KEY_BACKSPACE))) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6618 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6619 int selMin = (textBoxSelectionStart < textBoxSelectionEnd) ? textBoxSelectionStart : textBoxSelectionEnd; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6620 int selMax = (textBoxSelectionStart > textBoxSelectionEnd) ? textBoxSelectionStart : textBoxSelectionEnd; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6621 int selLen = selMax - selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6622 for (int j = selMax; j <= textLength; j++) text[j - selLen] = text[j]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6623 textLength -= selLen; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6624 textBoxCursorIndex = selMin; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6625 textBoxSelectionStart = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6626 textBoxSelectionEnd = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6627 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6628 // Ctrl+Delete: Delete word after cursor |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6629 else if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_DELETE) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6630 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6631 int offset = textBoxCursorIndex; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6632 int accCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6633 int nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6634 int nextCodepoint; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6635 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6636 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6637 bool puctuation = ispunct(nextCodepoint & 0xff); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6638 while (offset < textLength) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6639 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6640 if ((puctuation && !ispunct(nextCodepoint & 0xff)) || (!puctuation && (isspace(nextCodepoint & 0xff) || ispunct(nextCodepoint & 0xff)))) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6641 break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6642 offset += nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6643 accCodepointSize += nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6644 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6645 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6646 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6647 while (offset < textLength) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6648 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6649 if (!isspace(nextCodepoint & 0xff)) break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6650 offset += nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6651 accCodepointSize += nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6652 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6653 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6654 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6655 for (int i = offset; i <= textLength; i++) text[i - accCodepointSize] = text[i]; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6656 textLength -= accCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6657 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6658 // Delete single character after cursor |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6659 else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && autoCursorShouldTrigger))) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6660 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6661 int nextCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6662 GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6663 for (int i = textBoxCursorIndex + nextCodepointSize; i <= textLength; i++) text[i - nextCodepointSize] = text[i]; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6664 textLength -= nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6665 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6666 // Ctrl+Backspace: Delete word before cursor |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6667 else if ((textBoxCursorIndex > 0) && IsKeyPressed(KEY_BACKSPACE) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6668 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6669 int offset = textBoxCursorIndex; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6670 int accCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6671 int prevCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6672 int prevCodepoint = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6673 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6674 while (offset > 0) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6675 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6676 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6677 if (!isspace(prevCodepoint & 0xff)) break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6678 offset -= prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6679 accCodepointSize += prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6680 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6681 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6682 bool puctuation = ispunct(prevCodepoint & 0xff); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6683 while (offset > 0) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6684 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6685 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6686 if ((puctuation && !ispunct(prevCodepoint & 0xff)) || (!puctuation && (isspace(prevCodepoint & 0xff) || ispunct(prevCodepoint & 0xff)))) break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6687 offset -= prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6688 accCodepointSize += prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6689 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6690 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6691 for (int i = textBoxCursorIndex; i <= textLength; i++) text[i - accCodepointSize] = text[i]; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6692 textLength -= accCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6693 textBoxCursorIndex -= accCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6694 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6695 // Backspace single character before cursor |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6696 else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && autoCursorShouldTrigger))) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6697 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6698 int prevCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6699 GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6700 for (int i = textBoxCursorIndex; i <= textLength; i++) text[i - prevCodepointSize] = text[i]; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6701 textLength -= prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6702 textBoxCursorIndex -= prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6703 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6704 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6705 // Move cursor position with keys (with Shift selection support) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6706 if ((textBoxCursorIndex > 0) && IsKeyPressed(KEY_LEFT) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6707 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6708 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6709 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6710 int offset = textBoxCursorIndex; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6711 int prevCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6712 int prevCodepoint = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6713 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6714 while (offset > 0) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6715 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6716 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6717 if (!isspace(prevCodepoint & 0xff)) break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6718 offset -= prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6719 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6720 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6721 bool puctuation = ispunct(prevCodepoint & 0xff); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6722 while (offset > 0) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6723 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6724 prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6725 if ((puctuation && !ispunct(prevCodepoint & 0xff)) || (!puctuation && (isspace(prevCodepoint & 0xff) || ispunct(prevCodepoint & 0xff)))) break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6726 offset -= prevCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6727 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6728 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6729 textBoxCursorIndex = offset; |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6730 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6731 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6732 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6733 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6734 else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_LEFT) || (IsKeyDown(KEY_LEFT) && autoCursorShouldTrigger))) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6735 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6736 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6737 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6738 int prevCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6739 GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6740 textBoxCursorIndex -= prevCodepointSize; |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6741 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6742 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6743 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6744 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6745 else if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_RIGHT) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6746 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6747 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6748 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6749 int offset = textBoxCursorIndex; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6750 int nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6751 int nextCodepoint; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6752 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6753 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6754 bool puctuation = ispunct(nextCodepoint & 0xff); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6755 while (offset < textLength) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6756 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6757 if ((puctuation && !ispunct(nextCodepoint & 0xff)) || (!puctuation && (isspace(nextCodepoint & 0xff) || ispunct(nextCodepoint & 0xff)))) break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6758 offset += nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6759 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6760 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6761 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6762 while (offset < textLength) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6763 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6764 if (!isspace(nextCodepoint & 0xff)) break; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6765 offset += nextCodepointSize; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6766 nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6767 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6768 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6769 textBoxCursorIndex = offset; |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6770 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6771 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6772 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6773 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6774 else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_RIGHT) || (IsKeyDown(KEY_RIGHT) && autoCursorShouldTrigger))) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6775 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6776 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6777 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6778 int nextCodepointSize = 0; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6779 GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6780 textBoxCursorIndex += nextCodepointSize; |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6781 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6782 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6783 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6784 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6785 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6786 // Vertical cursor movement using visual lines (with Shift selection support) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6787 if ((IsKeyPressed(KEY_UP) || (IsKeyDown(KEY_UP) && autoCursorShouldTrigger))) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6788 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6789 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6790 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6791 // Find current visual line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6792 int currVisLine = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6793 for (int vl = visualLineCount - 1; vl >= 0; vl--) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6794 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6795 if (textBoxCursorIndex >= visualLineStarts[vl]) { currVisLine = vl; break; } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6796 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6797 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6798 // Calculate X offset in current line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6799 int currLineStart = visualLineStarts[currVisLine]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6800 float xOffset = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6801 for (int k = currLineStart; k < textBoxCursorIndex && k < textLength; k++) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6802 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6803 if (text[k] == '\n') break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6804 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6805 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6806 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6807 float gw = (guiFont.glyphs[gi].advanceX == 0) ? (float)guiFont.recs[gi].width * scaleFactor : (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6808 xOffset += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6809 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6810 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6811 if (currVisLine > 0) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6812 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6813 // Move to previous visual line at same X position |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6814 int prevLineStart = visualLineStarts[currVisLine - 1]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6815 int prevLineEnd = visualLineStarts[currVisLine]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6816 if (prevLineEnd > 0 && text[prevLineEnd - 1] == '\n') prevLineEnd--; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6817 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6818 float accum = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6819 textBoxCursorIndex = prevLineStart; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6820 for (int k = prevLineStart; k < prevLineEnd; ) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6821 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6822 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6823 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6824 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6825 float gw = (guiFont.glyphs[gi].advanceX == 0) ? (float)guiFont.recs[gi].width * scaleFactor : (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6826 if (accum + gw / 2 >= xOffset) break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6827 accum += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6828 textBoxCursorIndex = k + cpSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6829 k += cpSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6830 } |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6831 } |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6832 else |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6833 { |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6834 textBoxCursorIndex = 0; |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6835 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6836 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6837 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6838 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6839 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6840 else if ((IsKeyPressed(KEY_DOWN) || (IsKeyDown(KEY_DOWN) && autoCursorShouldTrigger))) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6841 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6842 if (shiftDown && textBoxSelectionStart < 0) textBoxSelectionStart = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6843 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6844 // Find current visual line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6845 int currVisLine = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6846 for (int vl = visualLineCount - 1; vl >= 0; vl--) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6847 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6848 if (textBoxCursorIndex >= visualLineStarts[vl]) { currVisLine = vl; break; } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6849 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6850 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6851 // Calculate X offset in current line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6852 int currLineStart = visualLineStarts[currVisLine]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6853 float xOffset = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6854 for (int k = currLineStart; k < textBoxCursorIndex && k < textLength; k++) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6855 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6856 if (text[k] == '\n') break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6857 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6858 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6859 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6860 float gw = (guiFont.glyphs[gi].advanceX == 0) ? (float)guiFont.recs[gi].width * scaleFactor : (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6861 xOffset += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6862 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6863 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6864 if (currVisLine < visualLineCount - 1) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6865 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6866 // Move to next visual line at same X position |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6867 int nextLineStart = visualLineStarts[currVisLine + 1]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6868 int nextLineEnd = (currVisLine + 2 < visualLineCount) ? visualLineStarts[currVisLine + 2] : textLength; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6869 if (nextLineEnd > nextLineStart && text[nextLineEnd - 1] == '\n') nextLineEnd--; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6870 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6871 float accum = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6872 textBoxCursorIndex = nextLineStart; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6873 for (int k = nextLineStart; k < nextLineEnd; ) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6874 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6875 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6876 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6877 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6878 float gw = (guiFont.glyphs[gi].advanceX == 0) ? (float)guiFont.recs[gi].width * scaleFactor : (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6879 if (accum + gw / 2 >= xOffset) break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6880 accum += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6881 textBoxCursorIndex = k + cpSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6882 k += cpSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6883 } |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6884 } |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6885 else |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6886 { |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6887 textBoxCursorIndex = textLength; |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6888 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6889 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6890 if (shiftDown) textBoxSelectionEnd = textBoxCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6891 else { textBoxSelectionStart = -1; textBoxSelectionEnd = -1; } |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6892 } |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6893 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6894 // Move cursor position with mouse using visual lines |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6895 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6896 int mouseCursorIndex = 0; |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6897 bool mouseInBounds = CheckCollisionPointRec(mousePosition, textBounds); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6898 bool shouldCalculateMousePos = mouseInBounds || textBoxSelecting; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6899 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6900 if (shouldCalculateMousePos && textLength > 0) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6901 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6902 // Determine which visual line the mouse is on |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6903 int mouseLine = (int)((mousePosition.y - textBounds.y) / lineHeight); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6904 if (mouseLine < 0) mouseLine = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6905 if (mouseLine >= visualLineCount) mouseLine = visualLineCount - 1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6906 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6907 // Get the start and end of the target visual line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6908 int targetLineStart = visualLineStarts[mouseLine]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6909 int targetLineEnd = (mouseLine + 1 < visualLineCount) ? visualLineStarts[mouseLine + 1] : textLength; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6910 if (targetLineEnd > targetLineStart && text[targetLineEnd - 1] == '\n') targetLineEnd--; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6911 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6912 // Find character position within the line based on mouse X |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6913 float relativeMouseX = mousePosition.x - textBounds.x; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6914 if (relativeMouseX < 0) relativeMouseX = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6915 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6916 float widthAccum = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6917 mouseCursorIndex = targetLineStart; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6918 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6919 for (int k = targetLineStart; k < targetLineEnd; ) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6920 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6921 if (text[k] == '\n') break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6922 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6923 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6924 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6925 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6926 float gw; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6927 if (guiFont.glyphs[gi].advanceX == 0) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6928 gw = (float)guiFont.recs[gi].width * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6929 else |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6930 gw = (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6931 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6932 float charMidpoint = widthAccum + gw / 2.0f; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6933 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6934 if (relativeMouseX <= charMidpoint) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6935 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6936 mouseCursorIndex = k; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6937 break; |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6938 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6939 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6940 widthAccum += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6941 mouseCursorIndex = k + cpSize; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6942 k += cpSize; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6943 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6944 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6945 // Clamp to line end |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6946 if (mouseCursorIndex > targetLineEnd) mouseCursorIndex = targetLineEnd; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6947 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6948 else if (shouldCalculateMousePos) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6949 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6950 mouseCursorIndex = 0; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6951 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6952 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6953 // Mouse selection: start selection on mouse press (only when in bounds) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6954 if (mouseInBounds && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6955 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6956 textBoxCursorIndex = mouseCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6957 textBoxSelectionStart = mouseCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6958 textBoxSelectionEnd = mouseCursorIndex; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6959 textBoxSelecting = true; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6960 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6961 // Mouse selection: update selection while dragging (even outside bounds) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6962 else if (textBoxSelecting && IsMouseButtonDown(MOUSE_LEFT_BUTTON)) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6963 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6964 textBoxSelectionEnd = mouseCursorIndex; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6965 textBoxCursorIndex = mouseCursorIndex; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6966 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6967 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6968 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6969 // End mouse selection when button released |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6970 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6971 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6972 textBoxSelecting = false; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6973 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6974 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6975 // Recalculate cursor position using visual lines |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6976 // (Visual lines already calculated at the start - need to recalculate after any changes) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6977 int newCursorVisLine = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6978 for (int vl = visualLineCount - 1; vl >= 0; vl--) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6979 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6980 if (textBoxCursorIndex >= visualLineStarts[vl]) { newCursorVisLine = vl; break; } |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6981 } |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6982 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6983 int newCursorLineStart = visualLineStarts[newCursorVisLine]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6984 float newCursorXOffset = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6985 for (int k = newCursorLineStart; k < textBoxCursorIndex && k < textLength; k++) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
6986 { |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6987 if (text[k] == '\n') break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6988 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6989 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6990 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6991 float gw = (guiFont.glyphs[gi].advanceX == 0) ? (float)guiFont.recs[gi].width * scaleFactor : (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6992 newCursorXOffset += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6993 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6994 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6995 cursor.x = textBounds.x + newCursorXOffset; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6996 cursor.y = textBounds.y + newCursorVisLine * lineHeight; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6997 |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
6998 // Finish text editing on ENTER or mouse click outside bounds |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
6999 if ((!CheckCollisionPointRec(mousePosition, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7000 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7001 textBoxCursorIndex = 0; // GLOBAL: Reset the shared cursor index |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7002 autoCursorCounter = 0; // GLOBAL: Reset counter for repeated keystrokes |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7003 textBoxSelectionStart = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7004 textBoxSelectionEnd = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7005 textBoxSelecting = false; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7006 resultStruct.result = 1; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7007 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7008 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7009 else |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7010 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7011 if (CheckCollisionPointRec(mousePosition, bounds)) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7012 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7013 state = STATE_FOCUSED; |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7014 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7015 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7016 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7017 textBoxCursorIndex = textLength; // GLOBAL: Place cursor index to the end of current text |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7018 autoCursorCounter = 0; // GLOBAL: Reset counter for repeated keystrokes |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7019 textBoxSelectionStart = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7020 textBoxSelectionEnd = -1; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7021 resultStruct.result = 1; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7022 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7023 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7024 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7025 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7026 //-------------------------------------------------------------------- |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7027 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7028 // Draw control |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7029 //-------------------------------------------------------------------- |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7030 if (state == STATE_PRESSED) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7031 { |
|
116
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
114
diff
changeset
|
7032 GuiDrawRectangle(bounds, 0, GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED))); |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7033 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7034 else if (state == STATE_DISABLED) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7035 { |
|
116
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
114
diff
changeset
|
7036 GuiDrawRectangle(bounds, 0, GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED))); |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7037 } |
|
116
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
114
diff
changeset
|
7038 else GuiDrawRectangle(bounds, 0, GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED))); |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7039 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7040 // Draw selection highlight using visual lines |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7041 if (editMode && textBoxSelectionStart >= 0 && textBoxSelectionEnd >= 0 && textBoxSelectionStart != textBoxSelectionEnd) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7042 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7043 int selMin = (textBoxSelectionStart < textBoxSelectionEnd) ? textBoxSelectionStart : textBoxSelectionEnd; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7044 int selMax = (textBoxSelectionStart > textBoxSelectionEnd) ? textBoxSelectionStart : textBoxSelectionEnd; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7045 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7046 // Find visual line for selection start |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7047 int selStartVisLine = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7048 for (int vl = visualLineCount - 1; vl >= 0; vl--) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7049 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7050 if (selMin >= visualLineStarts[vl]) { selStartVisLine = vl; break; } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7051 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7052 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7053 // Find visual line for selection end |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7054 int selEndVisLine = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7055 for (int vl = visualLineCount - 1; vl >= 0; vl--) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7056 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7057 if (selMax >= visualLineStarts[vl]) { selEndVisLine = vl; break; } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7058 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7059 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7060 Color selectionColor = (Color){ 100, 150, 255, 100 }; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7061 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7062 // Draw selection for each visual line in range |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7063 for (int vl = selStartVisLine; vl <= selEndVisLine; vl++) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7064 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7065 int vlStart = visualLineStarts[vl]; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7066 int vlEnd = (vl + 1 < visualLineCount) ? visualLineStarts[vl + 1] : textLength; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7067 if (vlEnd > vlStart && vlEnd <= textLength && text[vlEnd - 1] == '\n') vlEnd--; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7068 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7069 // Determine selection bounds within this visual line |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7070 int drawStart = (vl == selStartVisLine) ? selMin : vlStart; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7071 int drawEnd = (vl == selEndVisLine) ? selMax : vlEnd; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7072 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7073 // Calculate X positions |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7074 float xStart = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7075 for (int k = vlStart; k < drawStart && k < textLength; k++) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7076 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7077 if (text[k] == '\n') break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7078 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7079 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7080 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7081 float gw = (guiFont.glyphs[gi].advanceX == 0) ? (float)guiFont.recs[gi].width * scaleFactor : (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7082 xStart += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7083 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7084 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7085 float xEnd = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7086 for (int k = vlStart; k < drawEnd && k < textLength; k++) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7087 { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7088 if (text[k] == '\n') break; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7089 int cpSize = 0; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7090 int cp = GetCodepointNext(&text[k], &cpSize); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7091 int gi = GetGlyphIndex(guiFont, cp); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7092 float gw = (guiFont.glyphs[gi].advanceX == 0) ? (float)guiFont.recs[gi].width * scaleFactor : (float)guiFont.glyphs[gi].advanceX * scaleFactor; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7093 xEnd += gw + (float)GuiGetStyle(DEFAULT, TEXT_SPACING); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7094 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7095 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7096 Rectangle selRect = { |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7097 textBounds.x + xStart, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7098 textBounds.y + vl * lineHeight, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7099 xEnd - xStart, |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7100 (float)GuiGetStyle(DEFAULT, TEXT_SIZE) |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7101 }; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7102 GuiDrawRectangle(selRect, 0, BLANK, selectionColor); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7103 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7104 } |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7105 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7106 // Draw text with word wrap enabled |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7107 int prevVerticalAlignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL); |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7108 int prevWrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7109 GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_TOP); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7110 GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_CHAR); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7111 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7112 GuiDrawText(text, textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3)))); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7113 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7114 // Restore previous settings |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7115 GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, prevVerticalAlignment); |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7116 GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, prevWrapMode); |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7117 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7118 // Draw cursor |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7119 if (editMode && !GuiGetStyle(TEXTBOX, TEXT_READONLY)) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7120 { |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7121 //if (autoCursorMode || ((blinkCursorFrameCounter/40)%2 == 0)) |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7122 GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7123 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7124 // Draw mouse position cursor (if required) |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7125 // if (mouseCursor.x >= 0) GuiDrawRectangle(mouseCursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7126 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7127 else if (state == STATE_FOCUSED) GuiTooltip(bounds); |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7128 //-------------------------------------------------------------------- |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7129 |
|
157
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7130 // Return selection info |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7131 resultStruct.selectionStart = textBoxSelectionStart; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7132 resultStruct.selectionEnd = textBoxSelectionEnd; |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7133 |
|
2db6253f355d
[ThirdParty] Added highlight library for better readability on blog.
June Park <parkjune1995@gmail.com>
parents:
118
diff
changeset
|
7134 return resultStruct; |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7135 } |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7136 |
|
112
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7137 void JUNE_DrawRectangleLinesNoBottom(Rectangle rect, float thickness, Color color) { |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7138 Vector2 topLeft = { rect.x, rect.y }; |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7139 Vector2 topRight = { rect.x + rect.width, rect.y }; |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7140 Vector2 bottomLeft = { rect.x, rect.y + rect.height }; |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7141 Vector2 bottomRight = { rect.x + rect.width, rect.y + rect.height }; |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7142 |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7143 DrawLineEx(topLeft, topRight, thickness, color); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7144 DrawLineEx(topLeft, bottomLeft, thickness, color); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7145 DrawLineEx(topRight, bottomRight, thickness, color); |
|
d6d578b49a19
[PostDog] Got CRUD working.
June Park <parkjune1995@gmail.com>
parents:
111
diff
changeset
|
7146 } |
|
111
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7147 |
|
48f260576059
[PostDog] Rewriting it from scratch as it is unreadable for me.
June Park <parkjune1995@gmail.com>
parents:
54
diff
changeset
|
7148 #endif // RAYGUI_IMPLEMENTnk_command_bufferATION |