mirror of
https://github.com/ctruLua/uCompat.git
synced 2025-10-27 16:49:31 +00:00
Added Font and System libs
This commit is contained in:
parent
0166ba6bce
commit
31f86ae648
13 changed files with 111 additions and 0 deletions
|
|
@ -7,9 +7,11 @@ Actually done:
|
|||
* Color
|
||||
* Controls
|
||||
* dsUser
|
||||
* Font
|
||||
* Image
|
||||
* Motion
|
||||
* Rumble
|
||||
* screen
|
||||
* Sprite
|
||||
* System
|
||||
* Timer
|
||||
|
|
|
|||
25
uCompat/Font.lua
Normal file
25
uCompat/Font.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
--[[
|
||||
Fonts related µLua compatibility layer/lib for ctrµLua.
|
||||
|
||||
No support for bitmap fonts actually, it would be too slow.
|
||||
]]
|
||||
|
||||
-- Module
|
||||
|
||||
Font = {}
|
||||
|
||||
function Font.load(path)
|
||||
return true
|
||||
end
|
||||
|
||||
function Font.destroy(font)
|
||||
font = nil
|
||||
end
|
||||
|
||||
function Font.getCharHeight(font)
|
||||
return 8
|
||||
end
|
||||
|
||||
function Font.getStringWidth(font, text)
|
||||
return (#text*6)
|
||||
end
|
||||
82
uCompat/System.lua
Normal file
82
uCompat/System.lua
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
--[[
|
||||
System related µLua compatibility layer/lib for ctrµLua
|
||||
|
||||
The System table must not exist.
|
||||
]]
|
||||
|
||||
-- Local
|
||||
|
||||
local fs = require("ctr.fs")
|
||||
local gfx = require("ctr.gfx")
|
||||
|
||||
-- Constants
|
||||
|
||||
LED_ON = 0
|
||||
LED_BLINK = 1
|
||||
LED_SLEEP = 2
|
||||
|
||||
-- Module
|
||||
|
||||
System = {}
|
||||
|
||||
function System.currentDirectory()
|
||||
return fs.getDirectory()
|
||||
end
|
||||
|
||||
function System.changeDirectory(dir)
|
||||
fs.setDirectory(dir)
|
||||
end
|
||||
|
||||
function System.remove(path)
|
||||
|
||||
end
|
||||
|
||||
function System.rename(old, new)
|
||||
|
||||
end
|
||||
|
||||
function System.makeDirectory(name)
|
||||
|
||||
end
|
||||
|
||||
function System.listDirectory(path)
|
||||
local list = fs.list(path)
|
||||
local flist = {}
|
||||
for i=1, #list do
|
||||
flist[i] = {
|
||||
name = list[i].name,
|
||||
isDir = list[i].isDirectory,
|
||||
size = list[i].fileSize
|
||||
}
|
||||
end
|
||||
|
||||
return flist
|
||||
end
|
||||
|
||||
function System.CurrentVramUsed()
|
||||
return (6291456-gfx.vramSpaceFree())
|
||||
end
|
||||
|
||||
function System.CurrentVramFree()
|
||||
return gfx.vramSpaceFree()
|
||||
end
|
||||
|
||||
function System.CurrentPalUsed()
|
||||
return 0
|
||||
end
|
||||
|
||||
function System.CurrentPalFree()
|
||||
return 0
|
||||
end
|
||||
|
||||
function System.setLedBlinkMode(mode)
|
||||
|
||||
end
|
||||
|
||||
function System.shutDown()
|
||||
|
||||
end
|
||||
|
||||
function System.sleep()
|
||||
|
||||
end
|
||||
|
|
@ -15,6 +15,7 @@ ULUA_BOOT_FULLPATH = (ULUA_DIR..ULUA_BOOT_FILE)
|
|||
-- Other libs
|
||||
require("uCompat.screen")
|
||||
require("uCompat.Color")
|
||||
require("uCompat.Font")
|
||||
require("uCompat.Image")
|
||||
require("uCompat.Timer")
|
||||
require("uCompat.Sprite")
|
||||
|
|
@ -22,3 +23,4 @@ require("uCompat.Controls")
|
|||
require("uCompat.Motion")
|
||||
require("uCompat.Rumble")
|
||||
require("uCompat.dsUser")
|
||||
require("uCompat.System")
|
||||
Loading…
Add table
Add a link
Reference in a new issue