This commit is contained in:
2026-04-28 08:04:01 -05:00
parent 19f2a2c616
commit a41b0e916b
57 changed files with 5023 additions and 3503 deletions
+32
View File
@@ -0,0 +1,32 @@
var Cube = {
create: function() {
var e = Entity.create();
e.add(COMPONENT_TYPE_POSITION);
e.position.x = 0;
e.position.y = 0;
e.position.z = 0;
e.add(COMPONENT_TYPE_MESH);
e.add(COMPONENT_TYPE_MATERIAL);
e.material.setColor(colorRed());
return {
_e: e,
update: Cube.update,
dispose: Cube.dispose
};
},
update: function() {
var speed = 3.0;
var dx = inputAxis(INPUT_ACTION_LEFT, INPUT_ACTION_RIGHT);
var dz = inputAxis(INPUT_ACTION_UP, INPUT_ACTION_DOWN);
this._e.position.x += dx * speed * TIME.delta;
this._e.position.z += dz * speed * TIME.delta;
},
dispose: function() {
this._e.dispose();
}
};
Cube;
-25
View File
@@ -1,25 +0,0 @@
local Cube = setmetatable({}, { __index = Entity })
Cube.__index = Cube
function Cube.new()
local self = Entity.new()
setmetatable(self, Cube)
self:add(Entity.POSITION)
self.position.x = 0
self.position.y = 0
self.position.z = 0
self:add(Entity.MESH)
self:add(Entity.MATERIAL)
self.material.color = colorRed()
return self
end
function Cube:update()
local speed = 3.0
local dx = inputAxis(INPUT_ACTION_LEFT, INPUT_ACTION_RIGHT)
local dz = inputAxis(INPUT_ACTION_UP, INPUT_ACTION_DOWN)
self.position.x = self.position.x + dx * speed * TIME.delta
self.position.z = self.position.z + dz * speed * TIME.delta
end
return Cube
+75
View File
@@ -0,0 +1,75 @@
// Default input bindings.
if (typeof PSP !== 'undefined') {
inputBind("up", INPUT_ACTION_UP);
inputBind("down", INPUT_ACTION_DOWN);
inputBind("left", INPUT_ACTION_LEFT);
inputBind("right", INPUT_ACTION_RIGHT);
inputBind("accept", INPUT_ACTION_ACCEPT);
inputBind("cancel", INPUT_ACTION_CANCEL);
inputBind("select", INPUT_ACTION_RAGEQUIT);
inputBind("lstick_up", INPUT_ACTION_UP);
inputBind("lstick_down", INPUT_ACTION_DOWN);
inputBind("lstick_left", INPUT_ACTION_LEFT);
inputBind("lstick_right", INPUT_ACTION_RIGHT);
inputBind("triangle", INPUT_ACTION_CONSOLE);
} else if (typeof DOLPHIN !== 'undefined') {
inputBind("up", INPUT_ACTION_UP);
inputBind("down", INPUT_ACTION_DOWN);
inputBind("left", INPUT_ACTION_LEFT);
inputBind("right", INPUT_ACTION_RIGHT);
inputBind("b", INPUT_ACTION_CANCEL);
inputBind("a", INPUT_ACTION_ACCEPT);
inputBind("z", INPUT_ACTION_CONSOLE);
inputBind("lstick_up", INPUT_ACTION_UP);
inputBind("lstick_down", INPUT_ACTION_DOWN);
inputBind("lstick_left", INPUT_ACTION_LEFT);
inputBind("lstick_right", INPUT_ACTION_RIGHT);
} else if (typeof LINUX !== 'undefined') {
if (typeof INPUT_KEYBOARD !== 'undefined') {
inputBind("w", INPUT_ACTION_UP);
inputBind("s", INPUT_ACTION_DOWN);
inputBind("a", INPUT_ACTION_LEFT);
inputBind("d", INPUT_ACTION_RIGHT);
inputBind("left", INPUT_ACTION_LEFT);
inputBind("right", INPUT_ACTION_RIGHT);
inputBind("up", INPUT_ACTION_UP);
inputBind("down", INPUT_ACTION_DOWN);
inputBind("enter", INPUT_ACTION_ACCEPT);
inputBind("e", INPUT_ACTION_ACCEPT);
inputBind("q", INPUT_ACTION_CANCEL);
inputBind("escape", INPUT_ACTION_RAGEQUIT);
inputBind("`", INPUT_ACTION_CONSOLE);
}
if (typeof INPUT_GAMEPAD !== 'undefined') {
inputBind("gamepad_up", INPUT_ACTION_UP);
inputBind("gamepad_down", INPUT_ACTION_DOWN);
inputBind("gamepad_left", INPUT_ACTION_LEFT);
inputBind("gamepad_right", INPUT_ACTION_RIGHT);
inputBind("gamepad_a", INPUT_ACTION_ACCEPT);
inputBind("gamepad_b", INPUT_ACTION_CANCEL);
inputBind("gamepad_back", INPUT_ACTION_RAGEQUIT);
inputBind("gamepad_lstick_up", INPUT_ACTION_UP);
inputBind("gamepad_lstick_down", INPUT_ACTION_DOWN);
inputBind("gamepad_lstick_left", INPUT_ACTION_LEFT);
inputBind("gamepad_lstick_right", INPUT_ACTION_RIGHT);
}
if (typeof INPUT_POINTER !== 'undefined') {
inputBind("mouse_x", INPUT_ACTION_POINTERX);
inputBind("mouse_y", INPUT_ACTION_POINTERY);
}
} else {
consolePrint("Unknown platform, no default input bindings set.");
}
Scene.set('scenes/cube.js');
-75
View File
@@ -1,75 +0,0 @@
-- Default Input bindings.
if PSP then
inputBind("up", INPUT_ACTION_UP)
inputBind("down", INPUT_ACTION_DOWN)
inputBind("left", INPUT_ACTION_LEFT)
inputBind("right", INPUT_ACTION_RIGHT)
inputBind("accept", INPUT_ACTION_ACCEPT)
inputBind("cancel", INPUT_ACTION_CANCEL)
inputBind("select", INPUT_ACTION_RAGEQUIT)
inputBind("lstick_up", INPUT_ACTION_UP)
inputBind("lstick_down", INPUT_ACTION_DOWN)
inputBind("lstick_left", INPUT_ACTION_LEFT)
inputBind("lstick_right", INPUT_ACTION_RIGHT)
inputBind("triangle", INPUT_ACTION_CONSOLE)
elseif DOLPHIN then
inputBind("up", INPUT_ACTION_UP)
inputBind("down", INPUT_ACTION_DOWN)
inputBind("left", INPUT_ACTION_LEFT)
inputBind("right", INPUT_ACTION_RIGHT)
inputBind("b", INPUT_ACTION_CANCEL)
inputBind("a", INPUT_ACTION_ACCEPT)
inputBind("z", INPUT_ACTION_CONSOLE)
inputBind("lstick_up", INPUT_ACTION_UP)
inputBind("lstick_down", INPUT_ACTION_DOWN)
inputBind("lstick_left", INPUT_ACTION_LEFT)
inputBind("lstick_right", INPUT_ACTION_RIGHT)
elseif LINUX then
if INPUT_KEYBOARD then
inputBind("w", INPUT_ACTION_UP)
inputBind("s", INPUT_ACTION_DOWN)
inputBind("a", INPUT_ACTION_LEFT)
inputBind("d", INPUT_ACTION_RIGHT)
inputBind("left", INPUT_ACTION_LEFT)
inputBind("right", INPUT_ACTION_RIGHT)
inputBind("up", INPUT_ACTION_UP)
inputBind("down", INPUT_ACTION_DOWN)
inputBind("enter", INPUT_ACTION_ACCEPT)
inputBind("e", INPUT_ACTION_ACCEPT)
inputBind("q", INPUT_ACTION_CANCEL)
inputBind("escape", INPUT_ACTION_RAGEQUIT)
inputBind("`", INPUT_ACTION_CONSOLE)
end
if INPUT_GAMEPAD then
inputBind("gamepad_up", INPUT_ACTION_UP)
inputBind("gamepad_down", INPUT_ACTION_DOWN)
inputBind("gamepad_left", INPUT_ACTION_LEFT)
inputBind("gamepad_right", INPUT_ACTION_RIGHT)
inputBind("gamepad_a", INPUT_ACTION_ACCEPT)
inputBind("gamepad_b", INPUT_ACTION_CANCEL)
inputBind("gamepad_back", INPUT_ACTION_RAGEQUIT)
inputBind("gamepad_lstick_up", INPUT_ACTION_UP)
inputBind("gamepad_lstick_down", INPUT_ACTION_DOWN)
inputBind("gamepad_lstick_left", INPUT_ACTION_LEFT)
inputBind("gamepad_lstick_right", INPUT_ACTION_RIGHT)
end
if INPUT_POINTER then
inputBind("mouse_x", INPUT_ACTION_POINTERX)
inputBind("mouse_y", INPUT_ACTION_POINTERY)
end
else
print("Unknown platform, no default input bindings set.")
end
Scene.set('scenes/cube.lua')
+29
View File
@@ -0,0 +1,29 @@
var Cube = include('entities/cube.js');
var cam;
var cube;
var SceneCube = {
init: function() {
cam = Entity.create();
cam.add(COMPONENT_TYPE_POSITION);
cam.position.x = 3;
cam.position.y = 3;
cam.position.z = 3;
cam.position.lookAt(0, 0, 0);
cam.add(COMPONENT_TYPE_CAMERA);
cube = Cube.create();
},
update: function() {
cube.update();
},
dispose: function() {
cam.dispose();
cube.dispose();
}
};
SceneCube;
-30
View File
@@ -1,30 +0,0 @@
local Cube = include('entities/cube.lua')
local SceneCube = {}
SceneCube.__index = SceneCube
local cam
local cube
function SceneCube:init()
cam = Entity.new()
cam:add(Entity.POSITION)
cam.position.x = 3
cam.position.y = 3
cam.position.z = 3
cam.position:lookAt(0, 0, 0)
cam:add(Entity.CAMERA)
cube = Cube.new()
end
function SceneCube:update()
cube:update()
end
function SceneCube:dispose()
cam:dispose()
cube:dispose()
end
return SceneCube