- [NEW] camera() without arguments returns 'x' and 'y' of camera. - [NEW] palcolor() to set or get a color from the palette (replaces setcolor() & getcolor() ). - [NEW] paltrans() to set or get which color index is transparent (replaces settrans() & gettrans() ). - [RENAME] sspr() to blit(), spr_r() to blit_r() - [NEW] mouse() returns both x and y mouse coordinates. - [DEPRECATED] setcolor(), getcolor(), settrans(), gettrans(), spr(), sspr(), spr_r(), mousex(), mousey(), abs(), ceil(), flr(), sgn(), sin(), cos(), atan2(), sqrt(), max(), mid(), min(), tostr(), ascii(), strlen(), fopen(), fopenres(), fclose(), feof(), fwritei(), fwrited(), fwrites(), fwritew(), fwriteb(), fwriteln(), freadi(), freadd(), freads(), freadw(), freadb() - [FIX] Now the background on resizable windows is filled with black instead of garbage. - [FIX] Compiling on Linux uses POSIX functions.
81 lines
1.7 KiB
Lua
81 lines
1.7 KiB
Lua
other = require "other"
|
|
|
|
x=0
|
|
|
|
function _init()
|
|
text=other.peiv()
|
|
keyRight = tonumber(getconf("keyright")) or KEY_RIGHT
|
|
keyLeft = tonumber(getconf("keyleft")) or KEY_LEFT
|
|
_update=normal_update
|
|
turbo(false)
|
|
local perico = "péricòñ"
|
|
print(utf8.len(perico))
|
|
end
|
|
|
|
function _update()
|
|
end
|
|
|
|
function normal_update()
|
|
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) or mbtnp(1) 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
|
|
|
|
view()
|
|
cls(20)
|
|
view(10,10,140,100)
|
|
cls(3)
|
|
color(5)
|
|
prnt("HOLA",0,0)
|
|
origin(70,50)
|
|
prnt("ORIGIN",0,0)
|
|
prnt(text,x,10)
|
|
color(10)
|
|
bcolor(15)
|
|
fillp(0x5a5a, false);
|
|
circfill(20,20,10);
|
|
fillp(0xffff,false);
|
|
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
|
|
}
|