[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx, 1.53, 1.54 editor_
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx, 1.53, 1.54 editor_event.cxx, 1.61, 1.62 editor_event.hxx, 1.18, 1.19 editor_view.cxx, 1.9, 1.10 editor_view.hxx, 1.8, 1.9 panel_icons.cxx, 1.11, 1.12 |
Date: |
22 Aug 2003 10:19:50 -0000 |
Update of /var/lib/cvs/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv15522
Modified Files:
editor.cxx editor_event.cxx editor_event.hxx editor_view.cxx
editor_view.hxx panel_icons.cxx
Log Message:
- added some scroll wheel support, bit ugly but better than nothing
Index: editor.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor.cxx,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- editor.cxx 19 Aug 2003 19:56:55 -0000 1.53
+++ editor.cxx 22 Aug 2003 10:19:48 -0000 1.54
@@ -113,7 +113,7 @@
scroll_map->editor_event = event;
//std::cout << "Editor: registering event handler" << event << "... " <<
std::flush;
- on_button_press_slot = CL_Input::sig_button_press ().connect(event,
&EditorEvent::on_button_press);
+ on_button_press_slot = CL_Input::sig_button_press ().connect(event,
&EditorEvent::on_button_press);
on_button_release_slot = CL_Input::sig_button_release ().connect(event,
&EditorEvent::on_button_release);
}
Index: editor_event.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_event.cxx,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- editor_event.cxx 19 Aug 2003 19:56:55 -0000 1.61
+++ editor_event.cxx 22 Aug 2003 10:19:48 -0000 1.62
@@ -161,26 +161,26 @@
// Set a checkpoint.
case CL_KEY_F7:
/*
- editor->save_tmp_level();
- editor->checkpoint = std::string(tmpnam(0)) + ".pingus";
- if (verbose) std::cout << "Setting checkpoint: " <<
editor->checkpoint << std::endl;
- object_manager->save_level(editor->checkpoint);*/
+ editor->save_tmp_level();
+ editor->checkpoint = std::string(tmpnam(0)) + ".pingus";
+ if (verbose) std::cout << "Setting checkpoint: " <<
editor->checkpoint << std::endl;
+ object_manager->save_level(editor->checkpoint);*/
break;
// Restore a previously created checkpoint.
case CL_KEY_F8:
/*
- editor->save_tmp_level();
- if (!editor->checkpoint.empty())
+ editor->save_tmp_level();
+ if (!editor->checkpoint.empty())
{
- if (verbose) std::cout << "Restoring checkpoint: " <<
editor->checkpoint << std::endl;
- selection->clear ();
- object_manager->load_level(editor->checkpoint);
+ if (verbose) std::cout << "Restoring checkpoint: " <<
editor->checkpoint << std::endl;
+ selection->clear ();
+ object_manager->load_level(editor->checkpoint);
}
- else
+ else
{
- if (verbose) std::cout << "No checkpoint set, no restoring done.
" << std::endl;
- }*/
+ if (verbose) std::cout << "No checkpoint set, no restoring done. "
<< std::endl;
+ }*/
break;
// Insert a new object, present the ObjectsSelector to select
@@ -206,10 +206,10 @@
break;
/* case CL_KEY_F11:
- CL_Display::set_videomode(screen_width, screen_height, 16,
- fullscreen_enabled,
- true); // allow resize
- break;
+ CL_Display::set_videomode(screen_width, screen_height, 16,
+ fullscreen_enabled,
+ true); // allow resize
+ break;
*/
case CL_KEY_F12:
// FIXME: disable cause it gives a segfault
@@ -307,11 +307,11 @@
break;
case CL_KEY_Z: // FIXME: stupid key binding
- editor_zoom_in ();
+ editor_zoom_in(CL_Mouse::get_x(), CL_Mouse::get_y());
break;
case CL_KEY_W: // FIXME: stupid key binding
- editor_zoom_out ();
+ editor_zoom_out(CL_Mouse::get_x(), CL_Mouse::get_y());
break;
case CL_KEY_ENTER:
@@ -329,9 +329,12 @@
}
else if (device == CL_Input::pointers[0])
{
- /*std::cout << "Mouse: (" << CL_Mouse::get_x () << ", " <<
CL_Mouse::get_y () << ") "
- << "World: " << editor->view->screen_to_world
(Vector(CL_Mouse::get_x (), CL_Mouse::get_y ()))
- << std::endl;*/
+ if (0)
+ {
+ std::cout << "Mouse: (" << CL_Mouse::get_x () << ", " <<
CL_Mouse::get_y () << ") "
+ << "World: " << editor->view->screen_to_world
(Vector(CL_Mouse::get_x (), CL_Mouse::get_y ()))
+ << std::endl;
+ }
switch (key.id)
{
@@ -343,9 +346,21 @@
else
editor_mark_or_move_object();
break;
+
case CL_MOUSE_MIDDLEBUTTON:
editor->rect_get_current_objs();
break;
+
+ case CL_MOUSE_WHEELDOWN:
+ editor_zoom_out(static_cast<int>(key.x),
+ static_cast<int>(key.y));
+ break;
+
+ case CL_MOUSE_WHEELUP:
+ editor_zoom_in(static_cast<int>(key.x),
+ static_cast<int>(key.y));
+ break;
+
case CL_MOUSE_RIGHTBUTTON:
editor->scroll();
break;
@@ -739,15 +754,15 @@
}
void
-EditorEvent::editor_zoom_in ()
+EditorEvent::editor_zoom_in(int x, int y)
{
- editor->view->set_zoom(editor->view->get_zoom () * 1.4f);
+ editor->view->zoom_in(x, y);
}
void
-EditorEvent::editor_zoom_out ()
+EditorEvent::editor_zoom_out(int x, int y)
{
- editor->view->set_zoom(editor->view->get_zoom () / 1.4f);
+ editor->view->zoom_out(x, y);
}
void
Index: editor_event.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_event.hxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- editor_event.hxx 19 Apr 2003 10:23:18 -0000 1.18
+++ editor_event.hxx 22 Aug 2003 10:19:48 -0000 1.19
@@ -102,8 +102,12 @@
current object */
void editor_decrease_count ();
- void editor_zoom_in ();
- void editor_zoom_out ();
+ /** Zoom into the given screen coordinates */
+ void editor_zoom_in (int x, int y);
+
+ /** Zoom out off the given screen coordinates */
+ void editor_zoom_out (int x, int y);
+
void zoom_mode ();
private:
Index: editor_view.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_view.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- editor_view.cxx 17 Jun 2003 14:09:20 -0000 1.9
+++ editor_view.cxx 22 Aug 2003 10:19:48 -0000 1.10
@@ -58,7 +58,30 @@
EditorView::set_zoom (float new_zoom)
{
offset.z = new_zoom;
- //std::cout << "Zoom: " << offset.z << std::endl;
+}
+
+void
+EditorView::zoom_out(int screen_x, int screen_y)
+{
+ float old_zoom = offset.z;
+ set_zoom(old_zoom / 1.2f);
+ if (0)
+ { // FIXME: Code below doesn't work because of 'center'
+ offset.x += screen_x/offset.z - screen_x/old_zoom;
+ offset.y += screen_y/offset.z - screen_y/old_zoom;
+ }
+}
+
+void
+EditorView::zoom_in (int screen_x, int screen_y)
+{
+ float old_zoom = offset.z;
+ set_zoom(old_zoom * 1.2f);
+ if (0)
+ { // FIXME: Code below doesn't work because of 'center'
+ offset.x += screen_x/offset.z - screen_x/old_zoom;
+ offset.y += screen_y/offset.z - screen_y/old_zoom;
+ }
}
void
Index: editor_view.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_view.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- editor_view.hxx 19 Apr 2003 10:23:18 -0000 1.8
+++ editor_view.hxx 22 Aug 2003 10:19:48 -0000 1.9
@@ -60,6 +60,12 @@
float get_zoom ();
void set_zoom (float new_zoom);
+ /** Zoom out of the given screen coordinates */
+ void zoom_out(int screen_x, int screen_y);
+
+ /** Zoom into of the given screen coordinates */
+ void zoom_in (int screen_x, int screen_y);
+
/** Set the current zoom and offset, so that the given rectangle is
completly visible on the screen and maximally zoomed. */
void zoom_to (const CL_Rect & rect);
Index: panel_icons.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/panel_icons.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- panel_icons.cxx 27 Jul 2003 17:34:04 -0000 1.11
+++ panel_icons.cxx 22 Aug 2003 10:19:48 -0000 1.12
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
+#include <ClanLib/Display/Display/display.h>
#include "../gettext.h"
#include "../pingus_resource.hxx"
#include "panel_icons.hxx"
@@ -168,7 +169,8 @@
void
PanelIconZoomIn::on_click()
{
- editor->get_event ()->editor_zoom_in ();
+ editor->get_event ()->editor_zoom_in(CL_Display::get_width()/2,
+ CL_Display::get_height()/2);
}
PanelIconZoomOut::PanelIconZoomOut()
@@ -180,7 +182,8 @@
void
PanelIconZoomOut::on_click()
{
- editor->get_event ()->editor_zoom_out ();
+ editor->get_event ()->editor_zoom_out (CL_Display::get_width()/2,
+ CL_Display::get_height()/2);
}
PanelIconSetupActions::PanelIconSetupActions ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx, 1.53, 1.54 editor_event.cxx, 1.61, 1.62 editor_event.hxx, 1.18, 1.19 editor_view.cxx, 1.9, 1.10 editor_view.hxx, 1.8, 1.9 panel_icons.cxx, 1.11, 1.12,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/contrib iso-8859-1-utf8.txt, NONE, 1.1
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/data/levels/volcano volcano1-grumbel.plf, NONE, 1.1 volcano2-grumbel.plf, NONE, 1.1
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/contrib iso-8859-1-utf8.txt, NONE, 1.1
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/data/levels/volcano volcano1-grumbel.plf, NONE, 1.1 volcano2-grumbel.plf, NONE, 1.1
- Index(es):