ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
video.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) by Fred Klaus *
3  * development@fkweb.de *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef SDLTK_VIDEO_H
21 #define SDLTK_VIDEO_H
22 
23 #include "def.h"
24 #include "size.h"
25 #include "cpc.h"
26 #include "SDL.h"
27 
29 namespace sdltk
30 {
31 
32  class Canvas;
33 
35  class Video
36  {
37 
38  public:
40  Video(cpcx::Cpc * cpc);
41  virtual ~Video() ROLAND_DEFAULT
42 
44  virtual int init() = 0;
46  virtual int init(uint width, uint height, uint depth,
47  bool fullscreen, unsigned char scale) = 0;
48 
49  virtual Canvas * getCanvas() = 0;
50 
52  virtual void setup() {};
54  virtual void update() = 0;
56  virtual void quit() = 0;
58  virtual void lock() {};
60  virtual void unlock() {};
62 
64  uint bpp() {return mBuffer->format->BitsPerPixel;}
66  uint depth() {return mBuffer->format->BytesPerPixel;}
68  Size size() {return Size(mScreen->w, mScreen->h);}
69 
71  void setFullscreen(bool value) {mFullscreen = value; init();}
73  void setDoubling (bool value) {mDoubling = value;}
75  void setFilter (bool value) {mFilter = value; init();}
77  void toggleFullscreen() {mFullscreen = (mFullscreen ? false : true); init();}
79  void toggleDoubling () {mDoubling = (mDoubling ? false : true); init();}
81  void toggleFilter () {mFilter = (mFilter ? false : true); init();}
82 
86  uint* bufferEnd() {return mBufferEnd;}
87 
89  SDL_Surface* buffer() {return mBuffer;}
91  SDL_Surface* screen() {return mScreen;}
92 
94  static void setIcon (const String & icon);
96  static void setCaption(const String & caption) {SDL_WM_SetCaption(caption.c_str(), caption.c_str());}
97 
98 
99  protected:
101 
102  static unsigned int mDesktopWidth;
103  static unsigned int mDesktopHeight;
104 
105  static bool mFullscreen;
106  static bool mDoubling;
107  static bool mFilter;
108 
109  unsigned int mCpcWidth;
110  unsigned int mCpcHeight;
111  unsigned char mCpcScale;
112 
113  unsigned int * mBufferStart;
114  unsigned int * mBufferEnd;
115 
116  SDL_Surface * mBuffer;
117  SDL_Surface * mScreen;
118  SDL_Rect mCanvasRect;
119 
120  };
121 
122 } // sdltk
123 
124 #endif // SDLTK_VIDEO_H
125 
void setFullscreen(bool value)
Set to fullscreen or not.
Definition: video.h:71
void setDoubling(bool value)
Set line doubling on or off.
Definition: video.h:73
static bool mFilter
Definition: video.h:107
void setFilter(bool value)
En-/disable bilinear texture filter.
Definition: video.h:75
unsigned int * mBufferEnd
Definition: video.h:114
static unsigned int mDesktopHeight
Definition: video.h:103
void toggleFilter()
Toggle bilinear texture filter.
Definition: video.h:81
void toggleDoubling()
Toggle line doubling.
Definition: video.h:79
Video(cpcx::Cpc *cpc)
Constructs the video interface for the.
Definition: video.cpp:31
SDL_Surface * mBuffer
Definition: video.h:116
uint depth()
Returns the bytes per pixel inbetween (1 to 4)
Definition: video.h:66
SDL_Surface * screen()
Returns the SDL_Surface of the screen.
Definition: video.h:91
SDL_Surface * mScreen
Definition: video.h:117
virtual Canvas * getCanvas()=0
uint * bufferStart()
Returns the start of the backbuffer.
Definition: video.h:84
SDL_Surface * buffer()
Returns the SDL_Surface of the backbuffer.
Definition: video.h:89
unsigned int mCpcWidth
Definition: video.h:109
static void setCaption(const String &caption)
Sets a caption for the application.
Definition: video.h:96
virtual void setup()
Things that needs to be done before update.
Definition: video.h:52
Definition: canvas.h:40
virtual void quit()=0
Free all resources.
virtual void lock()
Locks the screen-surface.
Definition: video.h:58
SDL_Rect mCanvasRect
Definition: video.h:118
unsigned int * mBufferStart
Definition: video.h:113
static bool mDoubling
Definition: video.h:106
uint * bufferEnd()
Returns the end of the backbuffer.
Definition: video.h:86
static void setIcon(const String &icon)
Sets an image as application icon.
Definition: video.cpp:51
#define ROLAND_DEFAULT
Definition: compspec.h:46
Size size()
Returns the size of the video surface.
Definition: video.h:68
unsigned int uint
Definition: types.h:121
GLuint GLfloat GLenum cap GLsizei GLuint *textures GLenum GLint *params void GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLint GLint GLsizei GLsizei height
Definition: glfunclist.h:21
static bool mFullscreen
Definition: video.h:105
virtual void unlock()
Unlocks the screen-surface.
Definition: video.h:60
defines a planar size (width, height)
Definition: size.h:30
Definition: cpc.h:61
uint bpp()
Things that needs to be done before update.
Definition: video.h:64
static unsigned int mDesktopWidth
Definition: video.h:102
cpcx::Cpc * mCpc
Definition: video.h:100
Baseclass for all SDL Video drivers.
Definition: video.h:35
unsigned char mCpcScale
Definition: video.h:111
sdltk::Audio audio & cpc
Definition: roland.cpp:76
std::string String
Definition: types.h:29
virtual void update()=0
Updates the Screen (flip or something)
unsigned int mCpcHeight
Definition: video.h:110
GLuint GLfloat GLenum cap GLsizei GLuint *textures GLenum GLint *params void GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLint GLint GLsizei width
Definition: glfunclist.h:21
the SDL based Stuff
Definition: audio.cpp:22
virtual int init(uint width, uint height, uint depth, bool fullscreen, unsigned char scale)=0
inits all
void toggleFullscreen()
Toggles fullscreen.
Definition: video.h:77
virtual ~Video() ROLAND_DEFAULT virtual int init()=0
device dependant init for inheritance