Mercurial
annotate third_party/raylib/custom.c @ 122:96628cf126a0
[MrJuneJune] Websocket blog.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 08 Jan 2026 06:45:51 -0800 |
| parents | 7bd795bac997 |
| children | 87d8d3eb3491 |
| rev | line source |
|---|---|
|
116
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
1 #include "third_party/raylib/include/raylib.h" |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
2 #define RAYGUI_IMPLEMENTATION |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 #include "third_party/raylib/include/raygui.h" |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
4 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
5 // -- forward declarations --// |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
6 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 // --- Default Behaviour that should be part of all raylib gui ---/ |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
8 void DefaultBehaviours(); |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
9 // --- Increase Font Sizes on key press --- // |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
10 void IncreaseFontSize(); |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
11 // --- Decrease Font Sizes on key press --- // |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
12 void DecreaseFontSize(); |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
13 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
14 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
15 void DefaultBehaviours() |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
16 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
17 // Font sizes |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
18 IncreaseFontSize(); |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 DecreaseFontSize(); |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
21 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 void IncreaseFontSize() |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
24 if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyDown(KEY_EQUAL)) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
25 GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetStyle(DEFAULT, TEXT_SIZE) + 1); |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
26 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
27 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
28 void DecreaseFontSize() |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
29 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
30 if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyDown(KEY_MINUS)) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
31 GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetStyle(DEFAULT, TEXT_SIZE) - 1); |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
32 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
33 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
34 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
35 // --- Layout helper --- // |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
36 Rectangle RightOf(Rectangle ref, float padding) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
37 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
38 return (Rectangle){ |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
39 .x = ref.x + ref.width + padding, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
40 .y = ref.y, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
41 .width = 0, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
42 .height = ref.height |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
43 }; |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
44 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
45 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
46 Rectangle Below(Rectangle ref, float padding) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
47 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
48 return (Rectangle){ |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
49 .x = ref.x, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
50 .y = ref.y + ref.height + padding, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
51 .width = ref.width, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
52 .height = 0 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
53 }; |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
54 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
55 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
56 Rectangle LeftColumn(Rectangle container, float ratio, float padding) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
57 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
58 return (Rectangle){ |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
59 .x = container.x + padding, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
60 .y = container.y + padding, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
61 .width = (container.width * ratio) - padding, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
62 .height = container.height - (2 * padding) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
63 }; |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
64 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
65 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
66 Rectangle RightColumn(Rectangle container, Rectangle leftCol, float padding) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
67 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
68 return (Rectangle){ |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
69 .x = leftCol.x + leftCol.width + padding, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
70 .y = container.y + padding, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
71 .width = container.width - leftCol.width - (3 * padding), |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
72 .height = container.height - (2 * padding) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
73 }; |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
74 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
75 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
76 Rectangle HorizontalSplit(Rectangle container, float ratio) |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
77 { |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
78 return (Rectangle){ |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
79 .x = container.x, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
80 .y = container.y, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
81 .width = container.width * ratio, |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
82 .height = container.height |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
83 }; |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
84 } |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
85 |
|
7bd795bac997
[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
86 |