[ERROR] Seg faults everywhere.. WOO!!

This commit is contained in:
Rtch90 2012-04-12 02:37:31 +01:00
parent 84d3121bfb
commit 6b5607797b
2 changed files with 4 additions and 3 deletions

View File

@ -8,10 +8,9 @@ Player::Player(void) {
_blueCollision = false; _blueCollision = false;
// Loading of sprites and collision details. // Loading of sprites and collision details.
_player->LoadSprite("../Data/Img/Player.png");
// This should be directed to a collision sheet. // This should be directed to a collision sheet.
_collisionBound = new AABB(); _collisionBound = new AABB();
_collisionBound->CreateAABBFromSprite("../Data/Img/Player.png"); _collisionBound->CreateAABBFromSprite("../Data/Img/Player");
_environmentCollisionBound = new AABB(); _environmentCollisionBound = new AABB();
_environmentCollisionBound->SetMin(_collisionBound->GetMin().x, _collisionBound->GetMax().y - 50.0f); _environmentCollisionBound->SetMin(_collisionBound->GetMin().x, _collisionBound->GetMax().y - 50.0f);
@ -24,6 +23,7 @@ Player::~Player(void) {
} }
void Player::Update(void) { void Player::Update(void) {
_player->LoadSprite("../Data/Img/Player.png");
// Position and collision bound with the player. // Position and collision bound with the player.
_collisionBound->SetPositionOffset(_player->GetX(), _player->GetY()); _collisionBound->SetPositionOffset(_player->GetX(), _player->GetY());
//_environmentCollisionBound->SetPositionOffset(_player->GetX, _player->GetY()); //_environmentCollisionBound->SetPositionOffset(_player->GetX, _player->GetY());

View File

@ -1,7 +1,7 @@
#include "AABB.h" #include "AABB.h"
typedef unsigned int DWORD; typedef Uint32 DWORD;
AABB::AABB(void) { AABB::AABB(void) {
_sprite = 0; _sprite = 0;
@ -64,6 +64,7 @@ void AABB::CreateAABBFromSprite(const char* filename) {
// Find the min, look through until we find a first instance of a white color. // Find the min, look through until we find a first instance of a white color.
bool found = false; bool found = false;
int color = 0; int color = 0;
DWORD* pixels = (DWORD*)screen->pixels; DWORD* pixels = (DWORD*)screen->pixels;
for(int width = 0; width < _sprite->GetWidth(); width++) { for(int width = 0; width < _sprite->GetWidth(); width++) {