[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/editor Makefile.am,1.23,1.24 editor.c
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/editor Makefile.am,1.23,1.24 editor.cxx,1.14,1.15 editor_event.cxx,1.17,1.18 level_property_window.cxx,1.2,1.3 level_property_window.hxx,1.2,1.3 object_manager.cxx,1.13,1.14 property_window.cxx,1.5,1.6 property_window.hxx,1.2,1.3 selection.cxx,1.1,1.2 selection.hxx,1.1,1.2 status_line.hxx,1.3,1.4 |
Date: |
1 Jul 2002 16:31:42 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv16848/editor
Modified Files:
Makefile.am editor.cxx editor_event.cxx
level_property_window.cxx level_property_window.hxx
object_manager.cxx property_window.cxx property_window.hxx
selection.cxx selection.hxx status_line.hxx
Log Message:
level editor is compilable again
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/Makefile.am,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- Makefile.am 1 Jul 2002 16:09:41 -0000 1.23
+++ Makefile.am 1 Jul 2002 16:31:40 -0000 1.24
@@ -40,7 +40,7 @@
rect_editorobj.cxx rect_editorobj.hxx \
scroll_map.cxx scroll_map.hxx \
selection.cxx selection.hxx \
- sprite_editorobj.cxx sprite_editorobj.hxx
+ sprite_editorobj.cxx sprite_editorobj.hxx \
start_pos.cxx start_pos.hxx \
status_line.cxx status_line.hxx \
string_reader.cxx string_reader.hxx \
Index: editor.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- editor.cxx 1 Jul 2002 16:10:29 -0000 1.14
+++ editor.cxx 1 Jul 2002 16:31:40 -0000 1.15
@@ -92,7 +92,7 @@
font = PingusResource::load_font("Fonts/courier_small", "fonts");
panel->init();
- status_line->set_current_objs(&selection->get_current_objs());
+ status_line->set_current_objs(&selection->get_objects());
panel->set_editor(this);
scroll_map->editor_event = event;
}
@@ -160,7 +160,7 @@
register_event_handler();
- std::list<boost::shared_ptr<EditorObj> > tmp_selection;
+ std::list<EditorObj*> tmp_selection;
while (!quit)
{
@@ -177,21 +177,21 @@
Display::flip_display(true);
// FIXME: This should be moved to the object manager
- if (tmp_selection != object_manager->current_objs)
+ if (tmp_selection != selection->get_objects ())
{
std::cout << "Selection changed" << std::endl;
- tmp_selection = object_manager->current_objs;
+ tmp_selection = selection->get_objects ();
// FIXME: dirty hack
- if (object_manager->current_objs.size() == 1)
+ if (selection->size() == 1)
{
- boost::shared_ptr<EditorObj> obj =
*object_manager->current_objs.begin ();
+ EditorObj* obj = selection->get_current_obj ();
property_window->update_frame (obj);
//CL_Component* comp = obj->get_gui_dialog
(editor->property_window);
}
else
{
- property_window->update_frame (boost::shared_ptr<EditorObj>());
+ property_window->update_frame (0);
std::cout << "EditorEvent::editor_show_object_properties ():
error: multiple objects selected" << std::endl;
}
}
@@ -209,6 +209,7 @@
CL_Display::clear_display();
object_manager->draw(view);
+ selection->draw (view);
panel->draw();
/* {
@@ -434,6 +435,8 @@
// Draw the screen
CL_Display::clear_display();
object_manager->draw(view);
+ selection->draw (view);
+
Display::draw_rect((int) start_pos.x, (int)start_pos.y, (int)end_pos.x,
(int)end_pos.y,
0.0f, 1.0f, 0.0f, 1.0f);
panel->draw();
@@ -444,7 +447,7 @@
start_pos = view->screen_to_world (start_pos);
end_pos = view->screen_to_world (end_pos);
- object_manager->rect_get_current_objs(start_pos.x, start_pos.y, end_pos.x,
end_pos.y);
+ selection->select_rect(start_pos.x, start_pos.y, end_pos.x, end_pos.y);
//std::cout << "finished" << std::endl;
}
@@ -485,7 +488,7 @@
else if (CL_Keyboard::get_keycode(CL_KEY_DOWN))
move_y = move_speed;
- object_manager->move_current_objs(move_x, move_y);
+ selection->move(move_x, move_y);
}
void
@@ -493,20 +496,19 @@
{
CL_System::keep_alive();
- object_manager->drag_current_objs ();
+ selection->drag ();
CL_Vector old_pos (view->screen_to_world(CL_Vector(CL_Mouse::get_x(),
CL_Mouse::get_y())));
while (CL_Mouse::left_pressed())
{
CL_Vector new_pos (view->screen_to_world(CL_Vector(CL_Mouse::get_x(),
CL_Mouse::get_y())));
- object_manager->move_current_objs(new_pos.x - old_pos.x,
- new_pos.y - old_pos.y);
+ selection->move(new_pos.x - old_pos.x, new_pos.y - old_pos.y);
old_pos = new_pos;
draw();
Display::flip_display (true);
CL_System::keep_alive();
}
- object_manager->drop_current_objs ();
+ selection->drop ();
}
void
@@ -536,6 +538,7 @@
// filename could be relative, insert a relative->absolute converter
// and we might save it.
+ selection->clear ();
object_manager->load_level(str);
last_level = str;
}
Index: editor_event.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor_event.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- editor_event.cxx 1 Jul 2002 16:10:29 -0000 1.17
+++ editor_event.cxx 1 Jul 2002 16:31:40 -0000 1.18
@@ -164,6 +164,7 @@
if (!editor->checkpoint.empty())
{
if (verbose) std::cout << "Restoring checkpoint: " <<
editor->checkpoint << std::endl;
+ selection->clear ();
object_manager->load_level(editor->checkpoint);
}
else
@@ -420,7 +421,7 @@
void
EditorEvent::editor_convert_selection_to_group()
{
- if (selection->get_current_objs().size() > 1)
+ if (selection->size() > 1)
{
EditorObjGroup* group = new EditorObjGroup();
boost::shared_ptr<EditorObj> group_obj(group);
@@ -431,8 +432,8 @@
j != object_manager->editor_objs.end();
j++)
{
- for (list<EditorObj*>::const_iterator i =
selection->get_current_objs().begin();
- i != selection->get_current_objs().end();
+ for (list<EditorObj*>::const_iterator i =
selection->get_objects().begin();
+ i != selection->get_objects().end();
i++)
{
if ((*j).get() == *i)
@@ -496,8 +497,8 @@
{
editor->save_tmp_level ();
- for (std::list<EditorObj*>::const_iterator i =
selection->get_current_objs().begin();
- i != selection->get_current_objs().end();
+ for (std::list<EditorObj*>::const_iterator i =
selection->get_objects().begin();
+ i != selection->get_objects().end();
i++)
{
object_manager->editor_objs.erase(std::find(object_manager->editor_objs.begin(),
object_manager->editor_objs.end(),
@@ -566,6 +567,7 @@
if (!str.empty())
{
try {
+ selection->clear ();
object_manager->load_level(str);
editor->last_level = str;
}
@@ -621,8 +623,8 @@
{
std::list<EditorObj*> new_objs;
- for (std::list<EditorObj*>::const_iterator i =
selection->get_current_objs().begin();
- i != selection->get_current_objs().end();
+ for (std::list<EditorObj*>::const_iterator i =
selection->get_objects().begin();
+ i != selection->get_objects().end();
i++)
{
ObjectManager::EditorObjIter iter =
std::find(object_manager->editor_objs.begin(),
@@ -763,8 +765,8 @@
std::cout << "EditorEvent:editor_export_object_group_from_selection ()" <<
std::endl;
std::list<boost::shared_ptr<EditorObj> > temp;
- for (std::list<EditorObj*>::const_iterator it =
selection->get_current_objs().begin();
- it !=
selection->get_current_objs().end(); it++)
+ for (std::list<EditorObj*>::const_iterator it =
selection->get_objects().begin();
+ it != selection->get_objects().end(); ++it)
temp.push_back(boost::shared_ptr<EditorObj>(*it));
EditorObjGroup group (temp);
Index: level_property_window.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/level_property_window.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- level_property_window.cxx 1 Jul 2002 12:46:22 -0000 1.2
+++ level_property_window.cxx 1 Jul 2002 16:31:40 -0000 1.3
@@ -63,7 +63,19 @@
pingus_to_save_input (CL_Rect(110, 90, 190, 110), to_string (10),
get_client_area ()),
time_label (CL_Rect (10, 110, 90, 130), "Time", get_client_area ()),
- time_input (CL_Rect(110, 110, 190, 130), to_string (-1), get_client_area
())
+ time_input (CL_Rect(110, 110, 190, 130), to_string (-1), get_client_area
()),
+
+ width_label (CL_Rect (10, 130, 90, 150), "Width", get_client_area ()),
+ width_input (CL_Rect(110, 130, 190, 150), to_string(manager->get_width
()), get_client_area ()),
+
+ height_label (CL_Rect (10, 150, 90, 170), "Height", get_client_area ()),
+ height_input (CL_Rect(110, 150, 190, 170), to_string(manager->get_height
()), get_client_area ()),
+
+ difficulty_label (CL_Rect (10, 170, 90, 190), "Difficulty",
get_client_area ()),
+ difficulty_input (CL_Rect(110, 170, 190, 190), to_string (50),
get_client_area ()),
+
+ comment_label (CL_Rect(10, 190, 90, 210), "Comment", get_client_area ()),
+ playable_checkbox (CL_Point(10, 210), "Playable", get_client_area ())
{
show (false);
}
Index: level_property_window.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/level_property_window.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- level_property_window.hxx 1 Jul 2002 12:46:22 -0000 1.2
+++ level_property_window.hxx 1 Jul 2002 16:31:40 -0000 1.3
@@ -48,6 +48,19 @@
CL_Label time_label;
CL_InputBox time_input;
+
+ CL_Label width_label;
+ CL_InputBox width_input;
+
+ CL_Label height_label;
+ CL_InputBox height_input;
+
+ CL_Label difficulty_label;
+ CL_InputBox difficulty_input;
+
+ CL_Label comment_label;
+ CL_CheckBox playable_checkbox;
+
public:
LevelPropertyWindow (CL_Component* parent, ObjectManager*);
~LevelPropertyWindow ();
Index: object_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_manager.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- object_manager.cxx 1 Jul 2002 16:10:29 -0000 1.13
+++ object_manager.cxx 1 Jul 2002 16:31:40 -0000 1.14
@@ -123,7 +123,6 @@
{
std::cout << "ObjectManager::Loading level: " << filename << endl;
- delete_selection();
delete_all_objs();
difficulty = 40;
@@ -231,11 +230,7 @@
(*i)->draw (view);
}
- for (CurrentObjIter i = current_objs.begin(); i != current_objs.end(); ++i)
- {
- (*i)->draw_mark(view);
- }
-
+ // The level window
view->draw_rect(0, 0, width, height,
bg.red, bg.green, bg.blue, 1.0);
}
@@ -437,7 +432,7 @@
for (EditorObjIter it = editor_objs.begin(); it != editor_objs.end(); it++)
if ((*it)->is_in_rect(CL_Rect(x1, y1, x2, y2)))
- retval.push_back(*it.get());
+ retval.push_back(it->get ());
return retval;
}
Index: property_window.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/property_window.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- property_window.cxx 1 Jul 2002 12:46:22 -0000 1.5
+++ property_window.cxx 1 Jul 2002 16:31:40 -0000 1.6
@@ -34,7 +34,7 @@
}
void
-PropertyWindow::update_frame (boost::shared_ptr<EditorObj> obj)
+PropertyWindow::update_frame (EditorObj* obj)
{
if (current_frame)
{
@@ -43,7 +43,7 @@
current_frame = 0;
}
- if (obj.get ())
+ if (obj)
{
// We are responsible to delete comp
Pingus::Editor::PropertyFrame* comp = obj->get_gui_dialog
(get_client_area ());
Index: property_window.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/property_window.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- property_window.hxx 30 Jun 2002 22:32:26 -0000 1.2
+++ property_window.hxx 1 Jul 2002 16:31:40 -0000 1.3
@@ -37,7 +37,7 @@
public:
PropertyWindow (CL_Component* parent);
- void update_frame (boost::shared_ptr<EditorObj>);
+ void update_frame (EditorObj*);
};
}
}
Index: selection.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/selection.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- selection.cxx 1 Jul 2002 16:10:29 -0000 1.1
+++ selection.cxx 1 Jul 2002 16:31:40 -0000 1.2
@@ -76,8 +76,9 @@
object_manager->lower_obj(boost::shared_ptr<EditorObj>(*it));
}
-void EditorSelection::select_rect(float x1_, float y1_, float x2_, float y2_) {
-
+void
+EditorSelection::select_rect(float x1_, float y1_, float x2_, float y2_)
+{
int x1, x2, y1, y2;
if (!CL_Keyboard::get_keycode(CL_KEY_LSHIFT)
@@ -94,40 +95,56 @@
obj_list.insert(obj_list.end(), erg.begin(), erg.end());
}
-bool EditorSelection::object_selected(EditorObj* obj) {
-
+bool
+EditorSelection::object_selected(EditorObj* obj)
+{
return std::find(obj_list.begin(), obj_list.end(), obj) != obj_list.end();
}
-EditorObj* EditorSelection::get_current_obj() {
-
+EditorObj*
+EditorSelection::get_current_obj()
+{
if (obj_list.size() == 1)
return *obj_list.begin();
else
return 0;
}
-void EditorSelection::horizontal_flip() {
+void
+EditorSelection::horizontal_flip()
+{
for (list<EditorObj*>::iterator it = obj_list.begin(); it != obj_list.end();
it++)
(*it)->horizontal_flip();
}
-void EditorSelection::vertical_flip() {
-
+void
+EditorSelection::vertical_flip()
+{
for (list<EditorObj*>::iterator it = obj_list.begin(); it != obj_list.end();
it++)
(*it)->vertical_flip();
}
-void EditorSelection::rotate_90() {
-
+void
+EditorSelection::rotate_90()
+{
for (list<EditorObj*>::iterator it = obj_list.begin(); it != obj_list.end();
it++)
(*it)->rotate_90();
}
-void EditorSelection::rotate_270() {
-
+void
+EditorSelection::rotate_270()
+{
for (list<EditorObj*>::iterator it = obj_list.begin(); it != obj_list.end();
it++)
(*it)->rotate_270();
+}
+
+void
+EditorSelection::draw(EditorView * view)
+{
+ for (list<EditorObj*>::iterator i = obj_list.begin(); i != obj_list.end();
++i)
+ {
+ (*i)->draw_mark(view);
+ }
}
/* EOF */
Index: selection.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/selection.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- selection.hxx 1 Jul 2002 16:10:29 -0000 1.1
+++ selection.hxx 1 Jul 2002 16:31:40 -0000 1.2
@@ -25,46 +25,50 @@
#include "object_manager.hxx"
class CL_Vector;
+class EditorView;
class EditorSelection
{
- private:
+private:
- std::list<EditorObj*> obj_list;
- ObjectManager* object_manager;
+ std::list<EditorObj*> obj_list;
+ ObjectManager* object_manager;
- public:
+public:
- EditorSelection(ObjectManager* mng) : object_manager(mng) { }
- ~EditorSelection() { }
-
- void clear() { obj_list.clear(); }
+ EditorSelection(ObjectManager* mng) : object_manager(mng) { }
+ ~EditorSelection() { }
- void move(float x, float y);
- void move(const CL_Vector& pos);
- void drag();
- void drop();
+ void clear() { obj_list.clear(); }
- void add(EditorObj* obj);
- void add(list<EditorObj*> objs);
+ void move(float x, float y);
+ void move(const CL_Vector& pos);
+ void drag();
+ void drop();
- void remove(EditorObj* obj);
+ void add(EditorObj* obj);
+ void add(list<EditorObj*> objs);
- void raise();
- void lower();
+ void remove(EditorObj* obj);
- void select_rect(float x1_, float y1_, float x2_, float y2_);
+ void raise();
+ void lower();
- bool object_selected(EditorObj* obj);
+ void select_rect(float x1_, float y1_, float x2_, float y2_);
- EditorObj* get_current_obj();
- const list<EditorObj*> & get_current_objs() { return obj_list; }
+ bool object_selected(EditorObj* obj);
- void horizontal_flip();
- void vertical_flip();
- void rotate_90();
- void rotate_270();
+ EditorObj* get_current_obj();
+ const list<EditorObj*> & get_objects() { return obj_list; }
+
+ int size () { return obj_list.size (); }
+ void horizontal_flip();
+ void vertical_flip();
+ void rotate_90();
+ void rotate_270();
+
+ void draw(EditorView* view);
};
#endif
Index: status_line.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/status_line.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- status_line.hxx 1 Jul 2002 16:10:29 -0000 1.3
+++ status_line.hxx 1 Jul 2002 16:31:40 -0000 1.4
@@ -30,19 +30,13 @@
class StatusLine
{
private:
- ///
CL_Font* font;
- ///
- std::list<EditorObj*>* current_objs;
+ const std::list<EditorObj*>* current_objs;
public:
- ///
StatusLine();
- ///
~StatusLine();
- ///
void set_current_objs(const std::list<EditorObj*>* c_objs);
- ///
void draw(EditorView * view);
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/editor Makefile.am,1.23,1.24 editor.cxx,1.14,1.15 editor_event.cxx,1.17,1.18 level_property_window.cxx,1.2,1.3 level_property_window.hxx,1.2,1.3 object_manager.cxx,1.13,1.14 property_window.cxx,1.5,1.6 property_window.hxx,1.2,1.3 selection.cxx,1.1,1.2 selection.hxx,1.1,1.2 status_line.hxx,1.3,1.4,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor selection.cxx,NONE,1.1 selection.hxx,NONE,1.1 editor.cxx,1.13,1.14 editor.hxx,1.6,1.7 editor_event.cxx,1.16,1.17 editor_event.hxx,1.9,1.10 object_manager.cxx,1.12,1.13 object_manager.hxx,1.6,1.7 status_line.cxx,1.3,1.4 status_line.hxx,1.2,1.3
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor editorobj.hxx,1.7,1.8 object_manager.cxx,1.14,1.15 object_manager.hxx,1.7,1.8 plfobj.hxx,1.4,1.5 selection.cxx,1.2,1.3 selection.hxx,1.2,1.3
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor selection.cxx,NONE,1.1 selection.hxx,NONE,1.1 editor.cxx,1.13,1.14 editor.hxx,1.6,1.7 editor_event.cxx,1.16,1.17 editor_event.hxx,1.9,1.10 object_manager.cxx,1.12,1.13 object_manager.hxx,1.6,1.7 status_line.cxx,1.3,1.4 status_line.hxx,1.2,1.3
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor editorobj.hxx,1.7,1.8 object_manager.cxx,1.14,1.15 object_manager.hxx,1.7,1.8 plfobj.hxx,1.4,1.5 selection.cxx,1.2,1.3 selection.hxx,1.2,1.3
- Index(es):