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

140 lines
5.4 KiB
C

/*******************************************************************************************
*
* LoadingScreen v1.0.0 - Tool Description
*
* MODULE USAGE:
* #define GUI_LOADINGSCREEN_IMPLEMENTATION
* #include "gui_LoadingScreen.h"
*
* INIT: GuiLoadingScreenState state = InitGuiLoadingScreen();
* DRAW: GuiLoadingScreen(&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_LOADINGSCREEN_H
#define GUI_LOADINGSCREEN_H
typedef struct {
// Define anchors
Vector2 anchor01; // ANCHOR ID:1
// Define controls variables
float ProgressBar000Value; // ProgressBar: ProgressBar000
Rectangle ScrollPanel002ScrollView;
Vector2 ScrollPanel002ScrollOffset;
Vector2 ScrollPanel002BoundsOffset; // ScrollPanel: ScrollPanel002
// Define rectangles
Rectangle layoutRecs[4];
// Custom state variables (depend on development software)
// NOTE: This variables should be added manually if required
} GuiLoadingScreenState;
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
//...
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
// ...
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
GuiLoadingScreenState InitGuiLoadingScreen(void);
void GuiLoadingScreen(GuiLoadingScreenState *state);
#ifdef __cplusplus
}
#endif
#endif // GUI_LOADINGSCREEN_H
/***********************************************************************************
*
* GUI_LOADINGSCREEN IMPLEMENTATION
*
************************************************************************************/
#if defined(GUI_LOADINGSCREEN_IMPLEMENTATION)
#include "raygui.h"
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
//...
//----------------------------------------------------------------------------------
// Internal Module Functions Definition
//----------------------------------------------------------------------------------
//...
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
GuiLoadingScreenState InitGuiLoadingScreen(void)
{
GuiLoadingScreenState state = { 0 };
// Init anchors
state.anchor01 = (Vector2){ 24, 24 }; // ANCHOR ID:1
// Initilize controls variables
state.ProgressBar000Value = 0.0f; // ProgressBar: ProgressBar000
state.ScrollPanel002ScrollView = (Rectangle){ 0, 0, 0, 0 };
state.ScrollPanel002ScrollOffset = (Vector2){ 0, 0 };
state.ScrollPanel002BoundsOffset = (Vector2){ 0, 0 }; // ScrollPanel: ScrollPanel002
// Init controls rectangles
state.layoutRecs[0] = (Rectangle){ state.anchor01.x + 192, state.anchor01.y + 576, 672, 24 };// ProgressBar: ProgressBar000
state.layoutRecs[1] = (Rectangle){ state.anchor01.x + 48, state.anchor01.y + 72, 984, 480 };// ScrollPanel: ScrollPanel002
state.layoutRecs[2] = (Rectangle){ state.anchor01.x + 0, state.anchor01.y + 0, 1080, 632 };// GroupBox: GroupBox003
state.layoutRecs[3] = (Rectangle){ state.anchor01.x + 72, state.anchor01.y + 24, 120, 24 };// Label: Label003
// Custom variables initialization
return state;
}
void GuiLoadingScreen(GuiLoadingScreenState *state)
{
// Const text
const char *ProgressBar000Text = ""; // PROGRESSBAR: ProgressBar000
const char *GroupBox003Text = "Loading Screen"; // GROUPBOX: GroupBox003
const char *Label003Text = "Debug Console"; // LABEL: Label003
// Draw controls
GuiProgressBar(state->layoutRecs[0], ProgressBar000Text, NULL, &state->ProgressBar000Value, 0, 1);
GuiScrollPanel((Rectangle){state->layoutRecs[1].x, state->layoutRecs[1].y, state->layoutRecs[1].width - state->ScrollPanel002BoundsOffset.x, state->layoutRecs[1].height - state->ScrollPanel002BoundsOffset.y }, ScrollPanel002Text, state->layoutRecs[1], &state->ScrollPanel002ScrollOffset, &state->ScrollPanel002ScrollView);
GuiGroupBox(state->layoutRecs[2], GroupBox003Text);
GuiLabel(state->layoutRecs[3], Label003Text);
}
#endif // GUI_LOADINGSCREEN_IMPLEMENTATION