Skip to content

Commit 60ca9e4

Browse files
patch bug in raygui.h (#180)
1 parent a6cca9f commit 60ca9e4

File tree

5 files changed

+75
-2
lines changed

5 files changed

+75
-2
lines changed

.cirrus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pi_task:
4444
- make -j2
4545
- cp raylib/libraylib.a /usr/local/lib/libraylib.a
4646
build_script:
47+
- patch -p0 <raygui.h.diff
4748
- cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
4849
- cp physac/src/physac.h /usr/local/include/
4950
- cp raygui/src/raygui.h /usr/local/include/
@@ -134,6 +135,7 @@ mac_task:
134135
- make -j8
135136
- sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
136137
build_script:
138+
- patch -p0 <raygui.h.diff
137139
- sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
138140
- sudo cp physac/src/physac.h /usr/local/include/
139141
- sudo cp raygui/src/raygui.h /usr/local/include/

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
with:
2626
submodules: recursive
2727

28+
- name: fix raygui bug
29+
run: |
30+
patch -p0 <raygui.h.diff
31+
2832
- name: Build SDL
2933
run: |
3034
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.30.7.tar.gz
@@ -195,6 +199,10 @@ jobs:
195199
with:
196200
submodules: recursive
197201

202+
- name: fix raygui bug
203+
run: |
204+
patch -p0 <raygui.h.diff
205+
198206
- name: Setup Python
199207
uses: actions/setup-python@v5
200208
with:
@@ -278,6 +286,10 @@ jobs:
278286
with:
279287
submodules: recursive
280288

289+
- name: fix raygui bug
290+
run: |
291+
patch -p0 <raygui.h.diff
292+
281293
- name: Download SDL2
282294
run: curl -L -o SDL2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.30.8/SDL2-devel-2.30.8-VC.zip
283295

@@ -359,6 +371,10 @@ jobs:
359371
with:
360372
submodules: recursive
361373

374+
- name: fix raygui bug
375+
run: |
376+
patch -p0 <raygui.h.diff
377+
362378
- name: Setup Python
363379
uses: actions/setup-python@v5
364380
with:
@@ -406,6 +422,10 @@ jobs:
406422
with:
407423
submodules: recursive
408424

425+
- name: fix raygui bug
426+
run: |
427+
patch -p0 <raygui.h.diff
428+
409429
- name: Setup Python
410430
uses: actions/setup-python@v5
411431
with:

raygui.h.diff

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--- raygui_buggy/src/raygui.h 2025-08-25 20:37:15.268489729 +0100
2+
+++ raygui/src/raygui.h 2025-08-25 20:38:02.052486927 +0100
3+
@@ -696,8 +696,8 @@
4+
RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state)
5+
6+
// Style set/get functions
7+
-RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property
8+
-RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property
9+
+RAYGUIAPI void GuiSetStyle(int control, int property, unsigned int value); // Set one style property
10+
+RAYGUIAPI unsigned int GuiGetStyle(int control, int property); // Get one style property
11+
12+
// Styles loading functions
13+
RAYGUIAPI void GuiLoadStyle(const char *fileName); // Load style file over global style variable (.rgs)
14+
@@ -1557,7 +1557,7 @@
15+
}
16+
17+
// Set control style property value
18+
-void GuiSetStyle(int control, int property, int value)
19+
+void GuiSetStyle(int control, int property, int unsigned value)
20+
{
21+
if (!guiStyleLoaded) GuiLoadStyleDefault();
22+
guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value;
23+
@@ -1570,7 +1570,7 @@
24+
}
25+
26+
// Get control style property value
27+
-int GuiGetStyle(int control, int property)
28+
+unsigned int GuiGetStyle(int control, int property)
29+
{
30+
if (!guiStyleLoaded) GuiLoadStyleDefault();
31+
return guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property];

raylib/raygui.h.modified

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ typedef enum {
541541
/* Functions defined as 'extern' by default (implicit specifiers)*/ void GuiSetFont(Font font); // Set gui custom font (global state)
542542
/* Functions defined as 'extern' by default (implicit specifiers)*/ Font GuiGetFont(void); // Get gui custom font (global state)
543543
// Style set/get functions
544-
/* Functions defined as 'extern' by default (implicit specifiers)*/ void GuiSetStyle(int control, int property, int value); // Set one style property
545-
/* Functions defined as 'extern' by default (implicit specifiers)*/ int GuiGetStyle(int control, int property); // Get one style property
544+
/* Functions defined as 'extern' by default (implicit specifiers)*/ void GuiSetStyle(int control, int property, unsigned int value); // Set one style property
545+
/* Functions defined as 'extern' by default (implicit specifiers)*/ unsigned int GuiGetStyle(int control, int property); // Get one style property
546546
// Styles loading functions
547547
/* Functions defined as 'extern' by default (implicit specifiers)*/ void GuiLoadStyle(const char *fileName); // Load style file over global style variable (.rgs)
548548
/* Functions defined as 'extern' by default (implicit specifiers)*/ void GuiLoadStyleDefault(void); // Load style default over global style

tests/test_raygui_style.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from pyray import *
2+
3+
init_window(400, 200, "raygui - controls test suite")
4+
set_target_fps(60)
5+
6+
7+
while not window_should_close():
8+
# Draw
9+
#----------------------------------------------------------------------------------
10+
begin_drawing()
11+
clear_background(get_color(abs(gui_get_style(DEFAULT, BACKGROUND_COLOR))));
12+
13+
gui_button(Rectangle(24, 24, 320, 30), "#191#Background should be white")
14+
15+
16+
17+
end_drawing()
18+
19+
20+
close_window()

0 commit comments

Comments
 (0)