pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3742 - in trunk/pingus/src: display screen


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3742 - in trunk/pingus/src: display screen
Date: Tue, 8 Jul 2008 11:56:34 +0200

Author: grumbel
Date: 2008-07-08 11:56:34 +0200 (Tue, 08 Jul 2008)
New Revision: 3742

Removed:
   trunk/pingus/src/display/cursor.cpp
   trunk/pingus/src/display/cursor.hpp
   trunk/pingus/src/display/scene_graph.cpp
   trunk/pingus/src/display/scene_graph.hpp
   trunk/pingus/src/display/scene_node.cpp
   trunk/pingus/src/display/scene_node.hpp
   trunk/pingus/src/display/scene_test.cpp
   trunk/pingus/src/display/sprite_node.cpp
   trunk/pingus/src/display/sprite_node.hpp
Modified:
   trunk/pingus/src/screen/screen_manager.cpp
Log:
Removed a bunch of obsolete files

Deleted: trunk/pingus/src/display/cursor.cpp
===================================================================
--- trunk/pingus/src/display/cursor.cpp 2008-07-08 09:55:36 UTC (rev 3741)
+++ trunk/pingus/src/display/cursor.cpp 2008-07-08 09:56:34 UTC (rev 3742)
@@ -1,45 +0,0 @@
-//  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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include "../input/controller.hpp"
-#include "../input/control.hpp"
-#include "../resource.hpp"
-#include "cursor.hpp"
-
-Cursor::Cursor(const std::string& ident)
-  : sprite(ident)
-{
-}
-
-Cursor::~Cursor ()
-{
-}
-
-void
-Cursor::update (float delta)
-{
-  sprite.update (delta);
-}
-
-void
-Cursor::on_event()
-{
-  Vector2f pos = 
Input::Controller::current()->get_pointer(Input::STANDARD_POINTER)->get_pos();
-  sprite.draw(pos.x, pos.y, Display::get_screen());
-}
-
-
-/* EOF */

Deleted: trunk/pingus/src/display/cursor.hpp
===================================================================
--- trunk/pingus/src/display/cursor.hpp 2008-07-08 09:55:36 UTC (rev 3741)
+++ trunk/pingus/src/display/cursor.hpp 2008-07-08 09:56:34 UTC (rev 3742)
@@ -1,47 +0,0 @@
-//  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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_CURSOR_HPP
-#define HEADER_PINGUS_CURSOR_HPP
-
-#include <string>
-#include "display/display.hpp"
-#include "../sprite.hpp"
-
-/** A simple mouse cursor class and stupid. We can't use the X11/win32
-    nativ mouse cursor because we want also to support non-mouse input
-    devices and because we want to support multiple cursors */
-class Cursor
-{
-private:
-  Sprite sprite;
-
-public:
-  Cursor (const std::string& ident);
-  virtual ~Cursor ();
-
-  virtual void update (float delta);
-  virtual void on_event();
-
-private:
-  Cursor (const Cursor&);
-  Cursor& operator= (const Cursor&);
-};
-
-
-#endif
-
-/* EOF */

Deleted: trunk/pingus/src/display/scene_graph.cpp
===================================================================
--- trunk/pingus/src/display/scene_graph.cpp    2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/display/scene_graph.cpp    2008-07-08 09:56:34 UTC (rev 
3742)
@@ -1,98 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include <SDL.h>
-#include "scene_node.hpp"
-#include "scene_graph.hpp"
-
-extern SDL_Surface* global_screen;
-
-SceneGraph::SceneGraph()
-{
-  screen.resize(800/32, 600/32); // could use microtiles instead
-}
-
-SceneGraph::~SceneGraph()
-{
-}
-
-void
-SceneGraph::add(SceneNode* node)
-{
-  nodes.push_back(node);
-}
-
-void
-SceneGraph::render()
-{
-  for(Nodes::iterator i = nodes.begin(); i != nodes.end(); ++i)
-    { // could limit this to stuff that has changed
-      (*i)->render(this);
-    }
-
-  return;
-
-#if 0
-  screen.clear();
-  // Find out what regions of the screen have changed
-  for(Nodes::iterator i = nodes.begin(); i != nodes.end(); ++i)
-    { // could limit this to stuff that has changed
-      (*i)->mark(this);
-    }
-  
-  // Redraw said regions
-  for(int y = 0; y < screen.get_height(); ++y)
-    for(int x = 0; x < screen.get_width(); ++x)
-      {
-        if (screen(x, y))
-          {
-            int width = 1;
-
-            // Join cells horizontally
-            while(screen(x+width,y)) { width += 1; }
-            
-            for(Nodes::iterator i = nodes.begin(); i != nodes.end(); ++i)
-              { // FIXME: could optimize this to only draw the ones that touch 
the region
-                SDL_Rect clip_rect;
-
-                clip_rect.x = x*32;
-                clip_rect.y = y*32;
-                clip_rect.w = 32*width;
-                clip_rect.h = 32;
-
-                SDL_SetClipRect(global_screen, &clip_rect);
-
-                (*i)->render(this);
-              }
-
-            x += width;
-          }
-      }
-#endif
-}
-
-void
-SceneGraph::mark_screen_region(SceneNode* node, const Rect& rect)
-{
-  for(int y = rect.top/32; y < rect.bottom/32; ++y)
-    for(int x = rect.left/32; x < rect.left/32; ++x)
-      {
-        screen(x, y) = true;
-        // screen(x, y).push_back(screen_node); bad?
-      }
-}
-
-/* EOF */

Deleted: trunk/pingus/src/display/scene_graph.hpp
===================================================================
--- trunk/pingus/src/display/scene_graph.hpp    2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/display/scene_graph.hpp    2008-07-08 09:56:34 UTC (rev 
3742)
@@ -1,57 +0,0 @@
- //  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_SCENE_GRAPH_HPP
-#define HEADER_SCENE_GRAPH_HPP
-
-#define EMPTY_TILE 0x00000000
-#define FULL_TILE  0x00002020
-
-#define MICROTILE(x0, y0, x1, y1) (((x0) << 24) | ((y0) << 16) | ((x1) << 8) | 
(y1))
-
-#include <vector>
-#include "../field.hpp"
-
-class Rect;
-class SceneNode;
-
-/** */
-class SceneGraph
-{
-private:
-  /** true if the region needs a refresh, false otherwise */
-  Field<uint32_t> screen;
-
-  typedef std::vector<SceneNode*> Nodes;
-  Nodes nodes;
-  
-public:
-  SceneGraph();
-  ~SceneGraph();
-
-  void add(SceneNode* );
-  
-  /** Draw the SceneGraph to the screen */
-  void render();
-  void mark_screen_region(SceneNode* node, const Rect& rect);
-private:
-  SceneGraph (const SceneGraph&);
-  SceneGraph& operator= (const SceneGraph&);
-};
-
-#endif
-
-/* EOF */

Deleted: trunk/pingus/src/display/scene_node.cpp
===================================================================
--- trunk/pingus/src/display/scene_node.cpp     2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/display/scene_node.cpp     2008-07-08 09:56:34 UTC (rev 
3742)
@@ -1,27 +0,0 @@
-//  Pingus - A free Lemmings clone
-//  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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include "scene_node.hpp"
-
-SceneNode::SceneNode()
-{
-}
-
-SceneNode::~SceneNode()
-{
-}
-
-/* EOF */

Deleted: trunk/pingus/src/display/scene_node.hpp
===================================================================
--- trunk/pingus/src/display/scene_node.hpp     2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/display/scene_node.hpp     2008-07-08 09:56:34 UTC (rev 
3742)
@@ -1,47 +0,0 @@
- //  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_SCENE_NODE_HPP
-#define HEADER_SCENE_NODE_HPP
-
-#include "../math/rect.hpp"
-
-class SceneGraph;
-
-/** */
-class SceneNode
-{
-private:
-public:
-  SceneNode();
-  virtual ~SceneNode();
-
-  /** Return the area that the SceneNode covers on the screen */
-  virtual Rect get_screen_rect() const =0;
-
-  /** Mark regions for update */
-  virtual void mark(SceneGraph* graph) =0;
-
-  virtual void render(SceneGraph* graph) =0;
-  
-private:
-  SceneNode (const SceneNode&);
-  SceneNode& operator= (const SceneNode&);
-};
-
-#endif
-
-/* EOF */

Deleted: trunk/pingus/src/display/scene_test.cpp
===================================================================
--- trunk/pingus/src/display/scene_test.cpp     2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/display/scene_test.cpp     2008-07-08 09:56:34 UTC (rev 
3742)
@@ -1,63 +0,0 @@
-#include <SDL.h>
-#include <SDL_image.h>
-#include <stdlib.h>
-#include <iostream>
-#include "scene_graph.hpp"
-#include "sprite_node.hpp"
-
-SDL_Surface* global_screen;
-
-int main()
-{
-  if(SDL_Init(SDL_INIT_VIDEO) < 0) {
-    std::cerr << "Unable to init SDL: " << SDL_GetError() << std::endl;
-    exit(1);
-  }
-  atexit(SDL_Quit);
-
-  global_screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
-
-  SDL_Event event;
-
-  SDL_Surface* surface = 
IMG_Load("/home/ingo/projects/pingus/svn/trunk/data/images/pingus/player0/tumble.png");
-
-  SceneGraph graph;
-  SpriteNode* sprite = new 
SpriteNode("/home/ingo/projects/pingus/svn/trunk/data/images/pingus/player0/tumble.png");
-  graph.add(sprite);
-
-  sprite->set_pos(Point(100, 100));
-
-  while(1)
-    {
-      while(SDL_PollEvent(&event)) 
-        {
-          switch (event.type)
-            {
-            case SDL_KEYDOWN:
-              std::cout << "Keypress" << std::endl;
-              break;
-
-            case SDL_QUIT:
-              exit(EXIT_SUCCESS);
-              break;
-            }
-        }
-
-      sprite->set_pos(Point(rand()%800, rand()%600));
-
-      graph.render();
-      {
-        SDL_Rect rect;
-        rect.x = 320;
-        rect.y = 200;
-        SDL_BlitSurface(surface, NULL, global_screen, &rect);
-      }
-
-      SDL_Flip(global_screen);
-
-      std::cout << "." << std::endl;
-    }
-}
-
-/* EOF */
-

Deleted: trunk/pingus/src/display/sprite_node.cpp
===================================================================
--- trunk/pingus/src/display/sprite_node.cpp    2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/display/sprite_node.cpp    2008-07-08 09:56:34 UTC (rev 
3742)
@@ -1,149 +0,0 @@
- //  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include <SDL.h>
-#include <SDL_image.h>
-#include <string>
-#include "scene_graph.hpp"
-#include "sprite_node.hpp"
-
-extern SDL_Surface* global_screen;
-
-SpriteNode::SpriteNode(const std::string resourcename)
-{
-  surface = IMG_Load(resourcename.c_str());
-}
-
-SpriteNode::~SpriteNode() 
-{
-  SDL_FreeSurface(surface);
-}
-
-void
-SpriteNode::set_pos(const Point& pos_)
-{
-  if (pos != pos_) has_changed_ = true;
-  pos = pos_;
-}
-
-Point
-SpriteNode::get_pos() const
-{
-  return pos;
-}
-
-void
-SpriteNode::render(SceneGraph* graph)
-{
-  SDL_Rect dest;
-
-  dest.x = pos.x;
-  dest.y = pos.y;
-
-  SDL_BlitSurface(surface, NULL, global_screen, &dest);
-
-  has_changed_ = false;
-  old_repeat = repeat;
-  old_pos    = pos;
-}
-
-Rect
-SpriteNode::get_old_screen_rect() const
-{
-  return Rect(old_pos.x - (old_repeat.left * surface->w),
-              old_pos.y - (old_repeat.top  * surface->h), 
-              surface->w * (old_repeat.left + old_repeat.right + 1),
-              surface->h * (old_repeat.top  + old_repeat.bottom + 1));
-}
-
-Rect
-SpriteNode::get_screen_rect() const
-{
-  return Rect(pos.x - (repeat.left * surface->w),
-              pos.y - (repeat.top  * surface->h), 
-              surface->w * (repeat.left + repeat.right + 1),
-              surface->h * (repeat.top  + repeat.bottom + 1));
-}
-
-bool
-SpriteNode::has_changed() const
-{
-  return has_changed_;
-}
-
-void
-SpriteNode::mark(SceneGraph* graph)
-{
-  if (has_changed_)
-    {
-      graph->mark_screen_region(this, get_old_screen_rect());
-      graph->mark_screen_region(this, get_screen_rect());
-    }
-}
-
-void
-SpriteNode::set_left_repeat(int left)
-{
-  if (left != repeat.left) has_changed_ = true;
-  repeat.left = left;
-}
-
-void
-SpriteNode::set_right_repeat(int right)
-{
-  if (right != repeat.right) has_changed_ = true;
-  repeat.right = right;
-}
-
-void
-SpriteNode::set_top_repeat(int top)
-{
-  if (top != repeat.top) has_changed_ = true;
-  repeat.top = top;
-}
-
-void
-SpriteNode::set_bottom_repeat(int bottom)
-{
-  if (bottom != repeat.bottom) has_changed_ = true;
-  repeat.bottom = bottom;
-}
-
-int
-SpriteNode::get_left_repeat(int left) const
-{
-  return repeat.left;
-}
-
-int
-SpriteNode::get_right_repeat(int right) const
-{
-  return repeat.right;
-}
-
-int
-SpriteNode::get_top_repeat(int top) const
-{
-  return repeat.top;
-}
-
-int
-SpriteNode::get_bottom_repeat(int bottom) const
-{
-  return repeat.bottom;
-}
-
-/* EOF */

Deleted: trunk/pingus/src/display/sprite_node.hpp
===================================================================
--- trunk/pingus/src/display/sprite_node.hpp    2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/display/sprite_node.hpp    2008-07-08 09:56:34 UTC (rev 
3742)
@@ -1,61 +0,0 @@
- //  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 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 3 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, see <http://www.gnu.org/licenses/>.
-
-#include "../math/point.hpp"
-#include "scene_node.hpp"
-
-class SpriteNode : public SceneNode
-{
-private:
-  Point pos;
-  Rect    repeat;
-
-  Point old_pos;
-  Rect    old_repeat;
-
-  SDL_Surface* surface;
-  bool has_changed_;
-
-public:
-  SpriteNode(const std::string resourcename);
-  ~SpriteNode();
-
-  bool has_changed() const;
-  Rect get_screen_rect() const;
-  Rect get_old_screen_rect() const;
-
-  void mark(SceneGraph* graph);
-    
-  void  set_pos(const Point& pos);
-  Point get_pos() const;
-  
-  void set_left_repeat(int left);
-  void set_right_repeat(int right);
-
-  void set_top_repeat(int top);
-  void set_bottom_repeat(int bottom);
-
-  int get_left_repeat(int left) const;
-  int get_right_repeat(int right) const;
-
-  int get_top_repeat(int top) const;
-  int get_bottom_repeat(int bottom) const;
-
-  /** Draw the SDL_Surface to the screen */
-  void render(SceneGraph* graph);
-};
-
-/* EOF */

Modified: trunk/pingus/src/screen/screen_manager.cpp
===================================================================
--- trunk/pingus/src/screen/screen_manager.cpp  2008-07-08 09:55:36 UTC (rev 
3741)
+++ trunk/pingus/src/screen/screen_manager.cpp  2008-07-08 09:56:34 UTC (rev 
3742)
@@ -20,7 +20,6 @@
 #include "../globals.hpp"
 #include "math/size.hpp"
 #include "pathname.hpp"
-#include "display/cursor.hpp"
 #include "display/display.hpp"
 #include "screen_manager.hpp"
 #include "../path_manager.hpp"





reply via email to

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