mirror of https://github.com/stella-emu/stella.git
Integrated main TIA palette and GUI colors. That means the GUI can use
any TIA color when drawing lines, characters, etc. The number of available colors is in GuiUtils::kNumColors, and is currently set to 262 (256 TIA colors, 6 GUI colors). The enumerated names for the 6 GUI colors are still used; there aren't yet any enumerations for the TIA colors, so you have to refer to them by index number. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@588 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
6eafefb3a5
commit
bd03f7d80f
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferGL.cxx,v 1.33 2005-06-28 23:18:15 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.34 2005-07-02 01:28:42 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
|
@ -142,8 +142,8 @@ bool FrameBufferGL::initSubsystem()
|
|||
|
||||
// Precompute the GUI palette
|
||||
// We abuse the concept of 'enum' by referring directly to the integer values
|
||||
for(uInt8 i = 0; i < kNumColors; i++)
|
||||
myGUIPalette[i] = mapRGB(myGUIColors[i][0], myGUIColors[i][1], myGUIColors[i][2]);
|
||||
for(uInt8 i = 0; i < kNumColors-256; i++)
|
||||
myPalette[i+256] = mapRGB(ourGUIColors[i][0], ourGUIColors[i][1], ourGUIColors[i][2]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ void FrameBufferGL::hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color)
|
|||
tmp.y = y;
|
||||
tmp.w = x2 - x + 1;
|
||||
tmp.h = 1;
|
||||
SDL_FillRect(myTexture, &tmp, myGUIPalette[color]);
|
||||
SDL_FillRect(myTexture, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -329,7 +329,7 @@ void FrameBufferGL::vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color)
|
|||
tmp.y = y;
|
||||
tmp.w = 1;
|
||||
tmp.h = y2 - y + 1;
|
||||
SDL_FillRect(myTexture, &tmp, myGUIPalette[color]);
|
||||
SDL_FillRect(myTexture, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -352,7 +352,7 @@ void FrameBufferGL::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|||
tmp.y = y;
|
||||
tmp.w = w;
|
||||
tmp.h = h;
|
||||
SDL_FillRect(myTexture, &tmp, myGUIPalette[color]);
|
||||
SDL_FillRect(myTexture, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -389,7 +389,7 @@ void FrameBufferGL::drawChar(const GUI::Font* FONT, uInt8 chr,
|
|||
rect.x = x + xorig;
|
||||
rect.y = y + yorig;
|
||||
rect.w = rect.h = 1;
|
||||
SDL_FillRect(myTexture, &rect, myGUIPalette[color]);
|
||||
SDL_FillRect(myTexture, &rect, myPalette[color]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ void FrameBufferGL::drawBitmap(uInt32* bitmap, Int32 xorig, Int32 yorig,
|
|||
rect.x = x + xorig;
|
||||
rect.y = y + yorig;
|
||||
rect.w = rect.h = 1;
|
||||
SDL_FillRect(myTexture, &rect, myGUIPalette[color]);
|
||||
SDL_FillRect(myTexture, &rect, myPalette[color]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferGL.hxx,v 1.18 2005-06-28 23:18:15 stephena Exp $
|
||||
// $Id: FrameBufferGL.hxx,v 1.19 2005-07-02 01:28:42 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_GL_HXX
|
||||
|
@ -37,7 +37,7 @@ class GUI::Font;
|
|||
This class implements an SDL OpenGL framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.18 2005-06-28 23:18:15 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.19 2005-07-02 01:28:42 stephena Exp $
|
||||
*/
|
||||
class FrameBufferGL : public FrameBuffer
|
||||
{
|
||||
|
@ -225,9 +225,6 @@ class FrameBufferGL : public FrameBuffer
|
|||
// OpenGL texture coordinates for the main surface
|
||||
GLfloat myTexCoord[4];
|
||||
|
||||
// GUI palette
|
||||
Uint32 myGUIPalette[kNumColors];
|
||||
|
||||
// The texture filtering to use
|
||||
GLint myFilterParam;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferSoft.cxx,v 1.28 2005-06-23 14:33:10 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.29 2005-07-02 01:28:42 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -66,8 +66,8 @@ bool FrameBufferSoft::initSubsystem()
|
|||
|
||||
// Precompute the GUI palette
|
||||
// We abuse the concept of 'enum' by referring directly to the integer values
|
||||
for(uInt8 i = 0; i < kNumColors; i++)
|
||||
myGUIPalette[i] = mapRGB(myGUIColors[i][0], myGUIColors[i][1], myGUIColors[i][2]);
|
||||
for(uInt8 i = 0; i < kNumColors-256; i++)
|
||||
myPalette[i+256] = mapRGB(ourGUIColors[i][0], ourGUIColors[i][1], ourGUIColors[i][2]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ void FrameBufferSoft::hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color)
|
|||
tmp.y = y * theZoomLevel;
|
||||
tmp.w = (x2 - x + 1) * theZoomLevel;
|
||||
tmp.h = theZoomLevel;
|
||||
SDL_FillRect(myScreen, &tmp, myGUIPalette[color]);
|
||||
SDL_FillRect(myScreen, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -349,7 +349,7 @@ void FrameBufferSoft::vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color)
|
|||
tmp.y = y * theZoomLevel;
|
||||
tmp.w = theZoomLevel;
|
||||
tmp.h = (y2 - y + 1) * theZoomLevel;
|
||||
SDL_FillRect(myScreen, &tmp, myGUIPalette[color]);
|
||||
SDL_FillRect(myScreen, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -373,7 +373,7 @@ void FrameBufferSoft::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
|||
tmp.w = w * theZoomLevel;
|
||||
tmp.h = h * theZoomLevel;
|
||||
myRectList->add(&tmp);
|
||||
SDL_FillRect(myScreen, &tmp, myGUIPalette[color]);
|
||||
SDL_FillRect(myScreen, &tmp, myPalette[color]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -410,7 +410,7 @@ void FrameBufferSoft::drawChar(const GUI::Font* FONT, uInt8 chr,
|
|||
rect.x = (x + xorig) * theZoomLevel;
|
||||
rect.y = (y + yorig) * theZoomLevel;
|
||||
rect.w = rect.h = theZoomLevel;
|
||||
SDL_FillRect(myScreen, &rect, myGUIPalette[color]);
|
||||
SDL_FillRect(myScreen, &rect, myPalette[color]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void FrameBufferSoft::drawBitmap(uInt32* bitmap, Int32 xorig, Int32 yorig,
|
|||
rect.x = (x + xorig) * theZoomLevel;
|
||||
rect.y = (y + yorig) * theZoomLevel;
|
||||
rect.w = rect.h = theZoomLevel;
|
||||
SDL_FillRect(myScreen, &rect, myGUIPalette[color]);
|
||||
SDL_FillRect(myScreen, &rect, myPalette[color]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferSoft.hxx,v 1.17 2005-06-16 00:55:56 stephena Exp $
|
||||
// $Id: FrameBufferSoft.hxx,v 1.18 2005-07-02 01:28:42 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_SOFT_HXX
|
||||
|
@ -35,7 +35,7 @@ class RectList;
|
|||
This class implements an SDL software framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.17 2005-06-16 00:55:56 stephena Exp $
|
||||
@version $Id: FrameBufferSoft.hxx,v 1.18 2005-07-02 01:28:42 stephena Exp $
|
||||
*/
|
||||
class FrameBufferSoft : public FrameBuffer
|
||||
{
|
||||
|
@ -191,9 +191,6 @@ class FrameBufferSoft : public FrameBuffer
|
|||
private:
|
||||
// Used in the dirty update of the SDL surface
|
||||
RectList* myRectList;
|
||||
|
||||
// GUI palette
|
||||
Uint32 myGUIPalette[kNumColors];
|
||||
};
|
||||
|
||||
class RectList
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBuffer.cxx,v 1.49 2005-06-29 00:31:49 urchlay Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.50 2005-07-02 01:28:43 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -50,21 +50,6 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
|
|||
myMessageText(""),
|
||||
myNumRedraws(0)
|
||||
{
|
||||
// Fill the GUI colors array
|
||||
// The specific video subsystem will know what to do with it
|
||||
uInt8 colors[kNumColors][3] = {
|
||||
{104, 104, 104},
|
||||
{0, 0, 0},
|
||||
{64, 64, 64},
|
||||
{32, 160, 32},
|
||||
{0, 255, 0},
|
||||
{200, 0, 0}
|
||||
};
|
||||
|
||||
for(uInt8 i = 0; i < kNumColors; i++)
|
||||
for(uInt8 j = 0; j < 3; j++)
|
||||
myGUIColors[i][j] = colors[i][j];
|
||||
|
||||
myBaseDim.x = myBaseDim.y = myBaseDim.w = myBaseDim.h = 0;
|
||||
myImageDim = myScreenDim = myDesktopDim = myBaseDim;
|
||||
}
|
||||
|
@ -670,3 +655,13 @@ void FrameBuffer::drawString(const GUI::Font* font, const string& s,
|
|||
x += w;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const uInt8 FrameBuffer::ourGUIColors[kNumColors-256][3] = {
|
||||
{104, 104, 104},
|
||||
{0, 0, 0},
|
||||
{64, 64, 64},
|
||||
{32, 160, 32},
|
||||
{0, 255, 0},
|
||||
{200, 0, 0}
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBuffer.hxx,v 1.43 2005-06-25 16:35:36 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.44 2005-07-02 01:28:43 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -52,7 +52,7 @@ enum FrameStyle {
|
|||
All GUI elements (ala ScummVM) are drawn here as well.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.43 2005-06-25 16:35:36 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.44 2005-07-02 01:28:43 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -426,10 +426,7 @@ class FrameBuffer
|
|||
uInt32 mySDLFlags;
|
||||
|
||||
// SDL palette
|
||||
Uint32 myPalette[256];
|
||||
|
||||
// Holds the palette for GUI elements
|
||||
uInt8 myGUIColors[5][3];
|
||||
Uint32 myPalette[kNumColors];
|
||||
|
||||
// Indicates the current zoom level of the SDL screen
|
||||
uInt32 theZoomLevel;
|
||||
|
@ -440,6 +437,9 @@ class FrameBuffer
|
|||
// The aspect ratio of the window
|
||||
float theAspectRatio;
|
||||
|
||||
// Table of RGB values for GUI elements
|
||||
static const uInt8 ourGUIColors[kNumColors-256][3];
|
||||
|
||||
private:
|
||||
/**
|
||||
Set the icon for the main SDL window.
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: GuiUtils.hxx,v 1.11 2005-06-16 00:55:59 stephena Exp $
|
||||
// $Id: GuiUtils.hxx,v 1.12 2005-07-02 01:28:43 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -29,7 +29,7 @@
|
|||
Probably not very neat, but at least it works ...
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: GuiUtils.hxx,v 1.11 2005-06-16 00:55:59 stephena Exp $
|
||||
@version $Id: GuiUtils.hxx,v 1.12 2005-07-02 01:28:43 stephena Exp $
|
||||
*/
|
||||
|
||||
#define kLineHeight 12
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
// Colors indices to use for the various GUI elements
|
||||
enum OverlayColor {
|
||||
kColor,
|
||||
kColor = 256, // The rest of the enumerations will continue from 256
|
||||
kBGColor,
|
||||
kShadowColor,
|
||||
kTextColor,
|
||||
|
|
Loading…
Reference in New Issue