Skip to content

Commit

Permalink
Try to fix GUI-related issues in Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeodrippe committed Jan 25, 2025
1 parent f8034d6 commit d072f5f
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
66 changes: 66 additions & 0 deletions bin/vybe_raylib.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,70 @@
#define RAYGUI_IMPLEMENTATION TRUE
#endif

// To prevent undefined symbol on Linux when loading raygui functions, we
// provide the text-related functions shown at
// https://github.com/raysan5/raygui/blob/54bff64d7dbaefea877b0b2e32323761fc5692f2/examples/standalone/raygui_custom_backend.h#L139
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)

#elif __APPLE__

#else
//-------------------------------------------------------------------------------
// Text required functions
//-------------------------------------------------------------------------------
// USED IN: GuiLoadStyleDefault()
static Font GetFontDefault(void)
{
Font font = { 0 };

// TODO: Return default rendering Font for the UI

return font;
}

// USED IN: GetTextWidth()
static Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing)
{
Vector2 size = { 0 };

// TODO: Return text size (width, height) on screen depending on the Font, text, fontSize and spacing

return size;
}

// USED IN: GuiDrawText()
static void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
{
// TODO: Draw text on the screen
}

//-------------------------------------------------------------------------------
// GuiLoadStyle() required functions
//-------------------------------------------------------------------------------
static Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount)
{
Font font = { 0 };

// TODO: Load a new font from a file

return font;
}

static char *LoadText(const char *fileName)
{
// TODO: Load text file data, used by GuiLoadStyle() to load characters list required on Font generation,
// this is a .rgs feature, probably this function is not required in most cases

return NULL;
}

static const char *GetDirectoryPath(const char *filePath)
{
// TODO: Get directory path for .rgs file, required to look for a possible .ttf/.otf font file referenced,
// this is a .rgs feature, probably this function is not required in most cases

return NULL;
}
#endif

#include "../raygui/src/raygui.h"
2 changes: 2 additions & 0 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@
- [x] macro to quickly evaluate stuff
- [-] REPL plugin like portal does for cljs?
- [ ] https://github.com/pfeodrippe/vybe/issues/4
- [ ] check if we can call
- [ ] no gui for linux
- [ ] try to VybeC animation-node-player
- [x] don't use `-field` for non components
- [ ] make vector destructuring work
Expand Down

0 comments on commit d072f5f

Please sign in to comment.