aboutsummaryrefslogtreecommitdiff
path: root/examples/textures_logo_raylib.c
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2014-09-21 14:08:16 +0200
committerRay <raysan5@gmail.com>2014-09-21 14:08:16 +0200
commit9d47934a0213f530cbc0cf68747d9220a41be882 (patch)
treebfaf021ffdc141c1a76504b5435f5620d21efb4c /examples/textures_logo_raylib.c
parent3b6e5119f3ba684498b712859575069177ccd279 (diff)
downloadraylib-9d47934a0213f530cbc0cf68747d9220a41be882.tar.gz
raylib-9d47934a0213f530cbc0cf68747d9220a41be882.zip
Rename ex04a_textures.c to textures_logo_raylib.c
Diffstat (limited to 'examples/textures_logo_raylib.c')
-rw-r--r--examples/textures_logo_raylib.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/examples/textures_logo_raylib.c b/examples/textures_logo_raylib.c
new file mode 100644
index 00000000..60604594
--- /dev/null
+++ b/examples/textures_logo_raylib.c
@@ -0,0 +1,58 @@
+/*******************************************************************************************
+*
+* raylib example 04a - Texture loading and drawing
+*
+* This example has been created using raylib 1.0 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib example 04a - texture loading and drawing");
+
+ // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
+ Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
+ //---------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ // TODO: Update your variables here
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ DrawTexture(texture, screenWidth/2 - texture.width/2,
+ screenHeight/2 - texture.height/2, WHITE);
+
+ DrawText("this IS a texture!", 360, 370, 10, GRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ UnloadTexture(texture); // Texture unloading
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+}