projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Reworked Surface class and drawing stuff:
[supertux.git]
/
src
/
sprite
/
sprite_data.cpp
diff --git
a/src/sprite/sprite_data.cpp
b/src/sprite/sprite_data.cpp
index
16207ff
..
ca97124
100644
(file)
--- a/
src/sprite/sprite_data.cpp
+++ b/
src/sprite/sprite_data.cpp
@@
-23,11
+23,10
@@
#include <sstream>
#include <stdexcept>
#include <sstream>
#include <stdexcept>
-#include "sprite_data.h"
-#include "app/globals.h"
-#include "app/setup.h"
-#include "video/drawing_context.h"
-#include "lisp/list_iterator.h"
+#include "sprite_data.hpp"
+#include "resources.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/list_iterator.hpp"
SpriteData::Action::Action()
{
SpriteData::Action::Action()
{
@@
-44,20
+43,18
@@
SpriteData::Action::~Action()
delete *i;
}
delete *i;
}
-SpriteData::SpriteData(const lisp::Lisp* lisp)
+SpriteData::SpriteData(const lisp::Lisp* lisp
, const std::string& basedir
)
{
lisp::ListIterator iter(lisp);
while(iter.next()) {
if(iter.item() == "name") {
iter.value()->get(name);
} else if(iter.item() == "action") {
{
lisp::ListIterator iter(lisp);
while(iter.next()) {
if(iter.item() == "name") {
iter.value()->get(name);
} else if(iter.item() == "action") {
- parse_action(iter.lisp());
+ parse_action(iter.lisp()
, basedir
);
} else {
std::cerr << "Unknown sprite field: " << iter.item() << "\n";
}
}
} else {
std::cerr << "Unknown sprite field: " << iter.item() << "\n";
}
}
- if(name.empty())
- throw std::runtime_error("Error: Sprite wihtout name.");
if(actions.empty())
throw std::runtime_error("Error: Sprite wihtout actions.");
}
if(actions.empty())
throw std::runtime_error("Error: Sprite wihtout actions.");
}
@@
-69,7
+66,7
@@
SpriteData::~SpriteData()
}
void
}
void
-SpriteData::parse_action(const lisp::Lisp* lisp)
+SpriteData::parse_action(const lisp::Lisp* lisp
, const std::string& basedir
)
{
Action* action = new Action;
{
Action* action = new Action;
@@
-93,9
+90,8
@@
SpriteData::parse_action(const lisp::Lisp* lisp)
} else {
for(int i = 0; static_cast<unsigned int>(i) < act_tmp->surfaces.size();
i++) {
} else {
for(int i = 0; static_cast<unsigned int>(i) < act_tmp->surfaces.size();
i++) {
- Surface* surface = new Surface(sdl_surface_from_sdl_surface(
- act_tmp->surfaces[i]->impl->get_sdl_surface(), true), true);
- surface->apply_filter(HORIZONTAL_FLIP_FILTER);
+ Surface* surface = new Surface(*(act_tmp->surfaces[i]));
+ surface->hflip();
action->surfaces.push_back(surface);
}
}
action->surfaces.push_back(surface);
}
}
@@
-109,8
+105,7
@@
SpriteData::parse_action(const lisp::Lisp* lisp)
}
for(std::vector<std::string>::size_type i = 0; i < images.size(); i++) {
}
for(std::vector<std::string>::size_type i = 0; i < images.size(); i++) {
- action->surfaces.push_back(
- new Surface(datadir + "/images/" + images[i], true));
+ action->surfaces.push_back(new Surface(basedir + images[i]));
}
}
actions[action->name] = action;
}
}
actions[action->name] = action;