[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/editor level_property_window.cxx,1.11
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/editor level_property_window.cxx,1.11,1.12 level_property_window.hxx,1.9,1.10 level_resizer.cxx,1.2,1.3 level_resizer.hxx,1.1,1.2 object_manager.hxx,1.23,1.24 property_window.cxx,1.13,1.14 |
Date: |
30 Nov 2002 17:11:57 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv25073/editor
Modified Files:
level_property_window.cxx level_property_window.hxx
level_resizer.cxx level_resizer.hxx object_manager.hxx
property_window.cxx
Log Message:
fixed levelproperty dialog, should now be fully working
Index: level_property_window.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/level_property_window.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- level_property_window.cxx 29 Nov 2002 22:54:22 -0000 1.11
+++ level_property_window.cxx 30 Nov 2002 17:11:55 -0000 1.12
@@ -17,6 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <iostream>
#include "object_manager.hxx"
#include "../string_converter.hxx"
#include "level_property_window.hxx"
@@ -82,25 +83,93 @@
comment_label (CL_Rect(10, 190, 90, 210), "Comment", get_client_area ()),
playable_checkbox (CL_Point(10, 210), "Playable", get_client_area ()),
- ok_button(CL_Rect(10, 200, 90, 220), "Ok", get_client_area()),
- cancel_button(CL_Rect(110, 200, 190, 220), "Cancel", get_client_area())
+ ok_button(CL_Rect(210, 240, 290, 260), "Ok", get_client_area()),
+ cancel_button(CL_Rect(310, 240, 390, 260), "Cancel", get_client_area())
{
- if (manager->get_playable ())
- playable_checkbox.set_checked (true);
- else
- playable_checkbox.set_checked (false);
+ playable_checkbox.set_checked (manager->get_playable ());
- levelname_input.set_read_only (true);
- description_input.set_read_only (true);
-
+ ok_button_slot = ok_button.sig_clicked().connect(this,
&LevelPropertyWindow::on_ok_click);
+ cancel_button_slot = cancel_button.sig_clicked().connect(this,
&LevelPropertyWindow::on_cancel_click);
+
+ set_position(200, 100);
show (false);
}
LevelPropertyWindow::~LevelPropertyWindow ()
{
+ manager->set_playable (playable_checkbox.is_checked ());
+}
+
+void
+LevelPropertyWindow::on_ok_click()
+{
+ write_data();
+ show(false);
+}
+
+void
+LevelPropertyWindow::on_cancel_click()
+{
+ show(false);
+}
+
+void
+LevelPropertyWindow::show(bool show_window)
+{
+ if (show_window)
+ read_data();
+
+ CL_Window::show(show_window);
+}
+
+void
+LevelPropertyWindow::write_data()
+{
+ manager->set_levelname (levelname_input.get_text());
+ manager->set_description (description_input.get_text());
+
+ manager->set_author (author_input.get_text());
+
+ int number_of_pingus;
+ if (from_string(number_of_pingus_input.get_text(), number_of_pingus))
+ manager->set_number_of_pingus (number_of_pingus);
+
+ int pingus_to_save;
+ if (from_string(pingus_to_save_input.get_text(), pingus_to_save))
+ manager->set_number_to_save (pingus_to_save);
+ int time;
+ if (from_string (time_input.get_text(), time))
+ manager->set_leveltime (time);
- manager->set_playable (playable_checkbox.is_checked ());
+ int width;
+ if (from_string(width_input.get_text(), width))
+ manager->set_width(width);
+
+ int height;
+ if (from_string(height_input.get_text(), height))
+ manager->set_height(height);
+
+ int difficulty = 40;
+ if (from_string(difficulty_input.get_text(), difficulty))
+ manager->set_difficulty(difficulty);
+
+ manager->set_playable (playable_checkbox.is_checked());
+}
+
+void
+LevelPropertyWindow::read_data()
+{
+ levelname_input.set_text(manager->get_levelname ());
+ description_input.set_text(manager->get_description ());
+ author_input.set_text(manager->get_author ());
+ number_of_pingus_input.set_text(to_string (manager->get_number_of_pingus
()));
+ pingus_to_save_input.set_text(to_string (manager->get_number_to_save ()));
+ time_input.set_text(to_string (manager->get_leveltime ()));
+ width_input.set_text(to_string(manager->get_width ()));
+ height_input.set_text(to_string(manager->get_height ()));
+ difficulty_input.set_text(to_string (manager->get_difficulty ()));
+ playable_checkbox.set_checked(manager->get_playable ());
}
} // namespace EditorNS
Index: level_property_window.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/level_property_window.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- level_property_window.hxx 29 Nov 2002 22:54:22 -0000 1.9
+++ level_property_window.hxx 30 Nov 2002 17:11:55 -0000 1.10
@@ -68,10 +68,21 @@
CL_Button ok_button;
CL_Button cancel_button;
+ CL_Slot ok_button_slot;
+ CL_Slot cancel_button_slot;
+
public:
LevelPropertyWindow (CL_Component* parent, ObjectManager*);
~LevelPropertyWindow ();
+ void show(bool);
+
+ void on_ok_click();
+ void on_cancel_click();
+
+ void write_data();
+ void read_data();
+
private:
LevelPropertyWindow (const LevelPropertyWindow&);
LevelPropertyWindow& operator= (const LevelPropertyWindow&);
Index: level_resizer.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/level_resizer.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- level_resizer.cxx 30 Nov 2002 15:06:31 -0000 1.2
+++ level_resizer.cxx 30 Nov 2002 17:11:55 -0000 1.3
@@ -35,6 +35,13 @@
}
void
+LevelResizer::update(float delta)
+{
+ pos.x = obj_manager->get_width();
+ pos.y = obj_manager->get_height();
+}
+
+void
LevelResizer::draw (EditorNS::EditorView* view)
{
SpriteEditorObj::draw(view);
Index: level_resizer.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/level_resizer.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- level_resizer.hxx 29 Nov 2002 22:54:22 -0000 1.1
+++ level_resizer.hxx 30 Nov 2002 17:11:55 -0000 1.2
@@ -40,6 +40,7 @@
void set_position_offset(const Vector& offset);
void draw (EditorNS::EditorView *);
+ void update(float delta);
void write_xml(std::ostream&) {}
EditorObj* duplicate() { return 0; }
Index: object_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_manager.hxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- object_manager.hxx 29 Nov 2002 22:54:22 -0000 1.23
+++ object_manager.hxx 30 Nov 2002 17:11:55 -0000 1.24
@@ -92,6 +92,9 @@
std::string get_levelname () { return levelname["en"]; }
std::string get_description () { return description["en"]; }
+ void set_levelname (const std::string& str) { levelname["en"] = str; }
+ void set_description (const std::string& str) { description["en"] = str; }
+
// Get and Setter functions
int get_width() { return width; }
int get_height() { return height; }
Index: property_window.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/property_window.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- property_window.cxx 30 Nov 2002 15:06:31 -0000 1.13
+++ property_window.cxx 30 Nov 2002 17:11:55 -0000 1.14
@@ -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 <ClanLib/GUI/gui_manager.h>
#include "editor.hxx"
#include "editorobj.hxx"
@@ -37,6 +38,9 @@
label.show (true);
set_client_size (200, 50);
show (false);
+
+ set_position(CL_Display::get_width() - get_width() - 50,
+ 50);
}
void
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/editor level_property_window.cxx,1.11,1.12 level_property_window.hxx,1.9,1.10 level_resizer.cxx,1.2,1.3 level_resizer.hxx,1.1,1.2 object_manager.hxx,1.23,1.24 property_window.cxx,1.13,1.14,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs groundpiece_obj.cxx,1.8,1.9 solid_color_background_obj.cxx,1.5,1.6 starfield_background_obj.cxx,1.4,1.5
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs groundpiece_obj.cxx,1.8,1.9 solid_color_background_obj.cxx,1.5,1.6 starfield_background_obj.cxx,1.4,1.5
- Index(es):