add render callback example, put the core basic window back how it was

This commit is contained in:
Jeffery Myers 2026-07-11 11:41:55 -07:00
commit 1185626c50
7 changed files with 688 additions and 18 deletions

View file

@ -27,22 +27,6 @@
********************************************************************************************/
#include "raylib.h"
#include <math.h>
bool RunFrame(void)
{
if (WindowShouldClose())
return false;
ClearBackground(BLACK);
float offset = cosf(GetTime() * 2.0f) *60.0f;
DrawTextEx(GetFontDefault(), "Congrats! You created your first window!", (Vector2) { 190, 200 + offset}, 20, 2, LIGHTGRAY);
DrawFPS(10, 10);
DrawText(TextFormat("FrameTime %0.3f", GetFrameTime()), 10, 30, 20, GRAY);
return true;
}
//------------------------------------------------------------------------------------
// Program main entry point
@ -54,14 +38,30 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
RunGameLoop(RunFrame);
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------