ManaPlus
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
Graphics Class Referenceabstract

#include <graphics.h>

Inheritance diagram for Graphics:
ImegeGraphics MobileOpenGL2Graphics MobileOpenGLGraphics ModernOpenGLGraphics NormalOpenGLGraphics NullOpenGLGraphics SafeOpenGLGraphics SDLGraphics SurfaceGraphics

Public Types

enum  Alignment { LEFT = 0, CENTER, RIGHT }
 

Public Member Functions

virtual ~Graphics ()
 
void setWindow (SDL_Surface *const window, const int width, const int height)
 
SDL_Surface * getWindow () const
 
void setSync (const bool sync)
 
bool getSync () const
 
virtual bool setVideoMode (const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)=0
 
bool setFullscreen (const bool fs)
 
virtual bool resizeScreen (const int width, const int height)
 
virtual void restoreContext ()
 
virtual void drawRescaledImage (const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight)=0
 
virtual void drawPattern (const Image *const image, const int x, const int y, const int w, const int h)=0
 
virtual void drawRescaledPattern (const Image *const image, const int x, const int y, const int w, const int h, const int scaledWidth, const int scaledHeight)=0
 
virtual void drawImageRect (const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
 
virtual void calcPattern (ImageVertexes *const vert, const Image *const image, const int x, const int y, const int w, const int h) const =0
 
virtual void calcPattern (ImageCollection *const vert, const Image *const image, const int x, const int y, const int w, const int h) const =0
 
virtual void calcTileVertexes (ImageVertexes *const vert, const Image *const image, int x, int y) const =0
 
virtual void calcTileSDL (ImageVertexes *const vert, int x, int y) const
 
virtual void drawTileVertexes (const ImageVertexes *const vert)=0
 
virtual void drawTileCollection (const ImageCollection *const vertCol)=0
 
virtual void calcTileCollection (ImageCollection *const vertCol, const Image *const image, int x, int y)=0
 
virtual void calcWindow (ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
 
virtual void fillRectangle (const Rect &rectangle)=0
 
virtual void updateScreen ()=0
 
void setWindowSize (const int width, const int height)
 
int getWidth () const
 
int getHeight () const
 
int getMemoryUsage () const
 
virtual void drawNet (const int x1, const int y1, const int x2, const int y2, const int width, const int height)
 
ClipRectgetTopClip () const
 
void setRedraw (const bool n)
 
bool getRedraw () const
 
void setSecure (const bool n)
 
bool getSecure () const
 
int getBpp () const
 
bool getFullScreen () const
 
bool getHWAccel () const
 
bool getDoubleBuffer () const
 
RenderType getOpenGL () const
 
void setNoFrame (const bool n)
 
const std::string & getName () const
 
virtual void initArrays (const int vertCount)
 
virtual void setColor (const Color &color)
 
const ColorgetColor () const
 
virtual void drawImage (const Image *const image, int dstX, int dstY)=0
 
virtual void copyImage (const Image *const image, int dstX, int dstY)=0
 
virtual void drawImageCached (const Image *const image, int srcX, int srcY)=0
 
virtual void drawPatternCached (const Image *const image, const int x, const int y, const int w, const int h)=0
 
virtual void completeCache ()=0
 
int getScale () const
 
virtual bool isAllowScale () const
 
void setScale (int scale)
 
virtual void pushClipArea (const Rect &area)
 
virtual void popClipArea ()
 
virtual void drawLine (int x1, int y1, int x2, int y2)=0
 
virtual void drawRectangle (const Rect &rectangle)=0
 
virtual void createGLContext (const bool custom)
 
virtual void drawPoint (int x, int y)=0
 
virtual void beginDraw ()
 
virtual void endDraw ()
 
virtual void clearScreen () const
 
virtual void deleteArrays ()
 
virtual void postInit ()
 
virtual void finalize (ImageCollection *const col)
 
virtual void finalize (ImageVertexes *const vert)
 
virtual void testDraw ()
 
virtual void removeArray (const uint32_t sz, uint32_t *const arr)
 
virtual void screenResized ()
 

Static Public Member Functions

static void cleanUp ()
 

Data Fields

int mWidth
 
int mHeight
 
int mActualWidth
 
int mActualHeight
 

Protected Member Functions

 Graphics ()
 
void setMainFlags (const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)
 
int getOpenGLFlags () const
 
int getSoftwareFlags () const
 
bool setOpenGLMode ()
 
void updateMemoryInfo ()
 
bool videoInfo ()
 
void setOpenGLFlags ()
 

Protected Attributes

MStack< ClipRectmClipStack
 
SDL_Surface * mWindow
 
int mBpp
 
bool mAlpha
 
bool mFullscreen
 
bool mHWAccel
 
bool mRedraw
 
bool mDoubleBuffer
 
SDL_Rect mRect
 
bool mSecure
 
RenderType mOpenGL
 
bool mEnableResize
 
bool mNoFrame
 
bool mAllowHighDPI
 
std::string mName
 
int mStartFreeMem
 
bool mSync
 
int mScale
 
Color mColor
 

Static Protected Attributes

static void * mGLContext = 0
 

Friends

class OpenGLScreenshotHelper
 
class SdlScreenshotHelper
 

Detailed Description

A central point of control for graphics.

Definition at line 107 of file graphics.h.

Member Enumeration Documentation

◆ Alignment

Alignments for text drawing.

Enumerator
LEFT 
CENTER 
RIGHT 

Definition at line 128 of file graphics.h.

129  {
130  LEFT = 0,
131  CENTER,
132  RIGHT
133  };

Constructor & Destructor Documentation

◆ ~Graphics()

Graphics::~Graphics ( )
virtual

Destructor.

Definition at line 153 of file graphics.cpp.

154 {
155  endDraw();
156 }

References endDraw().

◆ Graphics()

Graphics::Graphics ( )
protected

Constructor.

Definition at line 122 of file graphics.cpp.

122  :
123  mWidth(0),
124  mHeight(0),
125  mActualWidth(0),
126  mActualHeight(0),
127  mClipStack(1000),
128  mWindow(nullptr),
129  mBpp(0),
130  mAlpha(false),
131  mFullscreen(false),
132  mHWAccel(false),
133  mRedraw(false),
134  mDoubleBuffer(false),
135  mRect(),
136  mSecure(false),
138  mEnableResize(false),
139  mNoFrame(false),
140  mAllowHighDPI(false),
141  mName("Unknown"),
142  mStartFreeMem(0),
143  mSync(false),
144  mScale(1),
145  mColor()
146 {
147  mRect.x = 0;
148  mRect.y = 0;
149  mRect.w = 0;
150  mRect.h = 0;
151 }

References mRect.

Member Function Documentation

◆ beginDraw()

virtual void Graphics::beginDraw ( )
inlinevirtual

Initializes drawing. Called by the Gui when Gui::draw() is called. It is needed by some implementations of Graphics to perform preparations before drawing. An example of such an implementation is the OpenGLGraphics.

NOTE: You will never need to call this function yourself, unless you use a Graphics object outside of Guichan.

See also
endDraw, Gui::draw

Reimplemented in ImegeGraphics, and SurfaceGraphics.

Definition at line 440 of file graphics.h.

441  { }

Referenced by Client::initGraphics().

◆ calcPattern() [1/2]

virtual void Graphics::calcPattern ( ImageCollection *const  vert,
const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
) const
pure virtual

Implemented in ImegeGraphics, and SurfaceGraphics.

◆ calcPattern() [2/2]

virtual void Graphics::calcPattern ( ImageVertexes *const  vert,
const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
) const
pure virtual

◆ calcTileCollection()

virtual void Graphics::calcTileCollection ( ImageCollection *const  vertCol,
const Image *const  image,
int  x,
int  y 
)
pure virtual

◆ calcTileSDL()

virtual void Graphics::calcTileSDL ( ImageVertexes *const  vert,
int  x,
int  y 
) const
inlinevirtual

Reimplemented in ImegeGraphics, and SurfaceGraphics.

Definition at line 223 of file graphics.h.

226  {
227  }

◆ calcTileVertexes()

virtual void Graphics::calcTileVertexes ( ImageVertexes *const  vert,
const Image *const  image,
int  x,
int  y 
) const
pure virtual

◆ calcWindow()

virtual void Graphics::calcWindow ( ImageCollection *const  vertCol,
const int  x,
const int  y,
const int  w,
const int  h,
const ImageRect imgRect 
)
pure virtual

◆ cleanUp()

void Graphics::cleanUp ( )
static

Definition at line 158 of file graphics.cpp.

159 {
160 #ifdef USE_SDL2
161  if (mRenderer)
162  {
163  SDL_DestroyRenderer(mRenderer);
164  mRenderer = nullptr;
165  }
166 #ifdef USE_OPENGL
167  if (mGLContext)
168  {
169  SDL_GL_DeleteContext(mGLContext);
170  mGLContext = nullptr;
171  }
172 #endif // USE_OPENGL
173 #endif // USE_SDL2
174 }

References mGLContext.

Referenced by Client::gameClear().

◆ clearScreen()

virtual void Graphics::clearScreen ( ) const
inlinevirtual

Definition at line 455 of file graphics.h.

456  { }

Referenced by Map::draw(), and TestLauncher::testTextures().

◆ completeCache()

virtual void Graphics::completeCache ( )
pure virtual

Implemented in SurfaceGraphics, and ImegeGraphics.

◆ copyImage()

virtual void Graphics::copyImage ( const Image *const  image,
int  dstX,
int  dstY 
)
pure virtual

Implemented in SurfaceGraphics, and ImegeGraphics.

◆ createGLContext()

void Graphics::createGLContext ( const bool  custom)
virtual

Reimplemented in ModernOpenGLGraphics, and MobileOpenGL2Graphics.

Definition at line 417 of file graphics.cpp.

418 {
419 #ifdef USE_SDL2
420  mGLContext = SDL_GL_CreateContext(mWindow);
421 #endif // USE_SDL2
422 }

Referenced by MobileOpenGL2Graphics::createGLContext(), ModernOpenGLGraphics::createGLContext(), GraphicsManager::detectGraphics(), and setOpenGLMode().

◆ deleteArrays()

virtual void Graphics::deleteArrays ( )
inlinevirtual

Definition at line 458 of file graphics.h.

459  { }

◆ drawImage()

virtual void Graphics::drawImage ( const Image *const  image,
int  dstX,
int  dstY 
)
pure virtual

◆ drawImageCached()

virtual void Graphics::drawImageCached ( const Image *const  image,
int  srcX,
int  srcY 
)
pure virtual

Implemented in SurfaceGraphics, and ImegeGraphics.

◆ drawImageRect()

virtual void Graphics::drawImageRect ( const int  x,
const int  y,
const int  w,
const int  h,
const ImageRect imgRect 
)
pure virtual

◆ drawLine()

virtual void Graphics::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)
pure virtual

Ddraws a line.

Parameters
x1The first x coordinate.
y1The first y coordinate.
x2The second x coordinate.
y2The second y coordinate.

Implemented in SurfaceGraphics, and ImegeGraphics.

Referenced by AvatarListBox::draw(), DropDown::draw(), StaticBrowserBox::draw(), BrowserBox::draw(), TextField::drawCaret(), TextBox::drawCaret(), AvatarListBox::safeDraw(), and TestLauncher::testDraw().

◆ drawNet()

void Graphics::drawNet ( const int  x1,
const int  y1,
const int  x2,
const int  y2,
const int  width,
const int  height 
)
virtual

Reimplemented in SurfaceGraphics, and ImegeGraphics.

Definition at line 652 of file graphics.cpp.

655 {
656  for (int y = y1; y < y2; y += height)
657  drawLine(x1, y, x2, y);
658 
659  for (int x = x1; x < x2; x += width)
660  drawLine(x, y1, x, y2);
661 }

References drawLine(), x, and y.

Referenced by TestLauncher::testDraw().

◆ drawPattern()

virtual void Graphics::drawPattern ( const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
)
pure virtual

◆ drawPatternCached()

virtual void Graphics::drawPatternCached ( const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h 
)
pure virtual

Implemented in SurfaceGraphics, and ImegeGraphics.

◆ drawPoint()

virtual void Graphics::drawPoint ( int  x,
int  y 
)
pure virtual

Draws a single point/pixel.

Parameters
xThe x coordinate.
yThe y coordinate.

Implemented in SurfaceGraphics, and ImegeGraphics.

Referenced by TestLauncher::testDraw().

◆ drawRectangle()

virtual void Graphics::drawRectangle ( const Rect rectangle)
pure virtual

Draws a simple, non-filled, rectangle with a one pixel width.

Parameters
rectangleThe rectangle to draw.

Implemented in SurfaceGraphics, and ImegeGraphics.

Referenced by CastingEffect::draw(), SpellShortcutContainer::draw(), OutfitWindow::draw(), DropDown::draw(), MapItem::draw(), Minimap::draw2(), SpellShortcutContainer::safeDraw(), OutfitWindow::safeDraw(), and TestLauncher::testDraw().

◆ drawRescaledImage()

virtual void Graphics::drawRescaledImage ( const Image *const  image,
int  dstX,
int  dstY,
const int  desiredWidth,
const int  desiredHeight 
)
pure virtual

Draws a resclaled version of the image

Implemented in ImegeGraphics, and SurfaceGraphics.

Referenced by Desktop::draw(), and TestLauncher::testDraw().

◆ drawRescaledPattern()

virtual void Graphics::drawRescaledPattern ( const Image *const  image,
const int  x,
const int  y,
const int  w,
const int  h,
const int  scaledWidth,
const int  scaledHeight 
)
pure virtual

Draw a pattern based on a rescaled version of the given image...

Implemented in ImegeGraphics, and SurfaceGraphics.

Referenced by AmbientLayer::draw(), and TestLauncher::testDraw().

◆ drawTileCollection()

virtual void Graphics::drawTileCollection ( const ImageCollection *const  vertCol)
pure virtual

◆ drawTileVertexes()

virtual void Graphics::drawTileVertexes ( const ImageVertexes *const  vert)
pure virtual

◆ endDraw()

virtual void Graphics::endDraw ( )
inlinevirtual

Deinitializes drawing. Called by the Gui when a Gui::draw() is done. done. It should reset any state changes made by beginDraw().

NOTE: You will never need to call this function yourself, unless you use a Graphics object outside of Guichan.

See also
beginDraw, Gui::draw

Reimplemented in ImegeGraphics, and SurfaceGraphics.

Definition at line 452 of file graphics.h.

453  { }

Referenced by ~Graphics().

◆ fillRectangle()

virtual void Graphics::fillRectangle ( const Rect rectangle)
pure virtual

◆ finalize() [1/2]

virtual void Graphics::finalize ( ImageCollection *const  col)
inlinevirtual

◆ finalize() [2/2]

virtual void Graphics::finalize ( ImageVertexes *const  vert)
inlinevirtual

Reimplemented in ModernOpenGLGraphics, and MobileOpenGL2Graphics.

Definition at line 468 of file graphics.h.

470  { }

◆ getBpp()

int Graphics::getBpp ( ) const
inline

Definition at line 295 of file graphics.h.

296  { return mBpp; }

References mBpp.

◆ getColor()

const Color& Graphics::getColor ( ) const
inline

Definition at line 325 of file graphics.h.

326  { return mColor; }

References mColor.

◆ getDoubleBuffer()

bool Graphics::getDoubleBuffer ( ) const
inline

Definition at line 304 of file graphics.h.

305  { return mDoubleBuffer; }

References mDoubleBuffer.

◆ getFullScreen()

bool Graphics::getFullScreen ( ) const
inline

Definition at line 298 of file graphics.h.

299  { return mFullscreen; }

References mFullscreen.

◆ getHeight()

int Graphics::getHeight ( ) const

Returns the height of the screen.

Definition at line 647 of file graphics.cpp.

648 {
649  return mHeight;
650 }

References mHeight.

Referenced by ChatWindow::ChatWindow(), Minimap::draw2(), CharCreateDialog::setButtonsPosition(), setConfigDefaults2(), PopupMenu::showPopup(), Client::stateGame(), and Client::stateGame1().

◆ getHWAccel()

bool Graphics::getHWAccel ( ) const
inline

Definition at line 301 of file graphics.h.

302  { return mHWAccel; }

References mHWAccel.

◆ getMemoryUsage()

int Graphics::getMemoryUsage ( ) const

Definition at line 440 of file graphics.cpp.

441 {
442 #ifdef USE_OPENGL
443  if (mStartFreeMem == 0)
444  return 0;
445 
446  if (graphicsManager.supportExtension("GL_NVX_gpu_memory_info"))
447  {
448  GLint val;
450  &val);
451  return mStartFreeMem - val;
452  }
453 #endif // USE_OPENGL
454  return 0;
455 }

References GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, graphicsManager, mStartFreeMem, and GraphicsManager::supportExtension().

◆ getName()

const std::string& Graphics::getName ( ) const
inline

Definition at line 313 of file graphics.h.

314  { return mName; }

References mName.

Referenced by UserAgent::update().

◆ getOpenGL()

RenderType Graphics::getOpenGL ( ) const
inline

Definition at line 307 of file graphics.h.

308  { return mOpenGL; }

References mOpenGL.

Referenced by Game::Game(), setOpenGLMode(), and Game::slowLogic().

◆ getOpenGLFlags()

int Graphics::getOpenGLFlags ( ) const
protected

< Allow any video depth/pixel-format

< Create an OpenGL rendering context

< Surface is a full screen display

< This video mode may be resized

< No window caption or edge frame

Definition at line 241 of file graphics.cpp.

242 {
243 #ifdef USE_OPENGL
244 
245 #ifdef USE_SDL2
246  int displayFlags = SDL_WINDOW_OPENGL;
247  if (mFullscreen)
248  displayFlags |= SDL_WINDOW_FULLSCREEN;
249 #if SDL_VERSION_ATLEAST(2, 0, 1)
250  if (mAllowHighDPI)
251  displayFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
252 #endif // SDL_VERSION_ATLEAST(2, 0, 1)
253 #else // USE_SDL2
254 
255  int displayFlags = SDL_ANYFORMAT | SDL_OPENGL;
256 #endif // USE_SDL2
257 
258  if (mFullscreen)
259  {
260  displayFlags |= SDL_FULLSCREEN;
261  }
262  else
263  {
264  // Resizing currently not supported on Windows, where it would require
265  // reuploading all textures.
266 #if !defined(_WIN32)
267  if (mEnableResize)
268  displayFlags |= SDL_RESIZABLE;
269 #endif // !defined(_WIN32)
270  }
271 
272  if (mNoFrame)
273  displayFlags |= SDL_NOFRAME;
274 
275  return displayFlags;
276 #else // USE_OPENGL
277 
278  return 0;
279 #endif // USE_OPENGL
280 }

References mAllowHighDPI, mEnableResize, mFullscreen, and mNoFrame.

Referenced by setOpenGLMode().

◆ getRedraw()

bool Graphics::getRedraw ( ) const
inline

◆ getScale()

int Graphics::getScale ( ) const
inline

Definition at line 365 of file graphics.h.

366  { return mScale; }

References mScale.

Referenced by WindowManager::applyScale(), Gui::getMouseState(), and SDLInput::pushInput().

◆ getSecure()

bool Graphics::getSecure ( ) const
inline

Definition at line 292 of file graphics.h.

293  { return mSecure; }

References mSecure.

Referenced by AvatarListBox::draw(), and AvatarListBox::safeDraw().

◆ getSoftwareFlags()

int Graphics::getSoftwareFlags ( ) const
protected

< Allow any video depth/pixel-format

< Surface is in video memory

< Set up double-buffered video mode

< Surface is in system memory

< Surface is a full screen display

< This video mode may be resized

< No window caption or edge frame

Definition at line 388 of file graphics.cpp.

389 {
390 #ifdef USE_SDL2
391  int displayFlags = SDL_WINDOW_SHOWN;
392 #if SDL_VERSION_ATLEAST(2, 0, 1)
393  if (mAllowHighDPI)
394  displayFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
395 #endif // SDL_VERSION_ATLEAST(2, 0, 1)
396 #else // USE_SDL2
397 
398  int displayFlags = SDL_ANYFORMAT;
399 
400  if (mHWAccel)
401  displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
402  else
403  displayFlags |= SDL_SWSURFACE;
404 #endif // USE_SDL2
405 
406  if (mFullscreen)
407  displayFlags |= SDL_FULLSCREEN;
408  else if (mEnableResize)
409  displayFlags |= SDL_RESIZABLE;
410 
411  if (mNoFrame)
412  displayFlags |= SDL_NOFRAME;
413  return displayFlags;
414 }

References mAllowHighDPI, mEnableResize, mFullscreen, mHWAccel, and mNoFrame.

◆ getSync()

bool Graphics::getSync ( ) const
inline

Definition at line 152 of file graphics.h.

153  { return mSync; }

References mSync.

◆ getTopClip()

ClipRect& Graphics::getTopClip ( ) const
inline

◆ getWidth()

int Graphics::getWidth ( ) const

Returns the width of the screen.

Definition at line 642 of file graphics.cpp.

643 {
644  return mWidth;
645 }

References mWidth.

Referenced by CharacterDisplay::CharacterDisplay(), CharSelectDialog::CharSelectDialog(), ChatWindow::ChatWindow(), Minimap::draw2(), Client::stateGame(), and Client::stateGame1().

◆ getWindow()

SDL_Surface* Graphics::getWindow ( ) const
inline

◆ initArrays()

virtual void Graphics::initArrays ( const int  vertCount)
inlinevirtual

Definition at line 316 of file graphics.h.

317  { }

Referenced by setOpenGLMode().

◆ isAllowScale()

virtual bool Graphics::isAllowScale ( ) const
inlinevirtual

Definition at line 368 of file graphics.h.

369  { return false; }

◆ popClipArea()

void Graphics::popClipArea ( )
virtual

Removes the top most clip area from the stack.

Exceptions
Exceptionif the stack is empty.

Reimplemented in ImegeGraphics, and SurfaceGraphics.

Definition at line 738 of file graphics.cpp.

739 {
740  if (mClipStack.empty())
741  return;
742 
743  mClipStack.pop();
744 }

References MStack< T >::empty(), mClipStack, and MStack< T >::pop().

Referenced by GuiTable::draw(), Gui::draw(), Minimap::draw2(), GuiTable::safeDraw(), and TestLauncher::testDraw().

◆ postInit()

virtual void Graphics::postInit ( )
inlinevirtual

Reimplemented in ModernOpenGLGraphics, MobileOpenGL2Graphics, and MobileOpenGLGraphics.

Definition at line 461 of file graphics.h.

462  { }

Referenced by Client::gameInit().

◆ pushClipArea()

void Graphics::pushClipArea ( const Rect area)
virtual

Pushes a clip area onto the stack. The x and y coordinates in the rectangle is relative to the last pushed clip area. If the new area falls outside the current clip area, it will be clipped as necessary.

If a clip area is outside of the top clip area a clip area with zero width and height will be pushed.

Parameters
areaThe clip area to be pushed onto the stack.

Reimplemented in ImegeGraphics, and SurfaceGraphics.

Definition at line 676 of file graphics.cpp.

677 {
678  // Ignore area with a negate width or height
679  // by simple pushing an empty clip area
680  // to the stack.
681  if (area.width < 0 || area.height < 0)
682  {
683  ClipRect &carea = mClipStack.push();
684  carea.x = 0;
685  carea.y = 0;
686  carea.width = 0;
687  carea.height = 0;
688  carea.xOffset = 0;
689  carea.yOffset = 0;
690  return;
691  }
692 
693  if (mClipStack.empty())
694  {
695  ClipRect &carea = mClipStack.push();
696  carea.x = area.x;
697  carea.y = area.y;
698  carea.width = area.width;
699  carea.height = area.height;
700  carea.xOffset = area.x;
701  carea.yOffset = area.y;
702  return;
703  }
704 
705  const ClipRect &top = mClipStack.top();
706  ClipRect &carea = mClipStack.push();
707  carea.x = area.x + top.xOffset;
708  carea.y = area.y + top.yOffset;
709  carea.width = area.width;
710  carea.height = area.height;
711  carea.xOffset = top.xOffset + area.x;
712  carea.yOffset = top.yOffset + area.y;
713 
714  // Clamp the pushed clip rectangle.
715  if (carea.x < top.x)
716  carea.x = top.x;
717 
718  if (carea.y < top.y)
719  carea.y = top.y;
720 
721  if (carea.x + carea.width > top.x + top.width)
722  {
723  carea.width = top.x + top.width - carea.x;
724 
725  if (carea.width < 0)
726  carea.width = 0;
727  }
728 
729  if (carea.y + carea.height > top.y + top.height)
730  {
731  carea.height = top.y + top.height - carea.y;
732 
733  if (carea.height < 0)
734  carea.height = 0;
735  }
736 }

References Rect::height, top, Rect::width, Rect::x, ClipRect::xOffset, Rect::y, and ClipRect::yOffset.

Referenced by GuiTable::draw(), Gui::draw(), Minimap::draw2(), GuiTable::safeDraw(), and TestLauncher::testDraw().

◆ removeArray()

virtual void Graphics::removeArray ( const uint32_t  sz,
uint32_t *const  arr 
)
inlinevirtual

Reimplemented in ModernOpenGLGraphics, and MobileOpenGL2Graphics.

Definition at line 475 of file graphics.h.

478  { }

Referenced by OpenGLGraphicsVertexes::clear().

◆ resizeScreen()

bool Graphics::resizeScreen ( const int  width,
const int  height 
)
virtual

Resize the window to the specified size.

Definition at line 557 of file graphics.cpp.

559 {
560 #ifdef USE_SDL2
561  endDraw();
562 
563  mRect.w = CAST_S32(width / mScale);
564  mRect.h = CAST_S32(height / mScale);
565  mWidth = width / mScale;
566  mHeight = height / mScale;
567  mActualWidth = width;
568  mActualHeight = height;
569 
570 #ifdef USE_OPENGL
571  // +++ probably this way will not work in windows/mac
572  // Setup OpenGL
573  glViewport(0, 0, mActualWidth, mActualHeight);
574  glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
575 #else // USE_OPENGL
576  // +++ need impliment resize in soft mode
577 #endif // USE_OPENGL
578 
579  screenResized();
580  beginDraw();
581  return true;
582 
583 #else // USE_SDL2
584 
585  const int prevWidth = mWidth;
586  const int prevHeight = mHeight;
587 
588  endDraw();
589 
590  bool success = true;
591 #ifdef __native_client__
592  if (mOpenGL != RENDER_SOFTWARE)
593  {
594  mRect.w = CAST_S32(width / mScale);
595  mRect.h = CAST_S32(height / mScale);
596  mWidth = width / mScale;
597  mHeight = height / mScale;
598  mActualWidth = width;
599  mActualHeight = height;
600 #ifdef USE_OPENGL
601  naclResizeBuffers(mActualWidth, mActualHeight);
602  glViewport(0, 0, mActualWidth, mActualHeight);
603 #endif // USE_OPENGL
604  }
605  else
606 #endif // __native_client__
607  {
608  success = setVideoMode(width, height,
609  mScale,
610  mBpp,
611  mFullscreen,
612  mHWAccel,
614  mNoFrame,
615  mAllowHighDPI);
616 
617  // If it didn't work, try to restore the previous size. If that didn't
618  // work either, bail out (but then we're in deep trouble).
619  if (!success)
620  {
621  if (!setVideoMode(prevWidth, prevHeight,
622  mScale,
623  mBpp,
624  mFullscreen,
625  mHWAccel,
627  mNoFrame,
628  mAllowHighDPI))
629  {
630  return false;
631  }
632  }
633  }
634 
635  screenResized();
636  beginDraw();
637 
638  return success;
639 #endif // USE_SDL2
640 }

References beginDraw(), CAST_S32, endDraw(), RENDER_SOFTWARE, and setVideoMode().

Referenced by WindowManager::resizeVideo().

◆ restoreContext()

virtual void Graphics::restoreContext ( )
inlinevirtual

Definition at line 178 of file graphics.h.

179  { }

◆ screenResized()

virtual void Graphics::screenResized ( )
inlinevirtual

Reimplemented in ModernOpenGLGraphics, and MobileOpenGL2Graphics.

Definition at line 480 of file graphics.h.

481  { }

◆ setColor()

virtual void Graphics::setColor ( const Color color)
inlinevirtual

◆ setFullscreen()

bool Graphics::setFullscreen ( const bool  fs)

Set fullscreen mode.

Definition at line 541 of file graphics.cpp.

542 {
543  if (mFullscreen == fs)
544  return true;
545 
546  return setVideoMode(mActualWidth,
548  mScale,
549  mBpp,
550  fs,
551  mHWAccel,
553  mNoFrame,
554  mAllowHighDPI);
555 }

References setVideoMode().

Referenced by WindowManager::setFullScreen().

◆ setMainFlags()

void Graphics::setMainFlags ( const int  w,
const int  h,
const int  scale,
const int  bpp,
const bool  fs,
const bool  hwaccel,
const bool  resize,
const bool  noFrame,
const bool  allowHighDPI 
)
protected

Definition at line 181 of file graphics.cpp.

189 {
190  logger->log("graphics backend: %s", getName().c_str());
191  logger->log("Setting video mode %dx%d %s",
192  w, h, fs ? "fullscreen" : "windowed");
193 
194  mBpp = bpp;
195  mFullscreen = fs;
196  mHWAccel = hwaccel;
197  mEnableResize = resize;
198  mNoFrame = noFrame;
199  mAllowHighDPI = allowHighDPI;
200  mActualWidth = w;
201  mActualHeight = h;
202  setScale(scale);
203 }

References GroupDb::getName(), Logger::log(), and logger.

◆ setNoFrame()

void Graphics::setNoFrame ( const bool  n)
inline

Definition at line 310 of file graphics.h.

311  { mNoFrame = n; }

References mNoFrame.

◆ setOpenGLFlags()

void Graphics::setOpenGLFlags ( )
protected

Definition at line 747 of file graphics.cpp.

748 {
749  // here disable/enable probably need convert to mgl
750 
751  glEnable(GL_SCISSOR_TEST);
752 
753  glDisable(GL_MULTISAMPLE);
754  glDisable(GL_DITHER);
755  glDisable(GL_DEPTH_TEST);
756  glDisable(GL_LINE_SMOOTH);
757  glDisable(GL_POLYGON_SMOOTH);
758  glDisable(GL_STENCIL_TEST);
759  glDisable(GL_COLOR_LOGIC_OP);
760  glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
761  glDisable(GL_DEPTH_CLAMP);
762  glDisable(GL_RASTERIZER_DISCARD);
763  glDisable(GL_SAMPLE_MASK);
764 
765 #ifndef ANDROID
766 #ifndef __MINGW32__
767  glHint(GL_TEXTURE_COMPRESSION_HINT, GL_FASTEST);
768 #endif // __MINGW32__
769 #endif // ANDROID
770 
771  glHint(GL_TEXTURE_COMPRESSION_HINT_ARB, GL_FASTEST);
772 
773  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
774 }

References GL_DEPTH_BOUNDS_TEST_EXT, GL_DEPTH_CLAMP, GL_POLYGON_SMOOTH, GL_RASTERIZER_DISCARD, GL_SAMPLE_MASK, and GL_TEXTURE_COMPRESSION_HINT_ARB.

◆ setOpenGLMode()

bool Graphics::setOpenGLMode ( )
protected

Definition at line 282 of file graphics.cpp.

283 {
284 #ifdef USE_OPENGL
285  SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
288  mBpp, getOpenGLFlags())) == nullptr)
289  {
290  logger->log("Window/context creation failed");
291  mRect.w = 0;
292  mRect.h = 0;
293  return false;
294  }
295 
296 #if defined(USE_X11)
297  Glx::initFunctions();
298 #endif // defined(USE_X11)
299 #ifdef __native_client__
300  NaclGles::initGles();
301 #endif // __native_client__
302 
303 #ifdef USE_SDL2
304  int w1 = 0;
305  int h1 = 0;
306  SDL_GetWindowSize(mWindow, &w1, &h1);
307  mRect.w = CAST_S32(w1 / mScale);
308  mRect.h = CAST_S32(h1 / mScale);
309 
310  createGLContext(config.getBoolValue("openglContext"));
311 #else // USE_SDL2
312 
313  createGLContext(config.getBoolValue("openglContext"));
314  mRect.w = CAST_U16(mWindow->w / mScale);
315  mRect.h = CAST_U16(mWindow->h / mScale);
316 
317 #endif // USE_SDL2
318 
319 #ifdef __APPLE__
320  if (mSync)
321  {
322  const GLint VBL = 1;
323  CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
324  }
325 #endif // __APPLE__
326 
329 
330  // Setup OpenGL
331  glViewport(0, 0, mActualWidth, mActualHeight);
332  int gotDoubleBuffer = 0;
333  SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &gotDoubleBuffer);
334  logger->log("Using OpenGL %s double buffering.",
335  (gotDoubleBuffer != 0 ? "with" : "without"));
336 
342 
343  GLint texSize;
344  bool rectTex = graphicsManager.supportExtension(
345  "GL_ARB_texture_rectangle") ||
346  graphicsManager.supportExtension("GL_EXT_texture_rectangle");
347 
348  if (rectTex
353  && config.getBoolValue("rectangulartextures")
355  {
356  logger->log1("using GL_ARB_texture_rectangle");
358  glEnable(GL_TEXTURE_RECTANGLE_ARB);
359  glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &texSize);
361  logger->log("OpenGL texture size: %d pixels (rectangle textures)",
363 #if !defined(ANDROID) && !defined(__SWITCH__)
366 #endif // ANDROID
367  }
368  else
369  {
370  glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
371  OpenGLImageHelper::mTextureType = GL_TEXTURE_2D;
373 #if !defined(ANDROID) && !defined(__SWITCH__)
374  SafeOpenGLImageHelper::mTextureType = GL_TEXTURE_2D;
376 #endif // ANDROID
377 
378  logger->log("OpenGL texture size: %d pixels",
380  }
381  return videoInfo();
382 #else // USE_OPENGL
383 
384  return false;
385 #endif // USE_OPENGL
386 }

References CAST_S32, CAST_U16, config, createGLContext(), GraphicsManager::createWindow(), Configuration::getBoolValue(), OpenGLImageHelper::getInternalTextureType(), GraphicsManager::getMaxVertices(), getOpenGL(), getOpenGLFlags(), GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, GL_TEXTURE_RECTANGLE_ARB, graphicsManager, initArrays(), GraphicsManager::initOpenGL(), GraphicsManager::isUseTextureSampler(), Logger::log(), Logger::log1(), logger, GraphicsManager::logVersion(), mActualHeight, mActualWidth, mBpp, mRect, mScale, mSync, OpenGLImageHelper::mTextureSize, SafeOpenGLImageHelper::mTextureSize, OpenGLImageHelper::mTextureType, SafeOpenGLImageHelper::mTextureType, mWindow, RENDER_GLES2_OPENGL, RENDER_GLES_OPENGL, RENDER_MODERN_OPENGL, GraphicsManager::setGLVersion(), GraphicsManager::supportExtension(), updateMemoryInfo(), GraphicsManager::updateTextureCompressionFormat(), GraphicsManager::updateTextureFormat(), and videoInfo().

◆ setRedraw()

void Graphics::setRedraw ( const bool  n)
inline

Definition at line 283 of file graphics.h.

284  { mRedraw = n; }

References mRedraw.

Referenced by Window::draw(), and ScrollArea::draw().

◆ setScale()

void Graphics::setScale ( int  scale)

Definition at line 205 of file graphics.cpp.

206 {
207  if (isAllowScale())
208  {
209  if (scale == 0)
210  scale = 1;
211  int scaleW = mActualWidth / scale;
212  int scaleH = mActualHeight / scale;
213  if (scaleW < 470)
214  {
215  scale = mActualWidth / 470;
216  if (scale < 1)
217  scale = 1;
218  scaleH = mActualHeight / scale;
219  }
220  if (scaleH < 320)
221  {
222  scale = mActualHeight / 320;
223  if (scale < 1)
224  scale = 1;
225  }
226  logger->log("set scale: %d", scale);
227  mScale = scale;
230  }
231  else
232  {
233  mScale = 1;
236  }
237  mRect.w = static_cast<RectSize>(mWidth);
238  mRect.h = static_cast<RectSize>(mHeight);
239 }

References isAllowScale(), Logger::log(), logger, and RectSize.

Referenced by WindowManager::applyScale().

◆ setSecure()

void Graphics::setSecure ( const bool  n)
inline

Definition at line 289 of file graphics.h.

290  { mSecure = n; }

References mSecure.

Referenced by Game::createScreenshot().

◆ setSync()

void Graphics::setSync ( const bool  sync)

Sets whether vertical refresh syncing is enabled. Takes effect after the next call to setVideoMode(). Only implemented on MacOS for now.

Definition at line 176 of file graphics.cpp.

177 {
178  mSync = sync;
179 }

References Ea::BeingRecv::mSync.

◆ setVideoMode()

virtual bool Graphics::setVideoMode ( const int  w,
const int  h,
const int  scale,
const int  bpp,
const bool  fs,
const bool  hwaccel,
const bool  resize,
const bool  noFrame,
const bool  allowHighDPI 
)
pure virtual

Try to create a window with the given settings.

Implemented in SurfaceGraphics, and ImegeGraphics.

Referenced by GraphicsManager::setVideoMode().

◆ setWindow()

void Graphics::setWindow ( SDL_Surface *const  window,
const int  width,
const int  height 
)
inline

Definition at line 135 of file graphics.h.

137  {
138  mWindow = window;
139  mRect.w = static_cast<RectSize>(width);
140  mRect.h = static_cast<RectSize>(height);
141  }

References mRect, mWindow, and RectSize.

Referenced by GraphicsManager::detectGraphics().

◆ setWindowSize()

void Graphics::setWindowSize ( const int  width,
const int  height 
)

Definition at line 670 of file graphics.cpp.

672 {
673 }

Referenced by Setup_Video::action().

◆ testDraw()

virtual void Graphics::testDraw ( )
inlinevirtual

Reimplemented in NormalOpenGLGraphics, ModernOpenGLGraphics, MobileOpenGL2Graphics, and SafeOpenGLGraphics.

Definition at line 472 of file graphics.h.

473  { }

Referenced by TestLauncher::testFps2().

◆ updateMemoryInfo()

void Graphics::updateMemoryInfo ( )
protected

Definition at line 425 of file graphics.cpp.

426 {
427 #ifdef USE_OPENGL
428  if (mStartFreeMem != 0)
429  return;
430 
431  if (graphicsManager.supportExtension("GL_NVX_gpu_memory_info"))
432  {
434  &mStartFreeMem);
435  logger->log("free video memory: %d", mStartFreeMem);
436  }
437 #endif // USE_OPENGL
438 }

References GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, graphicsManager, Logger::log(), logger, mStartFreeMem, and GraphicsManager::supportExtension().

Referenced by setOpenGLMode().

◆ updateScreen()

virtual void Graphics::updateScreen ( )
pure virtual

Updates the screen. This is done by either copying the buffer to the screen or swapping pages.

Implemented in SurfaceGraphics, and ImegeGraphics.

Referenced by Client::gameExec(), PRAGMA45(), TestLauncher::testBackend(), TestLauncher::testDraw(), TestLauncher::testFps2(), TestLauncher::testFps3(), and TestLauncher::testTextures().

◆ videoInfo()

bool Graphics::videoInfo ( )
protected

< Set up double-buffered video mode

< Set up double-buffered video mode

Definition at line 482 of file graphics.cpp.

483 {
484  logger->log("SDL video info");
485 #ifdef USE_SDL2
486  logger->log("Using video driver: %s", SDL_GetCurrentVideoDriver());
487 
488  if (mRenderer)
489  {
490  SDL_RendererInfo info;
491  SDL_GetRendererInfo(mRenderer, &info);
492  dumpRendererInfo("Current SDL renderer name: %s", info);
493 
494  const int num = SDL_GetNumRenderDrivers();
495  logger->log("Known renderers");
496  for (int f = 0; f < num; f ++)
497  {
498  if (!SDL_GetRenderDriverInfo(f, &info))
499  dumpRendererInfo("renderer name: %s", info);
500  }
501  }
502 #else // USE_SDL2
503 
504  char videoDriverName[65];
505  if (SDL_VideoDriverName(videoDriverName, 64) != nullptr)
506  logger->log("Using video driver: %s", videoDriverName);
507  else
508  logger->log1("Using video driver: unknown");
509  mDoubleBuffer = ((mWindow->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF);
510  logger->log("Double buffer mode: %s", mDoubleBuffer ? "yes" : "no");
511 
513 
514  const SDL_VideoInfo *restrict const vi = SDL_GetVideoInfo();
515  if (vi == nullptr)
516  return false;
517 
518  logger->log("Possible to create hardware surfaces: %s",
519  ((vi->hw_available) != 0U ? "yes" : "no"));
520  logger->log("Window manager available: %s",
521  ((vi->wm_available) != 0U ? "yes" : "no"));
522  logger->log("Accelerated hardware to hardware blits: %s",
523  ((vi->blit_hw) != 0U ? "yes" : "no"));
524  logger->log("Accelerated hardware to hardware colorkey blits: %s",
525  ((vi->blit_hw_CC) != 0U ? "yes" : "no"));
526  logger->log("Accelerated hardware to hardware alpha blits: %s",
527  ((vi->blit_hw_A) != 0U ? "yes" : "no"));
528  logger->log("Accelerated software to hardware blits: %s",
529  ((vi->blit_sw) != 0U ? "yes" : "no"));
530  logger->log("Accelerated software to hardware colorkey blits: %s",
531  ((vi->blit_sw_CC) != 0U ? "yes" : "no"));
532  logger->log("Accelerated software to hardware alpha blits: %s",
533  ((vi->blit_sw_A) != 0U ? "yes" : "no"));
534  logger->log("Accelerated color fills: %s",
535  ((vi->blit_fill) != 0U ? "yes" : "no"));
536 #endif // USE_SDL2
537 
538  return true;
539 }

References ImageHelper::dumpSurfaceFormat(), Actions::info(), Logger::log(), Logger::log1(), logger, mDoubleBuffer, mWindow, and restrict.

Referenced by setOpenGLMode().

Friends And Related Function Documentation

◆ OpenGLScreenshotHelper

friend class OpenGLScreenshotHelper
friend

Definition at line 111 of file graphics.h.

◆ SdlScreenshotHelper

friend class SdlScreenshotHelper
friend

Definition at line 114 of file graphics.h.

Field Documentation

◆ mActualHeight

int Graphics::mActualHeight

◆ mActualWidth

int Graphics::mActualWidth

◆ mAllowHighDPI

bool Graphics::mAllowHighDPI
protected

Definition at line 547 of file graphics.h.

Referenced by getOpenGLFlags(), and getSoftwareFlags().

◆ mAlpha

bool Graphics::mAlpha
protected

Definition at line 537 of file graphics.h.

Referenced by disableTexturingAndBlending(), enableTexturingAndBlending(), and setColor().

◆ mBpp

int Graphics::mBpp
protected

Definition at line 536 of file graphics.h.

Referenced by getBpp(), and setOpenGLMode().

◆ mClipStack

MStack<ClipRect> Graphics::mClipStack
protected

Holds the clip area stack.

Definition at line 520 of file graphics.h.

Referenced by getTopClip(), and popClipArea().

◆ mColor

Color Graphics::mColor
protected

◆ mDoubleBuffer

bool Graphics::mDoubleBuffer
protected

Definition at line 541 of file graphics.h.

Referenced by getDoubleBuffer(), and videoInfo().

◆ mEnableResize

bool Graphics::mEnableResize
protected

Definition at line 545 of file graphics.h.

Referenced by getOpenGLFlags(), and getSoftwareFlags().

◆ mFullscreen

bool Graphics::mFullscreen
protected

Definition at line 538 of file graphics.h.

Referenced by getFullScreen(), getOpenGLFlags(), and getSoftwareFlags().

◆ mGLContext

void * Graphics::mGLContext = 0
staticprotected

Definition at line 532 of file graphics.h.

Referenced by cleanUp().

◆ mHeight

int Graphics::mHeight

◆ mHWAccel

bool Graphics::mHWAccel
protected

Definition at line 539 of file graphics.h.

Referenced by getHWAccel(), and getSoftwareFlags().

◆ mName

std::string Graphics::mName
protected

◆ mNoFrame

bool Graphics::mNoFrame
protected

Definition at line 546 of file graphics.h.

Referenced by getOpenGLFlags(), getSoftwareFlags(), and setNoFrame().

◆ mOpenGL

RenderType Graphics::mOpenGL
protected

◆ mRect

SDL_Rect Graphics::mRect
protected

Definition at line 542 of file graphics.h.

Referenced by Graphics(), setOpenGLMode(), and setWindow().

◆ mRedraw

bool Graphics::mRedraw
protected

Definition at line 540 of file graphics.h.

Referenced by getRedraw(), and setRedraw().

◆ mScale

int Graphics::mScale
protected

Definition at line 551 of file graphics.h.

Referenced by getScale(), and setOpenGLMode().

◆ mSecure

bool Graphics::mSecure
protected

Definition at line 543 of file graphics.h.

Referenced by getSecure(), and setSecure().

◆ mStartFreeMem

int Graphics::mStartFreeMem
protected

Definition at line 549 of file graphics.h.

Referenced by getMemoryUsage(), and updateMemoryInfo().

◆ mSync

bool Graphics::mSync
protected

Definition at line 550 of file graphics.h.

Referenced by getSync(), and setOpenGLMode().

◆ mWidth

int Graphics::mWidth

◆ mWindow

SDL_Surface* Graphics::mWindow
protected

The documentation for this class was generated from the following files:
Graphics::mSync
bool mSync
Definition: graphics.h:550
Graphics::mActualWidth
int mActualWidth
Definition: graphics.h:485
Rect::height
int height
Definition: rect.h:223
Graphics::getOpenGLFlags
int getOpenGLFlags() const
Definition: graphics.cpp:241
GL_RASTERIZER_DISCARD
#define GL_RASTERIZER_DISCARD
Definition: mgldefines.h:104
ImageHelper::dumpSurfaceFormat
static void dumpSurfaceFormat(const SDL_Surface *const image)
Definition: imagehelper.cpp:178
GL_TEXTURE_RECTANGLE_ARB
#define GL_TEXTURE_RECTANGLE_ARB
Definition: openglimagehelper.h:31
Graphics::mEnableResize
bool mEnableResize
Definition: graphics.h:545
Graphics::setVideoMode
virtual bool setVideoMode(const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)=0
RectSize
#define RectSize
Definition: graphics.h:94
Graphics::initArrays
virtual void initArrays(const int vertCount)
Definition: graphics.h:316
Rect::y
int y
Definition: rect.h:213
MStack::top
T & top() const
Definition: mstack.h:72
GL_SAMPLE_MASK
#define GL_SAMPLE_MASK
Definition: mgldefines.h:105
GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX
#define GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX
Definition: graphics.cpp:104
Graphics::mDoubleBuffer
bool mDoubleBuffer
Definition: graphics.h:541
GraphicsManager::updateTextureFormat
static void updateTextureFormat()
Definition: graphicsmanager.cpp:840
Graphics::mOpenGL
RenderType mOpenGL
Definition: graphics.h:544
GL_DEPTH_BOUNDS_TEST_EXT
#define GL_DEPTH_BOUNDS_TEST_EXT
Definition: mgldefines.h:113
MStack::empty
bool empty() const
Definition: mstack.h:87
OpenGLImageHelper::mTextureSize
static int mTextureSize
Definition: openglimagehelper.h:162
Graphics::RIGHT
@ RIGHT
Definition: graphics.h:132
Graphics::getOpenGL
RenderType getOpenGL() const
Definition: graphics.h:307
SafeOpenGLImageHelper::mTextureType
static int mTextureType
Definition: safeopenglimagehelper.h:116
GraphicsManager::initOpenGL
void initOpenGL()
Definition: graphicsmanager.cpp:1433
Graphics::endDraw
virtual void endDraw()
Definition: graphics.h:452
GraphicsManager::supportExtension
bool supportExtension(const std::string &ext) const
Definition: graphicsmanager.cpp:757
SafeOpenGLImageHelper::mTextureSize
static int mTextureSize
Definition: safeopenglimagehelper.h:162
GL_TEXTURE_COMPRESSION_HINT_ARB
#define GL_TEXTURE_COMPRESSION_HINT_ARB
Definition: mgldefines.h:117
logger
Logger * logger
Definition: logger.cpp:88
Graphics::mColor
Color mColor
Definition: graphics.h:552
GraphicsManager::updateTextureCompressionFormat
void updateTextureCompressionFormat() const
Definition: graphicsmanager.cpp:762
OpenGLImageHelper::mTextureType
static int mTextureType
Definition: openglimagehelper.h:116
GraphicsManager::logVersion
void logVersion() const
Definition: graphicsmanager.cpp:911
Actions::info
bool info(InputEvent &event)
Definition: commands.cpp:56
Graphics::mNoFrame
bool mNoFrame
Definition: graphics.h:546
MStack::pop
void pop()
Definition: mstack.h:67
Graphics::mScale
int mScale
Definition: graphics.h:551
ClipRect
Definition: cliprect.h:77
Graphics::mAlpha
bool mAlpha
Definition: graphics.h:537
RENDER_GLES_OPENGL
@ RENDER_GLES_OPENGL
Definition: rendertype.h:29
Graphics::getName
const std::string & getName() const
Definition: graphics.h:313
Graphics::mRedraw
bool mRedraw
Definition: graphics.h:540
Rect::width
int width
Definition: rect.h:218
Graphics::beginDraw
virtual void beginDraw()
Definition: graphics.h:440
GL_POLYGON_SMOOTH
#define GL_POLYGON_SMOOTH
Definition: mgldefines.h:109
OpenGLImageHelper::getInternalTextureType
static int getInternalTextureType()
Definition: openglimagehelper.h:107
RENDER_MODERN_OPENGL
@ RENDER_MODERN_OPENGL
Definition: rendertype.h:31
GraphicsManager::getMaxVertices
int getMaxVertices() const
Definition: graphicsmanager.h:136
Graphics::mBpp
int mBpp
Definition: graphics.h:536
GraphicsManager::isUseTextureSampler
bool isUseTextureSampler() const
Definition: graphicsmanager.h:155
x
x
Definition: graphics_calcImageRect.hpp:72
GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB
Definition: openglimagehelper.h:32
Graphics::mGLContext
static void * mGLContext
Definition: graphics.h:532
GraphicsManager::createWindow
static SDL_Surface * createWindow(const int w, const int h, const int bpp, const int flags)
Definition: graphicsmanager.cpp:639
graphicsManager
GraphicsManager graphicsManager
Definition: graphicsmanager.cpp:114
Graphics::setScale
void setScale(int scale)
Definition: graphics.cpp:205
Graphics::mFullscreen
bool mFullscreen
Definition: graphics.h:538
GL_DEPTH_CLAMP
#define GL_DEPTH_CLAMP
Definition: mgldefines.h:103
RENDER_SOFTWARE
@ RENDER_SOFTWARE
Definition: rendertype.h:26
Graphics::CENTER
@ CENTER
Definition: graphics.h:131
Logger::log1
void log1(const char *const log_text)
Definition: logger.cpp:237
CAST_U16
#define CAST_U16
Definition: cast.h:28
config
Configuration config
Definition: configuration.cpp:51
Graphics::mHeight
int mHeight
Definition: graphics.h:484
Graphics::mActualHeight
int mActualHeight
Definition: graphics.h:486
Graphics::videoInfo
bool videoInfo()
Definition: graphics.cpp:482
Graphics::updateMemoryInfo
void updateMemoryInfo()
Definition: graphics.cpp:425
MStack::push
T & push()
Definition: mstack.h:47
Graphics::drawLine
virtual void drawLine(int x1, int y1, int x2, int y2)=0
Graphics::createGLContext
virtual void createGLContext(const bool custom)
Definition: graphics.cpp:417
Graphics::mWindow
SDL_Surface * mWindow
Definition: graphics.h:522
Graphics::LEFT
@ LEFT
Definition: graphics.h:130
restrict
#define restrict
Definition: localconsts.h:164
GraphicsManager::setGLVersion
void setGLVersion()
Definition: graphicsmanager.cpp:883
CAST_S32
#define CAST_S32
Definition: cast.h:29
ClipRect::yOffset
int yOffset
Definition: cliprect.h:126
Graphics::isAllowScale
virtual bool isAllowScale() const
Definition: graphics.h:368
Graphics::mSecure
bool mSecure
Definition: graphics.h:543
Graphics::mStartFreeMem
int mStartFreeMem
Definition: graphics.h:549
RENDER_GLES2_OPENGL
@ RENDER_GLES2_OPENGL
Definition: rendertype.h:32
y
y
Definition: graphics_calcImageRect.hpp:72
ClipRect::xOffset
int xOffset
Definition: cliprect.h:121
Rect::x
int x
Definition: rect.h:208
Graphics::mRect
SDL_Rect mRect
Definition: graphics.h:542
Graphics::screenResized
virtual void screenResized()
Definition: graphics.h:480
Color::a
unsigned int a
Definition: color.h:250
Logger::log
void log(const char *const log_text,...)
Definition: logger.cpp:268
Graphics::mClipStack
MStack< ClipRect > mClipStack
Definition: graphics.h:520
top
const Image *const restrict top
Definition: graphics_calcImageRect.hpp:39
Configuration::getBoolValue
bool getBoolValue(const std::string &key) const
Definition: configuration.cpp:596
Graphics::mWidth
int mWidth
Definition: graphics.h:483
Graphics::mName
std::string mName
Definition: graphics.h:548
Graphics::mAllowHighDPI
bool mAllowHighDPI
Definition: graphics.h:547
Graphics::mHWAccel
bool mHWAccel
Definition: graphics.h:539