12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- graphics=require("graphics")
- matrix=require("matrix")
- quat=require("quat")
- vector=require("vector")
- loadobj=require("obj")
- posteffect=require("posteffect")
- keycode,keyname=table.unpack(require("keys"))
- gui=require("gui")
- errfunc=function(str)
- print(str)
- end
- w=graphics.window.new(1366,748,"title",errfunc)
- dt=graphics:timedelta()
- width,height,t=0,0,1
- font=w:font("fonts/mplus-1m-regular.ttf",16)
- g=gui.init(w)
- render=function(...)
- while not w:shouldclose() do
- dt=graphics:timedelta()
- t=t+dt
- width,height=w:getsize()
- w:viewport(0,0,width,height)
- w:clearcolor(0.1,0.1,0.1,1.0)
- local mx,my=w:mousegetpos()
- g:draw(mx+10,my,200,150,{0.0,0.0,0.0,0.5})
- font:draw(mx+10,my+16,200,150,"Hello, World!!!!\nqwertyuiop[](){}\'\""..tostring(t),{1.0,0.7,0.0,1.0})
- w:swap()
- graphics.pollevents()
- end
- w:close()
- --closetask(id)
- --closetask(id2)
- collectgarbage()
- end
- keycb=function(win,key,scancode,action,mods)
- print("key "..tostring(key))
- end
- --w:keycallback(keycb,errfunc)
- qwe=function(tt,...)
- local num=0
- --tt=1.3
- while true do
- if t>tt*num then
- print("num"..tostring(num))
- num=num+1
- end
- --coroutine.yield()
- end
- end
- --id2=newtask(qwe,errfunc,1.1,"q","w","e","r","t","y")
- --id=newtask(qwe,errfunc,1.3)
- newtask(render,errfunc,1,2,3,4,5)
|