Have you added the SDL.lib and SDLmain.lib to linked libraries? Do you have the SDL.dll in the same folder as the executable?
Beginning SDL Part 4 - State Manager
#47
Posted 06 December 2012 - 04:40 AM
Yea, got all of them lionked, and the files in the folder where i run the program.
It worked before in the last tutorials to run, i really hate when it happens for no specific reason
It worked before in the last tutorials to run, i really hate when it happens for no specific reason
#49
Posted 06 December 2012 - 06:16 AM
DoNotWant, on 06 December 2012 - 05:22 AM, said:
Could you post your sprite class?
Sprite.h
#ifndef SPRITE_H
#define SPRITE_H
#include <SDL.h>
class Sprite
{
public:
Sprite();
static SDL_Surface* Load (char* pFile);
static bool Draw(SDL_Surface* dest, SDL_Surface* src, int x, int y);
static bool Draw(SDL_Surface* dest, SDL_Surface* src, int x, int y, int x2, int y2, int width, int height);
};
#endif
Sprite.cpp
#include "Sprite.h"
Sprite::Sprite()
{
}
bool Sprite::Draw(SDL_Surface* dest, SDL_Surface* src, int x, int y)
{
if(dest == NULL || src == NULL)
return false;
SDL_Rect offset;
offset.x = x;
offset.y = y;
SDL_BlitSurface( src, NULL, dest, &offset );
return true;
}
bool Sprite::Draw(SDL_Surface* dest, SDL_Surface* src, int x, int y, int x2, int y2, int width, int height)
{
if(dest == NULL || src == NULL)
return false;
SDL_Rect offset;
offset.x = x;
offset.y = y;
SDL_Rect sourceRect;
sourceRect.x = x2;
sourceRect.y = y2;
sourceRect.w = width;
sourceRect.h = height;
SDL_BlitSurface(src, &sourceRect, dest, &offset);
return true;
}
#52
Posted 06 December 2012 - 06:38 AM
DoNotWant is right, you've missed a function out. it's declared but never defined.
#53
Posted 06 December 2012 - 06:43 AM
BUT i do call load from gamestate... Ah! there we go, thanks, I checked it up and i use it in gamestate, but i got my own method to load images, and when i replaced load with that method, it worked
thats what i get when i follow tutorials and use diffent names 
Thanks!
Thanks!
#54
Posted 06 December 2012 - 06:52 AM
I do those kind of renaming mistakes all the time too. Probably should start following tutorials verbatim.
|
|





MultiQuote


|