/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see .
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: Display.h ////////////////////////////////////////////////////////////
// The graphics display singleton
// Author: Michael S. Booth, March 2001
#pragma once
#ifndef _GAME_DISPLAY_H_
#define _GAME_DISPLAY_H_
#include
#include "Common/SubsystemInterface.h"
#include "View.h"
#include "GameClient/Color.h"
#include "GameClient/GameFont.h"
class View;
struct ShroudLevel
{
Short m_currentShroud; ///< A Value of 1 means shrouded. 0 is not. Negative is the count of people looking.
Short m_activeShroudLevel;///< A Value of 0 means passive shroud. Positive is the count of people shrouding.
};
class VideoBuffer;
class VideoStreamInterface;
class DebugDisplayInterface;
class Radar;
class Image;
class DisplayString;
enum StaticGameLODLevel;
/**
* The Display class implements the Display interface
*/
class Display : public SubsystemInterface
{
public:
enum DrawImageMode
{
DRAW_IMAGE_SOLID,
DRAW_IMAGE_GRAYSCALE, //draw image without blending and ignoring alpha
DRAW_IMAGE_ALPHA, //alpha blend the image into frame buffer
DRAW_IMAGE_ADDITIVE //additive blend the image into frame buffer
};
typedef void (DebugDisplayCallback)( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp = NULL );
Display();
virtual ~Display();
virtual void init( void ) { }; ///< Initialize
virtual void reset( void ); ///< Reset system
virtual void update( void ); ///< Update system
//---------------------------------------------------------------------------------------
// Display attribute methods
virtual void setWidth( UnsignedInt width ); ///< Sets the width of the display
virtual void setHeight( UnsignedInt height ); ///< Sets the height of the display
virtual UnsignedInt getWidth( void ) { return m_width; } ///< Returns the width of the display
virtual UnsignedInt getHeight( void ) { return m_height; } ///< Returns the height of the display
virtual void setBitDepth( UnsignedInt bitDepth ) { m_bitDepth = bitDepth; }
virtual UnsignedInt getBitDepth( void ) { return m_bitDepth; }
virtual void setWindowed( Bool windowed ) { m_windowed = windowed; } ///< set windowd/fullscreen flag
virtual Bool getWindowed( void ) { return m_windowed; } ///< return widowed/fullscreen flag
virtual Bool setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed ); ///getNextView();
return NULL;
}
virtual void drawViews( void ); ///< Render all views of the world
virtual void updateViews ( void ); ///< Updates state of world views
virtual VideoBuffer* createVideoBuffer( void ) = 0; ///< Create a video buffer that can be used for this display
//---------------------------------------------------------------------------------------
// Drawing management
virtual void setClipRegion( IRegion2D *region ) = 0; ///< Set clip rectangle for 2D draw operations.
virtual Bool isClippingEnabled( void ) = 0;
virtual void enableClipping( Bool onoff ) = 0;
virtual void draw( void ); ///< Redraw the entire display
virtual void setTimeOfDay( TimeOfDay tod ) = 0; ///< Set the time of day for this display
virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius,Real attenuationWidth,
UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime//, Bool donut = FALSE
) = 0;
/// draw a line on the display in pixel coordinates with the specified color
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
Real lineWidth, UnsignedInt lineColor ) = 0;
/// draw a line on the display in pixel coordinates with the specified 2 colors
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) = 0;
/// draw a rect border on the display in pixel coordinates with the specified color
virtual void drawOpenRect( Int startX, Int startY, Int width, Int height,
Real lineWidth, UnsignedInt lineColor ) = 0;
/// draw a filled rect on the display in pixel coords with the specified color
virtual void drawFillRect( Int startX, Int startY, Int width, Int height,
UnsignedInt color ) = 0;
/// Draw a percentage of a rectange, much like a clock
virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) = 0;
virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) = 0;
/// draw an image fit within the screen coordinates
virtual void drawImage( const Image *image, Int startX, Int startY,
Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA) = 0;
/// draw a video buffer fit within the screen coordinates
virtual void drawVideoBuffer( VideoBuffer *buffer, Int startX, Int startY,
Int endX, Int endY ) = 0;
/// FullScreen video playback
virtual void playLogoMovie( AsciiString movieName, Int minMovieLength, Int minCopyrightLength );
virtual void playMovie( AsciiString movieName );
virtual void stopMovie( void );
virtual Bool isMoviePlaying(void);
/// Register debug display callback
virtual void setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData = NULL );
virtual DebugDisplayCallback *getDebugDisplayCallback();
virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting ) = 0; ///< set shroud
virtual void clearShroud() = 0; ///< empty the entire shroud
virtual void setBorderShroudLevel(UnsignedByte level) = 0; ///