Full JS rendering example.

This commit is contained in:
2021-09-25 23:29:56 -07:00
parent 8022fbadaa
commit 3a94e307d4
4 changed files with 8 additions and 6 deletions

View File

@ -28,9 +28,9 @@ bool sandboxSceneInit(sandboxscene_t *game) {
} }
void sandboxSceneUpdate(sandboxscene_t *game) { void sandboxSceneUpdate(sandboxscene_t *game) {
// scripterInvokeMethodSimple(&game->scripter, "update"); scripterInvokeMethodSimple(&game->scripter, "update");
} }
void sandboxSceneDispose(sandboxscene_t *game) { void sandboxSceneDispose(sandboxscene_t *game) {
// scripterInvokeMethodSimple(&game->scripter, "dispose"); scripterInvokeMethodSimple(&game->scripter, "dispose");
} }

View File

@ -29,6 +29,7 @@
#include "../../script/api/io.h" #include "../../script/api/io.h"
#include "../../script/api/display.h" #include "../../script/api/display.h"
#include "../../script/api/asset.h" #include "../../script/api/asset.h"
#include "../../script/api/epoch.h"
typedef struct { typedef struct {
engine_t engine; engine_t engine;

View File

@ -8,7 +8,7 @@ type Time = {
export class Game { export class Game {
public time:Time; public time:Time;
private scene:Scene|null; public scene:Scene|null;
constructor() { constructor() {
this.time = { delta: 0, current: 0, last: 0 }; this.time = { delta: 0, current: 0, last: 0 };
@ -53,9 +53,8 @@ export const gameSetMain = (game:Game) => {
* Method that is invoked by C when the game needs to intialize. * Method that is invoked by C when the game needs to intialize.
*/ */
const init = () => { const init = () => {
print("init"); if(!GAME_MAIN) return;
// if(!GAME_MAIN) return; GAME_MAIN.init();
// GAME_MAIN.init();
} }
/** /**

View File

@ -32,6 +32,7 @@ class TestScene extends Scene {
shaderUse(this.shader); shaderUse(this.shader);
shaderUseCamera(this.shader, this.camera); shaderUseCamera(this.shader, this.camera);
shaderUsePosition(this.shader, 0,0,0, 0,this.game.time.current,0); shaderUsePosition(this.shader, 0,0,0, 0,this.game.time.current,0);
shaderUseTexture(this.shader, this.texture);
primitiveDraw(this.quad, 0, -1); primitiveDraw(this.quad, 0, -1);
} }
@ -43,6 +44,7 @@ class MainGame extends Game {
constructor() { constructor() {
super(); super();
this.setScene(new TestScene(this)); this.setScene(new TestScene(this));
this.scene.init();
} }
} }