[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3196 - in trunk/pingus: data/data src/editor
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3196 - in trunk/pingus: data/data src/editor |
Date: |
Fri, 21 Sep 2007 15:09:08 +0200 |
Author: grumbel
Date: 2007-09-21 15:09:07 +0200 (Fri, 21 Sep 2007)
New Revision: 3196
Modified:
trunk/pingus/data/data/core.res
trunk/pingus/data/data/editor.res
trunk/pingus/src/editor/action_properties.cpp
trunk/pingus/src/editor/editor_level.cpp
trunk/pingus/src/editor/editor_screen.cpp
trunk/pingus/src/editor/level_objs.cpp
trunk/pingus/src/editor/level_objs.hpp
trunk/pingus/src/editor/object_properties.cpp
trunk/pingus/src/editor/object_properties.hpp
trunk/pingus/src/editor/object_selector.cpp
Log:
- implemented Starfield Background in editor
Modified: trunk/pingus/data/data/core.res
===================================================================
--- trunk/pingus/data/data/core.res 2007-09-20 22:25:26 UTC (rev 3195)
+++ trunk/pingus/data/data/core.res 2007-09-21 13:09:07 UTC (rev 3196)
@@ -50,6 +50,10 @@
(image-file
"../images/core/editor/solidcolorbackground_thumb.png"))
(sprite
+ (name "solidcolorbackground")
+ (image-file
"../images/core/editor/solidcolorbackground.png"))
+
+ (sprite
(name "starfield_thumb")
(image-file "../images/core/editor/starfield_thumb.png"))
Modified: trunk/pingus/data/data/editor.res
===================================================================
--- trunk/pingus/data/data/editor.res 2007-09-20 22:25:26 UTC (rev 3195)
+++ trunk/pingus/data/data/editor.res 2007-09-21 13:09:07 UTC (rev 3196)
@@ -4,84 +4,84 @@
(section (name "Objects")
(sprite
(name "start_pos")
- (images "../images/core/editor/start_pos.png"))
+ (image-file "../images/core/editor/start_pos.png"))
(sprite
(name "weather_rain")
- (images "../images/core/editor/weather_rain.png"))
+ (image-file "../images/core/editor/weather_rain.png"))
(sprite
(name "weather_snow")
- (images "../images/core/editor/weather_snow.png"))
+ (image-file "../images/core/editor/weather_snow.png"))
(sprite
(name "solidcolorbackground_thumb")
- (images "../images/core/editor/solidcolorbackground_thumb.png"))
+ (image-file "../images/core/editor/solidcolorbackground_thumb.png"))
(sprite
(name "starfield_thumb")
- (images "../images/core/editor/starfield_thumb.png"))
+ (image-file "../images/core/editor/starfield_thumb.png"))
(section (name "Icons")
(sprite
(name "copy")
- (images "../images/core/editor/tb_copy.png"))
+ (image-file "../images/core/editor/tb_copy.png"))
(sprite
(name "new")
- (images "../images/core/editor/tb_new.png"))
+ (image-file "../images/core/editor/tb_new.png"))
(sprite
(name "open")
- (images "../images/core/editor/tb_open.png"))
+ (image-file "../images/core/editor/tb_open.png"))
(sprite
(name "save")
- (images "../images/core/editor/tb_save.png"))
+ (image-file "../images/core/editor/tb_save.png"))
(sprite
(name "exit")
- (images "../images/core/editor/tb_exit.png"))
+ (image-file "../images/core/editor/tb_exit.png"))
(sprite
(name "clock_run")
- (images "../images/core/editor/tb_clock_run.png"))
+ (image-file "../images/core/editor/tb_clock_run.png"))
(sprite
(name "edit")
- (images "../images/core/editor/tb_edit.png"))
+ (image-file "../images/core/editor/tb_edit.png"))
(sprite
(name "preferences")
- (images "../images/core/editor/tb_preferences.png"))
+ (image-file "../images/core/editor/tb_preferences.png"))
(sprite
(name "help")
- (images "../images/core/editor/tb_help.png"))
+ (image-file "../images/core/editor/tb_help.png"))
(sprite
(name "delete")
- (images "../images/core/editor/tb_trash.png"))
+ (image-file "../images/core/editor/tb_trash.png"))
(sprite
(name "index")
- (images "../images/core/editor/tb_index.png"))
+ (image-file "../images/core/editor/tb_index.png"))
(sprite
(name "actions")
- (images "../images/core/editor/actions.png"))
+ (image-file "../images/core/editor/actions.png"))
(sprite
(name "region-zoom")
- (images "../images/core/editor/region-zoom.png"))
+ (image-file "../images/core/editor/region-zoom.png"))
(sprite
(name "zoom-in")
- (images "../images/core/editor/zoom-in.png"))
+ (image-file "../images/core/editor/zoom-in.png"))
(sprite
(name "zoom-out")
- (images "../images/core/editor/zoom-out.png"))
+ (image-file "../images/core/editor/zoom-out.png"))
)
)
)
Modified: trunk/pingus/src/editor/action_properties.cpp
===================================================================
--- trunk/pingus/src/editor/action_properties.cpp 2007-09-20 22:25:26 UTC
(rev 3195)
+++ trunk/pingus/src/editor/action_properties.cpp 2007-09-21 13:09:07 UTC
(rev 3196)
@@ -41,12 +41,10 @@
{
add_action(Actions::Basher);
add_action(Actions::Blocker);
- add_action(Actions::Boarder);
add_action(Actions::Bomber);
add_action(Actions::Bridger);
add_action(Actions::Climber);
add_action(Actions::Digger);
- add_action(Actions::Exiter);
add_action(Actions::Floater);
add_action(Actions::Jumper);
add_action(Actions::Miner);
Modified: trunk/pingus/src/editor/editor_level.cpp
===================================================================
--- trunk/pingus/src/editor/editor_level.cpp 2007-09-20 22:25:26 UTC (rev
3195)
+++ trunk/pingus/src/editor/editor_level.cpp 2007-09-21 13:09:07 UTC (rev
3196)
@@ -63,12 +63,10 @@
impl->actions.clear();
impl->actions["basher"] = 20;
impl->actions["blocker"] = 20;
- impl->actions["boarder"] = 20;
impl->actions["bomber"] = 20;
impl->actions["bridger"] = 20;
impl->actions["climber"] = 20;
impl->actions["digger"] = 20;
- impl->actions["exiter"] = 20;
impl->actions["floater"] = 20;
impl->actions["jumper"] = 20;
impl->actions["miner"] = 20;
Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp 2007-09-20 22:25:26 UTC (rev
3195)
+++ trunk/pingus/src/editor/editor_screen.cpp 2007-09-21 13:09:07 UTC (rev
3196)
@@ -92,7 +92,7 @@
viewport->selection_changed.connect(boost::bind(&ObjectProperties::set_objects,
object_properties, _1));
- action_properties = new ActionProperties(this, Rect(Vector2i(0, 38),
Size(150, 284)));
+ action_properties = new ActionProperties(this, Rect(Vector2i(0, 38),
Size(150, 240)));
action_properties->hide();
gui_manager->add(action_properties, true);
Modified: trunk/pingus/src/editor/level_objs.cpp
===================================================================
--- trunk/pingus/src/editor/level_objs.cpp 2007-09-20 22:25:26 UTC (rev
3195)
+++ trunk/pingus/src/editor/level_objs.cpp 2007-09-21 13:09:07 UTC (rev
3196)
@@ -67,6 +67,10 @@
return HAS_SPEED | HAS_WIDTH | HAS_SURFACE;
else if (obj_type == "surface-background")
return HAS_COLOR | HAS_STRETCH | HAS_PARA | HAS_SCROLL | HAS_SURFACE;
+ else if (obj_type == "solidcolor-background")
+ return HAS_COLOR | HAS_SURFACE_FAKE;
+ else if (obj_type == "starfield-background")
+ return HAS_STARFIELD | HAS_SURFACE_FAKE;
else if (obj_type == "entrance" || obj_type == "woodthing")
return HAS_TYPE | HAS_DIRECTION | HAS_RELEASE_RATE | HAS_OWNER |
HAS_SURFACE_FAKE;
else if (obj_type == "exit")
@@ -90,7 +94,7 @@
void
LevelObj::draw(DrawingContext &gc)
{
- if (attribs & (HAS_SURFACE | HAS_SURFACE_FAKE))
+ if (attribs & HAS_SURFACE || attribs & HAS_SURFACE_FAKE)
{
if (attribs & HAS_WIDTH)
{
@@ -106,6 +110,11 @@
gc.draw(sprite, Vector3f((float)x, (float)y, pos.z));
}
#endif
+ else if (attribs & HAS_COLOR && section_name == "solidcolor-background")
+ { // FIXME: Should we have the object type in non-string form?
+ gc.draw_fillrect(Rect(Vector2i((int)pos.x, (int)pos.y), Size(256,
256)), color, pos.z);
+ gc.draw(sprite, pos);
+ }
else
{
gc.draw(sprite, pos);
@@ -161,7 +170,7 @@
void
LevelObj::refresh_sprite()
{
- if (attribs & HAS_SURFACE)
+ if (attribs & HAS_SURFACE || attribs & HAS_SURFACE_FAKE)
{
sprite = Resource::load_sprite(desc);
}
@@ -249,6 +258,13 @@
fw.write_float("para-y", para_y);
}
+ if (attribs & HAS_STARFIELD)
+ {
+ fw.write_int("small-stars", small_stars);
+ fw.write_int("middle-stars", middle_stars);
+ fw.write_int("large-stars", large_stars);
+ }
+
// Writes any extra properties that may be necessary (virtual function)
write_extra_properties(fw);
Modified: trunk/pingus/src/editor/level_objs.hpp
===================================================================
--- trunk/pingus/src/editor/level_objs.hpp 2007-09-20 22:25:26 UTC (rev
3195)
+++ trunk/pingus/src/editor/level_objs.hpp 2007-09-21 13:09:07 UTC (rev
3196)
@@ -50,6 +50,7 @@
const unsigned HAS_SURFACE_FAKE = 1 << 12;
const unsigned CAN_ROTATE = 1 << 13;
const unsigned HAS_GPTYPE = 1 << 14;
+const unsigned HAS_STARFIELD = 1 << 15;
class LevelImpl;
@@ -125,7 +126,11 @@
/** Optional translation origin of the sprite */
Origin origin;
-
+
+ int small_stars;
+ int middle_stars;
+ int large_stars;
+
/** Number representing which attributes this object possesses */
unsigned attribs;
@@ -317,6 +322,14 @@
Rect get_rect() const;
+ int get_small_stars() const { return small_stars; }
+ int get_middle_stars() const { return middle_stars; }
+ int get_large_stars() const { return large_stars; }
+
+ void set_small_stars(int n) { small_stars = n; }
+ void set_middle_stars(int n) { middle_stars = n; }
+ void set_large_stars(int n) { large_stars = n; }
+
private:
LevelObj (const LevelObj&);
LevelObj& operator= (const LevelObj&);
Modified: trunk/pingus/src/editor/object_properties.cpp
===================================================================
--- trunk/pingus/src/editor/object_properties.cpp 2007-09-20 22:25:26 UTC
(rev 3195)
+++ trunk/pingus/src/editor/object_properties.cpp 2007-09-21 13:09:07 UTC
(rev 3196)
@@ -109,7 +109,8 @@
add(pos_z_label = new Label(label_rect, "Z-Pos:"), true);
add(pos_z_inputbox = new Inputbox(box_rect), true);
pos_z_inputbox->on_change.connect(boost::bind(&ObjectProperties::on_pos_z_change,
this, _1));
-
+ // ___________________________________________________________________
+ //
Size color_s(box_rect.get_width()/4, box_rect.get_height());
add(color_label = new Label(label_rect, "Color:"), true);
@@ -122,7 +123,21 @@
color_g_inputbox->on_change.connect(boost::bind(&ObjectProperties::on_color_g_change,
this, _1));
color_b_inputbox->on_change.connect(boost::bind(&ObjectProperties::on_color_b_change,
this, _1));
color_a_inputbox->on_change.connect(boost::bind(&ObjectProperties::on_color_a_change,
this, _1));
-
+ // ___________________________________________________________________
+ //
+ add(small_stars_label = new Label(label_rect, "Small Stars:"), true);
+ add(small_stars_inputbox = new Inputbox(box_rect), true);
+
+ add(middle_stars_label = new Label(label_rect, "Middle Stars:"), true);
+ add(middle_stars_inputbox = new Inputbox(box_rect), true);
+
+ add(large_stars_label = new Label(label_rect, "Large Stars:"), true);
+ add(large_stars_inputbox = new Inputbox(box_rect), true);
+
+
small_stars_inputbox->on_change.connect(boost::bind(&ObjectProperties::on_small_stars_change,
this, _1));
+
middle_stars_inputbox->on_change.connect(boost::bind(&ObjectProperties::on_middle_stars_change,
this, _1));
+
large_stars_inputbox->on_change.connect(boost::bind(&ObjectProperties::on_large_stars_change,
this, _1));
+
set_object(0);
}
@@ -213,6 +228,14 @@
color_g_inputbox->hide();
color_b_inputbox->hide();
color_a_inputbox->hide();
+
+ small_stars_label->hide();
+ middle_stars_label->hide();
+ large_stars_label->hide();
+
+ small_stars_inputbox->hide();
+ middle_stars_inputbox->hide();
+ large_stars_inputbox->hide();
}
void
@@ -311,6 +334,17 @@
place(release_rate_label, release_rate_inputbox);
}
+ if (attr & HAS_STARFIELD)
+ {
+
small_stars_inputbox->set_text(StringUtil::to_string(obj->get_small_stars()));
+
middle_stars_inputbox->set_text(StringUtil::to_string(obj->get_middle_stars()));
+
large_stars_inputbox->set_text(StringUtil::to_string(obj->get_large_stars()));
+
+ place(small_stars_label, small_stars_inputbox);
+ place(middle_stars_label, middle_stars_inputbox);
+ place(large_stars_label, large_stars_inputbox);
+ }
+
if (1) // everybody has z-pos
{
pos_z_inputbox->set_text(StringUtil::to_string(obj->get_pos_z()));
@@ -491,6 +525,32 @@
}
}
+void
+ObjectProperties::on_small_stars_change(const std::string& str)
+{
+ for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
+ {
+ (*i)->set_small_stars(StringUtil::to<int>(str));
+ }
+}
+
+void
+ObjectProperties::on_middle_stars_change(const std::string& str)
+{
+ for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
+ {
+ (*i)->set_middle_stars(StringUtil::to<int>(str));
+ }
+}
+
+void
+ObjectProperties::on_large_stars_change(const std::string& str)
+{
+ for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
+ {
+ (*i)->set_large_stars(StringUtil::to<int>(str));
+ }
+}
} // namespace Editor
Modified: trunk/pingus/src/editor/object_properties.hpp
===================================================================
--- trunk/pingus/src/editor/object_properties.hpp 2007-09-20 22:25:26 UTC
(rev 3195)
+++ trunk/pingus/src/editor/object_properties.hpp 2007-09-21 13:09:07 UTC
(rev 3196)
@@ -79,8 +79,18 @@
Inputbox* color_g_inputbox;
Inputbox* color_b_inputbox;
Inputbox* color_a_inputbox;
+
+ Label* small_stars_label;
+ Inputbox* small_stars_inputbox;
+ Label* middle_stars_label;
+ Inputbox* middle_stars_inputbox;
+
+ Label* large_stars_label;
+ Inputbox* large_stars_inputbox;
+
int y_pos;
+
public:
ObjectProperties(EditorScreen* editor, const Rect& rect);
~ObjectProperties();
@@ -113,6 +123,10 @@
void on_color_g_change(const std::string& str);
void on_color_b_change(const std::string& str);
void on_color_a_change(const std::string& str);
+
+ void on_small_stars_change(const std::string& str);
+ void on_middle_stars_change(const std::string& str);
+ void on_large_stars_change(const std::string& str);
};
Modified: trunk/pingus/src/editor/object_selector.cpp
===================================================================
--- trunk/pingus/src/editor/object_selector.cpp 2007-09-20 22:25:26 UTC (rev
3195)
+++ trunk/pingus/src/editor/object_selector.cpp 2007-09-21 13:09:07 UTC (rev
3196)
@@ -143,12 +143,16 @@
struct SolidColorBackground : public ObjectSelectorList::Object
{
SolidColorBackground()
- : Object(Resource::load_sprite("core/editor/solidcolorbackground_thumb"),
+ : Object(Resource::load_sprite("core/editor/solidcolorbackground"),
Resource::load_thumb_sprite("core/editor/solidcolorbackground_thumb"))
{}
LevelObj* create(const Vector2i& pos, LevelImpl* impl) {
- return 0;
+ LevelObj* obj = new LevelObj("solidcolor-background", impl);
+ obj->set_pos(Vector3f((float)pos.x, (float)pos.y, -1000.0f)); // FIXME:
Hack, z-pos handling is messed up
+ obj->set_color(Color(255, 0, 255));
+ obj->set_res_desc(ResDescriptor("core/editor/solidcolorbackground"));
+ return obj;
}
};
@@ -160,7 +164,13 @@
{}
LevelObj* create(const Vector2i& pos, LevelImpl* impl) {
- return 0;
+ LevelObj* obj = new LevelObj("starfield-background", impl);
+ obj->set_pos(Vector3f((float)pos.x, (float)pos.y, -1000.0f)); // FIXME:
Hack, z-pos handling is messed up
+ obj->set_res_desc(ResDescriptor("core/editor/starfield_thumb"));
+ obj->set_small_stars(500);
+ obj->set_middle_stars(250);
+ obj->set_large_stars(125);
+ return obj;
}
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3196 - in trunk/pingus: data/data src/editor,
grumbel at BerliOS <=