other = require "other" x=0 function mini.init() text=other.peiv() keyRight = tonumber(config.getKey("keyright")) or key.RIGHT keyLeft = tonumber(config.getKey("keyleft")) or key.LEFT mini.update=normal_update --turbo(false) local perico = "péricòñ" print(utf8.len(perico)) ants = 0xc936; s = surface.load("tiles01.gif") --surface.source(s) p = palette.load("tiles01.gif") palette.set(p) palette.setTransparent(255) print(#p) surface.save(s, "data/copy.gif") s = surface.load("copy.gif") --draw.source(s) system.setBeat(4) end function mini.update() if keyboard.keyPressed(key.ESCAPE) then system.quit() end if system.isBeat() then ants = (ants >> 12) | ((ants<<4)&0xffff) end surface.cls(5) draw.surface(s, 0, 0, 64, 64, 10, 10) draw.rect(10, 10, 73, 73, 8) draw.setPattern(ants) draw.rect(10, 10, 73, 73, 0) draw.setPattern(0xffff) --draw.text(#p,0,0,2) end function normal_update() if keyboard.keyPressed(key.RIGHT) then x=x+1 end if keyboard.keyPressed(key.LEFT) then x=x-1 end if keyboard.keyPressed(key.SPACE) then redefinekeys.init() end if keyboard.keyPressed(key.ESCAPE) then system.quit() end if keyboard.keyPressed(key.F2) or mouse.buttonPressed(1) then local val = window.getZoom() + 2 if val >= 10 then val = 2 end window.setZoom(val) elseif keyboard.keyPressed(key.F3) then window.setFullscreen(not window.getFullscreen()) end if x>160 then x=-utf8.len(text)*4 end viewport.resetClipping() viewport.setOrigin(0,0) surface.cls(20) viewport.setClipping(10,10,140,100) surface.cls(3) draw.text("HOLA",0,0,5) viewport.setOrigin(-70,-50) draw.text("ORÍGIN",0,0,5) draw.text(text,x,10,5) draw.circFill(20,20,10,15); draw.setPattern(0x5a5a); draw.circFill(20,20,10,10); draw.setPattern(0xffff); end redefinekeys = { state = 0, init = function () redefinekeys.state=0 _update=redefinekeys.update end, update = function() surface.cls(20) if redefinekeys.state == 0 then draw.text("PULSA TECLA PER A DRETA...",0,0,10) local key = keyboard.keyPressed(); if key ~= 0 then redefinekeys.state = 1 keyRight=key config.setKey("keyright", keyRight) end elseif redefinekeys.state == 1 then draw.text("PULSA TECLA PER A ESQUERRA...",0,0,10) local key = keyboard.keyPressed(); if key ~= 0 then keyLeft=key config.setKey("keyleft", keyLeft) _update=normal_update end end end }