Im a novice programmer and im trying to use the Raylib library in C++.
But i cant get a simple Startmenu to work. Ive been trying to call void functions, used a switch and a simple if statement... How do i make a simple menu in raylib using switch or if statements without closing and open a new window of the program? Somehere in the While-loop i guess?
#include "raylib.h"
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your firstwindow!", 190, 200, 50, LIGHTGRAY);
EndDrawing();
if(IsKeyPressed(KEY_Q)) DrawText("New thing here", 200, 210, 60, GREEN);
if(IsKeyPressed(KEY_W)) DrawText("New thing here number two", 200, 210, 60, BLACK);
}
//----------------------------------------------------------------------------------
CloseWindow();
return 0;
}
Ive been trying with a Break and Pause and Goto things, how do i end the While loop without closing the window, do i need change the statements for the while loop?