- [NEW] zoom(), fullscreen(), cursor(), getconf(), setconf(). - [CHG] now zoom and fullscreen are controlled by the game, not by mini. - [FIX] quit() now actually quits. - [NEW] btnp() without parameters returns key pressed. - [NEW] zoom, fullscreen and cursor are saved to config automatically.
63 lines
1.4 KiB
Lua
63 lines
1.4 KiB
Lua
x=0
|
|
|
|
function _init()
|
|
text="HOLA MINI"
|
|
keyRight = tonumber(getconf("keyright")) or KEY_RIGHT
|
|
keyLeft = tonumber(getconf("keyleft")) or KEY_LEFT
|
|
_update=normal_update
|
|
end
|
|
|
|
function _update()
|
|
end
|
|
|
|
function normal_update()
|
|
cls(20)
|
|
prnt(text,x,60)
|
|
if btnp(keyRight) then x=x+1 end
|
|
if btnp(keyLeft) then x=x-1 end
|
|
if btnp(KEY_SPACE) then
|
|
redefinekeys.init()
|
|
end
|
|
if btnp(KEY_ESCAPE) then
|
|
quit()
|
|
end
|
|
|
|
if btnp(KEY_F2) then
|
|
local val = zoom() + 2
|
|
if val >= 10 then val = 2 end
|
|
zoom(val)
|
|
elseif btnp(KEY_F3) then
|
|
fullscreen(not fullscreen())
|
|
end
|
|
|
|
if x>160 then x=-strlen(text)*4 end
|
|
end
|
|
|
|
redefinekeys = {
|
|
state = 0,
|
|
init = function ()
|
|
redefinekeys.state=0
|
|
_update=redefinekeys.update
|
|
end,
|
|
update = function()
|
|
cls(20)
|
|
if redefinekeys.state == 0 then
|
|
prnt("PULSA TECLA PER A DRETA...",0,0)
|
|
local key = btnp();
|
|
if key ~= 0 then
|
|
redefinekeys.state = 1
|
|
keyRight=key
|
|
setconf("keyright", keyRight)
|
|
end
|
|
elseif redefinekeys.state == 1 then
|
|
prnt("PULSA TECLA PER A ESQUERRA...",0,0)
|
|
local key = btnp();
|
|
if key ~= 0 then
|
|
keyLeft=key
|
|
setconf("keyleft", keyLeft)
|
|
_update=normal_update
|
|
end
|
|
end
|
|
end
|
|
}
|