• (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4

Beginning SDL Part 4 - State Manager

#46 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 931
  • View blog
  • Posts: 4,012
  • Joined: 14-February 08

Posted 06 December 2012 - 04:16 AM

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?
Was This Post Helpful? 0
  • +
  • -

#47 sandmaster  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 06-December 12

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 :/
Was This Post Helpful? 0
  • +
  • -

#48 DoNotWant  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 50
  • Joined: 03-November 11

Posted 06 December 2012 - 05:22 AM

Could you post your sprite class?
Was This Post Helpful? 0
  • +
  • -

#49 sandmaster  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 06-December 12

Posted 06 December 2012 - 06:16 AM

View PostDoNotWant, 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;

 }

Was This Post Helpful? 0
  • +
  • -

#50 DoNotWant  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 50
  • Joined: 03-November 11

Posted 06 December 2012 - 06:29 AM

Where is your load function in the cpp file?
Was This Post Helpful? 0
  • +
  • -

#51 sandmaster  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 06-December 12

Posted 06 December 2012 - 06:38 AM

Thats the problem, it isnt there :S
Was This Post Helpful? 0
  • +
  • -

#52 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 931
  • View blog
  • Posts: 4,012
  • Joined: 14-February 08

Posted 06 December 2012 - 06:38 AM

DoNotWant is right, you've missed a function out. it's declared but never defined.
Was This Post Helpful? 0
  • +
  • -

#53 sandmaster  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 06-December 12

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 :P

Thanks!
Was This Post Helpful? 0
  • +
  • -

#54 DoNotWant  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 50
  • Joined: 03-November 11

Posted 06 December 2012 - 06:52 AM

I do those kind of renaming mistakes all the time too. Probably should start following tutorials verbatim. :P
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4