drag.h

Go to the documentation of this file.
00001 /*
00002  *  drag.cc - Dragging objects in Game_window.
00003  *
00004  *  Copyright (C) 2000-2001  The Exult Team
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef INCL_DRAG_H
00022 #define INCL_DRAG_H
00023 
00024 #include "singles.h"
00025 
00026 /*
00027  *  Data needed when dragging an object.
00028  */
00029 class Dragging_info : public Game_singletons
00030   {
00031   Game_object *obj;   // What's being dragged.
00032   bool is_new;      // Object was newly created.
00033   Gump *gump;
00034   Gump_button *button;
00035   Tile_coord old_pos;   // Original pos. of object if it wasn't
00036           //   in a container.
00037   Rectangle old_foot;   // Original footprint.
00038   int old_lift;     // Lift of obj OR its owner.
00039   int quantity;     // Amount of object being moved.
00040   int readied_index;    // If it was a 'readied' item.
00041           // Last mouse, paint positions:
00042   int mousex, mousey, paintx, painty;
00043   Rectangle rect;     // Rectangle to repaint.
00044   Image_buffer *save;   // Image below dragged object.
00045   bool okay;      // True if drag constructed okay.
00046   bool possible_theft;    // Moved enough to be 'theft'.
00047 
00048   bool start(int x, int y); // First motion.
00049   void put_back();    // Put back object.
00050   bool drop_on_gump(int x, int y, Game_object *to_drop, Gump *gump);
00051   bool drop_on_map(int x, int y, Game_object *to_drop);
00052   bool drop(int x, int y);  // Drop obj. at given position.
00053 public:
00054   friend class Game_window;
00055           // Create for dropping new object.
00056   Dragging_info(Game_object *newobj);
00057   Dragging_info(int x, int y);  // Create for given mouse position.
00058   ~Dragging_info();
00059   bool moved(int x, int y); // Mouse moved.
00060   void paint();     // Paint object being dragged.
00061           // Mouse button released.
00062   bool drop(int x, int y, bool moved);
00063   };
00064 
00065 #endif  /* INCL_DRAG_H */

Generated on Mon Jul 9 14:42:45 2007 for ExultEngine by  doxygen 1.5.1