rayjs/examples/core/core_basic_window.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-05-10 21:26:53 +00:00
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
2023-05-14 20:19:47 +00:00
initWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
2023-05-10 21:26:53 +00:00
2023-05-14 20:19:47 +00:00
setTargetFPS(60); // Set our game to run at 60 frames-per-second
2023-05-10 21:26:53 +00:00
//--------------------------------------------------------------------------------------
// Main game loop
2023-05-14 20:19:47 +00:00
while (!windowShouldClose()) // Detect window close button or ESC key
2023-05-10 21:26:53 +00:00
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
2023-05-14 20:19:47 +00:00
beginDrawing();
2023-05-10 21:26:53 +00:00
2023-05-14 20:19:47 +00:00
clearBackground(RAYWHITE);
2023-05-10 21:26:53 +00:00
2023-05-14 20:19:47 +00:00
drawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
2023-05-10 21:26:53 +00:00
2023-05-14 20:19:47 +00:00
endDrawing();
2023-05-10 21:26:53 +00:00
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
closeWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
2023-05-10 21:26:53 +00:00