pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r2939 - branches/pingus_sdl/src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2939 - branches/pingus_sdl/src
Date: Wed, 15 Aug 2007 23:32:20 +0200

Author: grumbel
Date: 2007-08-15 23:32:19 +0200 (Wed, 15 Aug 2007)
New Revision: 2939

Removed:
   branches/pingus_sdl/src/target_provider.cpp
   branches/pingus_sdl/src/target_provider.hpp
   branches/pingus_sdl/src/theme.cpp
   branches/pingus_sdl/src/theme.hpp
   branches/pingus_sdl/src/theme_selector.cpp
   branches/pingus_sdl/src/theme_selector.hpp
Log:
- removed some unused files

Deleted: branches/pingus_sdl/src/target_provider.cpp
===================================================================
--- branches/pingus_sdl/src/target_provider.cpp 2007-08-15 20:53:38 UTC (rev 
2938)
+++ branches/pingus_sdl/src/target_provider.cpp 2007-08-15 21:32:19 UTC (rev 
2939)
@@ -1,43 +0,0 @@
-//  $Id: target_provider.cxx,v 1.4 2003/10/21 21:37:06 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2000 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 <ClanLib/Display/pixel_buffer.h>
-#include "target_provider.hpp"
-
-
-CL_Canvas*
-TargetProvider::create_canvas (CL_Target* target)
-{
-  CL_Canvas* canvas;
-  float r, g, b, a;
-
-  canvas = new CL_Canvas (target->get_width (), target->get_height ());
-
-  for (int y_pos = 0; y_pos < (int) canvas->get_height (); y_pos++)
-    for (int x_pos = 0; x_pos < (int) canvas->get_width (); x_pos++)
-      {
-       target->get_pixel (x_pos, y_pos, &r, &g, &b, &a);
-       canvas->draw_pixel (x_pos, y_pos, r, g, b);
-      }
-
-  return canvas;
-}
-
-
-/* EOF */

Deleted: branches/pingus_sdl/src/target_provider.hpp
===================================================================
--- branches/pingus_sdl/src/target_provider.hpp 2007-08-15 20:53:38 UTC (rev 
2938)
+++ branches/pingus_sdl/src/target_provider.hpp 2007-08-15 21:32:19 UTC (rev 
2939)
@@ -1,67 +0,0 @@
-//  $Id: target_provider.hxx,v 1.8 2003/10/20 19:28:54 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2000 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_TARGET_PROVIDER_HXX
-#define HEADER_PINGUS_TARGET_PROVIDER_HXX
-
-#include "pingus.hpp"
-#include <ClanLib/Display/pixel_buffer.h>
-
-class CL_Target;
-class CL_Palette;
-class CL_Canvas;
-
-
-class TargetProvider : public PixelBuffer
-{
-private:
-  CL_Target* target;
-  TargetProvider () {}
-
-public:
-  TargetProvider (CL_Target* t) { target = t; }
-  virtual ~TargetProvider () {}
-
-  void lock () { target->lock(); }
-  void unlock () { target->unlock(); }
-  void* get_data () const { return target->get_data (); }
-  bool  is_indexed () const { return target->get_type() ==  pixelformat_index; 
}
-  unsigned int get_num_frames () const { return target->get_num_frames (); }
-  unsigned int get_width () const { return target->get_width (); }
-  unsigned int get_height () const { return target->get_height (); }
-  unsigned int get_pitch () const { return target->get_pitch (); }
-  unsigned int get_red_mask () const { return target->get_red_mask (); }
-  unsigned int get_green_mask () const { return target->get_green_mask (); }
-  unsigned int get_blue_mask () const { return target->get_blue_mask (); }
-  unsigned int get_alpha_mask () const { return target->get_alpha_mask (); }
-  CL_Palette*  get_palette () const { return target->get_palette (); }
-  bool uses_src_colorkey() const { return false; }
-  unsigned int get_src_colorkey () const { return 0; }
-
-  static CL_Canvas* create_canvas (CL_Target*);
-
-private:
-  TargetProvider (const TargetProvider&);
-  TargetProvider& operator= (const TargetProvider&);
-};
-
-
-#endif
-
-/* EOF */

Deleted: branches/pingus_sdl/src/theme.cpp
===================================================================
--- branches/pingus_sdl/src/theme.cpp   2007-08-15 20:53:38 UTC (rev 2938)
+++ branches/pingus_sdl/src/theme.cpp   2007-08-15 21:32:19 UTC (rev 2939)
@@ -1,353 +0,0 @@
- //  $Id: theme.cxx,v 1.23 2003/10/22 11:11:22 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 1999 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 <fstream>
-#include <iostream>
-#include <ClanLib/Core/System/error.h>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Display/font.h>
-#include <ClanLib/Display/keyboard.h>
-#include "path_manager.hpp"
-#include "gettext.h"
-#include "system.hpp"
-#include "resource.hpp"
-#include "pingus_error.hpp"
-#include "plf_res_mgr.hpp"
-#include "game_session.hpp"
-#include "globals.hpp"
-#include "theme.hpp"
-#include "xml_pingus_level.hpp"
-#include "fonts.hpp"
-#include "gui/screen_manager.hpp"
-
-
-Theme::Theme (const std::string& filename_)
-  : font(Fonts::pingus_small),
-    title(Fonts::pingus_large),
-    filename (filename_),
-    is_loaded(false)
-{
-}
-
-Theme::~Theme ()
-{
-}
-
-void
-Theme::load (const std::string& filename)
-{
-  if (verbose) std::cout << "Theme: loading: " << filename << std::endl;
-  plt.parse(filename);
-  
-  title_name = _(plt.get_name());
-
-  level_filenames = plt.get_levels();
-  load_levels();
-
-  if (_(plt.get_description()) != "-")
-    {
-      description.set_font(font);
-      description.set_text(_(plt.get_description()), 350);
-      has_description = true;
-    }
-  else
-    {
-      has_description = false;
-    }
-
-  try
-    {
-      //if (plt.get_background().desc.res_name != "-")
-      background = Resource::load_surface("textures/default");
-    }
-  catch (CL_Error& err)
-    {
-      if (verbose)
-       {
-         std::cout << "Theme:" << filename  << ":" << err.message << std::endl;
-         std::cout << "Theme: Ignoring missing resource, disable background." 
<< std::endl;
-       }
-    }
-  load_status(filename);
-}
-
-int
-Theme::mark_level_at_point(int x, int y)
-{
-#ifdef CLANLIB_0_6
-  preload ();
-
-  int j = 0;
-  int y_pos = level_start_y_pos;
-
-  for(std::vector<std::string>::iterator i = levelnames.begin();
-      i < levelnames.end();
-      ++i, ++j)
-    {
-      int width = font.get_text_width(i->c_str());
-
-      if ((CL_Display::get_width()/2 - width/2) < x
-         && (CL_Display::get_width()/2 + width/2) > x
-         && y_pos < y
-         && (y_pos + font.get_height()) > y)
-       {
-         if (j <= accessible_levels)
-           {
-             current_level = j;
-             // std::cout << "Current_level: " << current_level << std::endl;
-             return current_level;
-           }
-         return -1;
-       }
-      y_pos += font.get_height() + 4;
-    }
-#endif
-  return -1;
-}
-
-void
-Theme::draw_title()
-{
-#ifdef CLANLIB_0_6
-  preload ();
-
-  int x_center =  CL_Display::get_width() / 2;
-  int x_pos = x_center;
-  int y_pos = 10;
-
-  if (!background)
-    {
-      CL_Display::clear();
-    }
-  else
-    {
-      // Fill the screen with the background surface
-      for(int y=0; y < CL_Display::get_height(); y += background.get_height())
-       {
-         for(int x=0; x < CL_Display::get_width(); x += background.get_width())
-           background.draw(x, y);
-       }
-    }
-
-  if (title_name != "-")
-    {
-      title->print_center(x_center, y_pos, title_name.c_str());
-      y_pos += 50;
-    }
-
-  if (surface)
-    {
-      x_pos -= surface.get_width() / 2;
-      surface.draw(x_pos, y_pos);
-
-      y_pos += surface.get_height() + 20;
-    }
-
-  y_pos += 15;
-  if (has_description)
-    {
-      CL_Display::fill_rect(x_center - (description.get_width()/2) - 15,
-                           y_pos - 15,
-                           x_center + (description.get_width()/2) + 15,
-                           y_pos + description.get_height() + 15,
-                           0.0, 0.0, 0.0, 0.5);
-
-      description.print_center(x_center, y_pos);
-    }
-
-  y_pos += description.get_height() + 15 + 20;
-  int j = 0;
-
-  level_start_y_pos = y_pos;
-
-  for(std::vector<std::string>::iterator i = levelnames.begin(); i != 
levelnames.end(); ++i)
-    {
-      if (j > accessible_levels)
-       {
-         // Level is not yet accessible
-         font.print_center(x_center, y_pos, (*i).c_str());
-         CL_Display::fill_rect(x_center - font.get_text_width(i->c_str())/2 - 
1,
-                               y_pos - 1,
-                               x_center + font.get_text_width(i->c_str())/2 + 
1,
-                               y_pos + font.get_height() + 1,
-                               0.0, 0.0, 0.0, 0.5);
-       }
-      else if (j == current_level)
-       {
-         // Level is accessible
-         CL_Display::fill_rect(x_center - font.get_text_width(i->c_str())/2 - 
1,
-                               y_pos - 1,
-                               x_center + font.get_text_width(i->c_str())/2 + 
1,
-                               y_pos + font.get_height() + 1,
-                               0.0f, 0.0f, 0.0f, 1.0f);
-         CL_Display::draw_rect(x_center - font.get_text_width(i->c_str())/2 - 
1,
-                               y_pos - 1,
-                               x_center + font.get_text_width(i->c_str())/2 + 
1,
-                               y_pos + font.get_height() + 1,
-                               1.0f, 1.0f, 1.0f, 1.0f);
-         font.print_center(x_center, y_pos, (*i).c_str());
-       }
-      else
-       {
-         font.print_center(x_center, y_pos, (*i).c_str());
-       }
-      ++j;
-      y_pos += font.get_height() + 4;
-    }
-#endif
-}
-
-void
-Theme::load_status(std::string name)
-{
-  status_file = System::basename(name);
-  std::string rawname  = status_file.substr(0, status_file.rfind("."));
-
-  if (verbose > 1) std::cout << "Filename: " << status_file << std::endl;
-  if (verbose > 1) std::cout << "Rawfile: " << status_file.substr(0, 
status_file.rfind(".")) << std::endl;
-
-  status_file = System::get_statdir() + "savegames/" + rawname + ".pst";
-
-  if (verbose > 1) std::cout << "Filename to open: " << status_file << 
std::endl;
-
-  if (System::exist(status_file))
-    {
-      std::ifstream in;
-      in.open(status_file.c_str());
-      in >> accessible_levels;
-      in.close();
-    }
-  else
-    {
-      if (verbose) std::cout << "Theme: No Savegame for this theme found" << 
std::endl;
-      accessible_levels = 0;
-    }
-
-  if ((unsigned int)(accessible_levels) >= level_filenames.size())
-    {
-      if (verbose) std::cout << "Warning: Accessible_Level is to high! " << 
accessible_levels << std::endl;
-      accessible_levels = static_cast<int>(level_filenames.size()) - 1;
-    }
-  current_level = accessible_levels;
-}
-
-void
-Theme::play()
-{
-  preload ();
-
-  try
-    {
-      assert (!"Theme::play unimplemented");
-
-      ScreenManager::instance()->push_screen
-       (new 
PingusGameSession(PLFResMgr::load_plf(plt.get_levels()[current_level]), true),
-         true);
-
-      if (current_level == accessible_levels)
-       ++accessible_levels;
-
-      if ((unsigned int)(accessible_levels) >= level_filenames.size())
-       accessible_levels = static_cast<int>(level_filenames.size()) - 1;
-
-      std::ofstream out (status_file.c_str());
-      out << accessible_levels;
-      out.close();
-    }
-
-  catch (PingusError& err)
-    {
-      std::cout <<  "Pingus_Error: " << err.get_message () << std::endl;
-    }
-
-  // Wait for escape release
-  while (CL_Keyboard::get_keycode (CL_KEY_ESCAPE))
-    CL_System::keep_alive ();
-}
-
-void
-Theme::next_level()
-{
-  preload ();
-
-  ++current_level;
-
-  if ((unsigned int)(current_level) >= level_filenames.size())
-    current_level = static_cast<int>(level_filenames.size()) - 1;
-
-  if (current_level > accessible_levels)
-    current_level  = accessible_levels;
-
-  //std::cout << "Level: " << current_level << std::endl;
-}
-
-void
-Theme::previous_level()
-{
-  preload ();
-
-  current_level--;
-
-  if (current_level < 0)
-    current_level = 0;
-
-  //  std::cout << "Level: " << current_level << std::endl;
-}
-
-void
-Theme::load_levels()
-{
-  std::string filename;
-
-  if (verbose)
-    std::cout << "Theme opening levels... " << std::flush;
-
-  for(std::vector<std::string>::iterator i = level_filenames.begin();
-      i != level_filenames.end(); ++i)
-    {
-      filename = path_manager.complete("levels/" + *i);
-
-      try
-             {
-                XMLPingusLevel plf(filename, filename);
-               levelnames.push_back(_(plf.get_levelname()));
-             }
-           catch (PingusError& err)
-             {
-               std::cout << "Theme: PingusError: " << err.get_message () << 
std::endl;
-             }
-    }
-  if (verbose)
-    std::cout << "done." << std::endl;
-
-  std::cout << "Levelnames: " << static_cast<unsigned>(levelnames.size()) << 
std::endl;
-}
-
-void
-Theme::preload ()
-{
-  if (!is_loaded)
-    {
-      load(filename);
-      is_loaded = true;
-    }
-}
-
-
-/* EOF */

Deleted: branches/pingus_sdl/src/theme.hpp
===================================================================
--- branches/pingus_sdl/src/theme.hpp   2007-08-15 20:53:38 UTC (rev 2938)
+++ branches/pingus_sdl/src/theme.hpp   2007-08-15 21:32:19 UTC (rev 2939)
@@ -1,93 +0,0 @@
-//  $Id: theme.hxx,v 1.9 2003/10/21 21:37:06 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 1999 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_THEME_HXX
-#define HEADER_PINGUS_THEME_HXX
-
-#include <ClanLib/Display/surface.h>
-#include "multiline_text.hpp"
-#include "plt_xml.hpp"
-
-class CL_Font;
-
-
-class Theme
-{
-private:
-  PLTXML plt;
-  CL_Surface surface;
-  CL_Surface background;
-  CL_Font font;
-  CL_Font title;
-
-  /** The last level, which is accessible */
-  int      accessible_levels;
-
-  /** The currently selected level, valid in the interval [0,
-      accessible_levels */
-  int      current_level;
-  std::string filename;
-
-  /** The name of the levels, this is was is displayed */
-  std::vector<std::string> levelnames;
-
-  /** The filenames of the levels */
-  std::vector<std::string> level_filenames;
-
-  std::string title_name;
-  std::string status_file;
-
-  /** This is the position at which the levelnames are printed, it is
-      used to calculate mark_level_at_point() */
-  int level_start_y_pos;
-
-  bool has_description;
-  MultiLineText description;
-
-  bool is_loaded;
-
-  void load_status(std::string);
-  void load_levels();
-
-public:
-  Theme (const std::string& filename);
-  ~Theme ();
-
-  void preload ();
-
-  /** Marks the level, which is under the given coordinates
-      @param x X-Position (normaly CL_Mouse::get_x())
-      @param y Y-Position (normaly CL_Mouse::get_y()) */
-  int mark_level_at_point (int x, int y);
-  void next_level ();
-  void previous_level ();
-  void load (const std::string& filename);
-  void draw_title ();
-  void play ();
-
-private:
-  Theme (const Theme&);
-  Theme& operator= (const Theme&);
-};
-
-
-#endif
-
-/* EOF */

Deleted: branches/pingus_sdl/src/theme_selector.cpp
===================================================================
--- branches/pingus_sdl/src/theme_selector.cpp  2007-08-15 20:53:38 UTC (rev 
2938)
+++ branches/pingus_sdl/src/theme_selector.cpp  2007-08-15 21:32:19 UTC (rev 
2939)
@@ -1,373 +0,0 @@
-//  $Id: theme_selector.cxx,v 1.17 2003/10/22 11:11:22 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 1999 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 <config.h>
-
-#include <iostream>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Display/font.h>
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/mouse.h>
-#include <ClanLib/Core/System/system.h>
-
-#include "gui/display.hpp"
-#include "globals.hpp"
-#include "theme_selector.hpp"
-#include "pingus_error.hpp"
-#include "resource.hpp"
-#include "sound/sound.hpp"
-#include "path_manager.hpp"
-#include "system.hpp"
-#include "fonts.hpp"
-#include "theme.hpp"
-
-
-ListBox::ListBox ()
-{
-}
-
-void
-ListBox::draw_offset(int x, int y)
-{
-  int i = 0;
-  CL_Display::fill_rect(CL_Rect(x, y, x + 200, CL_Display::get_height() - 20),
-                       Display::to_color(0.0, 0.0, 0.0, 0.5));
-  for(ListIter item = items.begin(); item != items.end(); ++item) {
-    item->draw_offset(x, y + (i++ * 20)); // FIXME i++ is a bit ambigious here
-  }
-}
-
-void
-ListBox::add_item(std::string l)
-{
-  items.push_back(ListItem(l));
-}
-
-// ---=== List item ===---
-
-ListItem::ListItem(std::string l)
-{
-  label = l;
-  font = Fonts::smallfont_h;
-}
-
-ListItem::ListItem (const ListItem& old) 
-  : label(old.label),
-    font(old.font)
-{
-}
-
-ListItem&
-ListItem::operator= (const ListItem& old)
-{
-  if (this == &old)
-    return *this;
-
-  label = old.label;
-  font  = new CL_Font(*(old.font));
-
-  return *this;
-}
-
-void
-ListItem::draw_offset(int x, int y)
-{
-  font->print_left(x, y, label.c_str());
-}
-
-// ---=== ThemeSelector ===---
-
-void
-ThemeSelector::Event::on_button_release(const CL_InputEvent& event)
-{
-  if (!enabled) return;
-}
-
-void
-ThemeSelector::Event::on_button_press(const CL_InputEvent& event)
-{
-  if (!enabled) return;
-
-  if (device == CL_Input::keyboards[0])
-    {
-      switch (key.id)
-       {
-       case CL_KEY_ESCAPE:
-         theme_selector->finished = true;
-         break;
-       case CL_KEY_LEFT:
-         theme_selector->current_theme++;
-         if (theme_selector->current_theme == theme_selector->themes.end())
-           theme_selector->current_theme = theme_selector->themes.begin();
-         break;
-
-       case CL_KEY_RIGHT:
-         if (theme_selector->current_theme == theme_selector->themes.begin())
-           theme_selector->current_theme = theme_selector->themes.end();
-         theme_selector->current_theme--;
-         break;
-
-       case CL_KEY_DOWN:
-         (*(theme_selector->current_theme))->next_level();
-         break;
-       case CL_KEY_UP:
-         (*(theme_selector->current_theme))->previous_level();
-         break;
-
-       case CL_KEY_ENTER:
-         enabled = false;
-         loading_screen.draw();
-         (*(theme_selector->current_theme))->play();
-         enabled = true;
-         PingusSound::play_music("pingus-1.it");
-         break;
-       }
-    }
-  else if (device == CL_Input::pointers[0])
-    {
-      int tmp_level;
-      switch (key.id)
-       {
-       case CL_MOUSE_LEFTBUTTON: // Left mouse button
-         tmp_level = theme_selector->mark_level_at_point(int(key.x), 
int(key.y));
-         if (tmp_level != -1)
-           {
-             // We clicked on a level, start it now.
-             enabled = false;
-             loading_screen.draw();
-             (*(theme_selector->current_theme))->play();
-             enabled = true;
-           }
-         else
-           {
-             // Check if we clicked on one of the red buttons
-             if (key.x > 0 && key.x < theme_selector->left_arrow.get_width()
-                 && key.y > (CL_Display::get_height() - 
theme_selector->left_arrow.get_height()) / 2
-                 && key.y < (CL_Display::get_height() + 
theme_selector->left_arrow.get_height()) / 2)
-               {
-                 theme_selector->current_theme++;
-                 if (theme_selector->current_theme == 
theme_selector->themes.end())
-                   theme_selector->current_theme = 
theme_selector->themes.begin();
-               }
-             else if (key.x > CL_Display::get_width() - 
theme_selector->right_arrow.get_width()
-                      && key.x < CL_Display::get_width()
-                      && key.y > (CL_Display::get_height() - 
theme_selector->right_arrow.get_height()) / 2
-                      && key.y < (CL_Display::get_height() + 
theme_selector->right_arrow.get_height()) / 2)
-               {
-                 if (theme_selector->current_theme == 
theme_selector->themes.begin())
-                   theme_selector->current_theme = 
theme_selector->themes.end();
-                 theme_selector->current_theme--;
-               }
-             else if (key.x < theme_selector->back.get_width()
-                      && key.y < theme_selector->back.get_height())
-               {
-                 theme_selector->finished = true;
-               }
-           }
-         break;
-       case CL_MOUSE_MIDDLEBUTTON: // Middle mouse
-         theme_selector->finished = true;
-         break;
-       default:
-         break;
-       }
-    }
-
-  theme_selector->draw();
-
-  return;
-}
-
-void
-ThemeSelector::Event::on_mouse_move(CL_InputDevice *, int mouse_x, int mouse_y)
-{
-  //std::cout << "Event: on_mouse_move called.." << std::endl;
-  if (!enabled) return;
-  //std::cout << "Event: on_mouse_move active.." << std::endl;
-  theme_selector->mark_level_at_point(mouse_x, mouse_y);
-}
-
-ThemeSelector::ThemeSelector()
-{
-  dir_read = false;
-  title_font = Fonts::pingus_large;
-  theme_font = Fonts::pingus_small;
-
-  left_arrow  = Resource::load_surface("Hotspots/left_arrow", "global");
-  right_arrow = Resource::load_surface("Hotspots/right_arrow", "global");
-  back        = Resource::load_surface("buttons/back", "core");
-
-  event = new ThemeSelector::Event;
-  event->enabled = false;
-
-  event->theme_selector = this;
-
-  //CL_Input::chain_button_press.push_back(event);
-  //CL_Input::chain_button_release.push_back(event);
-  //CL_Input::chain_mouse_move.push_back(event);
-
-  current_theme = themes.end();
-
-  ////on_button_press_slot = CL_Input::sig_button_press ().connect (event, 
&ThemeSelector::Event::on_button_press);
-  ////on_button_release_slot = CL_Input::sig_button_release ().connect (event, 
&ThemeSelector::Event::on_button_release);
-  ////on_mouse_move_slot = CL_Input::sig_mouse_move ().connect (event, 
&ThemeSelector::Event::on_mouse_move);
-}
-
-ThemeSelector::~ThemeSelector()
-{
-  // FIXME: Deleting the stuff which was allocated in readdir()
-  // FIXME: Should be rewritten
-  for(std::vector<Theme*>::iterator i = themes.begin(); i != themes.end(); ++i)
-    delete (*i);
-
-  // CL_Input::chain_mouse_move.remove(event);
-  // CL_Input::chain_button_press.remove(event);
-  // CL_Input::chain_button_release.remove(event);
-
-  ////CL_Input::sig_button_press ().disconnect (on_button_press_slot);
-  ////CL_Input::sig_button_release ().disconnect (on_button_release_slot);
-  ////CL_Input::sig_mouse_move ().disconnect (on_mouse_move_slot);
-
-  delete event;
-}
-
-void
-ThemeSelector::display()
-{
-  event->enabled = true;
-
-  while(CL_Mouse::left_pressed() || CL_Mouse::middle_pressed())
-    CL_System::keep_alive();
-
-  if (!dir_read)
-    {
-      loading_screen.draw();
-
-      readdir(path_manager.complete("themes/"));
-
-      dir_read = true;
-    }
-  current_theme = themes.end()-1;
-
-  PingusSound::play_music("pingus-1.it");
-
-  finished = false;
-  while(!finished)
-    {
-      CL_System::keep_alive();
-      draw();
-      CL_System::sleep (20);
-    }
-
-  while (CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
-    CL_System::keep_alive ();
-
-  event->enabled = false;
-}
-
-void
-ThemeSelector::draw()
-{
-  //CL_Display::fill_rect(0,0,640,480,0.5,0.0,0.0,0.5);
-
-  (*current_theme)->draw_title();
-
-  {
-    int item_width = (CL_Display::get_width() / themes.size());
-    int item_index = themes.size() - std::distance(themes.begin(), 
current_theme) - 1;
-
-    Display::draw_rect(item_index * item_width, CL_Display::get_height() - 15,
-                      (item_index + 1) * item_width, CL_Display::get_height(),
-                      0.0, 1.0, 0.0, 1.0);
-  }
-
-  left_arrow.draw(0, (CL_Display::get_height() - left_arrow.get_height()) / 2);
-  right_arrow.draw(CL_Display::get_width() - right_arrow.get_width(),
-                         (CL_Display::get_height() - right_arrow.get_height()) 
/ 2);
-  back.draw(0, 0);
-  if (CL_Mouse::get_x() < (int)back.get_width()
-      && CL_Mouse::get_y() < (int)back.get_height())
-    CL_Display::fill_rect(0, 0, back.get_width(), back.get_height(),
-                         1.0f, 1.0f, 1.0f, 0.3f);
-
-  theme_font->print_center(CL_Display::get_width()/2, CL_Display::get_height() 
- 50,
-                          "..:: Use the cursor keys to select a level ::..");
-
-  Display::flip_display();
-}
-
-void
-ThemeSelector::readdir(std::string path)
-{
-  System::Directory dir;
-  std::string pathname;
-  std::string::size_type pos = 0;
-  std::string::size_type last_pos = 0;
-  bool exit_for = false;
-
-  // Remove this and pingus_datadir should become a vector
-  for(pos = path.find(":", last_pos);
-      !exit_for;
-      last_pos = pos + 1, pos = path.find(":", last_pos))
-    {
-      if (pos == std::string::npos)
-       {
-         pathname = path.substr(last_pos, std::string::npos);
-         exit_for = true;
-       }
-      else
-       {
-         pathname = path.substr(last_pos, pos - last_pos);
-       }
-
-      std::cout << "ThemeSelector: " << pathname << std::endl;
-      dir = System::opendir(pathname, "*.xml");
-
-      for(System::Directory::iterator entry = dir.begin(); entry != dir.end(); 
++entry)
-       {
-         if (verbose) std::cout << "ThemeSelelector: Name of entry: " << 
pathname + entry->name << std::endl;
-         try {
-             themes.push_back(new Theme(pathname + entry->name));
-         } catch (PingusError& err) {
-           std::cout << "ThemeSelector: PingusError: " << err.get_message () 
<< std::endl;
-         }
-       }
-    }
-
-  if (themes.size() == 0)
-    {
-      PingusError::raise ("ThemeSelector: Couldn't find any themes");
-    }
-  else
-    {
-      std::cout << "ThemesSelector: " << themes.size() << " Themes loaded." << 
std::endl;
-    }
-}
-
-int
-ThemeSelector::mark_level_at_point(int x, int y)
-{
-  if (current_theme == themes.end())
-    return 0;
-  else
-    return (*current_theme)->mark_level_at_point(x, y);
-}
-
-
-/* EOF */

Deleted: branches/pingus_sdl/src/theme_selector.hpp
===================================================================
--- branches/pingus_sdl/src/theme_selector.hpp  2007-08-15 20:53:38 UTC (rev 
2938)
+++ branches/pingus_sdl/src/theme_selector.hpp  2007-08-15 21:32:19 UTC (rev 
2939)
@@ -1,144 +0,0 @@
-//  $Id: theme_selector.hxx,v 1.10 2003/10/21 21:37:06 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 1999 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_THEME_SELECTOR_HXX
-#define HEADER_PINGUS_THEME_SELECTOR_HXX
-
-#include "pingus.hpp"
-#include <vector>
-#include <string>
-
-class CL_Key;
-class Font;
-class CL_InputDevice;
-
-
-class Theme;
-class AlphaButton;
-
-class ListItem
-{
-private:
-  std::string label;
-  Font font;
-
-public:
-  ListItem(std::string);
-  void draw_offset(int x, int y);
-  bool mouse_over();
-
-  ListItem (const ListItem& old);
-  ListItem& operator= (const ListItem& old);
-};
-
-class ListBox
-{
-private:
-  std::vector<ListItem> items;
-  typedef std::vector<ListItem>::iterator ListIter;
-public:
-  ListBox();
-  void add_item(std::string);
-  void draw_offset(int x, int y);
-
-private:
-  ListBox (const ListBox&);
-  ListBox& operator= (const ListBox&);
-};
-
-class ThemeSelector
-{
-public:
-  ////CL_Slot on_button_press_slot;
-  ////CL_Slot on_button_release_slot;
-  ////CL_Slot on_mouse_move_slot;
-
-  class Event /*: public CL_Event_ButtonPress,
-               public CL_Event_ButtonRelease,
-               public CL_Event_MouseMove*/
-  {
-  public:
-    bool enabled;
-    ThemeSelector* theme_selector;
-
-  public:
-    Event () { }
-    virtual ~Event () { }
-
-    virtual void on_button_press(const CL_InputEvent& event);
-    virtual void on_button_release(const CL_InputEvent& event);
-    virtual void on_mouse_move(const CL_InputEvent& event);
-
-  private:
-    Event (const Event&);
-    Event& operator= (const Event&);
-  };
-
-  friend class Event;
-
-  Event* event;
-
-private:
-  std::vector<Theme*> themes;
-  std::vector<Theme*>::iterator current_theme;
-
-  /** A large font, used for the Title Name */
-  Font title_font;
-
-  /** This font is used for the levelnames */
-  Font theme_font;
-
-  /// The red arrow to the right
-  CL_Surface right_arrow;
-  /// The red arrow to the left
-  CL_Surface left_arrow;
-  /// The back button
-  CL_Surface back;
-
-  bool dir_read;
-  bool finished;
-  ListBox list_box;
-
-  void   draw();
-  bool key_pressed(int key);
-
-  /** Marks the level, which is under the given coordinates
-      @param x X-Position (normaly CL_Mouse::get_x())
-      @param y Y-Position (normaly CL_Mouse::get_y())
-      @return The current_level at point or -1 if no level is under point */
-  int mark_level_at_point(int x, int y);
-
-  void   readdir(std::string path);
-
-public:
-  ThemeSelector();
-  ~ThemeSelector();
-
-  /** Display the theme selector */
-  void   display ();
-
-private:
-  ThemeSelector (const ThemeSelector&);
-  ThemeSelector& operator= (const ThemeSelector&);
-};
-
-
-#endif
-
-/* EOF */





reply via email to

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