2003-09-25 16:20:34 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2005-06-16 01:11:29 +00:00
|
|
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
2003-09-25 16:20:34 +00:00
|
|
|
//
|
|
|
|
// See the file "license" for information on usage and redistribution of
|
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2006-03-24 19:59:52 +00:00
|
|
|
// $Id: FrameBuffer.hxx,v 1.68 2006-03-24 19:59:52 stephena Exp $
|
2003-09-25 16:20:34 +00:00
|
|
|
//============================================================================
|
|
|
|
|
2003-10-17 18:02:16 +00:00
|
|
|
#ifndef FRAMEBUFFER_HXX
|
|
|
|
#define FRAMEBUFFER_HXX
|
2003-09-25 16:20:34 +00:00
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
|
2003-09-25 16:20:34 +00:00
|
|
|
#include "bspf.hxx"
|
2003-09-26 00:32:00 +00:00
|
|
|
#include "Event.hxx"
|
2003-10-17 18:02:16 +00:00
|
|
|
#include "MediaSrc.hxx"
|
2005-06-08 18:45:09 +00:00
|
|
|
#include "Font.hxx"
|
2005-03-13 03:38:41 +00:00
|
|
|
#include "GuiUtils.hxx"
|
2003-09-25 16:20:34 +00:00
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
class OSystem;
|
2005-06-23 14:33:12 +00:00
|
|
|
class Console;
|
2003-09-25 16:20:34 +00:00
|
|
|
|
2005-06-08 18:45:09 +00:00
|
|
|
// Text alignment modes for drawString()
|
|
|
|
enum TextAlignment {
|
2005-06-25 16:35:36 +00:00
|
|
|
kTextAlignLeft,
|
|
|
|
kTextAlignCenter,
|
|
|
|
kTextAlignRight
|
|
|
|
};
|
|
|
|
|
|
|
|
// Line types for drawing rectangular frames
|
|
|
|
enum FrameStyle {
|
|
|
|
kSolidLine,
|
|
|
|
kDashLine
|
2005-06-08 18:45:09 +00:00
|
|
|
};
|
|
|
|
|
2006-01-19 00:45:13 +00:00
|
|
|
// Different types of framebuffer derived objects
|
|
|
|
enum BufferType {
|
|
|
|
kSoftBuffer,
|
|
|
|
kGLBuffer
|
|
|
|
};
|
|
|
|
|
2006-03-19 18:17:48 +00:00
|
|
|
// Positions for onscreen/overlaid messages
|
|
|
|
enum MessagePosition {
|
|
|
|
kTopLeft,
|
|
|
|
kTopCenter,
|
|
|
|
kTopRight,
|
|
|
|
kMiddleLeft,
|
|
|
|
kMiddleCenter,
|
|
|
|
kMiddleRight,
|
|
|
|
kBottomLeft,
|
|
|
|
kBottomCenter,
|
|
|
|
kBottomRight
|
|
|
|
};
|
|
|
|
|
2003-09-25 16:20:34 +00:00
|
|
|
/**
|
2003-10-26 19:40:39 +00:00
|
|
|
This class encapsulates the MediaSource and is the basis for the video
|
2005-02-21 02:23:57 +00:00
|
|
|
display in Stella. All graphics ports should derive from this class for
|
2003-10-26 19:40:39 +00:00
|
|
|
platform-specific video stuff.
|
|
|
|
|
2005-03-11 23:36:30 +00:00
|
|
|
All GUI elements (ala ScummVM) are drawn here as well.
|
2003-09-25 16:20:34 +00:00
|
|
|
|
|
|
|
@author Stephen Anthony
|
2006-03-24 19:59:52 +00:00
|
|
|
@version $Id: FrameBuffer.hxx,v 1.68 2006-03-24 19:59:52 stephena Exp $
|
2003-09-25 16:20:34 +00:00
|
|
|
*/
|
2003-10-17 18:02:16 +00:00
|
|
|
class FrameBuffer
|
2003-09-25 16:20:34 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2003-10-17 18:02:16 +00:00
|
|
|
Creates a new Frame Buffer
|
2003-09-25 16:20:34 +00:00
|
|
|
*/
|
2005-02-21 20:43:53 +00:00
|
|
|
FrameBuffer(OSystem* osystem);
|
2003-09-25 16:20:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
2003-10-26 19:40:39 +00:00
|
|
|
virtual ~FrameBuffer();
|
|
|
|
|
|
|
|
/**
|
2005-02-22 18:41:16 +00:00
|
|
|
(Re)initializes the framebuffer display. This must be called before any
|
2003-10-26 19:40:39 +00:00
|
|
|
calls are made to derived methods.
|
|
|
|
|
2005-05-06 22:50:15 +00:00
|
|
|
@param title The title of the window
|
|
|
|
@param width The width of the framebuffer
|
|
|
|
@param height The height of the framebuffer
|
|
|
|
@param aspect Whether to use the aspect ratio setting
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
2005-05-06 22:50:15 +00:00
|
|
|
void initialize(const string& title, uInt32 width, uInt32 height,
|
|
|
|
bool aspect = true);
|
2003-10-26 19:40:39 +00:00
|
|
|
|
|
|
|
/**
|
2005-02-21 02:23:57 +00:00
|
|
|
Updates the display, which depending on the current mode could mean
|
|
|
|
drawing the mediasource, any pending menus, etc.
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
|
|
|
void update();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Shows a message onscreen.
|
|
|
|
|
|
|
|
@param message The message to be shown
|
2006-03-19 18:17:48 +00:00
|
|
|
@param position Onscreen position for the message
|
|
|
|
@param color Color of text in the message
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
2006-03-19 18:17:48 +00:00
|
|
|
void showMessage(const string& message,
|
|
|
|
MessagePosition position = kBottomCenter,
|
|
|
|
OverlayColor color = kTextColor);
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-08-29 18:36:42 +00:00
|
|
|
/**
|
|
|
|
Hides any onscreen messages.
|
|
|
|
*/
|
|
|
|
void hideMessage();
|
|
|
|
|
2003-10-26 19:40:39 +00:00
|
|
|
/**
|
2005-03-28 00:04:54 +00:00
|
|
|
Returns the current width of the framebuffer *before* any scaling.
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
@return The current unscaled width
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
2005-03-28 00:04:54 +00:00
|
|
|
inline const uInt32 baseWidth() { return myBaseDim.w; }
|
2003-10-26 19:40:39 +00:00
|
|
|
|
|
|
|
/**
|
2005-03-28 00:04:54 +00:00
|
|
|
Returns the current height of the framebuffer *before* any scaling.
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
@return The current unscaled height
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
2005-03-28 00:04:54 +00:00
|
|
|
inline const uInt32 baseHeight() { return myBaseDim.h; }
|
2003-09-25 16:20:34 +00:00
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
/**
|
2005-03-28 00:04:54 +00:00
|
|
|
Returns the current width of the framebuffer image.
|
|
|
|
Note that this will take into account the current scaling (if any).
|
2005-02-21 02:23:57 +00:00
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
@return The current width
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
2005-04-03 19:37:32 +00:00
|
|
|
inline const uInt32 imageWidth() { return myImageDim.w; }
|
2005-02-21 02:23:57 +00:00
|
|
|
|
|
|
|
/**
|
2005-03-28 00:04:54 +00:00
|
|
|
Returns the current height of the framebuffer image.
|
|
|
|
Note that this will take into account the current scaling (if any).
|
2005-02-21 02:23:57 +00:00
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
@return The current height
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
2005-04-03 19:37:32 +00:00
|
|
|
inline const uInt32 imageHeight() { return myImageDim.h; }
|
2005-02-21 02:23:57 +00:00
|
|
|
|
2003-11-12 19:36:25 +00:00
|
|
|
/**
|
2006-03-24 19:59:52 +00:00
|
|
|
Handle the pause event; currently this updates the palette.
|
2003-11-12 19:36:25 +00:00
|
|
|
|
2006-03-24 19:59:52 +00:00
|
|
|
@param status Whether pause has been enabled or disabled
|
2003-11-12 19:36:25 +00:00
|
|
|
*/
|
2006-03-24 19:59:52 +00:00
|
|
|
void handlePause(bool status);
|
2003-11-12 19:36:25 +00:00
|
|
|
|
2003-11-24 14:51:06 +00:00
|
|
|
/**
|
2005-06-23 14:33:12 +00:00
|
|
|
Indicates that the TIA area is dirty, and certain areas need
|
2005-05-28 17:25:41 +00:00
|
|
|
to be redrawn.
|
2003-11-24 14:51:06 +00:00
|
|
|
*/
|
2006-03-19 18:17:48 +00:00
|
|
|
void refresh() { theRedrawTIAIndicator = true; }
|
2003-11-24 14:51:06 +00:00
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
/**
|
2005-05-01 20:11:07 +00:00
|
|
|
Toggles between fullscreen and window mode.
|
|
|
|
Grabmouse activated when in fullscreen mode.
|
|
|
|
*/
|
|
|
|
void toggleFullscreen();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Enables/disables fullscreen mode.
|
|
|
|
Grabmouse activated when in fullscreen mode.
|
2005-03-26 19:26:48 +00:00
|
|
|
|
2005-05-01 20:11:07 +00:00
|
|
|
@param enable Set the fullscreen mode to this value
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
2005-05-01 20:11:07 +00:00
|
|
|
void setFullscreen(bool enable);
|
2005-02-21 02:23:57 +00:00
|
|
|
|
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called when the user wants to resize the window.
|
2005-05-01 20:11:07 +00:00
|
|
|
Size = 'PreviousSize' means window should decrease in size
|
|
|
|
Size = 'NextSize' means window should increase in size
|
|
|
|
Size = 'GivenSize' means window should be resized to quantity given in 'zoom'
|
2005-03-26 19:26:48 +00:00
|
|
|
|
2005-05-01 20:11:07 +00:00
|
|
|
@param size Described above
|
|
|
|
@param zoom The zoom level to use if size is set to 'sGiven'
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
2005-05-01 20:11:07 +00:00
|
|
|
void resize(Size size, Int8 zoom = 0);
|
2005-02-21 02:23:57 +00:00
|
|
|
|
2005-03-14 04:08:15 +00:00
|
|
|
/**
|
|
|
|
Sets the state of the cursor (hidden or grabbed) based on the
|
|
|
|
current mode.
|
|
|
|
*/
|
|
|
|
void setCursorState();
|
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
/**
|
|
|
|
Shows or hides the cursor based on the given boolean value.
|
|
|
|
*/
|
|
|
|
void showCursor(bool show);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Grabs or ungrabs the mouse based on the given boolean value.
|
|
|
|
*/
|
|
|
|
void grabMouse(bool grab);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Answers if the display is currently in fullscreen mode.
|
|
|
|
*/
|
|
|
|
bool fullScreen();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Calculate the maximum window size that the current screen can hold.
|
2006-01-10 02:09:34 +00:00
|
|
|
If not supported by platform, always return 4.
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
2006-01-19 00:45:13 +00:00
|
|
|
virtual uInt32 maxWindowSizeForScreen();
|
2005-02-21 02:23:57 +00:00
|
|
|
|
2005-08-30 01:10:54 +00:00
|
|
|
/**
|
|
|
|
Returns current zoomlevel of the framebuffer.
|
|
|
|
*/
|
|
|
|
uInt32 zoomLevel() { return theZoomLevel; }
|
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
/**
|
2005-02-22 18:41:16 +00:00
|
|
|
Set the title for the main SDL window.
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
2005-03-26 19:26:48 +00:00
|
|
|
void setWindowTitle(const string& title);
|
2005-02-21 02:23:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set up the palette for a screen of any depth > 8.
|
2005-05-05 00:10:49 +00:00
|
|
|
|
|
|
|
@param palette The array of colors
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
2005-10-09 17:31:47 +00:00
|
|
|
virtual void setPalette(const uInt32* palette);
|
2005-02-21 02:23:57 +00:00
|
|
|
|
2005-03-11 23:36:30 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to draw a rectangular box with sides
|
2005-03-11 23:36:30 +00:00
|
|
|
at the specified coordinates.
|
|
|
|
|
|
|
|
@param x The x coordinate
|
|
|
|
@param y The y coordinate
|
|
|
|
@param w The width of the box
|
|
|
|
@param h The height of the box
|
2005-09-15 19:43:36 +00:00
|
|
|
@param colorA Lighter color for outside line.
|
|
|
|
@param colorB Darker color for inside line.
|
2005-03-11 23:36:30 +00:00
|
|
|
*/
|
|
|
|
void box(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|
|
|
OverlayColor colorA, OverlayColor colorB);
|
|
|
|
|
2005-04-04 02:19:22 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to draw a framed rectangle.
|
2005-04-04 02:19:22 +00:00
|
|
|
I'm not exactly sure what it is, so I can't explain it :)
|
|
|
|
|
|
|
|
@param x The x coordinate
|
|
|
|
@param y The y coordinate
|
|
|
|
@param w The width of the area
|
|
|
|
@param h The height of the area
|
|
|
|
@param color The color of the surrounding frame
|
|
|
|
*/
|
|
|
|
void frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
2005-06-25 16:35:36 +00:00
|
|
|
OverlayColor color, FrameStyle style = kSolidLine);
|
2005-04-04 02:19:22 +00:00
|
|
|
|
2005-06-08 18:45:09 +00:00
|
|
|
/**
|
|
|
|
This method should be called to draw the specified string.
|
|
|
|
|
|
|
|
@param font The font to draw the string with
|
|
|
|
@param str The string to draw
|
|
|
|
@param x The x coordinate
|
|
|
|
@param y The y coordinate
|
|
|
|
@param w The width of the string area
|
|
|
|
@param h The height of the string area
|
|
|
|
@param color The color of the text
|
|
|
|
@param align The alignment of the text in the string width area
|
|
|
|
@param deltax
|
|
|
|
@param useEllipsis Whether to use '...' when the string is too long
|
|
|
|
*/
|
2005-06-14 01:11:48 +00:00
|
|
|
void drawString(const GUI::Font* font, const string& str, int x, int y, int w,
|
2005-06-08 18:45:09 +00:00
|
|
|
OverlayColor color, TextAlignment align = kTextAlignLeft,
|
|
|
|
int deltax = 0, bool useEllipsis = true);
|
|
|
|
|
|
|
|
|
2003-10-17 18:02:16 +00:00
|
|
|
public:
|
2003-10-26 19:40:39 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// The following methods are system-specific and must be implemented
|
|
|
|
// in derived classes.
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2005-02-21 02:23:57 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called to initialize the subsystem-specific video mode.
|
2005-02-21 02:23:57 +00:00
|
|
|
*/
|
|
|
|
virtual bool initSubsystem() = 0;
|
|
|
|
|
2006-01-19 00:45:13 +00:00
|
|
|
/**
|
|
|
|
This method is called to query the type of the FrameBuffer.
|
|
|
|
*/
|
|
|
|
virtual BufferType type() = 0;
|
|
|
|
|
2005-05-30 16:25:47 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called to set the aspect ratio of the screen.
|
2005-05-30 16:25:47 +00:00
|
|
|
*/
|
|
|
|
virtual void setAspectRatio() = 0;
|
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called whenever the screen needs to be recreated.
|
2005-02-21 02:23:57 +00:00
|
|
|
It updates the global screen variable.
|
|
|
|
*/
|
|
|
|
virtual bool createScreen() = 0;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-03-11 23:36:30 +00:00
|
|
|
/**
|
|
|
|
Switches between the filtering options in the video subsystem.
|
|
|
|
*/
|
|
|
|
virtual void toggleFilter() = 0;
|
|
|
|
|
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called anytime the MediaSource needs to be redrawn
|
2005-03-11 23:36:30 +00:00
|
|
|
to the screen.
|
|
|
|
*/
|
|
|
|
virtual void drawMediaSource() = 0;
|
|
|
|
|
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called before any drawing is done (per-frame).
|
2005-03-11 23:36:30 +00:00
|
|
|
*/
|
|
|
|
virtual void preFrameUpdate() = 0;
|
|
|
|
|
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called after any drawing is done (per-frame).
|
2005-03-11 23:36:30 +00:00
|
|
|
*/
|
|
|
|
virtual void postFrameUpdate() = 0;
|
|
|
|
|
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called to get the specified scanline data.
|
2005-03-11 23:36:30 +00:00
|
|
|
|
|
|
|
@param row The row we are looking for
|
|
|
|
@param data The actual pixel data (in bytes)
|
|
|
|
*/
|
|
|
|
virtual void scanline(uInt32 row, uInt8* data) = 0;
|
|
|
|
|
2003-10-17 18:02:16 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method is called to map a given r,g,b triple to the screen palette.
|
2005-02-21 02:23:57 +00:00
|
|
|
|
|
|
|
@param r The red component of the color.
|
|
|
|
@param g The green component of the color.
|
|
|
|
@param b The blue component of the color.
|
2003-10-17 18:02:16 +00:00
|
|
|
*/
|
2005-02-21 02:23:57 +00:00
|
|
|
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) = 0;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-02-22 18:41:16 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to draw a horizontal line.
|
2005-03-11 23:36:30 +00:00
|
|
|
|
|
|
|
@param x The first x coordinate
|
|
|
|
@param y The y coordinate
|
|
|
|
@param x2 The second x coordinate
|
|
|
|
@param color The color of the line
|
2005-02-22 18:41:16 +00:00
|
|
|
*/
|
2005-03-11 23:36:30 +00:00
|
|
|
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color) = 0;
|
2005-02-22 18:41:16 +00:00
|
|
|
|
2003-10-26 19:40:39 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to draw a vertical line.
|
2005-03-11 23:36:30 +00:00
|
|
|
|
|
|
|
@param x The x coordinate
|
|
|
|
@param y The first y coordinate
|
|
|
|
@param y2 The second y coordinate
|
|
|
|
@param color The color of the line
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
2005-03-12 01:47:15 +00:00
|
|
|
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color) = 0;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to draw a filled rectangle.
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-03-11 23:36:30 +00:00
|
|
|
@param x The x coordinate
|
|
|
|
@param y The y coordinate
|
|
|
|
@param w The width of the area
|
|
|
|
@param h The height of the area
|
|
|
|
@param color The color of the area
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
2005-03-11 23:36:30 +00:00
|
|
|
virtual void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|
|
|
OverlayColor color) = 0;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to draw the specified character.
|
2005-03-11 23:36:30 +00:00
|
|
|
|
2005-06-08 18:45:09 +00:00
|
|
|
@param font The font to use to draw the character
|
2005-03-13 03:38:41 +00:00
|
|
|
@param c The character to draw
|
2005-03-11 23:36:30 +00:00
|
|
|
@param x The x coordinate
|
|
|
|
@param y The y coordinate
|
2005-03-13 03:38:41 +00:00
|
|
|
@param color The color of the character
|
2003-10-26 19:40:39 +00:00
|
|
|
*/
|
2005-06-14 01:11:48 +00:00
|
|
|
virtual void drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y,
|
2005-06-08 18:45:09 +00:00
|
|
|
OverlayColor color) = 0;
|
2005-03-11 23:36:30 +00:00
|
|
|
|
2005-03-26 19:26:48 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to draw the bitmap image.
|
2005-03-26 19:26:48 +00:00
|
|
|
|
|
|
|
@param bitmap The data to draw
|
|
|
|
@param x The x coordinate
|
|
|
|
@param y The y coordinate
|
|
|
|
@param color The color of the character
|
|
|
|
@param h The height of the data image
|
|
|
|
*/
|
|
|
|
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, OverlayColor color,
|
|
|
|
Int32 h = 8) = 0;
|
2005-03-11 23:36:30 +00:00
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
/**
|
2005-06-08 18:45:09 +00:00
|
|
|
This method should be called to translate the given coordinates
|
2005-03-28 00:04:54 +00:00
|
|
|
to their unzoomed/unscaled equivalents.
|
|
|
|
|
|
|
|
@param x X coordinate to translate
|
|
|
|
@param y Y coordinate to translate
|
|
|
|
*/
|
|
|
|
virtual void translateCoords(Int32* x, Int32* y) = 0;
|
|
|
|
|
2005-08-01 22:33:16 +00:00
|
|
|
/**
|
|
|
|
This method should be called to add a dirty rectangle
|
|
|
|
(ie, an area of the screen that has changed)
|
|
|
|
|
|
|
|
@param x The x coordinate
|
|
|
|
@param y The y coordinate
|
|
|
|
@param w The width of the area
|
|
|
|
@param h The height of the area
|
|
|
|
*/
|
|
|
|
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) = 0;
|
|
|
|
|
2006-01-10 20:37:00 +00:00
|
|
|
/**
|
2006-01-15 16:31:01 +00:00
|
|
|
Enable/disable phosphor effect.
|
2006-01-10 20:37:00 +00:00
|
|
|
*/
|
|
|
|
virtual void enablePhosphor(bool enable) = 0;
|
|
|
|
|
2006-01-15 16:31:01 +00:00
|
|
|
/**
|
|
|
|
Completely erase contents of the screen.
|
|
|
|
*/
|
|
|
|
virtual void cls() = 0;
|
|
|
|
|
2003-10-17 18:02:16 +00:00
|
|
|
protected:
|
2005-02-21 02:23:57 +00:00
|
|
|
// The parent system for the framebuffer
|
|
|
|
OSystem* myOSystem;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
// Dimensions of the base image, before zooming.
|
|
|
|
// All external GUI items should refer to these dimensions,
|
|
|
|
// since this is the *real* size of the image.
|
|
|
|
// The other sizes are simply scaled versions of these dimensions.
|
|
|
|
SDL_Rect myBaseDim;
|
|
|
|
|
|
|
|
// Dimensions of the actual image, after zooming
|
|
|
|
SDL_Rect myImageDim;
|
|
|
|
|
|
|
|
// Dimensions of the SDL window (not always the same as the image)
|
|
|
|
SDL_Rect myScreenDim;
|
|
|
|
|
|
|
|
// Dimensions of the desktop area
|
|
|
|
SDL_Rect myDesktopDim;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
// The SDL video buffer
|
|
|
|
SDL_Surface* myScreen;
|
|
|
|
|
|
|
|
// SDL initialization flags
|
|
|
|
uInt32 mySDLFlags;
|
|
|
|
|
2006-03-24 19:59:52 +00:00
|
|
|
// TIA palettes for normal and phosphor modes
|
|
|
|
Uint32 myDefTIAPalette[256];
|
|
|
|
Uint32 myAvgTIAPalette[256][256];
|
2005-03-13 03:38:41 +00:00
|
|
|
|
2006-03-24 19:59:52 +00:00
|
|
|
// GUI palette, derived from 'ourGUIColors'
|
|
|
|
Uint32 myGUIPalette[kNumColors];
|
2006-01-10 02:09:34 +00:00
|
|
|
|
2005-02-21 02:23:57 +00:00
|
|
|
// Indicates the current zoom level of the SDL screen
|
|
|
|
uInt32 theZoomLevel;
|
|
|
|
|
|
|
|
// Indicates the maximum zoom of the SDL screen
|
|
|
|
uInt32 theMaxZoomLevel;
|
|
|
|
|
|
|
|
// The aspect ratio of the window
|
|
|
|
float theAspectRatio;
|
|
|
|
|
2006-01-11 13:25:20 +00:00
|
|
|
// Indicates if the TIA area should be redrawn
|
|
|
|
bool theRedrawTIAIndicator;
|
|
|
|
|
2005-10-18 18:49:46 +00:00
|
|
|
// Use dirty updates (SDL_UpdateRects instead of SDL_UpdateRect)
|
|
|
|
bool myUseDirtyRects;
|
|
|
|
|
2006-01-10 20:37:00 +00:00
|
|
|
// Use phosphor effect (aka no flicker on 30Hz screens)
|
|
|
|
bool myUsePhosphor;
|
|
|
|
|
|
|
|
// Amount to blend when using phosphor effect
|
|
|
|
int myPhosphorBlend;
|
|
|
|
|
2005-07-02 01:28:43 +00:00
|
|
|
// Table of RGB values for GUI elements
|
2006-03-24 19:59:52 +00:00
|
|
|
static const uInt8 ourGUIColors[kNumColors][3];
|
2005-07-02 01:28:43 +00:00
|
|
|
|
2003-10-26 19:40:39 +00:00
|
|
|
private:
|
2005-02-22 18:41:16 +00:00
|
|
|
/**
|
|
|
|
Set the icon for the main SDL window.
|
|
|
|
*/
|
|
|
|
void setWindowIcon();
|
|
|
|
|
2005-08-29 18:36:42 +00:00
|
|
|
/**
|
|
|
|
Set the icon for the main SDL window.
|
|
|
|
*/
|
|
|
|
void drawMessage();
|
|
|
|
|
2006-01-10 02:09:34 +00:00
|
|
|
/**
|
|
|
|
Used to calculate an averaged color for the 'phosphor' effect.
|
|
|
|
|
|
|
|
@param c1 Color 1
|
|
|
|
@param c2 Color 2
|
|
|
|
|
|
|
|
@return Averaged value of the two colors
|
|
|
|
*/
|
|
|
|
uInt8 getPhosphor(uInt8 c1, uInt8 c2);
|
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
private:
|
|
|
|
// Indicates the current framerate of the system
|
|
|
|
uInt32 myFrameRate;
|
|
|
|
|
|
|
|
// Indicates the current pause status
|
|
|
|
bool myPauseStatus;
|
|
|
|
|
2006-03-19 18:17:48 +00:00
|
|
|
// Used for onscreen messages
|
|
|
|
struct Message {
|
|
|
|
string text;
|
|
|
|
int counter;
|
|
|
|
int x, y, w, h;
|
|
|
|
OverlayColor color;
|
|
|
|
};
|
|
|
|
Message myMessage;
|
2005-03-28 00:04:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|