-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharacterView.cpp
More file actions
82 lines (75 loc) · 2.33 KB
/
CharacterView.cpp
File metadata and controls
82 lines (75 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// CharacterView.cpp
// FFFF
//
// Created by Casey Hanley on 3/27/14.
// Copyright (c) 2014 Casey Hanley. All rights reserved.
//
#include "CharacterView.h"
#include <SDL2/SDL.h>
#include "SDL2_image/SDL_image.h"
#include <stdio.h>
int CharacterView::getX(){
return xLoc;
}
//------------------------------------------------------------------------------
int CharacterView::getY(){
return yLoc;
}
//------------------------------------------------------------------------------
void CharacterView::moveRel(int x, int y){
xLoc=getX()+x;
yLoc=getY()+y;
}
//------------------------------------------------------------------------------
void CharacterView::moveAbs(int x, int y){
xLoc=x;
yLoc=y;
}
//------------------------------------------------------------------------------
void CharacterView::setDegs(double value){
degs=value;
}
//------------------------------------------------------------------------------
double CharacterView::getDegs(){
return degs;
}
//------------------------------------------------------------------------------
void CharacterView::setDir(int direction){
faceDir=direction;
}
//------------------------------------------------------------------------------
SDL_RendererFlip CharacterView::getDir(){
return flipDir;
}
//------------------------------------------------------------------------------
SDL_RendererFlip CharacterView::flipLeft(){
flipDir=SDL_FLIP_NONE;
return flipDir;
}
//------------------------------------------------------------------------------
SDL_RendererFlip CharacterView::flipRight(){
flipDir=SDL_FLIP_HORIZONTAL;
return flipDir;
}
//------------------------------------------------------------------------------
void CharacterView::draw(SDL_Renderer *gRenderer){
battleTexture.render(gRenderer, xLoc, yLoc, NULL, degs, NULL, flipDir);
}
//------------------------------------------------------------------------------
CharacterView::CharacterView(){
//initialize stuff
xLoc=0;
yLoc=0;
degs=0;
flipDir=SDL_FLIP_NONE;
}
//------------------------------------------------------------------------------
CharacterView::CharacterView(int x, int y, string filename, SDL_Renderer *gRenderer){
//initialize stuff
xLoc=x;
yLoc=y;
degs=0;
flipDir=SDL_FLIP_NONE;
battleTexture.loadFromFile(filename, gRenderer);
}