-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfml_test.nelua
56 lines (43 loc) · 1.03 KB
/
sfml_test.nelua
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require 'sfml'
do print '# Time'
local t: sfml.Time = sfml.Time.zero
local ms = t:as_milliseconds()
local sec = t:as_seconds()
print(ms, sec)
end
do print '\n## Clock'
local c: *sfml.Clock = sfml.Clock.create()
defer c:destroy() end
print(c:get_elapsed_time():as_seconds())
print(c:get_elapsed_time():as_milliseconds())
end
do print '\n# Threads'
local function thing(ptr: pointer)
for i=0, 20 do
print(i)
end
end
local t: *sfml.Thread = sfml.Thread.create(thing, nilptr)
defer t:destroy() end
t:launch()
t:wait()
end
do print '\n# Vectors'
local vi = sfml.Vector2i{1, 2}
print(vi.x, vi.y)
local vu = sfml.Vector2u{1, 2}
print(vu.x, vu.y)
local vf = sfml.Vector2f{1, 2}
print(vf.x, vf.y)
local v3 = sfml.Vector3f{1, 2, 3}
print(v3.x, v3.y, v3.z)
end
do print '\n# Window'
local window = sfml.Window.create((@sfml.VideoMode){720, 480, 32}, "Hello", sfml.DefaultStyle, nilptr)
defer window:destroy() end
print('Open?', window:is_open())
end
do print '\n# Misc'
local m = sfml.MouseButton.Left
print(m)
end