12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include "raylib.h"
- int main(void)
- {
- // Initialization
- //--------------------------------------------------------------------------------------
- const int screenWidth = 800;
- const int screenHeight = 450;
- InitWindow(screenWidth, screenHeight, "raylib example.");
-
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- // Update
- //----------------------------------------------------------------------------------
-
-
- //----------------------------------------------------------------------------------
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
- ClearBackground(RAYWHITE);
-
- // This is one way to use the 'if' command. If there is only 1 line after the if
- // Notice that the else is on the next line.
- if(GetMouseX()<screenWidth/2)DrawText("Mouse on left side of screen.",0,0,20,GRAY);
- else DrawText("Mouse on right side of screen.",0,0,20,GRAY);
-
-
- EndDrawing();
- //----------------------------------------------------------------------------------
- }
- // De-Initialization
- //--------------------------------------------------------------------------------------
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
- return 0;
- }
|