Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ad6ebf38d | ||
|
|
96deb8b393 | ||
|
|
47fe0c4719 | ||
|
|
da8946e9ef | ||
|
|
c02273d29d | ||
|
|
fec7e08c2b | ||
|
|
0f937e2e02 | ||
|
|
b768b27d49 |
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ namespace ZL {
|
|||||||
int Environment::windowHeaderHeight = 0;
|
int Environment::windowHeaderHeight = 0;
|
||||||
int Environment::width = 0;
|
int Environment::width = 0;
|
||||||
int Environment::height = 0;
|
int Environment::height = 0;
|
||||||
float Environment::zoom = 6.f;
|
float Environment::zoom = 20.f;
|
||||||
|
|
||||||
bool Environment::leftPressed = false;
|
bool Environment::leftPressed = false;
|
||||||
bool Environment::rightPressed = false;
|
bool Environment::rightPressed = false;
|
||||||
|
|||||||
@@ -1,61 +1,87 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "OpenGlExtensions.h"
|
#include "OpenGlExtensions.h"
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
#include "Environment.h"
|
#include "Environment.h"
|
||||||
#include "TextureManager.h"
|
#include "TextureManager.h"
|
||||||
|
|
||||||
namespace ZL {
|
namespace ZL {
|
||||||
|
|
||||||
|
|
||||||
struct BoxCoords
|
struct BoxCoords
|
||||||
{
|
{
|
||||||
Vector3f pos;
|
Vector3f pos;
|
||||||
Matrix3f m;
|
Matrix3f m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Game {
|
class Game {
|
||||||
public:
|
public:
|
||||||
Game();
|
Game();
|
||||||
~Game();
|
~Game();
|
||||||
|
|
||||||
void setup();
|
void setup();
|
||||||
void update();
|
void update();
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
bool shouldExit() const { return Environment::exitGameLoop; }
|
bool shouldExit() const { return Environment::exitGameLoop; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processTickCount();
|
void processTickCount();
|
||||||
void drawScene();
|
void drawScene();
|
||||||
void drawCubemap();
|
void drawCubemap();
|
||||||
void drawShip();
|
void drawShip();
|
||||||
void drawBoxes();
|
void drawBoxes();
|
||||||
|
void drawUI();
|
||||||
SDL_Window* window;
|
|
||||||
SDL_GLContext glContext;
|
SDL_Window* window;
|
||||||
Renderer renderer;
|
SDL_GLContext glContext;
|
||||||
|
Renderer renderer;
|
||||||
size_t newTickCount;
|
|
||||||
size_t lastTickCount;
|
size_t newTickCount;
|
||||||
|
size_t lastTickCount;
|
||||||
static const size_t CONST_TIMER_INTERVAL = 10;
|
|
||||||
static const size_t CONST_MAX_TIME_INTERVAL = 1000;
|
static const size_t CONST_TIMER_INTERVAL = 10;
|
||||||
|
static const size_t CONST_MAX_TIME_INTERVAL = 1000;
|
||||||
std::shared_ptr<Texture> spaceshipTexture;
|
|
||||||
std::shared_ptr<Texture> cubemapTexture;
|
std::shared_ptr<Texture> spaceshipTexture;
|
||||||
VertexDataStruct spaceshipBase;
|
std::shared_ptr<Texture> cubemapTexture;
|
||||||
VertexRenderStruct spaceship;
|
VertexDataStruct spaceshipBase;
|
||||||
|
VertexRenderStruct spaceship;
|
||||||
VertexRenderStruct cubemap;
|
|
||||||
|
VertexRenderStruct cubemap;
|
||||||
std::shared_ptr<Texture> boxTexture;
|
|
||||||
VertexDataStruct boxBase;
|
std::shared_ptr<Texture> boxTexture;
|
||||||
|
VertexDataStruct boxBase;
|
||||||
std::vector<BoxCoords> boxCoordsArr;
|
|
||||||
std::vector<VertexRenderStruct> boxRenderArr;
|
std::vector<BoxCoords> boxCoordsArr;
|
||||||
|
std::vector<VertexRenderStruct> boxRenderArr;
|
||||||
};
|
|
||||||
|
|
||||||
|
std::shared_ptr<Texture> buttonTexture;
|
||||||
|
VertexRenderStruct button;
|
||||||
|
|
||||||
|
std::shared_ptr<Texture> musicVolumeBarTexture;
|
||||||
|
VertexRenderStruct musicVolumeBar;
|
||||||
|
|
||||||
|
std::shared_ptr<Texture> musicVolumeBarButtonTexture;
|
||||||
|
VertexRenderStruct musicVolumeBarButton;
|
||||||
|
|
||||||
|
|
||||||
|
bool isDraggingVolume = false;
|
||||||
|
bool isDraggingShip = false;
|
||||||
|
bool isDraggingCamera = false;
|
||||||
|
bool shipMoveLockActive = false;
|
||||||
|
Matrix3f lockedCameraMat = Matrix3f::Identity();
|
||||||
|
float musicVolume = 1.0f;
|
||||||
|
float volumeBarMinX = 1190.0f;
|
||||||
|
float volumeBarMaxX = 1200.0f;
|
||||||
|
float volumeBarMinY = 100.0f;
|
||||||
|
float volumeBarMaxY = 600.0f;
|
||||||
|
float musicVolumeBarButtonButtonCenterX = 1195.0f;
|
||||||
|
float musicVolumeBarButtonButtonRadius = 25.0f;
|
||||||
|
void UpdateVolumeFromMouse(int mouseX, int mouseY);
|
||||||
|
void UpdateVolumeKnob();
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace ZL
|
} // namespace ZL
|
||||||
@@ -148,7 +148,7 @@ embuilder build sdl2 sdl2_ttf sdl2_image sdl2_image_jpg sdl2_image_png
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
emcc main.cpp Game.cpp Environment.cpp BoneAnimatedModel.cpp Math.cpp Renderer.cpp TextModel.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -pthread -sUSE_PTHREADS=1 -sPTHREAD_POOL_SIZE=4 -sTOTAL_MEMORY=4294967296 -sINITIAL_MEMORY=3221225472 -sMAXIMUM_MEMORY=4294967296 -sALLOW_MEMORY_GROWTH=1 -I./thirdparty/libzip-1.11.3/build-emcmake/install/include -L./thirdparty/libzip-1.11.3/build-emcmake/install/lib -lzip -lz -sUSE_SDL_IMAGE=2 -sUSE_SDL=2 -sUSE_LIBPNG=1 --preload-file space-game001.zip -o space-game001.html
|
emcc main.cpp Game.cpp Environment.cpp BoneAnimatedModel.cpp ZLMath.cpp Renderer.cpp TextModel.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp OpenGlExtensions.cpp -O2 -std=c++14 -pthread -sUSE_PTHREADS=1 -sPTHREAD_POOL_SIZE=4 -sTOTAL_MEMORY=4294967296 -sINITIAL_MEMORY=3221225472 -sMAXIMUM_MEMORY=4294967296 -sALLOW_MEMORY_GROWTH=1 -I./thirdparty/libzip-1.11.3/build-emcmake/install/include -L./thirdparty/libzip-1.11.3/build-emcmake/install/lib -lzip -lz -sUSE_SDL_IMAGE=2 -sUSE_SDL=2 -sUSE_LIBPNG=1 --preload-file space-game001.zip -o space-game001.html
|
||||||
|
|
||||||
emrun --no_browser --port 8080 .
|
emrun --no_browser --port 8080 .
|
||||||
```
|
```
|
||||||
|
|||||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user