5 * Created by Alyssa Milburn on Sun Oct 24 2004.
6 * Copyright (c) 2004-2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
27 class SDLSurface
: public Surface
{
28 friend class SDLBackend
;
32 unsigned int width
, height
;
33 SDL_Color palette
[256];
36 void render(shared_ptr
<creaturesImage
> image
, unsigned int frame
, int x
, int y
, bool trans
= false, unsigned char transparency
= 0, bool mirror
= false, bool is_background
= false);
37 void renderLine(int x1
, int y1
, int x2
, int y2
, unsigned int colour
);
38 void blitSurface(Surface
*src
, int x
, int y
, int w
, int h
);
39 unsigned int getWidth() const { return width
; }
40 unsigned int getHeight() const { return height
; }
44 class SDLBackend
: public Backend
{
48 SDLSurface mainsurface
;
49 TCPsocket listensocket
;
51 void handleNetworking();
52 void resizeNotify(int _w
, int _h
);
53 int translateKey(int key
);
55 SDL_Surface
*getMainSDLSurface() { return mainsurface
.surface
; }
57 virtual int idealBpp();
65 void resize(unsigned int w
, unsigned int h
) { resizeNotify(w
, h
); }
67 bool pollEvent(SomeEvent
&e
);
69 unsigned int ticks() { return SDL_GetTicks(); }
73 bool selfRender() { return false; }
74 void requestRender() { }
76 Surface
*getMainSurface() { return &mainsurface
; }
77 Surface
*newSurface(unsigned int width
, unsigned int height
);
78 void freeSurface(Surface
*surf
);
80 bool keyDown(int key
);
82 void setPalette(uint8
*data
);