saving
This commit is contained in:
parent
442705c786
commit
be2a52f323
|
|
@ -12,6 +12,8 @@ inputEnabled: bool = false,
|
||||||
|
|
||||||
sensitivity: f32 = 1.0,
|
sensitivity: f32 = 1.0,
|
||||||
|
|
||||||
|
entity: core.Entity,
|
||||||
|
|
||||||
fn log(comptime fmt: []const u8, args: anytype) void {
|
fn log(comptime fmt: []const u8, args: anytype) void {
|
||||||
core.engine_log("[Doomplayer] " ++ fmt, args);
|
core.engine_log("[Doomplayer] " ++ fmt, args);
|
||||||
}
|
}
|
||||||
|
|
@ -31,10 +33,6 @@ pub fn create(allocator: std.mem.Allocator) !*@This() {
|
||||||
self.sensitivity = core.configVar(f32, "doomplayer.sensitivity", 1.0);
|
self.sensitivity = core.configVar(f32, "doomplayer.sensitivity", 1.0);
|
||||||
gDoom = self;
|
gDoom = self;
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn setup(self: *@This()) !void {
|
|
||||||
try self.createTextures();
|
try self.createTextures();
|
||||||
try backlog.platform.context().addSDLProcessFunction(processFunc);
|
try backlog.platform.context().addSDLProcessFunction(processFunc);
|
||||||
c.doom_set_resolution(320, 200);
|
c.doom_set_resolution(320, 200);
|
||||||
|
|
@ -46,6 +44,9 @@ pub fn setup(self: *@This()) !void {
|
||||||
c.doom_set_default_int("mouse_move", 0); // Mouse will not move forward
|
c.doom_set_default_int("mouse_move", 0); // Mouse will not move forward
|
||||||
|
|
||||||
c.doom_init(1, @constCast(@ptrCast(@alignCast(&.{"doom"}))), 8);
|
c.doom_init(1, @constCast(@ptrCast(@alignCast(&.{"doom"}))), 8);
|
||||||
|
|
||||||
|
self.entity = try self.createEntity();
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sdlToDoomButton(button: c_uint) c_uint {
|
fn sdlToDoomButton(button: c_uint) c_uint {
|
||||||
|
|
@ -407,6 +408,8 @@ pub fn tick(self: *@This(), dt: f64) void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo CMRF can be replaced with custom texture install.
|
||||||
|
// installCustomTexture should be doable through the sgpu renderer.
|
||||||
fn bindVideoTextures(p: ?*anyopaque) void {
|
fn bindVideoTextures(p: ?*anyopaque) void {
|
||||||
const self: *@This() = @ptrCast(@alignCast(p));
|
const self: *@This() = @ptrCast(@alignCast(p));
|
||||||
const ctx = rend.context();
|
const ctx = rend.context();
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ pub const FoxObject = struct {
|
||||||
const fox = try core.createEntity();
|
const fox = try core.createEntity();
|
||||||
const scene = fox.addComponent(core.Scene).?;
|
const scene = fox.addComponent(core.Scene).?;
|
||||||
|
|
||||||
scene.setScale(0.1, 0.1, 0.1);
|
scene.setScale(0.01, 0.01, 0.01);
|
||||||
const mesh = fox.addComponent(rend.MeshComponent).?;
|
const mesh = fox.addComponent(rend.MeshComponent).?;
|
||||||
mesh.setMesh("m_fox");
|
mesh.setMesh("m_fox");
|
||||||
mesh.setTexture("t_fox");
|
mesh.setTexture("t_fox");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue