/* * $Id: output.h,v 1.3 2002/09/09 23:26:30 stefan Exp $ * Copyright (c) 2002, Dominik Schnitzer * * JFK - JFK Fucking Killerz, a massive multiplayer 2d shoot'em-up game * http://relax.ath.cx/jfk/ * * 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 Library 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 JFK_OUTPUT_H #define JFK_OUTPUT_H #include #include "conffile.h" using namespace std; namespace JFK { namespace client { const double PI = 3.14159265358979323846; /* All possible JFK Events */ enum events { EVENT_FIRE, /* User wants to fire, the poll_events() data parameter is * set to NULL */ EVENT_LEFT, /* User wants to go left, the poll_events() data parameter * is set to NULL */ EVENT_RIGHT, /* User pressed the right key, data parameter is set to * NULL */ EVENT_UP, /* User pressed the up key, data parameter is set to NULL */ EVENT_DOWN, /* User pressed the down key, data parameter is set to * NULL */ EVENT_MESSAGE, /* User wants to send a message. the data parameter contains * the message to be sent as a (*string) */ EVENT_CHANGE_WEAPON, /* change the weapon */ EVENT_ESC, /* User pressed the escape key, data = NULL */ EVENT_MAX /* Placeholder */ }; enum event_state { EVENTSTATE_NONE, EVENTSTATE_BEGIN, EVENTSTATE_DONE }; typedef struct { int ev[EVENT_MAX]; string msg; } event_t; typedef char* image; class output { public: output(); virtual ~output(); /* Shows all Data drawn to the offline surface. Usually a surface * flip. Doublebuffering is not necessary */ virtual void show() = 0; /* Loads the image specified and returns an cloated SDL Surface */ virtual image load_image(string section, string file, int nr = 0, bool hw = false) = 0; /* Frees the memory associated with the given image. */ virtual void free_image(image img) = 0; /* Return the Image width */ virtual int get_image_width(image img) = 0; /* Return the Image height */ virtual int get_image_height(image img) = 0; /* Draws the given object to the given position, ignoring the given * x or y coordinate. */ virtual void draw_image(image img, int x, int y) = 0; virtual void draw_image_ext(image img, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh) = 0; /* Sets the clipping rectangle for a surface. When this surface is the * destination of a blit, only the area within the clip rectangle will * be drawn into. set everything to 0 to disable again. */ virtual void set_cliprect(int x, int y, int w, int h) = 0; /* Poll for events. Returns 1 if more events are pending, 0 if finished */ virtual void poll_events(event_t *data) = 0; /* Return the current screen height/width */ virtual int get_height() = 0; virtual int get_width() = 0; }; class output_plugins { public: output* get_plugin(string name, const conffile& cf); string list_plugins(); }; const char* defaultplugin_name(); } } #endif /* JFK_OUTPUT_H */