Working on web, change python to lua
This commit is contained in:
1 parent
90e2a369f4
commit
178f69967b
14 files changed
+327
-162
No files matched your search
+27
-6
@@ -39,6 +39,7 @@ namespace ZL
|
||||
Game* Game::s_instance = nullptr;
|
||||
|
||||
void Game::onResourcesZipLoaded(const char* /*filename*/) {
|
||||
std::cout << "Resources.zip loaded successfully" << std::endl;
|
||||
if (s_instance) {
|
||||
s_instance->mainThreadHandler.EnqueueMainThreadTask([&]() {
|
||||
s_instance->setupPart2();
|
||||
@@ -47,7 +48,7 @@ namespace ZL
|
||||
}
|
||||
|
||||
void Game::onResourcesZipError(const char* /*filename*/) {
|
||||
std::cerr << "Failed to download resources.zip" << std::endl;
|
||||
std::cout << "Failed to download resources.zip" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -84,7 +85,7 @@ namespace ZL
|
||||
renderer.shaderManager.AddShaderFromFiles("defaultColor", "resources/shaders/defaultColor.vertex", "resources/shaders/defaultColor_desktop.fragment", CONST_ZIP_FILE);
|
||||
renderer.shaderManager.AddShaderFromFiles("default", "resources/shaders/default.vertex", "resources/shaders/default_desktop.fragment", CONST_ZIP_FILE);
|
||||
#endif
|
||||
loadingTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/loading.png", CONST_ZIP_FILE));
|
||||
loadingTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/loading.png", ""));
|
||||
|
||||
float minDimension;
|
||||
float width = Environment::projectionWidth;
|
||||
@@ -139,22 +140,28 @@ namespace ZL
|
||||
renderer.shaderManager.AddShaderFromFiles("spark", "resources/shaders/spark.vertex", "resources/shaders/spark_desktop.fragment", CONST_ZIP_FILE);
|
||||
#endif
|
||||
|
||||
std::cout << "Load resurces step 4" << std::endl;
|
||||
|
||||
roomTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/w/room005.png", CONST_ZIP_FILE));
|
||||
roomMesh.data = LoadFromTextFile02("resources/w/room001.txt", CONST_ZIP_FILE);
|
||||
roomMesh.data.RotateByMatrix(Eigen::Quaternionf(Eigen::AngleAxisf(-M_PI*0.5, Eigen::Vector3f::UnitY())).toRotationMatrix());
|
||||
roomMesh.RefreshVBO();
|
||||
|
||||
std::cout << "Load resurces step 5" << std::endl;
|
||||
fireboxTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/w/Cube001.png", CONST_ZIP_FILE));
|
||||
fireboxMesh.data = LoadFromTextFile02("resources/w/firebox.txt", CONST_ZIP_FILE);
|
||||
fireboxMesh.data.RotateByMatrix(Eigen::Quaternionf(Eigen::AngleAxisf(-M_PI * 0.5, Eigen::Vector3f::UnitY())).toRotationMatrix());
|
||||
fireboxMesh.RefreshVBO();
|
||||
|
||||
|
||||
std::cout << "Load resurces step 6" << std::endl;
|
||||
inaiTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/w/inai001.png", CONST_ZIP_FILE));
|
||||
std::cout << "Load resurces step 6.1" << std::endl;
|
||||
inaiMesh.data = LoadFromTextFile02("resources/w/inai001.txt", CONST_ZIP_FILE);
|
||||
inaiMesh.data.RotateByMatrix(Eigen::Quaternionf(Eigen::AngleAxisf(-M_PI * 0.5, Eigen::Vector3f::UnitY())).toRotationMatrix());
|
||||
inaiMesh.data.Move({ 2.5, 1.4, -9.9 });
|
||||
inaiMesh.RefreshVBO();
|
||||
|
||||
std::cout << "Load resurces step 7" << std::endl;
|
||||
benchTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/w/bench001opt.png", CONST_ZIP_FILE));
|
||||
benchMesh.data = LoadFromTextFile02("resources/w/bench002opt.txt", CONST_ZIP_FILE);
|
||||
benchMesh.data.Scale(3.f);
|
||||
@@ -162,6 +169,8 @@ namespace ZL
|
||||
benchMesh.data.Move({ -2.1, 0.5, -7.9 });
|
||||
benchMesh.RefreshVBO();
|
||||
|
||||
std::cout << "Load resurces step 8" << std::endl;
|
||||
|
||||
auto violaTexture = std::make_shared<Texture>(CreateTextureDataFromPng("resources/viola.png", CONST_ZIP_FILE));
|
||||
|
||||
// Player (Viola)
|
||||
@@ -176,39 +185,51 @@ namespace ZL
|
||||
Eigen::Quaternionf(Eigen::AngleAxisf(-M_PI * 0.5f, Eigen::Vector3f::UnitX())) *
|
||||
Eigen::Quaternionf(Eigen::AngleAxisf(M_PI, Eigen::Vector3f::UnitZ()));
|
||||
|
||||
std::cout << "Load resurces step 9" << std::endl;
|
||||
auto defaultTexture = std::make_shared<Texture>(CreateTextureDataFromPng("resources/w/default_skin001.png", CONST_ZIP_FILE));
|
||||
|
||||
auto npc01 = std::make_unique<Character>();
|
||||
npc01->loadAnimation(AnimationState::IDLE, "resources/w/default_idle002.txt", CONST_ZIP_FILE);
|
||||
npc01->loadAnimation(AnimationState::WALK, "resources/w/default_walk001.txt", CONST_ZIP_FILE);
|
||||
//npc01->loadAnimation(AnimationState::IDLE, "resources/idleviola_uv010.txt", CONST_ZIP_FILE);
|
||||
//npc01->loadAnimation(AnimationState::WALK, "resources/walkviola_uv010.txt", CONST_ZIP_FILE);
|
||||
npc01->setTexture(defaultTexture);
|
||||
npc01->walkSpeed = 1.5f;
|
||||
npc01->rotationSpeed = 8.0f;
|
||||
npc01->modelScale = 0.01f;
|
||||
//npc01->modelScale = 0.1f;
|
||||
npc01->modelCorrectionRotation = Eigen::Quaternionf(Eigen::AngleAxisf(M_PI, Eigen::Vector3f::UnitY()));
|
||||
|
||||
npc01->position = Eigen::Vector3f(0.f, 0.f, -45.f);
|
||||
std::cout << "Load resurces step 10" << std::endl;
|
||||
npc01->position = Eigen::Vector3f(0.f, 0.f, -10.f);
|
||||
npc01->setTarget(npc01->position);
|
||||
npcs.push_back(std::move(npc01));
|
||||
|
||||
auto ghostTexture = std::make_shared<Texture>(CreateTextureDataFromPng("resources/w/ghost_skin001.png", CONST_ZIP_FILE));
|
||||
|
||||
std::cout << "Load resurces step 11" << std::endl;
|
||||
auto npc02 = std::make_unique<Character>();
|
||||
//npc02->loadAnimation(AnimationState::IDLE, "resources/w/default_float001.txt", CONST_ZIP_FILE);
|
||||
npc02->loadAnimation(AnimationState::IDLE, "resources/w/float_attack003.txt", CONST_ZIP_FILE);
|
||||
npc02->loadAnimation(AnimationState::IDLE, "resources/w/default_float001.txt", CONST_ZIP_FILE);
|
||||
//npc02->loadAnimation(AnimationState::IDLE, "resources/w/float_attack003.txt", CONST_ZIP_FILE);
|
||||
//npc02->loadAnimation(AnimationState::IDLE, "resources/idleviola_uv010.txt", CONST_ZIP_FILE);
|
||||
npc02->setTexture(ghostTexture);
|
||||
npc02->walkSpeed = 1.5f;
|
||||
npc02->rotationSpeed = 8.0f;
|
||||
npc02->modelScale = 0.01f;
|
||||
//npc02->modelScale = 0.1f;
|
||||
npc02->modelCorrectionRotation = Eigen::Quaternionf(Eigen::AngleAxisf(M_PI, Eigen::Vector3f::UnitY()));
|
||||
|
||||
npc02->position = Eigen::Vector3f(0.f, 0.f, -20.f);
|
||||
npc02->setTarget(npc02->position);
|
||||
npcs.push_back(std::move(npc02));
|
||||
|
||||
std::cout << "Load resurces step 12" << std::endl;
|
||||
|
||||
loadingCompleted = true;
|
||||
|
||||
scriptEngine.init(this);
|
||||
|
||||
std::cout << "Load resurces step 13" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user