]> git.localhorst.tv Git - l2e.git/blob - src/battle/states/RunState.cpp
08c45e80cd8fb97f1a35f9cbc88783204da4a4a8
[l2e.git] / src / battle / states / RunState.cpp
1 /*
2  * RunState.cpp
3  *
4  *  Created on: Aug 10, 2012
5  *      Author: holy
6  */
7
8 #include "RunState.h"
9
10 #include "../BattleState.h"
11 #include "../../app/Application.h"
12 #include "../../app/Input.h"
13 #include "../../geometry/operators.h"
14 #include "../../geometry/Point.h"
15
16 using app::Application;
17 using app::Input;
18 using geometry::Point;
19 using geometry::Vector;
20
21 namespace battle {
22
23 void RunState::EnterState(Application &c, SDL_Surface *screen) {
24         ctrl = &c;
25         // TODO: push battle animation if enemy is faster
26 }
27
28 void RunState::ExitState(Application &c, SDL_Surface *screen) {
29         ctrl = 0;
30 }
31
32 void RunState::ResumeState(Application &ctrl, SDL_Surface *screen) {
33         timer = GraphicsTimers().StartCountdown(2500);
34 }
35
36 void RunState::PauseState(Application &ctrl, SDL_Surface *screen) {
37
38 }
39
40
41 void RunState::Resize(int width, int height) {
42
43 }
44
45
46 void RunState::HandleEvents(const Input &input) {
47         if (timer.Finished()) {
48                 ctrl->PopState(); // pop self
49                 ctrl->PopState(); // pop battle
50         }
51 }
52
53
54 void RunState::UpdateWorld(float deltaT) {
55
56 }
57
58 void RunState::Render(SDL_Surface *screen) {
59         Vector<int> offset(battle->CalculateScreenOffset(screen));
60         battle->RenderBackground(screen, offset);
61         battle->RenderMonsters(screen, offset);
62         battle->RenderHeroes(screen, offset);
63         // render small tags
64 }
65
66 }