#ifndef SPRITE
#define SPRITE
#include "Stdafx.h"
#include "Anim.h"
#include "Backdrop.h"
#define SPRDLL
#ifdef SPRDLL
#define SPRITE_API __declspec(dllexport)
#else
#define SPRITE_API __declspec(dllimport)
#endif
namespace sprite
{
class SPRITE_API Sprite
{
private:
string name;
Anim* actv_anim;
vector<Anim*> anims;
Uint32 timer;
SDL_Rect coord;
public:
Sprite(string source);
Sprite();
void change_anim(string anim_name);
Frame* get_frame();
SDL_Rect get_coord();
void set_coord(int, int);
};
class SPRITE_API Display
{
private:
SDL_Surface* screen;
vector<Sprite*> sprites;
Backdrop* bkg;
SDL_Rect camera;
void init_video();
public:
Display();
void update();
void add_sprite(Sprite*);
void init_bkg(string);
};
class SPRITE_API Textbox
{
private:
Sprite* font;
string text;
SDL_Rect pos;
SDL_Surface* img;
void update();
public:
Textbox(string, string, SDL_Rect);
SDL_Rect get_coord();
void set_coord(int, int);
SDL_Surface* get_img();
void set_text(string);
string get_text();
};
}
#endif
Main:
#include "SDL Sprite.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace sprite;
Sprite* test;
Textbox* testtext;
int main(int arcg, char **argv)
{
Display screen;
string teststr = "test.txt";
test = new Sprite(teststr);
screen.add_sprite(test);
screen.init_bkg("test_bkg.txt");
test->set_coord(300, 200);
for(int i = 0; i < 300; i++) screen.update();
return 0;
}
The code is like blocked by the spoiler or something- I need to be able to read it.