Beginners_-_String_To_Integers.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "raylib.h"
  2. #include "stdlib.h"
  3. int main(void)
  4. {
  5. // Initialization
  6. //--------------------------------------------------------------------------------------
  7. const int screenWidth = 800;
  8. const int screenHeight = 450;
  9. InitWindow(screenWidth, screenHeight, "raylib example.");
  10. SetTargetFPS(60); // Set our game to run at 60 frames-per-second
  11. //--------------------------------------------------------------------------------------
  12. // Main game loop
  13. while (!WindowShouldClose()) // Detect window close button or ESC key
  14. {
  15. // Update
  16. //----------------------------------------------------------------------------------
  17. static int num;
  18. static char con[10] = " 23";
  19. num = atoi(con);
  20. //----------------------------------------------------------------------------------
  21. // Draw
  22. //----------------------------------------------------------------------------------
  23. BeginDrawing();
  24. ClearBackground(RAYWHITE);
  25. DrawText(FormatText("%i",num),200,200,20,BLACK);
  26. EndDrawing();
  27. //----------------------------------------------------------------------------------
  28. }
  29. // De-Initialization
  30. //--------------------------------------------------------------------------------------
  31. CloseWindow(); // Close window and OpenGL context
  32. //--------------------------------------------------------------------------------------
  33. return 0;
  34. }