diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/core_basic_window.lua | 41 | ||||
| -rw-r--r-- | examples/rlua_execute_file.c | 39 |
2 files changed, 80 insertions, 0 deletions
diff --git a/examples/core_basic_window.lua b/examples/core_basic_window.lua new file mode 100644 index 00000000..4f288005 --- /dev/null +++ b/examples/core_basic_window.lua @@ -0,0 +1,41 @@ +-- Initialization +---------------------------------------------------------------------------------------- +local screenWidth = 800 +local screenHeight = 450 + +InitWindow(screenWidth, screenHeight, "raylib [rlua] example - basic window") + +InitAudioDevice() + +--local pause = false +--local texture = LoadTexture("resources/texture.png") + +SetTargetFPS(60) -- Set target frames-per-second +---------------------------------------------------------------------------------------- + +while not WindowShouldClose() do + -- Update + ------------------------------------------------------------------------------------ + --if (IsKeyPressed(KEY.SPACE)) then + -- pause = not pause + --end + ------------------------------------------------------------------------------------ + + -- Draw + ------------------------------------------------------------------------------------ + BeginDrawing() + + ClearBackground(RAYWHITE) + + DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY) + + EndDrawing() + ------------------------------------------------------------------------------------ +end + +-- De-Initialization +------------------------------------------------------------------------------------ +CloseAudioDevice() -- Close audio device + +CloseWindow() -- Close window and OpenGL context +------------------------------------------------------------------------------------
\ No newline at end of file diff --git a/examples/rlua_execute_file.c b/examples/rlua_execute_file.c new file mode 100644 index 00000000..b21a4459 --- /dev/null +++ b/examples/rlua_execute_file.c @@ -0,0 +1,39 @@ +/******************************************************************************************* +* +* raylib [rlua] example - Lua file execution +* +* NOTE: This example requires Lua library (http://luabinaries.sourceforge.net/download.html) +* +* Compile example using: +* gcc -o $(NAME_PART).exe $(FILE_NAME) $(RAYLIB_DIR)\raylib_icon / +* -I../src -I../src/external/lua/include -L../src/external/lua/lib / +* -lraylib -lglfw3 -lopengl32 -lopenal32 -llua53 -lgdi32 -std=c99 +* +* This example has been created using raylib 1.6 (www.raylib.com) +* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) +* +* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5) +* +********************************************************************************************/ + +#include "raylib.h" + +#define RLUA_IMPLEMENTATION +#include "rlua.h" + +int main() +{ + // Initialization + //-------------------------------------------------------------------------------------- + InitLuaDevice(); + //-------------------------------------------------------------------------------------- + + ExecuteLuaFile("core_basic_window.lua"); + + // De-Initialization + //-------------------------------------------------------------------------------------- + CloseLuaDevice(); // Close Lua device and free resources + //-------------------------------------------------------------------------------------- + + return 0; +}
\ No newline at end of file |
