Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sammynammy

Pages: [1]
1
Graphics / [solved] white sprite
« on: September 17, 2008, 06:36:57 pm »
hi everyone,

i want to draw a sprite on my screen but i just get a white rectangle.

this is my code:
Glider.h
Code: [Select]

#ifndef GLIDER_H
#define GLIDER_H

#include <SFML/Graphics.hpp>
#include "Entity.h"
//------------------------------------------------------------
class CGlider : public CEntity
{
public:
CGlider();
CGlider(const float fX, const float fY);
virtual ~CGlider();

void Initialize();
void Uninitialize();
void Draw();
void Idle(float flDeltaTime);

private:
sf::Sprite m_pSprite;
};
#endif

Glider.cpp
Code: [Select]

#include "Glider.h"
#include "core/KeyboardManager.h"
#include "Game/GameManager.h"
//-----------------------------------------------------------
extern sf::RenderWindow App;
//-----------------------------------------------------------
void CGlider::Initialize()
{
sf::Image Resource;
if(!Resource.LoadFromFile("C:/...Resourcen/Gleiter/gleiter.bmp"))
GAMEMANAGER->QuitWithError("Datei Resourcen/Gleiter/gleiter.bmp nicht gefunden");
m_pSprite.SetImage(Resource);
}
//-----------------------------------------------------------
void CGlider::Draw()
{
App.Draw(m_pSprite);
}
//-----------------------------------------------------------



this is a tutorial for coding an 2D-game.
by using the debug instruments of the VS2008 i found out that after loading the bmp-file the pixel array of the Resource object is completely white, Color(0,0,0,255) and its also displayed in white. but i just dont get my mistake.
perhabs you could help me...

Pages: [1]