// 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 "screen.h"
+#include "screen/drawing_context.h"
#include "mousecursor.h"
-MouseCursor::MouseCursor(std::string cursor_file, int frames)
+MouseCursor* MouseCursor::current_ = 0;
+
+MouseCursor::MouseCursor(std::string cursor_file, int frames) : mid_x(0), mid_y(0)
{
cursor = new Surface(cursor_file, USE_ALPHA);
-
+
cur_state = MC_NORMAL;
cur_frame = 0;
tot_frames = frames;
timer.init(false);
timer.start(MC_FRAME_PERIOD);
-
+
SDL_ShowCursor(SDL_DISABLE);
}
cur_state = nstate;
}
-void MouseCursor::draw()
+void MouseCursor::set_mid(int x, int y)
+{
+ mid_x = x;
+ mid_y = y;
+}
+
+void MouseCursor::draw(DrawingContext& context)
{
int x,y,w,h;
Uint8 ispressed = SDL_GetMouseState(&x,&y);
timer.start(MC_FRAME_PERIOD);
}
- cursor->draw_part(w*cur_frame, h*cur_state , x, y, w, h);
+ context.draw_surface_part(cursor, Vector(w*cur_frame, h*cur_state), Vector(w,
+ h), Vector(x-mid_x, y-mid_y), LAYER_FOREGROUND1+100);
}