add read from zip
This commit is contained in:
1 parent
b055faf882
commit
112684b40a
6 files changed
+124
-45
No files matched your search
+17
-17
@@ -15,7 +15,7 @@ namespace ZL
|
||||
#ifdef EMSCRIPTEN
|
||||
const char* CONST_ZIP_FILE = "space-game001a.zip";
|
||||
#else
|
||||
const char* CONST_ZIP_FILE = "";
|
||||
const char* CONST_ZIP_FILE = "../assets.zip";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -176,11 +176,11 @@ namespace ZL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifndef SIMPLIFIED
|
||||
bool cfgLoaded = sparkEmitter.loadFromJsonFile("../config/spark_config.json", renderer, CONST_ZIP_FILE);
|
||||
bool projCfgLoaded = projectileEmitter.loadFromJsonFile("../config/spark_projectile_config.json", renderer, CONST_ZIP_FILE);
|
||||
//#ifndef SIMPLIFIED
|
||||
bool cfgLoaded = sparkEmitter.loadFromJsonFile("config/spark_config.json", renderer, CONST_ZIP_FILE);
|
||||
bool projCfgLoaded = projectileEmitter.loadFromJsonFile("config/spark_projectile_config.json", renderer, CONST_ZIP_FILE);
|
||||
projectileEmitter.setEmissionPoints(std::vector<Vector3f>());
|
||||
uiManager.loadFromFile("../config/ui.json", renderer, CONST_ZIP_FILE);
|
||||
uiManager.loadFromFile("config/ui.json", renderer, CONST_ZIP_FILE);
|
||||
|
||||
uiManager.setButtonCallback("playButton", [this](const std::string& name) {
|
||||
std::cerr << "Play button pressed: " << name << std::endl;
|
||||
@@ -191,7 +191,7 @@ namespace ZL
|
||||
});
|
||||
|
||||
uiManager.setButtonCallback("settingsButton", [this](const std::string& name) {
|
||||
if (uiManager.pushMenuFromFile("../config/settings.json", this->renderer, CONST_ZIP_FILE)) {
|
||||
if (uiManager.pushMenuFromFile("config/settings.json", this->renderer, CONST_ZIP_FILE)) {
|
||||
|
||||
uiManager.setButtonCallback("Opt1", [this](const std::string& n) {
|
||||
std::cerr << "Opt1 pressed: " << n << std::endl;
|
||||
@@ -215,7 +215,7 @@ namespace ZL
|
||||
musicVolume = value;
|
||||
Environment::shipVelocity = musicVolume * 20.0f;
|
||||
});
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
cubemapTexture = std::make_shared<Texture>(
|
||||
std::array<TextureDataStruct, 6>{
|
||||
@@ -446,11 +446,11 @@ namespace ZL
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SIMPLIFIED
|
||||
//#ifndef SIMPLIFIED
|
||||
|
||||
sparkEmitter.draw(renderer, Environment::zoom, Environment::width, Environment::height);
|
||||
projectileEmitter.draw(renderer, Environment::zoom, Environment::width, Environment::height);
|
||||
#endif
|
||||
//#endif
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
renderer.DisableVertexAttribArray(vPositionName);
|
||||
@@ -613,10 +613,10 @@ namespace ZL
|
||||
drawShip();
|
||||
drawBoxes();
|
||||
|
||||
#ifndef SIMPLIFIED
|
||||
//#ifndef SIMPLIFIED
|
||||
|
||||
drawUI();
|
||||
#endif
|
||||
//#endif
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
@@ -632,10 +632,10 @@ namespace ZL
|
||||
size_t delta = (newTickCount - lastTickCount > CONST_MAX_TIME_INTERVAL) ?
|
||||
CONST_MAX_TIME_INTERVAL : newTickCount - lastTickCount;
|
||||
|
||||
#ifndef SIMPLIFIED
|
||||
//#ifndef SIMPLIFIED
|
||||
//gameObjects.updateScene(delta);
|
||||
sparkEmitter.update(static_cast<float>(delta));
|
||||
#endif
|
||||
//#endif
|
||||
planetObject.update(static_cast<float>(delta));
|
||||
if (Environment::tapDownHold) {
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace ZL
|
||||
Environment::shipPosition = Environment::shipPosition + velocityDirectionAdjusted;
|
||||
}
|
||||
|
||||
#ifndef SIMPLIFIED
|
||||
//#ifndef SIMPLIFIED
|
||||
for (auto& p : projectiles) {
|
||||
if (p && p->isActive()) {
|
||||
p->update(static_cast<float>(delta), renderer);
|
||||
@@ -705,7 +705,7 @@ namespace ZL
|
||||
|
||||
sparkEmitter.update(static_cast<float>(delta));
|
||||
projectileEmitter.update(static_cast<float>(delta));
|
||||
#endif
|
||||
//#endif
|
||||
lastTickCount = newTickCount;
|
||||
}
|
||||
}
|
||||
@@ -763,7 +763,7 @@ namespace ZL
|
||||
uiManager.onMouseDown(uiX, uiY);
|
||||
|
||||
bool uiHandled = false;
|
||||
#ifndef SIMPLIFIED
|
||||
//#ifndef SIMPLIFIED
|
||||
if (event.button.button == SDL_BUTTON_LEFT && !uiManager.isUiInteraction()) {
|
||||
uint64_t now = SDL_GetTicks64();
|
||||
if (now - lastProjectileFireTime >= static_cast<uint64_t>(projectileCooldownMs)) {
|
||||
@@ -771,7 +771,7 @@ namespace ZL
|
||||
fireProjectiles();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
for (const auto& button : uiManager.findButton("") ? std::vector<std::shared_ptr<UiButton>>{} : std::vector<std::shared_ptr<UiButton>>{}) {
|
||||
(void)button;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user