From 6b5607797b0ecbb66892ae501cb11cf7dcb5e406 Mon Sep 17 00:00:00 2001 From: Rtch90 Date: Thu, 12 Apr 2012 02:37:31 +0100 Subject: [PATCH] [ERROR] Seg faults everywhere.. WOO!! --- src/Actor/Player.cpp | 4 ++-- src/Collision/AABB.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Actor/Player.cpp b/src/Actor/Player.cpp index 796864b..3d8625b 100644 --- a/src/Actor/Player.cpp +++ b/src/Actor/Player.cpp @@ -8,10 +8,9 @@ Player::Player(void) { _blueCollision = false; // Loading of sprites and collision details. - _player->LoadSprite("../Data/Img/Player.png"); // This should be directed to a collision sheet. _collisionBound = new AABB(); - _collisionBound->CreateAABBFromSprite("../Data/Img/Player.png"); + _collisionBound->CreateAABBFromSprite("../Data/Img/Player"); _environmentCollisionBound = new AABB(); _environmentCollisionBound->SetMin(_collisionBound->GetMin().x, _collisionBound->GetMax().y - 50.0f); @@ -24,6 +23,7 @@ Player::~Player(void) { } void Player::Update(void) { + _player->LoadSprite("../Data/Img/Player.png"); // Position and collision bound with the player. _collisionBound->SetPositionOffset(_player->GetX(), _player->GetY()); //_environmentCollisionBound->SetPositionOffset(_player->GetX, _player->GetY()); diff --git a/src/Collision/AABB.cpp b/src/Collision/AABB.cpp index ab6ca5f..ada7f3e 100644 --- a/src/Collision/AABB.cpp +++ b/src/Collision/AABB.cpp @@ -1,7 +1,7 @@ #include "AABB.h" -typedef unsigned int DWORD; +typedef Uint32 DWORD; AABB::AABB(void) { _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. bool found = false; int color = 0; + DWORD* pixels = (DWORD*)screen->pixels; for(int width = 0; width < _sprite->GetWidth(); width++) {