blob: 1fa5744e2cc6bf69f3572c5cbbff1b44bf0818a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
local textColor = BLACK
local textPos = { 192, 200 }
local imageFont = -1
local text = "Congrats! You created your first window!"
function init()
RL_SetWindowTitle( "First window" )
RL_SetWindowState( FLAG_VSYNC_HINT )
end
function process( delta )
if RL_IsKeyPressed( KEY_ENTER ) then
local textSize = RL_MeasureText( 0, text, 20, 2 )
local winSize = RL_GetScreenSize()
textColor = BLUE
textPos = { winSize[1] / 2 - textSize[1] / 2, winSize[2] / 2 - textSize[2] / 2 }
end
if RL_IsKeyPressed( KEY_SPACE ) then
textColor = BLACK
textPos = { 192, 200 }
end
end
function draw()
RL_ClearBackground( RAYWHITE )
RL_DrawText( 0, text, textPos, 20, 2, textColor )
end
|