mirror of
https://github.com/ctruLua/uCompat.git
synced 2025-10-27 16:49:31 +00:00
I tested and fixed everything, and now it works. Yes I test sometimes.
This commit is contained in:
parent
eba92fcce8
commit
5ea4493bac
5 changed files with 86 additions and 11 deletions
|
|
@ -133,7 +133,7 @@ function Canvas.newGradientRect(x1, y1, x2, y2, color1, color2, color3, color4)
|
|||
return o
|
||||
end
|
||||
|
||||
function Canvas.newText(x1, y1 text, color)
|
||||
function Canvas.newText(x1, y1, text, color)
|
||||
local o = attrTable()
|
||||
o.type = TYPE_TEXT
|
||||
o[ATTR_X1] = x1
|
||||
|
|
@ -212,7 +212,7 @@ function Canvas.setAttr(object, attrName, attrValue)
|
|||
end
|
||||
|
||||
function Canvas.getAttr(object, attrName)
|
||||
return obect[attrName]
|
||||
return object[attrName]
|
||||
end
|
||||
|
||||
function Canvas.setObjOnTop(canvas, object)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,17 @@ PLAY_LOOP = 1
|
|||
|
||||
-- Module
|
||||
|
||||
-- Sound banks
|
||||
|
||||
function Sound.loadBank(filename)
|
||||
|
||||
end
|
||||
|
||||
function Sound.unloadBank()
|
||||
|
||||
end
|
||||
|
||||
-- Mods
|
||||
function Sound.loadMod(id)
|
||||
|
||||
end
|
||||
|
|
@ -25,6 +36,10 @@ function Sound.pause()
|
|||
|
||||
end
|
||||
|
||||
function Sound.resume()
|
||||
|
||||
end
|
||||
|
||||
function Sound.stop()
|
||||
|
||||
end
|
||||
|
|
@ -56,3 +71,45 @@ end
|
|||
function Sound.setModPitch(pitch)
|
||||
|
||||
end
|
||||
|
||||
-- SFX
|
||||
|
||||
function Sound.loadSFX(id)
|
||||
|
||||
end
|
||||
|
||||
function Sound.unloadSFX(id)
|
||||
|
||||
end
|
||||
|
||||
function Sound.startSFX(id)
|
||||
return {"I am a SFX handle"}
|
||||
end
|
||||
|
||||
function Sound.stopSFX(handle)
|
||||
|
||||
end
|
||||
|
||||
function Sound.releaseSFX(handle)
|
||||
|
||||
end
|
||||
|
||||
function Sound.stopAllSFX()
|
||||
|
||||
end
|
||||
|
||||
function Sound.setSFXVolume(handle, volume)
|
||||
|
||||
end
|
||||
|
||||
function Sound.setSFXPanning(handle, panning)
|
||||
|
||||
end
|
||||
|
||||
function Sound.setSFXPitch(handle, pitch)
|
||||
|
||||
end
|
||||
|
||||
function Sound.setSFXScalePitch(handle, scale)
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function dsUser.getAlarmMinute()
|
|||
end
|
||||
|
||||
function dsUser.getLanguage()
|
||||
return language5[cgfu.getLanguage()]
|
||||
return language5[cfgu.getLanguage()]
|
||||
end
|
||||
|
||||
function dsUser.getGBAScreen()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ ULUA_LIBS = (ULUA_DIR.."libs/")
|
|||
ULUA_BOOT_FILE = "main.lua"
|
||||
ULUA_BOOT_FULLPATH = (ULUA_DIR..ULUA_BOOT_FILE)
|
||||
|
||||
-- Some old Lua functions
|
||||
function table.getn(t)
|
||||
return #t
|
||||
end
|
||||
|
||||
-- Other libs
|
||||
require("uCompat.screen")
|
||||
require("uCompat.Color")
|
||||
|
|
@ -35,4 +40,4 @@ require("uCompat.dsUser")
|
|||
require("uCompat.System")
|
||||
require("uCompat.ini")
|
||||
require("uCompat.Wifi")
|
||||
reqiore("uCompat.Nifi")
|
||||
require("uCompat.Nifi")
|
||||
|
|
|
|||
|
|
@ -124,12 +124,14 @@ function screen.print(scr, x, y, text, color)
|
|||
end
|
||||
|
||||
function screen.printFont(scr, x, y, text, color, font)
|
||||
checkBuffer(scr)[#videoStack[scr]+1] = {"text", {offsetX+x, offsetY+y, text, 8, RGB2RGBA(color), font}}
|
||||
checkBuffer(scr)[#videoStack[scr]+1] = {"text", {offsetX+x, offsetY+y, text, 8, RGB2RGBA(color), nil}}
|
||||
end
|
||||
|
||||
function screen.blit(scr, x, y, img, sx, sy, w, h)
|
||||
local x = math.floor(x) -- \ Compatibility patch for some homebrews not using integers
|
||||
local y = math.floor(y) -- /
|
||||
local sizex, sizey = img.texture:getSize()
|
||||
checkBuffer(scr)[#videoStack[scr]+1] = {"img", img.texture, {offsetX+x, offsetY+y, (sx or 0), (sy or 0), (w or sizex), (h or sizey), img.rotation}}
|
||||
checkBuffer(scr)[#videoStack[scr]+1] = {"img", img.texture, {offsetX+x+math.floor(sizex/2), offsetY+y+math.floor(sizey/2), (sx or 0), (sy or 0), (w or sizex), (h or sizey), img.rotation}}
|
||||
end
|
||||
|
||||
function screen.drawPoint(scr, x, y, color)
|
||||
|
|
@ -191,15 +193,13 @@ function screen.startDrawing2D() -- unused
|
|||
-- As you can change the screen size, we have to re-calculate this every time.
|
||||
offsetX = math.floor((gfx.BOTTOM_WIDTH-SCREEN_WIDTH)/2)
|
||||
offsetY = math.floor((gfx.BOTTOM_HEIGHT-SCREEN_HEIGHT)/2)
|
||||
if drawScreen == gfx.GFX_TOP then
|
||||
if drawScreen == gfx.TOP then
|
||||
offsetX = offsetX + 40
|
||||
end
|
||||
end
|
||||
|
||||
function screen.endDrawing()
|
||||
gfx.startFrame(drawScreen)
|
||||
--gfx.text(2, 2, "x: "..offsetX.." ;y: "..offsetY.." ;stackUP: "..#videoStack[0].." ;stackDOWN: "..#videoStack[1]) -- debug only
|
||||
--gfx.text(2, 12, "screen: "..drawScreen.." ; stack: "..#videoStack[drawScreen]) -- debug only
|
||||
gfx.start(drawScreen)
|
||||
for i=1, #videoStack[drawScreen] do
|
||||
local e = videoStack[drawScreen][i]
|
||||
if e[1] == "img" then
|
||||
|
|
@ -210,7 +210,20 @@ function screen.endDrawing()
|
|||
gfx[e[1]](table.unpack(e[2]))
|
||||
end
|
||||
end
|
||||
gfx.endFrame()
|
||||
|
||||
if offsetY ~= 0 then
|
||||
gfx.rectangle(0, 0, 400, offsetY, 0, color.getBackground())
|
||||
gfx.rectangle(0, SCREEN_HEIGHT+offsetY, 400, offsetY, 0, color.getBackground())
|
||||
end
|
||||
if offsetX ~= 0 then
|
||||
gfx.rectangle(0, 0, offsetX, 240, 0, color.getBackground())
|
||||
gfx.rectangle(offsetX+SCREEN_WIDTH, 0, offsetX, 240, 0, color.getBackground())
|
||||
end
|
||||
if drawScreen == gfx.TOP then
|
||||
gfx.text(380, 225, tostring(gfx.getFPS()))
|
||||
end
|
||||
|
||||
gfx.stop()
|
||||
|
||||
-- set the screen
|
||||
drawScreen = ((drawScreen == 0 and 1) or 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue