Skip to content

Commit

Permalink
Added texture to bricks
Browse files Browse the repository at this point in the history
  • Loading branch information
izayacity committed Dec 14, 2016
1 parent 26d4802 commit 8c1a18d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 282 deletions.
2 changes: 0 additions & 2 deletions GAME-230-Breakout.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,11 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="src\Collision.cpp" />
<ClCompile Include="src\Gameplay.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Ball.h" />
<ClInclude Include="include\Brick.h" />
<ClInclude Include="include\Collision.h" />
<ClInclude Include="include\Gameplay.h" />
<ClInclude Include="include\Paddle.h" />
</ItemGroup>
Expand Down
6 changes: 0 additions & 6 deletions GAME-230-Breakout.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Collision.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Gameplay.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand All @@ -29,9 +26,6 @@
<ClInclude Include="include\Ball.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Collision.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Gameplay.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
10 changes: 6 additions & 4 deletions include/Brick.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@ class Brick {
public:
sf::RectangleShape brick;
sf::Vector2f brickSize;
sf::Texture brickTex;
sf::Texture brokeTex;
int type;
int life;

Brick () : brickSize(sf::Vector2f (100.0f, 25.0f)) {
}
// normal brick, grey
void init1 () {
void init1 (sf::Texture *brickTexture) {
type = 0;
life = 1;
brick.setFillColor (sf::Color (131, 60, 30));
brick.setSize (brickSize);
brick.setOutlineThickness (1);
brick.setOutlineColor (sf::Color::White);
brick.setOrigin (brickSize / 2.f);
brick.setTexture (brickTexture);
}
// hard brick, brown
void init2 () {
void init2 (sf::Texture *brickTexture) {
type = 1;
life = 2;
brick.setFillColor (sf::Color (195, 187, 168));
brick.setSize (brickSize);
brick.setOutlineThickness (1);
brick.setOutlineColor (sf::Color::White);
brick.setOrigin (brickSize / 2.f);
brick.setTexture (brickTexture);
assert (brokeTex.loadFromFile ("resources/crack.jpg"));
brokeTex.setSmooth (true);
}
Expand All @@ -46,14 +47,15 @@ class Brick {

}
// invincible brick, dark grey
void init4 () {
void init4 (sf::Texture *brickTexture) {
type = 3;
life = ((unsigned int)-1) >> 1;
brick.setFillColor (sf::Color (51, 51, 51));
brick.setSize (brickSize);
brick.setOutlineThickness (1);
brick.setOutlineColor (sf::Color::White);
brick.setOrigin (brickSize / 2.f);
brick.setTexture (brickTexture);
}

sf::Vector2f getPosition () {
Expand Down
75 changes: 0 additions & 75 deletions include/Collision.h

This file was deleted.

5 changes: 3 additions & 2 deletions include/Gameplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <ctime>
#include "../include/Ball.h"
#include "../include/Paddle.h"
#include "../include/Collision.h"
#include "../include/Brick.h"
#include <vector>

Expand All @@ -27,6 +26,8 @@ class Gameplay {
sf::Text scoreText;
sf::Text lifeText;
sf::Texture bgTex; //background texture
sf::Texture hard_brick_tex;
sf::Texture normal_brick_tex;
sf::RectangleShape shape; //background shape
std::vector<Brick> bricks;
int bricks_show[60];
Expand Down Expand Up @@ -59,7 +60,7 @@ class Gameplay {
float deltaTime;
int countBrick;
float fringe;
int sector;
int sector;

Gameplay () : window(sf::VideoMode (gameWidth, gameHeight, 32), "Breakout++"), BRICK_COUNT(60) {

Expand Down
190 changes: 0 additions & 190 deletions src/Collision.cpp

This file was deleted.

Loading

0 comments on commit 8c1a18d

Please sign in to comment.