[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3117 - in trunk/pingus/src: . editor gui
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3117 - in trunk/pingus/src: . editor gui |
Date: |
Sun, 9 Sep 2007 19:42:24 +0200 |
Author: grumbel
Date: 2007-09-09 19:42:23 +0200 (Sun, 09 Sep 2007)
New Revision: 3117
Added:
trunk/pingus/src/editor/action_properties.cpp
trunk/pingus/src/editor/action_properties.hpp
trunk/pingus/src/editor/label.cpp
trunk/pingus/src/editor/label.hpp
trunk/pingus/src/editor/level_properties.cpp
trunk/pingus/src/editor/level_properties.hpp
Modified:
trunk/pingus/src/SConscript
trunk/pingus/src/editor/button.cpp
trunk/pingus/src/editor/context_menu.cpp
trunk/pingus/src/editor/editor_screen.cpp
trunk/pingus/src/editor/file_list.cpp
trunk/pingus/src/editor/file_load_dialog.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/fonts.cpp
trunk/pingus/src/fonts.hpp
trunk/pingus/src/gui/combobox.cpp
trunk/pingus/src/gui/combobox.hpp
Log:
- added some dummy components and verdana11 font
Modified: trunk/pingus/src/SConscript
===================================================================
--- trunk/pingus/src/SConscript 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/SConscript 2007-09-09 17:42:23 UTC (rev 3117)
@@ -94,6 +94,7 @@
'editor/context_menu.cpp',
'editor/editor_level.cpp',
'editor/panel.cpp',
+'editor/label.cpp',
'editor/file_list.cpp',
'editor/file_load_dialog.cpp',
'editor/file_save_dialog.cpp',
@@ -101,7 +102,9 @@
'editor/editor_viewport.cpp',
'editor/level_objs.cpp',
'editor/object_selector.cpp',
-'editor/object_properties.cpp',
+'editor/object_properties.cpp',
+'editor/level_properties.cpp',
+'editor/action_properties.cpp',
'command_line.cpp',
'command_line_generic.cpp',
Added: trunk/pingus/src/editor/action_properties.cpp
===================================================================
--- trunk/pingus/src/editor/action_properties.cpp 2007-09-09 17:41:20 UTC
(rev 3116)
+++ trunk/pingus/src/editor/action_properties.cpp 2007-09-09 17:42:23 UTC
(rev 3117)
@@ -0,0 +1,60 @@
+/* $Id$
+** __ __ __ ___ __ __ __ __
+** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
+** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
+** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
+** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
+** \/ \/ \/ \/ \/
+** Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version 2
+** of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+** 02111-1307, USA.
+*/
+
+#include "action_properties.hpp"
+
+namespace Editor {
+
+/*
+
+ActionDialog:
+[active] [Actionname] [count]
+...
+
+ */
+ActionProperties::ActionProperties(EditorScreen* editor, const Rect& rect)
+: GroupComponent(rect)
+{
+
+}
+
+ActionProperties::~ActionProperties()
+{
+}
+
+void
+ActionProperties::draw(DrawingContext& gc)
+{
+}
+
+void
+ActionProperties::update (float delta)
+{
+
+}
+
+} // namespace Editor
+
+/* EOF */
Property changes on: trunk/pingus/src/editor/action_properties.cpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/pingus/src/editor/action_properties.hpp
===================================================================
--- trunk/pingus/src/editor/action_properties.hpp 2007-09-09 17:41:20 UTC
(rev 3116)
+++ trunk/pingus/src/editor/action_properties.hpp 2007-09-09 17:42:23 UTC
(rev 3117)
@@ -0,0 +1,57 @@
+/* $Id$
+** __ __ __ ___ __ __ __ __
+** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
+** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
+** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
+** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
+** \/ \/ \/ \/ \/
+** Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version 2
+** of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+** 02111-1307, USA.
+*/
+
+#ifndef HEADER_ACTION_PROPERTIES_HPP
+#define HEADER_ACTION_PROPERTIES_HPP
+
+#include "gui/group_component.hpp"
+
+namespace Editor {
+
+class EditorScreen;
+
+/** */
+class ActionProperties : GUI::GroupComponent
+{
+private:
+ EditorScreen* editor;
+
+public:
+ ActionProperties(EditorScreen* editor, const Rect& rect);
+ ~ActionProperties();
+
+ void draw (DrawingContext& gc);
+ void update (float delta);
+
+private:
+ ActionProperties (const ActionProperties&);
+ ActionProperties& operator= (const ActionProperties&);
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */
Property changes on: trunk/pingus/src/editor/action_properties.hpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: trunk/pingus/src/editor/button.cpp
===================================================================
--- trunk/pingus/src/editor/button.cpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/editor/button.cpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -51,7 +51,7 @@
GUIStyle::draw_raised_box(gc, rect, Color(237, 233, 227), 2);
}
- gc.print_center(Fonts::courier_small,
+ gc.print_center(Fonts::verdana11,
rect.left + rect.get_width()/2, rect.top +
rect.get_height()/2 - 6,
text);
}
Modified: trunk/pingus/src/editor/context_menu.cpp
===================================================================
--- trunk/pingus/src/editor/context_menu.cpp 2007-09-09 17:41:20 UTC (rev
3116)
+++ trunk/pingus/src/editor/context_menu.cpp 2007-09-09 17:42:23 UTC (rev
3117)
@@ -35,7 +35,7 @@
pos(p),
selected_action_offset(0),
displayed_child(0),
- item_height(Fonts::courier_small.get_height())
+ item_height(Fonts::verdana11.get_height())
{
if (base_menu)
{
@@ -90,7 +90,7 @@
// Draw the action names
for (unsigned i = 0; i < actions.size(); i++)
- gc.print_left(Fonts::courier_small, pos.x, pos.y +
+ gc.print_left(Fonts::verdana11, pos.x, pos.y +
(i * item_height), actions[i].friendly_name);
}
}
Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp 2007-09-09 17:41:20 UTC (rev
3116)
+++ trunk/pingus/src/editor/editor_screen.cpp 2007-09-09 17:42:23 UTC (rev
3117)
@@ -61,7 +61,7 @@
panel = new Panel(this);
object_selector = new ObjectSelector(this);
- object_properties = new ObjectProperties(this, Rect(0,500,200,600));
+ object_properties = new ObjectProperties(this, Rect(Vector2i(0,440),
Size(240, 160)));
gui_manager->add(object_properties, true);
file_load_dialog = new FileLoadDialog(this, Rect(Vector2i(50, 50),
Size(Display::get_width() -
100,
@@ -125,12 +125,12 @@
int(gc.get_height()/2) + size.height/2,
Color(0,0,0));
- gc.print_center(Fonts::courier_small,
+ gc.print_center(Fonts::verdana11,
int(gc.get_width()/2),
int(gc.get_height()/2) - size.height/2 + 12,
"Editor Help");
- gc.print_left(Fonts::courier_small,
+ gc.print_left(Fonts::verdana11,
int(gc.get_width()/2 - size.width/2 + 12),
int(gc.get_height()/2) - size.height/2 + 36,
"F1 - display this help\n"
@@ -142,7 +142,7 @@
"F9 - change level width/height\n"
);
- gc.print_left(Fonts::courier_small,
+ gc.print_left(Fonts::verdana11,
int(gc.get_width()/2 + 12),
int(gc.get_height()/2) - size.height/2 + 36,
"F1 - display this help\n"
@@ -154,7 +154,7 @@
"F9 - change level width/height\n"
);
- gc.print_left(Fonts::courier_small,
+ gc.print_left(Fonts::verdana11,
int(gc.get_width()/2 - size.width/2 + 12),
int(gc.get_height()/2) - 10,
"Naming Convention:
<levelname><number>-<creator>.pingus\n\n"
Modified: trunk/pingus/src/editor/file_list.cpp
===================================================================
--- trunk/pingus/src/editor/file_list.cpp 2007-09-09 17:41:20 UTC (rev
3116)
+++ trunk/pingus/src/editor/file_list.cpp 2007-09-09 17:42:23 UTC (rev
3117)
@@ -84,7 +84,7 @@
FileList::draw(DrawingContext& gc)
{
gc.draw_fillrect(rect.left, rect.top, rect.right, rect.bottom,
- Color(0, 0, 0));
+ Color(255, 255, 255));
int end = (page+1) * items_per_page();
if (end > int(directory.size()))
@@ -109,7 +109,7 @@
gc.draw_rect(x, y, x + hspace, y + vspace, Color(0, 0, 255));
}
- gc.print_left(Fonts::courier_small, x + 4, y + 3,
+ gc.print_left(Fonts::verdana11, x + 4, y + 3,
((i->type == System::DE_DIRECTORY) ? "[DIR] " : "[FILE]
") + i->name);
y += 20;
Modified: trunk/pingus/src/editor/file_load_dialog.cpp
===================================================================
--- trunk/pingus/src/editor/file_load_dialog.cpp 2007-09-09 17:41:20 UTC
(rev 3116)
+++ trunk/pingus/src/editor/file_load_dialog.cpp 2007-09-09 17:42:23 UTC
(rev 3117)
@@ -91,14 +91,15 @@
gc.print_center(Fonts::pingus_small, rect.get_width()/2, 2, "Open a level");
GUIStyle::draw_lowered_box(gc, Rect(4 + 60,4+30,rect.get_width()-4, 26+30),
- Color(0,0,0));
- gc.print_left(Fonts::courier_small, 10, 8+30, "File: ");
- gc.print_left(Fonts::courier_small, 10 + 60, 8+30, filename);
+ Color(255,255,255));
+ gc.print_left(Fonts::verdana11, 10, 8+30, "File: ");
+ gc.print_left(Fonts::verdana11, 10 + 60, 8+30, filename);
+
GUIStyle::draw_lowered_box(gc, Rect(4 + 60,4+60,rect.get_width()-4, 26+60),
- Color(0,0,0));
- gc.print_left(Fonts::courier_small, 10, 8+60, "Path: ");
- gc.print_left(Fonts::courier_small, 10 + 60, 8+60, pathname);
+ Color(255,255,255));
+ gc.print_left(Fonts::verdana11, 10, 8+60, "Path: ");
+ gc.print_left(Fonts::verdana11, 10 + 60, 8+60, pathname);
}
void
Added: trunk/pingus/src/editor/label.cpp
===================================================================
--- trunk/pingus/src/editor/label.cpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/editor/label.cpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -0,0 +1,51 @@
+/* $Id$
+** __ __ __ ___ __ __ __ __
+** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
+** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
+** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
+** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
+** \/ \/ \/ \/ \/
+** Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version 2
+** of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+** 02111-1307, USA.
+*/
+
+#include "display/drawing_context.hpp"
+#include "fonts.hpp"
+#include "label.hpp"
+
+namespace Editor {
+
+Label::Label(const Rect& rect, const std::string& text_)
+ : RectComponent(rect),
+ text(text_)
+{
+}
+
+void
+Label::draw (DrawingContext& gc)
+{
+ gc.print_left(Fonts::verdana11, rect.left, rect.top, text);
+}
+
+void
+Label::update (float delta)
+{
+}
+
+} // namespace Editor
+
+/* EOF */
Property changes on: trunk/pingus/src/editor/label.cpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/pingus/src/editor/label.hpp
===================================================================
--- trunk/pingus/src/editor/label.hpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/editor/label.hpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -0,0 +1,54 @@
+/* $Id$
+** __ __ __ ___ __ __ __ __
+** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
+** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
+** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
+** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
+** \/ \/ \/ \/ \/
+** Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version 2
+** of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+** 02111-1307, USA.
+*/
+
+#ifndef HEADER_LABEL_HPP
+#define HEADER_LABEL_HPP
+
+#include "gui/rect_component.hpp"
+
+namespace Editor {
+
+/** */
+class Label : public GUI::RectComponent
+{
+private:
+ std::string text;
+
+public:
+ Label(const Rect& rect, const std::string& text);
+
+ bool is_at(int, int) { return false; }
+ void draw (DrawingContext& gc);
+ void update (float delta);
+ void update_layout() {}
+
+ void set_text(const std::string& text_) { text = text_; }
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */
Property changes on: trunk/pingus/src/editor/label.hpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/pingus/src/editor/level_properties.cpp
===================================================================
--- trunk/pingus/src/editor/level_properties.cpp 2007-09-09 17:41:20 UTC
(rev 3116)
+++ trunk/pingus/src/editor/level_properties.cpp 2007-09-09 17:42:23 UTC
(rev 3117)
@@ -0,0 +1,61 @@
+/* $Id$
+** __ __ __ ___ __ __ __ __
+** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
+** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
+** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
+** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
+** \/ \/ \/ \/ \/
+** Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version 2
+** of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+** 02111-1307, USA.
+*/
+
+#include "level_properties.hpp"
+
+/*
+Level Properties:
+Levelname, Description, Author,
+Number of Pingus, Time, Pingus to Save,
+Width, Height, (could be handled elsewhere)
+Difficulty
+Comment
+Playable (unneeded)
+*/
+
+namespace Editor {
+
+LevelProperties::LevelProperties(EditorScreen* editor, const Rect& rect)
+ : GroupComponent(rect)
+{
+}
+
+LevelProperties::~LevelProperties()
+{
+}
+
+void
+LevelProperties::draw(DrawingContext& gc)
+{
+}
+
+void
+LevelProperties::update(float delta)
+{
+}
+
+} // namespace Editor
+
+/* EOF */
Property changes on: trunk/pingus/src/editor/level_properties.cpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/pingus/src/editor/level_properties.hpp
===================================================================
--- trunk/pingus/src/editor/level_properties.hpp 2007-09-09 17:41:20 UTC
(rev 3116)
+++ trunk/pingus/src/editor/level_properties.hpp 2007-09-09 17:42:23 UTC
(rev 3117)
@@ -0,0 +1,57 @@
+/* $Id$
+** __ __ __ ___ __ __ __ __
+** / \ / \__| ____ __| _/_______/ |_|__| | | | ____
+** \ \/\/ / |/ \ / __ |/ ___/\ __\ | | | | _/ __ \
+** \ /| | | \/ /_/ |\___ \ | | | | |_| |_\ ___/
+** \__/\ / |__|___| /\____ /____ > |__| |__|____/____/\___ >
+** \/ \/ \/ \/ \/
+** Copyright (C) 2007 Ingo Ruhnke <address@hidden>
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version 2
+** of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+** 02111-1307, USA.
+*/
+
+#ifndef HEADER_LEVEL_PROPERTIES_HPP
+#define HEADER_LEVEL_PROPERTIES_HPP
+
+#include "gui/group_component.hpp"
+
+namespace Editor {
+
+class EditorScreen;
+
+/** */
+class LevelProperties : public GUI::GroupComponent
+{
+private:
+ EditorScreen* editor;
+
+public:
+ LevelProperties(EditorScreen* editor, const Rect& rect);
+ ~LevelProperties();
+
+ void draw (DrawingContext& gc);
+ void update (float delta);
+
+private:
+ LevelProperties (const LevelProperties&);
+ LevelProperties& operator= (const LevelProperties&);
+};
+
+} // namespace Editor
+
+#endif
+
+/* EOF */
Property changes on: trunk/pingus/src/editor/level_properties.hpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: trunk/pingus/src/editor/object_properties.cpp
===================================================================
--- trunk/pingus/src/editor/object_properties.cpp 2007-09-09 17:41:20 UTC
(rev 3116)
+++ trunk/pingus/src/editor/object_properties.cpp 2007-09-09 17:42:23 UTC
(rev 3117)
@@ -21,6 +21,8 @@
#include "editor_screen.hpp"
#include "level_objs.hpp"
#include "fonts.hpp"
+#include "label.hpp"
+#include "gui_style.hpp"
#include "object_properties.hpp"
namespace Editor {
@@ -29,7 +31,15 @@
: GUI::GroupComponent(rect),
editor(editor_)
{
- add(new Button(Rect(10, 50, 100, 70), "Test 2"), true);
+ add(type_label = new Label(Rect(Vector2i(10, 10), Size(120, 20)),
"Object:"), true);
+
+ add(new Label(Rect(Vector2i( 10, 30), Size( 80, 20)), "Type:"), true);
+
+ add(new Button(Rect(Vector2i( 60, 30), Size( 80, 20)), "Ground"), true);
+ add(new Button(Rect(Vector2i( 60, 50), Size( 80, 20)), "Transparent"),
true);
+ add(new Button(Rect(Vector2i( 60, 70), Size( 80, 20)), "Solid"), true);
+ add(new Button(Rect(Vector2i(140, 30), Size( 80, 20)), "Bridge"), true);
+ add(new Button(Rect(Vector2i(140, 50), Size( 80, 20)), "Remove"), true);
}
ObjectProperties::~ObjectProperties()
@@ -44,31 +54,28 @@
void
ObjectProperties::draw_background(DrawingContext& gc)
{
- gc.draw_fillrect(0,0, rect.get_width(), rect.get_height(),
- Color(255, 255, 0));
+ GUIStyle::draw_raised_box(gc, Rect(0,0, rect.get_width(),
rect.get_height()));
+}
+void
+ObjectProperties::set_objects(const std::vector<LevelObj*>& objs)
+{
+ objects = objs;
+
std::string obj_type;
if (objects.empty())
{
- obj_type = "[Empty]";
+ type_label->set_text("Object: [Empty]");
}
else if (objects.size() > 1)
{
- obj_type = "[Group]";
+ type_label->set_text("Object: [Group]");
}
else
{
- obj_type = objects.front()->get_section_name();
+ type_label->set_text("Object: " + objects.front()->get_section_name());
}
- gc.print_center(Fonts::courier_small, rect.get_width()/2, 10,
- obj_type);
}
-
-void
-ObjectProperties::set_objects(const std::vector<LevelObj*>& objs)
-{
- objects = objs;
-}
} // namespace Editor
Modified: trunk/pingus/src/editor/object_properties.hpp
===================================================================
--- trunk/pingus/src/editor/object_properties.hpp 2007-09-09 17:41:20 UTC
(rev 3116)
+++ trunk/pingus/src/editor/object_properties.hpp 2007-09-09 17:42:23 UTC
(rev 3117)
@@ -25,6 +25,7 @@
namespace Editor {
+class Label;
class EditorScreen;
/** */
@@ -33,7 +34,11 @@
private:
EditorScreen* editor;
std::vector<LevelObj*> objects;
-
+ Label* type_label;
+
+ Label* gptype_label;
+ RadioButtonGroup* gptype_type;
+
public:
ObjectProperties(EditorScreen* editor, const Rect& rect);
~ObjectProperties();
Modified: trunk/pingus/src/editor/object_selector.cpp
===================================================================
--- trunk/pingus/src/editor/object_selector.cpp 2007-09-09 17:41:20 UTC (rev
3116)
+++ trunk/pingus/src/editor/object_selector.cpp 2007-09-09 17:42:23 UTC (rev
3117)
@@ -87,7 +87,7 @@
Rect rect(int(gc.get_width()) - 244, 38,
int(gc.get_width()), int(gc.get_height()));
- gc.print_left(Fonts::courier_small,
+ gc.print_left(Fonts::verdana11,
//pos.x + 17.f, pos.y + 38.f,
rect.left+2 + 2,
rect.top+2 + 62 + 2,
Modified: trunk/pingus/src/editor/panel.cpp
===================================================================
--- trunk/pingus/src/editor/panel.cpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/editor/panel.cpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -99,7 +99,7 @@
if (mouse_over)
{
- gc.print_center(Fonts::courier_small, pos.x + 17.f, pos.y + 38.f,
tooltip, 1000.0f);
+ gc.print_center(Fonts::verdana11, pos.x + 17.f, pos.y + 38.f, tooltip,
1000.0f);
}
}
Modified: trunk/pingus/src/fonts.cpp
===================================================================
--- trunk/pingus/src/fonts.cpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/fonts.cpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -34,6 +34,8 @@
Font courier_small;
+Font verdana11;
+
Font lcd;
void
@@ -49,6 +51,8 @@
courier_small = Resource::load_font("fonts/courier_small" + std::string("-")
+ encoding);
+ verdana11 = Resource::load_font("fonts/verdana11" + std::string("-") +
encoding);
+
lcd = Resource::load_font("fonts/lcd");
}
@@ -60,6 +64,7 @@
pingus_small = Font();
pingus_large = Font();
courier_small = Font();
+ verdana11 = Font();
lcd = Font();
}
Modified: trunk/pingus/src/fonts.hpp
===================================================================
--- trunk/pingus/src/fonts.hpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/fonts.hpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -1,7 +1,7 @@
// $Id$
//
// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+// Copyright (C) 2007 Ingo Ruhnke <address@hidden>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -37,6 +37,8 @@
extern Font pingus_small_fixnum;
extern Font pingus_large;
+extern Font verdana11;
+
extern Font lcd;
/** Load all fonts */
Modified: trunk/pingus/src/gui/combobox.cpp
===================================================================
--- trunk/pingus/src/gui/combobox.cpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/gui/combobox.cpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -24,154 +24,154 @@
#include "../fonts.hpp"
namespace GUI {
-
+
// Constructor
Combobox::Combobox (Vector3f p, ComboboxListener* listener_, std::string l) :
- current_item(0),
- drop_down(false),
- hover(false),
- pos(p),
- enabled(false),
- label(l),
- listener(listener_)
+ current_item(0),
+ drop_down(false),
+ hover(false),
+ pos(p),
+ enabled(false),
+ label(l),
+ listener(listener_)
{
- // Default to 20 characters wide.
- width = Fonts::pingus_small.get_width('O') * 20.0f;
- height = (float)Fonts::pingus_small.get_height();
+ // Default to 20 characters wide.
+ width = Fonts::pingus_small.get_width('O') * 20.0f;
+ height = (float)Fonts::pingus_small.get_height();
}
// Destructor
Combobox::~Combobox ()
{
- clear();
+ clear();
}
// Add an item to the combobox
void
Combobox::add(ComboItem* item)
{
- item_list.push_back(item);
+ item_list.push_back(item);
}
// Remove an item from the combobox. Delete it if necessary
void
Combobox::remove(ComboItem* item)
{
- for (std::vector<ComboItem*>::iterator i = item_list.begin();
- i != item_list.end(); i++)
- {
- if ((*i) == item)
- {
- item_list.erase(i);
- if (item->delete_it())
- delete item;
- }
- }
+ for (std::vector<ComboItem*>::iterator i = item_list.begin();
+ i != item_list.end(); i++)
+ {
+ if ((*i) == item)
+ {
+ item_list.erase(i);
+ if (item->delete_it())
+ delete item;
+ }
+ }
}
// Remove all items from this combobox
void
Combobox::clear()
{
- for (std::vector<ComboItem*>::iterator i = item_list.begin();
- i != item_list.end(); i++)
- {
- if ((*i)->delete_it())
- delete (*i);
- }
- item_list.clear();
- current_item = 0;
- drop_down = false;
+ for (std::vector<ComboItem*>::iterator i = item_list.begin();
+ i != item_list.end(); i++)
+ {
+ if ((*i)->delete_it())
+ delete (*i);
+ }
+ item_list.clear();
+ current_item = 0;
+ drop_down = false;
}
// Returns whether or not the combobox is at this location
bool
Combobox::is_at(int x, int y)
{
- if (enabled)
- return ((float)x > pos.x && (float)x < pos.x + get_width() &&
- (float)y > pos.y && (float)y < pos.y + get_height());
- else
- return false;
+ if (enabled)
+ return ((float)x > pos.x && (float)x < pos.x + get_width() &&
+ (float)y > pos.y && (float)y < pos.y + get_height());
+ else
+ return false;
}
// Returns the width of the box
float
Combobox::get_width()
{
- return width;
+ return width;
}
// Returns the height of the box
float
Combobox::get_height()
{
- if (drop_down)
- return height * ((float)item_list.size() + 1.0f);
- else
- return height;
+ if (drop_down)
+ return height * ((float)item_list.size() + 1.0f);
+ else
+ return height;
}
// action taken when the primary mouse button is clicked
void
Combobox::on_primary_button_click(int x, int y)
{
- if (drop_down)
- {
- // Determine which item was selected, if any, and set the
current item to it.
- drop_down = false;
- if (y > pos.y + height)
- {
- current_item = item_list[static_cast<int>((y - pos.y -
height) / height)];
- listener->combobox_changed(this);
- }
- }
- else
- {
- drop_down = true;
- }
+ if (drop_down)
+ {
+ // Determine which item was selected, if any, and set the current item
to it.
+ drop_down = false;
+ if (y > pos.y + height)
+ {
+ current_item = item_list[static_cast<int>((y - pos.y - height) /
height)];
+ listener->combobox_changed(this);
+ }
+ }
+ else
+ {
+ drop_down = true;
+ }
}
// Draws the Combobox on the screen at it's location
void
Combobox::draw(DrawingContext &gc)
{
- if (!enabled)
- return;
+ if (!enabled)
+ return;
- // Draw the label
- gc.print_right(Fonts::pingus_small, pos.x, pos.y, label);
+ // Draw the label
+ gc.print_right(Fonts::pingus_small, pos.x, pos.y, label);
- // Draw the rectangle
- gc.draw_fillrect(pos.x, pos.y, pos.x + get_width(), pos.y +
get_height(),
- Color(255,255,255));
+ // Draw the rectangle
+ gc.draw_fillrect(pos.x, pos.y, pos.x + get_width(), pos.y + get_height(),
+ Color(255,255,255));
- // Next, draw the rectangle border
- gc.draw_rect(pos.x, pos.y, pos.x + get_width(), pos.y + get_height(),
- Color(0,0,0));
+ // Next, draw the rectangle border
+ gc.draw_rect(pos.x, pos.y, pos.x + get_width(), pos.y + get_height(),
+ Color(0,0,0));
- if (drop_down && item_list.size() > 0)
- {
- // Draw the highlighted box
- int y_offset = int(int(((mouse_pos.y - pos.y -
height)/height)+1) * height);
- gc.draw_fillrect(pos.x, pos.y + y_offset, pos.x + get_width(),
pos.y + y_offset +
- height, Color(128,128,128));
+ if (drop_down && item_list.size() > 0)
+ {
+ // Draw the highlighted box
+ int y_offset = int(int(((mouse_pos.y - pos.y - height)/height)+1) *
height);
+ gc.draw_fillrect(pos.x, pos.y + y_offset, pos.x + get_width(), pos.y +
y_offset +
+ height, Color(128,128,128));
- // Draw all of the items
- for (unsigned i = 0; i < item_list.size(); i++)
- {
- gc.print_left(Fonts::pingus_small, pos.x + 5.0f, pos.y
+ ((i + 1) * height),
- item_list[i]->get_displayed_string());
- }
- }
+ // Draw all of the items
+ for (unsigned i = 0; i < item_list.size(); i++)
+ {
+ gc.print_left(Fonts::pingus_small, pos.x + 5.0f, pos.y + ((i + 1) *
height),
+ item_list[i]->get_displayed_string());
+ }
+ }
- if (current_item)
- {
- // Print the currently selected item
- gc.print_left(Fonts::pingus_small, pos.x + 3.0f, pos.y,
current_item->get_displayed_string());
- }
+ if (current_item)
+ {
+ // Print the currently selected item
+ gc.print_left(Fonts::pingus_small, pos.x + 3.0f, pos.y,
current_item->get_displayed_string());
+ }
}
+
+} // namespace GUI
-} // GUI namespace
-
/* EOF */
Modified: trunk/pingus/src/gui/combobox.hpp
===================================================================
--- trunk/pingus/src/gui/combobox.hpp 2007-09-09 17:41:20 UTC (rev 3116)
+++ trunk/pingus/src/gui/combobox.hpp 2007-09-09 17:42:23 UTC (rev 3117)
@@ -25,48 +25,47 @@
#include "component.hpp"
#include "../math/vector3f.hpp"
-
namespace GUI {
-
- class ComboboxListener;
+
+class ComboboxListener;
/** A ComboItems holds a specific item in a Combobox (string, id, etc.) */
class ComboItem
{
protected:
- /* The item's hidden ID field */
- std::string id;
+ /* The item's hidden ID field */
+ std::string id;
- /** string that displays when printed on the Combobox */
- std::string str;
+ /** string that displays when printed on the Combobox */
+ std::string str;
- /** Should this item be deleted when the Combobox dies? */
- bool delete_item;
+ /** Should this item be deleted when the Combobox dies? */
+ bool delete_item;
public:
- /** Constructors */
- ComboItem () { delete_item = true; }
- ComboItem (std::string id_, std::string displayed_string, bool d =
true)
- : id(id_), str(displayed_string), delete_item(d)
- {
- }
+ /** Constructors */
+ ComboItem () { delete_item = true; }
+ ComboItem (std::string id_, std::string displayed_string, bool d = true)
+ : id(id_), str(displayed_string), delete_item(d)
+ {
+ }
- virtual ~ComboItem () { }
+ virtual ~ComboItem () { }
- /** Returns this item's ID */
- std::string get_id() { return id; }
+ /** Returns this item's ID */
+ std::string get_id() { return id; }
- /** Returns this item's string */
- std::string get_displayed_string() { return str; }
+ /** Returns this item's string */
+ std::string get_displayed_string() { return str; }
- /** Returns the value of del_item */
- bool delete_it() { return delete_item; }
+ /** Returns the value of del_item */
+ bool delete_it() { return delete_item; }
- /** Set this item's ID */
- void set_id(std::string s) { id = s; }
+ /** Set this item's ID */
+ void set_id(std::string s) { id = s; }
- /** Set this item's string */
- void set_displayed_string(std::string s) { str = s; }
+ /** Set this item's string */
+ void set_displayed_string(std::string s) { str = s; }
private:
ComboItem (const ComboItem&);
@@ -79,106 +78,106 @@
class Combobox : public Component
{
protected:
- /** List of items in this Combobox */
- std::vector<ComboItem*> item_list;
+ /** List of items in this Combobox */
+ std::vector<ComboItem*> item_list;
- /** The currently selected item in the list */
- ComboItem* current_item;
+ /** The currently selected item in the list */
+ ComboItem* current_item;
- /** Whether or not the list is showing right now */
- bool drop_down;
+ /** Whether or not the list is showing right now */
+ bool drop_down;
- /** Is the mouse hovering over this object? */
- bool hover;
+ /** Is the mouse hovering over this object? */
+ bool hover;
- /** Where the mouse is located */
- Vector3f mouse_pos;
+ /** Where the mouse is located */
+ Vector3f mouse_pos;
- /** Width of the Combobox */
- float width;
+ /** Width of the Combobox */
+ float width;
- /** Height of EACH ITEM in the Combobox. So, when drop_down is false,
this
- should be the height of the entire widget/component. When
drop_down is
- true, the entire widget's height should be this height times
the number of
- items */
- float height;
+ /** Height of EACH ITEM in the Combobox. So, when drop_down is false, this
+ should be the height of the entire widget/component. When drop_down is
+ true, the entire widget's height should be this height times the number
of
+ items */
+ float height;
- /** Location of the Combobox */
- Vector3f pos;
+ /** Location of the Combobox */
+ Vector3f pos;
- /** Whether or not this combobox is enabled */
- bool enabled;
+ /** Whether or not this combobox is enabled */
+ bool enabled;
- /** Label that prints to the left of the drop-down */
- std::string label;
+ /** Label that prints to the left of the drop-down */
+ std::string label;
- /** The "owner" of this combobox */
- ComboboxListener* listener;
+ /** The "owner" of this combobox */
+ ComboboxListener* listener;
public:
- /** Constructor */
- Combobox (Vector3f p, ComboboxListener* listener, std::string label =
std::string());
+ /** Constructor */
+ Combobox (Vector3f p, ComboboxListener* listener, std::string label =
std::string());
- /** Destructor */
- virtual ~Combobox ();
+ /** Destructor */
+ virtual ~Combobox ();
- /** Add an item to the list.
- @param del_item Set to true if you want this Combobox to delete
the
- ComboItem when it's destroyed */
- virtual void add(ComboItem* item);
+ /** Add an item to the list.
+ @param del_item Set to true if you want this Combobox to delete the
+ ComboItem when it's destroyed */
+ virtual void add(ComboItem* item);
- /** Remove an item from the list */
- virtual void remove(ComboItem* item);
+ /** Remove an item from the list */
+ virtual void remove(ComboItem* item);
- /** Clears all items from combobox */
- virtual void clear();
+ /** Clears all items from combobox */
+ virtual void clear();
- /** Return a pointer to the selected item. Returns 0 if nothing is
selected */
- ComboItem* get_selected_item() { return current_item; }
+ /** Return a pointer to the selected item. Returns 0 if nothing is selected
*/
+ ComboItem* get_selected_item() { return current_item; }
- /** Sets the selected item to the given ComboItem. Returns false if
that item
- doesn't exist */
- bool set_selected_item(ComboItem*);
+ /** Sets the selected item to the given ComboItem. Returns false if that
item
+ doesn't exist */
+ bool set_selected_item(ComboItem*);
- /** Draw this Combobox and all of it's items if selected */
+ /** Draw this Combobox and all of it's items if selected */
virtual void draw (DrawingContext& gc);
- /** Tells the gui_manager if the mouse is on top of the Combobox */
+ /** Tells the gui_manager if the mouse is on top of the Combobox */
virtual bool is_at (int x, int y);
- /** Returns the height of the Combobox at this given moment. Will be
tall if
- drop_down = true, and short if drop_down = false */
- virtual float get_height();
+ /** Returns the height of the Combobox at this given moment. Will be tall
if
+ drop_down = true, and short if drop_down = false */
+ virtual float get_height();
- /** Returns the width of the Combobox */
- virtual float get_width();
+ /** Returns the width of the Combobox */
+ virtual float get_width();
/** Gets emmited when a button is pressed and released over the
same component */
virtual void on_primary_button_click (int x, int y);
- virtual void on_pointer_enter() { hover = true; }
- virtual void on_pointer_leave() { hover = false; }
- virtual void on_pointer_move(int x, int y) { mouse_pos =
Vector3f((float)x, (float)y); }
+ virtual void on_pointer_enter() { hover = true; }
+ virtual void on_pointer_leave() { hover = false; }
+ virtual void on_pointer_move(int x, int y) { mouse_pos = Vector3f((float)x,
(float)y); }
- /** Sets whether or not this combobox is clickable */
- virtual void set_enabled(bool e) { enabled = e; }
+ /** Sets whether or not this combobox is clickable */
+ virtual void set_enabled(bool e) { enabled = e; }
- /** Returns whether or not the combobox is enabled */
- virtual bool is_enabled() { return enabled; }
+ /** Returns whether or not the combobox is enabled */
+ virtual bool is_enabled() { return enabled; }
- /** Sets the label */
- virtual void set_label(std::string l) { label = l; }
+ /** Sets the label */
+ virtual void set_label(std::string l) { label = l; }
private:
- Combobox();
+ Combobox();
Combobox (const Combobox&);
Combobox& operator= (const Combobox&);
-}; // Combobox class
+};
+
+} // namespace GUI
-} // GUI namespace
-
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3117 - in trunk/pingus/src: . editor gui,
grumbel at BerliOS <=