diff options
| author | jussi | 2023-04-06 12:31:37 +0300 |
|---|---|---|
| committer | jussi | 2023-04-06 12:31:37 +0300 |
| commit | 2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a (patch) | |
| tree | 825775577403d9341045571adb266173513c4bbd /examples/waving_cubes | |
| parent | 198a74c0aa27389c062c47bc29187c58a9d6c4a1 (diff) | |
| download | reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.tar.gz reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.tar.bz2 reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.zip | |
All global variables and functions are not in global RL table. doc_parser creates also ReiLua_API.lua.
Diffstat (limited to 'examples/waving_cubes')
| -rw-r--r-- | examples/waving_cubes/main.lua | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/examples/waving_cubes/main.lua b/examples/waving_cubes/main.lua index eab9758..d8cd143 100644 --- a/examples/waving_cubes/main.lua +++ b/examples/waving_cubes/main.lua @@ -9,40 +9,40 @@ local camera = -1 local num_blocks = 15 -function init() +function RL.init() local monitor = 0 - local mPos = RL_GetMonitorPosition( monitor ) - local mSize = RL_GetMonitorSize( monitor ) - local winSize = RL_GetScreenSize() - - RL_SetWindowTitle( "Waving cubes" ) - RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) - RL_SetWindowState( FLAG_VSYNC_HINT ) - RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) + local mPos = RL.GetMonitorPosition( monitor ) + local mSize = RL.GetMonitorSize( monitor ) + local winSize = RL.GetScreenSize() - camera = RL_CreateCamera3D() - RL_SetCamera3DPosition( camera, { 30, 20, 30 } ) - RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) - RL_SetCamera3DUp( camera, { 0, 1, 0 } ) + RL.SetWindowTitle( "Waving cubes" ) + RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) + RL.SetWindowState( RL.FLAG_VSYNC_HINT ) + RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) + + camera = RL.CreateCamera3D() + RL.SetCamera3DPosition( camera, { 30, 20, 30 } ) + RL.SetCamera3DTarget( camera, { 0, 0, 0 } ) + RL.SetCamera3DUp( camera, { 0, 1, 0 } ) end -function draw() - local t = RL_GetTime() +function RL.draw() + local t = RL.GetTime() local cos = math.cos local sin = math.sin local scale = (2.0 + sin(t)) * 0.7 local camera_time = t * 0.3 - local camera_pos = RL_GetCamera3DPosition( camera ) + local camera_pos = RL.GetCamera3DPosition( camera ) camera_pos[1] = cos(camera_time) * 40.0 camera_pos[3] = sin(camera_time) * 40.0 - - RL_SetCamera3DPosition( camera, camera_pos ) - RL_ClearBackground( RAYWHITE ) - RL_BeginMode3D( camera ) - RL_DrawGrid( 10, 5.0 ) + RL.SetCamera3DPosition( camera, camera_pos ) + RL.ClearBackground( RL.RAYWHITE ) + + RL.BeginMode3D( camera ) + RL.DrawGrid( 10, 5.0 ) for x = 0,num_blocks - 1 do for y = 0,num_blocks - 1 do @@ -55,14 +55,14 @@ function draw() (y - num_blocks / 2) * (scale * 2.0) + scatter, (z - num_blocks / 2) * (scale * 3.0) + scatter } - local cube_color = RL_ColorFromHSV( (((x + y + z) * 18) % 360), 0.75, 0.9 ) + local cube_color = RL.ColorFromHSV( (((x + y + z) * 18) % 360), 0.75, 0.9 ) local cube_size = (2.4 - scale) * block_scale - RL_DrawCube( cube_pos, { cube_size, cube_size, cube_size }, cube_color ) + RL.DrawCube( cube_pos, { cube_size, cube_size, cube_size }, cube_color ) end end end - RL_EndMode3D() + RL.EndMode3D() - RL_DrawFPS( { 10, 10 } ) + RL.DrawFPS( { 10, 10 } ) end |
