CCAPI update as "bit" is now an alias of "bit32"

Former-commit-id: 68c272908747e3ab451799b4cddd211fbee09489
Former-commit-id: aeaa3e995030501175d3692248a1a3cc2d9bfcfa
This commit is contained in:
Song Minjae
2016-09-28 00:44:43 +09:00
parent 7fec3fc066
commit 4b1ff36344
2 changed files with 24 additions and 30 deletions

View File

@@ -26,19 +26,13 @@ local function intLog2(i)
end
-------------
-- BIT API --
-------------
-----------------------
-- BIT API Extension --
-----------------------
_G.bit = {} -- CC's weird BIT API
bit.blshift = function(n, bits) bit32.lshift(n, bits) end
bit.brshift = function(n, bits) bit32.arshift(n, bits) end
bit.blogic_rshift = function(n, bits) bit32.rshift(n, bits) end
bit.bxor = function(m, n) bit32.bxor(m, n) end
bit.bor = function(m, n) bit32.bor(m, n) end
bit.band = function(m, n) bit32.band(m, n) end
bit.bnot = function(n) bit32.bnot(n) end
bit.blshift = bit32.lshift(n, bits)
bit.brshift = bit32.arshift(n, bits)
bit.blogic_rshift = bit32.rshift(n, bits)
----------------
@@ -134,28 +128,28 @@ term.blit = function(text, foreCol, backCol)
end
end
term.getCursorPos = function() return term.getCursor() end
term.setCursorPos = function(x, y) term.moveCursor(x, y) end
term.setCursorBlink = function(b) term.blink(b) end
term.isColor = function() return term.isCol() end
term.getSize = function() return term.size() end
term.getCursorPos = term.getCursor
term.setCursorPos = term.moveCursor
term.setCursorBlink = term.blink
term.isColor = term.isCol
term.getSize = term.size
term.setTextColor = function(cccol) term.setForeCol(ccToGameCol[normaliseCCcol(cccol)]) end
term.getTextColor = function() return term.getForeCol() end
term.getTextColor = term.getForeCol
term.setBackgroundColor = function(cccol) term.setBackCol(ccToGameCol[normaliseCCcol(cccol)]) end
term.getBackgroundColor = function() return term.getBackCol() end
term.getBackgroundColor = term.getBackCol
--------------------
-- FILESYSTEM API --
--------------------
fs.makeDir = function(p) fs.mkdir(p) end
fs.move = function(a, b) fs.mv(a, b) end
fs.copy = function(a, b) fs.cp(a, b) end
fs.delete = function(p) fs.rm(p) end
fs.combine = function(a, b) return fs.concat(a, b) end
fs.getDir = function(p) return fs.parent(p) end
fs.run = function(p) fs.dofile(p) end
fs.makeDir = fs.mkdir
fs.move = fs.mv
fs.copy = fs.cp
fs.delete = fs.rm
fs.combine = fs.concat
fs.getDir = fs.parent
fs.run = fs.dofile
------------------

View File

@@ -22,14 +22,14 @@ class Input(globals: Globals, computer: BaseTerrarumComputer) {
val keys_caps = intArrayOf(Key.CAPS_LOCK, Key.BACKSPACE, Key.L_CONTROL)
}
class IsKeyDown(val computer: BaseTerrarumComputer) : OneArgFunction() {
class IsKeyDown(val host: BaseTerrarumComputer) : OneArgFunction() {
override fun call(keyCode: LuaValue): LuaValue {
val key = keyCode.checkint()
// L_Alt and L_COMMAND are homogeneous
if (keys_alt.contains(key)) {
for (k in keys_alt) {
val down = computer.input.isKeyDown(k)
val down = host.input.isKeyDown(k)
if (down) return LuaValue.valueOf(true)
}
}
@@ -37,12 +37,12 @@ class Input(globals: Globals, computer: BaseTerrarumComputer) {
// Caps, Backspace, L_Control, for Colemak and HHKB
if (keys_caps.contains(key)) {
for (k in keys_caps) {
val down = computer.input.isKeyDown(k)
val down = host.input.isKeyDown(k)
if (down) return LuaValue.valueOf(true)
}
}
return LuaValue.valueOf(computer.input.isKeyDown(keyCode.checkint()))
return LuaValue.valueOf(host.input.isKeyDown(keyCode.checkint()))
}
}
}