add raygui example
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,8 +1 @@
|
|||||||
app
|
app
|
||||||
|
|
||||||
*.o
|
|
||||||
*.d
|
|
||||||
*.i
|
|
||||||
*.s
|
|
||||||
*.so
|
|
||||||
*.a
|
|
||||||
|
|||||||
33
Makefile
33
Makefile
@@ -1,21 +1,28 @@
|
|||||||
all: app
|
TARGET = app
|
||||||
|
CC = gcc -std=c23 -ggdb -Wall -Wextra -pedantic -O0
|
||||||
|
INC = -I./raylib/include
|
||||||
|
LIB_PATH = -L./raylib/lib
|
||||||
|
LIBS = -lraylib \
|
||||||
|
-lm
|
||||||
|
|
||||||
app: main.c
|
all: $(TARGET)
|
||||||
@gcc -std=c23 -ggdb -Wall -Wextra -pedantic -O0 main.c -o app
|
|
||||||
|
$(TARGET): main.c
|
||||||
|
@$(CC) $(INC) $(LIB_PATH) main.c -o $(TARGET) $(LIBS)
|
||||||
|
|
||||||
.PHONY: clean run test debug
|
.PHONY: clean run test debug
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -rf app
|
@rm -rf $(TARGET)
|
||||||
|
|
||||||
run: app
|
run: $(TARGET)
|
||||||
-@./app
|
-@./$(TARGET)
|
||||||
@rm -rf app
|
@rm -rf $(TARGET)
|
||||||
|
|
||||||
test: app
|
test: $(TARGET)
|
||||||
@valgrind ./app
|
@valgrind ./$(TARGET)
|
||||||
@rm -rf app
|
@rm -rf $(TARGET)
|
||||||
|
|
||||||
debug: app
|
debug: $(TARGET)
|
||||||
@gdb ./app
|
@gdb ./$(TARGET)
|
||||||
@rm -rf app
|
@rm -rf $(TARGET)
|
||||||
|
|||||||
35
main.c
35
main.c
@@ -1,7 +1,40 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#define RAYGUI_IMPLEMENTATION
|
||||||
|
#include "raygui.h"
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
printf("Hello\n");
|
InitWindow(400, 200, "App");
|
||||||
|
SetTargetFPS(60);
|
||||||
|
|
||||||
|
bool showMessageBox = false;
|
||||||
|
|
||||||
|
while (!WindowShouldClose()) {
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||||
|
|
||||||
|
if (GuiButton((Rectangle){24, 24, 120, 30}, "#191Show Message")) {
|
||||||
|
showMessageBox = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showMessageBox) {
|
||||||
|
int result = GuiMessageBox(
|
||||||
|
(Rectangle){85, 70, 250, 100},
|
||||||
|
"#191Message Box",
|
||||||
|
"Hi! This is a message!",
|
||||||
|
"Nice;Cool"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result >= 0) {
|
||||||
|
showMessageBox = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseWindow();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
5987
raylib/include/raygui.h
Normal file
5987
raylib/include/raygui.h
Normal file
File diff suppressed because it is too large
Load Diff
1727
raylib/include/raylib.h
Normal file
1727
raylib/include/raylib.h
Normal file
File diff suppressed because it is too large
Load Diff
BIN
raylib/lib/libraylib.a
Normal file
BIN
raylib/lib/libraylib.a
Normal file
Binary file not shown.
Reference in New Issue
Block a user