|
@@ -0,0 +1,57 @@
|
|
|
|
+
|
|
|
|
+#include "raylib.h"
|
|
|
|
+
|
|
|
|
+// Let the compiler know we are using a function outside the main function.
|
|
|
|
+void drawmessage(int x,int y);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+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);
|
|
|
|
+
|
|
|
|
+ // Here we use the function that is outside our main function.
|
|
|
|
+ drawmessage(100,100);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ EndDrawing();
|
|
|
|
+ //----------------------------------------------------------------------------------
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // De-Initialization
|
|
|
|
+ //--------------------------------------------------------------------------------------
|
|
|
|
+ CloseWindow(); // Close window and OpenGL context
|
|
|
|
+ //--------------------------------------------------------------------------------------
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// This is our function
|
|
|
|
+// It is outside the main function.
|
|
|
|
+// void means it returns nothing.
|
|
|
|
+void drawmessage(int x,int y){
|
|
|
|
+ DrawText("Hello World.",x,y,20,BLACK);
|
|
|
|
+}
|