Debian Codegraph @

projects/CMake/core_basic_window.c

raw symbols SCIP
1 /*******************************************************************************************
2 *
3 * raylib [core] example - Basic window (adapted for HTML5 platform)
4 *
5 * This example is prepared to compile for PLATFORM_WEB and PLATFORM_DESKTOP
6 * As you will notice, code structure is slightly different to the other examples...
7 * To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
8 *
9 * This example has been created using raylib 1.3 (www.raylib.com)
10 * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
11 *
12 * Copyright (c) 2015 Ramon Santamaria (@raysan5)
13 *
14 ********************************************************************************************/
15
16 #include "raylib.h"
17
18 #if defined(PLATFORM_WEB)
19 #include <emscripten/emscripten.h>
20 #endif
21
22 //----------------------------------------------------------------------------------
23 // Global Variables Definition
24 //----------------------------------------------------------------------------------
25 int screenWidth = 800;
26 int screenHeight = 450;
27
28 //----------------------------------------------------------------------------------
29 // Module Functions Declaration
30 //----------------------------------------------------------------------------------
31 void UpdateDrawFrame(void); // Update and Draw one frame
32
33 //----------------------------------------------------------------------------------
34 // Program main entry point
35 //----------------------------------------------------------------------------------
36 int main()
37 {
38 // Initialization
39 //--------------------------------------------------------------------------------------
40 InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
41
42 #if defined(PLATFORM_WEB)
43 emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
44 #else
45 SetTargetFPS(60); // Set our game to run at 60 frames-per-second
46 //--------------------------------------------------------------------------------------
47
48 // Main game loop
49 while (!WindowShouldClose()) // Detect window close button or ESC key
50 {
51 UpdateDrawFrame();
52 }
53 #endif
54
55 // De-Initialization
56 //--------------------------------------------------------------------------------------
57 CloseWindow(); // Close window and OpenGL context
58 //--------------------------------------------------------------------------------------
59
60 return 0;
61 }
62
63 //----------------------------------------------------------------------------------
64 // Module Functions Definition
65 //----------------------------------------------------------------------------------
66 void UpdateDrawFrame(void)
67 {
68 // Update
69 //----------------------------------------------------------------------------------
70 // TODO: Update your variables here
71 //----------------------------------------------------------------------------------
72
73 // Draw
74 //----------------------------------------------------------------------------------
75 BeginDrawing();
76
77 ClearBackground(RAYWHITE);
78
79 DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
80
81 EndDrawing();
82 //----------------------------------------------------------------------------------
83 }