|
Odamex
Setting the Standard in Multiplayer Doom
|
00001 // Emacs style mode select -*- C++ -*- 00002 //----------------------------------------------------------------------------- 00003 // 00004 // $Id: i_sdlvideo.h 2115 2011-02-21 03:54:14Z russellrice $ 00005 // 00006 // Copyright (C) 2006-2010 by The Odamex Team. 00007 // 00008 // This program is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU General Public License 00010 // as published by the Free Software Foundation; either version 2 00011 // of the License, or (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // DESCRIPTION: 00019 // SDL implementation of the IVideo class. 00020 // 00021 //----------------------------------------------------------------------------- 00022 00023 00024 #ifndef __SDLVIDEO_H__ 00025 #define __SDLVIDEO_H__ 00026 00027 #include <SDL.h> 00028 #include "hardware.h" 00029 #include "i_video.h" 00030 #include "c_console.h" 00031 00032 class SDLVideo : public IVideo 00033 { 00034 public: 00035 SDLVideo(int parm); 00036 virtual ~SDLVideo (void); 00037 00038 virtual std::string GetVideoDriverName(); 00039 00040 virtual bool CanBlit (void) {return false;} 00041 virtual EDisplayType GetDisplayType (void) {return DISPLAY_Both;} 00042 00043 virtual bool FullscreenChanged (bool fs); 00044 virtual void SetWindowedScale (float scale); 00045 virtual bool SetOverscan (float scale); 00046 00047 virtual bool SetMode (int width, int height, int bits, bool fs); 00048 virtual void SetPalette (DWORD *palette); 00049 00050 /* 12/3/06: HACK - Add SetOldPalette to accomodate classic redscreen - ML*/ 00051 virtual void SetOldPalette (byte *doompalette); 00052 00053 virtual void UpdateScreen (DCanvas *canvas); 00054 virtual void ReadScreen (byte *block); 00055 00056 virtual int GetModeCount (void); 00057 virtual void StartModeIterator (int bits); 00058 virtual bool NextMode (int *width, int *height); 00059 00060 virtual DCanvas *AllocateSurface (int width, int height, int bits, bool primary = false); 00061 virtual void ReleaseSurface (DCanvas *scrn); 00062 virtual void LockSurface (DCanvas *scrn); 00063 virtual void UnlockSurface (DCanvas *scrn); 00064 virtual bool Blit (DCanvas *src, int sx, int sy, int sw, int sh, 00065 DCanvas *dst, int dx, int dy, int dw, int dh); 00066 00067 00068 protected: 00069 00070 class cChain 00071 { 00072 public: 00073 cChain(DCanvas *dc) : canvas(dc) {next = prev = this;} 00074 ~cChain() {(prev->next = next)->prev = prev;} 00075 00076 void linkTo(cChain *head) 00077 { 00078 (next = head->next)->prev = next; 00079 (head->next = next)->prev = head; 00080 } 00081 00082 DCanvas *canvas; 00083 cChain *next, *prev; 00084 }; 00085 00086 typedef struct 00087 { 00088 int width, height, bits; 00089 } vidMode_t; 00090 00091 // binary predicate for video mode comparison 00092 static bool bp_vm_uni_cmp (vidMode_t first, vidMode_t second) 00093 { 00094 return (first.width == second.width && 00095 first.height == second.height && 00096 first.bits == second.bits); 00097 } 00098 00099 std::vector<vidMode_t> vidModeList; 00100 size_t vidModeIterator; 00101 int vidModeIteratorBits; 00102 00103 SDL_Surface *sdlScreen; 00104 bool infullscreen; 00105 int screenw, screenh; 00106 int screenbits; 00107 00108 SDL_Color newPalette[256]; 00109 SDL_Color palette[256]; 00110 bool palettechanged; 00111 00112 cChain *chainHead; 00113 }; 00114 #endif 00115