Added SDL_Coor options to ButtonToggle. Major changes coming.

This commit is contained in:
Rtch90 2011-12-12 20:00:49 +00:00
parent 93bbd34acc
commit fd4ebca425
6 changed files with 36 additions and 4 deletions

BIN
Unuk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -1,13 +1,35 @@
#include "ButtonToggle.h" #include "ButtonToggle.h"
ButtonToggle::ButtonToggle(void) {
}
ButtonToggle::~ButtonToggle(void) {
}
void ButtonToggle::SetOverRGB(Uint8 r, Uint8 g, Uint8 b) { void ButtonToggle::SetOverRGB(Uint8 r, Uint8 g, Uint8 b) {
Button::SetOverRGB(r, g, b); Button::SetOverRGB(r, g, b);
} }
void ButtonToggle::SetOverRGB(SDL_Color colour) {
Button::SetOverRGB(colour);
}
void ButtonToggle::SetOffRGB(Uint8 r, Uint8 g, Uint8 b) { void ButtonToggle::SetOffRGB(Uint8 r, Uint8 g, Uint8 b) {
ButtonToggle::SetOutRGB(r, g, b); ButtonToggle::SetOutRGB(r, g, b);
} }
void ButtonToggle::SetOnRGB(Uint8 r, Uint8 g, Uint8 b) { void ButtonToggle::SetOffRGB(SDL_Color colour) {
Button::SetOutRGB(colour);
}
void ButtonToggle::SetOnRGB(Uint8 r, Uint8 g, Uint8 b) {
m_onColour.r = r;
m_onColour.g = g;
m_onColour.b = b;
}
void ButtonToggle::SetOnRGB(SDL_Color colour) {
m_onColour = colour;
} }

View File

@ -11,8 +11,11 @@ public:
~ButtonToggle(void); ~ButtonToggle(void);
void SetOverRGB(Uint8 r, Uint8 g, Uint8 b); void SetOverRGB(Uint8 r, Uint8 g, Uint8 b);
void SetOverRGB(SDL_Color);
void SetOffRGB(Uint8 r, Uint8 g, Uint8 b); void SetOffRGB(Uint8 r, Uint8 g, Uint8 b);
void SetOffRGB(SDL_Color);
void SetOnRGB(Uint8 r, Uint8 g, Uint8 b); void SetOnRGB(Uint8 r, Uint8 g, Uint8 b);
void SetOnRGB(SDL_Color);
void SetTextRGB(Uint8 r, Uint8 g, Uint8 b); void SetTextRGB(Uint8 r, Uint8 g, Uint8 b);
void SetOnText(string); void SetOnText(string);

View File

@ -130,12 +130,15 @@ bool Character::CheckTileCollisions(void) {
bool Character::CheckEntityCollisions(void) { bool Character::CheckEntityCollisions(void) {
for(int i = -1; i < 2; i++) { for(int i = -1; i < 2; i++) {
for(int j = -1; j < 2; j++) { for(int j = -1; j < 2; j++) {
if(map->GetEntitySolidity(tileX + i, tileY + j)) if(map->GetEntitySolidity(tileX + i, tileY + j)) {
printf("\nw - ", map->GetEntityWidth(tileX + i, tileY + j));
printf("\nh - ", map->GetEntityHeight(tileX + i, tileY + j));
if(CheckCollisionXY(x, y, w, h, map->GetEntityX(tileX + i, tileY + j), if(CheckCollisionXY(x, y, w, h, map->GetEntityX(tileX + i, tileY + j),
map->GetEntityY(tileX + i, tileY + j), map->GetEntityY(tileX + i, tileY + j),
map->GetEntityWidth(tileX + i, tileY + j), map->GetEntityWidth(tileX + i, tileY + j),
map->GetEntityHeight(tileX + i, tileY + j))) map->GetEntityHeight(tileX + i, tileY + j)))
return true; return true;
}
} }
} }
return false; return false;

View File

@ -10,6 +10,7 @@
#include "Collision.h" #include "Collision.h"
#include "Map.h" #include "Map.h"
#include "Timer.h" #include "Timer.h"
#include "Debug.h"
using namespace std; using namespace std;
class Map; class Map;
@ -71,7 +72,7 @@ protected:
private: private:
static const int ANIMATION_SPEED = 200; static const int ANIMATION_SPEED = 200;
static const int ATTACKING_DISPLAY_LEN = 100; static const int ATTACKING_DISPLAY_LEN = 150;
SDL_Surface* m_texture; SDL_Surface* m_texture;

View File

@ -56,6 +56,9 @@ void Map::Load(const string filename) {
m_entityTextures->GetTextureWidth(m_tile[m_mapRows][m_mapColumns].GetEntityID()), m_entityTextures->GetTextureWidth(m_tile[m_mapRows][m_mapColumns].GetEntityID()),
m_entityTextures->GetTextureHeight(m_tile[m_mapRows][m_mapColumns].GetEntityID())); m_entityTextures->GetTextureHeight(m_tile[m_mapRows][m_mapColumns].GetEntityID()));
printf("\nw - ", m_entityTextures->GetTextureWidth(m_tile[m_mapRows][m_mapColumns].GetEntityID()));
printf("\nh - ", m_entityTextures->GetTextureHeight(m_tile[m_mapRows][m_mapColumns].GetEntityID()));
// Set the entities x and y variables. // Set the entities x and y variables.
m_tile[m_mapRows][m_mapColumns].SetEntityXY( m_tile[m_mapRows][m_mapColumns].SetEntityXY(
m_tile[m_mapRows][m_mapColumns].GetTileX() - (m_tile[m_mapRows][m_mapColumns].GetEntityWidth() / 2 + TILE_WIDTH / 2), m_tile[m_mapRows][m_mapColumns].GetTileX() - (m_tile[m_mapRows][m_mapColumns].GetEntityWidth() / 2 + TILE_WIDTH / 2),