Compare commits
3 Commits
SQC-31
...
SQC-35_nou
Author | SHA1 | Date | |
---|---|---|---|
|
e330f5dd67 | ||
|
2f5579875e | ||
|
114c1631a8 |
@@ -9,6 +9,10 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
|
|||||||
//if (input.fail()) {
|
//if (input.fail()) {
|
||||||
OpenSimplexNoise::Noise simplex = OpenSimplexNoise::Noise(seed);
|
OpenSimplexNoise::Noise simplex = OpenSimplexNoise::Noise(seed);
|
||||||
m_blocks.Reset(BTYPE_AIR);
|
m_blocks.Reset(BTYPE_AIR);
|
||||||
|
int ratio = 0;
|
||||||
|
|
||||||
|
ratio = x * y % 7;
|
||||||
|
|
||||||
|
|
||||||
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // Montagnes
|
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // Montagnes
|
||||||
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
||||||
@@ -47,8 +51,8 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int rnd = rand() % 15;
|
//int rnd = rand() % 15;
|
||||||
if (rnd == 4)
|
if (ratio == 1)
|
||||||
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // structure
|
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // structure
|
||||||
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
||||||
for (int iy = 0; iy < 14; ++iy) {
|
for (int iy = 0; iy < 14; ++iy) {
|
||||||
@@ -57,16 +61,16 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
|
|||||||
Structure(ix, iy, iz, 2);
|
Structure(ix, iy, iz, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rnd == 3)
|
if (ratio == 3)
|
||||||
for (int ix = 0; ix < CHUNK_SIZE_Z; ++ix) // structure
|
for (int ix = 0; ix < CHUNK_SIZE_Z; ++ix) // structure
|
||||||
for (int iz = 0; iz < CHUNK_SIZE_X; ++iz) {
|
for (int iz = 0; iz < CHUNK_SIZE_X; ++iz) {
|
||||||
for (int iy = 0; iy < 14; ++iy) {
|
for (int iy = 0; iy < 14; ++iy) {
|
||||||
if (iz == 4)
|
if (iz == 4)
|
||||||
if (GetBlock(ix, iy, iz) == BTYPE_AIR)
|
if (GetBlock(ix, iy, iz) == BTYPE_AIR)
|
||||||
Structure(ix, iy, iz, 2);
|
Structure(ix, iy, iz, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rnd == 6)
|
if (ratio == 5)
|
||||||
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // structure
|
for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // structure
|
||||||
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
|
||||||
for (int iy = 0; iy < 14; ++iy) {
|
for (int iy = 0; iy < 14; ++iy) {
|
||||||
|
@@ -76,7 +76,7 @@ void Engine::DrawSplachScreen()
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
m_gamestate = GameState::MAIN_MENU;
|
m_gamestate = GameState::OPTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ void Engine::DrawMenu()
|
|||||||
glVertex2i(0, 200);
|
glVertex2i(0, 200);
|
||||||
glEnd();*/
|
glEnd();*/
|
||||||
|
|
||||||
MenuOptionsTexture.Bind();
|
/*MenuOptionsTexture.Bind();
|
||||||
glTranslated(0, -100, 0);
|
glTranslated(0, -100, 0);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
@@ -170,7 +170,7 @@ void Engine::DrawMenu()
|
|||||||
glVertex2i(sButton, 200);
|
glVertex2i(sButton, 200);
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
glVertex2i(0, 200);
|
glVertex2i(0, 200);
|
||||||
glEnd();
|
glEnd();*/
|
||||||
|
|
||||||
MenuQuitTexture.Bind();
|
MenuQuitTexture.Bind();
|
||||||
glTranslated(0, -100, 0);
|
glTranslated(0, -100, 0);
|
||||||
@@ -188,7 +188,7 @@ void Engine::DrawMenu()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MenuOptionsTexture.Bind();
|
/*MenuOptionsTexture.Bind();
|
||||||
glTranslated(200, 0, 0);
|
glTranslated(200, 0, 0);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
@@ -201,7 +201,7 @@ void Engine::DrawMenu()
|
|||||||
glVertex2i(0, 200);
|
glVertex2i(0, 200);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
/*WireFrameTexture.Bind();
|
WireFrameTexture.Bind();
|
||||||
glTranslated(0, 300, 0);
|
glTranslated(0, 300, 0);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
@@ -212,9 +212,9 @@ void Engine::DrawMenu()
|
|||||||
glVertex2i(sButton, 200);
|
glVertex2i(sButton, 200);
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
glVertex2i(0, 200);
|
glVertex2i(0, 200);
|
||||||
glEnd();*/
|
glEnd();
|
||||||
|
|
||||||
/*OnOffBtnTexture.Bind();
|
OnOffBtnTexture.Bind();
|
||||||
glTranslated(200, 0, 0);
|
glTranslated(200, 0, 0);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
@@ -226,7 +226,7 @@ void Engine::DrawMenu()
|
|||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
glVertex2i(0, 200);
|
glVertex2i(0, 200);
|
||||||
glEnd();
|
glEnd();
|
||||||
glTranslated(-400, -300, 0);*/
|
glTranslated(-400, -300, 0);
|
||||||
|
|
||||||
MusicTexture.Bind();
|
MusicTexture.Bind();
|
||||||
glTranslated(200, 200, 0);
|
glTranslated(200, 200, 0);
|
||||||
@@ -265,7 +265,7 @@ void Engine::DrawMenu()
|
|||||||
glVertex2i(sButton, 200);
|
glVertex2i(sButton, 200);
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
glVertex2i(0, 200);
|
glVertex2i(0, 200);
|
||||||
glEnd();
|
glEnd();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//glEnable(GL_LIGHTING);
|
//glEnable(GL_LIGHTING);
|
||||||
@@ -278,7 +278,7 @@ void Engine::DrawMenu()
|
|||||||
ShowCursor();
|
ShowCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::DrawOption()
|
void Engine::DrawPause()
|
||||||
{
|
{
|
||||||
static const int sTitle = 400;
|
static const int sTitle = 400;
|
||||||
static const int sButton = 225;
|
static const int sButton = 225;
|
||||||
@@ -295,36 +295,19 @@ void Engine::DrawOption()
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
MenuBGTexture.Bind();
|
PauseBGTexture.Bind();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
glVertex2i(0, 0);
|
glVertex2i(0, 0);
|
||||||
glTexCoord2f(1, 0);
|
glTexCoord2f(1, 0);
|
||||||
glVertex2i(Width(), 0); //
|
glVertex2i(800, 0);
|
||||||
glTexCoord2f(1, 1);
|
glTexCoord2f(1, 1);
|
||||||
glVertex2i(Width(), Height());
|
glVertex2i(800, 600);
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
glVertex2i(0, Height());
|
glVertex2i(0, 600);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
//glEnable(GL_LIGHTING);
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPopMatrix();
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPopMatrix();
|
|
||||||
ShowCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Engine::Init() {
|
|
||||||
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
@@ -457,9 +440,7 @@ void Engine::LoadResource() {
|
|||||||
|
|
||||||
LoadTexture(MenuTitleTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
LoadTexture(MenuTitleTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
||||||
LoadTexture(MenuBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
LoadTexture(MenuBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
||||||
|
LoadTexture(PauseBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
||||||
LoadTexture(MenuBGOptionTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
|
||||||
|
|
||||||
LoadTexture(SplachScreenTexture, TEXTURE_PATH "sc2.png");
|
LoadTexture(SplachScreenTexture, TEXTURE_PATH "sc2.png");
|
||||||
LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png");
|
LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png");
|
||||||
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
||||||
@@ -1313,15 +1294,14 @@ void Engine::Render(float elapsedTime) {
|
|||||||
lsPck.clear();
|
lsPck.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::MAIN_MENU)
|
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
||||||
{
|
{
|
||||||
|
if (!m_soloMultiChoiceMade) {
|
||||||
|
DisplaySingleOrMultiplayerMenu();
|
||||||
|
}
|
||||||
|
else {
|
||||||
DrawMenu();
|
DrawMenu();
|
||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::SINGLEMULTI)
|
|
||||||
DisplaySingleOrMultiplayerMenu();
|
|
||||||
else if (m_gamestate == GameState::OPTIONS)
|
|
||||||
{
|
|
||||||
DrawOption();
|
|
||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::PAUSE)
|
else if (m_gamestate == GameState::PAUSE)
|
||||||
{
|
{
|
||||||
@@ -1534,13 +1514,11 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
|||||||
else if (m_gamestate == GameState::MAIN_MENU)
|
else if (m_gamestate == GameState::MAIN_MENU)
|
||||||
{
|
{
|
||||||
if ((m_mousemx >= 285 && m_mousemx <= 490) && (m_mousemy >= 150 && m_mousemy <= 250))
|
if ((m_mousemx >= 285 && m_mousemx <= 490) && (m_mousemy >= 150 && m_mousemy <= 250))
|
||||||
m_gamestate = GameState::SINGLEMULTI;
|
m_gamestate = GameState::PLAY;
|
||||||
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400))
|
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400))
|
||||||
m_gamestate = GameState::OPTIONS;
|
|
||||||
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 450 && m_mousemy <= 500))
|
|
||||||
m_gamestate = GameState::QUIT;
|
m_gamestate = GameState::QUIT;
|
||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::SINGLEMULTI)
|
else if (m_gamestate == GameState::OPTIONS)
|
||||||
{
|
{
|
||||||
float buttonWidthProportion = 0.4f;
|
float buttonWidthProportion = 0.4f;
|
||||||
float buttonHeightProportion = 0.075f;
|
float buttonHeightProportion = 0.075f;
|
||||||
|
@@ -31,7 +31,7 @@ public:
|
|||||||
Engine();
|
Engine();
|
||||||
virtual ~Engine();
|
virtual ~Engine();
|
||||||
virtual void DrawMenu();
|
virtual void DrawMenu();
|
||||||
virtual void DrawOption();
|
virtual void DrawPause();
|
||||||
virtual void DrawSplachScreen();
|
virtual void DrawSplachScreen();
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
virtual void DeInit();
|
virtual void DeInit();
|
||||||
@@ -107,20 +107,15 @@ private:
|
|||||||
std::chrono::high_resolution_clock::time_point m_startTime;
|
std::chrono::high_resolution_clock::time_point m_startTime;
|
||||||
|
|
||||||
//Menu
|
//Menu
|
||||||
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY,SINGLEMULTI };
|
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE };
|
||||||
|
|
||||||
GameState m_gamestate = GameState::MAIN_MENU;
|
GameState m_gamestate = GameState::MAIN_MENU;
|
||||||
Texture MenuTitleTexture;
|
Texture MenuTitleTexture;
|
||||||
Texture MenuBGTexture;
|
Texture MenuBGTexture;
|
||||||
Texture MenuBGOptionTexture;
|
|
||||||
Texture MenuStartTexture;
|
Texture MenuStartTexture;
|
||||||
Texture MenuQuitTexture;
|
Texture MenuQuitTexture;
|
||||||
Texture MenuOptionsTexture;
|
Texture MenuOptionsTexture;
|
||||||
Texture PauseBGTexture;
|
Texture PauseBGTexture;
|
||||||
Texture SplachScreenTexture;
|
Texture SplachScreenTexture;
|
||||||
Texture MusicTexture; //TODO
|
|
||||||
Texture OnOffBtnTexture;//TODO
|
|
||||||
Texture BackBtnTexture;//TODO
|
|
||||||
|
|
||||||
|
|
||||||
float m_scale;
|
float m_scale;
|
||||||
|
Reference in New Issue
Block a user