pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2602 - in trunk/src: . components editor gui worldmap


From: jave27
Subject: [Pingus-CVS] r2602 - in trunk/src: . components editor gui worldmap
Date: Wed, 18 Jan 2006 16:01:50 +0100

Author: jave27
Date: 2006-01-18 16:01:29 +0100 (Wed, 18 Jan 2006)
New Revision: 2602

Added:
   trunk/src/gui/combobox_listener.hxx
Modified:
   trunk/src/components/playfield.cxx
   trunk/src/editor/editor_panel.cxx
   trunk/src/editor/editor_panel.hxx
   trunk/src/editor/editor_screen.cxx
   trunk/src/editor/editor_screen.hxx
   trunk/src/editor/editor_viewport.cxx
   trunk/src/editor/editor_viewport.hxx
   trunk/src/editor/panel_buttons.cxx
   trunk/src/editor/panel_buttons.hxx
   trunk/src/editor/xml_level.cxx
   trunk/src/editor/xml_level.hxx
   trunk/src/graphic_context_state.cxx
   trunk/src/gui/Makefile.am
   trunk/src/gui/combobox.cxx
   trunk/src/gui/combobox.hxx
   trunk/src/resource.cxx
   trunk/src/start_screen.cxx
   trunk/src/worldmap/worldmap.cxx
Log:
Editor can add new groundpiece objects now.
Reworked Combobox a bit more.
Took care of a bunch of MSVC compile/type conversion warnings

Modified: trunk/src/components/playfield.cxx
===================================================================
--- trunk/src/components/playfield.cxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/components/playfield.cxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -69,31 +69,31 @@
   
        // Blank out the entire window in case the screen resolution is larger
        // than the current level.
-       gc.draw_fillrect(0, 0, CL_Display::get_width(), 
CL_Display::get_height(),
+       gc.draw_fillrect(0, 0, (float)CL_Display::get_width(), 
(float)CL_Display::get_height(),
                CL_Color::black, -15000);
   world->draw(*scene_context);
  
   // Draw the scrolling band
   if (mouse_scrolling && !drag_drop_scrolling)
     {
-      gc.draw_line(mouse_pos.x, mouse_pos.y,
-                   scroll_center.x, scroll_center.y-15,
+      gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
+                   (float)scroll_center.x, (float)scroll_center.y-15,
                    CL_Color(0, 255, 0));
 
-      gc.draw_line(mouse_pos.x, mouse_pos.y,
-                   scroll_center.x, scroll_center.y,
+      gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
+                   (float)scroll_center.x, (float)scroll_center.y,
                    CL_Color(255, 0, 0));
 
-      gc.draw_line(mouse_pos.x, mouse_pos.y,
-                   scroll_center.x, scroll_center.y+15,
+      gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
+                   (float)scroll_center.x, (float)scroll_center.y+15,
                    CL_Color(0, 0, 255));
 
-      gc.draw_line(mouse_pos.x, mouse_pos.y,
-                   scroll_center.x + 15, scroll_center.y,
+      gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
+                   (float)scroll_center.x + 15, (float)scroll_center.y,
                    CL_Color(0, 255, 255));
 
-      gc.draw_line(mouse_pos.x, mouse_pos.y,
-                   scroll_center.x - 15, scroll_center.y,
+      gc.draw_line((float)mouse_pos.x, (float)mouse_pos.y,
+                   (float)scroll_center.x - 15, (float)scroll_center.y,
                    CL_Color(255, 255, 0));
     }
 
@@ -143,8 +143,8 @@
         }
       else
         { 
-          state.set_pos(CL_Pointf(state.get_pos().x - (scroll_center.x - 
mouse_pos.x) * 0.2,
-                                  state.get_pos().y - (scroll_center.y - 
mouse_pos.y) * 0.2));
+          state.set_pos(CL_Pointf(state.get_pos().x - float(scroll_center.x - 
mouse_pos.x) * 0.2f,
+                                  state.get_pos().y - float(scroll_center.y - 
mouse_pos.y) * 0.2f));
         }
     }
 

Modified: trunk/src/editor/editor_panel.cxx
===================================================================
--- trunk/src/editor/editor_panel.cxx   2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/editor_panel.cxx   2006-01-18 15:01:29 UTC (rev 2602)
@@ -70,12 +70,15 @@
        get_screen()->get_gui_manager()->add(snap_to_checkbox);
        
        // Create Comboboxes
-       combobox_1 = new GUI::Combobox(Vector(500,  0));
-       combobox_2 = new GUI::Combobox(Vector(500, 30));
+       combobox_3 = new GUI::Combobox(Vector(500, 36), this);
+       combobox_2 = new GUI::Combobox(Vector(500, 18), this);
+       combobox_1 = new GUI::Combobox(Vector(500,  0), this);
+       get_screen()->get_gui_manager()->add(combobox_3);
+       get_screen()->get_gui_manager()->add(combobox_2);
        get_screen()->get_gui_manager()->add(combobox_1);
-       get_screen()->get_gui_manager()->add(combobox_2);
+       combobox_3->set_enabled(false);
+       combobox_2->set_enabled(false);
        combobox_1->set_enabled(false);
-       combobox_2->set_enabled(false);
 }
 
 // Draw the panel
@@ -113,7 +116,12 @@
 EditorPanel::set_selected_button(PanelButton* pb)
 {
        if (pressed_button)
+       {
+               combobox_1->set_enabled(false);
+               combobox_2->set_enabled(false);
+               combobox_3->set_enabled(false);
                pressed_button->select(false);
+       }
        
        pressed_button = pb;
        if (pressed_button)
@@ -129,6 +137,8 @@
                        return combobox_1;
                case 2 :
                        return combobox_2;
+               case 3:
+                       return combobox_3;
                default :
                        return 0;
        }
@@ -141,5 +151,25 @@
                editor->get_viewport()->set_snap_to(new_value);
 }
 
+void
+EditorPanel::combobox_changed(GUI::Combobox* box)
+{
+       if (pressed_button)
+       {       
+               int i;
+               if (box == combobox_1)
+                       i = 1;
+               else if (box == combobox_2)
+                       i = 2;
+               else
+                       i = 3;
+
+               // Send the ID field of the Combobox to whichever button is 
currently selected.
+               pressed_button->combobox_changed(i, 
+                       get_combobox(i)->get_selected_item()->get_id());
+       }
+       
+}
+
 } // Editor namespace
 } // Pingus namespace

Modified: trunk/src/editor/editor_panel.hxx
===================================================================
--- trunk/src/editor/editor_panel.hxx   2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/editor_panel.hxx   2006-01-18 15:01:29 UTC (rev 2602)
@@ -24,12 +24,14 @@
 #include <iostream>
 #include "../gui/component.hxx"
 #include "../gui/checkbox_listener.hxx"
-#include "../gui/combobox.hxx"
+#include "../gui/combobox_listener.hxx"
+//#include "../gui/combobox.hxx"
 
 namespace Pingus {
 
        class DrawingContext;
        class GUI::Checkbox;
+       class GUI::Combobox;
 
 namespace Editor {
 
@@ -38,7 +40,7 @@
 
 /** This class contains all of the buttons, comboboxes, and other components */
 class EditorPanel : public GUI::Component, 
-       public GUI::CheckboxListener 
+       public GUI::CheckboxListener, public GUI::ComboboxListener
 {
 private:
        /** The EditorScreen to which this panel belongs */
@@ -53,6 +55,7 @@
        /** Combobox which can change it's item list based on the button 
pressed */
        GUI::Combobox* combobox_1;
        GUI::Combobox* combobox_2;
+       GUI::Combobox* combobox_3;
 
        /** Checkbox which controls the snap-to-grid functionality */
        GUI::Checkbox* snap_to_checkbox;
@@ -87,6 +90,9 @@
        
        /** Event that fires when a checkbox gets changed */
        void checkbox_changed(bool new_value, GUI::Checkbox* box);
+       
+       /** Event that fires when a combobox gets changed */
+       void combobox_changed(GUI::Combobox* box);
 
 
 private:

Modified: trunk/src/editor/editor_screen.cxx
===================================================================
--- trunk/src/editor/editor_screen.cxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/editor_screen.cxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -172,8 +172,21 @@
        }
        else
                GUIScreen::update(delta);
+}
 
+void
+EditorScreen::add_object(LevelObj* obj)
+{
+       plf->add_object(obj);
+       viewport->add_object(obj);
 }
 
+void
+EditorScreen::add_objects(std::vector<LevelObj*> objs)
+{
+       for (std::vector<LevelObj*>::const_iterator it = objs.begin(); it != 
objs.end(); it++)
+               add_object(*it);
+}
+
 } // Editor namespace
 } // Pingus namespace

Modified: trunk/src/editor/editor_screen.hxx
===================================================================
--- trunk/src/editor/editor_screen.hxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/editor_screen.hxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -32,6 +32,7 @@
 namespace Editor {
 
 class XMLLevel;
+class LevelObj;
 class EditorPanel;
 class EditorViewport;
 
@@ -85,6 +86,10 @@
        /** Return a pointer to the current level */
        XMLLevel* get_level() const { return plf; }
 
+       /** Add an object to both the XMLLevel and the EditorViewport */
+       void add_object(LevelObj* obj);
+       void add_objects(std::vector<LevelObj*> objs);
+
        /** Show a file dialog box */
        void show_file_dialog(bool for_loading);
 

Modified: trunk/src/editor/editor_viewport.cxx
===================================================================
--- trunk/src/editor/editor_viewport.cxx        2006-01-17 02:49:26 UTC (rev 
2601)
+++ trunk/src/editor/editor_viewport.cxx        2006-01-18 15:01:29 UTC (rev 
2602)
@@ -273,6 +273,12 @@
        objs = editor->get_level()->get_objects();
 }
 
+void 
+EditorViewport::add_object(LevelObj* obj)
+{
+       objs.push_back(obj);
+}
+
 } // Editor namespace
 } // Pingus namespace
 

Modified: trunk/src/editor/editor_viewport.hxx
===================================================================
--- trunk/src/editor/editor_viewport.hxx        2006-01-17 02:49:26 UTC (rev 
2601)
+++ trunk/src/editor/editor_viewport.hxx        2006-01-18 15:01:29 UTC (rev 
2602)
@@ -72,6 +72,10 @@
        /** Turns the "snap-to-grid" option on or off */
        void set_snap_to(bool s) { snap_to = s; }
 
+       /** Add an object to the currently displayed vector of objects */
+       void add_object(LevelObj* obj);
+
+       /** Return a pointer to the EditorScreen object */
        EditorScreen* get_screen() { return editor; }
 
 private:

Modified: trunk/src/editor/panel_buttons.cxx
===================================================================
--- trunk/src/editor/panel_buttons.cxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/panel_buttons.cxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -27,6 +27,8 @@
 #include "../resource.hxx"
 #include "editor_screen.hxx"
 #include "editor_panel.hxx"
+#include "level_objs.hxx"
+#include "xml_level.hxx"
 
 namespace Pingus {
 
@@ -149,18 +151,69 @@
 {
        PanelButton::on_primary_button_click(x, y);
 
-       // FIXME: Add actual groundpieces
        panel->get_combobox(1)->clear();
-       panel->get_combobox(1)->set_label("Groundpieces");
-       //std::vector<std::string> groundpieces = 
Resource::get_resources("sprite", "groundpieces");
+       panel->get_combobox(1)->set_label("Type");
+       panel->get_combobox(2)->set_label("Subtype");
+       panel->get_combobox(3)->set_label("Subtype 2");
        std::vector<std::string> groundpieces = 
Resource::get_sections("groundpieces");
        for (unsigned i = 0; i < groundpieces.size(); i++)
        {
-               panel->get_combobox(1)->add(new GUI::ComboItem(1, 
groundpieces[i]));
+               // We add each ComboItem to the first box:
+               // - The ID field of the ComboItem should be the full resource 
name.
+               // - The displayed field should only be the section name.
+               panel->get_combobox(1)->add(new GUI::ComboItem("groundpieces/" 
+ groundpieces[i], 
+                       groundpieces[i]));
        }
-       
        panel->get_combobox(1)->set_enabled(true);
 }
 
+// Populate the other comboboxes with the available resources.
+void
+PanelButtonGroundpiece::combobox_changed(int i, const std::string &value)
+{
+       std::string section;
+       if (i == 1)
+       {
+               // Populate the 2nd combobox with the next resource section & 
disable box 3.
+               panel->get_combobox(2)->clear();
+               panel->get_combobox(2)->set_enabled(true);
+               panel->get_combobox(3)->set_enabled(false);
+
+               std::vector<std::string> groundpieces = Resource::get_sections(
+                       
panel->get_combobox(1)->get_selected_item()->get_displayed_string());
+               for (std::vector<std::string>::const_iterator it = 
groundpieces.begin();
+                       it != groundpieces.end(); it++)
+                       panel->get_combobox(2)->add(new GUI::ComboItem(value + 
"/" + (*it), (*it)));            
+       }
+       else if (i == 2)
+       {
+               // Populate the 3rd combobox with the Resource ID's
+               panel->get_combobox(3)->clear();
+               panel->get_combobox(3)->set_enabled(true);
+
+               std::vector<std::string> groundpieces = Resource::get_resources(
+                       "sprite", value);
+               for (std::vector<std::string>::const_iterator it = 
groundpieces.begin();
+                       it != groundpieces.end(); it++)
+               {
+                       // new_value is the "displayed_string" for the combobox.
+                       std::string new_value = (*it).substr(value.length()+1);
+                       panel->get_combobox(3)->add(new GUI::ComboItem(value + 
"/" + new_value, 
+                       new_value));            
+               }
+       }
+       else
+       {
+               // 3rd box was selected - add the resource to the current level.
+               LevelObj* obj = new LevelObj("groundpiece", 
panel->get_screen()->get_level()->get_level_impl());
+               obj->set_res_desc(ResDescriptor(value));
+               obj->set_pos(Vector(0, 0, 0));
+               // 1st combobox displayed the "type" of resource (solid, 
transparent, etc.)
+               
obj->set_type(panel->get_combobox(1)->get_selected_item()->get_displayed_string());
+               panel->get_screen()->add_object(obj);
+       }
+}
+
+
 } // Editor namespace
 } // Pingus namespace

Modified: trunk/src/editor/panel_buttons.hxx
===================================================================
--- trunk/src/editor/panel_buttons.hxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/panel_buttons.hxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -99,6 +99,9 @@
        
        /** Action taken when the button is selected or not */
        virtual void select(bool s) { is_selected = s; }
+       
+       /** Event that fires when the first combobox has been changed */
+       virtual void combobox_changed(int i, const std::string &value) { }
 
 private:
        PanelButton (const PanelButton&);
@@ -169,8 +172,11 @@
        PanelButtonGroundpiece (EditorPanel* p);
 
        /** This function is called by the gui_manager when the button is 
clicked */
-       void on_primary_button_click (int x, int y);
+       virtual void on_primary_button_click (int x, int y);
 
+       /** Want to update the other comboboxes with the new groundpieces */
+       virtual void combobox_changed(int i, const std::string &value);
+
 private:
        PanelButtonGroundpiece ();
   PanelButtonGroundpiece (const PanelButtonGroundpiece&);

Modified: trunk/src/editor/xml_level.cxx
===================================================================
--- trunk/src/editor/xml_level.cxx      2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/xml_level.cxx      2006-01-18 15:01:29 UTC (rev 2602)
@@ -246,5 +246,11 @@
        impl->sort_objs();
 }
 
+void
+XMLLevel::add_object(LevelObj* obj)
+{
+       impl->objects.push_back(obj);
+}
+
 }      // Editor namespace
 }      // Pingus namespace

Modified: trunk/src/editor/xml_level.hxx
===================================================================
--- trunk/src/editor/xml_level.hxx      2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/editor/xml_level.hxx      2006-01-18 15:01:29 UTC (rev 2602)
@@ -51,7 +51,15 @@
        /** Load an existing level from a file */
        void load_level(const std::string& filename);
 
+       /** Return all objects in the level */
        std::vector<LevelObj*> get_objects() const { return impl->objects; }
+       
+       /** Add an object to the level */
+       void add_object(LevelObj* obj);
+       
+       /** Return LevelImpl */
+       LevelImpl* get_level_impl() { return impl; }
+       
 
 private:
        XMLLevel (const XMLLevel&);

Modified: trunk/src/graphic_context_state.cxx
===================================================================
--- trunk/src/graphic_context_state.cxx 2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/graphic_context_state.cxx 2006-01-18 15:01:29 UTC (rev 2602)
@@ -83,9 +83,9 @@
 {
   gc.push_modelview();
 
-  gc.translate(impl->width/2, impl->height/2);
+  gc.translate((float)impl->width/2, (float)impl->height/2);
   gc.rotate(impl->rotation);
-  gc.translate(-impl->width/2, -impl->height/2);
+  gc.translate(-(float)impl->width/2, -(float)impl->height/2);
 
   gc.scale(get_zoom(), get_zoom());
   gc.translate(impl->offset.x, impl->offset.y);
@@ -96,9 +96,9 @@
 {
   gc.push_modelview();
 
-  gc.translate(impl->width/2, impl->height/2);
+  gc.translate((float)impl->width/2, (float)impl->height/2);
   gc.rotate(impl->rotation);
-  gc.translate(-impl->width/2, -impl->height/2);
+  gc.translate(-(float)impl->width/2, -(float)impl->height/2);
 
   gc.scale(get_zoom(), get_zoom());
   gc.translate(impl->offset.x, impl->offset.y);
@@ -238,11 +238,11 @@
 GraphicContextState::screen2world(const CL_Point& pos_)
 {
   CL_Pointf pos = pos_;
-  float sa = sin(-impl->rotation/180.0f*M_PI);
-  float ca = cos(-impl->rotation/180.0f*M_PI);
+  float sa = (float)sin(-impl->rotation/180.0f*M_PI);
+  float ca = (float)cos(-impl->rotation/180.0f*M_PI);
 
-  float dx = pos.x - impl->width/2;
-  float dy = pos.y - impl->height/2;
+  float dx = pos.x - (float)impl->width/2;
+  float dy = pos.y - (float)impl->height/2;
 
   pos.x = impl->width/2  + (ca * dx - sa * dy);
   pos.y = impl->height/2 + (sa * dx + ca * dy);

Modified: trunk/src/gui/Makefile.am
===================================================================
--- trunk/src/gui/Makefile.am   2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/gui/Makefile.am   2006-01-18 15:01:29 UTC (rev 2602)
@@ -43,6 +43,7 @@
         surface_button.hxx \
         combobox.cxx \
         combobox.hxx \
+       combobox_listener.hxx \
                                checkbox.cxx \
                                checkbox.hxx \
                                checkbox_listener.hxx

Modified: trunk/src/gui/combobox.cxx
===================================================================
--- trunk/src/gui/combobox.cxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/gui/combobox.cxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -21,19 +21,21 @@
 #include <vector>
 #include <string>
 #include "combobox.hxx"
+#include "combobox_listener.hxx"
 #include "../fonts.hxx"
 
 namespace Pingus {
 namespace GUI {
 
 // Constructor
-Combobox::Combobox (Vector p, std::string l) :
+Combobox::Combobox (Vector p, ComboboxListener* listener_, std::string l) :
        current_item(0),
        drop_down(false),
        hover(false),
        pos(p),
        enabled(false),
-       label(l)
+       label(l),
+       listener(listener_)
 {
        // Default to 20 characters wide.
        width = Fonts::smallfont.get_width('O') * 20.0f;
@@ -118,9 +120,12 @@
        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)];
-               drop_down = false;
+                       listener->combobox_changed(this);
+               }
        }
        else
        {
@@ -150,20 +155,21 @@
        {
                // Draw the highlighted box
                int y_offset = int(int(((mouse_pos.y - pos.y - 
height)/height)+1) * height);
-               gc.draw_fillrect(pos.x, y_offset, pos.x + get_width(), y_offset 
+ height, CL_Color::gray);
+               gc.draw_fillrect(pos.x, pos.y + y_offset, pos.x + get_width(), 
pos.y + y_offset + 
+                       height, CL_Color::gray);
                
                // Draw all of the items
                for (unsigned i = 0; i < item_list.size(); i++)
                {
                        gc.print_left(Fonts::smallfont, pos.x + 5.0f, pos.y + 
((i + 1) * height), 
-                               item_list[i]->get_string(), 5000);
+                               item_list[i]->get_displayed_string());
                }
        }
 
        if (current_item)
        {
                // Print the currently selected item
-               gc.print_left(Fonts::smallfont, pos.x + 3.0f, pos.y, 
current_item->get_string());
+               gc.print_left(Fonts::smallfont, pos.x + 3.0f, pos.y, 
current_item->get_displayed_string());
        }
 }
 

Modified: trunk/src/gui/combobox.hxx
===================================================================
--- trunk/src/gui/combobox.hxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/gui/combobox.hxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -28,13 +28,15 @@
 namespace Pingus {
 
 namespace GUI {
+       
+       class ComboboxListener;
 
 /** A ComboItems holds a specific item in a Combobox (string, id, etc.) */
 class ComboItem
 {
 protected:
        /* The item's hidden ID field */
-       int                                     id;
+       std::string id;
 
        /** string that displays when printed on the Combobox */
        std::string str;
@@ -45,29 +47,27 @@
 public:
        /** Constructors */
        ComboItem () { delete_item = true; }
-       ComboItem (int i, std::string s, bool d = true) 
-       {
-               id = i;
-               str =s;
-               delete_item = d;
+       ComboItem (std::string id_, std::string displayed_string, bool d = 
true) 
+               : id(id_), str(displayed_string), delete_item(d) 
+       { 
        }
 
        virtual ~ComboItem () { }
 
        /** Returns this item's ID */
-       int get_id() { return id; }
+       std::string get_id() { return id; }
 
        /** Returns this item's string */
-       std::string get_string() { return str; }
+       std::string get_displayed_string() { return str; }
 
        /** Returns the value of del_item */
        bool delete_it() { return delete_item; }
 
        /** Set this item's ID */
-       void set_id(int i) { id = i; }
+       void set_id(std::string s) { id = s; }
 
        /** Set this item's string */
-       void set_string(std::string s) { str = s; }
+       void set_displayed_string(std::string s) { str = s; }
 
 private:
   ComboItem (const ComboItem&);
@@ -112,10 +112,13 @@
        
        /** Label that prints to the left of the drop-down */
        std::string label;
+       
+       /** The "owner" of this combobox */
+       ComboboxListener* listener;
 
 public:
        /** Constructor */
-       Combobox (Vector p, std::string label = "");
+       Combobox (Vector p, ComboboxListener* listener, std::string label = 
std::string());
        
        /** Destructor */
        virtual ~Combobox ();
@@ -157,7 +160,7 @@
        
        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 = Vector(x, y); }
+       virtual void on_pointer_move(int x, int y) { mouse_pos = 
Vector((float)x, (float)y); }
        
        /** Sets whether or not this combobox is clickable */
        virtual void set_enabled(bool e) { enabled = e; }

Added: trunk/src/gui/combobox_listener.hxx
===================================================================
--- trunk/src/gui/combobox_listener.hxx 2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/gui/combobox_listener.hxx 2006-01-18 15:01:29 UTC (rev 2602)
@@ -0,0 +1,40 @@
+//  $Id: checkbox_listener.hxx,v 1.00 2006/1/17 23:41:12 Jave27 Exp $
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2006 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_PINGUS_GUI_COMBOBOX_LISTENER_HXX
+#define HEADER_PINGUS_GUI_COMBOBOX_LISTENER_HXX
+
+namespace Pingus {
+
+namespace GUI {
+       
+       class Combobox;
+
+class ComboboxListener {
+public:
+       virtual void combobox_changed(Combobox* box) = 0;
+       virtual ~ComboboxListener() { }
+};     // ComboboxListener class
+
+}      // GUI namespace
+}      // Pingus namespace
+
+#endif
+
+/* EOF */


Property changes on: trunk/src/gui/combobox_listener.hxx
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/src/resource.cxx
===================================================================
--- trunk/src/resource.cxx      2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/resource.cxx      2006-01-18 15:01:29 UTC (rev 2602)
@@ -81,17 +81,14 @@
 }
 
 
-// Returns a list of sections
+// Returns a list of sections.  Returns all sections if left blank.
 std::vector<std::string>
 Resource::get_sections(const std::string& section)
 {
        if (section == std::string())
                return resmgr.get_all_sections();
        else
-               // FIXME: This patch hasn't been applied to ClanLib yet.
-               // return resmgr.get_sections(section);
-               // The following is wrong.
-               return resmgr.get_all_sections();
+               return resmgr.get_sections(section);
 }
 
 

Modified: trunk/src/start_screen.cxx
===================================================================
--- trunk/src/start_screen.cxx  2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/start_screen.cxx  2006-01-18 15:01:29 UTC (rev 2602)
@@ -73,7 +73,7 @@
 
   void draw(DrawingContext& gc) {
     SurfaceButton::draw(gc);
-    gc.print_center(Fonts::chalk_normal, x_pos + 32, y_pos - 17, _("Ok"));
+    gc.print_center(Fonts::chalk_normal, (float)x_pos + 32, (float)y_pos - 17, 
_("Ok"));
   }
 
   void on_click()
@@ -109,7 +109,7 @@
 
   void draw(DrawingContext& gc) {
     SurfaceButton::draw(gc);
-    gc.print_center(Fonts::chalk_normal, x_pos + 55, y_pos, _("Abort"));
+    gc.print_center(Fonts::chalk_normal, (float)x_pos + 55, (float)y_pos, 
_("Abort"));
   }
 
   void on_click() {
@@ -148,7 +148,7 @@
 void
 StartScreenComponent::draw(DrawingContext& gc)
 {
-  background.draw(CL_Display::get_width()/2,CL_Display::get_height()/2);
+  
background.draw((float)CL_Display::get_width()/2,(float)CL_Display::get_height()/2);
 
   int left_x  = CL_Display::get_width()/2 - 120;
   int right_x = CL_Display::get_width()/2 + 120;
@@ -156,33 +156,29 @@
 
   gc.print_center(Fonts::chalk_large,
                   gc.get_width()/2,
-                  CL_Display::get_height()/2 - 200,
+                  (float)CL_Display::get_height()/2 - 200,
                   _(plf.get_levelname()));
 
   gc.print_left(Fonts::chalk_normal,
-                CL_Display::get_width()/2 - 290,
-                CL_Display::get_height()/2 - 140,
+                (float)CL_Display::get_width()/2 - 290,
+                (float)CL_Display::get_height()/2 - 140,
                 format_description(800 - 230));
 
-  gc.print_left (Fonts::chalk_normal, left_x,  y, _("Number of Pingus: "));
-  gc.print_right(Fonts::chalk_normal, right_x, y, 
CL_String::to(plf.get_number_of_pingus()));
+  gc.print_left (Fonts::chalk_normal, (float)left_x,  (float)y, _("Number of 
Pingus: "));
+  gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y, 
CL_String::to(plf.get_number_of_pingus()));
 
-  gc.print_left (Fonts::chalk_normal, left_x,  y += 30, _("Number to Save: "));
-  gc.print_right(Fonts::chalk_normal, right_x, y, 
CL_String::to(plf.get_number_to_save()));
+  gc.print_left (Fonts::chalk_normal, (float)left_x,  float(y += 30), 
_("Number to Save: "));
+  gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y, 
CL_String::to(plf.get_number_to_save()));
 
-  gc.print_left (Fonts::chalk_normal, left_x,  y += 30, _("Time: "));
-  gc.print_right(Fonts::chalk_normal, right_x, y, time_str);
+  gc.print_left (Fonts::chalk_normal, (float)left_x,  float(y += 30), _("Time: 
"));
+  gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y, time_str);
 
-  gc.print_left (Fonts::chalk_normal, left_x,  y += 30, _("Difficulty:"));
-  gc.print_right(Fonts::chalk_normal, right_x, y, 
CL_String::to(plf.get_difficulty()) + "/100");
+  gc.print_left (Fonts::chalk_normal, (float)left_x,  float(y += 30), 
_("Difficulty:"));
+  gc.print_right(Fonts::chalk_normal, (float)right_x, (float)y, 
CL_String::to(plf.get_difficulty()) + "/100");
 
-  /*for (int i = 0; plf.get_difficulty())
-    {
-    }*/
+  gc.print_center(Fonts::chalk_small, (float)CL_Display::get_width()/2,
+                  (float)CL_Display::get_height()/2 + 270, _("Author: ") + 
plf.get_author());
 
-  gc.print_center(Fonts::chalk_small, CL_Display::get_width()/2,
-                  CL_Display::get_height()/2 + 270, _("Author: ") + 
plf.get_author());
-
   if (maintainer_mode)
     gc.print_left(Fonts::chalk_small, 110, 430, _("Filename: ") + 
plf.get_resname());
 

Modified: trunk/src/worldmap/worldmap.cxx
===================================================================
--- trunk/src/worldmap/worldmap.cxx     2006-01-17 02:49:26 UTC (rev 2601)
+++ trunk/src/worldmap/worldmap.cxx     2006-01-18 15:01:29 UTC (rev 2602)
@@ -185,7 +185,7 @@
        // Blank out the screen in case the screen resolution is larger than
        // the worldmap picture.
        // FIXME:  Should probably scale everything to match the resolution 
instead.
-       gc.draw_fillrect(0, 0, CL_Display::get_width(), 
CL_Display::get_height(),
+       gc.draw_fillrect(0, 0, (float)CL_Display::get_width(), 
(float)CL_Display::get_height(),
                CL_Color::black, -15000);
                
   for (DrawableLst::iterator i = drawables.begin (); i != drawables.end (); 
++i)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]