Skip to content

Commit

Permalink
Added highscore print to main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-santos committed May 31, 2020
1 parent ca0379c commit 36cb37e
Show file tree
Hide file tree
Showing 84 changed files with 204 additions and 23 deletions.
14 changes: 0 additions & 14 deletions Game Engine/Game Engine/Assets/Scripts/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,6 @@ void GameManager::GameLoop()
EraseShadowHint();
DrawShadowHint();
}

// ClearScreen();
// DrawBoard();
}

void GameManager::Update()
Expand All @@ -626,26 +623,16 @@ void GameManager::Update()
return;

GameLoop();

//ClearScreen();
cout << "Score: " << this->score << endl;
cout << "Level: " << this->level << endl;
cout << "Lines to Next Level: " << this->linesToNextLevel << endl;
cout << "Cleared Lines: " << this->linesCleared << endl;
cout << "Delay Time: " << this->delayTime << endl;
}

void GameManager::DrawShadowHint()
{
shadowHint.NewBlock(_currenctObject);

//_currenctObject->Erase(_board, graphicBoard, _currentPosition, shadowPiece, boardCenter, pieceScale);

shadowHint.Erase(_board, graphicBoard, _currentPosition, shadowPiece, boardCenter);

_positionHint = shadowHint.PositionShadowHint(_board, _currentPosition);

//_currenctObject->Draw(_board, graphicBoard, _currentPosition, shadowPiece, boardCenter, pieceScale);
shadowHint.Draw(_board, graphicBoard, _currentPosition, shadowPiece, boardCenter);

if (_positionHint._x != _currentPosition._x)
Expand All @@ -659,7 +646,6 @@ void GameManager::EraseShadowHint()

shadowHint.Erase(_board, graphicBoard, _currentPosition, shadowPiece, boardCenter);

//_currenctObject->Erase(_board, graphicBoard, _currentPosition, shadowPiece, boardCenter, pieceScale);
_positionHint = shadowHint.PositionShadowHint(_board, _currentPosition);

if (_positionHint._x != _currentPosition._x)
Expand Down
9 changes: 0 additions & 9 deletions Game Engine/Game Engine/GameEngine/Camera/Perspective.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
#include "./Perspective.hpp"

#include <iostream>

Perspective::Perspective(GLfloat fov, GLfloat aspect, GLfloat near, GLfloat far, vec3 eye, vec3 origin, vec3 up)
{
this->projection = perspective(fov, aspect, near, far);
this->view = lookAt(eye, origin, up);

for (int i = 0; i < 4; i++)
{
std::cout << view[i].x << " " << view[i].y << " " << view[i].z << " " << view[i].w << " " << std::endl;
}

this->position.x = this->view[3].x;
this->position.y = this->view[3].y;
this->position.z = this->view[3].z;

std::cout << position.x << " " << position.y << " " << position.z << std::endl;
}

mat4 Perspective::GetView()
Expand Down
8 changes: 8 additions & 0 deletions Game Engine/Game Engine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ void callLoadLevelMultiPlayer()

void callLoadLevelMainMenu()
{
std::cout << std::endl;
std::cout << std::endl;

std::cout << "Pontuação Maxima Atual: " << Config::highscore << std::endl;

std::cout << std::endl;
std::cout << std::endl;

scene.reset(new Scene());

// Single Player camera
Expand Down
Binary file added Game Engine/Tetris3D.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Game Engine/Tetris3D/Assets/Audio/Theme_A.mp3
Binary file not shown.
Binary file added Game Engine/Tetris3D/Assets/Audio/Theme_B.mp3
Binary file not shown.
Binary file added Game Engine/Tetris3D/Assets/Audio/Theme_C.mp3
Binary file not shown.
13 changes: 13 additions & 0 deletions Game Engine/Tetris3D/Assets/Shaders/GLSLShaders/OpaqueShader.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#version 330 core
out vec4 FragColor;

in vec3 FragPos;
in vec2 TexCoords;

uniform vec3 objectColor;
uniform sampler2D texture1;

void main()
{
FragColor = texture(texture1, TexCoords) * vec4(objectColor, 1.0);
}
17 changes: 17 additions & 0 deletions Game Engine/Tetris3D/Assets/Shaders/GLSLShaders/OpaqueShader.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 2) in vec2 aTexCoords;

out vec3 FragPos;
out vec2 TexCoords;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
FragPos = vec3(model * vec4(aPos, 1.0));
TexCoords = aTexCoords;
gl_Position = projection * view * vec4(FragPos, 1.0);
}
55 changes: 55 additions & 0 deletions Game Engine/Tetris3D/Assets/Shaders/GLSLShaders/PhongShader.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#version 330 core

in vec3 tnorm;
in vec4 eyeCoords;
in vec2 TexCoords;

layout(location = 0) out vec4 FragColor;

uniform vec3 objectColor;
uniform sampler2D texture1;

struct LightInfo {
vec4 Position; // Light position in eye coords.
vec3 La; // Ambient light intensity
vec3 Ld; // Diffuse light intensity
vec3 Ls; // Specular light intensity
};
uniform LightInfo Light[2];

struct MaterialInfo {
vec3 Ka; // Ambient reflectivity
vec3 Kd; // Diffuse reflectivity
vec3 Ks; // Specular reflectivity
float Shininess; // Specular shininess factor
};
uniform MaterialInfo Material;

void main()
{
// Light 1
vec3 s1 = normalize(vec3(Light[0].Position - eyeCoords));
vec3 v1 = normalize(-eyeCoords.xyz);
vec3 r1 = reflect(-s1, tnorm);
float sDotN1 = max(dot(s1,tnorm), 0.0);
vec3 ambient1 = Light[0].La * Material.Ka;
vec3 diffuse1 = Light[0].Ld * Material.Kd * sDotN1;
vec3 spec1= vec3(0.0);
if(sDotN1 > 0.0)
spec1 = Light[0].Ls * Material.Ks * pow(max(dot(r1, v1), 0.0), Material.Shininess);

// Light 2
vec3 s2 = normalize(vec3(Light[1].Position - eyeCoords));
vec3 v2 = normalize(-eyeCoords.xyz);
vec3 r2 = reflect(-s2, tnorm );
float sDotN2 = max(dot(s2,tnorm), 0.0 );
vec3 ambient2 = Light[1].La * Material.Ka;
vec3 diffuse2 = Light[1].Ld * Material.Kd * sDotN2;
vec3 spec2 = vec3(0.0);
if(sDotN2 > 0.0)
spec2 = Light[1].Ls * Material.Ks * pow(max(dot(r2, v2), 0.0), Material.Shininess);

vec3 LightIntensity = ambient1 + diffuse1 + spec1 + ambient2 + diffuse2 + spec2;

FragColor = texture(texture1, TexCoords) * vec4(LightIntensity * objectColor, 1.0);
}
23 changes: 23 additions & 0 deletions Game Engine/Tetris3D/Assets/Shaders/GLSLShaders/PhongShader.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#version 330 core

layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexNormal;
layout (location = 2) in vec2 aTexCoords;

out vec2 TexCoords;
out vec3 tnorm;
out vec4 eyeCoords;

uniform mat4 ModelViewMatrix;
uniform mat3 NormalMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 MVP;

void main()
{
tnorm = normalize(NormalMatrix * VertexNormal);
eyeCoords = ModelViewMatrix * vec4(VertexPosition,1.0);

TexCoords = aTexCoords;
gl_Position = MVP * vec4(VertexPosition,1.0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#version 330 core
out vec4 FragColor;

in vec3 FragPos;
in vec2 TexCoords;

uniform vec3 objectColor;
uniform sampler2D texture1;

void main()
{
FragColor = texture(texture1, TexCoords) * vec4(objectColor, 0.5);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 2) in vec2 aTexCoords;

out vec3 FragPos;
out vec2 TexCoords;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
FragPos = vec3(model * vec4(aPos, 1.0));
TexCoords = aTexCoords;
gl_Position = projection * view * vec4(FragPos, 1.0);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Game Engine/Tetris3D/Assets/Sprites/digits/five.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Game Engine/Tetris3D/Assets/Sprites/digits/four.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Game Engine/Tetris3D/Assets/Sprites/digits/one.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Game Engine/Tetris3D/Assets/Sprites/digits/seven.png
Binary file added Game Engine/Tetris3D/Assets/Sprites/digits/two.png
Binary file added Game Engine/Tetris3D/Assets/Sprites/digits/zero.png
Binary file added Game Engine/Tetris3D/Assets/Sprites/na.png
Binary file added Game Engine/Tetris3D/Tetris3D.exe
Binary file not shown.
58 changes: 58 additions & 0 deletions Game Engine/Tetris3D/config.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Visit https://www.glfw.org/docs/latest/group__keys.html
# To know what id
#

[Keyboard]
Right0=262
Left0=263
HardDrop0=265
Drop0=264
RotateR0=77
RotateL0=44
Hold0=46
Right1=68
Left1=65
HardDrop1=87
Drop1=83
RotateR1=67
RotateL1=86
Hold1=66
Pause=257

# id | Xbox 360
# 0 | A
# 1 | B
# 2 | X
# 3 | Y
# 4 | LB
# 5 | RB
# 6 | Select
# 7 | Start
# 8 | L3
# 9 | R3
# 10 | Dpad Up
# 11 | Dpad Right
# 12 | Dpad Down
# 13 | Dpad Left
[Gamepad]
Right=11
Left=13
HardDrop=10
Drop=12
RotateR=0
RotateL=1
Hold=4
HoldAlt=5
Pause=7

# id | Xbox
# 0 | Left Axis X
# 1 | Left Axis Y
# 2 | Right Axis X
# 3 | Right Axis Y
# 4 | LT
# 5 | RT
[Axis]
Horizontal=0
Vertical=1
Binary file added Game Engine/Tetris3D/glew32.dll
Binary file not shown.
Binary file added Game Engine/Tetris3D/ikpMP3.dll
Binary file not shown.
Binary file added Game Engine/Tetris3D/irrKlang.dll
Binary file not shown.
Binary file added Game Engine/Tetris3D/score.dat
Binary file not shown.

0 comments on commit 36cb37e

Please sign in to comment.