/******************************************************************************************* * * Inventory v1.0.0 - Tool Description * * MODULE USAGE: * #define GUI_INVENTORY_IMPLEMENTATION * #include "gui_inventory.h" * * INIT: GuiInventoryState state = InitGuiInventory(); * DRAW: GuiInventory(&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_INVENTORY_H #define GUI_INVENTORY_H typedef struct { // Define anchors Vector2 anchor01; // ANCHOR ID:1 // Define controls variables // Define rectangles Rectangle layoutRecs[3]; // Custom state variables (depend on development software) // NOTE: This variables should be added manually if required } GuiInventoryState; #ifdef __cplusplus extern "C" { // Prevents name mangling of functions #endif //---------------------------------------------------------------------------------- // Defines and Macros //---------------------------------------------------------------------------------- //... //---------------------------------------------------------------------------------- // Types and Structures Definition //---------------------------------------------------------------------------------- // ... //---------------------------------------------------------------------------------- // Module Functions Declaration //---------------------------------------------------------------------------------- GuiInventoryState InitGuiInventory(void); void GuiInventory(GuiInventoryState *state); #ifdef __cplusplus } #endif #endif // GUI_INVENTORY_H /*********************************************************************************** * * GUI_INVENTORY IMPLEMENTATION * ************************************************************************************/ #if defined(GUI_INVENTORY_IMPLEMENTATION) #include "raygui.h" //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- //... //---------------------------------------------------------------------------------- // Internal Module Functions Definition //---------------------------------------------------------------------------------- //... //---------------------------------------------------------------------------------- // Module Functions Definition //---------------------------------------------------------------------------------- GuiInventoryState InitGuiInventory(void) { GuiInventoryState state = { 0 }; // Init anchors state.anchor01 = (Vector2){ 840, 72 }; // ANCHOR ID:1 // Initilize controls variables // Init controls rectangles state.layoutRecs[0] = (Rectangle){ state.anchor01.x + 0, state.anchor01.y + 0, 240, 528 };// GroupBox: Inventory state.layoutRecs[1] = (Rectangle){ state.anchor01.x + -264, state.anchor01.y + 48, 240, 192 };// Panel: DataPanel state.layoutRecs[2] = (Rectangle){ state.anchor01.x + -264, state.anchor01.y + 264, 240, 216 };// Panel: DescriptionPanel // Custom variables initialization return state; } void GuiInventory(GuiInventoryState *state) { // Const text const char *InventoryText = "Void Bag"; // GROUPBOX: Inventory // Draw controls GuiGroupBox(state->layoutRecs[0], InventoryText); GuiPanel(state->layoutRecs[1], DataPanelText); GuiPanel(state->layoutRecs[2], DescriptionPanelText); } #endif // GUI_INVENTORY_IMPLEMENTATION