Trying to optimize memory.
This commit is contained in:
@ -8,6 +8,9 @@
|
||||
#include "../engine/engine.h"
|
||||
#include "../locale/language.h"
|
||||
|
||||
#define SETTING_GAME_SANDBOX 3
|
||||
#define SETTING_GAME SETTING_GAME_SANDBOX
|
||||
|
||||
/** Describes the current game */
|
||||
#if SETTING_GAME == SETTING_GAME_POKER
|
||||
#include "poker/game.h"
|
||||
|
@ -8,29 +8,30 @@
|
||||
#include "sandboxscene.h"
|
||||
|
||||
bool sandboxSceneInit(sandboxscene_t *game) {
|
||||
// Init Scripter
|
||||
scripterInit(&game->scripter, &game->engine);
|
||||
game->scripter.user = game;
|
||||
|
||||
// Add APIs
|
||||
scriptsApiIo(&game->scripter);
|
||||
scriptsApiDisplay(&game->scripter);
|
||||
scriptsApiAsset(&game->scripter);
|
||||
scriptsApiEpoch(&game->scripter);
|
||||
|
||||
// Load main script
|
||||
assetScripterAppend(&game->scripter, "scripts/main.js");
|
||||
|
||||
// Invoke initialization.
|
||||
scripterInvokeMethodSimple(&game->scripter, "init");
|
||||
|
||||
// Init Assets
|
||||
assetShaderLoad(&game->shader,
|
||||
"shared/shaders/textured.vert",
|
||||
"shared/shaders/textured.frag"
|
||||
);
|
||||
assetFontLoad(&game->font, "shared/fonts/opensans/OpenSans-Regular.ttf");
|
||||
assetTextureLoad(&game->texture, "shared/test_texture.png");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void sandboxSceneUpdate(sandboxscene_t *game) {
|
||||
scripterInvokeMethodSimple(&game->scripter, "update");
|
||||
camera_t camera;
|
||||
|
||||
shaderUse(&game->shader);
|
||||
cameraOrtho(&camera,
|
||||
0, game->engine.render.width,
|
||||
game->engine.render.height, 0,
|
||||
0.01f, 1000.0f
|
||||
);
|
||||
cameraLookAt(&camera, 0,0,10, 0,0,0);
|
||||
shaderUseCamera(&game->shader, &camera);
|
||||
}
|
||||
|
||||
void sandboxSceneDispose(sandboxscene_t *game) {
|
||||
scripterInvokeMethodSimple(&game->scripter, "dispose");
|
||||
// shaderDispose(&game->shader);
|
||||
}
|
@ -8,32 +8,17 @@
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../../display/camera.h"
|
||||
#include "../../display/shader.h"
|
||||
#include "../../display/font.h"
|
||||
#include "../../display/primitive.h"
|
||||
#include "../../display/primitives/quad.h"
|
||||
#include "../../display/primitives/cube.h"
|
||||
#include "../../display/renderlist.h"
|
||||
#include "../../display/texture.h"
|
||||
#include "../../display/shader.h"
|
||||
#include "../../file/asset.h"
|
||||
|
||||
#include "../../file/xml.h"
|
||||
#include "../../file/asset.h"
|
||||
#include "../../ui/grid.h"
|
||||
#include "../../ui/menu.h"
|
||||
#include "../../ui/textmenu.h"
|
||||
#include "../../ui/image.h"
|
||||
#include "../../ui/framedtextmenu.h"
|
||||
|
||||
#include "../../script/scripter.h"
|
||||
#include "../../script/api/io.h"
|
||||
#include "../../script/api/display.h"
|
||||
#include "../../script/api/asset.h"
|
||||
#include "../../script/api/epoch.h"
|
||||
#include "../../ui/label.h"
|
||||
#include "../../ui/breakpoint.h"
|
||||
|
||||
typedef struct {
|
||||
engine_t engine;
|
||||
scripter_t scripter;
|
||||
shader_t shader;
|
||||
texture_t texture;
|
||||
font_t font;
|
||||
} sandboxscene_t;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user