/******************************************************************************************* * * Settings v1.0.0 - Tool Description * * MODULE USAGE: * #define GUI_SETTINGS_IMPLEMENTATION * #include "gui_settings.h" * * INIT: GuiSettingsState state = InitGuiSettings(); * DRAW: GuiSettings(&state); * * LICENSE: Propietary License * * Copyright (c) 2022 SleepeeSoftware. All Rights Reserved. * * Unauthorized copying of this file, via any medium is strictly prohibited * This project is proprietary and confidential unless the owner allows * usage in any other form by expresely written permission. * **********************************************************************************************/ #include "raylib.h" // WARNING: raygui implementation is expected to be defined before including this header #undef RAYGUI_IMPLEMENTATION #include "raygui.h" #include // Required for: strcpy() #ifndef GUI_SETTINGS_H #define GUI_SETTINGS_H typedef struct { // Define anchors Vector2 anchor01; // ANCHOR ID:1 // Define controls variables int ToggleGroup001Active; // ToggleGroup: ToggleGroup001 // Define rectangles Rectangle layoutRecs[6]; // Custom state variables (depend on development software) // NOTE: This variables should be added manually if required } GuiSettingsState; #ifdef __cplusplus extern "C" { // Prevents name mangling of functions #endif //---------------------------------------------------------------------------------- // Defines and Macros //---------------------------------------------------------------------------------- //... //---------------------------------------------------------------------------------- // Types and Structures Definition //---------------------------------------------------------------------------------- // ... //---------------------------------------------------------------------------------- // Module Functions Declaration //---------------------------------------------------------------------------------- GuiSettingsState InitGuiSettings(void); void GuiSettings(GuiSettingsState *state); #ifdef __cplusplus } #endif #endif // GUI_SETTINGS_H /*********************************************************************************** * * GUI_SETTINGS IMPLEMENTATION * ************************************************************************************/ #if defined(GUI_SETTINGS_IMPLEMENTATION) #include "raygui.h" //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- //... //---------------------------------------------------------------------------------- // Internal Module Functions Definition //---------------------------------------------------------------------------------- //... //---------------------------------------------------------------------------------- // Module Functions Definition //---------------------------------------------------------------------------------- GuiSettingsState InitGuiSettings(void) { GuiSettingsState state = { 0 }; // Init anchors state.anchor01 = (Vector2){ 96, 96 }; // ANCHOR ID:1 // Initilize controls variables state.ToggleGroup001Active = 0; // ToggleGroup: ToggleGroup001 // Init controls rectangles state.layoutRecs[0] = (Rectangle){ state.anchor01.x + 0, state.anchor01.y + 0, 840, 504 };// GroupBox: GroupBox000 state.layoutRecs[1] = (Rectangle){ 264, 48, 128, 32 };// ToggleGroup: ToggleGroup001 state.layoutRecs[2] = (Rectangle){ state.anchor01.x + 0, state.anchor01.y + 0, 840, 504 };// GroupBox: GroupBox002 state.layoutRecs[3] = (Rectangle){ state.anchor01.x + 0, state.anchor01.y + 0, 840, 504 };// GroupBox: GroupBox003 state.layoutRecs[4] = (Rectangle){ state.anchor01.x + 0, state.anchor01.y + 0, 840, 504 };// GroupBox: GroupBox004 state.layoutRecs[5] = (Rectangle){ state.anchor01.x + 0, state.anchor01.y + 0, 840, 504 };// GroupBox: GroupBox005 // Custom variables initialization return state; } void GuiSettings(GuiSettingsState *state) { // Const text const char *GroupBox000Text = "SAMPLE TEXT"; // GROUPBOX: GroupBox000 const char *ToggleGroup001Text = "Gameplay; Sound; Graphic; Control; SECRET"; // TOGGLEGROUP: ToggleGroup001 const char *GroupBox002Text = "SAMPLE TEXT"; // GROUPBOX: GroupBox002 const char *GroupBox003Text = "SAMPLE TEXT"; // GROUPBOX: GroupBox003 const char *GroupBox004Text = "SAMPLE TEXT"; // GROUPBOX: GroupBox004 const char *GroupBox005Text = "SAMPLE TEXT"; // GROUPBOX: GroupBox005 // Draw controls GuiGroupBox(state->layoutRecs[0], GroupBox000Text); GuiToggleGroup(state->layoutRecs[1], ToggleGroup001Text, &state->ToggleGroup001Active); GuiGroupBox(state->layoutRecs[2], GroupBox002Text); GuiGroupBox(state->layoutRecs[3], GroupBox003Text); GuiGroupBox(state->layoutRecs[4], GroupBox004Text); GuiGroupBox(state->layoutRecs[5], GroupBox005Text); } #endif // GUI_SETTINGS_IMPLEMENTATION