add file dialog
This commit is contained in:
parent
7f0c088b3d
commit
a503e67eaf
6 changed files with 775 additions and 8 deletions
21
src/main.zig
21
src/main.zig
|
@ -7,15 +7,28 @@ const sqlite = @cImport({
|
|||
pub fn main() !void {
|
||||
const screen_width = 800;
|
||||
const screen_height = 450;
|
||||
raylib.InitWindow(screen_width, screen_height, "raylib [core] example - basic window");
|
||||
raylib.InitWindow(screen_width, screen_height, "FabApp");
|
||||
raylib.SetTargetFPS(60);
|
||||
|
||||
var file_dialog_state = raylib.InitGuiWindowFileDialog(raylib.GetWorkingDirectory());
|
||||
|
||||
while (!raylib.WindowShouldClose()) {
|
||||
raylib.BeginDrawing();
|
||||
defer raylib.EndDrawing();
|
||||
|
||||
raylib.ClearBackground(raylib.RAYWHITE);
|
||||
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LIGHTGRAY);
|
||||
if (raylib.GuiButton(.{ .x = 0, .y = 0, .width = 100, .height = 100 }, "MyButton") == 1) {}
|
||||
|
||||
{
|
||||
if (file_dialog_state.windowActive) raylib.GuiLock();
|
||||
defer raylib.GuiUnlock();
|
||||
|
||||
const button_size = 200;
|
||||
if (raylib.GuiButton(.{ .x = (screen_width - button_size) / 2, .y = (screen_height - button_size) / 2, .width = 200, .height = 200 }, "Load db file") == 1) {
|
||||
file_dialog_state.windowActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
raylib.GuiWindowFileDialog(&file_dialog_state);
|
||||
// // if (GuiButton((Rectangle){ 20, 20, 140, 30 }, GuiIconText(ICON_FILE_OPEN, "Open Image"))) fileDialogState.windowActive = true;
|
||||
}
|
||||
raylib.CloseWindow();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue