GameEngine/source/layout/gui_MainMenu.h
2026-02-20 16:12:16 +01:00

150 lines
4.9 KiB
C

/*******************************************************************************************
*
* MainMenu v1.0.0 - Tool Description
*
* MODULE USAGE:
* #define GUI_MAINMENU_IMPLEMENTATION
* #include "gui_MainMenu.h"
*
* INIT: GuiMainMenuState state = InitGuiMainMenu();
* DRAW: GuiMainMenu(&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 <string.h> // Required for: strcpy()
#ifndef GUI_MAINMENU_H
#define GUI_MAINMENU_H
typedef struct {
// Define anchors
// Define controls variables
bool Toggle001Active; // Toggle: Toggle001
// Define rectangles
Rectangle layoutRecs[4];
// Custom state variables (depend on development software)
// NOTE: This variables should be added manually if required
} GuiMainMenuState;
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
//...
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
// ...
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
GuiMainMenuState InitGuiMainMenu(void);
void GuiMainMenu(GuiMainMenuState *state);
static void Button001(); // Button: Button001 logic
static void Button002(); // Button: Button002 logic
static void Button004(); // Button: Button004 logic
#ifdef __cplusplus
}
#endif
#endif // GUI_MAINMENU_H
/***********************************************************************************
*
* GUI_MAINMENU IMPLEMENTATION
*
************************************************************************************/
#if defined(GUI_MAINMENU_IMPLEMENTATION)
#include "raygui.h"
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
//...
//----------------------------------------------------------------------------------
// Internal Module Functions Definition
//----------------------------------------------------------------------------------
//...
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
GuiMainMenuState InitGuiMainMenu(void)
{
GuiMainMenuState state = { 0 };
// Init anchors
// Initilize controls variables
state.Toggle001Active = true; // Toggle: Toggle001
// Init controls rectangles
state.layoutRecs[0] = (Rectangle){ 120, 456, 144, 48 };// Toggle: Toggle001
state.layoutRecs[1] = (Rectangle){ 432, 264, 144, 48 };// Button: Button001
state.layoutRecs[2] = (Rectangle){ 120, 288, 144, 48 };// Button: Button002
state.layoutRecs[3] = (Rectangle){ 768, 456, 144, 48 };// Button: Button004
// Custom variables initialization
return state;
}
// Button: Button001 logic
static void Button001()
{
// TODO: Implement control logic
}
// Button: Button002 logic
static void Button002()
{
// TODO: Implement control logic
}
// Button: Button004 logic
static void Button004()
{
// TODO: Implement control logic
}
void GuiMainMenu(GuiMainMenuState *state)
{
// Const text
const char *Toggle001Text = "Debug Toggle"; // TOGGLE: Toggle001
const char *Button001Text = "Play"; // BUTTON: Button001
const char *Button002Text = "Settings"; // BUTTON: Button002
const char *Button004Text = "Shutdown"; // BUTTON: Button004
// Draw controls
GuiToggle(state->layoutRecs[0], Toggle001Text, &state->Toggle001Active);
if (GuiButton(state->layoutRecs[1], Button001Text)) Button001();
if (GuiButton(state->layoutRecs[2], Button002Text)) Button002();
if (GuiButton(state->layoutRecs[3], Button004Text)) Button004();
}
#endif // GUI_MAINMENU_IMPLEMENTATION