[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.9,1.10 edit
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.9,1.10 editor_event.hxx,1.3,1.4 editor_groundpiece_obj.cxx,1.3,1.4 editor_groundpiece_obj.hxx,1.3,1.4 editorobj.hxx,1.3,1.4 |
Date: |
25 Jun 2002 21:31:42 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv6646/editor
Modified Files:
editor_event.cxx editor_event.hxx editor_groundpiece_obj.cxx
editor_groundpiece_obj.hxx editorobj.hxx
Log Message:
- implemented horz/vert flipping of groundpieces
- implemented rotating of groundpieces (90 degree)
- saving of modified groundpieces is *not* implemented
- horz/vert/rot is buggy and incorrect
- it compiles and runs
- I am tired, rest will follow tomorrow... good night
Index: editor_event.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor_event.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- editor_event.cxx 25 Jun 2002 14:54:01 -0000 1.9
+++ editor_event.cxx 25 Jun 2002 21:31:40 -0000 1.10
@@ -86,6 +86,25 @@
{
switch (key.id)
{
+ case CL_KEY_R:
+ if (CL_Keyboard::get_keycode(CL_KEY_RSHIFT)
+ || CL_Keyboard::get_keycode(CL_KEY_LSHIFT))
+ { // rotate 90 counterclockwise
+ editor_rotate_270_current_selection ();
+ }
+ else
+ { // rotate 90 clockwise
+ editor_rotate_90_current_selection ();
+ }
+
+ case CL_KEY_H: // horizontal flip
+ editor_horizontal_flip_current_selection ();
+ break;
+
+ case CL_KEY_V: // vertical flip
+ editor_vertical_flip_current_selection ();
+ break;
+
case CL_KEY_I: // import meta-object
editor_import_object_group ();
break;
@@ -756,6 +775,50 @@
EditorEvent::editor_import_object_group ()
{
editor->object_manager->add_object_group_from_file ("/tmp/metaobj.xml");
+}
+
+void
+EditorEvent::editor_horizontal_flip_current_selection()
+{
+ for (ObjectManager::CurrentObjIter i = object_manager->current_objs.begin();
+ i != object_manager->current_objs.end();
+ i++)
+ {
+ (*i)->horizontal_flip ();
+ }
+}
+
+void
+EditorEvent::editor_vertical_flip_current_selection()
+{
+ for (ObjectManager::CurrentObjIter i = object_manager->current_objs.begin();
+ i != object_manager->current_objs.end();
+ i++)
+ {
+ (*i)->vertical_flip ();
+ }
+}
+
+void
+EditorEvent::editor_rotate_90_current_selection()
+{
+ for (ObjectManager::CurrentObjIter i = object_manager->current_objs.begin();
+ i != object_manager->current_objs.end();
+ i++)
+ {
+ (*i)->rotate_90 ();
+ }
+}
+
+void
+EditorEvent::editor_rotate_270_current_selection()
+{
+ for (ObjectManager::CurrentObjIter i = object_manager->current_objs.begin();
+ i != object_manager->current_objs.end();
+ i++)
+ {
+ (*i)->rotate_270 ();
+ }
}
/* EOF */
Index: editor_event.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor_event.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- editor_event.hxx 24 Jun 2002 22:52:58 -0000 1.3
+++ editor_event.hxx 25 Jun 2002 21:31:40 -0000 1.4
@@ -56,6 +56,13 @@
void editor_move_object();
void editor_toggle_background_color();
void editor_duplicate_current_selection();
+
+ // Groundpiece modifier
+ void editor_horizontal_flip_current_selection();
+ void editor_vertical_flip_current_selection();
+ void editor_rotate_90_current_selection();
+ void editor_rotate_270_current_selection();
+
void editor_delete_selected_objects();
void editor_start_current_level();
void editor_save_level_as();
Index: editor_groundpiece_obj.cxx
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/editor/editor_groundpiece_obj.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- editor_groundpiece_obj.cxx 20 Jun 2002 11:12:12 -0000 1.3
+++ editor_groundpiece_obj.cxx 25 Jun 2002 21:31:40 -0000 1.4
@@ -19,11 +19,14 @@
#include <stdio.h>
#include "../boost/smart_ptr.hpp"
+#include "../pingus_resource.hxx"
#include "editor_groundpiece_obj.hxx"
+using namespace Pingus;
+
EditorGroundpieceObj::EditorGroundpieceObj(const GroundpieceData& data)
: GroundpieceData (data),
- SpriteEditorObj (desc.res_name, desc.datafile, pos)
+ SpriteEditorObj (desc, pos)
{
}
@@ -45,6 +48,38 @@
desc.res_name.c_str(), type_name.c_str());
return std::string(str);
+}
+
+void
+EditorGroundpieceObj::vertical_flip ()
+{
+ std::cout << "Vertical flip" << std::endl;
+ desc.modifier = Pingus::vertical_flip(desc.modifier);
+ sprite.get_surface () = PingusResource::load_surface (desc);
+}
+
+void
+EditorGroundpieceObj::horizontal_flip ()
+{
+ std::cout << "Horz flip" << std::endl;
+ desc.modifier = Pingus::horizontal_flip(desc.modifier);
+ sprite.get_surface () = PingusResource::load_surface (desc);
+}
+
+void
+EditorGroundpieceObj::rotate_90 ()
+{
+ std::cout << "rot90" << std::endl;
+ desc.modifier = Pingus::rotate_90(desc.modifier);
+ sprite.get_surface () = PingusResource::load_surface (desc);
+}
+
+void
+EditorGroundpieceObj::rotate_270 ()
+{
+ std::cout << "rot 270" << std::endl;
+ desc.modifier = Pingus::rotate_270(desc.modifier);
+ sprite.get_surface () = PingusResource::load_surface (desc);
}
/* EOF */
Index: editor_groundpiece_obj.hxx
===================================================================
RCS file:
/usr/local/cvsroot/Games/Pingus/src/editor/editor_groundpiece_obj.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- editor_groundpiece_obj.hxx 25 Jun 2002 12:20:33 -0000 1.3
+++ editor_groundpiece_obj.hxx 25 Jun 2002 21:31:40 -0000 1.4
@@ -30,6 +30,18 @@
public:
EditorGroundpieceObj(const GroundpieceData& data);
+ /** Flip the object vertical */
+ void vertical_flip ();
+
+ /** Flip the object horizontal */
+ void horizontal_flip ();
+
+ /** Rotate the object 90 degrees */
+ void rotate_90 ();
+
+ /** Rotate the object -90 degrees */
+ void rotate_270 ();
+
void write_xml(std::ostream& xml) { GroundpieceData::write_xml (xml); }
boost::shared_ptr<EditorObj> duplicate();
std::string status_line();
Index: editorobj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editorobj.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- editorobj.hxx 25 Jun 2002 12:20:33 -0000 1.3
+++ editorobj.hxx 25 Jun 2002 21:31:40 -0000 1.4
@@ -80,6 +80,18 @@
happens is object dependend. Default is to do nothing */
virtual void make_smaller () {}
+ /** Flip the object vertical */
+ virtual void vertical_flip () {}
+
+ /** Flip the object horizontal */
+ virtual void horizontal_flip () {}
+
+ /** Rotate the object 90 degrees */
+ virtual void rotate_90 () {}
+
+ /** Rotate the object -90 degrees */
+ virtual void rotate_270 () {}
+
/** This function is called once at the start of an interactive move */
virtual void drag () {}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.9,1.10 editor_event.hxx,1.3,1.4 editor_groundpiece_obj.cxx,1.3,1.4 editor_groundpiece_obj.hxx,1.3,1.4 editorobj.hxx,1.3,1.4,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src col_map.cxx,1.4,1.5 col_map.hxx,1.3,1.4 groundpiece_data.hxx,1.6,1.7 pingu.cxx,1.11,1.12 pingu.hxx,1.4,1.5 pingu_action.cxx,1.3,1.4 smallmap.cxx,1.4,1.5 smallmap_image.cxx,1.2,1.3 spot_map.cxx,1.4,1.5
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.79,1.80 blitter.cxx,1.9,1.10 blitter.hxx,1.4,1.5 pingus_resource.cxx,1.9,1.10 pingus_resource.hxx,1.4,1.5 res_descriptor.cxx,1.2,1.3 res_descriptor.hxx,1.4,1.5 sprite.cxx,1.3,1.4 sprite.hxx,1.2,1.3
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src col_map.cxx,1.4,1.5 col_map.hxx,1.3,1.4 groundpiece_data.hxx,1.6,1.7 pingu.cxx,1.11,1.12 pingu.hxx,1.4,1.5 pingu_action.cxx,1.3,1.4 smallmap.cxx,1.4,1.5 smallmap_image.cxx,1.2,1.3 spot_map.cxx,1.4,1.5
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.79,1.80 blitter.cxx,1.9,1.10 blitter.hxx,1.4,1.5 pingus_resource.cxx,1.9,1.10 pingus_resource.hxx,1.4,1.5 res_descriptor.cxx,1.2,1.3 res_descriptor.hxx,1.4,1.5 sprite.cxx,1.3,1.4 sprite.hxx,1.2,1.3
- Index(es):