new window code

This commit is contained in:
David Rose 2003-01-09 22:50:30 +00:00
parent b9dcb6ec4f
commit b1c07e0c41
9 changed files with 0 additions and 4301 deletions

View File

@ -1,98 +0,0 @@
// Filename: config_wdxdisplay.cxx
// Created by: mike (07Oct99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#include "config_wdxdisplay8.h"
#include "wdxGraphicsPipe8.h"
#include "wdxGraphicsWindow8.h"
#include <dconfig.h>
Configure(config_wdxdisplay);
NotifyCategoryDef(wdxdisplay, "display");
ConfigureFn(config_wdxdisplay) {
init_libwdxdisplay8();
}
bool dx_force_16bpp_zbuffer = config_wdxdisplay.GetBool("dx-force-16bpp-zbuffer", false);
bool bResponsive_minimized_fullscreen_window = config_wdxdisplay.GetBool("responsive-minimized-fullscreen-window",false);
bool dx_preserve_fpu_state = config_wdxdisplay.GetBool("dx-preserve-fpu-state", false);
int dx_preferred_deviceID = config_wdxdisplay.GetInt("dx-preferred-device-id", -1);
// if true, use ddraw's GetAvailVidMem to fail if driver says it has too little video mem
bool dx_do_vidmemsize_check = config_wdxdisplay.GetBool("do-vidmemsize-check", true);
// if true, override win-width/height and use driver vidmem info to pick what will
// be a fullscreen window size close to the best perf capability of card, based on
// a heuristic
bool dx_pick_best_screenres = config_wdxdisplay.GetBool("pick-best-screenres", false);
// For now, set this true to use the IME correctly on Win2000, or
// false on Win98. This is temporary; once we have been able to
// verify that this distinction is actually necessary, we can replace
// this config variable with an actual OS detection.
bool ime_composition_w = config_wdxdisplay.GetBool("ime-composition-w", true);
bool dx_use_joystick = config_wdxdisplay.GetBool("use-joystick", false);
extern void AtExitFn(void);
////////////////////////////////////////////////////////////////////
// Function: init_libwdxdisplay
// Description: Initializes the library. This must be called at
// least once before any of the functions or classes in
// this library can be used. Normally it will be
// called by the static initializers and need not be
// called explicitly, but special cases exist.
////////////////////////////////////////////////////////////////////
void init_libwdxdisplay8() {
static bool initialized = false;
if (initialized) {
return;
}
initialized = true;
atexit(AtExitFn);
wdxGraphicsPipe::init_type();
GraphicsPipe::get_factory().register_factory(
wdxGraphicsPipe::get_class_type(),
wdxGraphicsPipe::make_wdxGraphicsPipe);
wdxGraphicsWindow::init_type();
GraphicsWindow::get_factory().register_factory(
wdxGraphicsWindow::get_class_type(),
wdxGraphicsWindow::make_wdxGraphicsWindow);
set_global_parameters();
}
// cant use global var cleanly because global var static init executed after init_libwdxdisplay(), incorrectly reiniting var
Filename get_icon_filename() {
string iconname = config_wdxdisplay.GetString("win32-window-icon","");
return ExecutionEnvironment::expand_string(iconname);
}
Filename get_color_cursor_filename() {
string cursorname = config_wdxdisplay.GetString("win32-color-cursor","");
return ExecutionEnvironment::expand_string(cursorname);
}
Filename get_mono_cursor_filename() {
string cursorname = config_wdxdisplay.GetString("win32-mono-cursor","");
return ExecutionEnvironment::expand_string(cursorname);
}

View File

@ -1,42 +0,0 @@
// Filename: config_wdxdisplay.h
// Created by: mike (07Oct99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#ifndef __CONFIG_WDXDISPLAY8_H__
#define __CONFIG_WDXDISPLAY8_H__
#include <pandabase.h>
#include <filename.h>
#include <notifyCategoryProxy.h>
NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
extern bool bResponsive_minimized_fullscreen_window;
extern bool dx_force_16bpp_zbuffer;
extern bool dx_preserve_fpu_state;
extern bool dx_do_vidmemsize_check;
extern int dx_preferred_deviceID;
extern bool dx_pick_best_screenres;
extern Filename get_icon_filename();
extern Filename get_mono_cursor_filename();
extern Filename get_color_cursor_filename();
extern bool ime_composition_w;
extern bool dx_use_joystick;
extern EXPCL_PANDADX void init_libwdxdisplay8();
#endif /* __CONFIG_WDXDISPLAY_H__ */

View File

@ -1,276 +0,0 @@
// Filename: dxInput8.cxx
// Created by: angelina jolie (07Oct99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#include "config_wdxdisplay8.h"
#include <dxInput8.h>
#define AXIS_RESOLUTION 2000 // use this many levels of resolution by default (could be more if needed and device supported it)
#define AXIS_RANGE_CENTERED // if defined, axis range is centered on 0, instead of starting on 0
BOOL CALLBACK EnumGameCtrlsCallback( const DIDEVICEINSTANCE* pdidInstance,
VOID* pContext ) {
DI_DeviceInfos *pDevInfos = (DI_DeviceInfos *)pContext;
(*pDevInfos).push_back(*pdidInstance);
if(wdxdisplay_cat.is_debug())
wdxdisplay_cat.debug() << "Found DevType 0x" << (void*)pdidInstance->dwDevType << ": " << pdidInstance->tszInstanceName << ": " << pdidInstance->tszProductName <<endl;
return DIENUM_CONTINUE;
}
extern BOOL CALLBACK EnumObjectsCallbackJoystick(const DIDEVICEOBJECTINSTANCE* pdidoi,VOID* pContext);
DInput8Info::DInput8Info() {
_pDInput8 = NULL;
_hDInputDLL = NULL;
_JoystickPollTimer = NULL;
}
DInput8Info::~DInput8Info() {
for(UINT i=0;i<_DeviceList.size();i++) {
_DeviceList[i]->Unacquire();
SAFE_RELEASE(_DeviceList[i]);
}
// bugbug: need to handle this
// if(_JoystickPollTimer!=NULL)
// KillTimer(...)
SAFE_RELEASE(_pDInput8);
if(_hDInputDLL) {
FreeLibrary(_hDInputDLL);
_hDInputDLL=NULL;
}
}
bool DInput8Info::InitDirectInput(void) {
HRESULT hr;
// assumes dx8 exists
// use dynamic load so non-dinput programs dont have to load dinput
#define DLLNAME "dinput8.dll"
#define DINPUTCREATE "DirectInput8Create"
HINSTANCE _hDInputDLL = LoadLibrary(DLLNAME);
if(_hDInputDLL == 0) {
wdxdisplay_cat.fatal() << "LoadLibrary(" << DLLNAME <<") failed!, error=" << GetLastError() << endl;
exit(1);
}
typedef HRESULT (WINAPI * LPDIRECTINPUT8CREATE)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter);
LPDIRECTINPUT8CREATE pDInputCreate8;
pDInputCreate8 = (LPDIRECTINPUT8CREATE) GetProcAddress(_hDInputDLL,DINPUTCREATE);
if(pDInputCreate8 == NULL) {
wdxdisplay_cat.fatal() << "GetProcAddr failed for " << DINPUTCREATE << endl;
exit(1);
}
// Register with the DirectInput subsystem and get a pointer
// to a IDirectInput interface we can use.
// Create a DInput object
if( FAILED( hr = (*pDInputCreate8)(GetModuleHandle(NULL), DIRECTINPUT_VERSION,
IID_IDirectInput8, (VOID**)&_pDInput8, NULL ) ) ) {
wdxdisplay_cat.error() << DINPUTCREATE << "failed" << D3DERRORSTRING(hr);
return false;
}
// enum all the joysticks,etc (but not keybd/mouse)
if( FAILED( hr = _pDInput8->EnumDevices(DI8DEVCLASS_GAMECTRL,
EnumGameCtrlsCallback,
(LPVOID)&_DevInfos, DIEDFL_ATTACHEDONLY ) ) ) {
wdxdisplay_cat.error() << "EnumDevices failed" << D3DERRORSTRING(hr);
return false;
}
return true;
}
bool DInput8Info::CreateJoystickOrPad(HWND hWnd) {
bool bFoundDev = false;
UINT devnum=0;
char *errstr=NULL;
// look through the list for the first joystick or gamepad
for(;devnum<_DevInfos.size();devnum++) {
DWORD devType = GET_DIDEVICE_TYPE(_DevInfos[devnum].dwDevType);
if((devType==DI8DEVTYPE_GAMEPAD) ||(devType==DI8DEVTYPE_JOYSTICK)) {
bFoundDev=true;
break;
}
}
if(!bFoundDev) {
wdxdisplay_cat.error() << "Cant find an attached Joystick or GamePad!\n";
return false;
}
LPDIRECTINPUTDEVICE8 pJoyDevice;
// Obtain an interface to the enumerated joystick.
HRESULT hr = _pDInput8->CreateDevice(_DevInfos[devnum].guidInstance, &pJoyDevice, NULL );
if(FAILED(hr)) {
errstr="CreateDevice";
goto handle_error;
}
assert(pJoyDevice!=NULL);
_DeviceList.push_back(pJoyDevice);
// Set the data format to "simple joystick" - a predefined data format
//
// A data format specifies which controls on a device we are interested in,
// and how they should be reported. This tells DInput that we will be
// passing a DIJOYSTATE2 structure to IDirectInputDevice::GetDeviceState().
hr = pJoyDevice->SetDataFormat(&c_dfDIJoystick2);
if(FAILED(hr)) {
errstr="SetDataFormat";
goto handle_error;
}
// must be called AFTER SetDataFormat to get all the proper flags
DX_DECLARE_CLEAN(DIDEVCAPS, DIDevCaps);
hr = pJoyDevice->GetCapabilities(&DIDevCaps);
assert(SUCCEEDED(hr));
_DevCaps.push_back(DIDevCaps);
if(wdxdisplay_cat.is_debug())
wdxdisplay_cat.debug() << "Joy/Pad has " << DIDevCaps.dwAxes << " Axes, " << DIDevCaps.dwButtons << " Buttons, " << DIDevCaps.dwPOVs << " POVs" << endl;
// Set the cooperative level to let DInput know how this device should
// interact with the system and with other DInput applications.
hr = pJoyDevice->SetCooperativeLevel( hWnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND);
if(FAILED(hr)) {
errstr="SetCooperativeLevel";
goto handle_error;
}
// set the min/max values property for discovered axes.
hr = pJoyDevice->EnumObjects(EnumObjectsCallbackJoystick, (LPVOID)pJoyDevice, DIDFT_AXIS);
if(FAILED(hr)) {
errstr="EnumObjects";
goto handle_error;
}
return true;
handle_error:
wdxdisplay_cat.error() << errstr << " failed for (" << _DevInfos[devnum].tszInstanceName << ":" << _DevInfos[devnum].tszProductName << ")" << D3DERRORSTRING(hr);
return false;
}
//-----------------------------------------------------------------------------
// Name: EnumObjectsCallback()
// Desc: Callback function for enumerating objects (axes, buttons, POVs) on a
// joystick. This function enables user interface elements for objects
// that are found to exist, and scales axes min/max values.
//-----------------------------------------------------------------------------
BOOL CALLBACK EnumObjectsCallbackJoystick( const DIDEVICEOBJECTINSTANCE* pdidoi,
VOID* pContext ) {
LPDIRECTINPUTDEVICE8 pJoyDevice = (LPDIRECTINPUTDEVICE8) pContext;
HRESULT hr;
// For axes that are returned, set the DIPROP_RANGE property for the
// enumerated axis in order to scale min/max values.
if( pdidoi->dwType & DIDFT_AXIS ) {
DIPROPRANGE diprg;
diprg.diph.dwSize = sizeof(DIPROPRANGE);
diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
diprg.diph.dwHow = DIPH_BYID;
diprg.diph.dwObj = pdidoi->dwType; // Specify the enumerated axis
#ifdef AXIS_RANGE_CENTERED
diprg.lMin = -AXIS_RESOLUTION/2;
diprg.lMax = +AXIS_RESOLUTION/2;
#else
diprg.lMin = 0;
diprg.lMax = +AXIS_RESOLUTION;
#endif
// Set the range for the axis
hr = pJoyDevice->SetProperty( DIPROP_RANGE, &diprg.diph);
if(FAILED(hr)) {
wdxdisplay_cat.error() << "SetProperty on axis failed" << D3DERRORSTRING(hr);
return DIENUM_STOP;
}
}
return DIENUM_CONTINUE;
}
bool DInput8Info::ReadJoystick(int devnum, DIJOYSTATE2 &js) {
LPDIRECTINPUTDEVICE8 pJoystick = _DeviceList[devnum];
assert(pJoystick!=NULL);
HRESULT hr;
char *errstr;
// Poll the device to read the current state
hr = pJoystick->Poll();
if( FAILED(hr) ) {
// DInput is telling us that the input stream has been
// interrupted. We aren't tracking any state between polls, so
// we don't have any special reset that needs to be done. We
// just re-acquire and try again.
if((hr==DIERR_NOTACQUIRED)||(hr == DIERR_INPUTLOST)) {
hr = pJoystick->Acquire();
if(FAILED(hr)) {
if(wdxdisplay_cat.is_spam())
wdxdisplay_cat.spam() << "Acquire failed" << D3DERRORSTRING(hr);
// hr may be DIERR_OTHERAPPHASPRIO or other errors. This
// may occur when the app is minimized or in the process of
// switching, so just try again later
return false;
}
hr = pJoystick->Poll();
if(FAILED(hr)) {
// should never happen!
errstr = "Poll after successful Acquire failed";
goto handle_error;
}
} else {
errstr = "Unknown Poll failure";
goto handle_error;
}
}
// should we make a vector of devstate dataformats to generalize this fn for all device types?
// Get the input's device state
hr = pJoystick->GetDeviceState( sizeof(DIJOYSTATE2), &js);
if(FAILED(hr)) {
errstr = "GetDeviceState failed";
goto handle_error;
}
return true;
handle_error:
wdxdisplay_cat.fatal() << errstr << D3DERRORSTRING(hr);
return false;
}

View File

@ -1,45 +0,0 @@
// Filename: dxInput8.h
// Created by: blllyjo (07Oct99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#ifndef DXINPUT8_H
#define DXINPUT8_H
#define DIRECTINPUT_VERSION 0x800
#include <dinput.h>
typedef vector<DIDEVICEINSTANCE> DI_DeviceInfos;
typedef vector<DIDEVICEOBJECTINSTANCE> DI_DeviceObjInfos;
class DInput8Info {
public:
DInput8Info(void);
~DInput8Info(void);
bool InitDirectInput(void);
bool CreateJoystickOrPad(HWND hWnd);
bool ReadJoystick(int devnum, DIJOYSTATE2 &js);
HINSTANCE _hDInputDLL;
UINT_PTR _JoystickPollTimer;
LPDIRECTINPUT8 _pDInput8;
DI_DeviceInfos _DevInfos;
// arrays for all created devices. Should probably put these together in a struct,
// along with the data fmt info
vector<LPDIRECTINPUTDEVICE8> _DeviceList;
vector<DIDEVCAPS> _DevCaps;
};
#endif

View File

@ -1,110 +0,0 @@
// Filename: wdxGraphicsPipe.cxx
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#include "wdxGraphicsPipe8.h"
#include "config_wdxdisplay8.h"
#include <mouseButton.h>
#include <keyboardButton.h>
#include <dxerr8.h>
////////////////////////////////////////////////////////////////////
// Static variables
////////////////////////////////////////////////////////////////////
TypeHandle wdxGraphicsPipe::_type_handle;
//wdxGraphicsPipe *global_pipe;
wdxGraphicsPipe::wdxGraphicsPipe(const PipeSpecifier& spec)
: InteractiveGraphicsPipe(spec) {
// _width = GetSystemMetrics(SM_CXSCREEN);
// _height = GetSystemMetrics(SM_CYSCREEN);
_shift = false;
// global_pipe = this;
}
////////////////////////////////////////////////////////////////////
// Function: wdxGraphicsPipe::get_window_type
// Access: Public, Virtual
// Description: Returns the TypeHandle of the kind of window
// preferred by this kind of pipe.
////////////////////////////////////////////////////////////////////
TypeHandle wdxGraphicsPipe::
get_window_type() const {
return wdxGraphicsWindow::get_class_type();
}
GraphicsPipe *wdxGraphicsPipe::
make_wdxGraphicsPipe(const FactoryParams &params) {
GraphicsPipe::PipeSpec *pipe_param;
if(!get_param_into(pipe_param, params)) {
return new wdxGraphicsPipe(PipeSpecifier());
} else {
return new wdxGraphicsPipe(pipe_param->get_specifier());
}
}
TypeHandle wdxGraphicsPipe::get_class_type(void) {
return _type_handle;
}
const char *pipe_type_name="wdxGraphicsPipe8";
void wdxGraphicsPipe::init_type(void) {
InteractiveGraphicsPipe::init_type();
register_type(_type_handle, pipe_type_name,
InteractiveGraphicsPipe::get_class_type());
}
TypeHandle wdxGraphicsPipe::get_type(void) const {
return get_class_type();
}
wdxGraphicsPipe::wdxGraphicsPipe(void) {
wdxdisplay_cat.error()
<< pipe_type_name <<"s should not be created with the default constructor" << endl;
}
wdxGraphicsPipe::wdxGraphicsPipe(const wdxGraphicsPipe&) {
wdxdisplay_cat.error()
<< pipe_type_name << "s should not be copied" << endl;
}
wdxGraphicsPipe& wdxGraphicsPipe::operator=(const wdxGraphicsPipe&) {
wdxdisplay_cat.error()
<< pipe_type_name << "s should not be assigned" << endl;
return *this;
}
////////////////////////////////////////////////////////////////////
// Function: find_window
// Access:
// Description: Find the window that has the xwindow "win" in the
// window list for the pipe (if it exists)
////////////////////////////////////////////////////////////////////
wdxGraphicsWindow *wdxGraphicsPipe::
find_window(HWND win) {
int num_windows = get_num_windows();
for(int w = 0; w < num_windows; w++) {
wdxGraphicsWindow *window = DCAST(wdxGraphicsWindow, get_window(w));
if((window->_dxgsg!=NULL) && (window->_dxgsg->scrn.hWnd == win))
return window;
}
return NULL;
}

View File

@ -1,72 +0,0 @@
// Filename: wdxGraphicsPipe.h
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#ifndef WDXGRAPHICSPIPE8_H
#define WDXGRAPHICSPIPE8_H
//
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include <string>
#include <interactiveGraphicsPipe.h>
#include "wdxGraphicsWindow8.h"
////////////////////////////////////////////////////////////////////
// Defines
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Class : wdxGraphicsPipe
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDADX wdxGraphicsPipe : public InteractiveGraphicsPipe {
public:
wdxGraphicsPipe(const PipeSpecifier&);
wdxGraphicsWindow* find_window(HWND win);
// ButtonHandle lookup_key(WPARAM wparam) const;
virtual TypeHandle get_window_type() const;
public:
static GraphicsPipe* make_wdxGraphicsPipe(const FactoryParams &params);
static TypeHandle get_class_type(void);
static void init_type(void);
virtual TypeHandle get_type(void) const;
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
// int _width;
// int _height;
bool _shift;
protected:
wdxGraphicsPipe(void);
wdxGraphicsPipe(const wdxGraphicsPipe&);
wdxGraphicsPipe& operator=(const wdxGraphicsPipe&);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,195 +0,0 @@
// Filename: wdxGraphicsWindow.h
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#ifndef WDXGRAPHICSWINDOW_H
#define WDXGRAPHICSWINDOW_H
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include <graphicsWindow.h>
#include "dxGraphicsStateGuardian8.h"
#include <dxInput8.h>
////////////////////////////////////////////////////////////////////
// Defines
////////////////////////////////////////////////////////////////////
class wdxGraphicsPipe;
class wdxGraphicsWindowGroup;
const int WDXWIN_CONFIGURE = 4;
const int WDXWIN_EVENT = 8;
//#define FIND_CARD_MEMAVAILS
typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter);
typedef struct {
UINT cardID;
char szDriver[MAX_DEVICE_IDENTIFIER_STRING];
char szDescription[MAX_DEVICE_IDENTIFIER_STRING];
GUID guidDeviceIdentifier;
DWORD VendorID,DeviceID;
HMONITOR hMon;
} DXDeviceInfo;
typedef vector<DXDeviceInfo> DXDeviceInfoVec;
////////////////////////////////////////////////////////////////////
// Class : wdxGraphicsWindow
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDADX wdxGraphicsWindow : public GraphicsWindow {
friend class DXGraphicsStateGuardian;
friend class DXTextureContext;
friend class wdxGraphicsWindowGroup;
friend class DInput8Info;
public:
wdxGraphicsWindow(GraphicsPipe* pipe);
wdxGraphicsWindow(GraphicsPipe* pipe,const GraphicsWindow::Properties& props);
// this constructor will not initialize the wdx stuff, only the panda graphicswindow stuff
wdxGraphicsWindow(GraphicsPipe* pipe,const GraphicsWindow::Properties& props,wdxGraphicsWindowGroup *pParentGroup);
virtual ~wdxGraphicsWindow(void);
virtual TypeHandle get_gsg_type() const;
static GraphicsWindow* make_wdxGraphicsWindow(const FactoryParams &params);
void set_window_handle(HWND hwnd);
LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
void process_events(void);
void handle_window_move( int x, int y );
void handle_mouse_motion( int x, int y );
void handle_mouse_exit(void);
void handle_keypress(ButtonHandle key, int x, int y );
void handle_keyrelease(ButtonHandle key);
void dx_setup();
// dont need to override these now?
// virtual void begin_frame( void );
// virtual void end_frame( void );
virtual bool resize(unsigned int xsize,unsigned int ysize);
virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
bool special_check_fullscreen_resolution(UINT xsize,UINT ysize);
virtual int get_depth_bitwidth(void);
virtual void get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format);
protected:
ButtonHandle lookup_key(WPARAM wparam) const;
void config_single_window(void);
void config_window(wdxGraphicsWindowGroup *pParentGroup);
void finish_window_setup(void);
bool search_for_device(LPDIRECT3D8 pD3D8,DXDeviceInfo *pDevinfo);
void search_for_valid_displaymode(UINT RequestedXsize,UINT RequestedYsize,bool bWantZBuffer,bool bWantStencil,
UINT *pSupportedScreenDepthsMask,bool *pCouldntFindAnyValidZBuf,
D3DFORMAT *pSuggestedPixFmt,bool bVerboseMode = false);
bool FindBestDepthFormat(DXScreenData &Display,D3DDISPLAYMODE &TestDisplayMode,D3DFORMAT *pBestFmt,bool bWantStencil,bool bForce16bpp,bool bVerboseMode = false) const;
void init_resized_window(void);
bool reset_device_resize_window(UINT new_xsize, UINT new_ysize);
void setup_colormap(void);
INLINE void track_mouse_leaving(HWND hwnd);
public:
UINT_PTR _PandaPausedTimer;
DXGraphicsStateGuardian *_dxgsg;
void CreateScreenBuffersAndDevice(DXScreenData &Display);
private:
wdxGraphicsWindowGroup *_pParentWindowGroup;
HDC _hdc;
HPALETTE _colormap;
typedef enum { NotAdjusting,MovingOrResizing,Resizing } WindowAdjustType;
WindowAdjustType _WindowAdjustingType;
bool _bSizeIsMaximized;
bool _ime_open;
bool _ime_active;
bool _ime_composition_w;
bool _exiting_window;
bool _window_inactive;
bool _active_minimized_fullscreen;
bool _return_control_to_app;
bool _cursor_in_windowclientarea;
bool _use_dx8_cursor;
bool _tracking_mouse_leaving;
int _depth_buffer_bpp;
public:
static TypeHandle get_class_type(void);
static void init_type(void);
virtual TypeHandle get_type(void) const;
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
void DestroyMe(bool bAtExitFnCalled);
virtual void do_close_window();
void deactivate_window(void);
void reactivate_window(void);
INLINE void set_cursor_visibility(bool bVisible);
bool handle_windowed_resize(HWND hWnd,bool bDoDXReset);
private:
static TypeHandle _type_handle;
};
// this class really belongs in panda, not here
class EXPCL_PANDADX wdxGraphicsWindowGroup {
// group of windows are all created at the same time
friend class wdxGraphicsWindow;
PUBLISHED:
wdxGraphicsWindowGroup(GraphicsPipe *,const GraphicsWindow::Properties&);
wdxGraphicsWindowGroup(GraphicsPipe *,const GraphicsWindow::Properties&,const GraphicsWindow::Properties&);
wdxGraphicsWindowGroup(GraphicsPipe *,const GraphicsWindow::Properties&,const GraphicsWindow::Properties&,
const GraphicsWindow::Properties&);
public:
wdxGraphicsWindowGroup(wdxGraphicsWindow *OneWindow);
// dont publish variable length one, since FFI wont support it
wdxGraphicsWindowGroup(GraphicsPipe *pipe,int num_windows,GraphicsWindow::Properties *WinPropArray);
~wdxGraphicsWindowGroup();
// void SetCoopLevelsAndDisplayModes(void);
protected:
void find_all_card_memavails(void);
public:
void CreateWindows(void);
void make_windows(GraphicsPipe *,int num_windows,GraphicsWindow::Properties *pWinPropArray);
void initWindowGroup(void);
pvector<wdxGraphicsWindow *> _windows;
DXDeviceInfoVec *_pDeviceInfoVec; // only used during init to store valid devices
HWND _hParentWindow;
HWND _hOldForegroundWindow;
HCURSOR _hMouseCursor;
bool _bLoadedCustomCursor;
bool _bClosingAllWindows;
bool _bIsDX81;
DWORD _numMonitors,_numAdapters;
LPDIRECT3D8 _pD3D8;
HINSTANCE _hD3D8_DLL;
DInput8Info *_pDInputInfo;
DXDeviceInfoVec _DeviceInfoVec;
};
extern void set_global_parameters(void);
extern void restore_global_parameters(void);
extern bool is_badvidmem_card(D3DADAPTER_IDENTIFIER8 *pDevID);
#endif

View File

@ -1,5 +0,0 @@
#include "config_wdxdisplay8.cxx"
#include "wdxGraphicsPipe8.cxx"
#include "dxInput8.cxx"