1 diff -Naur tractionedge-v0.1/AnimManager.h tractionedge-v0.1_mod/AnimManager.h
2 --- tractionedge-v0.1/AnimManager.h 2010-02-05 10:41:05.000000000 +0000
3 +++ tractionedge-v0.1_mod/AnimManager.h 2011-07-09 19:53:33.000000000 +0100
10 #include "DisplayManager.h"
12 class AnimManager: public Item{
13 diff -Naur tractionedge-v0.1/GfxSFML.cpp tractionedge-v0.1_mod/GfxSFML.cpp
14 --- tractionedge-v0.1/GfxSFML.cpp 2010-08-21 12:16:44.000000000 +0100
15 +++ tractionedge-v0.1_mod/GfxSFML.cpp 2011-07-09 19:53:33.000000000 +0100
18 #include "DisplayManager.h"
19 #include "GameWorld.h"
20 +#include <SFML/Window.hpp>
27 m_mainWindow.Create(sf::VideoMode(SCREENWIDTH, SCREENHEIGHT, 32), "Traction Edge");
28 - m_mainWindow.UseVerticalSync(true);
29 + m_mainWindow.EnableVerticalSync(true);
30 m_mainWindow.EnableKeyRepeat(true);
32 //create lookup table for colors
37 - titleFont.LoadFromFile("fonts/Vtks Revolt.ttf", 60);
38 - tinyFont.LoadFromFile("fonts/LiberationMono-Regular.ttf",FONTSIZETINY);
39 - smallFont.LoadFromFile("fonts/LiberationMono-Regular.ttf",FONTSIZESMALL);
40 - mediumFont.LoadFromFile("fonts/LiberationMono-Regular.ttf",FONTSIZEMEDIUM);
41 - largeFont.LoadFromFile("fonts/LiberationMono-Regular.ttf",FONTSIZELARGE);
42 + titleFont.LoadFromFile("fonts/Vtks Revolt.ttf"/*, 60*/);
43 + tinyFont.LoadFromFile("fonts/LiberationMono-Regular.ttf"/*,FONTSIZETINY*/);
44 + smallFont.LoadFromFile("fonts/LiberationMono-Regular.ttf"/*,FONTSIZESMALL*/);
45 + mediumFont.LoadFromFile("fonts/LiberationMono-Regular.ttf"/*,FONTSIZEMEDIUM*/);
46 + largeFont.LoadFromFile("fonts/LiberationMono-Regular.ttf"/*,FONTSIZELARGE*/);
49 //create lookup table of fonts
51 fontLookupMap[BODYLARGE]=largeFont;
53 //create lookup table of font styles
54 - styleLookupMap[REGULAR]=sf::String::Regular;
55 - styleLookupMap[BOLD]=sf::String::Bold;
56 - styleLookupMap[ITALIC]=sf::String::Italic;
57 + styleLookupMap[REGULAR]=sf::Text::Regular;
58 + styleLookupMap[BOLD]=sf::Text::Bold;
59 + styleLookupMap[ITALIC]=sf::Text::Italic;
61 //create lookup table of color shapes
62 for (int i=0;i < 15;i++){
65 for (int y=0; y<MASTERTILEIMAGEHEIGHT/TILEHEIGHT;y++){
66 for (int x=0; x<MASTERTILEIMAGEWIDTH/TILEWIDTH; x++) {
67 - sf::Image image(TILEWIDTH,TILEHEIGHT,colorLookup[0]);
69 + image.Create(TILEWIDTH,TILEHEIGHT,colorLookup[0]);
70 sf::IntRect rect(x*TILEWIDTH,y*TILEHEIGHT,x*TILEWIDTH+TILEWIDTH,y*TILEHEIGHT+TILEHEIGHT);
71 image.Copy(masterImage,0,0,rect,false);
72 switch (tileImages.size()) {
74 void GfxEngine::renderStrings(std::vector<std::string>& strings, std::vector<int>& colors, std::vector<font_t>& fonts, std::vector<fontStyle_t>& styles, std::vector<int>& sizes, std::vector<Position>& positions)
76 for (int i=0;i < strings.size();i++){
78 - text.SetText(strings[i]);
80 + text.SetString(strings[i]);
81 text.SetPosition(positions[i].x,positions[i].y);
82 text.SetColor(colorLookup[colors[i]]);
83 text.SetFont(fontLookupMap[fonts[i]]);
84 - text.SetSize(sizes[i]);
85 + text.SetCharacterSize(sizes[i]);
86 text.SetStyle(styleLookupMap[styles[i]]);
87 m_mainWindow.Draw(text);
90 void GfxEngine::renderFrame(int x1, int y1, int x2, int y2)
92 sf::Shape rect = sf::Shape::Rectangle(x1, y1, x2, y2, colorLookup[COLORBROWN],true,colorLookup[COLORBROWN]);
93 - rect.SetOutlineWidth(1);
94 + rect.SetOutlineThickness(1);
95 rect.EnableFill(false);
96 m_mainWindow.Draw(rect);
101 m_mainWindow.Create(sf::VideoMode(SCREENWIDTH, SCREENHEIGHT, 32), "Traction Edge");
102 - m_mainWindow.UseVerticalSync(true);
103 + m_mainWindow.EnableVerticalSync(true);
104 m_mainWindow.EnableKeyRepeat(true);
109 //fetch events and send only keypresses back
111 - while (m_mainWindow.GetEvent(Event))
112 + while (m_mainWindow.PollEvent(Event))
115 if (Event.Type == sf::Event::Closed)
116 @@ -277,62 +279,62 @@
117 if (Event.Type == sf::Event::KeyPressed)
120 - if (Event.Key.Code == sf::Key::Space)
121 + if (Event.Key.Code == sf::Keyboard::Space)
123 - if (Event.Key.Code == sf::Key::Escape)
124 + if (Event.Key.Code == sf::Keyboard::Escape)
126 - if (Event.Key.Code == sf::Key::Return)
127 + if (Event.Key.Code == sf::Keyboard::Return)
129 - if (Event.Key.Code == sf::Key::Right || Event.Key.Code == sf::Key::Numpad6)
130 + if (Event.Key.Code == sf::Keyboard::Right || Event.Key.Code == sf::Keyboard::Numpad6)
132 - if (Event.Key.Code == sf::Key::Left || Event.Key.Code == sf::Key::Numpad4)
133 + if (Event.Key.Code == sf::Keyboard::Left || Event.Key.Code == sf::Keyboard::Numpad4)
135 - if (Event.Key.Code == sf::Key::Up || Event.Key.Code == sf::Key::Numpad8)
136 + if (Event.Key.Code == sf::Keyboard::Up || Event.Key.Code == sf::Keyboard::Numpad8)
138 - if (Event.Key.Code == sf::Key::Down || Event.Key.Code == sf::Key::Numpad2)
139 + if (Event.Key.Code == sf::Keyboard::Down || Event.Key.Code == sf::Keyboard::Numpad2)
141 - if (Event.Key.Code == sf::Key::Numpad9)
142 + if (Event.Key.Code == sf::Keyboard::Numpad9)
143 return (KEY_UP_RIGHT);
144 - if (Event.Key.Code == sf::Key::Numpad7)
145 + if (Event.Key.Code == sf::Keyboard::Numpad7)
146 return (KEY_UP_LEFT);
147 - if (Event.Key.Code == sf::Key::Numpad3)
148 + if (Event.Key.Code == sf::Keyboard::Numpad3)
149 return (KEY_DOWN_RIGHT);
150 - if (Event.Key.Code == sf::Key::Numpad1)
151 + if (Event.Key.Code == sf::Keyboard::Numpad1)
152 return (KEY_DOWN_LEFT);
154 - if (Event.Key.Code == sf::Key::Tab)
155 + if (Event.Key.Code == sf::Keyboard::Tab)
157 - if (Event.Key.Code == sf::Key::T)
158 + if (Event.Key.Code == sf::Keyboard::T)
159 return (ACTION_TARGET);
160 - if (Event.Key.Code == sf::Key::R)
161 + if (Event.Key.Code == sf::Keyboard::R)
163 - if (Event.Key.Code == sf::Key::A)
164 + if (Event.Key.Code == sf::Keyboard::A)
166 - if (Event.Key.Code == sf::Key::A)
167 + if (Event.Key.Code == sf::Keyboard::A)
169 - if (Event.Key.Code == sf::Key::B)
170 + if (Event.Key.Code == sf::Keyboard::B)
172 - if (Event.Key.Code == sf::Key::C)
173 + if (Event.Key.Code == sf::Keyboard::C)
175 - if (Event.Key.Code == sf::Key::D)
176 + if (Event.Key.Code == sf::Keyboard::D)
178 - if (Event.Key.Code == sf::Key::E)
179 + if (Event.Key.Code == sf::Keyboard::E)
181 - if (Event.Key.Code == sf::Key::F)
182 + if (Event.Key.Code == sf::Keyboard::F)
184 - if (Event.Key.Code == sf::Key::G)
185 + if (Event.Key.Code == sf::Keyboard::G)
187 - if (Event.Key.Code == sf::Key::I)
188 + if (Event.Key.Code == sf::Keyboard::I)
190 - if (Event.Key.Code == sf::Key::H)
191 + if (Event.Key.Code == sf::Keyboard::H)
193 - if (Event.Key.Code == sf::Key::N)
194 + if (Event.Key.Code == sf::Keyboard::N)
196 - if (Event.Key.Code == sf::Key::P)
197 + if (Event.Key.Code == sf::Keyboard::P)
199 - if (Event.Key.Code == sf::Key::S)
200 + if (Event.Key.Code == sf::Keyboard::S)
202 - if (Event.Key.Code == sf::Key::W)
203 + if (Event.Key.Code == sf::Keyboard::W)
207 diff -Naur tractionedge-v0.1/GfxSFML.h tractionedge-v0.1_mod/GfxSFML.h
208 --- tractionedge-v0.1/GfxSFML.h 2010-04-24 13:22:15.000000000 +0100
209 +++ tractionedge-v0.1_mod/GfxSFML.h 2011-07-09 19:53:33.000000000 +0100
211 std::map<char, sf::String> tileLookupMap;
212 std::map<int, sf::Shape> colorShapeMap;
213 std::map<font_t, sf::Font> fontLookupMap;
214 - std::map<fontStyle_t, sf::String::Style> styleLookupMap;
215 + std::map<fontStyle_t, sf::Text::Style> styleLookupMap;
217 std::vector<sf::Image> tileImages;
218 std::vector<std::vector<sf::Sprite> > mapSprites;
219 diff -Naur tractionedge-v0.1/Utility.cpp tractionedge-v0.1_mod/Utility.cpp
220 --- tractionedge-v0.1/Utility.cpp 2010-07-01 10:31:35.000000000 +0100
221 +++ tractionedge-v0.1_mod/Utility.cpp 2011-07-09 19:53:33.000000000 +0100
223 #include "GameWorld.h"
224 #include "Position.h"
228 std::string Utility::wrap(std::string str, int width)