Torque3D Documentation / _generateds / platformWin32.h

platformWin32.h

Engine/source/platformWin32/platformWin32.h

More...

Classes:

Public Defines

define

Public Variables

Public Functions

backslash(char * str)
backslash(WCHAR * str)
backslashT(T * str)
forwardslash(char * str)
forwardslash(WCHAR * str)

Detailed Description

Public Defines

NOMINMAX() 

Public Variables

Win32PlatState winState 

Public Functions

backslash(char * str)

backslash(WCHAR * str)

backslashT(T * str)

forwardslash(char * str)

forwardslash(WCHAR * str)

forwardslashT(T * str)

getWin32WindowHandle()

setModifierKeys(S32 modKeys)

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _PLATFORMWIN32_H_
 25#define _PLATFORMWIN32_H_
 26
 27// Sanity check for UNICODE
 28#ifdef TORQUE_UNICODE
 29#  ifndef UNICODE
 30#     error "ERROR: You must have UNICODE defined in your preprocessor settings (ie, /DUNICODE) if you have TORQUE_UNICODE enabled in torqueConfig.h!"
 31#  endif
 32#endif
 33
 34#include <windows.h>
 35#ifndef _PLATFORM_H_
 36#include "platform/platform.h"
 37#endif
 38#ifndef _MRECT_H_
 39#include "math/mRect.h"
 40#endif
 41
 42#if defined(TORQUE_COMPILER_CODEWARRIOR)
 43#  include <ansi_prefix.win32.h>
 44#  include <stdio.h>
 45#  include <string.h>
 46#else
 47#  include <stdio.h>
 48#  include <string.h>
 49#endif
 50
 51#ifdef _MSC_VER
 52#pragma warning(disable: 4996) // turn off "deprecation" warnings
 53#endif
 54
 55#define NOMINMAX
 56
 57// Hack to get a correct HWND instead of using global state.
 58extern HWND getWin32WindowHandle();
 59
 60struct Win32PlatState
 61{
 62   FILE *log_fp;
 63   HINSTANCE hinstOpenGL;
 64   HINSTANCE hinstGLU;
 65   HINSTANCE hinstOpenAL;
 66   HWND appWindow;
 67   HDC appDC;
 68   HINSTANCE appInstance;
 69   HGLRC hGLRC;
 70   DWORD processId;
 71   bool renderThreadBlocked;
 72   S32 nMessagesPerFrame; ///< The max number of messages to dispatch per frame
 73   HMENU appMenu; ///< The menu bar for the window
 74#ifdef UNICODE
 75   //HIMC imeHandle;
 76#endif
 77
 78   S32 desktopBitsPixel;
 79   S32 desktopWidth;
 80   S32 desktopHeight;
 81   S32 desktopClientWidth;
 82   S32 desktopClientHeight;
 83   U32 currentTime;
 84   
 85   // minimum time per frame
 86   U32 sleepTicks;
 87   // are we in the background?
 88   bool backgrounded;
 89
 90   Win32PlatState();
 91};
 92
 93extern Win32PlatState winState;
 94
 95extern void setModifierKeys( S32 modKeys );
 96
 97//-------------------------------------- Helper Functions
 98
 99template< typename T >
100inline void forwardslashT( T *str )
101{
102   while(*str)
103   {
104      if(*str == '\\')
105         *str = '/';
106      str++;
107   }
108}
109
110inline void forwardslash( char* str )
111{
112   forwardslashT< char >( str );
113}
114inline void forwardslash( WCHAR* str )
115{
116   forwardslashT< WCHAR >( str );
117}
118
119template< typename T >
120inline void backslashT( T *str )
121{
122   while(*str)
123   {
124      if(*str == '/')
125         *str = '\\';
126      str++;
127   }
128}
129
130inline void backslash( char* str )
131{
132   backslashT< char >( str );
133}
134inline void backslash( WCHAR* str )
135{
136   backslashT< WCHAR >( str );
137}
138
139#endif //_PLATFORMWIN32_H_
140