comparison third_party/raylib/custom.c @ 116:7bd795bac997

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