| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- /*
- ** 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 <http://www.gnu.org/licenses/>.
- */
- ////////////////////////////////////////////////////////////////////////////////
- // //
- // (c) 2001-2003 Electronic Arts Inc. //
- // //
- ////////////////////////////////////////////////////////////////////////////////
- // FILE: GameWindowGlobal.cpp /////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //
- // Westwood Studios Pacific.
- //
- // Confidential Information
- // Copyright (C) 2001 - All Rights Reserved
- //
- //-----------------------------------------------------------------------------
- //
- // Project: RTS3
- //
- // File name: GameWindowGlobal.cpp
- //
- // Created: Colin Day, June 2001
- //
- // Desc: These are some global functions that every game using this
- // window system must implement for their current technology
- //
- //-----------------------------------------------------------------------------
- ///////////////////////////////////////////////////////////////////////////////
- // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
- #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
- // USER INCLUDES //////////////////////////////////////////////////////////////
- #include "Common/Language.h"
- #include "GameClient/Image.h"
- #include "GameClient/Display.h"
- #include "GameClient/GameWindowManager.h"
- #include "GameClient/GameFont.h"
- // DEFINES ////////////////////////////////////////////////////////////////////
- // PRIVATE TYPES //////////////////////////////////////////////////////////////
- // PRIVATE DATA ///////////////////////////////////////////////////////////////
- // PUBLIC DATA ////////////////////////////////////////////////////////////////
- // PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
- // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- // GameWindowManager::winDrawImage ============================================
- /** draw image, coord are in screen and should be kepth within
- * that box specified */
- //=============================================================================
- void GameWindowManager::winDrawImage( const Image *image, Int startX, Int startY,
- Int endX, Int endY, Color color )
- {
- TheDisplay->drawImage( image, startX, startY, endX, endY, color );
- } // end WinDrawImage
- // GameWindowManager::winFillRect =============================================
- /** draw filled rect, coords are absolute screen coords */
- //=============================================================================
- void GameWindowManager::winFillRect( Color color, Real width,
- Int startX, Int startY,
- Int endX, Int endY )
- {
- TheDisplay->drawFillRect( startX, startY,
- endX - startX, endY - startY,
- color );
- } // end WinFillRect
- // GameWindowManager::winOpenRect =============================================
- /** draw rect outline, coords are absolute screen coords */
- //=============================================================================
- void GameWindowManager::winOpenRect( Color color, Real width,
- Int startX, Int startY,
- Int endX, Int endY )
- {
- TheDisplay->drawOpenRect( startX, startY,
- endX - startX, endY - startY,
- width, color );
- } // end WinOpenRect
- // GameWindowManager::winDrawLine =============================================
- /** draw line, coords are absolute screen coords */
- //=============================================================================
- void GameWindowManager::winDrawLine( Color color, Real width,
- Int startX, Int startY,
- Int endX, Int endY )
- {
- TheDisplay->drawLine( startX, startY, endX, endY, width, color );
- } // end WinDrawLine
- // GameWindowManager::winFindImage ============================================
- /** Given an image name, return an image loc to that image information.
- * You may reorganize the image loc structure however you like to suit
- * your individual project */
- //=============================================================================
- const Image *GameWindowManager::winFindImage( const char *name )
- {
- assert( TheMappedImageCollection );
- if( TheMappedImageCollection )
- return TheMappedImageCollection->findImageByName( AsciiString( name ) );
- return NULL;
- } // end WinFindImage
- // GameWindowManager::winMakeColor ============================================
- /** Given RGBA, make a color, you can change color representation for your
- * individual project needs */
- //=============================================================================
- Color GameWindowManager::winMakeColor( UnsignedByte red,
- UnsignedByte green,
- UnsignedByte blue,
- UnsignedByte alpha )
- {
- return GameMakeColor( red, green, blue, alpha );
- } // end WinMakeColor
- // GameWindowManager::winFormatText ===========================================
- /** draw text to the screen */
- //=============================================================================
- void GameWindowManager::winFormatText( GameFont *font, UnicodeString text, Color color,
- Int x, Int y, Int width, Int height )
- {
- /// @todo make all display string rendering go through here!
- } // end WinFormatText
- // GameWindowManager::winGetTextSize ==========================================
- /** get the extent size of text */
- //=============================================================================
- void GameWindowManager::winGetTextSize( GameFont *font, UnicodeString text,
- Int *width, Int *height, Int maxWidth )
- {
- /// @todo make display string size stuff go through here
- if( width )
- *width = 0;
- if( height )
- *height = 0;
- } // end WinGetTextSize
- // GameWindowManager::winFontHeight ===========================================
- /** Return the font height in pixels */
- //=============================================================================
- Int GameWindowManager::winFontHeight( GameFont *font )
- {
-
- return font->height;
- } // end WinFontHeight
- // GameWindowManager::winIsDigit ==============================================
- /** You implementation of whether or not character is a digit */
- //=============================================================================
- Int GameWindowManager::winIsDigit( Int c )
- {
- return GameIsDigit( c );
- } // end WinIsDigit
- // GameWindowManager::winIsAscii ==============================================
- /** You implementation of whether or not character is ascii */
- //=============================================================================
- Int GameWindowManager::winIsAscii( Int c )
- {
- return GameIsAscii( c );
- } // end WinIsDigit
- // GameWindowManager::winIsAlNum ==============================================
- /** Your implementation of whether or not character is alpha numeric */
- //=============================================================================
- Int GameWindowManager::winIsAlNum( Int c )
- {
- return GameIsAlNum( c );
- } // end WinIsAlNum
- // GameWindowManager::winFindFont =============================================
- /** Get a font */
- //=============================================================================
- GameFont *GameWindowManager::winFindFont( AsciiString fontName,
- Int pointSize,
- Bool bold )
- {
- assert( TheFontLibrary );
- if( TheFontLibrary )
- return TheFontLibrary->getFont( fontName, pointSize, bold );
- return NULL;
- } // end WinFindFont
|