-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathmain.lua
More file actions
37 lines (30 loc) · 689 Bytes
/
main.lua
File metadata and controls
37 lines (30 loc) · 689 Bytes
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
local SDL = require "SDL"
local image = require "SDL.image"
local ret, err = SDL.init { SDL.flags.Video }
if not ret then
error(err)
end
local win, err = SDL.createWindow {
title = "Hello World!",
width = 620,
height = 387,
flags = SDL.window.Shown
}
if not win then
error(err)
end
local rdr, err = SDL.createRenderer(win, -1, SDL.rendererFlags.Accelerated + SDL.rendererFlags.PresentVSYNC)
if not rdr then
error(err)
end
local img, ret = SDL.loadBMP("../img/grumpy-cat.bmp")
if not img then
error(err)
end
tex = rdr:createTextureFromSurface(img)
for i = 1, 20 do
rdr:clear()
rdr:copy(tex)
rdr:present()
SDL.delay(100)
end