Contact me to be added to this repository. Push the creations you make for D&D, and they will be displayed in a nice website. See the website for how to contribute.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

40 lines
714 B

#pragma once
#include <string>
#include "Texture.h"
extern const int S_W; //screen dimensions
extern const int S_H;
extern int L_W; //level dimensions
extern int L_H;
extern const int TILE_SIZE;
class Character {
private:
int x_,y_,vx_,vy_; //position and velocity. We dont need no second derivatives.
Texture sprite_;
SDL_Rect camera_;
public:
static const int CHAR_SPEED = 250;
Character(std::string filepath, int x, int y): x_(x), y_(y), vx_(0), vy_(0), camera_({0,0,S_W,S_H}) {
sprite_.loadFromFile(filepath);
};
~Character() {
sprite_.free();
};
void handleEvent(SDL_Event& e);
void move();
void render();
SDL_Rect getCamera();
};