[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3136 - in trunk/pingus/src: editor worldobjs
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3136 - in trunk/pingus/src: editor worldobjs |
Date: |
Wed, 12 Sep 2007 18:35:49 +0200 |
Author: grumbel
Date: 2007-09-12 18:35:43 +0200 (Wed, 12 Sep 2007)
New Revision: 3136
Modified:
trunk/pingus/src/editor/editor_screen.cpp
trunk/pingus/src/editor/editor_viewport.cpp
trunk/pingus/src/editor/object_properties.cpp
trunk/pingus/src/editor/object_properties.hpp
trunk/pingus/src/editor/object_selector.cpp
trunk/pingus/src/editor/panel.cpp
trunk/pingus/src/worldobjs/entrance.cpp
Log:
- some more object properties update properly now
- added yellow background to tooltip
- hiding the ObjectSelector resizes the viewport
Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp 2007-09-12 16:33:06 UTC (rev
3135)
+++ trunk/pingus/src/editor/editor_screen.cpp 2007-09-12 16:35:43 UTC (rev
3136)
@@ -317,9 +317,15 @@
{
// need trigger a relayout
if (object_selector->is_visible())
- object_selector->hide();
+ {
+ object_selector->hide();
+ viewport->set_rect(Rect(0, 38, Display::get_width(),
Display::get_height()));
+ }
else
- object_selector->show();
+ {
+ object_selector->show();
+ viewport->set_rect(Rect(0, 38, Display::get_width() - 244,
Display::get_height()));
+ }
}
void
Modified: trunk/pingus/src/editor/editor_viewport.cpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.cpp 2007-09-12 16:33:06 UTC (rev
3135)
+++ trunk/pingus/src/editor/editor_viewport.cpp 2007-09-12 16:35:43 UTC (rev
3136)
@@ -471,7 +471,8 @@
void
EditorViewport::update_layout()
{
- // FIXME: Insert code here
+ state.set_size(rect.get_width(), rect.get_height());
+ drawing_context->set_rect(rect);
}
} // namespace Editor
Modified: trunk/pingus/src/editor/object_properties.cpp
===================================================================
--- trunk/pingus/src/editor/object_properties.cpp 2007-09-12 16:33:06 UTC
(rev 3135)
+++ trunk/pingus/src/editor/object_properties.cpp 2007-09-12 16:35:43 UTC
(rev 3136)
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <boost/bind.hpp>
+#include "string_util.hpp"
#include "button.hpp"
#include "editor_screen.hpp"
#include "level_objs.hpp"
@@ -39,9 +40,12 @@
add(type_label = new Label(Rect(Vector2i(4, 4), Size(120, 20)), "Object:"),
true);
add(mesg_label = new Label(Rect(Vector2i(40, rect.get_height()/2- 20),
Size(120, 20)), "nothing selected"), true);
+ Rect label_rect(10,0, 80, 20);
+ Rect box_rect(80,0, 190, 20);
+
// Groundpiece Type
- add(gptype_label = new Label(Rect(Vector2i(10, 0), Size(90, 20)),
"GPType:"), true);
- add(gptype_type = new Combobox(Rect(Vector2i(100, 0), Size(90, 20))), true);
+ add(gptype_label = new Label(label_rect, "GPType:"), true);
+ add(gptype_type = new Combobox(box_rect), true);
gptype_type->add(Groundtype::GP_TRANSPARENT, "Transparent");
gptype_type->add(Groundtype::GP_SOLID, "Solid");
@@ -54,38 +58,46 @@
gptype_type->on_select.connect(boost::bind(&ObjectProperties::on_gptype_change,
this, _1));
- add(entrance_direction_label = new Label(Rect(Vector2i(10, 0), Size(90,
20)), "Direction:"), true);
- add(entrance_direction = new Combobox(Rect(Vector2i(100, 0), Size(90, 20))),
true);
- entrance_direction->add(0, "Right");
+ add(entrance_direction_label = new Label(label_rect, "Direction:"), true);
+ add(entrance_direction = new Combobox(box_rect), true);
+ entrance_direction->add(0, "Left");
entrance_direction->add(1, "Misc");
- entrance_direction->add(2, "Left");
+ entrance_direction->add(2, "Right");
entrance_direction->set_selected_item(0);
entrance_direction->on_select.connect(boost::bind(&ObjectProperties::on_entrance_direction_change,
this, _1));
+
+ add(release_rate_label = new Label(label_rect, "ReleaseRate:"), true);
+ add(release_rate_inputbox = new Inputbox(box_rect), true);
// Background Stretch
- add(stretch_x_checkbox = new Checkbox(Rect(Vector2i(10, 0), Size(90, 20)),
"Stretch-X"), true);
- add(stretch_y_checkbox = new Checkbox(Rect(Vector2i(100, 0), Size(90, 20)),
"Stretch-Y"), true);
+ add(stretch_label = new Label(label_rect, "Stretch:"), true);
+ add(stretch_x_checkbox = new Checkbox(Rect(Vector2i(box_rect.left,
box_rect.top),
+ Size(box_rect.get_width()/2,
box_rect.get_height())),
+ "X"), true);
+ add(stretch_y_checkbox = new
Checkbox(Rect(Vector2i(box_rect.left+box_rect.get_width()/2, box_rect.top),
+ Size(box_rect.get_width()/2,
box_rect.get_height())),
+ "Y"), true);
stretch_x_checkbox->on_change.connect(boost::bind(&ObjectProperties::on_stretch_x_change,
this, _1));
stretch_y_checkbox->on_change.connect(boost::bind(&ObjectProperties::on_stretch_y_change,
this, _1));
- add(para_x_label = new Label(Rect(Vector2i(10, 0), Size(90,20)), "Para-X:"),
true);
- add(para_y_label = new Label(Rect(Vector2i(10, 0), Size(90,20)), "Para-Y:"),
true);
+ add(para_x_label = new Label(label_rect, "Para-X:"), true);
+ add(para_y_label = new Label(label_rect, "Para-Y:"), true);
- add(para_x_inputbox = new Inputbox(Rect(Vector2i(100, 0), Size(90,20))),
true);
- add(para_y_inputbox = new Inputbox(Rect(Vector2i(100, 0), Size(90,20))),
true);
+ add(para_x_inputbox = new Inputbox(box_rect), true);
+ add(para_y_inputbox = new Inputbox(box_rect), true);
- add(scroll_x_label = new Label(Rect(Vector2i(10, 0), Size(90,20)),
"Scroll-X:"), true);
- add(scroll_y_label = new Label(Rect(Vector2i(10, 0), Size(90,20)),
"Scroll-Y:"), true);
+ add(scroll_x_label = new Label(label_rect, "Scroll-X:"), true);
+ add(scroll_y_label = new Label(label_rect, "Scroll-Y:"), true);
- add(scroll_x_inputbox = new Inputbox(Rect(Vector2i(100, 0), Size(90,20))),
true);
- add(scroll_y_inputbox = new Inputbox(Rect(Vector2i(100, 0), Size(90,20))),
true);
+ add(scroll_x_inputbox = new Inputbox(box_rect), true);
+ add(scroll_y_inputbox = new Inputbox(box_rect), true);
- add(owner_label = new Label(Rect(Vector2i(10,0), Size(90,20)), "Owner
Id:"), true);
- add(owner_inputbox = new Inputbox(Rect(Vector2i(100,0), Size(90,20))), true);
+ add(owner_label = new Label(label_rect, "Owner Id:"), true);
+ add(owner_inputbox = new Inputbox(box_rect), true);
- hide_all();
+ set_object(0);
}
ObjectProperties::~ObjectProperties()
@@ -93,6 +105,12 @@
}
void
+ObjectProperties::advance()
+{
+ y_pos += 22;
+}
+
+void
ObjectProperties::place(GUI::RectComponent* comp)
{
Rect crect = comp->get_rect();
@@ -101,7 +119,6 @@
crect.right,
y_pos + crect.get_height()));
comp->show();
- y_pos += 22;
}
void
@@ -138,6 +155,10 @@
entrance_direction_label->hide();
entrance_direction->hide();
+ release_rate_label->hide();
+ release_rate_inputbox->hide();
+
+ stretch_label->hide();
stretch_x_checkbox->hide();
stretch_y_checkbox->hide();
@@ -169,12 +190,21 @@
y_pos = 30;
if (attr & HAS_TYPE)
{
+
gptype_type->set_selected_item(Groundtype::string_to_type(obj->get_type()));
place(gptype_label, gptype_type);
- // FIXME: update the content of the box
}
if (attr & HAS_DIRECTION)
{
+ if (obj->get_direction() == "left")
+ entrance_direction->set_selected_item(0);
+ else if (obj->get_direction() == "misc")
+ entrance_direction->set_selected_item(1);
+ else if (obj->get_direction() == "right")
+ entrance_direction->set_selected_item(2);
+ else
+ std::cout << "Error: ObjectProperties::set_object: unknown
direction: " << obj->get_direction() << std::endl;
+
place(entrance_direction_label, entrance_direction);
}
@@ -192,6 +222,7 @@
if (attr & HAS_OWNER)
{
+ owner_inputbox->set_text(StringUtil::to_string(obj->get_owner()));
place(owner_label, owner_inputbox);
}
@@ -201,23 +232,37 @@
if (attr & HAS_SCROLL)
{
+
scroll_x_inputbox->set_text(StringUtil::to_string(obj->get_scroll_x()));
+
scroll_y_inputbox->set_text(StringUtil::to_string(obj->get_scroll_y()));
+
place(scroll_x_label, scroll_x_inputbox);
place(scroll_y_label, scroll_y_inputbox);
}
if (attr & HAS_PARA)
{
+ para_x_inputbox->set_text(StringUtil::to_string(obj->get_para_x()));
+ para_y_inputbox->set_text(StringUtil::to_string(obj->get_para_y()));
+
place(para_x_label, para_x_inputbox);
place(para_y_label, para_y_inputbox);
}
if (attr & HAS_STRETCH)
{
- place(stretch_x_checkbox, stretch_y_checkbox);
+ stretch_x_checkbox->set_checked(obj->get_stretch_y());
+ stretch_y_checkbox->set_checked(obj->get_stretch_y());
+
+ place(stretch_label);
+ place(stretch_x_checkbox);
+ place(stretch_y_checkbox);
+ advance();
}
if (attr & HAS_RELEASE_RATE)
{
+
release_rate_inputbox->set_text(StringUtil::to_string(obj->get_release_rate()));
+ place(release_rate_label, release_rate_inputbox);
}
}
else
@@ -260,8 +305,10 @@
void
ObjectProperties::on_gptype_change(const ComboItem& item)
{
- std::cout << "ObjectProperties::on_gpytpe_change: switch to: "
- << Groundtype::type_to_string((Groundtype::GPType)item.id) <<
std::endl;
+ for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
+ {
+ (*i)->set_type(Groundtype::type_to_string((Groundtype::GPType)item.id));
+ }
}
void
@@ -279,7 +326,15 @@
void
ObjectProperties::on_entrance_direction_change(const ComboItem& item)
{
- std::cout << "ObjectProperties::on_entrance_direction_change: " <<
item.label << std::endl;
+ for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
+ {
+ if (item.id == 0)
+ (*i)->set_direction("left");
+ else if (item.id == 1)
+ (*i)->set_direction("left");
+ else // (item.id == 2)
+ (*i)->set_direction("right");
+ }
}
} // namespace Editor
Modified: trunk/pingus/src/editor/object_properties.hpp
===================================================================
--- trunk/pingus/src/editor/object_properties.hpp 2007-09-12 16:33:06 UTC
(rev 3135)
+++ trunk/pingus/src/editor/object_properties.hpp 2007-09-12 16:35:43 UTC
(rev 3136)
@@ -36,7 +36,9 @@
{
private:
EditorScreen* editor;
- std::vector<LevelObj*> objects;
+ typedef std::vector<LevelObj*> Objects;
+ Objects objects;
+
Label* type_label;
Label* mesg_label;
@@ -47,6 +49,10 @@
Label* entrance_direction_label;
Combobox* entrance_direction;
+ Label* release_rate_label;
+ Inputbox* release_rate_inputbox;
+
+ Label* stretch_label;
Checkbox* stretch_x_checkbox;
Checkbox* stretch_y_checkbox;
@@ -76,6 +82,7 @@
void set_objects(const std::vector<LevelObj*>& objs);
void hide_all();
+ void advance();
void place(GUI::RectComponent* comp);
void place(GUI::RectComponent* comp1, GUI::RectComponent* comp2);
Modified: trunk/pingus/src/editor/object_selector.cpp
===================================================================
--- trunk/pingus/src/editor/object_selector.cpp 2007-09-12 16:33:06 UTC (rev
3135)
+++ trunk/pingus/src/editor/object_selector.cpp 2007-09-12 16:35:43 UTC (rev
3136)
@@ -71,6 +71,7 @@
LevelObj* obj = new LevelObj("entrance", impl);
obj->set_type("generic");
obj->set_pos(Vector3f(pos.x, pos.y));
+ obj->set_direction("misc");
obj->set_release_rate(150);
obj->set_owner(0);
return obj;
Modified: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp 2007-09-12 16:33:06 UTC (rev 3135)
+++ trunk/pingus/src/editor/panel.cpp 2007-09-12 16:35:43 UTC (rev 3136)
@@ -99,7 +99,12 @@
if (mouse_over)
{
- gc.print_center(Fonts::verdana11, pos.x + 17.f, pos.y + 38.f, tooltip,
1000.0f);
+ int t_w = Fonts::verdana11.get_width(tooltip);
+ Rect t_r(pos.x + 17 - t_w/2 - 4, pos.y + 38 - 2,
+ pos.x + 17 + t_w/2 + 4, pos.y + 38 +
Fonts::verdana11.get_height() + 2);
+ gc.draw_fillrect(t_r, Color(255, 255, 200), 1000.0f);
+ gc.draw_rect(t_r, Color(0,0,0), 1000.0f);
+ gc.print_center(Fonts::verdana11, pos.x + 17.0f, pos.y + 38.0f,
tooltip, 1000.0f);
}
}
@@ -150,7 +155,7 @@
{
editor->get_gui_manager()->add(this, true);
- add_button("core/editor/document-new", "New level",
+ add_button("core/editor/document-new", " New level",
&EditorScreen::level_new);
add_button("core/editor/document-open", "Open level...",
&EditorScreen::level_load);
Modified: trunk/pingus/src/worldobjs/entrance.cpp
===================================================================
--- trunk/pingus/src/worldobjs/entrance.cpp 2007-09-12 16:33:06 UTC (rev
3135)
+++ trunk/pingus/src/worldobjs/entrance.cpp 2007-09-12 16:35:43 UTC (rev
3136)
@@ -38,8 +38,8 @@
reader.read_vector("position", pos);
reader.read_int ("release-rate", release_rate);
- // Set default owner ID to 0
- if (owner_id < 0 || owner_id > 3) owner_id = 0;
+ // Set default owner ID to 0
+ if (owner_id < 0 || owner_id > 3) owner_id = 0;
std::string direction_str;
reader.read_string("direction", direction_str);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3136 - in trunk/pingus/src: editor worldobjs,
grumbel at BerliOS <=