examples
248
examples/gui/controls_test_suite/controls_test_suite.c
Normal file
|
@ -0,0 +1,248 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - controls test suite
|
||||
*
|
||||
* TEST CONTROLS:
|
||||
* - GuiDropdownBox()
|
||||
* - GuiCheckBox()
|
||||
* - GuiSpinner()
|
||||
* - GuiValueBox()
|
||||
* - GuiTextBox()
|
||||
* - GuiButton()
|
||||
* - GuiComboBox()
|
||||
* - GuiListView()
|
||||
* - GuiToggleGroup()
|
||||
* - GuiTextBoxMulti()
|
||||
* - GuiColorPicker()
|
||||
* - GuiSlider()
|
||||
* - GuiSliderBar()
|
||||
* - GuiProgressBar()
|
||||
* - GuiColorBarAlpha()
|
||||
* - GuiScrollPanel()
|
||||
*
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.2 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
//#define RAYGUI_CUSTOM_ICONS // It requires providing gui_icons.h in the same directory
|
||||
//#include "gui_icons.h" // External icons data provided, it can be generated with rGuiIcons tool
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
#include <string.h> // Required for: strcpy()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------------------------------------
|
||||
const int screenWidth = 690;
|
||||
const int screenHeight = 560;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raygui - controls test suite");
|
||||
SetExitKey(0);
|
||||
|
||||
// GUI controls initialization
|
||||
//----------------------------------------------------------------------------------
|
||||
int dropdownBox000Active = 0;
|
||||
bool dropDown000EditMode = false;
|
||||
|
||||
int dropdownBox001Active = 0;
|
||||
bool dropDown001EditMode = false;
|
||||
|
||||
int spinner001Value = 0;
|
||||
bool spinnerEditMode = false;
|
||||
|
||||
int valueBox002Value = 0;
|
||||
bool valueBoxEditMode = false;
|
||||
|
||||
char textBoxText[64] = "Text box";
|
||||
bool textBoxEditMode = false;
|
||||
|
||||
int listViewScrollIndex = 0;
|
||||
int listViewActive = -1;
|
||||
|
||||
int listViewExScrollIndex = 0;
|
||||
int listViewExActive = 2;
|
||||
int listViewExFocus = -1;
|
||||
const char *listViewExList[8] = { "This", "is", "a", "list view", "with", "disable", "elements", "amazing!" };
|
||||
|
||||
char multiTextBoxText[256] = "Multi text box";
|
||||
bool multiTextBoxEditMode = false;
|
||||
Color colorPickerValue = RED;
|
||||
|
||||
int sliderValue = 50;
|
||||
int sliderBarValue = 60;
|
||||
float progressValue = 0.4f;
|
||||
|
||||
bool forceSquaredChecked = false;
|
||||
|
||||
float alphaValue = 0.5f;
|
||||
|
||||
int comboBoxActive = 1;
|
||||
|
||||
int toggleGroupActive = 0;
|
||||
|
||||
Vector2 viewScroll = { 0, 0 };
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Custom GUI font loading
|
||||
//Font font = LoadFontEx("fonts/rainyhearts16.ttf", 12, 0, 0);
|
||||
//GuiSetFont(font);
|
||||
|
||||
bool exitWindow = false;
|
||||
bool showMessageBox = false;
|
||||
|
||||
char textInput[256] = { 0 };
|
||||
bool showTextInputBox = false;
|
||||
|
||||
char textInputFileName[256] = { 0 };
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!exitWindow) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
exitWindow = WindowShouldClose();
|
||||
|
||||
if (IsKeyPressed(KEY_ESCAPE)) showMessageBox = !showMessageBox;
|
||||
|
||||
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_S)) showTextInputBox = true;
|
||||
|
||||
if (IsFileDropped())
|
||||
{
|
||||
FilePathList droppedFiles = LoadDroppedFiles();
|
||||
|
||||
if ((droppedFiles.count > 0) && IsFileExtension(droppedFiles.paths[0], ".rgs")) GuiLoadStyle(droppedFiles.paths[0]);
|
||||
|
||||
UnloadDroppedFiles(droppedFiles); // Clear internal buffers
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
|
||||
// raygui: controls drawing
|
||||
//----------------------------------------------------------------------------------
|
||||
if (dropDown000EditMode || dropDown001EditMode) GuiLock();
|
||||
else if (!dropDown000EditMode && !dropDown001EditMode) GuiUnlock();
|
||||
//GuiDisable();
|
||||
|
||||
// First GUI column
|
||||
//GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
forceSquaredChecked = GuiCheckBox((Rectangle){ 25, 108, 15, 15 }, "FORCE CHECK!", forceSquaredChecked);
|
||||
|
||||
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
//GuiSetStyle(VALUEBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
if (GuiSpinner((Rectangle){ 25, 135, 125, 30 }, NULL, &spinner001Value, 0, 100, spinnerEditMode)) spinnerEditMode = !spinnerEditMode;
|
||||
if (GuiValueBox((Rectangle){ 25, 175, 125, 30 }, NULL, &valueBox002Value, 0, 100, valueBoxEditMode)) valueBoxEditMode = !valueBoxEditMode;
|
||||
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
if (GuiTextBox((Rectangle){ 25, 215, 125, 30 }, textBoxText, 64, textBoxEditMode)) textBoxEditMode = !textBoxEditMode;
|
||||
|
||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
|
||||
if (GuiButton((Rectangle){ 25, 255, 125, 30 }, GuiIconText(ICON_FILE_SAVE, "Save File"))) showTextInputBox = true;
|
||||
|
||||
GuiGroupBox((Rectangle){ 25, 310, 125, 150 }, "STATES");
|
||||
//GuiLock();
|
||||
GuiSetState(STATE_NORMAL); if (GuiButton((Rectangle){ 30, 320, 115, 30 }, "NORMAL")) { }
|
||||
GuiSetState(STATE_FOCUSED); if (GuiButton((Rectangle){ 30, 355, 115, 30 }, "FOCUSED")) { }
|
||||
GuiSetState(STATE_PRESSED); if (GuiButton((Rectangle){ 30, 390, 115, 30 }, "#15#PRESSED")) { }
|
||||
GuiSetState(STATE_DISABLED); if (GuiButton((Rectangle){ 30, 425, 115, 30 }, "DISABLED")) { }
|
||||
GuiSetState(STATE_NORMAL);
|
||||
//GuiUnlock();
|
||||
|
||||
comboBoxActive = GuiComboBox((Rectangle){ 25, 470, 125, 30 }, "ONE;TWO;THREE;FOUR", comboBoxActive);
|
||||
|
||||
// NOTE: GuiDropdownBox must draw after any other control that can be covered on unfolding
|
||||
GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
if (GuiDropdownBox((Rectangle){ 25, 65, 125, 30 }, "#01#ONE;#02#TWO;#03#THREE;#04#FOUR", &dropdownBox001Active, dropDown001EditMode)) dropDown001EditMode = !dropDown001EditMode;
|
||||
|
||||
GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
if (GuiDropdownBox((Rectangle){ 25, 25, 125, 30 }, "ONE;TWO;THREE", &dropdownBox000Active, dropDown000EditMode)) dropDown000EditMode = !dropDown000EditMode;
|
||||
|
||||
// Second GUI column
|
||||
listViewActive = GuiListView((Rectangle){ 165, 25, 140, 140 }, "Charmander;Bulbasaur;#18#Squirtel;Pikachu;Eevee;Pidgey", &listViewScrollIndex, listViewActive);
|
||||
listViewExActive = GuiListViewEx((Rectangle){ 165, 180, 140, 200 }, listViewExList, 8, &listViewExFocus, &listViewExScrollIndex, listViewExActive);
|
||||
|
||||
toggleGroupActive = GuiToggleGroup((Rectangle){ 165, 400, 140, 25 }, "#1#ONE\n#3#TWO\n#8#THREE\n#23#", toggleGroupActive);
|
||||
|
||||
// Third GUI column
|
||||
if (GuiTextBoxMulti((Rectangle){ 320, 25, 225, 140 }, multiTextBoxText, 256, multiTextBoxEditMode)) multiTextBoxEditMode = !multiTextBoxEditMode;
|
||||
colorPickerValue = GuiColorPicker((Rectangle){ 320, 185, 196, 192 }, NULL, colorPickerValue);
|
||||
|
||||
sliderValue = GuiSlider((Rectangle){ 355, 400, 165, 20 }, "TEST", TextFormat("%2.2f", (float)sliderValue), sliderValue, -50, 100);
|
||||
sliderBarValue = GuiSliderBar((Rectangle){ 320, 430, 200, 20 }, NULL, TextFormat("%i", (int)sliderBarValue), sliderBarValue, 0, 100);
|
||||
progressValue = GuiProgressBar((Rectangle){ 320, 460, 200, 20 }, NULL, NULL, progressValue, 0, 1);
|
||||
|
||||
// NOTE: View rectangle could be used to perform some scissor test
|
||||
Rectangle view = GuiScrollPanel((Rectangle){ 560, 25, 100, 160 }, NULL, (Rectangle){ 560, 25, 200, 400 }, &viewScroll);
|
||||
|
||||
GuiPanel((Rectangle){ 560, 25 + 180, 100, 160 }, "Panel Info");
|
||||
|
||||
GuiGrid((Rectangle) { 560, 25 + 180 + 180, 100, 120 }, NULL, 20, 2);
|
||||
|
||||
GuiStatusBar((Rectangle){ 0, (float)GetScreenHeight() - 20, (float)GetScreenWidth(), 20 }, "This is a status bar");
|
||||
|
||||
alphaValue = GuiColorBarAlpha((Rectangle){ 320, 490, 200, 30 }, NULL, alphaValue);
|
||||
|
||||
if (showMessageBox)
|
||||
{
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
int result = GuiMessageBox((Rectangle){ (float)GetScreenWidth()/2 - 125, (float)GetScreenHeight()/2 - 50, 250, 100 }, GuiIconText(ICON_EXIT, "Close Window"), "Do you really want to exit?", "Yes;No");
|
||||
|
||||
if ((result == 0) || (result == 2)) showMessageBox = false;
|
||||
else if (result == 1) exitWindow = true;
|
||||
}
|
||||
|
||||
if (showTextInputBox)
|
||||
{
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
int result = GuiTextInputBox((Rectangle){ (float)GetScreenWidth()/2 - 120, (float)GetScreenHeight()/2 - 60, 240, 140 }, "Save", GuiIconText(ICON_FILE_SAVE, "Save file as..."), "Ok;Cancel", textInput, 255, NULL);
|
||||
|
||||
if (result == 1)
|
||||
{
|
||||
// TODO: Validate textInput value and save
|
||||
|
||||
strcpy(textInputFileName, textInput);
|
||||
}
|
||||
|
||||
if ((result == 0) || (result == 1) || (result == 2))
|
||||
{
|
||||
showTextInputBox = false;
|
||||
strcpy(textInput, "\0");
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/gui/custom_file_dialog/cat.png
Normal file
After Width: | Height: | Size: 379 KiB |
111
examples/gui/custom_file_dialog/custom_file_dialog.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - custom file dialog to load image
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.0 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
#undef RAYGUI_IMPLEMENTATION // Avoid including raygui implementation again
|
||||
#define GUI_FILE_DIALOG_IMPLEMENTATION
|
||||
#include "gui_file_dialog.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 560;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raygui - custom modal dialog");
|
||||
SetExitKey(0);
|
||||
|
||||
// Custom file dialog
|
||||
GuiFileDialogState fileDialogState = InitGuiFileDialog(GetWorkingDirectory());
|
||||
|
||||
bool exitWindow = false;
|
||||
|
||||
char fileNameToLoad[512] = { 0 };
|
||||
|
||||
Texture texture = { 0 };
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!exitWindow) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
exitWindow = WindowShouldClose();
|
||||
|
||||
if (fileDialogState.SelectFilePressed)
|
||||
{
|
||||
// Load image file (if supported extension)
|
||||
if (IsFileExtension(fileDialogState.fileNameText, ".png"))
|
||||
{
|
||||
strcpy(fileNameToLoad, TextFormat("%s/%s", fileDialogState.dirPathText, fileDialogState.fileNameText));
|
||||
UnloadTexture(texture);
|
||||
texture = LoadTexture(fileNameToLoad);
|
||||
}
|
||||
|
||||
fileDialogState.SelectFilePressed = false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
|
||||
DrawTexture(texture, GetScreenWidth()/2 - texture.width/2, GetScreenHeight()/2 - texture.height/2 - 5, WHITE);
|
||||
DrawRectangleLines(GetScreenWidth()/2 - texture.width/2, GetScreenHeight()/2 - texture.height/2 - 5, texture.width, texture.height, BLACK);
|
||||
|
||||
DrawText(fileNameToLoad, 208, GetScreenHeight() - 20, 10, GRAY);
|
||||
|
||||
// raygui: controls drawing
|
||||
//----------------------------------------------------------------------------------
|
||||
if (fileDialogState.windowActive) GuiLock();
|
||||
|
||||
if (GuiButton((Rectangle){ 20, 20, 140, 30 }, GuiIconText(ICON_FILE_OPEN, "Open Image"))) fileDialogState.windowActive = true;
|
||||
|
||||
GuiUnlock();
|
||||
|
||||
// GUI: Dialog Window
|
||||
//--------------------------------------------------------------------------------
|
||||
GuiFileDialog(&fileDialogState);
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Unload texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
617
examples/gui/custom_file_dialog/gui_file_dialog.h
Normal file
|
@ -0,0 +1,617 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* FileDialog v1.2 - Modal file dialog to open/save files
|
||||
*
|
||||
* MODULE USAGE:
|
||||
* #define GUI_FILE_DIALOG_IMPLEMENTATION
|
||||
* #include "gui_file_dialog.h"
|
||||
*
|
||||
* INIT: GuiFileDialogState state = InitGuiFileDialog();
|
||||
* DRAW: GuiFileDialog(&state);
|
||||
*
|
||||
* NOTE: This module depends on some raylib file system functions:
|
||||
* - LoadDirectoryFiles()
|
||||
* - UnloadDirectoryFiles()
|
||||
* - GetWorkingDirectory()
|
||||
* - DirectoryExists()
|
||||
* - FileExists()
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2019-2022 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#ifndef GUI_FILE_DIALOG_H
|
||||
#define GUI_FILE_DIALOG_H
|
||||
|
||||
// Gui file dialog context data
|
||||
typedef struct {
|
||||
|
||||
// Window management variables
|
||||
bool windowActive;
|
||||
Rectangle windowBounds;
|
||||
Vector2 panOffset;
|
||||
bool dragMode;
|
||||
bool supportDrag;
|
||||
|
||||
// UI variables
|
||||
bool dirPathEditMode;
|
||||
char dirPathText[1024];
|
||||
|
||||
int filesListScrollIndex;
|
||||
bool filesListEditMode;
|
||||
int filesListActive;
|
||||
|
||||
bool fileNameEditMode;
|
||||
char fileNameText[1024];
|
||||
bool SelectFilePressed;
|
||||
bool CancelFilePressed;
|
||||
int fileTypeActive;
|
||||
int itemFocused;
|
||||
|
||||
// Custom state variables
|
||||
FilePathList dirFiles;
|
||||
char filterExt[256];
|
||||
char dirPathTextCopy[1024];
|
||||
char fileNameTextCopy[1024];
|
||||
|
||||
int prevFilesListActive;
|
||||
|
||||
bool saveFileMode;
|
||||
|
||||
} GuiFileDialogState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { // Prevents name mangling of functions
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
//----------------------------------------------------------------------------------
|
||||
//...
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
// ...
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
//...
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
GuiFileDialogState InitGuiFileDialog(const char *initPath);
|
||||
void GuiFileDialog(GuiFileDialogState *state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GUI_FILE_DIALOG_H
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* GUI_FILE_DIALOG IMPLEMENTATION
|
||||
*
|
||||
************************************************************************************/
|
||||
#if defined(GUI_FILE_DIALOG_IMPLEMENTATION)
|
||||
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
#include <string.h> // Required for: strcpy()
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
//----------------------------------------------------------------------------------
|
||||
#define MAX_DIRECTORY_FILES 2048
|
||||
#define MAX_ICON_PATH_LENGTH 512
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
#if defined(USE_CUSTOM_LISTVIEW_FILEINFO)
|
||||
// Detailed file info type
|
||||
typedef struct FileInfo {
|
||||
const char *name;
|
||||
int size;
|
||||
int modTime;
|
||||
int type;
|
||||
int icon;
|
||||
} FileInfo;
|
||||
#else
|
||||
// Filename only
|
||||
typedef char *FileInfo; // Files are just a path string
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
FileInfo *dirFilesIcon = NULL; // Path string + icon (for fancy drawing)
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Internal Module Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
// Read files in new path
|
||||
static void ReloadDirectoryFiles(GuiFileDialogState *state);
|
||||
|
||||
#if defined(USE_CUSTOM_LISTVIEW_FILEINFO)
|
||||
// List View control for files info with extended parameters
|
||||
static int GuiListViewFiles(Rectangle bounds, FileInfo *files, int count, int *focus, int *scrollIndex, int active);
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
GuiFileDialogState InitGuiFileDialog(const char *initPath)
|
||||
{
|
||||
GuiFileDialogState state = { 0 };
|
||||
|
||||
// Init window data
|
||||
state.windowBounds = (Rectangle){ GetScreenWidth()/2 - 440/2, GetScreenHeight()/2 - 310/2, 440, 310 };
|
||||
state.windowActive = false;
|
||||
state.supportDrag = true;
|
||||
state.dragMode = false;
|
||||
state.panOffset = (Vector2){ 0, 0 };
|
||||
|
||||
// Init path data
|
||||
state.dirPathEditMode = false;
|
||||
state.filesListActive = -1;
|
||||
state.prevFilesListActive = state.filesListActive;
|
||||
state.filesListScrollIndex = 0;
|
||||
|
||||
state.fileNameEditMode = false;
|
||||
|
||||
state.SelectFilePressed = false;
|
||||
state.CancelFilePressed = false;
|
||||
|
||||
state.fileTypeActive = 0;
|
||||
|
||||
strcpy(state.fileNameText, "\0");
|
||||
|
||||
// Custom variables initialization
|
||||
if (initPath && DirectoryExists(initPath))
|
||||
{
|
||||
strcpy(state.dirPathText, initPath);
|
||||
}
|
||||
else if (initPath && FileExists(initPath))
|
||||
{
|
||||
strcpy(state.dirPathText, GetDirectoryPath(initPath));
|
||||
strcpy(state.fileNameText, GetFileName(initPath));
|
||||
}
|
||||
else strcpy(state.dirPathText, GetWorkingDirectory());
|
||||
|
||||
// TODO: Why we keep a copy?
|
||||
strcpy(state.dirPathTextCopy, state.dirPathText);
|
||||
strcpy(state.fileNameTextCopy, state.fileNameText);
|
||||
|
||||
state.filterExt[0] = '\0';
|
||||
//strcpy(state.filterExt, "all");
|
||||
|
||||
state.dirFiles.count = 0;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
// Update and draw file dialog
|
||||
void GuiFileDialog(GuiFileDialogState *state)
|
||||
{
|
||||
if (state->windowActive)
|
||||
{
|
||||
// Update window dragging
|
||||
//----------------------------------------------------------------------------------------
|
||||
if (state->supportDrag)
|
||||
{
|
||||
Vector2 mousePosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
// Window can be dragged from the top window bar
|
||||
if (CheckCollisionPointRec(mousePosition, (Rectangle){ state->windowBounds.x, state->windowBounds.y, (float)state->windowBounds.width, RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT }))
|
||||
{
|
||||
state->dragMode = true;
|
||||
state->panOffset.x = mousePosition.x - state->windowBounds.x;
|
||||
state->panOffset.y = mousePosition.y - state->windowBounds.y;
|
||||
}
|
||||
}
|
||||
|
||||
if (state->dragMode)
|
||||
{
|
||||
state->windowBounds.x = (mousePosition.x - state->panOffset.x);
|
||||
state->windowBounds.y = (mousePosition.y - state->panOffset.y);
|
||||
|
||||
// Check screen limits to avoid moving out of screen
|
||||
if (state->windowBounds.x < 0) state->windowBounds.x = 0;
|
||||
else if (state->windowBounds.x > (GetScreenWidth() - state->windowBounds.width)) state->windowBounds.x = GetScreenWidth() - state->windowBounds.width;
|
||||
|
||||
if (state->windowBounds.y < 0) state->windowBounds.y = 0;
|
||||
else if (state->windowBounds.y > (GetScreenHeight() - state->windowBounds.height)) state->windowBounds.y = GetScreenHeight() - state->windowBounds.height;
|
||||
|
||||
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) state->dragMode = false;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
// Load dirFilesIcon and state->dirFiles lazily on windows open
|
||||
// NOTE: They are automatically unloaded at fileDialog closing
|
||||
//----------------------------------------------------------------------------------------
|
||||
if (dirFilesIcon == NULL)
|
||||
{
|
||||
dirFilesIcon = (FileInfo *)RL_CALLOC(MAX_DIRECTORY_FILES, sizeof(FileInfo)); // Max files to read
|
||||
for (int i = 0; i < MAX_DIRECTORY_FILES; i++) dirFilesIcon[i] = (char *)RL_CALLOC(MAX_ICON_PATH_LENGTH, 1); // Max file name length
|
||||
}
|
||||
|
||||
// Load current directory files
|
||||
if (state->dirFiles.paths == NULL) ReloadDirectoryFiles(state);
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
// Draw window and controls
|
||||
//----------------------------------------------------------------------------------------
|
||||
state->windowActive = !GuiWindowBox(state->windowBounds, "#198# Select File Dialog");
|
||||
|
||||
// Draw previous directory button + logic
|
||||
if (GuiButton((Rectangle){ state->windowBounds.x + state->windowBounds.width - 48, state->windowBounds.y + 24 + 12, 40, 24 }, "< .."))
|
||||
{
|
||||
// Move dir path one level up
|
||||
strcpy(state->dirPathText, GetPrevDirectoryPath(state->dirPathText));
|
||||
|
||||
// Reload directory files (frees previous list)
|
||||
ReloadDirectoryFiles(state);
|
||||
|
||||
state->filesListActive = -1;
|
||||
memset(state->fileNameText, 0, 1024);
|
||||
memset(state->fileNameTextCopy, 0, 1024);
|
||||
}
|
||||
|
||||
// Draw current directory text box info + path editing logic
|
||||
if (GuiTextBox((Rectangle){ state->windowBounds.x + 8, state->windowBounds.y + 24 + 12, state->windowBounds.width - 48 - 16, 24 }, state->dirPathText, 1024, state->dirPathEditMode))
|
||||
{
|
||||
if (state->dirPathEditMode)
|
||||
{
|
||||
// Verify if a valid path has been introduced
|
||||
if (DirectoryExists(state->dirPathText))
|
||||
{
|
||||
// Reload directory files (frees previous list)
|
||||
ReloadDirectoryFiles(state);
|
||||
|
||||
strcpy(state->dirPathTextCopy, state->dirPathText);
|
||||
}
|
||||
else strcpy(state->dirPathText, state->dirPathTextCopy);
|
||||
}
|
||||
|
||||
state->dirPathEditMode = !state->dirPathEditMode;
|
||||
}
|
||||
|
||||
// List view elements are aligned left
|
||||
int prevTextAlignment = GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT);
|
||||
int prevElementsHeight = GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
GuiSetStyle(LISTVIEW, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, 24);
|
||||
# if defined(USE_CUSTOM_LISTVIEW_FILEINFO)
|
||||
state->filesListActive = GuiListViewFiles((Rectangle){ state->position.x + 8, state->position.y + 48 + 20, state->windowBounds.width - 16, state->windowBounds.height - 60 - 16 - 68 }, fileInfo, state->dirFiles.count, &state->itemFocused, &state->filesListScrollIndex, state->filesListActive);
|
||||
# else
|
||||
state->filesListActive = GuiListViewEx((Rectangle){ state->windowBounds.x + 8, state->windowBounds.y + 48 + 20, state->windowBounds.width - 16, state->windowBounds.height - 60 - 16 - 68 }, dirFilesIcon, state->dirFiles.count, &state->itemFocused, &state->filesListScrollIndex, state->filesListActive);
|
||||
# endif
|
||||
GuiSetStyle(LISTVIEW, TEXT_ALIGNMENT, prevTextAlignment);
|
||||
GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, prevElementsHeight);
|
||||
|
||||
// Check if a path has been selected, if it is a directory, move to that directory (and reload paths)
|
||||
if ((state->filesListActive >= 0) && (state->filesListActive != state->prevFilesListActive))
|
||||
//&& (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsKeyPressed(KEY_ENTER) || IsKeyPressed(KEY_DPAD_A)))
|
||||
{
|
||||
strcpy(state->fileNameText, GetFileName(state->dirFiles.paths[state->filesListActive]));
|
||||
|
||||
if (DirectoryExists(TextFormat("%s/%s", state->dirPathText, state->fileNameText)))
|
||||
{
|
||||
if (TextIsEqual(state->fileNameText, "..")) strcpy(state->dirPathText, GetPrevDirectoryPath(state->dirPathText));
|
||||
else strcpy(state->dirPathText, TextFormat("%s/%s", (strcmp(state->dirPathText, "/") == 0)? "" : state->dirPathText, state->fileNameText));
|
||||
|
||||
strcpy(state->dirPathTextCopy, state->dirPathText);
|
||||
|
||||
// Reload directory files (frees previous list)
|
||||
ReloadDirectoryFiles(state);
|
||||
|
||||
strcpy(state->dirPathTextCopy, state->dirPathText);
|
||||
|
||||
state->filesListActive = -1;
|
||||
strcpy(state->fileNameText, "\0");
|
||||
strcpy(state->fileNameTextCopy, state->fileNameText);
|
||||
}
|
||||
|
||||
state->prevFilesListActive = state->filesListActive;
|
||||
}
|
||||
|
||||
// Draw bottom controls
|
||||
//--------------------------------------------------------------------------------------
|
||||
GuiLabel((Rectangle){ state->windowBounds.x + 8, state->windowBounds.y + state->windowBounds.height - 68, 60, 24 }, "File name:");
|
||||
if (GuiTextBox((Rectangle){ state->windowBounds.x + 72, state->windowBounds.y + state->windowBounds.height - 68, state->windowBounds.width - 184, 24 }, state->fileNameText, 128, state->fileNameEditMode))
|
||||
{
|
||||
if (*state->fileNameText)
|
||||
{
|
||||
// Verify if a valid filename has been introduced
|
||||
if (FileExists(TextFormat("%s/%s", state->dirPathText, state->fileNameText)))
|
||||
{
|
||||
// Select filename from list view
|
||||
for (int i = 0; i < state->dirFiles.count; i++)
|
||||
{
|
||||
if (TextIsEqual(state->fileNameText, state->dirFiles.paths[i]))
|
||||
{
|
||||
state->filesListActive = i;
|
||||
strcpy(state->fileNameTextCopy, state->fileNameText);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!state->saveFileMode)
|
||||
{
|
||||
strcpy(state->fileNameText, state->fileNameTextCopy);
|
||||
}
|
||||
}
|
||||
|
||||
state->fileNameEditMode = !state->fileNameEditMode;
|
||||
}
|
||||
|
||||
GuiLabel((Rectangle){ state->windowBounds.x + 8, state->windowBounds.y + state->windowBounds.height - 24 - 12, 68, 24 }, "File filter:");
|
||||
state->fileTypeActive = GuiComboBox((Rectangle){ state->windowBounds.x + 72, state->windowBounds.y + state->windowBounds.height - 24 - 12, state->windowBounds.width - 184, 24 }, "All files", state->fileTypeActive);
|
||||
|
||||
state->SelectFilePressed = GuiButton((Rectangle){ state->windowBounds.x + state->windowBounds.width - 96 - 8, state->windowBounds.y + state->windowBounds.height - 68, 96, 24 }, "Select");
|
||||
|
||||
if (GuiButton((Rectangle){ state->windowBounds.x + state->windowBounds.width - 96 - 8, state->windowBounds.y + state->windowBounds.height - 24 - 12, 96, 24 }, "Cancel")) state->windowActive = false;
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Exit on file selected
|
||||
if (state->SelectFilePressed) state->windowActive = false;
|
||||
|
||||
// File dialog has been closed, free all memory before exit
|
||||
if (!state->windowActive)
|
||||
{
|
||||
// Free dirFilesIcon memory
|
||||
for (int i = 0; i < MAX_DIRECTORY_FILES; i++) RL_FREE(dirFilesIcon[i]);
|
||||
|
||||
RL_FREE(dirFilesIcon);
|
||||
dirFilesIcon = NULL;
|
||||
|
||||
// Unload directory file paths
|
||||
UnloadDirectoryFiles(state->dirFiles);
|
||||
|
||||
// Reset state variables
|
||||
state->dirFiles.count = 0;
|
||||
state->dirFiles.capacity = 0;
|
||||
state->dirFiles.paths = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compare two files from a directory
|
||||
static inline int FileCompare(const char *d1, const char *d2, const char *dir)
|
||||
{
|
||||
const bool b1 = DirectoryExists(TextFormat("%s/%s", dir, d1));
|
||||
const bool b2 = DirectoryExists(TextFormat("%s/%s", dir, d2));
|
||||
|
||||
if (b1 && !b2) return -1;
|
||||
if (!b1 && b2) return 1;
|
||||
|
||||
if (!FileExists(TextFormat("%s/%s", dir, d1))) return 1;
|
||||
if (!FileExists(TextFormat("%s/%s", dir, d2))) return -1;
|
||||
|
||||
return strcmp(d1, d2);
|
||||
}
|
||||
|
||||
// Read files in new path
|
||||
static void ReloadDirectoryFiles(GuiFileDialogState *state)
|
||||
{
|
||||
UnloadDirectoryFiles(state->dirFiles);
|
||||
|
||||
state->dirFiles = LoadDirectoryFilesEx(state->dirPathText, (state->filterExt[0] == '\0')? NULL : state->filterExt, false);
|
||||
state->itemFocused = 0;
|
||||
|
||||
// Reset dirFilesIcon memory
|
||||
for (int i = 0; i < MAX_DIRECTORY_FILES; i++) memset(dirFilesIcon[i], 0, MAX_ICON_PATH_LENGTH);
|
||||
|
||||
// Copy paths as icon + fileNames into dirFilesIcon
|
||||
for (int i = 0; i < state->dirFiles.count; i++)
|
||||
{
|
||||
if (IsPathFile(state->dirFiles.paths[i]))
|
||||
{
|
||||
// Path is a file, a file icon for convenience (for some recognized extensions)
|
||||
if (IsFileExtension(state->dirFiles.paths[i], ".png;.bmp;.tga;.gif;.jpg;.jpeg;.psd;.hdr;.qoi;.dds;.pkm;.ktx;.pvr;.astc"))
|
||||
{
|
||||
strcpy(dirFilesIcon[i], TextFormat("#12#%s", GetFileName(state->dirFiles.paths[i])));
|
||||
}
|
||||
else if (IsFileExtension(state->dirFiles.paths[i], ".wav;.mp3;.ogg;.flac;.xm;.mod;.it;.wma;.aiff"))
|
||||
{
|
||||
strcpy(dirFilesIcon[i], TextFormat("#11#%s", GetFileName(state->dirFiles.paths[i])));
|
||||
}
|
||||
else if (IsFileExtension(state->dirFiles.paths[i], ".txt;.info;.md;.nfo;.xml;.json;.c;.cpp;.cs;.lua;.py;.glsl;.vs;.fs"))
|
||||
{
|
||||
strcpy(dirFilesIcon[i], TextFormat("#10#%s", GetFileName(state->dirFiles.paths[i])));
|
||||
}
|
||||
else if (IsFileExtension(state->dirFiles.paths[i], ".exe;.bin;.raw;.msi"))
|
||||
{
|
||||
strcpy(dirFilesIcon[i], TextFormat("#200#%s", GetFileName(state->dirFiles.paths[i])));
|
||||
}
|
||||
else strcpy(dirFilesIcon[i], TextFormat("#218#%s", GetFileName(state->dirFiles.paths[i])));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Path is a directory, add a directory icon
|
||||
strcpy(dirFilesIcon[i], TextFormat("#1#%s", GetFileName(state->dirFiles.paths[i])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_CUSTOM_LISTVIEW_FILEINFO)
|
||||
// List View control for files info with extended parameters
|
||||
static int GuiListViewFiles(Rectangle bounds, FileInfo *files, int count, int *focus, int *scrollIndex, int active)
|
||||
{
|
||||
GuiState state = guiState;
|
||||
int itemFocused = (focus == NULL)? -1 : *focus;
|
||||
int itemSelected = active;
|
||||
|
||||
// Check if we need a scroll bar
|
||||
bool useScrollBar = false;
|
||||
if ((GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING))*count > bounds.height) useScrollBar = true;
|
||||
|
||||
// Define base item rectangle [0]
|
||||
Rectangle itemBounds = { 0 };
|
||||
itemBounds.x = bounds.x + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING);
|
||||
itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING) + GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
||||
itemBounds.width = bounds.width - 2*GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING) - GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
||||
itemBounds.height = GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
if (useScrollBar) itemBounds.width -= GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH);
|
||||
|
||||
// Get items on the list
|
||||
int visibleItems = bounds.height/(GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING));
|
||||
if (visibleItems > count) visibleItems = count;
|
||||
|
||||
int startIndex = (scrollIndex == NULL)? 0 : *scrollIndex;
|
||||
if ((startIndex < 0) || (startIndex > (count - visibleItems))) startIndex = 0;
|
||||
int endIndex = startIndex + visibleItems;
|
||||
|
||||
// Update control
|
||||
//--------------------------------------------------------------------
|
||||
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
||||
{
|
||||
Vector2 mousePoint = GetMousePosition();
|
||||
|
||||
// Check mouse inside list view
|
||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||
{
|
||||
state = GUI_STATE_FOCUSED;
|
||||
|
||||
// Check focused and selected item
|
||||
for (int i = 0; i < visibleItems; i++)
|
||||
{
|
||||
if (CheckCollisionPointRec(mousePoint, itemBounds))
|
||||
{
|
||||
itemFocused = startIndex + i;
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) itemSelected = startIndex + i;
|
||||
break;
|
||||
}
|
||||
|
||||
// Update item rectangle y position for next item
|
||||
itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING));
|
||||
}
|
||||
|
||||
if (useScrollBar)
|
||||
{
|
||||
int wheelMove = GetMouseWheelMove();
|
||||
startIndex -= wheelMove;
|
||||
|
||||
if (startIndex < 0) startIndex = 0;
|
||||
else if (startIndex > (count - visibleItems)) startIndex = count - visibleItems;
|
||||
|
||||
endIndex = startIndex + visibleItems;
|
||||
if (endIndex > count) endIndex = count;
|
||||
}
|
||||
}
|
||||
else itemFocused = -1;
|
||||
|
||||
// Reset item rectangle y to [0]
|
||||
itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING) + GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// Draw control
|
||||
//--------------------------------------------------------------------
|
||||
DrawRectangleRec(bounds, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background
|
||||
DrawRectangleLinesEx(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha));
|
||||
|
||||
// TODO: Draw list view header with file sections: icon+name | size | type | modTime
|
||||
|
||||
// Draw visible items
|
||||
for (int i = 0; i < visibleItems; i++)
|
||||
{
|
||||
if (state == GUI_STATE_DISABLED)
|
||||
{
|
||||
if ((startIndex + i) == itemSelected)
|
||||
{
|
||||
DrawRectangleRec(itemBounds, Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED)), guiAlpha));
|
||||
DrawRectangleLinesEx(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), guiAlpha));
|
||||
}
|
||||
|
||||
// TODO: Draw full file info line: icon+name | size | type | modTime
|
||||
|
||||
GuiDrawText(files[startIndex + i].name, GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((startIndex + i) == itemSelected)
|
||||
{
|
||||
// Draw item selected
|
||||
DrawRectangleRec(itemBounds, Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED)), guiAlpha));
|
||||
DrawRectangleLinesEx(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), guiAlpha));
|
||||
|
||||
GuiDrawText(files[startIndex + i].name, GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)), guiAlpha));
|
||||
}
|
||||
else if ((startIndex + i) == itemFocused)
|
||||
{
|
||||
// Draw item focused
|
||||
DrawRectangleRec(itemBounds, Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED)), guiAlpha));
|
||||
DrawRectangleLinesEx(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), guiAlpha));
|
||||
|
||||
GuiDrawText(files[startIndex + i].name, GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)), guiAlpha));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw item normal
|
||||
GuiDrawText(files[startIndex + i].name, GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha));
|
||||
}
|
||||
}
|
||||
|
||||
// Update item rectangle y position for next item
|
||||
itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING));
|
||||
}
|
||||
|
||||
if (useScrollBar)
|
||||
{
|
||||
Rectangle scrollBarBounds = {
|
||||
bounds.x + bounds.width - GuiGetStyle(LISTVIEW, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH),
|
||||
bounds.y + GuiGetStyle(LISTVIEW, BORDER_WIDTH), (float)GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH),
|
||||
bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH)
|
||||
};
|
||||
|
||||
// Calculate percentage of visible items and apply same percentage to scrollbar
|
||||
float percentVisible = (float)(endIndex - startIndex)/count;
|
||||
float sliderSize = bounds.height*percentVisible;
|
||||
|
||||
int prevSliderSize = GuiGetStyle(SCROLLBAR, SLIDER_WIDTH); // Save default slider size
|
||||
int prevScrollSpeed = GuiGetStyle(SCROLLBAR, SCROLL_SPEED); // Save default scroll speed
|
||||
GuiSetStyle(SCROLLBAR, SLIDER_WIDTH, sliderSize); // Change slider size
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_SPEED, count - visibleItems); // Change scroll speed
|
||||
|
||||
startIndex = GuiScrollBar(scrollBarBounds, startIndex, 0, count - visibleItems);
|
||||
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_SPEED, prevScrollSpeed); // Reset scroll speed to default
|
||||
GuiSetStyle(SCROLLBAR, SLIDER_WIDTH, prevSliderSize); // Reset slider size to default
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
if (focus != NULL) *focus = itemFocused;
|
||||
if (scrollIndex != NULL) *scrollIndex = startIndex;
|
||||
|
||||
return itemSelected;
|
||||
}
|
||||
#endif // USE_CUSTOM_LISTVIEW_FILEINFO
|
||||
|
||||
#endif // GUI_FILE_DIALOG_IMPLEMENTATION
|
192
examples/gui/image_exporter/image_exporter.c
Normal file
|
@ -0,0 +1,192 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - image exporter
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.0 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raygui - image exporter");
|
||||
|
||||
// GUI controls initialization
|
||||
//----------------------------------------------------------------------------------
|
||||
Rectangle windowBoxRec = { screenWidth/2 - 110, screenHeight/2 - 100, 220, 190 };
|
||||
bool windowBoxActive = false;
|
||||
|
||||
int fileFormatActive = 0;
|
||||
const char *fileFormatTextList[3] = { "IMAGE (.png)", "DATA (.raw)", "CODE (.h)" };
|
||||
|
||||
int pixelFormatActive = 0;
|
||||
const char *pixelFormatTextList[7] = { "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
|
||||
|
||||
bool textBoxEditMode = false;
|
||||
char fileName[32] = "untitled";
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
Image image = { 0 };
|
||||
Texture2D texture = { 0 };
|
||||
|
||||
bool imageLoaded = false;
|
||||
float imageScale = 1.0f;
|
||||
Rectangle imageRec = { 0 };
|
||||
|
||||
bool btnExport = false;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsFileDropped())
|
||||
{
|
||||
FilePathList droppedFiles = LoadDroppedFiles();
|
||||
|
||||
if (droppedFiles.count == 1)
|
||||
{
|
||||
Image imTemp = LoadImage(droppedFiles.paths[0]);
|
||||
|
||||
if (imTemp.data != NULL)
|
||||
{
|
||||
UnloadImage(image);
|
||||
image = imTemp;
|
||||
|
||||
UnloadTexture(texture);
|
||||
texture = LoadTextureFromImage(image);
|
||||
|
||||
imageLoaded = true;
|
||||
pixelFormatActive = image.format - 1;
|
||||
|
||||
if (texture.height > texture.width) imageScale = (float)(screenHeight - 100)/(float)texture.height;
|
||||
else imageScale = (float)(screenWidth - 100)/(float)texture.width;
|
||||
}
|
||||
}
|
||||
|
||||
UnloadDroppedFiles(droppedFiles);
|
||||
}
|
||||
|
||||
if (btnExport)
|
||||
{
|
||||
if (imageLoaded)
|
||||
{
|
||||
ImageFormat(&image, pixelFormatActive + 1);
|
||||
|
||||
if (fileFormatActive == 0) // PNG
|
||||
{
|
||||
if ((GetFileExtension(fileName) == NULL) || (!IsFileExtension(fileName, ".png"))) strcat(fileName, ".png\0"); // No extension provided
|
||||
ExportImage(image, fileName);
|
||||
}
|
||||
else if (fileFormatActive == 1) // RAW
|
||||
{
|
||||
if ((GetFileExtension(fileName) == NULL) || (!IsFileExtension(fileName, ".raw"))) strcat(fileName, ".raw\0"); // No extension provided
|
||||
|
||||
int dataSize = GetPixelDataSize(image.width, image.height, image.format);
|
||||
|
||||
FILE *rawFile = fopen(fileName, "wb");
|
||||
fwrite(image.data, dataSize, 1, rawFile);
|
||||
fclose(rawFile);
|
||||
}
|
||||
else if (fileFormatActive == 2) // CODE
|
||||
{
|
||||
ExportImageAsCode(image, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
windowBoxActive = false;
|
||||
}
|
||||
|
||||
if (imageLoaded)
|
||||
{
|
||||
imageScale += (float)GetMouseWheelMove()*0.05f; // Image scale control
|
||||
if (imageScale <= 0.1f) imageScale = 0.1f;
|
||||
else if (imageScale >= 5) imageScale = 5;
|
||||
|
||||
imageRec = (Rectangle){ screenWidth/2 - (float)image.width*imageScale/2,
|
||||
screenHeight/2 - (float)image.height*imageScale/2,
|
||||
(float)image.width*imageScale, (float)image.height*imageScale };
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
if (texture.id > 0)
|
||||
{
|
||||
DrawTextureEx(texture, (Vector2){ screenWidth/2 - (float)texture.width*imageScale/2, screenHeight/2 - (float)texture.height*imageScale/2 }, 0.0f, imageScale, WHITE);
|
||||
|
||||
DrawRectangleLinesEx(imageRec, 1, CheckCollisionPointRec(GetMousePosition(), imageRec) ? RED : DARKGRAY);
|
||||
DrawText(TextFormat("SCALE: %.2f%%", imageScale*100.0f), 20, screenHeight - 40, 20, GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)));
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("DRAG & DROP YOUR IMAGE!", 350, 200, 10, DARKGRAY);
|
||||
GuiDisable();
|
||||
}
|
||||
|
||||
if (GuiButton((Rectangle){ screenWidth - 170, screenHeight - 50, 150, 30 }, "Image Export")) windowBoxActive = true;
|
||||
GuiEnable();
|
||||
|
||||
// Draw window box: windowBoxName
|
||||
//-----------------------------------------------------------------------------
|
||||
if (windowBoxActive)
|
||||
{
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)), 0.7f));
|
||||
windowBoxActive = !GuiWindowBox((Rectangle){ windowBoxRec.x, windowBoxRec.y, 220, 190 }, "Image Export Options");
|
||||
|
||||
GuiLabel((Rectangle){ windowBoxRec.x + 10, windowBoxRec.y + 35, 60, 25 }, "File format:");
|
||||
fileFormatActive = GuiComboBox((Rectangle){ windowBoxRec.x + 80, windowBoxRec.y + 35, 130, 25 }, TextJoin(fileFormatTextList, 3, ";"), fileFormatActive);
|
||||
GuiLabel((Rectangle){ windowBoxRec.x + 10, windowBoxRec.y + 70, 63, 25 }, "Pixel format:");
|
||||
pixelFormatActive = GuiComboBox((Rectangle){ windowBoxRec.x + 80, windowBoxRec.y + 70, 130, 25 }, TextJoin(pixelFormatTextList, 7, ";"), pixelFormatActive);
|
||||
GuiLabel((Rectangle){ windowBoxRec.x + 10, windowBoxRec.y + 105, 50, 25 }, "File name:");
|
||||
if (GuiTextBox((Rectangle){ windowBoxRec.x + 80, windowBoxRec.y + 105, 130, 25 }, fileName, 64, textBoxEditMode)) textBoxEditMode = !textBoxEditMode;
|
||||
|
||||
btnExport = GuiButton((Rectangle){ windowBoxRec.x + 10, windowBoxRec.y + 145, 200, 30 }, "Export Image");
|
||||
}
|
||||
else btnExport = false;
|
||||
|
||||
if (btnExport) DrawText("Image exported!", 20, screenHeight - 20, 20, RED);
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadImage(image);
|
||||
UnloadTexture(texture);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/gui/image_exporter/resources/cat.png
Normal file
After Width: | Height: | Size: 379 KiB |
BIN
examples/gui/image_exporter/resources/fudesumi.png
Normal file
After Width: | Height: | Size: 218 KiB |
BIN
examples/gui/image_exporter/resources/parrots.png
Normal file
After Width: | Height: | Size: 288 KiB |
BIN
examples/gui/image_exporter/resources/scarfy.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
examples/gui/image_importer_raw/design/raw_importer_REF.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
examples/gui/image_importer_raw/design/raw_importer_REV0.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
examples/gui/image_importer_raw/design/raw_importer_REV1.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
examples/gui/image_importer_raw/design/raw_importer_REV2.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
examples/gui/image_importer_raw/design/raw_importer_REV3.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
examples/gui/image_importer_raw/design/raw_importer_REV4.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
examples/gui/image_importer_raw/design/raw_importer_REV5.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
examples/gui/image_importer_raw/image_2x2_RGBA.raw
Normal file
228
examples/gui/image_importer_raw/image_importer_raw.c
Normal file
|
@ -0,0 +1,228 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - image raw importer
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.0 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
#include <string.h> // Required for: strcpy()
|
||||
#include <stdlib.h> // Required for: atoi()
|
||||
#include <math.h> // Required for: round()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 600;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raygui - image raw importer");
|
||||
|
||||
Texture2D texture = { 0 };
|
||||
|
||||
// GUI controls initialization
|
||||
//----------------------------------------------------------------------------------
|
||||
Vector2 windowOffset = { screenWidth/2 - 200/2, screenHeight/2 - 465/2 };
|
||||
|
||||
bool importWindowActive = false;
|
||||
|
||||
int widthValue = 0;
|
||||
bool widthEditMode = false;
|
||||
int heightValue = 0;
|
||||
bool heightEditMode = false;
|
||||
|
||||
int pixelFormatActive = 0;
|
||||
const char *pixelFormatTextList[8] = { "CUSTOM", "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
|
||||
|
||||
int channelsActive = 3;
|
||||
const char *channelsTextList[4] = { "1", "2", "3", "4" };
|
||||
int bitDepthActive = 0;
|
||||
const char *bitDepthTextList[3] = { "8", "16", "32" };
|
||||
|
||||
int headerSizeValue = 0;
|
||||
bool headerSizeEditMode = false;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Image file info
|
||||
int dataSize = 0;
|
||||
char fileNamePath[256] = "\0";
|
||||
char fileName[64] = "\0";
|
||||
|
||||
bool btnLoadPressed = false;
|
||||
|
||||
bool imageLoaded = false;
|
||||
float imageScale = 1.0f;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// Check if a file is dropped
|
||||
if (IsFileDropped())
|
||||
{
|
||||
FilePathList droppedFiles = LoadDroppedFiles();
|
||||
|
||||
// Check file extensions for drag-and-drop
|
||||
if ((droppedFiles.count == 1) && IsFileExtension(droppedFiles.paths[0], ".raw"))
|
||||
{
|
||||
FILE *imageFile = fopen(droppedFiles.paths[0], "rb");
|
||||
fseek(imageFile, 0L, SEEK_END);
|
||||
dataSize = ftell(imageFile);
|
||||
fclose(imageFile);
|
||||
|
||||
// NOTE: Returned string is just a pointer to droppedFiles[0],
|
||||
// we need to make a copy of that data somewhere else: fileName
|
||||
strcpy(fileNamePath, droppedFiles.paths[0]);
|
||||
strcpy(fileName, GetFileName(droppedFiles.paths[0]));
|
||||
|
||||
// Try to guess possible raw values
|
||||
// Let's assume image is square, RGBA, 8 bit per channel
|
||||
widthValue = round(sqrt(dataSize/4));
|
||||
heightValue = widthValue;
|
||||
headerSizeValue = dataSize - widthValue*heightValue*4;
|
||||
if (headerSizeValue < 0) headerSizeValue = 0;
|
||||
|
||||
importWindowActive = true;
|
||||
}
|
||||
|
||||
UnloadDroppedFiles(droppedFiles);
|
||||
}
|
||||
|
||||
// Check if load button has been pressed
|
||||
if (btnLoadPressed)
|
||||
{
|
||||
// Depending on channels and bit depth, select correct pixel format
|
||||
if ((widthValue != 0) && (heightValue != 0))
|
||||
{
|
||||
int format = -1;
|
||||
|
||||
if (pixelFormatActive == 0)
|
||||
{
|
||||
int channels = atoi(channelsTextList[channelsActive]);
|
||||
int bpp = atoi(bitDepthTextList[bitDepthActive]);
|
||||
|
||||
// Select correct format depending on channels and bpp
|
||||
if (bpp == 8)
|
||||
{
|
||||
if (channels == 1) format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE;
|
||||
else if (channels == 2) format = PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA;
|
||||
else if (channels == 3) format = PIXELFORMAT_UNCOMPRESSED_R8G8B8;
|
||||
else if (channels == 4) format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
||||
}
|
||||
else if (bpp == 32)
|
||||
{
|
||||
if (channels == 1) format = PIXELFORMAT_UNCOMPRESSED_R32;
|
||||
else if (channels == 2) TraceLog(LOG_WARNING, "Channel bit-depth not supported!");
|
||||
else if (channels == 3) format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
|
||||
else if (channels == 4) format = PIXELFORMAT_UNCOMPRESSED_R32G32B32A32;
|
||||
}
|
||||
else if (bpp == 16) TraceLog(LOG_WARNING, "Channel bit-depth not supported!");
|
||||
}
|
||||
else format = pixelFormatActive;
|
||||
|
||||
if (format != -1)
|
||||
{
|
||||
Image image = LoadImageRaw(fileNamePath, widthValue, heightValue, format, headerSizeValue);
|
||||
texture = LoadTextureFromImage(image);
|
||||
UnloadImage(image);
|
||||
|
||||
importWindowActive = false;
|
||||
btnLoadPressed = false;
|
||||
|
||||
if (texture.id > 0)
|
||||
{
|
||||
imageLoaded = true;
|
||||
imageScale = (float)(screenHeight - 100)/texture.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imageLoaded) imageScale += (float)GetMouseWheelMove(); // Image scale control
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
|
||||
if (texture.id != 0)
|
||||
{
|
||||
DrawTextureEx(texture, (Vector2){ screenWidth/2 - texture.width*imageScale/2, screenHeight/2 - texture.height*imageScale/2 }, 0, imageScale, WHITE);
|
||||
DrawText(TextFormat("SCALE x%.0f", imageScale), 20, screenHeight - 40, 20, GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)));
|
||||
}
|
||||
else DrawText("drag & drop RAW image file", 320, 180, 10, GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)));
|
||||
|
||||
// raygui: controls drawing
|
||||
//----------------------------------------------------------------------------------
|
||||
if (importWindowActive)
|
||||
{
|
||||
importWindowActive = !GuiWindowBox((Rectangle){ windowOffset.x + 0, windowOffset.y + 0, 200, 465 }, "Image RAW Import Options");
|
||||
|
||||
GuiLabel((Rectangle){ windowOffset.x + 10, windowOffset.y + 30, 65, 20 }, "Import file:");
|
||||
GuiLabel((Rectangle){ windowOffset.x + 85, windowOffset.y + 30, 75, 20 }, fileName);
|
||||
GuiLabel((Rectangle){ windowOffset.x + 10, windowOffset.y + 50, 65, 20 }, "File size:");
|
||||
GuiLabel((Rectangle){ windowOffset.x + 85, windowOffset.y + 50, 75, 20 }, TextFormat("%i bytes", dataSize));
|
||||
GuiGroupBox((Rectangle){ windowOffset.x + 10, windowOffset.y + 85, 180, 80 }, "Resolution");
|
||||
GuiLabel((Rectangle){ windowOffset.x + 20, windowOffset.y + 100, 33, 25 }, "Width:");
|
||||
if (GuiValueBox((Rectangle){ windowOffset.x + 60, windowOffset.y + 100, 80, 25 }, NULL, &widthValue, 0, 8192, widthEditMode)) widthEditMode = !widthEditMode;
|
||||
GuiLabel((Rectangle){ windowOffset.x + 145, windowOffset.y + 100, 30, 25 }, "pixels");
|
||||
GuiLabel((Rectangle){ windowOffset.x + 20, windowOffset.y + 130, 33, 25 }, "Height:");
|
||||
if (GuiValueBox((Rectangle){ windowOffset.x + 60, windowOffset.y + 130, 80, 25 }, NULL, &heightValue, 0, 8192, heightEditMode)) heightEditMode = !heightEditMode;
|
||||
GuiLabel((Rectangle){ windowOffset.x + 145, windowOffset.y + 130, 30, 25 }, "pixels");
|
||||
GuiGroupBox((Rectangle){ windowOffset.x + 10, windowOffset.y + 180, 180, 160 }, "Pixel Format");
|
||||
pixelFormatActive = GuiComboBox((Rectangle){ windowOffset.x + 20, windowOffset.y + 195, 160, 25 }, TextJoin(pixelFormatTextList, 8, ";"), pixelFormatActive);
|
||||
GuiLine((Rectangle){ windowOffset.x + 20, windowOffset.y + 220, 160, 20 }, NULL);
|
||||
|
||||
if (pixelFormatActive != 0) GuiDisable();
|
||||
GuiLabel((Rectangle){ windowOffset.x + 20, windowOffset.y + 235, 50, 20 }, "Channels:");
|
||||
channelsActive = GuiToggleGroup((Rectangle){ windowOffset.x + 20, windowOffset.y + 255, 156/4, 25 }, TextJoin(channelsTextList, 4, ";"), channelsActive);
|
||||
GuiLabel((Rectangle){ windowOffset.x + 20, windowOffset.y + 285, 50, 20 }, "Bit Depth:");
|
||||
bitDepthActive = GuiToggleGroup((Rectangle){ windowOffset.x + 20, windowOffset.y + 305, 160/3, 25 }, TextJoin(bitDepthTextList, 3, ";"), bitDepthActive);
|
||||
GuiEnable();
|
||||
|
||||
GuiGroupBox((Rectangle){ windowOffset.x + 10, windowOffset.y + 355, 180, 50 }, "Header");
|
||||
GuiLabel((Rectangle){ windowOffset.x + 25, windowOffset.y + 370, 27, 25 }, "Size:");
|
||||
if (GuiValueBox((Rectangle){ windowOffset.x + 55, windowOffset.y + 370, 85, 25 }, NULL, &headerSizeValue, 0, 10000, headerSizeEditMode)) headerSizeEditMode = !headerSizeEditMode;
|
||||
GuiLabel((Rectangle){ windowOffset.x + 145, windowOffset.y + 370, 30, 25 }, "bytes");
|
||||
|
||||
btnLoadPressed = GuiButton((Rectangle){ windowOffset.x + 10, windowOffset.y + 420, 180, 30 }, "Import RAW");
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
if (texture.id != 0) UnloadTexture(texture);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
96
examples/gui/portable_window/portable_window.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - portable window
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.0 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 600;
|
||||
|
||||
SetConfigFlags(FLAG_WINDOW_UNDECORATED);
|
||||
InitWindow(screenWidth, screenHeight, "raygui - portable window");
|
||||
|
||||
// General variables
|
||||
Vector2 mousePosition = { 0 };
|
||||
Vector2 windowPosition = { 500, 200 };
|
||||
Vector2 panOffset = mousePosition;
|
||||
bool dragWindow = false;
|
||||
|
||||
SetWindowPosition(windowPosition.x, windowPosition.y);
|
||||
|
||||
bool exitWindow = false;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!exitWindow && !WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
mousePosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
if (CheckCollisionPointRec(mousePosition, (Rectangle){ 0, 0, screenWidth, 20 }))
|
||||
{
|
||||
dragWindow = true;
|
||||
panOffset = mousePosition;
|
||||
}
|
||||
}
|
||||
|
||||
if (dragWindow)
|
||||
{
|
||||
windowPosition.x += (mousePosition.x - panOffset.x);
|
||||
windowPosition.y += (mousePosition.y - panOffset.y);
|
||||
|
||||
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) dragWindow = false;
|
||||
|
||||
SetWindowPosition(windowPosition.x, windowPosition.y);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
exitWindow = GuiWindowBox((Rectangle){ 0, 0, screenWidth, screenHeight }, "#198# PORTABLE WINDOW");
|
||||
|
||||
DrawText(TextFormat("Mouse Position: [ %.0f, %.0f ]", mousePosition.x, mousePosition.y), 10, 40, 10, DARKGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
867
examples/gui/property_list/dm_property_list.h
Normal file
|
@ -0,0 +1,867 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* PropertyListControl v1.0.1 - A custom control that displays a set of properties as a list
|
||||
*
|
||||
* UPDATES: last updated - 10 march 2020 (v1.0.1)
|
||||
* v1.0.1 - Made it work with latest raygui version
|
||||
* - Added `GuiDMSaveProperties()` for saving properties to a text file
|
||||
* - A `GuiDMLoadProperties()` is planed but not implemented yet
|
||||
* - Added a section property that can work as a way to group multiple properties
|
||||
* - Fixed issue with section not having the correct height
|
||||
* v1.0.0 - Initial release
|
||||
*
|
||||
*
|
||||
* MODULE USAGE:
|
||||
* #define GUI_PROPERTY_LIST_IMPLEMENTATION
|
||||
* #include "dm_property_list.h"
|
||||
*
|
||||
* INIT: GuiDMProperty props[] = { // initialize a set of properties first
|
||||
PCOLOR(),
|
||||
PINT(),
|
||||
PFLOAT(),
|
||||
...
|
||||
};
|
||||
* DRAW: GuiDMPropertyList(bounds, props, sizeof(props)/sizeof(props[0]), ...);
|
||||
*
|
||||
*
|
||||
* NOTE: This module also contains 2 extra controls used internally by the property list
|
||||
* - GuiDMValueBox() - a value box that supports displaying float values
|
||||
* - GuiDMSpinner() - a `better` GuiSpinner()
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2020 Vlad Adrian (@Demizdor - https://github.com/Demizdor).
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
// WARNING: raygui implementation is expected to be defined before including this header
|
||||
#undef RAYGUI_IMPLEMENTATION
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
|
||||
#ifndef GUI_PROPERTY_LIST_H
|
||||
#define GUI_PROPERTY_LIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { // Prevents name mangling of functions
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// A bunch of usefull macros for modifying the flags of each property
|
||||
|
||||
// Set flag `F` of property `P`. `P` must be a pointer!
|
||||
#define PROP_SET_FLAG(P, F) ((P)->flags |= (F))
|
||||
// Clear flag `F` of property `P`. `P` must be a pointer!
|
||||
#define PROP_CLEAR_FLAG(P, F) ((P)->flags &= ~(F))
|
||||
// Toggles flag `F` of property `P`. `P` must be a pointer!
|
||||
#define PROP_TOGGLE_FLAG(P, F) ((P)->flags ^= (F))
|
||||
// Checks if flag `F` of property `P` is set . `P` must be a pointer!
|
||||
#define PROP_CHECK_FLAG(P, F) ((P)->flags & (F))
|
||||
|
||||
// Some usefull macros for creating properties
|
||||
|
||||
// Create a bool property with name `N`, flags `F` and value `V`
|
||||
#define PBOOL(N, F, V) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_BOOL, F, .value.vbool = V}
|
||||
// Create a int property with name `N`, flags `F` and value `V`
|
||||
#define PINT(N, F, V) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_INT, F, .value.vint = {V,0,0,1}}
|
||||
// Create a ranged int property within `MIN` and `MAX` with name `N`, flags `F` value `V`.
|
||||
// Pressing the spinner buttons will increase/decrease the value by `S`.
|
||||
#define PINT_RANGE(N, F, V, S, MIN, MAX) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_INT, F, .value.vint = {V,MIN,MAX,S}}
|
||||
// Create a float property with name `N`, flags `F` and value `V`
|
||||
#define PFLOAT(N, F, V) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_FLOAT, F, .value.vfloat = {V,0.f,0.f,1.0f,3}}
|
||||
// Create a ranged float property within `MIN` and `MAX` with name `N`, flags `F` value `V` with `P` decimal digits to show.
|
||||
// Pressing the spinner buttons will increase/decrease the value by `S`.
|
||||
#define PFLOAT_RANGE(N, F, V, S, P, MIN, MAX) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_FLOAT, F, .value.vfloat = {V,MIN,MAX,S,P}}
|
||||
// Create a text property with name `N`, flags `F` value `V` and max text size `S`
|
||||
#define PTEXT(N, F, V, S) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_TEXT, F, .value.vtext = {V, S} }
|
||||
// Create a text property with name `N`, flags `F` value `V` and max text size `S`
|
||||
#define PSELECT(N, F, V, A) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_SELECT, F, .value.vselect = {V, A} }
|
||||
// Create a 2D vector property with name `N`, flags `F` and the `X`, `Y` coordinates
|
||||
#define PVEC2(N, F, X, Y) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_VECTOR2, F, .value.v2 = {X, Y} }
|
||||
// Create a 3D vector property with name `N`, flags `F` and the `X`, `Y`, `Z` coordinates
|
||||
#define PVEC3(N, F, X, Y, Z) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_VECTOR3, F, .value.v3 = {X, Y, Z} }
|
||||
// Create a 4D vector property with name `N`, flags `F` and the `X`, `Y`, `Z`, `W` coordinates
|
||||
#define PVEC4(N, F, X, Y, Z, W) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_VECTOR4, F, .value.v4 = {X, Y, Z, W} }
|
||||
// Create a rectangle property with name `N`, flags `F`, `X`, `Y` coordinates and `W` and `H` size
|
||||
#define PRECT(N, F, X, Y, W, H) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_RECT, F, .value.vrect = {X, Y, W, H} }
|
||||
// Create a 3D vector property with name `N`, flags `F` and the `R`, `G`, `B`, `A` channel values
|
||||
#define PCOLOR(N, F, R, G, B, A) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_COLOR, F, .value.vcolor = {R, G, B, A} }
|
||||
// Create a collapsable section named `N` with `F` flags and the next `C` properties as children.
|
||||
// !! A section cannot hold another section as a child !!
|
||||
#define PSECTION(N, F, C) RAYGUI_CLITERAL(GuiDMProperty){N, GUI_PROP_SECTION, F, .value.vsection = (C)}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
enum GuiDMPropertyTypes {
|
||||
GUI_PROP_BOOL = 0,
|
||||
GUI_PROP_INT,
|
||||
GUI_PROP_FLOAT,
|
||||
GUI_PROP_TEXT,
|
||||
GUI_PROP_SELECT,
|
||||
GUI_PROP_VECTOR2,
|
||||
GUI_PROP_VECTOR3,
|
||||
GUI_PROP_VECTOR4,
|
||||
GUI_PROP_RECT,
|
||||
GUI_PROP_COLOR,
|
||||
GUI_PROP_SECTION,
|
||||
};
|
||||
|
||||
enum GuiDMPropertyFlags {
|
||||
GUI_PFLAG_COLLAPSED = 1 << 0, // is the property expanded or collapsed?
|
||||
GUI_PFLAG_DISABLED = 1 << 1, // is this property disabled or enabled?
|
||||
};
|
||||
|
||||
// Data structure for each property
|
||||
typedef struct {
|
||||
char* name;
|
||||
short type;
|
||||
short flags;
|
||||
union {
|
||||
bool vbool;
|
||||
struct { int val; int min; int max; int step; } vint;
|
||||
struct { float val; float min; float max; float step; int precision; } vfloat;
|
||||
struct { char* val; int size; } vtext;
|
||||
struct { char* val; int active; } vselect;
|
||||
int vsection;
|
||||
Vector2 v2;
|
||||
Vector3 v3;
|
||||
Vector4 v4;
|
||||
Rectangle vrect;
|
||||
Color vcolor;
|
||||
} value;
|
||||
} GuiDMProperty;
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
//...
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// A more advanced `GuiValueBox()` supporting float/int values with specified `precision`, cursor movements, cut/copy/paste and
|
||||
// other keybord shortcuts. Needed by `GuiDMSpinner()` !!
|
||||
// `precision` should be between 1-7 for float values and 0 for int values (maybe 15 for doubles but that was not tested)
|
||||
// WARNING: The bounds should be set big enough else the text will overflow and things will break
|
||||
// WARNING: Sometimes the last decimal value could differ, this is probably due to rounding
|
||||
double GuiDMValueBox(Rectangle bounds, double value, double minValue, double maxValue, int precision, bool editMode);
|
||||
|
||||
// A more advanced `GuiSpinner()` using `GuiDMValueBox()` for displaying the values.
|
||||
// This was needed because `GuiSpinner()` can't display float values and editing values is somewhat hard.
|
||||
// This is by no means perfect but should be more user friendly than the default control provided by raygui.
|
||||
double GuiDMSpinner(Rectangle bounds, double value, double minValue, double maxValue, double step, int precision, bool editMode);
|
||||
|
||||
// Works just like `GuiListViewEx()` but with an array of properties instead of text.
|
||||
void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* focus, int* scrollIndex);
|
||||
|
||||
// Handy function to save properties to a file. Returns false on failure or true otherwise.
|
||||
bool GuiDMSaveProperties(const char* file, GuiDMProperty* props, int count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GUI_PROPERTY_LIST_H
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* GUI_PROPERTY_LIST_IMPLEMENTATION
|
||||
*
|
||||
************************************************************************************/
|
||||
#if defined(GUI_PROPERTY_LIST_IMPLEMENTATION)
|
||||
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
#include <stdlib.h> // for calloc()
|
||||
#include <string.h> // for memmove(), strlen()
|
||||
#include <stdio.h> // for sscanf(), snprintf()
|
||||
|
||||
#ifndef __cplusplus
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
#include <stdbool.h> // for bool if >= C99
|
||||
#endif
|
||||
#endif
|
||||
|
||||
double GuiDMValueBox(Rectangle bounds, double value, double minValue, double maxValue, int precision, bool editMode) {
|
||||
// FIXME: Hope all those `memmove()` functions are correctly used so we won't leak memory or overflow the buffer !!!
|
||||
static int framesCounter = 0; // Required for blinking cursor
|
||||
static int cursor = 0; // Required for tracking the cursor position (only for a single active valuebox)
|
||||
|
||||
enum {cursorTimer = 6, maxChars = 31, textPadding = 2};
|
||||
|
||||
GuiState state = GuiGetState();
|
||||
|
||||
// Make sure value is in range
|
||||
if(maxValue != minValue){
|
||||
if(value < minValue) value = minValue;
|
||||
if(value > maxValue) value = maxValue;
|
||||
}
|
||||
|
||||
char textValue[maxChars + 1] = "\0";
|
||||
snprintf(textValue, maxChars, "%.*f", precision, value); // NOTE: use `snprintf` here so we don't overflow the buffer
|
||||
int len = strlen(textValue);
|
||||
|
||||
bool valueHasChanged = false;
|
||||
|
||||
// Update control
|
||||
//--------------------------------------------------------------------
|
||||
if ((state != STATE_DISABLED) && !guiLocked)
|
||||
{
|
||||
if (editMode)
|
||||
{
|
||||
// Make sure cursor position is correct
|
||||
if(cursor > len) cursor = len;
|
||||
if(cursor < 0) cursor = 0;
|
||||
|
||||
state = STATE_PRESSED;
|
||||
framesCounter++;
|
||||
|
||||
if(IsKeyPressed(KEY_RIGHT) || (IsKeyDown(KEY_RIGHT) && (framesCounter%cursorTimer == 0))) {
|
||||
// MOVE CURSOR TO RIGHT
|
||||
++cursor;
|
||||
framesCounter = 0;
|
||||
} else if(IsKeyPressed(KEY_LEFT) || (IsKeyDown(KEY_LEFT) && (framesCounter%cursorTimer == 0))) {
|
||||
// MOVE CURSOR TO LEFT
|
||||
--cursor;
|
||||
framesCounter = 0;
|
||||
} else if (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && (framesCounter%cursorTimer) == 0)) {
|
||||
// HANDLE BACKSPACE
|
||||
if(cursor > 0) {
|
||||
if(textValue[cursor-1] != '.') {
|
||||
if(cursor < len )
|
||||
memmove(&textValue[cursor-1], &textValue[cursor], len-cursor);
|
||||
textValue[len - 1] = '\0';
|
||||
valueHasChanged = true;
|
||||
}
|
||||
--cursor;
|
||||
}
|
||||
framesCounter = 0;
|
||||
} else if (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && (framesCounter%cursorTimer) == 0)) {
|
||||
// HANDLE DEL
|
||||
if(len > 0 && cursor < len && textValue[cursor] != '.') {
|
||||
memmove(&textValue[cursor], &textValue[cursor+1], len-cursor);
|
||||
textValue[len] = '\0';
|
||||
len -= 1;
|
||||
valueHasChanged = true;
|
||||
}
|
||||
} else if (IsKeyPressed(KEY_HOME)) {
|
||||
// MOVE CURSOR TO START
|
||||
cursor = 0;
|
||||
} else if (IsKeyPressed(KEY_END)) {
|
||||
// MOVE CURSOR TO END
|
||||
cursor = len;
|
||||
} else if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_C)) {
|
||||
// COPY
|
||||
SetClipboardText(textValue);
|
||||
} else if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_X)) {
|
||||
// CUT
|
||||
SetClipboardText(textValue);
|
||||
textValue[0] = '\0';
|
||||
cursor = len = 0;
|
||||
value = 0.0; // set it to 0 and pretend the value didn't change
|
||||
} else if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_V)) {
|
||||
// PASTE
|
||||
const char* clip = GetClipboardText();
|
||||
int clipLen = strlen(clip);
|
||||
clipLen = clipLen > maxChars ? maxChars : clipLen;
|
||||
memcpy(textValue, clip, clipLen);
|
||||
len = clipLen;
|
||||
textValue[len] = '\0';
|
||||
valueHasChanged = true;
|
||||
}
|
||||
else {
|
||||
// HANDLE KEY PRESS
|
||||
int key = GetKeyPressed();
|
||||
if( ((len < maxChars) && (key >= 48) && (key <= 57)) || (key == 46) || (key == 45) ) // only allow 0..9, minus(-) and dot(.)
|
||||
{
|
||||
if(precision != 0 && cursor < len) { // when we have decimals we can't insert at the end
|
||||
memmove(&textValue[cursor], &textValue[cursor-1], len+1-cursor);
|
||||
textValue[len+1] = '\0';
|
||||
textValue[cursor] = (char)key;
|
||||
cursor++;
|
||||
valueHasChanged = true;
|
||||
}
|
||||
else if(precision == 0) {
|
||||
if(cursor < len) memmove(&textValue[cursor], &textValue[cursor-1], len+1-cursor);
|
||||
len += 1;
|
||||
textValue[len+1] = '\0';
|
||||
textValue[cursor] = (char)key;
|
||||
cursor++;
|
||||
valueHasChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure cursor position is correct
|
||||
if(cursor > len) cursor = len;
|
||||
if(cursor < 0) cursor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CheckCollisionPointRec(GetMousePosition(), bounds))
|
||||
{
|
||||
state = STATE_FOCUSED;
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) framesCounter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// Draw control
|
||||
//--------------------------------------------------------------------
|
||||
DrawRectangleLinesEx(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), guiAlpha));
|
||||
|
||||
Rectangle textBounds = {bounds.x + GuiGetStyle(VALUEBOX, BORDER_WIDTH) + textPadding, bounds.y + GuiGetStyle(VALUEBOX, BORDER_WIDTH),
|
||||
bounds.width - 2*(GuiGetStyle(VALUEBOX, BORDER_WIDTH) + textPadding), bounds.height - 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH)};
|
||||
|
||||
int textWidth = GetTextWidth(textValue);
|
||||
if(textWidth > textBounds.width) textBounds.width = textWidth;
|
||||
|
||||
if (state == STATE_PRESSED)
|
||||
{
|
||||
DrawRectangle(bounds.x + GuiGetStyle(VALUEBOX, BORDER_WIDTH), bounds.y + GuiGetStyle(VALUEBOX, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), bounds.height - 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED)), guiAlpha));
|
||||
|
||||
// Draw blinking cursor
|
||||
// NOTE: ValueBox internal text is always centered
|
||||
if (editMode && ((framesCounter/20)%2 == 0)) {
|
||||
// Measure text until the cursor
|
||||
int textWidthCursor = -2;
|
||||
if(cursor > 0) {
|
||||
char c = textValue[cursor];
|
||||
textValue[cursor] = '\0';
|
||||
textWidthCursor = GetTextWidth(textValue);
|
||||
textValue[cursor] = c;
|
||||
}
|
||||
//DrawRectangle(bounds.x + textWidthCursor + textPadding + 2, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 1, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
||||
DrawRectangle(bounds.x + textWidthCursor + (int)((bounds.width - textWidth - textPadding)/2.0f) + 2, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 1, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
||||
}
|
||||
}
|
||||
else if (state == STATE_DISABLED)
|
||||
{
|
||||
DrawRectangle(bounds.x + GuiGetStyle(VALUEBOX, BORDER_WIDTH), bounds.y + GuiGetStyle(VALUEBOX, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), bounds.height - 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED)), guiAlpha));
|
||||
}
|
||||
|
||||
GuiDrawText(textValue, textBounds, TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3))), guiAlpha));
|
||||
|
||||
value = valueHasChanged ? strtod(textValue, NULL) : value;
|
||||
|
||||
// Make sure value is in range
|
||||
if(maxValue != minValue){
|
||||
if(value < minValue) value = minValue;
|
||||
if(value > maxValue) value = maxValue;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double GuiDMSpinner(Rectangle bounds, double value, double minValue, double maxValue, double step, int precision, bool editMode) {
|
||||
GuiState state = GuiGetState();
|
||||
|
||||
Rectangle spinner = { bounds.x + GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING), bounds.y,
|
||||
bounds.width - 2*(GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING)), bounds.height };
|
||||
Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
||||
Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
||||
|
||||
// Update control
|
||||
//--------------------------------------------------------------------
|
||||
if ((state != STATE_DISABLED) && !guiLocked)
|
||||
{
|
||||
Vector2 mousePoint = GetMousePosition();
|
||||
|
||||
// Check spinner state
|
||||
if (CheckCollisionPointRec(mousePoint, bounds))
|
||||
{
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED;
|
||||
else state = STATE_FOCUSED;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw control
|
||||
//--------------------------------------------------------------------
|
||||
// Draw value selector custom buttons
|
||||
// NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values
|
||||
int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
|
||||
int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
||||
GuiSetStyle(BUTTON, BORDER_WIDTH, GuiGetStyle(SPINNER, BORDER_WIDTH));
|
||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
|
||||
#if defined(RAYGUI_SUPPORT_RICONS)
|
||||
if (GuiButton(leftButtonBound, GuiIconText(RICON_ARROW_LEFT_FILL, NULL))) value -= step;
|
||||
if (GuiButton(rightButtonBound, GuiIconText(RICON_ARROW_RIGHT_FILL, NULL))) value += step;
|
||||
#else
|
||||
if (GuiButton(leftButtonBound, "<")) value -= step;
|
||||
if (GuiButton(rightButtonBound, ">")) value += step;
|
||||
#endif
|
||||
|
||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign);
|
||||
GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth);
|
||||
|
||||
value = GuiDMValueBox(spinner, value, minValue, maxValue, precision, editMode);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* focus, int* scrollIndex) {
|
||||
#ifdef RAYGUI_SUPPORT_RICONS
|
||||
#define PROPERTY_COLLAPSED_ICON "#120#"
|
||||
#define PROPERTY_EXPANDED_ICON "#121#"
|
||||
#else
|
||||
#define PROPERTY_COLLAPSED_ICON "+"
|
||||
#define PROPERTY_EXPANDED_ICON "-"
|
||||
#endif
|
||||
|
||||
#define PROPERTY_PADDING 6
|
||||
#define PROPERTY_ICON_SIZE 16
|
||||
#define PROPERTY_DECIMAL_DIGITS 3 //how many digits to show (used only for the vector properties)
|
||||
|
||||
// NOTE: Using ListView style for everything !!
|
||||
GuiState state = GuiGetState();
|
||||
int propFocused = (focus == NULL)? -1 : *focus;
|
||||
int scroll = *scrollIndex > 0 ? 0 : *scrollIndex; // NOTE: scroll should always be negative or 0
|
||||
|
||||
// Each property occupies a certain number of slots, highly synchronized with the properties enum (GUI_PROP_BOOL ... GUI_PROP_SECTION)
|
||||
// NOTE: If you add a custom property type make sure to add the number of slots it occupies here !!
|
||||
const int propSlots[] = {1,1,1,2,1,3,4,5,5,5,1};
|
||||
|
||||
Rectangle absoluteBounds = {0}; // total bounds for all of the properties (unclipped)
|
||||
// We need to loop over all the properties to get total height so we can see if we need a scrollbar or not
|
||||
for(int p=0; p<count; ++p) {
|
||||
// Calculate height of this property (properties can occupy 1 or more slots)
|
||||
int height = GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
if(props[p].type < (sizeof(propSlots)/sizeof(propSlots[0]))) {
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) height = propSlots[props[p].type]*GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
if(props[p].type == GUI_PROP_SECTION && (PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED))) p += props[p].value.vsection; // skip slots for collapsed section
|
||||
}
|
||||
absoluteBounds.height += height+1;
|
||||
}
|
||||
|
||||
// Check if we need a scrollbar and adjust bounds when necesary
|
||||
bool useScrollBar = absoluteBounds.height > bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) ? true : false;
|
||||
if(!useScrollBar && scroll != 0) scroll = 0; // make sure scroll is 0 when there's no scrollbar
|
||||
|
||||
Rectangle scrollBarBounds = {bounds.x + GuiGetStyle(LISTVIEW, BORDER_WIDTH), bounds.y + GuiGetStyle(LISTVIEW, BORDER_WIDTH),
|
||||
GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH), bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH)};
|
||||
|
||||
absoluteBounds.x = bounds.x + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
||||
absoluteBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH) + scroll;
|
||||
absoluteBounds.width = bounds.width - 2*(GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH));
|
||||
|
||||
if(useScrollBar) {
|
||||
if(GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)
|
||||
absoluteBounds.x += GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH); // scrollbar is on the LEFT, adjust bounds
|
||||
else
|
||||
scrollBarBounds.x = bounds.x + bounds.width - GuiGetStyle(LISTVIEW, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH); // scrollbar is on the RIGHT
|
||||
absoluteBounds.width -= GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH); // adjust width to fit the scrollbar
|
||||
}
|
||||
|
||||
int maxScroll = absoluteBounds.height + 2*(GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH))-bounds.height;
|
||||
|
||||
// Update control
|
||||
//--------------------------------------------------------------------
|
||||
Vector2 mousePos = GetMousePosition();
|
||||
// NOTE: most of the update code is actually done in the draw control section
|
||||
if ((state != STATE_DISABLED) && !guiLocked) {
|
||||
if(!CheckCollisionPointRec(mousePos, bounds)) {
|
||||
propFocused = -1;
|
||||
}
|
||||
|
||||
if (useScrollBar)
|
||||
{
|
||||
int wheelMove = GetMouseWheelMove();
|
||||
scroll += wheelMove*count;
|
||||
if(-scroll > maxScroll) scroll = -maxScroll;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw control
|
||||
//--------------------------------------------------------------------
|
||||
DrawRectangleRec(bounds, Fade(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)), guiAlpha) ); // Draw background
|
||||
DrawRectangleLinesEx(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha)); // Draw border
|
||||
|
||||
BeginScissorMode(absoluteBounds.x, bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), absoluteBounds.width, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH));
|
||||
int currentHeight = 0;
|
||||
for(int p=0; p<count; ++p)
|
||||
{
|
||||
int height = GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
if(props[p].type < (sizeof(propSlots)/sizeof(propSlots[0])) && !PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED) )
|
||||
height = propSlots[props[p].type]*GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT); // get property height based on how many slots it occupies
|
||||
|
||||
// Even with scissor mode on, draw only properties that we can see (comment out both BeginScissorMode() / EndScissorMode() to see this)
|
||||
if(absoluteBounds.y + currentHeight + height >= bounds.y && absoluteBounds.y + currentHeight <= bounds.y + bounds.height)
|
||||
{
|
||||
Rectangle propBounds = {absoluteBounds.x, absoluteBounds.y + currentHeight, absoluteBounds.width, height};
|
||||
Color textColor = Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha);
|
||||
int propState = STATE_NORMAL;
|
||||
|
||||
// Get the state of this property and do some initial drawing
|
||||
if(PROP_CHECK_FLAG(&props[p], GUI_PFLAG_DISABLED)) {
|
||||
propState = STATE_DISABLED;
|
||||
propBounds.height += 1;
|
||||
DrawRectangleRec(propBounds, Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED)), guiAlpha));
|
||||
propBounds.height -= 1;
|
||||
textColor = Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha);
|
||||
} else {
|
||||
if(CheckCollisionPointRec(mousePos, propBounds) && !guiLocked) {
|
||||
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) {
|
||||
propState = STATE_PRESSED;
|
||||
//DrawRectangleRec(propRect, Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED)), guiAlpha));
|
||||
textColor = Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)), guiAlpha);
|
||||
} else {
|
||||
propState = STATE_FOCUSED;
|
||||
propFocused = p;
|
||||
//DrawRectangleRec(propRect, Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED)), guiAlpha));
|
||||
textColor = Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)), guiAlpha);
|
||||
}
|
||||
} else propState = STATE_NORMAL;
|
||||
}
|
||||
|
||||
if(propState == STATE_DISABLED) GuiSetState(propState);
|
||||
switch(props[p].type)
|
||||
{
|
||||
case GUI_PROP_BOOL: {
|
||||
// draw property name
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x + PROPERTY_PADDING, propBounds.y, propBounds.width/2-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
if(propState == STATE_PRESSED) props[p].value.vbool = !props[p].value.vbool; // toggle the property value when clicked
|
||||
|
||||
// draw property value
|
||||
const bool locked = guiLocked;
|
||||
GuiLock(); // lock the checkbox since we changed the value manually
|
||||
GuiCheckBox((Rectangle){propBounds.x+propBounds.width/2, propBounds.y + height/4, height/2, height/2}, props[p].value.vbool ? "Yes" : "No", props[p].value.vbool);
|
||||
if(!locked) GuiUnlock(); // only unlock when needed
|
||||
} break;
|
||||
|
||||
case GUI_PROP_INT:
|
||||
// draw property name
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x + PROPERTY_PADDING, propBounds.y, propBounds.width/2-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
// draw property value
|
||||
props[p].value.vint.val = GuiDMSpinner((Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2},
|
||||
props[p].value.vint.val, props[p].value.vint.min, props[p].value.vint.max, props[p].value.vint.step, 0, (propState == STATE_FOCUSED) );
|
||||
break;
|
||||
|
||||
case GUI_PROP_FLOAT:
|
||||
// draw property name
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x + PROPERTY_PADDING, propBounds.y, propBounds.width/2-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
// draw property value
|
||||
props[p].value.vfloat.val = GuiDMSpinner((Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2},
|
||||
props[p].value.vfloat.val, props[p].value.vfloat.min, props[p].value.vfloat.max, props[p].value.vfloat.step, props[p].value.vfloat.precision, (propState == STATE_FOCUSED) );
|
||||
break;
|
||||
|
||||
case GUI_PROP_TEXT: {
|
||||
Rectangle titleBounds = { propBounds.x, propBounds.y, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) };
|
||||
// Collapse/Expand property on click
|
||||
if((propState == STATE_PRESSED) && CheckCollisionPointRec(mousePos, titleBounds))
|
||||
PROP_TOGGLE_FLAG(&props[p], GUI_PFLAG_COLLAPSED);
|
||||
|
||||
// draw property name
|
||||
GuiDrawText(PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED) ? PROPERTY_COLLAPSED_ICON : PROPERTY_EXPANDED_ICON, titleBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x+PROPERTY_ICON_SIZE+PROPERTY_PADDING, propBounds.y, propBounds.width-PROPERTY_ICON_SIZE-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(TextFormat("%i/%i", strlen(props[p].value.vtext.val), props[p].value.vtext.size), (Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2}, TEXT_ALIGN_LEFT, textColor);
|
||||
|
||||
// draw property value
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED))
|
||||
GuiTextBox((Rectangle){propBounds.x, propBounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2}, props[p].value.vtext.val, props[p].value.vtext.size, (propState == STATE_FOCUSED));
|
||||
} break;
|
||||
|
||||
case GUI_PROP_SELECT: {
|
||||
// TODO: Create a custom dropdownbox control instead of using the raygui combobox
|
||||
// draw property name
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x + PROPERTY_PADDING, propBounds.y, propBounds.width/2-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
// draw property value
|
||||
props[p].value.vselect.active = GuiComboBox((Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2},
|
||||
props[p].value.vselect.val, props[p].value.vselect.active);
|
||||
} break;
|
||||
|
||||
case GUI_PROP_VECTOR2: case GUI_PROP_VECTOR3: case GUI_PROP_VECTOR4: {
|
||||
Rectangle titleBounds = { propBounds.x, propBounds.y, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) };
|
||||
// Collapse/Expand property on click
|
||||
if((propState == STATE_PRESSED) && CheckCollisionPointRec(mousePos, titleBounds))
|
||||
PROP_TOGGLE_FLAG(&props[p], GUI_PFLAG_COLLAPSED);
|
||||
|
||||
const char* fmt = "";
|
||||
if(props[p].type == GUI_PROP_VECTOR2) fmt = TextFormat("[%.0f, %.0f]", props[p].value.v2.x, props[p].value.v2.y);
|
||||
else if(props[p].type == GUI_PROP_VECTOR3) fmt = TextFormat("[%.0f, %.0f, %.0f]", props[p].value.v3.x, props[p].value.v3.y, props[p].value.v3.z);
|
||||
else fmt = TextFormat("[%.0f, %.0f, %.0f, %.0f]", props[p].value.v4.x, props[p].value.v4.y, props[p].value.v4.z, props[p].value.v4.w);
|
||||
|
||||
// draw property name
|
||||
GuiDrawText(PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED) ? PROPERTY_COLLAPSED_ICON : PROPERTY_EXPANDED_ICON, titleBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x+PROPERTY_ICON_SIZE+PROPERTY_PADDING, propBounds.y, propBounds.width-PROPERTY_ICON_SIZE-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(fmt, (Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2}, TEXT_ALIGN_LEFT, textColor);
|
||||
|
||||
// draw X, Y, Z, W values (only when expanded)
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
|
||||
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("A"), slotBounds.height};
|
||||
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, propBounds.width-lblBounds.width-2*PROPERTY_PADDING, slotBounds.height};
|
||||
GuiDrawText("X", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.v2.x = GuiDMSpinner(valBounds, props[p].value.v2.x, 0.0, 0.0, 1.0, PROPERTY_DECIMAL_DIGITS, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = slotBounds.y;
|
||||
GuiDrawText("Y", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.v2.y = GuiDMSpinner(valBounds, props[p].value.v2.y, 0.0, 0.0, 1.0, PROPERTY_DECIMAL_DIGITS, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = slotBounds.y;
|
||||
if(props[p].type >= GUI_PROP_VECTOR3) {
|
||||
GuiDrawText("Z", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.v3.z = GuiDMSpinner(valBounds, props[p].value.v3.z, 0.0, 0.0, 1.0, PROPERTY_DECIMAL_DIGITS, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = slotBounds.y;
|
||||
}
|
||||
|
||||
if(props[p].type >= GUI_PROP_VECTOR4) {
|
||||
GuiDrawText("W", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.v4.w = GuiDMSpinner(valBounds, props[p].value.v4.w, 0.0, 0.0, 1.0, PROPERTY_DECIMAL_DIGITS, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case GUI_PROP_RECT:{
|
||||
Rectangle titleBounds = { propBounds.x, propBounds.y, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) };
|
||||
// Collapse/Expand property on click
|
||||
if((propState == STATE_PRESSED) && CheckCollisionPointRec(mousePos, titleBounds))
|
||||
PROP_TOGGLE_FLAG(&props[p], GUI_PFLAG_COLLAPSED);
|
||||
|
||||
// draw property name
|
||||
GuiDrawText(PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED) ? PROPERTY_COLLAPSED_ICON : PROPERTY_EXPANDED_ICON, titleBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x+PROPERTY_ICON_SIZE+PROPERTY_PADDING, propBounds.y, propBounds.width-PROPERTY_ICON_SIZE-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(TextFormat("[%.0f, %.0f, %.0f, %.0f]", props[p].value.vrect.x, props[p].value.vrect.y, props[p].value.vrect.width, props[p].value.vrect.height),
|
||||
(Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2}, TEXT_ALIGN_LEFT, textColor);
|
||||
|
||||
// draw X, Y, Width, Height values (only when expanded)
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
|
||||
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("Height"), slotBounds.height};
|
||||
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, propBounds.width-lblBounds.width-2*PROPERTY_PADDING, slotBounds.height};
|
||||
GuiDrawText("X", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vrect.x = GuiDMSpinner(valBounds, props[p].value.vrect.x, 0.0, 0.0, 1.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = slotBounds.y;
|
||||
GuiDrawText("Y", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vrect.y = GuiDMSpinner(valBounds, props[p].value.vrect.y, 0.0, 0.0, 1.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = slotBounds.y;
|
||||
GuiDrawText("Width", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vrect.width = GuiDMSpinner(valBounds, props[p].value.vrect.width, 0.0, 0.0, 1.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = slotBounds.y;
|
||||
GuiDrawText("Height", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vrect.height = GuiDMSpinner(valBounds, props[p].value.vrect.height, 0.0, 0.0, 1.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
}
|
||||
} break;
|
||||
|
||||
|
||||
case GUI_PROP_COLOR: {
|
||||
Rectangle titleBounds = { propBounds.x, propBounds.y, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) };
|
||||
// Collapse/Expand property on click
|
||||
if((propState == STATE_PRESSED) && CheckCollisionPointRec(mousePos, titleBounds))
|
||||
PROP_TOGGLE_FLAG(&props[p], GUI_PFLAG_COLLAPSED);
|
||||
|
||||
// draw property name
|
||||
GuiDrawText(PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED) ? PROPERTY_COLLAPSED_ICON : PROPERTY_EXPANDED_ICON, titleBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x+PROPERTY_ICON_SIZE+PROPERTY_PADDING, propBounds.y+1, propBounds.width-PROPERTY_ICON_SIZE-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2}, TEXT_ALIGN_LEFT, textColor);
|
||||
DrawLineEx( (Vector2){propBounds.x+propBounds.width/2, propBounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 5}, (Vector2){propBounds.x+propBounds.width, propBounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 5}, 6.0f, props[p].value.vcolor);
|
||||
const char* fmt = TextFormat("#%02X%02X%02X%02X", props[p].value.vcolor.r, props[p].value.vcolor.g, props[p].value.vcolor.b, props[p].value.vcolor.a);
|
||||
char clip[10] = "\0";
|
||||
memcpy(clip, fmt, 10*sizeof(char)); // copy to temporary buffer since we can't be sure when TextFormat() will be called again and our text will be overwritten
|
||||
GuiDrawText(fmt, (Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2}, TEXT_ALIGN_LEFT, textColor);
|
||||
|
||||
// draw R, G, B, A values (only when expanded)
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
|
||||
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
|
||||
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("A"), slotBounds.height};
|
||||
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, GetTextWidth("000000"), slotBounds.height};
|
||||
Rectangle sbarBounds = { valBounds.x + valBounds.width + PROPERTY_PADDING, slotBounds.y, slotBounds.width - 3*PROPERTY_PADDING - lblBounds.width - valBounds.width, slotBounds.height };
|
||||
|
||||
if(sbarBounds.width <= GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2) valBounds.width = propBounds.width-lblBounds.width-2*PROPERTY_PADDING; // hide slider when no space
|
||||
// save current scrollbar style
|
||||
int tmpSliderPadding = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING);
|
||||
int tmpPadding = GuiGetStyle(SCROLLBAR, SCROLL_PADDING);
|
||||
int tmpBorder = GuiGetStyle(SCROLLBAR, BORDER_WIDTH);
|
||||
int tmpSliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE);
|
||||
int tmpArrows = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE);
|
||||
Color tmpBG1 = GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED));
|
||||
// set a custom scrollbar style
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING, 3);
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_PADDING, 10);
|
||||
GuiSetStyle(SCROLLBAR, BORDER_WIDTH, 0);
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, 6);
|
||||
GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, 0);
|
||||
GuiSetStyle(DEFAULT, BORDER_COLOR_DISABLED, GuiGetStyle(DEFAULT, BACKGROUND_COLOR)); // disable scrollbar background
|
||||
|
||||
GuiDrawText("R", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vcolor.r = GuiDMValueBox(valBounds, props[p].value.vcolor.r, 0.0, 255.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
if(sbarBounds.width > GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2)
|
||||
props[p].value.vcolor.r = GuiScrollBar(sbarBounds, props[p].value.vcolor.r, 0, 255);
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = sbarBounds.y = slotBounds.y;
|
||||
|
||||
GuiDrawText("G", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vcolor.g = GuiDMValueBox(valBounds, props[p].value.vcolor.g, 0.0, 255.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
if(sbarBounds.width > GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2)
|
||||
props[p].value.vcolor.g = GuiScrollBar(sbarBounds, props[p].value.vcolor.g, 0, 255);
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = sbarBounds.y = slotBounds.y;
|
||||
|
||||
GuiDrawText("B", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vcolor.b = GuiDMValueBox(valBounds, props[p].value.vcolor.b, 0.0, 255.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
if(sbarBounds.width > GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2)
|
||||
props[p].value.vcolor.b = GuiScrollBar(sbarBounds, props[p].value.vcolor.b, 0, 255);
|
||||
slotBounds.y += GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
||||
lblBounds.y = valBounds.y = sbarBounds.y = slotBounds.y;
|
||||
|
||||
GuiDrawText("A", lblBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
props[p].value.vcolor.a = GuiDMValueBox(valBounds, props[p].value.vcolor.a, 0.0, 255.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
|
||||
if(sbarBounds.width > GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2)
|
||||
props[p].value.vcolor.a = GuiScrollBar(sbarBounds, props[p].value.vcolor.a, 0, 255);
|
||||
|
||||
// load saved scrollbar style
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING, tmpSliderPadding);
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_PADDING, tmpPadding);
|
||||
GuiSetStyle(SCROLLBAR, BORDER_WIDTH, tmpBorder);
|
||||
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, tmpSliderSize);
|
||||
GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, tmpArrows);
|
||||
GuiSetStyle(DEFAULT, BORDER_COLOR_DISABLED, ColorToInt(tmpBG1));
|
||||
}
|
||||
|
||||
// support COPY/PASTE (need to do this here since GuiDMValueBox() also has COPY/PASTE so we need to overwrite it)
|
||||
if((propState == STATE_FOCUSED)) {
|
||||
if(IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_C))
|
||||
SetClipboardText(clip);
|
||||
else if(IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_V)){
|
||||
unsigned int a = props[p].value.vcolor.a, r = props[p].value.vcolor.r, g=props[p].value.vcolor.g, b=props[p].value.vcolor.b;
|
||||
sscanf(GetClipboardText(), "#%02X%02X%02X%02X", &r, &g, &b, &a);
|
||||
props[p].value.vcolor.r=r; props[p].value.vcolor.g=g; props[p].value.vcolor.b=b; props[p].value.vcolor.a=a;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case GUI_PROP_SECTION: {
|
||||
Rectangle titleBounds = { propBounds.x, propBounds.y, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) };
|
||||
// Collapse/Expand section on click
|
||||
if( (propState == STATE_PRESSED) && CheckCollisionPointRec(mousePos, titleBounds) )
|
||||
PROP_TOGGLE_FLAG(&props[p], GUI_PFLAG_COLLAPSED);
|
||||
|
||||
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
|
||||
GuiDrawText(PROPERTY_EXPANDED_ICON, titleBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x+PROPERTY_ICON_SIZE+PROPERTY_PADDING, propBounds.y, propBounds.width-PROPERTY_ICON_SIZE-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_CENTER, textColor);
|
||||
} else {
|
||||
GuiDrawText(PROPERTY_COLLAPSED_ICON, titleBounds, TEXT_ALIGN_LEFT, textColor);
|
||||
GuiDrawText(TextFormat("%s [%i]", props[p].name, props[p].value.vsection), (Rectangle){propBounds.x+PROPERTY_ICON_SIZE+PROPERTY_PADDING, propBounds.y, propBounds.width-PROPERTY_ICON_SIZE-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_CENTER, textColor);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
||||
// NOTE: Add your custom property here !!
|
||||
default: {
|
||||
// draw property name
|
||||
GuiDrawText(props[p].name, (Rectangle){propBounds.x + PROPERTY_PADDING, propBounds.y, propBounds.width/2-PROPERTY_PADDING, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)}, TEXT_ALIGN_LEFT, textColor);
|
||||
// draw property type
|
||||
GuiDrawText(TextFormat("TYPE %i", props[p].type), (Rectangle){propBounds.x+propBounds.width/2, propBounds.y + 1, propBounds.width/2, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) - 2}, TEXT_ALIGN_LEFT, textColor);
|
||||
} break;
|
||||
|
||||
} // end of switch()
|
||||
|
||||
GuiSetState(state);
|
||||
}
|
||||
|
||||
currentHeight += height + 1;
|
||||
|
||||
// Skip collapsed section. Don't put this code inside the switch !!
|
||||
if(props[p].type == GUI_PROP_SECTION && (PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED))) p += props[p].value.vsection;
|
||||
} // end for
|
||||
EndScissorMode();
|
||||
|
||||
if(useScrollBar) {
|
||||
scroll = -GuiScrollBar(scrollBarBounds, -scroll, 0, maxScroll);
|
||||
*scrollIndex = scroll;
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
if(focus != NULL) *focus = propFocused;
|
||||
}
|
||||
|
||||
bool GuiDMSaveProperties(const char* file, GuiDMProperty* props, int count) {
|
||||
if(file == NULL || props == NULL) return false;
|
||||
if(count == 0) return true;
|
||||
|
||||
FILE* f = fopen(file, "w");
|
||||
if(f == NULL) return false;
|
||||
|
||||
// write header
|
||||
fprintf(f, "#\n# Property types:\n"
|
||||
"# b <name> <flags> <value> // Bool\n"
|
||||
"# i <name> <flags> <value> <min> <max> <step> // Int\n"
|
||||
"# f <name> <flags> <value> <min> <max> <step> <precision> // Float\n"
|
||||
"# t <name> <flags> <value> <edit_length> // Text\n"
|
||||
"# l <name> <flags> <value> <active> // Select\n"
|
||||
"# g <name> <flags> <value> // Section (Group)\n"
|
||||
"# v2 <name> <flags> <x> <y> // Vector 2D\n"
|
||||
"# v3 <name> <flags> <x> <y> <z> // Vector 3D\n"
|
||||
"# v4 <name> <flags> <x> <y> <z> <w> // Vector 4D\n"
|
||||
"# r <name> <flags> <x> <y> <width> <height> // Rectangle\n"
|
||||
"# c <name> <flags> <r> <g> <b> <a> // Color\n"
|
||||
"#\n\n");
|
||||
for(int p=0; p<count; ++p)
|
||||
{
|
||||
switch(props[p].type) {
|
||||
case GUI_PROP_BOOL: fprintf(f, "b %s %i %i\n", props[p].name, (int)props[p].flags, (int)props[p].value.vbool);
|
||||
break;
|
||||
|
||||
case GUI_PROP_INT: fprintf(f, "i %s %i %i %i %i %i\n", props[p].name, (int)props[p].flags, props[p].value.vint.val, props[p].value.vint.min,
|
||||
props[p].value.vint.max, props[p].value.vint.step);
|
||||
break;
|
||||
|
||||
case GUI_PROP_FLOAT: fprintf(f, "f %s %i %f %f %f %f %i\n", props[p].name, (int)props[p].flags, props[p].value.vfloat.val, props[p].value.vfloat.min,
|
||||
props[p].value.vfloat.max, props[p].value.vfloat.step, props[p].value.vfloat.precision);
|
||||
break;
|
||||
|
||||
case GUI_PROP_TEXT: fprintf(f, "t %s %i %s %i\n", props[p].name, (int)props[p].flags, props[p].value.vtext.val, props[p].value.vtext.size);
|
||||
break;
|
||||
|
||||
case GUI_PROP_SELECT: fprintf(f, "l %s %i %s %i\n", props[p].name, (int)props[p].flags, props[p].value.vselect.val, props[p].value.vselect.active);
|
||||
break;
|
||||
|
||||
case GUI_PROP_SECTION: fprintf(f, "g %s %i %i\n", props[p].name, (int)props[p].flags, props[p].value.vsection);
|
||||
break;
|
||||
|
||||
case GUI_PROP_VECTOR2: fprintf(f, "v2 %s %i %f %f\n", props[p].name, (int)props[p].flags, props[p].value.v2.x, props[p].value.v2.y);
|
||||
break;
|
||||
|
||||
case GUI_PROP_VECTOR3: fprintf(f, "v3 %s %i %f %f %f\n", props[p].name, (int)props[p].flags, props[p].value.v3.x, props[p].value.v3.y, props[p].value.v3.z);
|
||||
break;
|
||||
|
||||
case GUI_PROP_VECTOR4: fprintf(f, "v4 %s %i %f %f %f %f\n", props[p].name, (int)props[p].flags, props[p].value.v4.x, props[p].value.v4.y,
|
||||
props[p].value.v4.z, props[p].value.v4.w);
|
||||
break;
|
||||
|
||||
case GUI_PROP_RECT: fprintf(f, "r %s %i %i %i %i %i\n", props[p].name, (int)props[p].flags, (int)props[p].value.vrect.x, (int)props[p].value.vrect.y,
|
||||
(int)props[p].value.vrect.width, (int)props[p].value.vrect.height);
|
||||
break;
|
||||
|
||||
case GUI_PROP_COLOR: fprintf(f, "c %s %i %i %i %i %i\n", props[p].name, (int)props[p].flags, props[p].value.vcolor.r, props[p].value.vcolor.g,
|
||||
props[p].value.vcolor.b, props[p].value.vcolor.a);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // GUI_PROPERTY_LIST_IMPLEMENTATION
|
99
examples/gui/property_list/property_list.c
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - custom property list control
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.0 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2020-2022 Vlad Adrian (@Demizdor) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
#undef RAYGUI_IMPLEMENTATION // Avoid including raygui implementation again
|
||||
|
||||
#define GUI_PROPERTY_LIST_IMPLEMENTATION
|
||||
#include "dm_property_list.h"
|
||||
|
||||
#define SIZEOF(A) (sizeof(A)/sizeof(A[0]))
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raygui - property list");
|
||||
|
||||
GuiDMProperty prop[] = {
|
||||
PBOOL("Bool", 0, true),
|
||||
PSECTION("#102#SECTION", 0, 2),
|
||||
PINT("Int", 0, 123),
|
||||
PFLOAT("Float", 0, 0.99f),
|
||||
PTEXT("Text", 0, (char*)&(char[30]){"Hello!"}, 30),
|
||||
PSELECT("Select", 0, "ONE;TWO;THREE;FOUR", 0),
|
||||
PINT_RANGE("Int Range", 0, 32, 1, 0, 100),
|
||||
PRECT("Rect", 0, 0, 0, 100, 200),
|
||||
PVEC2("Vec2", 0, 20, 20),
|
||||
PVEC3("Vec3", 0, 12, 13, 14),
|
||||
PVEC4("Vec4", 0, 12, 13, 14, 15),
|
||||
PCOLOR("Color", 0, 0, 255, 0, 255),
|
||||
};
|
||||
|
||||
int focus = 0, scroll = 0; // Needed by GuiDMPropertyList()
|
||||
|
||||
GuiLoadStyleDefault();
|
||||
|
||||
// Tweak the default raygui style a bit
|
||||
GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, 24);
|
||||
GuiSetStyle(LISTVIEW, SCROLLBAR_WIDTH, 12);
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
|
||||
GuiGrid((Rectangle){0, 0, screenWidth, screenHeight}, "Property List", 20.0f, 2); // Draw a fancy grid
|
||||
|
||||
GuiDMPropertyList((Rectangle){(screenWidth - 180)/2, (screenHeight - 280)/2, 180, 280}, prop, SIZEOF(prop), &focus, &scroll);
|
||||
|
||||
if (prop[0].value.vbool >= 1)
|
||||
{
|
||||
DrawText(TextFormat("FOCUS:%i | SCROLL:%i | FPS:%i", focus, scroll, GetFPS()), prop[8].value.v2.x, prop[8].value.v2.y, 20, prop[11].value.vcolor);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
GuiDMSaveProperties("test.props", prop, SIZEOF(prop)); // Save properties to `test.props` file at exit
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
27
examples/gui/property_list/test.props
Normal file
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# Property types:
|
||||
# b <name> <flags> <value> // Bool
|
||||
# i <name> <flags> <value> <min> <max> <step> // Int
|
||||
# f <name> <flags> <value> <min> <max> <step> <precision> // Float
|
||||
# t <name> <flags> <value> <edit_length> // Text
|
||||
# l <name> <flags> <value> <active> // Select
|
||||
# g <name> <flags> <value> // Section (Group)
|
||||
# v2 <name> <flags> <x> <y> // Vector 2D
|
||||
# v3 <name> <flags> <x> <y> <z> // Vector 3D
|
||||
# v4 <name> <flags> <x> <y> <z> <w> // Vector 4D
|
||||
# r <name> <flags> <x> <y> <width> <height> // Rectangle
|
||||
# c <name> <flags> <r> <g> <b> <a> // Color
|
||||
#
|
||||
|
||||
b Bool 0 1
|
||||
g #102#SECTION 0 2
|
||||
i Int 0 123 0 0 1
|
||||
f Float 0 0.990000 0.000000 0.000000 1.000000 3
|
||||
t Text 1 Hello! 30
|
||||
l Select 0 ONE;TWO;THREE;FOUR 3
|
||||
i Int Range 0 32 0 100 1
|
||||
r Rect 1 0 0 100 200
|
||||
v2 Vec2 1 20.000000 20.000000
|
||||
v3 Vec3 1 12.000000 13.000000 14.000000
|
||||
v4 Vec4 1 12.000000 13.000000 14.000000 15.000000
|
||||
c Color 1 94 68 197 160
|
150
examples/gui/scroll_panel/scroll_panel.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - Controls test
|
||||
*
|
||||
* TEST CONTROLS:
|
||||
* - GuiScrollPanel()
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.0 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* COMPILATION (Linux - gcc):
|
||||
* gcc -o $(NAME_PART) $(FILE_NAME) -I../../src -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2019-2022 Vlad Adrian (@Demizdor) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
|
||||
static void DrawStyleEditControls(void); // Draw and process scroll bar style edition controls
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raygui - GuiScrollPanel()");
|
||||
|
||||
Rectangle panelRec = { 20, 40, 200, 150 };
|
||||
Rectangle panelContentRec = {0, 0, 340, 340 };
|
||||
Vector2 panelScroll = { 99, -20 };
|
||||
|
||||
bool showContentArea = true;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Implement required update logic
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText(TextFormat("[%f, %f]", panelScroll.x, panelScroll.y), 4, 4, 20, RED);
|
||||
|
||||
Rectangle view = GuiScrollPanel(panelRec, NULL, panelContentRec, &panelScroll);
|
||||
|
||||
BeginScissorMode(view.x, view.y, view.width, view.height);
|
||||
GuiGrid((Rectangle){panelRec.x + panelScroll.x, panelRec.y + panelScroll.y, panelContentRec.width, panelContentRec.height}, NULL, 16, 3);
|
||||
EndScissorMode();
|
||||
|
||||
if (showContentArea) DrawRectangle(panelRec.x + panelScroll.x, panelRec.y + panelScroll.y, panelContentRec.width, panelContentRec.height, Fade(RED, 0.1));
|
||||
|
||||
DrawStyleEditControls();
|
||||
|
||||
showContentArea = GuiCheckBox((Rectangle){ 565, 80, 20, 20 }, "SHOW CONTENT AREA", showContentArea);
|
||||
|
||||
panelContentRec.width = GuiSliderBar((Rectangle){ 590, 385, 145, 15}, "WIDTH", TextFormat("%i", (int)panelContentRec.width), panelContentRec.width, 1, 600);
|
||||
panelContentRec.height = GuiSliderBar((Rectangle){ 590, 410, 145, 15 }, "HEIGHT", TextFormat("%i", (int)panelContentRec.height), panelContentRec.height, 1, 400);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Draw and process scroll bar style edition controls
|
||||
static void DrawStyleEditControls(void)
|
||||
{
|
||||
// ScrollPanel style controls
|
||||
//----------------------------------------------------------
|
||||
GuiGroupBox((Rectangle){ 550, 170, 220, 205 }, "SCROLLBAR STYLE");
|
||||
|
||||
int style = GuiGetStyle(SCROLLBAR, BORDER_WIDTH);
|
||||
GuiLabel((Rectangle){ 555, 195, 110, 10 }, "BORDER_WIDTH");
|
||||
GuiSpinner((Rectangle){ 670, 190, 90, 20 }, NULL, &style, 0, 6, false);
|
||||
GuiSetStyle(SCROLLBAR, BORDER_WIDTH, style);
|
||||
|
||||
style = GuiGetStyle(SCROLLBAR, ARROWS_SIZE);
|
||||
GuiLabel((Rectangle){ 555, 220, 110, 10 }, "ARROWS_SIZE");
|
||||
GuiSpinner((Rectangle){ 670, 215, 90, 20 }, NULL, &style, 4, 14, false);
|
||||
GuiSetStyle(SCROLLBAR, ARROWS_SIZE, style);
|
||||
|
||||
style = GuiGetStyle(SCROLLBAR, SLIDER_PADDING);
|
||||
GuiLabel((Rectangle){ 555, 245, 110, 10 }, "SLIDER_PADDING");
|
||||
GuiSpinner((Rectangle){ 670, 240, 90, 20 }, NULL, &style, 0, 14, false);
|
||||
GuiSetStyle(SCROLLBAR, SLIDER_PADDING, style);
|
||||
|
||||
style = GuiCheckBox((Rectangle){ 565, 280, 20, 20 }, "ARROWS_VISIBLE", GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE));
|
||||
GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, style);
|
||||
|
||||
style = GuiGetStyle(SCROLLBAR, SLIDER_PADDING);
|
||||
GuiLabel((Rectangle){ 555, 325, 110, 10 }, "SLIDER_PADDING");
|
||||
GuiSpinner((Rectangle){ 670, 320, 90, 20 }, NULL, &style, 0, 14, false);
|
||||
GuiSetStyle(SCROLLBAR, SLIDER_PADDING, style);
|
||||
|
||||
style = GuiGetStyle(SCROLLBAR, SLIDER_WIDTH);
|
||||
GuiLabel((Rectangle){ 555, 350, 110, 10 }, "SLIDER_WIDTH");
|
||||
GuiSpinner((Rectangle){ 670, 345, 90, 20 }, NULL, &style, 2, 100, false);
|
||||
GuiSetStyle(SCROLLBAR, SLIDER_WIDTH, style);
|
||||
|
||||
const char *text = GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE? "SCROLLBAR: LEFT" : "SCROLLBAR: RIGHT";
|
||||
style = GuiToggle((Rectangle){ 560, 110, 200, 35 }, text, GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE));
|
||||
GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, style);
|
||||
//----------------------------------------------------------
|
||||
|
||||
// ScrollBar style controls
|
||||
//----------------------------------------------------------
|
||||
GuiGroupBox((Rectangle){ 550, 20, 220, 135 }, "SCROLLPANEL STYLE");
|
||||
|
||||
style = GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH);
|
||||
GuiLabel((Rectangle){ 555, 35, 110, 10 }, "SCROLLBAR_WIDTH");
|
||||
GuiSpinner((Rectangle){ 670, 30, 90, 20 }, NULL, &style, 6, 30, false);
|
||||
GuiSetStyle(LISTVIEW, SCROLLBAR_WIDTH, style);
|
||||
|
||||
style = GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
||||
GuiLabel((Rectangle){ 555, 60, 110, 10 }, "BORDER_WIDTH");
|
||||
GuiSpinner((Rectangle){ 670, 55, 90, 20 }, NULL, &style, 0, 20, false);
|
||||
GuiSetStyle(DEFAULT, BORDER_WIDTH, style);
|
||||
//----------------------------------------------------------
|
||||
}
|
193
examples/gui/standalone/raygui_custom_backend.h
Normal file
|
@ -0,0 +1,193 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - Standalone mode custom backend
|
||||
*
|
||||
* Just edit this file to include your custom implementation to your graphic API
|
||||
*
|
||||
* LICENSE: <your_license>
|
||||
*
|
||||
* Copyright (c) <year> <developer_name>
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
//#include "my_cool_graphic_api.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
// TODO: Define input keys required by raygui
|
||||
//----------------------------------------------------------------------------------
|
||||
#define KEY_RIGHT 262
|
||||
#define KEY_LEFT 263
|
||||
#define KEY_DOWN 264
|
||||
#define KEY_UP 265
|
||||
#define KEY_BACKSPACE 259
|
||||
#define KEY_ENTER 257
|
||||
#define MOUSE_LEFT_BUTTON 0
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
// TODO: Define required structures, maybe Font/Texture2D should be defined here?
|
||||
//----------------------------------------------------------------------------------
|
||||
// ...
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
// ...
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition
|
||||
// TODO: Define all raygui required functions (previously provided by raylib)
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// Input required functions
|
||||
//-------------------------------------------------------------------------------
|
||||
static Vector2 GetMousePosition(void)
|
||||
{
|
||||
Vector2 position = { 0 };
|
||||
|
||||
// TODO: Mouse position
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
static int GetMouseWheelMove(void)
|
||||
{
|
||||
// TODO: Mouse wheel movement variation, reseted every frame
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool IsMouseButtonDown(int button)
|
||||
{
|
||||
// TODO: Return true while mouse button [0..2] is being down
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsMouseButtonPressed(int button)
|
||||
{
|
||||
// TODO: Return true when mouse button [0..2] has been pressed: up->down
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsMouseButtonReleased(int button)
|
||||
{
|
||||
// TODO: Return true when mouse button [0..2] has been released: down->up
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsKeyDown(int key)
|
||||
{
|
||||
// TODO: Return true while key is being down
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsKeyPressed(int key)
|
||||
{
|
||||
// TODO: Return true when key has been pressed: up->down
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// USED IN: GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()
|
||||
static int GetKeyPressed(void)
|
||||
{
|
||||
// TODO: Return last key pressed (up->down) in the frame
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// Drawing required functions
|
||||
//-------------------------------------------------------------------------------
|
||||
static void DrawRectangle(int x, int y, int width, int height, Color color)
|
||||
{
|
||||
// TODO: Draw rectangle on the screen
|
||||
}
|
||||
|
||||
// USED IN: GuiColorPicker()
|
||||
static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4)
|
||||
{
|
||||
// TODO: Draw rectangle with gradients (4 vertex colors) on the screen
|
||||
}
|
||||
|
||||
// USED IN: GuiDropdownBox(), GuiScrollBar()
|
||||
static void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
|
||||
{
|
||||
// TODO: Draw triangle on the screen, required for arrows
|
||||
}
|
||||
|
||||
// USED IN: GuiImageButtonEx()
|
||||
static void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint)
|
||||
{
|
||||
// TODO: Draw texture (piece defined by source rectangle) on screen
|
||||
}
|
||||
|
||||
// USED IN: GuiTextBoxMulti()
|
||||
static void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint)
|
||||
{
|
||||
// TODO: Draw text limited by a rectangle. This advance function wraps the text inside the rectangle
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
// 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(), GuiTextBoxMulti()
|
||||
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;
|
||||
}
|
||||
|
36
examples/gui/standalone/raygui_standalone.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - Standalone mode usage template
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raygui 2.6 - Immediate-mode GUI controls.
|
||||
*
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2020 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
#define RAYGUI_STANDALONE
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
#include "custom_backend.h"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// TODO: Initialize your systems (window, graphics, inputs)
|
||||
|
||||
// TODO: Create your game loop
|
||||
{
|
||||
// TODO: Use raygui API
|
||||
}
|
||||
|
||||
// TODO: De-initialize all resources
|
||||
|
||||
return 0;
|
||||
}
|
292
examples/gui/style_selector/style_selector.c
Normal file
|
@ -0,0 +1,292 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raygui - controls test suite
|
||||
*
|
||||
* TEST CONTROLS:
|
||||
* - GuiDropdownBox()
|
||||
* - GuiCheckBox()
|
||||
* - GuiSpinner()
|
||||
* - GuiValueBox()
|
||||
* - GuiTextBox()
|
||||
* - GuiButton()
|
||||
* - GuiComboBox()
|
||||
* - GuiListView()
|
||||
* - GuiToggleGroup()
|
||||
* - GuiTextBoxMulti()
|
||||
* - GuiColorPicker()
|
||||
* - GuiSlider()
|
||||
* - GuiSliderBar()
|
||||
* - GuiProgressBar()
|
||||
* - GuiColorBarAlpha()
|
||||
* - GuiScrollPanel()
|
||||
*
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* raylib 4.0 - Windowing/input management and drawing.
|
||||
* raygui 3.2 - Immediate-mode GUI controls.
|
||||
*
|
||||
* COMPILATION (Windows - MinGW):
|
||||
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2016-2022 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#define RAYGUI_IMPLEMENTATION
|
||||
//#define RAYGUI_CUSTOM_ICONS // It requires providing gui_icons.h in the same directory
|
||||
//#include "gui_icons.h" // External icons data provided, it can be generated with rGuiIcons tool
|
||||
#include "../../src/raygui.h"
|
||||
|
||||
// raygui embedded styles
|
||||
#include "styles/style_cyber.h" // raygui style: cyber
|
||||
#include "styles/style_jungle.h" // raygui style: jungle
|
||||
#include "styles/style_lavanda.h" // raygui style: lavanda
|
||||
#include "styles/style_dark.h" // raygui style: dark
|
||||
#include "styles/style_bluish.h" // raygui style: bluish
|
||||
#include "styles/style_terminal.h" // raygui style: terminal
|
||||
|
||||
#include <string.h> // Required for: strcpy()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
//------------------------------------------------------------------------------------
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------------------------------------
|
||||
const int screenWidth = 690;
|
||||
const int screenHeight = 560;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raygui - controls test suite");
|
||||
SetExitKey(0);
|
||||
|
||||
// GUI controls initialization
|
||||
//----------------------------------------------------------------------------------
|
||||
int dropdownBox000Active = 0;
|
||||
bool dropDown000EditMode = false;
|
||||
|
||||
int dropdownBox001Active = 0;
|
||||
bool dropDown001EditMode = false;
|
||||
|
||||
int spinner001Value = 0;
|
||||
bool spinnerEditMode = false;
|
||||
|
||||
int valueBox002Value = 0;
|
||||
bool valueBoxEditMode = false;
|
||||
|
||||
char textBoxText[64] = "Text box";
|
||||
bool textBoxEditMode = false;
|
||||
|
||||
int listViewScrollIndex = 0;
|
||||
int listViewActive = -1;
|
||||
|
||||
int listViewExScrollIndex = 0;
|
||||
int listViewExActive = 2;
|
||||
int listViewExFocus = -1;
|
||||
const char *listViewExList[8] = { "This", "is", "a", "list view", "with", "disable", "elements", "amazing!" };
|
||||
|
||||
char multiTextBoxText[256] = "Multi text box";
|
||||
bool multiTextBoxEditMode = false;
|
||||
Color colorPickerValue = RED;
|
||||
|
||||
int sliderValue = 50;
|
||||
int sliderBarValue = 60;
|
||||
float progressValue = 0.4f;
|
||||
|
||||
bool forceSquaredChecked = false;
|
||||
|
||||
float alphaValue = 0.5f;
|
||||
|
||||
int comboBoxActive = 1;
|
||||
|
||||
int toggleGroupActive = 0;
|
||||
|
||||
Vector2 viewScroll = { 0, 0 };
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Custom GUI font loading
|
||||
//Font font = LoadFontEx("fonts/rainyhearts16.ttf", 12, 0, 0);
|
||||
//GuiSetFont(font);
|
||||
|
||||
bool exitWindow = false;
|
||||
bool showMessageBox = false;
|
||||
|
||||
char textInput[256] = { 0 };
|
||||
bool showTextInputBox = false;
|
||||
|
||||
char textInputFileName[256] = { 0 };
|
||||
|
||||
GuiLoadStyleBluish();
|
||||
int visualStyleActive = 4;
|
||||
int prevVisualStyleActive = 4;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!exitWindow) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
exitWindow = WindowShouldClose();
|
||||
|
||||
if (IsKeyPressed(KEY_ESCAPE)) showMessageBox = !showMessageBox;
|
||||
|
||||
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_S)) showTextInputBox = true;
|
||||
|
||||
if (IsFileDropped())
|
||||
{
|
||||
FilePathList droppedFiles = LoadDroppedFiles();
|
||||
|
||||
if ((droppedFiles.count > 0) && IsFileExtension(droppedFiles.paths[0], ".rgs")) GuiLoadStyle(droppedFiles.paths[0]);
|
||||
|
||||
UnloadDroppedFiles(droppedFiles); // Clear internal buffers
|
||||
}
|
||||
|
||||
if (visualStyleActive != prevVisualStyleActive)
|
||||
{
|
||||
GuiLoadStyleDefault();
|
||||
|
||||
switch (visualStyleActive)
|
||||
{
|
||||
case 0: break; // Default style
|
||||
case 1: GuiLoadStyleJungle(); break;
|
||||
case 2: GuiLoadStyleLavanda(); break;
|
||||
case 3: GuiLoadStyleDark(); break;
|
||||
case 4: GuiLoadStyleBluish(); break;
|
||||
case 5: GuiLoadStyleCyber(); break;
|
||||
case 6: GuiLoadStyleTerminal(); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
|
||||
prevVisualStyleActive = visualStyleActive;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
|
||||
|
||||
// Visuals options
|
||||
GuiLabel((Rectangle){ 10, 10, 60, 24 }, "Style:");
|
||||
visualStyleActive = GuiComboBox((Rectangle){ 60,10, 120, 24 }, "default;Jungle;Lavanda;Dark;Bluish;Cyber;Terminal", visualStyleActive);
|
||||
|
||||
GuiSetIconScale(2);
|
||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_RIGHT);
|
||||
GuiButton((Rectangle){ 25, 255, 300, 30 }, GuiIconText(ICON_FILE_SAVE, "Save File"));
|
||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
|
||||
/*
|
||||
// raygui: controls drawing
|
||||
//----------------------------------------------------------------------------------
|
||||
if (dropDown000EditMode || dropDown001EditMode) GuiLock();
|
||||
else if (!dropDown000EditMode && !dropDown001EditMode) GuiUnlock();
|
||||
//GuiDisable();
|
||||
|
||||
// First GUI column
|
||||
//GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
forceSquaredChecked = GuiCheckBox((Rectangle){ 25, 108, 15, 15 }, "FORCE CHECK!", forceSquaredChecked);
|
||||
|
||||
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
//GuiSetStyle(VALUEBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
if (GuiSpinner((Rectangle){ 25, 135, 125, 30 }, NULL, &spinner001Value, 0, 100, spinnerEditMode)) spinnerEditMode = !spinnerEditMode;
|
||||
if (GuiValueBox((Rectangle){ 25, 175, 125, 30 }, NULL, &valueBox002Value, 0, 100, valueBoxEditMode)) valueBoxEditMode = !valueBoxEditMode;
|
||||
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
if (GuiTextBox((Rectangle){ 25, 215, 125, 30 }, textBoxText, 64, textBoxEditMode)) textBoxEditMode = !textBoxEditMode;
|
||||
|
||||
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
|
||||
if (GuiButton((Rectangle){ 25, 255, 125, 30 }, GuiIconText(ICON_FILE_SAVE, "Save File"))) showTextInputBox = true;
|
||||
|
||||
GuiGroupBox((Rectangle){ 25, 310, 125, 150 }, "STATES");
|
||||
//GuiLock();
|
||||
GuiSetState(STATE_NORMAL); if (GuiButton((Rectangle){ 30, 320, 115, 30 }, "NORMAL")) { }
|
||||
GuiSetState(STATE_FOCUSED); if (GuiButton((Rectangle){ 30, 355, 115, 30 }, "FOCUSED")) { }
|
||||
GuiSetState(STATE_PRESSED); if (GuiButton((Rectangle){ 30, 390, 115, 30 }, "#15#PRESSED")) { }
|
||||
GuiSetState(STATE_DISABLED); if (GuiButton((Rectangle){ 30, 425, 115, 30 }, "DISABLED")) { }
|
||||
GuiSetState(STATE_NORMAL);
|
||||
//GuiUnlock();
|
||||
|
||||
comboBoxActive = GuiComboBox((Rectangle){ 25, 470, 125, 30 }, "ONE;TWO;THREE;FOUR", comboBoxActive);
|
||||
|
||||
// NOTE: GuiDropdownBox must draw after any other control that can be covered on unfolding
|
||||
GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
|
||||
if (GuiDropdownBox((Rectangle){ 25, 65, 125, 30 }, "#01#ONE;#02#TWO;#03#THREE;#04#FOUR", &dropdownBox001Active, dropDown001EditMode)) dropDown001EditMode = !dropDown001EditMode;
|
||||
|
||||
GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||
if (GuiDropdownBox((Rectangle){ 25, 25, 125, 30 }, "ONE;TWO;THREE", &dropdownBox000Active, dropDown000EditMode)) dropDown000EditMode = !dropDown000EditMode;
|
||||
|
||||
// Second GUI column
|
||||
listViewActive = GuiListView((Rectangle){ 165, 25, 140, 140 }, "Charmander;Bulbasaur;#18#Squirtel;Pikachu;Eevee;Pidgey", &listViewScrollIndex, listViewActive);
|
||||
listViewExActive = GuiListViewEx((Rectangle){ 165, 180, 140, 200 }, listViewExList, 8, &listViewExFocus, &listViewExScrollIndex, listViewExActive);
|
||||
|
||||
toggleGroupActive = GuiToggleGroup((Rectangle){ 165, 400, 140, 25 }, "#1#ONE\n#3#TWO\n#8#THREE\n#23#", toggleGroupActive);
|
||||
|
||||
// Third GUI column
|
||||
if (GuiTextBoxMulti((Rectangle){ 320, 25, 225, 140 }, multiTextBoxText, 256, multiTextBoxEditMode)) multiTextBoxEditMode = !multiTextBoxEditMode;
|
||||
colorPickerValue = GuiColorPicker((Rectangle){ 320, 185, 196, 192 }, NULL, colorPickerValue);
|
||||
|
||||
sliderValue = GuiSlider((Rectangle){ 355, 400, 165, 20 }, "TEST", TextFormat("%2.2f", (float)sliderValue), sliderValue, -50, 100);
|
||||
sliderBarValue = GuiSliderBar((Rectangle){ 320, 430, 200, 20 }, NULL, TextFormat("%i", (int)sliderBarValue), sliderBarValue, 0, 100);
|
||||
progressValue = GuiProgressBar((Rectangle){ 320, 460, 200, 20 }, NULL, NULL, progressValue, 0, 1);
|
||||
|
||||
// NOTE: View rectangle could be used to perform some scissor test
|
||||
Rectangle view = GuiScrollPanel((Rectangle){ 560, 25, 100, 160 }, NULL, (Rectangle){ 560, 25, 200, 400 }, &viewScroll);
|
||||
|
||||
GuiPanel((Rectangle){ 560, 25 + 180, 100, 160 }, "Panel Info");
|
||||
|
||||
GuiGrid((Rectangle) { 560, 25 + 180 + 180, 100, 120 }, NULL, 20, 2);
|
||||
|
||||
GuiStatusBar((Rectangle){ 0, (float)GetScreenHeight() - 20, (float)GetScreenWidth(), 20 }, "This is a status bar");
|
||||
|
||||
alphaValue = GuiColorBarAlpha((Rectangle){ 320, 490, 200, 30 }, NULL, alphaValue);
|
||||
|
||||
if (showMessageBox)
|
||||
{
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
int result = GuiMessageBox((Rectangle){ (float)GetScreenWidth()/2 - 125, (float)GetScreenHeight()/2 - 50, 250, 100 }, GuiIconText(ICON_EXIT, "Close Window"), "Do you really want to exit?", "Yes;No");
|
||||
|
||||
if ((result == 0) || (result == 2)) showMessageBox = false;
|
||||
else if (result == 1) exitWindow = true;
|
||||
}
|
||||
|
||||
if (showTextInputBox)
|
||||
{
|
||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f));
|
||||
int result = GuiTextInputBox((Rectangle){ (float)GetScreenWidth()/2 - 120, (float)GetScreenHeight()/2 - 60, 240, 140 }, "Save", GuiIconText(ICON_FILE_SAVE, "Save file as..."), "Ok;Cancel", textInput, 255, NULL);
|
||||
|
||||
if (result == 1)
|
||||
{
|
||||
// TODO: Validate textInput value and save
|
||||
|
||||
strcpy(textInputFileName, textInput);
|
||||
}
|
||||
|
||||
if ((result == 0) || (result == 1) || (result == 2))
|
||||
{
|
||||
showTextInputBox = false;
|
||||
strcpy(textInput, "\0");
|
||||
}
|
||||
}
|
||||
*/
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
354
examples/gui/style_selector/styles/style_bluish.h
Normal file
|
@ -0,0 +1,354 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// StyleAsCode exporter v1.2 - Style data exported as a values array //
|
||||
// //
|
||||
// USAGE: On init call: GuiLoadStyleBluish(); //
|
||||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raygui //
|
||||
// feedback and support: ray[at]raylibtech.com //
|
||||
// //
|
||||
// Copyright (c) 2020-2022 raylib technologies (@raylibtech) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define BLUISH_STYLE_PROPS_COUNT 14
|
||||
|
||||
// Custom style name: bluish
|
||||
static const GuiStyleProp bluishStyleProps[BLUISH_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 0, 0x5ca6a6ff }, // DEFAULT_BORDER_COLOR_NORMAL
|
||||
{ 0, 1, 0xb4e8f3ff }, // DEFAULT_BASE_COLOR_NORMAL
|
||||
{ 0, 2, 0x447e77ff }, // DEFAULT_TEXT_COLOR_NORMAL
|
||||
{ 0, 3, 0x5f8792ff }, // DEFAULT_BORDER_COLOR_FOCUSED
|
||||
{ 0, 4, 0xcdeff7ff }, // DEFAULT_BASE_COLOR_FOCUSED
|
||||
{ 0, 5, 0x4c6c74ff }, // DEFAULT_TEXT_COLOR_FOCUSED
|
||||
{ 0, 6, 0x3b5b5fff }, // DEFAULT_BORDER_COLOR_PRESSED
|
||||
{ 0, 7, 0xeaffffff }, // DEFAULT_BASE_COLOR_PRESSED
|
||||
{ 0, 8, 0x275057ff }, // DEFAULT_TEXT_COLOR_PRESSED
|
||||
{ 0, 9, 0x96aaacff }, // DEFAULT_BORDER_COLOR_DISABLED
|
||||
{ 0, 10, 0xc8d7d9ff }, // DEFAULT_BASE_COLOR_DISABLED
|
||||
{ 0, 11, 0x8c9c9eff }, // DEFAULT_TEXT_COLOR_DISABLED
|
||||
{ 0, 18, 0x84adb7ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, 0xe8eef1ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: (size: 10, spacing: 1)
|
||||
|
||||
#define BLUISH_COMPRESSED_DATA_SIZE 1423
|
||||
|
||||
// Font image pixels data compressed (DEFLATE)
|
||||
// NOTE: Original pixel data simplified to GRAYSCALE
|
||||
static unsigned char bluishFontData[BLUISH_COMPRESSED_DATA_SIZE] = { 0xed,
|
||||
0xdd, 0xd1, 0x72, 0x9b, 0x3a, 0x10, 0x00, 0x50, 0xc4, 0xff, 0x7f, 0x72, 0x41, 0x77, 0x1a, 0x3b, 0x99, 0xb9, 0x2d, 0x2b,
|
||||
0x58, 0x21, 0x08, 0x6d, 0x4f, 0xcf, 0xb4, 0x0f, 0x91, 0x51, 0x24, 0x2d, 0xe0, 0x34, 0x5a, 0x2f, 0x75, 0x02, 0x00, 0xf8,
|
||||
0xcd, 0x1c, 0x7c, 0x6d, 0x0e, 0x5f, 0x3d, 0x27, 0x7a, 0x7a, 0x7d, 0x7d, 0x6e, 0xb4, 0xe7, 0x7a, 0x9b, 0x13, 0x3d, 0xb4,
|
||||
0x5a, 0xda, 0x6d, 0xbf, 0x2a, 0x6f, 0x23, 0x56, 0x76, 0xfe, 0x5a, 0x8f, 0xed, 0x55, 0xca, 0xbc, 0x7e, 0x4e, 0xcd, 0x62,
|
||||
0x5b, 0x0d, 0xbe, 0xb6, 0x6e, 0xce, 0xb7, 0xd6, 0x12, 0xb4, 0xcc, 0xb5, 0x06, 0xe3, 0xa9, 0x1f, 0x47, 0x6d, 0xf7, 0xd8,
|
||||
0x3a, 0x6a, 0xeb, 0x7b, 0x2c, 0x1b, 0x7d, 0x2c, 0xe1, 0x59, 0xf1, 0xf3, 0x3b, 0x46, 0x2b, 0xb4, 0x06, 0xf1, 0xac, 0x9b,
|
||||
0xaf, 0x7d, 0x29, 0x87, 0x5e, 0xdd, 0xfa, 0x0e, 0xb5, 0x2e, 0x75, 0x79, 0xaf, 0xc7, 0xaf, 0xb3, 0xa8, 0xa9, 0xd7, 0xc7,
|
||||
0x2d, 0xe7, 0xe3, 0xbf, 0x7e, 0x8c, 0xa7, 0x6c, 0x5c, 0x07, 0x3f, 0xa3, 0xb5, 0x06, 0xf1, 0x8a, 0xc6, 0xf3, 0x5a, 0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 0x43, 0x13, 0xd7, 0x50, 0x98, 0x52, 0xaf, 0x8d, 0x9e, 0x49, 0xf4,
|
||||
0x67, 0xc6, 0x7f, 0x4a, 0xe6, 0xf6, 0xad, 0x07, 0xea, 0x65, 0x8c, 0xaa, 0xb1, 0x51, 0x3a, 0x32, 0x7c, 0x4a, 0xe3, 0xf9,
|
||||
0x63, 0xb9, 0xf8, 0x47, 0x4f, 0xab, 0x5b, 0x4f, 0x3e, 0xf9, 0xe9, 0x9a, 0x2a, 0x1b, 0xe3, 0x9f, 0x60, 0x33, 0xae, 0x9a,
|
||||
0xc7, 0xf8, 0x1a, 0x1b, 0xad, 0x9d, 0xf2, 0x38, 0xaf, 0x32, 0x17, 0xff, 0xab, 0x6a, 0x3b, 0x5c, 0x53, 0x65, 0xa3, 0xb7,
|
||||
0x42, 0x48, 0x4f, 0x6e, 0x4f, 0x79, 0x48, 0x8d, 0x8d, 0x6c, 0x85, 0x90, 0xf3, 0xf7, 0xff, 0xe7, 0xee, 0x54, 0xdf, 0x53,
|
||||
0x67, 0xa3, 0x27, 0x4f, 0xe7, 0xaa, 0x9d, 0xf9, 0xfc, 0xee, 0x7c, 0x26, 0xb7, 0x52, 0x65, 0x97, 0x51, 0x79, 0x3a, 0x4f,
|
||||
0xf2, 0x94, 0x67, 0x9e, 0xf1, 0xa4, 0x73, 0xda, 0x1a, 0xfc, 0xdb, 0x59, 0x5e, 0xd6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x2f,
|
||||
0xf0, 0x1f };
|
||||
|
||||
// Font characters rectangles data
|
||||
static const Rectangle bluishFontRecs[95] = {
|
||||
{ 4, 4, 5 , 10 },
|
||||
{ 17, 4, 2 , 8 },
|
||||
{ 27, 4, 4 , 3 },
|
||||
{ 39, 4, 6 , 8 },
|
||||
{ 53, 4, 5 , 10 },
|
||||
{ 66, 4, 6 , 8 },
|
||||
{ 80, 4, 5 , 10 },
|
||||
{ 93, 4, 2 , 3 },
|
||||
{ 103, 4, 3 , 8 },
|
||||
{ 114, 4, 3 , 8 },
|
||||
{ 125, 4, 6 , 6 },
|
||||
{ 139, 4, 6 , 6 },
|
||||
{ 153, 4, 2 , 3 },
|
||||
{ 163, 4, 5 , 2 },
|
||||
{ 176, 4, 2 , 2 },
|
||||
{ 186, 4, 6 , 8 },
|
||||
{ 200, 4, 5 , 8 },
|
||||
{ 213, 4, 3 , 8 },
|
||||
{ 224, 4, 5 , 8 },
|
||||
{ 237, 4, 5 , 8 },
|
||||
{ 4, 22, 5 , 8 },
|
||||
{ 17, 22, 5 , 8 },
|
||||
{ 30, 22, 5 , 8 },
|
||||
{ 43, 22, 5 , 8 },
|
||||
{ 56, 22, 5 , 8 },
|
||||
{ 69, 22, 5 , 8 },
|
||||
{ 82, 22, 2 , 8 },
|
||||
{ 92, 22, 2 , 9 },
|
||||
{ 102, 22, 4 , 6 },
|
||||
{ 114, 22, 5 , 4 },
|
||||
{ 127, 22, 4 , 6 },
|
||||
{ 139, 22, 5 , 8 },
|
||||
{ 152, 22, 6 , 8 },
|
||||
{ 166, 22, 5 , 8 },
|
||||
{ 179, 22, 5 , 8 },
|
||||
{ 192, 22, 5 , 8 },
|
||||
{ 205, 22, 5 , 8 },
|
||||
{ 218, 22, 5 , 8 },
|
||||
{ 231, 22, 5 , 8 },
|
||||
{ 4, 40, 5 , 8 },
|
||||
{ 17, 40, 5 , 8 },
|
||||
{ 30, 40, 4 , 8 },
|
||||
{ 42, 40, 5 , 8 },
|
||||
{ 55, 40, 5 , 8 },
|
||||
{ 68, 40, 5 , 8 },
|
||||
{ 81, 40, 8 , 8 },
|
||||
{ 97, 40, 5 , 8 },
|
||||
{ 110, 40, 5 , 8 },
|
||||
{ 123, 40, 5 , 8 },
|
||||
{ 136, 40, 5 , 9 },
|
||||
{ 149, 40, 5 , 8 },
|
||||
{ 162, 40, 5 , 8 },
|
||||
{ 175, 40, 6 , 8 },
|
||||
{ 189, 40, 5 , 8 },
|
||||
{ 202, 40, 5 , 8 },
|
||||
{ 215, 40, 8 , 8 },
|
||||
{ 231, 40, 5 , 8 },
|
||||
{ 4, 58, 5 , 8 },
|
||||
{ 17, 58, 5 , 8 },
|
||||
{ 30, 58, 3 , 8 },
|
||||
{ 41, 58, 6 , 8 },
|
||||
{ 55, 58, 3 , 8 },
|
||||
{ 66, 58, 6 , 4 },
|
||||
{ 80, 58, 5 , 1 },
|
||||
{ 93, 58, 2 , 3 },
|
||||
{ 103, 58, 5 , 6 },
|
||||
{ 116, 58, 5 , 8 },
|
||||
{ 129, 58, 5 , 6 },
|
||||
{ 142, 58, 5 , 8 },
|
||||
{ 155, 58, 5 , 6 },
|
||||
{ 168, 58, 5 , 8 },
|
||||
{ 181, 58, 5 , 7 },
|
||||
{ 194, 58, 5 , 8 },
|
||||
{ 207, 58, 2 , 8 },
|
||||
{ 217, 58, 3 , 9 },
|
||||
{ 228, 58, 5 , 8 },
|
||||
{ 241, 58, 2 , 8 },
|
||||
{ 4, 76, 8 , 6 },
|
||||
{ 20, 76, 5 , 6 },
|
||||
{ 33, 76, 5 , 6 },
|
||||
{ 46, 76, 5 , 7 },
|
||||
{ 59, 76, 5 , 7 },
|
||||
{ 72, 76, 5 , 6 },
|
||||
{ 85, 76, 5 , 6 },
|
||||
{ 98, 76, 5 , 8 },
|
||||
{ 111, 76, 5 , 6 },
|
||||
{ 124, 76, 5 , 6 },
|
||||
{ 137, 76, 8 , 6 },
|
||||
{ 153, 76, 5 , 6 },
|
||||
{ 166, 76, 5 , 7 },
|
||||
{ 179, 76, 5 , 6 },
|
||||
{ 192, 76, 4 , 8 },
|
||||
{ 204, 76, 2 , 10 },
|
||||
{ 214, 76, 4 , 8 },
|
||||
{ 226, 76, 6 , 4 },
|
||||
};
|
||||
|
||||
// Font characters info data
|
||||
// NOTE: No chars.image data provided
|
||||
static const GlyphInfo bluishFontChars[95] = {
|
||||
{ 32, 0, 9, 5, { 0 }},
|
||||
{ 33, 0, 1, 2, { 0 }},
|
||||
{ 34, 0, 1, 4, { 0 }},
|
||||
{ 35, 0, 1, 6, { 0 }},
|
||||
{ 36, 0, 0, 5, { 0 }},
|
||||
{ 37, 0, 1, 6, { 0 }},
|
||||
{ 38, 0, 0, 5, { 0 }},
|
||||
{ 39, 0, 1, 2, { 0 }},
|
||||
{ 40, 0, 1, 3, { 0 }},
|
||||
{ 41, 0, 1, 3, { 0 }},
|
||||
{ 42, 0, 1, 6, { 0 }},
|
||||
{ 43, 0, 2, 6, { 0 }},
|
||||
{ 44, 0, 7, 2, { 0 }},
|
||||
{ 45, 0, 4, 5, { 0 }},
|
||||
{ 46, 0, 7, 2, { 0 }},
|
||||
{ 47, 0, 1, 6, { 0 }},
|
||||
{ 48, 0, 1, 5, { 0 }},
|
||||
{ 49, 0, 1, 3, { 0 }},
|
||||
{ 50, 0, 1, 5, { 0 }},
|
||||
{ 51, 0, 1, 5, { 0 }},
|
||||
{ 52, 0, 1, 5, { 0 }},
|
||||
{ 53, 0, 1, 5, { 0 }},
|
||||
{ 54, 0, 1, 5, { 0 }},
|
||||
{ 55, 0, 1, 5, { 0 }},
|
||||
{ 56, 0, 1, 5, { 0 }},
|
||||
{ 57, 0, 1, 5, { 0 }},
|
||||
{ 58, 0, 1, 2, { 0 }},
|
||||
{ 59, 0, 1, 2, { 0 }},
|
||||
{ 60, 0, 2, 4, { 0 }},
|
||||
{ 61, 0, 3, 5, { 0 }},
|
||||
{ 62, 0, 2, 4, { 0 }},
|
||||
{ 63, 0, 1, 5, { 0 }},
|
||||
{ 64, 0, 1, 6, { 0 }},
|
||||
{ 65, 0, 1, 5, { 0 }},
|
||||
{ 66, 0, 1, 5, { 0 }},
|
||||
{ 67, 0, 1, 5, { 0 }},
|
||||
{ 68, 0, 1, 5, { 0 }},
|
||||
{ 69, 0, 1, 5, { 0 }},
|
||||
{ 70, 0, 1, 5, { 0 }},
|
||||
{ 71, 0, 1, 5, { 0 }},
|
||||
{ 72, 0, 1, 5, { 0 }},
|
||||
{ 73, 0, 1, 4, { 0 }},
|
||||
{ 74, 0, 1, 5, { 0 }},
|
||||
{ 75, 0, 1, 5, { 0 }},
|
||||
{ 76, 0, 1, 5, { 0 }},
|
||||
{ 77, 0, 1, 8, { 0 }},
|
||||
{ 78, 0, 1, 5, { 0 }},
|
||||
{ 79, 0, 1, 5, { 0 }},
|
||||
{ 80, 0, 1, 5, { 0 }},
|
||||
{ 81, 0, 1, 5, { 0 }},
|
||||
{ 82, 0, 1, 5, { 0 }},
|
||||
{ 83, 0, 1, 5, { 0 }},
|
||||
{ 84, 0, 1, 6, { 0 }},
|
||||
{ 85, 0, 1, 5, { 0 }},
|
||||
{ 86, 0, 1, 5, { 0 }},
|
||||
{ 87, 0, 1, 8, { 0 }},
|
||||
{ 88, 0, 1, 5, { 0 }},
|
||||
{ 89, 0, 1, 5, { 0 }},
|
||||
{ 90, 0, 1, 5, { 0 }},
|
||||
{ 91, 0, 1, 3, { 0 }},
|
||||
{ 92, 0, 1, 6, { 0 }},
|
||||
{ 93, 0, 1, 3, { 0 }},
|
||||
{ 94, 0, 1, 6, { 0 }},
|
||||
{ 95, 0, 9, 5, { 0 }},
|
||||
{ 96, 0, 1, 2, { 0 }},
|
||||
{ 97, 0, 3, 5, { 0 }},
|
||||
{ 98, 0, 1, 5, { 0 }},
|
||||
{ 99, 0, 3, 5, { 0 }},
|
||||
{ 100, 0, 1, 5, { 0 }},
|
||||
{ 101, 0, 3, 5, { 0 }},
|
||||
{ 102, 0, 1, 5, { 0 }},
|
||||
{ 103, 0, 3, 5, { 0 }},
|
||||
{ 104, 0, 1, 5, { 0 }},
|
||||
{ 105, 0, 1, 2, { 0 }},
|
||||
{ 106, 0, 1, 3, { 0 }},
|
||||
{ 107, 0, 1, 5, { 0 }},
|
||||
{ 108, 0, 1, 2, { 0 }},
|
||||
{ 109, 0, 3, 8, { 0 }},
|
||||
{ 110, 0, 3, 5, { 0 }},
|
||||
{ 111, 0, 3, 5, { 0 }},
|
||||
{ 112, 0, 3, 5, { 0 }},
|
||||
{ 113, 0, 3, 5, { 0 }},
|
||||
{ 114, 0, 3, 5, { 0 }},
|
||||
{ 115, 0, 3, 5, { 0 }},
|
||||
{ 116, 0, 1, 5, { 0 }},
|
||||
{ 117, 0, 3, 5, { 0 }},
|
||||
{ 118, 0, 3, 5, { 0 }},
|
||||
{ 119, 0, 3, 8, { 0 }},
|
||||
{ 120, 0, 3, 5, { 0 }},
|
||||
{ 121, 0, 3, 5, { 0 }},
|
||||
{ 122, 0, 3, 5, { 0 }},
|
||||
{ 123, 0, 1, 4, { 0 }},
|
||||
{ 124, 0, 0, 2, { 0 }},
|
||||
{ 125, 0, 1, 4, { 0 }},
|
||||
{ 126, 0, 3, 6, { 0 }},
|
||||
};
|
||||
|
||||
// Style loading function: bluish
|
||||
static void GuiLoadStyleBluish(void)
|
||||
{
|
||||
// Load style properties provided
|
||||
// NOTE: Default properties are propagated
|
||||
for (int i = 0; i < BLUISH_STYLE_PROPS_COUNT; i++)
|
||||
{
|
||||
GuiSetStyle(bluishStyleProps[i].controlId, bluishStyleProps[i].propertyId, bluishStyleProps[i].propertyValue);
|
||||
}
|
||||
|
||||
// Custom font loading
|
||||
// NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function
|
||||
int bluishFontDataSize = 0;
|
||||
unsigned char *data = DecompressData(bluishFontData, BLUISH_COMPRESSED_DATA_SIZE, &bluishFontDataSize);
|
||||
Image imFont = { data, 256, 256, 1, 2 };
|
||||
|
||||
Font font = { 0 };
|
||||
font.baseSize = 10;
|
||||
font.glyphCount = 95;
|
||||
|
||||
// Load texture from image
|
||||
font.texture = LoadTextureFromImage(imFont);
|
||||
UnloadImage(imFont); // Uncompressed data can be unloaded from memory
|
||||
|
||||
// Copy char recs data from global fontRecs
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle));
|
||||
memcpy(font.recs, bluishFontRecs, font.glyphCount*sizeof(Rectangle));
|
||||
|
||||
// Copy font char info data from global fontChars
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo));
|
||||
memcpy(font.glyphs, bluishFontChars, font.glyphCount*sizeof(GlyphInfo));
|
||||
|
||||
GuiSetFont(font);
|
||||
|
||||
// Setup a white rectangle on the font to be used on shapes drawing,
|
||||
// this way we make sure all gui can be drawn on a single pass because no texture change is required
|
||||
// NOTE: Setting up this rectangle is a manual process (for the moment)
|
||||
Rectangle whiteChar = { 66, 5, 2, 2 };
|
||||
SetShapesTexture(font.texture, whiteChar);
|
||||
}
|
340
examples/gui/style_selector/styles/style_cyber.h
Normal file
|
@ -0,0 +1,340 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// StyleAsCode exporter v1.2 - Style data exported as a values array //
|
||||
// //
|
||||
// USAGE: On init call: GuiLoadStyleCyber(); //
|
||||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raygui //
|
||||
// feedback and support: ray[at]raylibtech.com //
|
||||
// //
|
||||
// Copyright (c) 2020-2022 raylib technologies (@raylibtech) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define CYBER_STYLE_PROPS_COUNT 16
|
||||
|
||||
// Custom style name: cyber
|
||||
static const GuiStyleProp cyberStyleProps[CYBER_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 0, 0x2f7486ff }, // DEFAULT_BORDER_COLOR_NORMAL
|
||||
{ 0, 1, 0x024658ff }, // DEFAULT_BASE_COLOR_NORMAL
|
||||
{ 0, 2, 0x51bfd3ff }, // DEFAULT_TEXT_COLOR_NORMAL
|
||||
{ 0, 3, 0x82cde0ff }, // DEFAULT_BORDER_COLOR_FOCUSED
|
||||
{ 0, 4, 0x3299b4ff }, // DEFAULT_BASE_COLOR_FOCUSED
|
||||
{ 0, 5, 0xb6e1eaff }, // DEFAULT_TEXT_COLOR_FOCUSED
|
||||
{ 0, 6, 0xeb7630ff }, // DEFAULT_BORDER_COLOR_PRESSED
|
||||
{ 0, 7, 0xffbc51ff }, // DEFAULT_BASE_COLOR_PRESSED
|
||||
{ 0, 8, 0xd86f36ff }, // DEFAULT_TEXT_COLOR_PRESSED
|
||||
{ 0, 9, 0x134b5aff }, // DEFAULT_BORDER_COLOR_DISABLED
|
||||
{ 0, 10, 0x02313dff }, // DEFAULT_BASE_COLOR_DISABLED
|
||||
{ 0, 11, 0x17505fff }, // DEFAULT_TEXT_COLOR_DISABLED
|
||||
{ 0, 16, 0x0000000e }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, 0x81c0d0ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, 0x00222bff }, // DEFAULT_BACKGROUND_COLOR
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: (size: 14, spacing: 0)
|
||||
|
||||
#define CYBER_COMPRESSED_DATA_SIZE 1104
|
||||
|
||||
// Font image pixels data compressed (DEFLATE)
|
||||
// NOTE: Original pixel data simplified to GRAYSCALE
|
||||
static unsigned char cyberFontData[CYBER_COMPRESSED_DATA_SIZE] = { 0xed,
|
||||
0xdd, 0xe1,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, 0x1a,
|
||||
0x57, 0xc3, 0x9c, 0xd9, 0x96, 0xf5, 0xf5, 0x8a, 0x57, 0xdf, 0x85, 0xd5, 0x3f, 0x21, 0x31, 0xa3, 0xfe, 0x63, 0xab, 0x68,
|
||||
0x3e, 0xa7, 0x3d, 0x56, 0xec, 0x5d, 0x6e, 0x90, 0x41, 0xed, 0xeb, 0x25, 0x33, 0xfb, 0xff, 0xca, 0x7b, 0x0c, 0xf5, 0x5f,
|
||||
0xf1, 0xce, 0x57, 0xd4, 0x7f, 0xfb, 0x52, 0xe9, 0xcc, 0xf7, 0xcf, 0xa2, 0x4a, 0xda, 0x7e, 0xed, 0xbf, 0x40, 0x69, 0x05,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd9, 0xf3, 0x6e, 0x79, 0x42, 0x9a, 0xaa, 0x25, 0x4f, 0xd3, 0x96, 0x14, 0x39, 0x9e,
|
||||
0x5b, 0x32, 0xc3, 0xb4, 0xaa, 0xfe, 0x47, 0xdf, 0x54, 0xdc, 0x9e, 0x50, 0xcb, 0x92, 0x9f, 0xaa, 0xfd, 0x15, 0xf5, 0xdf,
|
||||
0x9a, 0x92, 0x6b, 0x99, 0x96, 0x7b, 0xbd, 0x53, 0x1e, 0xec, 0x7d, 0xce, 0x80, 0xfa, 0xea, 0x9d, 0xf5, 0xfe, 0x3f, 0x73,
|
||||
0x3d, 0x67, 0xf5, 0x5f, 0x93, 0xbf, 0x68, 0x5f, 0xbd, 0xb1, 0xb2, 0x4a, 0xed, 0xcc, 0x75, 0xdb, 0x9d, 0x01, 0xef, 0x96,
|
||||
0xef, 0xd2, 0xff, 0xbf, 0xea, 0xa7, 0x0b, 0xd5, 0x1f, 0xf5, 0x67, 0xfc, 0xf9, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
0x0f, 0xbf, 0x00 };
|
||||
|
||||
// Font characters rectangles data
|
||||
static const Rectangle cyberFontRecs[95] = {
|
||||
{ 4, 4, 4 , 14 },
|
||||
{ 16, 4, 1 , 8 },
|
||||
{ 25, 4, 4 , 3 },
|
||||
{ 37, 4, 8 , 8 },
|
||||
{ 53, 4, 8 , 9 },
|
||||
{ 69, 4, 8 , 8 },
|
||||
{ 85, 4, 8 , 8 },
|
||||
{ 101, 4, 1 , 3 },
|
||||
{ 110, 4, 4 , 9 },
|
||||
{ 122, 4, 4 , 9 },
|
||||
{ 134, 4, 5 , 6 },
|
||||
{ 147, 4, 5 , 6 },
|
||||
{ 160, 4, 2 , 2 },
|
||||
{ 170, 4, 4 , 1 },
|
||||
{ 182, 4, 1 , 1 },
|
||||
{ 191, 4, 8 , 8 },
|
||||
{ 207, 4, 8 , 8 },
|
||||
{ 223, 4, 2 , 8 },
|
||||
{ 233, 4, 8 , 8 },
|
||||
{ 4, 26, 8 , 8 },
|
||||
{ 20, 26, 8 , 8 },
|
||||
{ 36, 26, 8 , 8 },
|
||||
{ 52, 26, 8 , 8 },
|
||||
{ 68, 26, 7 , 8 },
|
||||
{ 83, 26, 8 , 8 },
|
||||
{ 99, 26, 8 , 8 },
|
||||
{ 115, 26, 1 , 4 },
|
||||
{ 124, 26, 2 , 5 },
|
||||
{ 134, 26, 4 , 8 },
|
||||
{ 146, 26, 5 , 3 },
|
||||
{ 159, 26, 4 , 8 },
|
||||
{ 171, 26, 7 , 8 },
|
||||
{ 186, 26, 8 , 8 },
|
||||
{ 202, 26, 8 , 8 },
|
||||
{ 218, 26, 8 , 8 },
|
||||
{ 234, 26, 8 , 8 },
|
||||
{ 4, 48, 8 , 8 },
|
||||
{ 20, 48, 7 , 8 },
|
||||
{ 35, 48, 7 , 8 },
|
||||
{ 50, 48, 8 , 8 },
|
||||
{ 66, 48, 8 , 8 },
|
||||
{ 82, 48, 5 , 8 },
|
||||
{ 95, 48, 7 , 8 },
|
||||
{ 110, 48, 8 , 8 },
|
||||
{ 126, 48, 7 , 8 },
|
||||
{ 141, 48, 8 , 8 },
|
||||
{ 157, 48, 8 , 8 },
|
||||
{ 173, 48, 8 , 8 },
|
||||
{ 189, 48, 8 , 8 },
|
||||
{ 205, 48, 8 , 9 },
|
||||
{ 221, 48, 8 , 8 },
|
||||
{ 237, 48, 8 , 8 },
|
||||
{ 4, 70, 8 , 8 },
|
||||
{ 20, 70, 8 , 8 },
|
||||
{ 36, 70, 8 , 8 },
|
||||
{ 52, 70, 9 , 8 },
|
||||
{ 69, 70, 8 , 8 },
|
||||
{ 85, 70, 8 , 8 },
|
||||
{ 101, 70, 8 , 8 },
|
||||
{ 117, 70, 4 , 9 },
|
||||
{ 129, 70, 8 , 8 },
|
||||
{ 145, 70, 4 , 9 },
|
||||
{ 157, 70, 4 , 3 },
|
||||
{ 169, 70, 7 , 1 },
|
||||
{ 184, 70, 2 , 3 },
|
||||
{ 194, 70, 7 , 5 },
|
||||
{ 209, 70, 7 , 8 },
|
||||
{ 224, 70, 7 , 5 },
|
||||
{ 239, 70, 7 , 8 },
|
||||
{ 4, 92, 7 , 5 },
|
||||
{ 19, 92, 4 , 8 },
|
||||
{ 31, 92, 7 , 7 },
|
||||
{ 46, 92, 7 , 8 },
|
||||
{ 61, 92, 1 , 8 },
|
||||
{ 70, 92, 3 , 10 },
|
||||
{ 81, 92, 7 , 8 },
|
||||
{ 96, 92, 4 , 8 },
|
||||
{ 108, 92, 9 , 5 },
|
||||
{ 125, 92, 7 , 5 },
|
||||
{ 140, 92, 7 , 5 },
|
||||
{ 155, 92, 7 , 7 },
|
||||
{ 170, 92, 7 , 7 },
|
||||
{ 185, 92, 5 , 5 },
|
||||
{ 198, 92, 7 , 5 },
|
||||
{ 213, 92, 5 , 8 },
|
||||
{ 226, 92, 7 , 5 },
|
||||
{ 4, 114, 7 , 5 },
|
||||
{ 19, 114, 9 , 5 },
|
||||
{ 36, 114, 7 , 5 },
|
||||
{ 51, 114, 7 , 7 },
|
||||
{ 66, 114, 7 , 5 },
|
||||
{ 81, 114, 4 , 9 },
|
||||
{ 93, 114, 1 , 9 },
|
||||
{ 102, 114, 4 , 9 },
|
||||
{ 114, 114, 8 , 2 },
|
||||
};
|
||||
|
||||
// Font characters info data
|
||||
// NOTE: No chars.image data provided
|
||||
static const GlyphInfo cyberFontChars[95] = {
|
||||
{ 32, 0, 11, 4, { 0 }},
|
||||
{ 33, 0, 3, 2, { 0 }},
|
||||
{ 34, 0, 3, 4, { 0 }},
|
||||
{ 35, 0, 3, 8, { 0 }},
|
||||
{ 36, 0, 3, 8, { 0 }},
|
||||
{ 37, 0, 3, 8, { 0 }},
|
||||
{ 38, 0, 3, 8, { 0 }},
|
||||
{ 39, 0, 3, 2, { 0 }},
|
||||
{ 40, 0, 3, 4, { 0 }},
|
||||
{ 41, 0, 3, 4, { 0 }},
|
||||
{ 42, 0, 4, 6, { 0 }},
|
||||
{ 43, 0, 4, 6, { 0 }},
|
||||
{ 44, 0, 10, 3, { 0 }},
|
||||
{ 45, 0, 7, 5, { 0 }},
|
||||
{ 46, 0, 10, 2, { 0 }},
|
||||
{ 47, 0, 3, 8, { 0 }},
|
||||
{ 48, 0, 3, 8, { 0 }},
|
||||
{ 49, 0, 3, 3, { 0 }},
|
||||
{ 50, 0, 3, 8, { 0 }},
|
||||
{ 51, 0, 3, 8, { 0 }},
|
||||
{ 52, 0, 3, 8, { 0 }},
|
||||
{ 53, 0, 3, 8, { 0 }},
|
||||
{ 54, 0, 3, 8, { 0 }},
|
||||
{ 55, 0, 3, 7, { 0 }},
|
||||
{ 56, 0, 3, 8, { 0 }},
|
||||
{ 57, 0, 3, 8, { 0 }},
|
||||
{ 58, 0, 6, 2, { 0 }},
|
||||
{ 59, 0, 6, 3, { 0 }},
|
||||
{ 60, 0, 3, 5, { 0 }},
|
||||
{ 61, 0, 6, 6, { 0 }},
|
||||
{ 62, 0, 3, 5, { 0 }},
|
||||
{ 63, 0, 3, 7, { 0 }},
|
||||
{ 64, 0, 3, 8, { 0 }},
|
||||
{ 65, 0, 3, 8, { 0 }},
|
||||
{ 66, 0, 3, 8, { 0 }},
|
||||
{ 67, 0, 3, 8, { 0 }},
|
||||
{ 68, 0, 3, 8, { 0 }},
|
||||
{ 69, 0, 3, 7, { 0 }},
|
||||
{ 70, 0, 3, 7, { 0 }},
|
||||
{ 71, 0, 3, 8, { 0 }},
|
||||
{ 72, 0, 3, 8, { 0 }},
|
||||
{ 73, 0, 3, 6, { 0 }},
|
||||
{ 74, 0, 3, 7, { 0 }},
|
||||
{ 75, 0, 3, 8, { 0 }},
|
||||
{ 76, 0, 3, 7, { 0 }},
|
||||
{ 77, 0, 3, 9, { 0 }},
|
||||
{ 78, 0, 3, 8, { 0 }},
|
||||
{ 79, 0, 3, 8, { 0 }},
|
||||
{ 80, 0, 3, 8, { 0 }},
|
||||
{ 81, 0, 3, 8, { 0 }},
|
||||
{ 82, 0, 3, 8, { 0 }},
|
||||
{ 83, 0, 3, 8, { 0 }},
|
||||
{ 84, 0, 3, 8, { 0 }},
|
||||
{ 85, 0, 3, 8, { 0 }},
|
||||
{ 86, 0, 3, 8, { 0 }},
|
||||
{ 87, 0, 3, 10, { 0 }},
|
||||
{ 88, 0, 3, 8, { 0 }},
|
||||
{ 89, 0, 3, 8, { 0 }},
|
||||
{ 90, 0, 3, 8, { 0 }},
|
||||
{ 91, 0, 3, 4, { 0 }},
|
||||
{ 92, 0, 3, 8, { 0 }},
|
||||
{ 93, 0, 3, 4, { 0 }},
|
||||
{ 94, 0, 3, 4, { 0 }},
|
||||
{ 95, 0, 11, 7, { 0 }},
|
||||
{ 96, 0, 3, 3, { 0 }},
|
||||
{ 97, 0, 6, 7, { 0 }},
|
||||
{ 98, 0, 3, 7, { 0 }},
|
||||
{ 99, 0, 6, 7, { 0 }},
|
||||
{ 100, 0, 3, 7, { 0 }},
|
||||
{ 101, 0, 6, 7, { 0 }},
|
||||
{ 102, 0, 3, 5, { 0 }},
|
||||
{ 103, 0, 6, 7, { 0 }},
|
||||
{ 104, 0, 3, 7, { 0 }},
|
||||
{ 105, 0, 3, 2, { 0 }},
|
||||
{ 106, -2, 3, 2, { 0 }},
|
||||
{ 107, 0, 3, 7, { 0 }},
|
||||
{ 108, 0, 3, 4, { 0 }},
|
||||
{ 109, 0, 6, 10, { 0 }},
|
||||
{ 110, 0, 6, 7, { 0 }},
|
||||
{ 111, 0, 6, 7, { 0 }},
|
||||
{ 112, 0, 6, 7, { 0 }},
|
||||
{ 113, 0, 6, 7, { 0 }},
|
||||
{ 114, 0, 6, 6, { 0 }},
|
||||
{ 115, 0, 6, 7, { 0 }},
|
||||
{ 116, 0, 3, 6, { 0 }},
|
||||
{ 117, 0, 6, 7, { 0 }},
|
||||
{ 118, 0, 6, 7, { 0 }},
|
||||
{ 119, 0, 6, 10, { 0 }},
|
||||
{ 120, 0, 6, 7, { 0 }},
|
||||
{ 121, 0, 6, 7, { 0 }},
|
||||
{ 122, 0, 6, 7, { 0 }},
|
||||
{ 123, 0, 3, 5, { 0 }},
|
||||
{ 124, 0, 3, 2, { 0 }},
|
||||
{ 125, 0, 3, 5, { 0 }},
|
||||
{ 126, 0, 6, 8, { 0 }},
|
||||
};
|
||||
|
||||
// Style loading function: cyber
|
||||
static void GuiLoadStyleCyber(void)
|
||||
{
|
||||
// Load style properties provided
|
||||
// NOTE: Default properties are propagated
|
||||
for (int i = 0; i < CYBER_STYLE_PROPS_COUNT; i++)
|
||||
{
|
||||
GuiSetStyle(cyberStyleProps[i].controlId, cyberStyleProps[i].propertyId, cyberStyleProps[i].propertyValue);
|
||||
}
|
||||
|
||||
// Custom font loading
|
||||
// NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function
|
||||
int cyberFontDataSize = 0;
|
||||
unsigned char *data = DecompressData(cyberFontData, CYBER_COMPRESSED_DATA_SIZE, &cyberFontDataSize);
|
||||
Image imFont = { data, 256, 256, 1, 2 };
|
||||
|
||||
Font font = { 0 };
|
||||
font.baseSize = 14;
|
||||
font.glyphCount = 95;
|
||||
|
||||
// Load texture from image
|
||||
font.texture = LoadTextureFromImage(imFont);
|
||||
UnloadImage(imFont); // Uncompressed data can be unloaded from memory
|
||||
|
||||
// Copy char recs data from global fontRecs
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle));
|
||||
memcpy(font.recs, cyberFontRecs, font.glyphCount*sizeof(Rectangle));
|
||||
|
||||
// Copy font char info data from global fontChars
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo));
|
||||
memcpy(font.glyphs, cyberFontChars, font.glyphCount*sizeof(GlyphInfo));
|
||||
|
||||
GuiSetFont(font);
|
||||
|
||||
// Setup a white rectangle on the font to be used on shapes drawing,
|
||||
// this way we make sure all gui can be drawn on a single pass because no texture change is required
|
||||
// NOTE: Setting up this rectangle is a manual process (for the moment)
|
||||
Rectangle whiteChar = { 89, 9, 2, 2 };
|
||||
SetShapesTexture(font.texture, whiteChar);
|
||||
}
|
347
examples/gui/style_selector/styles/style_dark.h
Normal file
|
@ -0,0 +1,347 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// StyleAsCode exporter v1.2 - Style data exported as a values array //
|
||||
// //
|
||||
// USAGE: On init call: GuiLoadStyleDark(); //
|
||||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raygui //
|
||||
// feedback and support: ray[at]raylibtech.com //
|
||||
// //
|
||||
// Copyright (c) 2020-2022 raylib technologies (@raylibtech) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define DARK_STYLE_PROPS_COUNT 22
|
||||
|
||||
// Custom style name: dark
|
||||
static const GuiStyleProp darkStyleProps[DARK_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 0, 0x878787ff }, // DEFAULT_BORDER_COLOR_NORMAL
|
||||
{ 0, 1, 0x2c2c2cff }, // DEFAULT_BASE_COLOR_NORMAL
|
||||
{ 0, 2, 0xc3c3c3ff }, // DEFAULT_TEXT_COLOR_NORMAL
|
||||
{ 0, 3, 0xe1e1e1ff }, // DEFAULT_BORDER_COLOR_FOCUSED
|
||||
{ 0, 4, 0x848484ff }, // DEFAULT_BASE_COLOR_FOCUSED
|
||||
{ 0, 5, 0x181818ff }, // DEFAULT_TEXT_COLOR_FOCUSED
|
||||
{ 0, 6, 0x000000ff }, // DEFAULT_BORDER_COLOR_PRESSED
|
||||
{ 0, 7, 0xefefefff }, // DEFAULT_BASE_COLOR_PRESSED
|
||||
{ 0, 8, 0x202020ff }, // DEFAULT_TEXT_COLOR_PRESSED
|
||||
{ 0, 9, 0x6a6a6aff }, // DEFAULT_BORDER_COLOR_DISABLED
|
||||
{ 0, 10, 0x818181ff }, // DEFAULT_BASE_COLOR_DISABLED
|
||||
{ 0, 11, 0x606060ff }, // DEFAULT_TEXT_COLOR_DISABLED
|
||||
{ 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, 0x9d9d9dff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, 0x3c3c3cff }, // DEFAULT_BACKGROUND_COLOR
|
||||
{ 1, 5, 0xf7f7f7ff }, // LABEL_TEXT_COLOR_FOCUSED
|
||||
{ 1, 8, 0x898989ff }, // LABEL_TEXT_COLOR_PRESSED
|
||||
{ 4, 5, 0xb0b0b0ff }, // SLIDER_TEXT_COLOR_FOCUSED
|
||||
{ 5, 5, 0x848484ff }, // PROGRESSBAR_TEXT_COLOR_FOCUSED
|
||||
{ 9, 5, 0xf5f5f5ff }, // TEXTBOX_TEXT_COLOR_FOCUSED
|
||||
{ 10, 5, 0xf6f6f6ff }, // VALUEBOX_TEXT_COLOR_FOCUSED
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: PixelOperator.ttf (size: 16, spacing: 0)
|
||||
|
||||
#define DARK_COMPRESSED_DATA_SIZE 1031
|
||||
|
||||
// Font image pixels data compressed (DEFLATE)
|
||||
// NOTE: Original pixel data simplified to GRAYSCALE
|
||||
static unsigned char darkFontData[DARK_COMPRESSED_DATA_SIZE] = { 0xed,
|
||||
0xdd, 0xd1, 0x76, 0x9b, 0x30, 0x0c, 0x00, 0x50, 0xff, 0xff, 0x4f, 0x6b, 0x4f, 0x3b, 0xeb, 0xb6, 0x16, 0x90, 0x90, 0x8d,
|
||||
0x93, 0xdc, 0xdd, 0x97, 0x9d, 0x36, 0x25, 0xc4, 0xc2, 0xc6, 0x04, 0xc9, 0xc4, 0x00, 0x00, 0xf8, 0x47, 0x7c, 0xfb, 0x93,
|
||||
0xf8, 0xf1, 0x95, 0x71, 0x79, 0x3b, 0xc7, 0x3f, 0xff, 0xfd, 0xdb, 0x38, 0x78, 0xaf, 0x6b, 0xfb, 0x9a, 0x7d, 0xdf, 0x48,
|
||||
0xb4, 0xc4, 0xf7, 0xfb, 0x17, 0x97, 0xb7, 0xfb, 0xd3, 0xe7, 0xcb, 0xbf, 0xfe, 0x68, 0x4b, 0xe7, 0xed, 0xfc, 0x54, 0xfc,
|
||||
0xe3, 0x52, 0x24, 0xe2, 0x62, 0xdb, 0x5c, 0x6f, 0xc5, 0xa3, 0x77, 0x8e, 0xe6, 0x16, 0x3c, 0x3f, 0x3a, 0x7f, 0x8a, 0x74,
|
||||
0xbe, 0x3d, 0xe2, 0xa0, 0x1f, 0xcd, 0x8d, 0xff, 0xd7, 0x7f, 0xb9, 0x7e, 0x1c,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 0x08, 0xe0, 0xe9, 0x51, 0x8c, 0xf7, 0x3a, 0x02, 0x54, 0xe0,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x36, 0xbb, 0xe3, 0x7e, 0x9c, 0xa5, 0x13, 0x2d, 0x19, 0x37, 0xbb, 0xaf, 0xa5,
|
||||
0x3f, 0x4e, 0xd6, 0xa7, 0xbd, 0x96, 0xdb, 0x15, 0xdb, 0xde, 0x0f, 0xae, 0xb6, 0x7f, 0x57, 0xfe, 0xf4, 0xee, 0x6b, 0xe9,
|
||||
0xdf, 0x5f, 0x93, 0x33, 0x4e, 0x8e, 0x8e, 0x57, 0x8c, 0x7f, 0x25, 0x67, 0xf4, 0xf9, 0xb5, 0x94, 0xa3, 0x94, 0xf1, 0x1a,
|
||||
0x9b, 0xe7, 0xcc, 0xed, 0x94, 0x8b, 0xbd, 0x72, 0xfc, 0x8f, 0x72, 0x74, 0xa2, 0x21, 0x0f, 0x5a, 0xfc, 0x47, 0xba, 0x16,
|
||||
0x6f, 0xe7, 0xfe, 0xff, 0xc4, 0xda, 0xeb, 0xef, 0x17, 0xff, 0xce, 0x8a, 0xab, 0x19, 0x6b, 0x69, 0xe7, 0xab, 0x3b, 0xdf,
|
||||
0xbf, 0xff, 0x57, 0xe7, 0xff, 0x3d, 0xe3, 0xff, 0xea, 0xb5, 0xb4, 0xf3, 0xf3, 0xff, 0xcf, 0x18, 0xff, 0xef, 0xbc, 0x22,
|
||||
0x73, 0xac, 0xbd, 0x5e, 0x5e, 0xae, 0xf8, 0x7f, 0x7a, 0x5e, 0xee, 0xdd, 0xeb, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x46, 0xbf, 0x00 };
|
||||
|
||||
// Font characters rectangles data
|
||||
static const Rectangle darkFontRecs[95] = {
|
||||
{ 4, 4, 4 , 16 },
|
||||
{ 16, 4, 1 , 9 },
|
||||
{ 25, 4, 3 , 3 },
|
||||
{ 36, 4, 6 , 9 },
|
||||
{ 50, 4, 5 , 13 },
|
||||
{ 63, 4, 7 , 9 },
|
||||
{ 78, 4, 5 , 9 },
|
||||
{ 91, 4, 1 , 3 },
|
||||
{ 100, 4, 3 , 9 },
|
||||
{ 111, 4, 3 , 9 },
|
||||
{ 122, 4, 5 , 5 },
|
||||
{ 135, 4, 5 , 5 },
|
||||
{ 148, 4, 2 , 3 },
|
||||
{ 158, 4, 4 , 1 },
|
||||
{ 170, 4, 1 , 1 },
|
||||
{ 179, 4, 3 , 9 },
|
||||
{ 190, 4, 5 , 9 },
|
||||
{ 203, 4, 3 , 9 },
|
||||
{ 214, 4, 5 , 9 },
|
||||
{ 227, 4, 5 , 9 },
|
||||
{ 240, 4, 5 , 9 },
|
||||
{ 4, 28, 5 , 9 },
|
||||
{ 17, 28, 5 , 9 },
|
||||
{ 30, 28, 5 , 9 },
|
||||
{ 43, 28, 5 , 9 },
|
||||
{ 56, 28, 5 , 9 },
|
||||
{ 69, 28, 1 , 7 },
|
||||
{ 78, 28, 2 , 9 },
|
||||
{ 88, 28, 3 , 5 },
|
||||
{ 99, 28, 4 , 3 },
|
||||
{ 111, 28, 3 , 5 },
|
||||
{ 122, 28, 5 , 9 },
|
||||
{ 135, 28, 7 , 9 },
|
||||
{ 150, 28, 5 , 9 },
|
||||
{ 163, 28, 5 , 9 },
|
||||
{ 176, 28, 5 , 9 },
|
||||
{ 189, 28, 5 , 9 },
|
||||
{ 202, 28, 5 , 9 },
|
||||
{ 215, 28, 5 , 9 },
|
||||
{ 228, 28, 5 , 9 },
|
||||
{ 241, 28, 5 , 9 },
|
||||
{ 4, 52, 1 , 9 },
|
||||
{ 13, 52, 5 , 9 },
|
||||
{ 26, 52, 5 , 9 },
|
||||
{ 39, 52, 5 , 9 },
|
||||
{ 52, 52, 7 , 9 },
|
||||
{ 67, 52, 5 , 9 },
|
||||
{ 80, 52, 5 , 9 },
|
||||
{ 93, 52, 5 , 9 },
|
||||
{ 106, 52, 5 , 9 },
|
||||
{ 119, 52, 5 , 9 },
|
||||
{ 132, 52, 5 , 9 },
|
||||
{ 145, 52, 5 , 9 },
|
||||
{ 158, 52, 5 , 9 },
|
||||
{ 171, 52, 5 , 9 },
|
||||
{ 184, 52, 7 , 9 },
|
||||
{ 199, 52, 5 , 9 },
|
||||
{ 212, 52, 5 , 9 },
|
||||
{ 225, 52, 5 , 9 },
|
||||
{ 238, 52, 3 , 9 },
|
||||
{ 4, 76, 3 , 9 },
|
||||
{ 15, 76, 3 , 9 },
|
||||
{ 26, 76, 5 , 3 },
|
||||
{ 39, 76, 5 , 1 },
|
||||
{ 52, 76, 2 , 2 },
|
||||
{ 62, 76, 5 , 7 },
|
||||
{ 75, 76, 5 , 9 },
|
||||
{ 88, 76, 5 , 7 },
|
||||
{ 101, 76, 5 , 9 },
|
||||
{ 114, 76, 5 , 7 },
|
||||
{ 127, 76, 4 , 9 },
|
||||
{ 139, 76, 5 , 9 },
|
||||
{ 152, 76, 5 , 9 },
|
||||
{ 165, 76, 1 , 9 },
|
||||
{ 174, 76, 5 , 11 },
|
||||
{ 187, 76, 5 , 9 },
|
||||
{ 200, 76, 2 , 9 },
|
||||
{ 210, 76, 7 , 7 },
|
||||
{ 225, 76, 5 , 7 },
|
||||
{ 238, 76, 5 , 7 },
|
||||
{ 4, 100, 5 , 9 },
|
||||
{ 17, 100, 5 , 9 },
|
||||
{ 30, 100, 5 , 7 },
|
||||
{ 43, 100, 5 , 7 },
|
||||
{ 56, 100, 4 , 8 },
|
||||
{ 68, 100, 5 , 7 },
|
||||
{ 81, 100, 5 , 7 },
|
||||
{ 94, 100, 7 , 7 },
|
||||
{ 109, 100, 5 , 7 },
|
||||
{ 122, 100, 5 , 9 },
|
||||
{ 135, 100, 5 , 7 },
|
||||
{ 148, 100, 4 , 9 },
|
||||
{ 160, 100, 1 , 9 },
|
||||
{ 169, 100, 4 , 9 },
|
||||
{ 181, 100, 6 , 2 },
|
||||
};
|
||||
|
||||
// Font glyphs info data
|
||||
// NOTE: No glyphs.image data provided
|
||||
static const GlyphInfo darkFontChars[95] = {
|
||||
{ 32, 0, 13, 4, { 0 }},
|
||||
{ 33, 2, 4, 5, { 0 }},
|
||||
{ 34, 2, 4, 7, { 0 }},
|
||||
{ 35, 1, 4, 8, { 0 }},
|
||||
{ 36, 1, 2, 7, { 0 }},
|
||||
{ 37, 1, 4, 9, { 0 }},
|
||||
{ 38, 1, 4, 7, { 0 }},
|
||||
{ 39, 2, 4, 5, { 0 }},
|
||||
{ 40, 3, 4, 7, { 0 }},
|
||||
{ 41, 1, 4, 7, { 0 }},
|
||||
{ 42, 1, 4, 7, { 0 }},
|
||||
{ 43, 1, 6, 7, { 0 }},
|
||||
{ 44, 1, 12, 5, { 0 }},
|
||||
{ 45, 1, 8, 6, { 0 }},
|
||||
{ 46, 2, 12, 5, { 0 }},
|
||||
{ 47, 1, 4, 5, { 0 }},
|
||||
{ 48, 1, 4, 7, { 0 }},
|
||||
{ 49, 2, 4, 7, { 0 }},
|
||||
{ 50, 1, 4, 7, { 0 }},
|
||||
{ 51, 1, 4, 7, { 0 }},
|
||||
{ 52, 1, 4, 7, { 0 }},
|
||||
{ 53, 1, 4, 7, { 0 }},
|
||||
{ 54, 1, 4, 7, { 0 }},
|
||||
{ 55, 1, 4, 7, { 0 }},
|
||||
{ 56, 1, 4, 7, { 0 }},
|
||||
{ 57, 1, 4, 7, { 0 }},
|
||||
{ 58, 2, 6, 5, { 0 }},
|
||||
{ 59, 1, 6, 5, { 0 }},
|
||||
{ 60, 1, 6, 5, { 0 }},
|
||||
{ 61, 1, 7, 6, { 0 }},
|
||||
{ 62, 1, 6, 5, { 0 }},
|
||||
{ 63, 1, 4, 7, { 0 }},
|
||||
{ 64, 1, 4, 9, { 0 }},
|
||||
{ 65, 1, 4, 7, { 0 }},
|
||||
{ 66, 1, 4, 7, { 0 }},
|
||||
{ 67, 1, 4, 7, { 0 }},
|
||||
{ 68, 1, 4, 7, { 0 }},
|
||||
{ 69, 1, 4, 7, { 0 }},
|
||||
{ 70, 1, 4, 7, { 0 }},
|
||||
{ 71, 1, 4, 7, { 0 }},
|
||||
{ 72, 1, 4, 7, { 0 }},
|
||||
{ 73, 2, 4, 5, { 0 }},
|
||||
{ 74, 1, 4, 7, { 0 }},
|
||||
{ 75, 1, 4, 7, { 0 }},
|
||||
{ 76, 1, 4, 7, { 0 }},
|
||||
{ 77, 1, 4, 9, { 0 }},
|
||||
{ 78, 1, 4, 7, { 0 }},
|
||||
{ 79, 1, 4, 7, { 0 }},
|
||||
{ 80, 1, 4, 7, { 0 }},
|
||||
{ 81, 1, 4, 7, { 0 }},
|
||||
{ 82, 1, 4, 7, { 0 }},
|
||||
{ 83, 1, 4, 7, { 0 }},
|
||||
{ 84, 1, 4, 7, { 0 }},
|
||||
{ 85, 1, 4, 7, { 0 }},
|
||||
{ 86, 1, 4, 7, { 0 }},
|
||||
{ 87, 1, 4, 9, { 0 }},
|
||||
{ 88, 1, 4, 7, { 0 }},
|
||||
{ 89, 1, 4, 7, { 0 }},
|
||||
{ 90, 1, 4, 7, { 0 }},
|
||||
{ 91, 3, 4, 7, { 0 }},
|
||||
{ 92, 1, 4, 5, { 0 }},
|
||||
{ 93, 1, 4, 7, { 0 }},
|
||||
{ 94, 1, 4, 7, { 0 }},
|
||||
{ 95, 0, 14, 5, { 0 }},
|
||||
{ 96, 1, 4, 5, { 0 }},
|
||||
{ 97, 1, 6, 7, { 0 }},
|
||||
{ 98, 1, 4, 7, { 0 }},
|
||||
{ 99, 1, 6, 7, { 0 }},
|
||||
{ 100, 1, 4, 7, { 0 }},
|
||||
{ 101, 1, 6, 7, { 0 }},
|
||||
{ 102, 1, 4, 6, { 0 }},
|
||||
{ 103, 1, 6, 7, { 0 }},
|
||||
{ 104, 1, 4, 7, { 0 }},
|
||||
{ 105, 2, 4, 5, { 0 }},
|
||||
{ 106, 1, 4, 7, { 0 }},
|
||||
{ 107, 1, 4, 7, { 0 }},
|
||||
{ 108, 2, 4, 5, { 0 }},
|
||||
{ 109, 1, 6, 9, { 0 }},
|
||||
{ 110, 1, 6, 7, { 0 }},
|
||||
{ 111, 1, 6, 7, { 0 }},
|
||||
{ 112, 1, 6, 7, { 0 }},
|
||||
{ 113, 1, 6, 7, { 0 }},
|
||||
{ 114, 1, 6, 7, { 0 }},
|
||||
{ 115, 1, 6, 7, { 0 }},
|
||||
{ 116, 1, 5, 6, { 0 }},
|
||||
{ 117, 1, 6, 7, { 0 }},
|
||||
{ 118, 1, 6, 7, { 0 }},
|
||||
{ 119, 1, 6, 9, { 0 }},
|
||||
{ 120, 1, 6, 7, { 0 }},
|
||||
{ 121, 1, 6, 7, { 0 }},
|
||||
{ 122, 1, 6, 7, { 0 }},
|
||||
{ 123, 2, 4, 7, { 0 }},
|
||||
{ 124, 2, 4, 5, { 0 }},
|
||||
{ 125, 1, 4, 7, { 0 }},
|
||||
{ 126, 1, 4, 8, { 0 }},
|
||||
};
|
||||
|
||||
// Style loading function: dark
|
||||
static void GuiLoadStyleDark(void)
|
||||
{
|
||||
// Load style properties provided
|
||||
// NOTE: Default properties are propagated
|
||||
for (int i = 0; i < DARK_STYLE_PROPS_COUNT; i++)
|
||||
{
|
||||
GuiSetStyle(darkStyleProps[i].controlId, darkStyleProps[i].propertyId, darkStyleProps[i].propertyValue);
|
||||
}
|
||||
|
||||
// Custom font loading
|
||||
// NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function
|
||||
int darkFontDataSize = 0;
|
||||
unsigned char *data = DecompressData(darkFontData, DARK_COMPRESSED_DATA_SIZE, &darkFontDataSize);
|
||||
Image imFont = { data, 256, 256, 1, 2 };
|
||||
|
||||
Font font = { 0 };
|
||||
font.baseSize = 16;
|
||||
font.glyphCount = 95;
|
||||
|
||||
// Load texture from image
|
||||
font.texture = LoadTextureFromImage(imFont);
|
||||
UnloadImage(imFont); // Uncompressed data can be unloaded from memory
|
||||
|
||||
// Copy char recs data from global fontRecs
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle));
|
||||
memcpy(font.recs, darkFontRecs, font.glyphCount*sizeof(Rectangle));
|
||||
|
||||
// Copy font char info data from global fontChars
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo));
|
||||
memcpy(font.glyphs, darkFontChars, font.glyphCount*sizeof(GlyphInfo));
|
||||
|
||||
GuiSetFont(font);
|
||||
|
||||
// TODO: Setup a white rectangle on the font to be used on shapes drawing,
|
||||
// this way we make sure all gui can be drawn on a single pass because no texture change is required
|
||||
// NOTE: Setting up this rectangle is a manual process (for the moment)
|
||||
Rectangle whiteChar = { 124, 6, 1, 1 };
|
||||
SetShapesTexture(font.texture, whiteChar);
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
// TODO: Custom user style setup: Set specific properties here (if required)
|
||||
// i.e. Controls specific BORDER_WIDTH, TEXT_PADDING, TEXT_ALIGNMENT
|
||||
}
|
337
examples/gui/style_selector/styles/style_jungle.h
Normal file
|
@ -0,0 +1,337 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// StyleAsCode exporter v1.2 - Style data exported as a values array //
|
||||
// //
|
||||
// USAGE: On init call: GuiLoadStyleJungle(); //
|
||||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raygui //
|
||||
// feedback and support: ray[at]raylibtech.com //
|
||||
// //
|
||||
// Copyright (c) 2020-2022 raylib technologies (@raylibtech) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define JUNGLE_STYLE_PROPS_COUNT 16
|
||||
|
||||
// Custom style name: jungle
|
||||
static const GuiStyleProp jungleStyleProps[JUNGLE_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 0, 0x60827dff }, // DEFAULT_BORDER_COLOR_NORMAL
|
||||
{ 0, 1, 0x2c3334ff }, // DEFAULT_BASE_COLOR_NORMAL
|
||||
{ 0, 2, 0x82a29fff }, // DEFAULT_TEXT_COLOR_NORMAL
|
||||
{ 0, 3, 0x5f9aa8ff }, // DEFAULT_BORDER_COLOR_FOCUSED
|
||||
{ 0, 4, 0x334e57ff }, // DEFAULT_BASE_COLOR_FOCUSED
|
||||
{ 0, 5, 0x6aa9b8ff }, // DEFAULT_TEXT_COLOR_FOCUSED
|
||||
{ 0, 6, 0xa9cb8dff }, // DEFAULT_BORDER_COLOR_PRESSED
|
||||
{ 0, 7, 0x3b6357ff }, // DEFAULT_BASE_COLOR_PRESSED
|
||||
{ 0, 8, 0x97af81ff }, // DEFAULT_TEXT_COLOR_PRESSED
|
||||
{ 0, 9, 0x5b6462ff }, // DEFAULT_BORDER_COLOR_DISABLED
|
||||
{ 0, 10, 0x2c3334ff }, // DEFAULT_BASE_COLOR_DISABLED
|
||||
{ 0, 11, 0x666b69ff }, // DEFAULT_TEXT_COLOR_DISABLED
|
||||
{ 0, 16, 0x0000000c }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, 0x638465ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, 0x2b3a3aff }, // DEFAULT_BACKGROUND_COLOR
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: (size: 12, spacing: 0)
|
||||
|
||||
#define JUNGLE_COMPRESSED_DATA_SIZE 1059
|
||||
|
||||
// Font image pixels data compressed (DEFLATE)
|
||||
// NOTE: Original pixel data simplified to GRAYSCALE
|
||||
static unsigned char jungleFontData[JUNGLE_COMPRESSED_DATA_SIZE] = { 0xed,
|
||||
0xdd, 0xe1, 0x6e, 0xdb, 0x20, 0x14, 0x06, 0x50, 0x84, 0xfa, 0xfe, 0xaf, 0xcc, 0xd4, 0x6d, 0xdd, 0xb4, 0x35, 0xc6, 0xdc,
|
||||
0x0b, 0xd8, 0x69, 0x7a, 0x7a, 0xd4, 0x3f, 0x71, 0xeb, 0xd8, 0x5c, 0x83, 0x53, 0xf1, 0x15, 0xb7, 0x02, 0x00, 0xf0, 0xc9,
|
||||
0xfb, 0xd7, 0xe3, 0xd7, 0x1e, 0x6d, 0x29, 0xbf, 0xb7, 0x8c, 0xef, 0xeb, 0xe3, 0xf5, 0x5f, 0x5b, 0xea, 0xe1, 0x4f, 0x3c,
|
||||
0xde, 0x63, 0x3d, 0x38, 0x86, 0xa3, 0xa3, 0x3e, 0x3e, 0xb2, 0x12, 0xda, 0x72, 0xbc, 0xff, 0xe3, 0xf6, 0x2a, 0x81, 0x73,
|
||||
0xf8, 0xf7, 0xab, 0x04, 0xce, 0xa5, 0xff, 0x7b, 0xbb, 0xeb, 0xdf, 0x6f, 0x83, 0xe3, 0x6d, 0xbf, 0xbe, 0xdf, 0x5b, 0xa2,
|
||||
0x06, 0xf6, 0x79, 0xfc, 0xf3, 0x25, 0x74, 0x05, 0xc6, 0xaf, 0x8c, 0x58, 0xeb, 0xf6, 0x7e, 0xfa, 0xec, 0x1c, 0x5a, 0xf0,
|
||||
0x08, 0x3e, 0x5e, 0xdf, 0x59, 0xff, 0xf2, 0xe7, 0x3d, 0xc6, 0xfb, 0xff, 0x59, 0x55, 0x5a, 0x7b, 0x7b, 0xd8, 0x12, 0xa5,
|
||||
0x5b, 0x9b, 0x9a, 0x78, 0xa7, 0x15, 0x57, 0x73, 0x59, 0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 0x3f, 0x96, 0xde, 0xcd, 0xe4, 0x08, 0x57, 0xe7, 0xf0, 0xee, 0xaa, 0x7f,
|
||||
0x4b, 0x3d, 0x3b, 0x77, 0xa6, 0xfe, 0x73, 0x79, 0xf9, 0xeb, 0xfa, 0x7f, 0xfe, 0x1d, 0xcb, 0x96, 0x27, 0xa3, 0xcf, 0xf6,
|
||||
0xd6, 0xd8, 0x4a, 0x8d, 0x77, 0x24, 0xb5, 0xd6, 0xe7, 0xe5, 0x76, 0x25, 0xbb, 0xee, 0x4d, 0x2f, 0xae, 0xca, 0xaf, 0xce,
|
||||
0xae, 0xfe, 0x7d, 0x47, 0xfd, 0x65, 0xc7, 0x5e, 0xfb, 0x2a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6e, 0xf3, 0x38,
|
||||
0xeb, 0x9e, 0x47, 0x15, 0x5d, 0xd5, 0xad, 0x85, 0x57, 0x68, 0x63, 0xd7, 0x0c, 0x70, 0xe9, 0x54, 0x69, 0x2e, 0xfd, 0x72,
|
||||
0xf4, 0x6a, 0xed, 0x26, 0x45, 0xb8, 0xbb, 0xfe, 0x35, 0xbc, 0x56, 0x5b, 0x7c, 0x45, 0x33, 0x9e, 0xb5, 0xfe, 0xf9, 0x14,
|
||||
0x97, 0x2b, 0xe0, 0x15, 0x92, 0x1c, 0x99, 0x9c, 0x9b, 0xfe, 0xff, 0x9a, 0xff, 0x07, 0xa2, 0xfe, 0x92, 0x5c, 0xea, 0xcf,
|
||||
0xca, 0xbf, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x29, 0x3f, 0x00 };
|
||||
|
||||
// Font characters rectangles data
|
||||
static const Rectangle jungleFontRecs[95] = {
|
||||
{ 4, 4, 5 , 12 },
|
||||
{ 17, 4, 2 , 7 },
|
||||
{ 27, 4, 5 , 3 },
|
||||
{ 40, 4, 5 , 5 },
|
||||
{ 53, 4, 6 , 7 },
|
||||
{ 67, 4, 7 , 7 },
|
||||
{ 82, 4, 5 , 7 },
|
||||
{ 95, 4, 3 , 3 },
|
||||
{ 106, 4, 4 , 8 },
|
||||
{ 118, 4, 4 , 8 },
|
||||
{ 130, 4, 5 , 5 },
|
||||
{ 143, 4, 5 , 5 },
|
||||
{ 156, 4, 2 , 3 },
|
||||
{ 166, 4, 5 , 1 },
|
||||
{ 179, 4, 2 , 2 },
|
||||
{ 189, 4, 7 , 7 },
|
||||
{ 204, 4, 7 , 6 },
|
||||
{ 219, 4, 6 , 6 },
|
||||
{ 233, 4, 6 , 6 },
|
||||
{ 4, 24, 6 , 6 },
|
||||
{ 18, 24, 6 , 6 },
|
||||
{ 32, 24, 6 , 6 },
|
||||
{ 46, 24, 6 , 6 },
|
||||
{ 60, 24, 6 , 6 },
|
||||
{ 74, 24, 6 , 6 },
|
||||
{ 88, 24, 6 , 6 },
|
||||
{ 102, 24, 2 , 5 },
|
||||
{ 112, 24, 2 , 6 },
|
||||
{ 122, 24, 3 , 5 },
|
||||
{ 133, 24, 5 , 3 },
|
||||
{ 146, 24, 3 , 5 },
|
||||
{ 157, 24, 6 , 7 },
|
||||
{ 171, 24, 7 , 7 },
|
||||
{ 186, 24, 6 , 7 },
|
||||
{ 200, 24, 6 , 7 },
|
||||
{ 214, 24, 6 , 7 },
|
||||
{ 228, 24, 6 , 7 },
|
||||
{ 4, 44, 6 , 7 },
|
||||
{ 18, 44, 6 , 7 },
|
||||
{ 32, 44, 6 , 7 },
|
||||
{ 46, 44, 6 , 7 },
|
||||
{ 60, 44, 6 , 7 },
|
||||
{ 74, 44, 6 , 7 },
|
||||
{ 88, 44, 6 , 7 },
|
||||
{ 102, 44, 6 , 7 },
|
||||
{ 116, 44, 7 , 7 },
|
||||
{ 131, 44, 6 , 7 },
|
||||
{ 145, 44, 6 , 7 },
|
||||
{ 159, 44, 6 , 7 },
|
||||
{ 173, 44, 7 , 8 },
|
||||
{ 188, 44, 6 , 7 },
|
||||
{ 202, 44, 6 , 7 },
|
||||
{ 216, 44, 6 , 7 },
|
||||
{ 230, 44, 6 , 7 },
|
||||
{ 4, 64, 6 , 7 },
|
||||
{ 18, 64, 7 , 7 },
|
||||
{ 33, 64, 6 , 7 },
|
||||
{ 47, 64, 6 , 7 },
|
||||
{ 61, 64, 6 , 7 },
|
||||
{ 75, 64, 4 , 8 },
|
||||
{ 87, 64, 7 , 7 },
|
||||
{ 102, 64, 4 , 8 },
|
||||
{ 114, 64, 4 , 2 },
|
||||
{ 126, 64, 6 , 1 },
|
||||
{ 140, 64, 2 , 2 },
|
||||
{ 150, 64, 6 , 5 },
|
||||
{ 164, 64, 6 , 7 },
|
||||
{ 178, 64, 6 , 5 },
|
||||
{ 192, 64, 6 , 7 },
|
||||
{ 206, 64, 6 , 5 },
|
||||
{ 220, 64, 6 , 7 },
|
||||
{ 234, 64, 6 , 7 },
|
||||
{ 4, 84, 6 , 7 },
|
||||
{ 18, 84, 6 , 7 },
|
||||
{ 32, 84, 5 , 8 },
|
||||
{ 45, 84, 6 , 7 },
|
||||
{ 59, 84, 6 , 7 },
|
||||
{ 73, 84, 7 , 5 },
|
||||
{ 88, 84, 6 , 5 },
|
||||
{ 102, 84, 6 , 5 },
|
||||
{ 116, 84, 6 , 7 },
|
||||
{ 130, 84, 6 , 7 },
|
||||
{ 144, 84, 6 , 5 },
|
||||
{ 158, 84, 6 , 5 },
|
||||
{ 172, 84, 6 , 6 },
|
||||
{ 186, 84, 6 , 5 },
|
||||
{ 200, 84, 6 , 5 },
|
||||
{ 214, 84, 7 , 5 },
|
||||
{ 229, 84, 6 , 5 },
|
||||
{ 4, 104, 6 , 7 },
|
||||
{ 18, 104, 6 , 5 },
|
||||
{ 32, 104, 4 , 8 },
|
||||
{ 44, 104, 2 , 8 },
|
||||
{ 54, 104, 4 , 8 },
|
||||
{ 66, 104, 5 , 2 },
|
||||
};
|
||||
|
||||
// Font characters info data
|
||||
// NOTE: No chars.image data provided
|
||||
static const GlyphInfo jungleFontChars[95] = {
|
||||
{ 32, 0, 9, 5, { 0 }},
|
||||
{ 33, 0, 2, 3, { 0 }},
|
||||
{ 34, 0, 2, 6, { 0 }},
|
||||
{ 35, 0, 3, 6, { 0 }},
|
||||
{ 36, 0, 2, 7, { 0 }},
|
||||
{ 37, 0, 2, 8, { 0 }},
|
||||
{ 38, 0, 2, 6, { 0 }},
|
||||
{ 39, 0, 2, 4, { 0 }},
|
||||
{ 40, 0, 2, 5, { 0 }},
|
||||
{ 41, 0, 2, 5, { 0 }},
|
||||
{ 42, 0, 2, 6, { 0 }},
|
||||
{ 43, 0, 3, 6, { 0 }},
|
||||
{ 44, 0, 7, 3, { 0 }},
|
||||
{ 45, 0, 5, 6, { 0 }},
|
||||
{ 46, 0, 7, 3, { 0 }},
|
||||
{ 47, 0, 2, 8, { 0 }},
|
||||
{ 48, 0, 3, 8, { 0 }},
|
||||
{ 49, 0, 3, 7, { 0 }},
|
||||
{ 50, 0, 3, 7, { 0 }},
|
||||
{ 51, 0, 3, 7, { 0 }},
|
||||
{ 52, 0, 3, 7, { 0 }},
|
||||
{ 53, 0, 3, 7, { 0 }},
|
||||
{ 54, 0, 3, 7, { 0 }},
|
||||
{ 55, 0, 3, 7, { 0 }},
|
||||
{ 56, 0, 3, 7, { 0 }},
|
||||
{ 57, 0, 3, 7, { 0 }},
|
||||
{ 58, 0, 4, 3, { 0 }},
|
||||
{ 59, 0, 4, 3, { 0 }},
|
||||
{ 60, 0, 3, 4, { 0 }},
|
||||
{ 61, 0, 4, 6, { 0 }},
|
||||
{ 62, 0, 3, 4, { 0 }},
|
||||
{ 63, 0, 2, 7, { 0 }},
|
||||
{ 64, 0, 2, 8, { 0 }},
|
||||
{ 65, 0, 2, 7, { 0 }},
|
||||
{ 66, 0, 2, 7, { 0 }},
|
||||
{ 67, 0, 2, 7, { 0 }},
|
||||
{ 68, 0, 2, 7, { 0 }},
|
||||
{ 69, 0, 2, 7, { 0 }},
|
||||
{ 70, 0, 2, 7, { 0 }},
|
||||
{ 71, 0, 2, 7, { 0 }},
|
||||
{ 72, 0, 2, 7, { 0 }},
|
||||
{ 73, 0, 2, 7, { 0 }},
|
||||
{ 74, 0, 2, 7, { 0 }},
|
||||
{ 75, 0, 2, 7, { 0 }},
|
||||
{ 76, 0, 2, 7, { 0 }},
|
||||
{ 77, 0, 2, 8, { 0 }},
|
||||
{ 78, 0, 2, 7, { 0 }},
|
||||
{ 79, 0, 2, 7, { 0 }},
|
||||
{ 80, 0, 2, 7, { 0 }},
|
||||
{ 81, 0, 2, 7, { 0 }},
|
||||
{ 82, 0, 2, 7, { 0 }},
|
||||
{ 83, 0, 2, 7, { 0 }},
|
||||
{ 84, 0, 2, 7, { 0 }},
|
||||
{ 85, 0, 2, 7, { 0 }},
|
||||
{ 86, 0, 2, 7, { 0 }},
|
||||
{ 87, 0, 2, 8, { 0 }},
|
||||
{ 88, 0, 2, 7, { 0 }},
|
||||
{ 89, 0, 2, 7, { 0 }},
|
||||
{ 90, 0, 2, 7, { 0 }},
|
||||
{ 91, 0, 2, 5, { 0 }},
|
||||
{ 92, 0, 2, 8, { 0 }},
|
||||
{ 93, 0, 2, 5, { 0 }},
|
||||
{ 94, 0, -1, 5, { 0 }},
|
||||
{ 95, 0, 10, 7, { 0 }},
|
||||
{ 96, 0, -1, 3, { 0 }},
|
||||
{ 97, 0, 4, 7, { 0 }},
|
||||
{ 98, 0, 2, 7, { 0 }},
|
||||
{ 99, 0, 4, 7, { 0 }},
|
||||
{ 100, 0, 2, 7, { 0 }},
|
||||
{ 101, 0, 4, 7, { 0 }},
|
||||
{ 102, 0, 2, 7, { 0 }},
|
||||
{ 103, 0, 4, 7, { 0 }},
|
||||
{ 104, 0, 2, 7, { 0 }},
|
||||
{ 105, 0, 2, 7, { 0 }},
|
||||
{ 106, 0, 2, 6, { 0 }},
|
||||
{ 107, 0, 2, 7, { 0 }},
|
||||
{ 108, 0, 2, 7, { 0 }},
|
||||
{ 109, 0, 4, 8, { 0 }},
|
||||
{ 110, 0, 4, 7, { 0 }},
|
||||
{ 111, 0, 4, 7, { 0 }},
|
||||
{ 112, 0, 4, 7, { 0 }},
|
||||
{ 113, 0, 4, 7, { 0 }},
|
||||
{ 114, 0, 4, 7, { 0 }},
|
||||
{ 115, 0, 4, 7, { 0 }},
|
||||
{ 116, 0, 3, 7, { 0 }},
|
||||
{ 117, 0, 4, 7, { 0 }},
|
||||
{ 118, 0, 4, 7, { 0 }},
|
||||
{ 119, 0, 4, 8, { 0 }},
|
||||
{ 120, 0, 4, 7, { 0 }},
|
||||
{ 121, 0, 4, 7, { 0 }},
|
||||
{ 122, 0, 4, 7, { 0 }},
|
||||
{ 123, 0, 2, 5, { 0 }},
|
||||
{ 124, 0, 2, 3, { 0 }},
|
||||
{ 125, 0, 2, 5, { 0 }},
|
||||
{ 126, 0, -1, 6, { 0 }},
|
||||
};
|
||||
|
||||
// Style loading function: jungle
|
||||
static void GuiLoadStyleJungle(void)
|
||||
{
|
||||
// Load style properties provided
|
||||
// NOTE: Default properties are propagated
|
||||
for (int i = 0; i < JUNGLE_STYLE_PROPS_COUNT; i++)
|
||||
{
|
||||
GuiSetStyle(jungleStyleProps[i].controlId, jungleStyleProps[i].propertyId, jungleStyleProps[i].propertyValue);
|
||||
}
|
||||
|
||||
// Custom font loading
|
||||
// NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function
|
||||
int jungleFontDataSize = 0;
|
||||
unsigned char *data = DecompressData(jungleFontData, JUNGLE_COMPRESSED_DATA_SIZE, &jungleFontDataSize);
|
||||
Image imFont = { data, 256, 256, 1, 2 };
|
||||
|
||||
Font font = { 0 };
|
||||
font.baseSize = 12;
|
||||
font.glyphCount = 95;
|
||||
|
||||
// Load texture from image
|
||||
font.texture = LoadTextureFromImage(imFont);
|
||||
UnloadImage(imFont); // Uncompressed data can be unloaded from memory
|
||||
|
||||
// Copy char recs data from global fontRecs
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle));
|
||||
memcpy(font.recs, jungleFontRecs, font.glyphCount*sizeof(Rectangle));
|
||||
|
||||
// Copy font char info data from global fontChars
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo));
|
||||
memcpy(font.glyphs, jungleFontChars, font.glyphCount*sizeof(GlyphInfo));
|
||||
|
||||
GuiSetFont(font);
|
||||
|
||||
// Setup a white rectangle on the font to be used on shapes drawing,
|
||||
// this way we make sure all gui can be drawn on a single pass because no texture change is required
|
||||
// NOTE: Setting up this rectangle is a manual process (for the moment)
|
||||
Rectangle whiteChar = { 27, 4, 2, 2 };
|
||||
SetShapesTexture(font.texture, whiteChar);
|
||||
}
|
349
examples/gui/style_selector/styles/style_lavanda.h
Normal file
|
@ -0,0 +1,349 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// StyleAsCode exporter v1.2 - Style data exported as a values array //
|
||||
// //
|
||||
// USAGE: On init call: GuiLoadStyleLavanda(); //
|
||||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raygui //
|
||||
// feedback and support: ray[at]raylibtech.com //
|
||||
// //
|
||||
// Copyright (c) 2020-2022 raylib technologies (@raylibtech) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define LAVANDA_STYLE_PROPS_COUNT 15
|
||||
|
||||
// Custom style name: lavanda
|
||||
static const GuiStyleProp lavandaStyleProps[LAVANDA_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 0, 0xab9bd3ff }, // DEFAULT_BORDER_COLOR_NORMAL
|
||||
{ 0, 1, 0x3e4350ff }, // DEFAULT_BASE_COLOR_NORMAL
|
||||
{ 0, 2, 0xdadaf4ff }, // DEFAULT_TEXT_COLOR_NORMAL
|
||||
{ 0, 3, 0xee84a0ff }, // DEFAULT_BORDER_COLOR_FOCUSED
|
||||
{ 0, 4, 0xf4b7c7ff }, // DEFAULT_BASE_COLOR_FOCUSED
|
||||
{ 0, 5, 0xb7657bff }, // DEFAULT_TEXT_COLOR_FOCUSED
|
||||
{ 0, 6, 0xd5c8dbff }, // DEFAULT_BORDER_COLOR_PRESSED
|
||||
{ 0, 7, 0x966ec0ff }, // DEFAULT_BASE_COLOR_PRESSED
|
||||
{ 0, 8, 0xd7ccf7ff }, // DEFAULT_TEXT_COLOR_PRESSED
|
||||
{ 0, 9, 0x8fa2bdff }, // DEFAULT_BORDER_COLOR_DISABLED
|
||||
{ 0, 10, 0x6b798dff }, // DEFAULT_BASE_COLOR_DISABLED
|
||||
{ 0, 11, 0x8292a9ff }, // DEFAULT_TEXT_COLOR_DISABLED
|
||||
{ 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 18, 0x84adb7ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, 0x5b5b81ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: (size: 16, spacing: 1)
|
||||
|
||||
#define LAVANDA_COMPRESSED_DATA_SIZE 1317
|
||||
|
||||
// Font image pixels data compressed (DEFLATE)
|
||||
// NOTE: Original pixel data simplified to GRAYSCALE
|
||||
static unsigned char lavandaFontData[LAVANDA_COMPRESSED_DATA_SIZE] = { 0xed,
|
||||
0xdd, 0x4b, 0x96, 0xa3, 0x48, 0x0c, 0x05, 0x50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 0x8c, 0x64, 0xe6, 0xd5, 0x5f, 0xfd, 0xff, 0xde, 0x3c, 0x7f,
|
||||
0xa4, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xed, 0x1f };
|
||||
|
||||
// Font characters rectangles data
|
||||
static const Rectangle lavandaFontRecs[95] = {
|
||||
{ 4, 4, 5 , 16 },
|
||||
{ 17, 4, 1 , 9 },
|
||||
{ 26, 4, 3 , 3 },
|
||||
{ 37, 4, 7 , 8 },
|
||||
{ 52, 4, 5 , 11 },
|
||||
{ 65, 4, 10 , 8 },
|
||||
{ 83, 4, 7 , 9 },
|
||||
{ 98, 4, 1 , 3 },
|
||||
{ 107, 4, 3 , 12 },
|
||||
{ 118, 4, 3 , 12 },
|
||||
{ 129, 4, 5 , 4 },
|
||||
{ 142, 4, 5 , 5 },
|
||||
{ 155, 4, 2 , 3 },
|
||||
{ 165, 4, 3 , 1 },
|
||||
{ 176, 4, 1 , 1 },
|
||||
{ 185, 4, 4 , 12 },
|
||||
{ 197, 4, 5 , 9 },
|
||||
{ 210, 4, 3 , 9 },
|
||||
{ 221, 4, 5 , 9 },
|
||||
{ 234, 4, 5 , 9 },
|
||||
{ 4, 28, 5 , 9 },
|
||||
{ 17, 28, 5 , 9 },
|
||||
{ 30, 28, 5 , 9 },
|
||||
{ 43, 28, 5 , 9 },
|
||||
{ 56, 28, 5 , 9 },
|
||||
{ 69, 28, 5 , 9 },
|
||||
{ 82, 28, 1 , 4 },
|
||||
{ 91, 28, 2 , 6 },
|
||||
{ 101, 28, 4 , 5 },
|
||||
{ 113, 28, 4 , 3 },
|
||||
{ 125, 28, 4 , 5 },
|
||||
{ 137, 28, 5 , 9 },
|
||||
{ 150, 28, 7 , 10 },
|
||||
{ 165, 28, 7 , 9 },
|
||||
{ 180, 28, 6 , 9 },
|
||||
{ 194, 28, 5 , 9 },
|
||||
{ 207, 28, 6 , 9 },
|
||||
{ 221, 28, 5 , 9 },
|
||||
{ 234, 28, 5 , 9 },
|
||||
{ 4, 52, 6 , 9 },
|
||||
{ 18, 52, 5 , 10 },
|
||||
{ 31, 52, 1 , 9 },
|
||||
{ 40, 52, 6 , 9 },
|
||||
{ 54, 52, 6 , 9 },
|
||||
{ 68, 52, 5 , 9 },
|
||||
{ 81, 52, 8 , 11 },
|
||||
{ 97, 52, 6 , 10 },
|
||||
{ 111, 52, 7 , 9 },
|
||||
{ 126, 52, 5 , 9 },
|
||||
{ 139, 52, 7 , 11 },
|
||||
{ 154, 52, 5 , 9 },
|
||||
{ 167, 52, 6 , 9 },
|
||||
{ 181, 52, 7 , 9 },
|
||||
{ 196, 52, 6 , 9 },
|
||||
{ 210, 52, 6 , 10 },
|
||||
{ 224, 52, 9 , 10 },
|
||||
{ 4, 76, 6 , 11 },
|
||||
{ 18, 76, 5 , 10 },
|
||||
{ 31, 76, 5 , 9 },
|
||||
{ 44, 76, 3 , 12 },
|
||||
{ 55, 76, 4 , 12 },
|
||||
{ 67, 76, 3 , 12 },
|
||||
{ 78, 76, 5 , 4 },
|
||||
{ 91, 76, 6 , 1 },
|
||||
{ 105, 76, 3 , 3 },
|
||||
{ 116, 76, 6 , 7 },
|
||||
{ 130, 76, 5 , 9 },
|
||||
{ 143, 76, 4 , 7 },
|
||||
{ 155, 76, 5 , 10 },
|
||||
{ 168, 76, 4 , 7 },
|
||||
{ 180, 76, 3 , 10 },
|
||||
{ 191, 76, 4 , 11 },
|
||||
{ 203, 76, 5 , 11 },
|
||||
{ 216, 76, 1 , 9 },
|
||||
{ 225, 76, 5 , 12 },
|
||||
{ 238, 76, 5 , 9 },
|
||||
{ 4, 100, 1 , 9 },
|
||||
{ 13, 100, 8 , 9 },
|
||||
{ 29, 100, 5 , 9 },
|
||||
{ 42, 100, 4 , 7 },
|
||||
{ 54, 100, 5 , 10 },
|
||||
{ 67, 100, 5 , 10 },
|
||||
{ 80, 100, 5 , 7 },
|
||||
{ 93, 100, 5 , 7 },
|
||||
{ 106, 100, 3 , 9 },
|
||||
{ 117, 100, 5 , 7 },
|
||||
{ 130, 100, 5 , 8 },
|
||||
{ 143, 100, 9 , 8 },
|
||||
{ 160, 100, 5 , 9 },
|
||||
{ 173, 100, 6 , 9 },
|
||||
{ 187, 100, 4 , 7 },
|
||||
{ 199, 100, 5 , 12 },
|
||||
{ 212, 100, 1 , 12 },
|
||||
{ 221, 100, 5 , 12 },
|
||||
{ 234, 100, 6 , 2 },
|
||||
};
|
||||
|
||||
// Font characters info data
|
||||
// NOTE: No chars.image data provided
|
||||
static const GlyphInfo lavandaFontChars[95] = {
|
||||
{ 32, 0, 12, 5, { 0 }},
|
||||
{ 33, 0, 3, 2, { 0 }},
|
||||
{ 34, 0, 3, 4, { 0 }},
|
||||
{ 35, 0, 3, 8, { 0 }},
|
||||
{ 36, 0, 2, 6, { 0 }},
|
||||
{ 37, 0, 4, 11, { 0 }},
|
||||
{ 38, 0, 3, 8, { 0 }},
|
||||
{ 39, 0, 3, 2, { 0 }},
|
||||
{ 40, 0, 2, 4, { 0 }},
|
||||
{ 41, 0, 2, 4, { 0 }},
|
||||
{ 42, 0, 3, 6, { 0 }},
|
||||
{ 43, 0, 5, 6, { 0 }},
|
||||
{ 44, 0, 10, 3, { 0 }},
|
||||
{ 45, 0, 7, 4, { 0 }},
|
||||
{ 46, 0, 11, 2, { 0 }},
|
||||
{ 47, 0, 2, 5, { 0 }},
|
||||
{ 48, 0, 3, 6, { 0 }},
|
||||
{ 49, 0, 3, 4, { 0 }},
|
||||
{ 50, 0, 3, 6, { 0 }},
|
||||
{ 51, 0, 3, 6, { 0 }},
|
||||
{ 52, 0, 3, 6, { 0 }},
|
||||
{ 53, 0, 3, 6, { 0 }},
|
||||
{ 54, 0, 3, 6, { 0 }},
|
||||
{ 55, 0, 3, 6, { 0 }},
|
||||
{ 56, 0, 3, 6, { 0 }},
|
||||
{ 57, 0, 3, 6, { 0 }},
|
||||
{ 58, 0, 7, 2, { 0 }},
|
||||
{ 59, 0, 7, 3, { 0 }},
|
||||
{ 60, 0, 5, 5, { 0 }},
|
||||
{ 61, 0, 6, 5, { 0 }},
|
||||
{ 62, 0, 5, 5, { 0 }},
|
||||
{ 63, 0, 3, 6, { 0 }},
|
||||
{ 64, 0, 4, 8, { 0 }},
|
||||
{ 65, 0, 3, 8, { 0 }},
|
||||
{ 66, 0, 3, 7, { 0 }},
|
||||
{ 67, 0, 3, 6, { 0 }},
|
||||
{ 68, 0, 3, 7, { 0 }},
|
||||
{ 69, 0, 3, 6, { 0 }},
|
||||
{ 70, 0, 3, 6, { 0 }},
|
||||
{ 71, 0, 3, 7, { 0 }},
|
||||
{ 72, 0, 2, 6, { 0 }},
|
||||
{ 73, 0, 3, 2, { 0 }},
|
||||
{ 74, 0, 3, 7, { 0 }},
|
||||
{ 75, 0, 3, 7, { 0 }},
|
||||
{ 76, 0, 3, 6, { 0 }},
|
||||
{ 77, 0, 3, 9, { 0 }},
|
||||
{ 78, 0, 2, 7, { 0 }},
|
||||
{ 79, 0, 3, 8, { 0 }},
|
||||
{ 80, 0, 3, 6, { 0 }},
|
||||
{ 81, 0, 3, 8, { 0 }},
|
||||
{ 82, 0, 3, 6, { 0 }},
|
||||
{ 83, 0, 3, 7, { 0 }},
|
||||
{ 84, 0, 3, 8, { 0 }},
|
||||
{ 85, 0, 3, 7, { 0 }},
|
||||
{ 86, 0, 2, 7, { 0 }},
|
||||
{ 87, 0, 2, 10, { 0 }},
|
||||
{ 88, 0, 3, 7, { 0 }},
|
||||
{ 89, 0, 3, 6, { 0 }},
|
||||
{ 90, 0, 3, 6, { 0 }},
|
||||
{ 91, 0, 2, 4, { 0 }},
|
||||
{ 92, 0, 2, 5, { 0 }},
|
||||
{ 93, 0, 2, 4, { 0 }},
|
||||
{ 94, 0, 3, 6, { 0 }},
|
||||
{ 95, 0, 13, 7, { 0 }},
|
||||
{ 96, 0, 3, 4, { 0 }},
|
||||
{ 97, 0, 5, 7, { 0 }},
|
||||
{ 98, 0, 3, 6, { 0 }},
|
||||
{ 99, 0, 5, 5, { 0 }},
|
||||
{ 100, 0, 2, 6, { 0 }},
|
||||
{ 101, 0, 5, 5, { 0 }},
|
||||
{ 102, 0, 2, 4, { 0 }},
|
||||
{ 103, 0, 4, 5, { 0 }},
|
||||
{ 104, 0, 3, 6, { 0 }},
|
||||
{ 105, 0, 3, 2, { 0 }},
|
||||
{ 106, -1, 3, 5, { 0 }},
|
||||
{ 107, 0, 3, 6, { 0 }},
|
||||
{ 108, 0, 3, 2, { 0 }},
|
||||
{ 109, 0, 5, 9, { 0 }},
|
||||
{ 110, 0, 5, 6, { 0 }},
|
||||
{ 111, 0, 5, 5, { 0 }},
|
||||
{ 112, 0, 5, 6, { 0 }},
|
||||
{ 113, 0, 5, 6, { 0 }},
|
||||
{ 114, 0, 5, 6, { 0 }},
|
||||
{ 115, 0, 5, 6, { 0 }},
|
||||
{ 116, 0, 3, 4, { 0 }},
|
||||
{ 117, 0, 5, 6, { 0 }},
|
||||
{ 118, 0, 4, 6, { 0 }},
|
||||
{ 119, 0, 4, 10, { 0 }},
|
||||
{ 120, 0, 5, 6, { 0 }},
|
||||
{ 121, -1, 5, 6, { 0 }},
|
||||
{ 122, 0, 5, 5, { 0 }},
|
||||
{ 123, 0, 2, 6, { 0 }},
|
||||
{ 124, 0, 2, 2, { 0 }},
|
||||
{ 125, 0, 2, 6, { 0 }},
|
||||
{ 126, 0, 7, 7, { 0 }},
|
||||
};
|
||||
|
||||
// Style loading function: lavanda
|
||||
static void GuiLoadStyleLavanda(void)
|
||||
{
|
||||
// Load style properties provided
|
||||
// NOTE: Default properties are propagated
|
||||
for (int i = 0; i < LAVANDA_STYLE_PROPS_COUNT; i++)
|
||||
{
|
||||
GuiSetStyle(lavandaStyleProps[i].controlId, lavandaStyleProps[i].propertyId, lavandaStyleProps[i].propertyValue);
|
||||
}
|
||||
|
||||
// Custom font loading
|
||||
// NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function
|
||||
int lavandaFontDataSize = 0;
|
||||
unsigned char *data = DecompressData(lavandaFontData, LAVANDA_COMPRESSED_DATA_SIZE, &lavandaFontDataSize);
|
||||
Image imFont = { data, 256, 256, 1, 2 };
|
||||
|
||||
Font font = { 0 };
|
||||
font.baseSize = 16;
|
||||
font.glyphCount = 95;
|
||||
|
||||
// Load texture from image
|
||||
font.texture = LoadTextureFromImage(imFont);
|
||||
UnloadImage(imFont); // Uncompressed data can be unloaded from memory
|
||||
|
||||
// Copy char recs data from global fontRecs
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle));
|
||||
memcpy(font.recs, lavandaFontRecs, font.glyphCount*sizeof(Rectangle));
|
||||
|
||||
// Copy font char info data from global fontChars
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo));
|
||||
memcpy(font.glyphs, lavandaFontChars, font.glyphCount*sizeof(GlyphInfo));
|
||||
|
||||
GuiSetFont(font);
|
||||
|
||||
// Setup a white rectangle on the font to be used on shapes drawing,
|
||||
// this way we make sure all gui can be drawn on a single pass because no texture change is required
|
||||
// NOTE: Setting up this rectangle is a manual process (for the moment)
|
||||
Rectangle whiteChar = { 130, 5, 2, 2 };
|
||||
SetShapesTexture(font.texture, whiteChar);
|
||||
}
|
333
examples/gui/style_selector/styles/style_terminal.h
Normal file
|
@ -0,0 +1,333 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// StyleAsCode exporter v1.2 - Style data exported as a values array //
|
||||
// //
|
||||
// USAGE: On init call: GuiLoadStyleTerminal(); //
|
||||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raygui //
|
||||
// feedback and support: ray[at]raylibtech.com //
|
||||
// //
|
||||
// Copyright (c) 2020-2022 raylib technologies (@raylibtech) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define TERMINAL_STYLE_PROPS_COUNT 16
|
||||
|
||||
// Custom style name: terminal
|
||||
static const GuiStyleProp terminalStyleProps[TERMINAL_STYLE_PROPS_COUNT] = {
|
||||
{ 0, 0, 0x1c8d00ff }, // DEFAULT_BORDER_COLOR_NORMAL
|
||||
{ 0, 1, 0x161313ff }, // DEFAULT_BASE_COLOR_NORMAL
|
||||
{ 0, 2, 0x38f620ff }, // DEFAULT_TEXT_COLOR_NORMAL
|
||||
{ 0, 3, 0xc3fbc6ff }, // DEFAULT_BORDER_COLOR_FOCUSED
|
||||
{ 0, 4, 0x43bf2eff }, // DEFAULT_BASE_COLOR_FOCUSED
|
||||
{ 0, 5, 0xdcfadcff }, // DEFAULT_TEXT_COLOR_FOCUSED
|
||||
{ 0, 6, 0x1f5b19ff }, // DEFAULT_BORDER_COLOR_PRESSED
|
||||
{ 0, 7, 0x43ff28ff }, // DEFAULT_BASE_COLOR_PRESSED
|
||||
{ 0, 8, 0x1e6f15ff }, // DEFAULT_TEXT_COLOR_PRESSED
|
||||
{ 0, 9, 0x223b22ff }, // DEFAULT_BORDER_COLOR_DISABLED
|
||||
{ 0, 10, 0x182c18ff }, // DEFAULT_BASE_COLOR_DISABLED
|
||||
{ 0, 11, 0x244125ff }, // DEFAULT_TEXT_COLOR_DISABLED
|
||||
{ 0, 16, 0x00000010 }, // DEFAULT_TEXT_SIZE
|
||||
{ 0, 17, 0x00000000 }, // DEFAULT_TEXT_SPACING
|
||||
{ 0, 18, 0xe6fce3ff }, // DEFAULT_LINE_COLOR
|
||||
{ 0, 19, 0x0c1505ff }, // DEFAULT_BACKGROUND_COLOR
|
||||
};
|
||||
|
||||
// WARNING: This style uses a custom font: (size: 16, spacing: 0)
|
||||
|
||||
#define TERMINAL_COMPRESSED_DATA_SIZE 964
|
||||
|
||||
// Font image pixels data compressed (DEFLATE)
|
||||
// NOTE: Original pixel data simplified to GRAYSCALE
|
||||
static unsigned char terminalFontData[TERMINAL_COMPRESSED_DATA_SIZE] = { 0xed,
|
||||
0xdd, 0x41, 0xb6, 0x9b, 0x30, 0x0c, 0x05, 0x50, 0xf6, 0xbf, 0x69, 0x75, 0xd0, 0xd3, 0x41, 0x7b, 0x9a, 0x0f, 0x92, 0x65,
|
||||
0xc7, 0xc0, 0xed, 0x9d, 0xa5, 0x09, 0x9f, 0xf0, 0x02, 0x38, 0xb6, 0xec, 0xc4, 0x01, 0x00, 0xf0, 0x8f, 0xf8, 0xef, 0x23,
|
||||
0xf1, 0xf1, 0x99, 0x71, 0x79, 0x3b, 0xbf, 0x1f, 0x8d, 0x8f, 0x7f, 0xe5, 0xcf, 0xbf, 0x2b, 0x5b, 0xba, 0xfe, 0xac, 0x48,
|
||||
0xed, 0xdd, 0xd8, 0x5e, 0xd5, 0xb6, 0x93, 0x7d, 0xf6, 0xcf, 0xfb, 0x13, 0x1b, 0xe4, 0x7f, 0xfe, 0x6e, 0x33, 0xc7, 0x33,
|
||||
0xca, 0xe9, 0xe5, 0x3f, 0x9d, 0x33, 0xcf, 0xa1, 0xec, 0x3e, 0xd6, 0x8e, 0xc9, 0x1e, 0xf9, 0x67, 0xff, 0x46, 0x6e, 0xbf,
|
||||
0x63, 0x68, 0xcf, 0x6b, 0xe7, 0xf4, 0xd8, 0xde, 0xdd, 0x39, 0xff, 0xe3, 0xe3, 0x95, 0xbc, 0x7a, 0x1c, 0x57, 0xe5, 0x3f,
|
||||
0xfe, 0x2e, 0x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 0xb7, 0xec, 0x7a, 0x5b, 0xef, 0x4d, 0xdf, 0xff, 0x8e, 0x86, 0x79, 0xe0, 0xe7, 0x6b, 0x2f, 0x77, 0xaf,
|
||||
0xa3, 0x5c, 0xf9, 0xfe, 0xf7, 0xf4, 0x6a, 0xc9, 0x58, 0x52, 0xcf, 0xb6, 0xcf, 0xf1, 0x89, 0x29, 0xf3, 0xe6, 0xe5, 0xbf,
|
||||
0x7b, 0xfe, 0xb5, 0x6f, 0xe3, 0xcf, 0xcf, 0x7f, 0xe5, 0xd1, 0x7f, 0xc6, 0xd9, 0x21, 0xff, 0x77, 0xd7, 0x72, 0xcb, 0xff,
|
||||
0x5d, 0xd7, 0xad, 0xd1, 0xfe, 0x7f, 0xcc, 0xef, 0x40, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0d, 0x7e, 0x01 };
|
||||
|
||||
// Font characters rectangles data
|
||||
static const Rectangle terminalFontRecs[95] = {
|
||||
{ 4, 4, 4 , 16 },
|
||||
{ 16, 4, 1 , 11 },
|
||||
{ 25, 4, 3 , 3 },
|
||||
{ 36, 4, 6 , 11 },
|
||||
{ 50, 4, 5 , 11 },
|
||||
{ 63, 4, 5 , 11 },
|
||||
{ 76, 4, 5 , 11 },
|
||||
{ 89, 4, 1 , 2 },
|
||||
{ 98, 4, 2 , 13 },
|
||||
{ 108, 4, 2 , 13 },
|
||||
{ 118, 4, 3 , 3 },
|
||||
{ 129, 4, 5 , 5 },
|
||||
{ 142, 4, 1 , 3 },
|
||||
{ 151, 4, 5 , 1 },
|
||||
{ 164, 4, 1 , 1 },
|
||||
{ 173, 4, 6 , 12 },
|
||||
{ 187, 4, 5 , 11 },
|
||||
{ 200, 4, 2 , 11 },
|
||||
{ 210, 4, 5 , 11 },
|
||||
{ 223, 4, 5 , 11 },
|
||||
{ 236, 4, 5 , 11 },
|
||||
{ 4, 28, 5 , 11 },
|
||||
{ 17, 28, 5 , 11 },
|
||||
{ 30, 28, 5 , 11 },
|
||||
{ 43, 28, 5 , 11 },
|
||||
{ 56, 28, 5 , 11 },
|
||||
{ 69, 28, 1 , 8 },
|
||||
{ 78, 28, 1 , 10 },
|
||||
{ 87, 28, 4 , 5 },
|
||||
{ 99, 28, 5 , 3 },
|
||||
{ 112, 28, 4 , 5 },
|
||||
{ 124, 28, 5 , 11 },
|
||||
{ 137, 28, 11 , 11 },
|
||||
{ 156, 28, 5 , 11 },
|
||||
{ 169, 28, 5 , 11 },
|
||||
{ 182, 28, 5 , 11 },
|
||||
{ 195, 28, 5 , 11 },
|
||||
{ 208, 28, 5 , 11 },
|
||||
{ 221, 28, 5 , 11 },
|
||||
{ 234, 28, 5 , 11 },
|
||||
{ 4, 52, 5 , 11 },
|
||||
{ 17, 52, 1 , 11 },
|
||||
{ 26, 52, 5 , 11 },
|
||||
{ 39, 52, 5 , 11 },
|
||||
{ 52, 52, 5 , 11 },
|
||||
{ 65, 52, 7 , 11 },
|
||||
{ 80, 52, 5 , 11 },
|
||||
{ 93, 52, 5 , 11 },
|
||||
{ 106, 52, 5 , 11 },
|
||||
{ 119, 52, 5 , 13 },
|
||||
{ 132, 52, 5 , 11 },
|
||||
{ 145, 52, 5 , 11 },
|
||||
{ 158, 52, 5 , 11 },
|
||||
{ 171, 52, 5 , 11 },
|
||||
{ 184, 52, 5 , 11 },
|
||||
{ 197, 52, 7 , 11 },
|
||||
{ 212, 52, 5 , 11 },
|
||||
{ 225, 52, 5 , 11 },
|
||||
{ 238, 52, 5 , 11 },
|
||||
{ 4, 76, 2 , 13 },
|
||||
{ 14, 76, 6 , 12 },
|
||||
{ 28, 76, 2 , 13 },
|
||||
{ 38, 76, 5 , 4 },
|
||||
{ 51, 76, 5 , 1 },
|
||||
{ 64, 76, 2 , 2 },
|
||||
{ 74, 76, 5 , 8 },
|
||||
{ 87, 76, 5 , 11 },
|
||||
{ 100, 76, 5 , 8 },
|
||||
{ 113, 76, 5 , 11 },
|
||||
{ 126, 76, 5 , 8 },
|
||||
{ 139, 76, 4 , 11 },
|
||||
{ 151, 76, 5 , 10 },
|
||||
{ 164, 76, 5 , 11 },
|
||||
{ 177, 76, 1 , 11 },
|
||||
{ 186, 76, 1 , 13 },
|
||||
{ 195, 76, 5 , 11 },
|
||||
{ 208, 76, 1 , 11 },
|
||||
{ 217, 76, 7 , 8 },
|
||||
{ 232, 76, 5 , 8 },
|
||||
{ 4, 100, 5 , 8 },
|
||||
{ 17, 100, 5 , 10 },
|
||||
{ 30, 100, 5 , 10 },
|
||||
{ 43, 100, 4 , 8 },
|
||||
{ 55, 100, 5 , 8 },
|
||||
{ 68, 100, 3 , 11 },
|
||||
{ 79, 100, 5 , 8 },
|
||||
{ 92, 100, 5 , 8 },
|
||||
{ 105, 100, 7 , 8 },
|
||||
{ 120, 100, 5 , 8 },
|
||||
{ 133, 100, 5 , 10 },
|
||||
{ 146, 100, 5 , 8 },
|
||||
{ 159, 100, 3 , 13 },
|
||||
{ 170, 100, 1 , 15 },
|
||||
{ 179, 100, 3 , 13 },
|
||||
{ 190, 100, 5 , 3 },
|
||||
};
|
||||
|
||||
// Font characters info data
|
||||
// NOTE: No chars.image data provided
|
||||
static const GlyphInfo terminalFontChars[95] = {
|
||||
{ 32, 0, 14, 4, { 0 }},
|
||||
{ 33, 1, 3, 3, { 0 }},
|
||||
{ 34, 1, 3, 5, { 0 }},
|
||||
{ 35, 1, 3, 8, { 0 }},
|
||||
{ 36, 1, 3, 7, { 0 }},
|
||||
{ 37, 1, 3, 7, { 0 }},
|
||||
{ 38, 1, 3, 7, { 0 }},
|
||||
{ 39, 1, 3, 3, { 0 }},
|
||||
{ 40, 1, 2, 4, { 0 }},
|
||||
{ 41, 1, 2, 4, { 0 }},
|
||||
{ 42, 1, 3, 5, { 0 }},
|
||||
{ 43, 1, 7, 7, { 0 }},
|
||||
{ 44, 1, 13, 3, { 0 }},
|
||||
{ 45, 1, 9, 7, { 0 }},
|
||||
{ 46, 1, 13, 3, { 0 }},
|
||||
{ 47, 1, 2, 8, { 0 }},
|
||||
{ 48, 1, 3, 7, { 0 }},
|
||||
{ 49, 1, 3, 4, { 0 }},
|
||||
{ 50, 1, 3, 7, { 0 }},
|
||||
{ 51, 1, 3, 7, { 0 }},
|
||||
{ 52, 1, 3, 7, { 0 }},
|
||||
{ 53, 1, 3, 7, { 0 }},
|
||||
{ 54, 1, 3, 7, { 0 }},
|
||||
{ 55, 1, 3, 7, { 0 }},
|
||||
{ 56, 1, 3, 7, { 0 }},
|
||||
{ 57, 1, 3, 7, { 0 }},
|
||||
{ 58, 1, 6, 3, { 0 }},
|
||||
{ 59, 1, 6, 3, { 0 }},
|
||||
{ 60, 1, 7, 6, { 0 }},
|
||||
{ 61, 1, 8, 7, { 0 }},
|
||||
{ 62, 1, 7, 6, { 0 }},
|
||||
{ 63, 1, 3, 7, { 0 }},
|
||||
{ 64, 2, 3, 15, { 0 }},
|
||||
{ 65, 1, 3, 7, { 0 }},
|
||||
{ 66, 1, 3, 7, { 0 }},
|
||||
{ 67, 1, 3, 7, { 0 }},
|
||||
{ 68, 1, 3, 7, { 0 }},
|
||||
{ 69, 1, 3, 7, { 0 }},
|
||||
{ 70, 1, 3, 7, { 0 }},
|
||||
{ 71, 1, 3, 7, { 0 }},
|
||||
{ 72, 1, 3, 7, { 0 }},
|
||||
{ 73, 1, 3, 3, { 0 }},
|
||||
{ 74, 1, 3, 7, { 0 }},
|
||||
{ 75, 1, 3, 7, { 0 }},
|
||||
{ 76, 1, 3, 7, { 0 }},
|
||||
{ 77, 1, 3, 9, { 0 }},
|
||||
{ 78, 1, 3, 7, { 0 }},
|
||||
{ 79, 1, 3, 7, { 0 }},
|
||||
{ 80, 1, 3, 7, { 0 }},
|
||||
{ 81, 1, 3, 7, { 0 }},
|
||||
{ 82, 1, 3, 7, { 0 }},
|
||||
{ 83, 1, 3, 7, { 0 }},
|
||||
{ 84, 1, 3, 7, { 0 }},
|
||||
{ 85, 1, 3, 7, { 0 }},
|
||||
{ 86, 1, 3, 7, { 0 }},
|
||||
{ 87, 1, 3, 9, { 0 }},
|
||||
{ 88, 1, 3, 7, { 0 }},
|
||||
{ 89, 1, 3, 7, { 0 }},
|
||||
{ 90, 1, 3, 7, { 0 }},
|
||||
{ 91, 1, 2, 4, { 0 }},
|
||||
{ 92, 1, 2, 8, { 0 }},
|
||||
{ 93, 1, 2, 4, { 0 }},
|
||||
{ 94, 1, 3, 7, { 0 }},
|
||||
{ 95, 1, 15, 7, { 0 }},
|
||||
{ 96, 1, 0, 4, { 0 }},
|
||||
{ 97, 1, 6, 7, { 0 }},
|
||||
{ 98, 1, 3, 7, { 0 }},
|
||||
{ 99, 1, 6, 7, { 0 }},
|
||||
{ 100, 1, 3, 7, { 0 }},
|
||||
{ 101, 1, 6, 7, { 0 }},
|
||||
{ 102, 1, 3, 6, { 0 }},
|
||||
{ 103, 1, 6, 7, { 0 }},
|
||||
{ 104, 1, 3, 7, { 0 }},
|
||||
{ 105, 1, 3, 3, { 0 }},
|
||||
{ 106, 1, 3, 3, { 0 }},
|
||||
{ 107, 1, 3, 7, { 0 }},
|
||||
{ 108, 1, 3, 3, { 0 }},
|
||||
{ 109, 1, 6, 9, { 0 }},
|
||||
{ 110, 1, 6, 7, { 0 }},
|
||||
{ 111, 1, 6, 7, { 0 }},
|
||||
{ 112, 1, 6, 7, { 0 }},
|
||||
{ 113, 1, 6, 7, { 0 }},
|
||||
{ 114, 1, 6, 6, { 0 }},
|
||||
{ 115, 1, 6, 7, { 0 }},
|
||||
{ 116, 1, 3, 5, { 0 }},
|
||||
{ 117, 1, 6, 7, { 0 }},
|
||||
{ 118, 1, 6, 7, { 0 }},
|
||||
{ 119, 1, 6, 9, { 0 }},
|
||||
{ 120, 1, 6, 7, { 0 }},
|
||||
{ 121, 1, 6, 7, { 0 }},
|
||||
{ 122, 1, 6, 7, { 0 }},
|
||||
{ 123, 1, 2, 5, { 0 }},
|
||||
{ 124, 1, 1, 3, { 0 }},
|
||||
{ 125, 1, 2, 5, { 0 }},
|
||||
{ 126, 1, 8, 7, { 0 }},
|
||||
};
|
||||
|
||||
// Style loading function: terminal
|
||||
static void GuiLoadStyleTerminal(void)
|
||||
{
|
||||
// Load style properties provided
|
||||
// NOTE: Default properties are propagated
|
||||
for (int i = 0; i < TERMINAL_STYLE_PROPS_COUNT; i++)
|
||||
{
|
||||
GuiSetStyle(terminalStyleProps[i].controlId, terminalStyleProps[i].propertyId, terminalStyleProps[i].propertyValue);
|
||||
}
|
||||
|
||||
// Custom font loading
|
||||
// NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function
|
||||
int terminalFontDataSize = 0;
|
||||
unsigned char *data = DecompressData(terminalFontData, TERMINAL_COMPRESSED_DATA_SIZE, &terminalFontDataSize);
|
||||
Image imFont = { data, 256, 256, 1, 2 };
|
||||
|
||||
Font font = { 0 };
|
||||
font.baseSize = 16;
|
||||
font.glyphCount = 95;
|
||||
|
||||
// Load texture from image
|
||||
font.texture = LoadTextureFromImage(imFont);
|
||||
UnloadImage(imFont); // Uncompressed data can be unloaded from memory
|
||||
|
||||
// Copy char recs data from global fontRecs
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.recs = (Rectangle *)malloc(font.glyphCount*sizeof(Rectangle));
|
||||
memcpy(font.recs, terminalFontRecs, font.glyphCount*sizeof(Rectangle));
|
||||
|
||||
// Copy font char info data from global fontChars
|
||||
// NOTE: Required to avoid issues if trying to free font
|
||||
font.glyphs = (GlyphInfo *)malloc(font.glyphCount*sizeof(GlyphInfo));
|
||||
memcpy(font.glyphs, terminalFontChars, font.glyphCount*sizeof(GlyphInfo));
|
||||
|
||||
GuiSetFont(font);
|
||||
|
||||
// Setup a white rectangle on the font to be used on shapes drawing,
|
||||
// this way we make sure all gui can be drawn on a single pass because no texture change is required
|
||||
// NOTE: Setting up this rectangle is a manual process (for the moment)
|
||||
Rectangle whiteChar = { 63, 4, 2, 2 };
|
||||
SetShapesTexture(font.texture, whiteChar);
|
||||
}
|