Beginners_-_ScissorMode.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "raylib.h"
  2. int main(void)
  3. {
  4. // Initialization
  5. //--------------------------------------------------------------------------------------
  6. const int screenWidth = 800;
  7. const int screenHeight = 450;
  8. InitWindow(screenWidth, screenHeight, "raylib example.");
  9. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  10. //--------------------------------------------------------------------------------------
  11. // Main game loop
  12. while (!WindowShouldClose()) // Detect window close button or ESC key
  13. {
  14. // Update
  15. //----------------------------------------------------------------------------------
  16. //----------------------------------------------------------------------------------
  17. // Draw
  18. //----------------------------------------------------------------------------------
  19. BeginDrawing();
  20. ClearBackground(RAYWHITE);
  21. // Here we start the scissormode.
  22. BeginScissorMode(100,100,screenWidth-200,screenHeight-200);
  23. DrawRectangle(0,0,screenWidth,screenHeight,RED);
  24. // We need to end the scissormode to be able to draw outside that area.
  25. EndScissorMode();
  26. DrawText("ScissorMode example.",0,0,30,GRAY);
  27. EndDrawing();
  28. //----------------------------------------------------------------------------------
  29. }
  30. // De-Initialization
  31. //--------------------------------------------------------------------------------------
  32. CloseWindow(); // Close window and OpenGL context
  33. //--------------------------------------------------------------------------------------
  34. return 0;
  35. }