mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
New display info.
This commit is contained in:
parent
483b663e31
commit
9b6d67c32f
266
panda/src/display/displayInformation.cxx
Normal file
266
panda/src/display/displayInformation.cxx
Normal file
@ -0,0 +1,266 @@
|
||||
// Filename: displayInformation.cxx
|
||||
// Created by: aignacio (17Jan07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2007, 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://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "displayInformation.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::Destructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
DisplayInformation::
|
||||
~DisplayInformation() {
|
||||
if (_display_mode_array != NULL) {
|
||||
delete _display_mode_array;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
DisplayInformation::
|
||||
DisplayInformation() {
|
||||
DisplayInformation::DetectionState state;
|
||||
int get_adapter_display_mode_state;
|
||||
int get_device_caps_state;
|
||||
int window_width;
|
||||
int window_height;
|
||||
int window_bits_per_pixel;
|
||||
int total_display_modes;
|
||||
DisplayMode *display_mode_array;
|
||||
int shader_model;
|
||||
int video_memory;
|
||||
UINT texture_memory;
|
||||
PN_uint64 physical_memory;
|
||||
PN_uint64 available_physical_memory;
|
||||
|
||||
state = DisplayInformation::DS_unknown;
|
||||
get_adapter_display_mode_state = false;
|
||||
get_device_caps_state = false;
|
||||
window_width = 0;
|
||||
window_height = 0;
|
||||
window_bits_per_pixel = 0;
|
||||
total_display_modes = 0;
|
||||
display_mode_array = NULL;
|
||||
shader_model = GraphicsStateGuardian::SM_00;
|
||||
video_memory = 0;
|
||||
texture_memory = 0;
|
||||
physical_memory = 0;
|
||||
available_physical_memory = 0;
|
||||
|
||||
_state = state;
|
||||
_get_adapter_display_mode_state = get_adapter_display_mode_state;
|
||||
_get_device_caps_state = get_device_caps_state;
|
||||
_maximum_window_width = window_width;
|
||||
_maximum_window_height = window_height;
|
||||
_window_bits_per_pixel = window_bits_per_pixel;
|
||||
_total_display_modes = total_display_modes;
|
||||
_display_mode_array = display_mode_array;
|
||||
_shader_model = shader_model;
|
||||
_video_memory = video_memory;
|
||||
_texture_memory = texture_memory;
|
||||
_physical_memory = physical_memory;
|
||||
_available_physical_memory = available_physical_memory;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::get_display_state() {
|
||||
return _state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_maximum_window_width
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_maximum_window_width() {
|
||||
return _maximum_window_width;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_maximum_window_height
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_maximum_window_height() {
|
||||
return _maximum_window_height;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_window_bits_per_pixel
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_window_bits_per_pixel() {
|
||||
return _window_bits_per_pixel;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_total_display_modes
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_total_display_modes() {
|
||||
return _total_display_modes;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_display_mode_width
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_display_mode_width (int display_index) {
|
||||
int value;
|
||||
|
||||
value = 0;
|
||||
if (display_index >= 0 && display_index < _total_display_modes) {
|
||||
value = _display_mode_array [display_index].width;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_display_mode_height
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_display_mode_height (int display_index) {
|
||||
int value;
|
||||
|
||||
value = 0;
|
||||
if (display_index >= 0 && display_index < _total_display_modes) {
|
||||
value = _display_mode_array [display_index].height;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_display_mode_bits_per_pixel
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_display_mode_bits_per_pixel (int display_index) {
|
||||
int value;
|
||||
|
||||
value = 0;
|
||||
if (display_index >= 0 && display_index < _total_display_modes) {
|
||||
value = _display_mode_array [display_index].bits_per_pixel;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_display_mode_refresh_rate
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_display_mode_refresh_rate (int display_index) {
|
||||
int value;
|
||||
|
||||
value = 0;
|
||||
if (display_index >= 0 && display_index < _total_display_modes) {
|
||||
value = _display_mode_array [display_index].refresh_rate;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_display_mode_fullscreen_only
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_display_mode_fullscreen_only (int display_index) {
|
||||
int value;
|
||||
|
||||
value = 0;
|
||||
if (display_index >= 0 && display_index < _total_display_modes) {
|
||||
value = _display_mode_array [display_index].fullscreen_only;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_shader_model
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_shader_model ( ) {
|
||||
return _shader_model;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_video_memory
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_video_memory ( ) {
|
||||
return _video_memory;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_texture_memory
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DisplayInformation::
|
||||
get_texture_memory() {
|
||||
return _texture_memory;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_physical_memory
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_uint64 DisplayInformation::
|
||||
get_physical_memory() {
|
||||
return _physical_memory;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_available_physical_memory
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_uint64 DisplayInformation::
|
||||
get_available_physical_memory() {
|
||||
return _available_physical_memory;
|
||||
}
|
89
panda/src/display/displayInformation.h
Normal file
89
panda/src/display/displayInformation.h
Normal file
@ -0,0 +1,89 @@
|
||||
// Filename: displayInformation.h
|
||||
// Created by: aignacio (17Jan07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2007, 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://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DISPLAYINFORMATION_H
|
||||
#define DISPLAYINFORMATION_H
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
int bits_per_pixel;
|
||||
int refresh_rate;
|
||||
int fullscreen_only;
|
||||
}
|
||||
DisplayMode;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DisplayInformation
|
||||
// Description : This class contains various display information.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EXPCL_PANDA DisplayInformation {
|
||||
|
||||
PUBLISHED:
|
||||
|
||||
enum DetectionState {
|
||||
DS_unknown,
|
||||
DS_success,
|
||||
|
||||
DS_direct_3d_create_error,
|
||||
DS_create_window_error,
|
||||
DS_create_device_error,
|
||||
};
|
||||
|
||||
DisplayInformation::~DisplayInformation();
|
||||
DisplayInformation::DisplayInformation();
|
||||
|
||||
int DisplayInformation::get_display_state();
|
||||
|
||||
int DisplayInformation::get_maximum_window_width();
|
||||
int DisplayInformation::get_maximum_window_height();
|
||||
int DisplayInformation::get_window_bits_per_pixel();
|
||||
|
||||
int DisplayInformation::get_total_display_modes();
|
||||
int DisplayInformation::get_display_mode_width(int display_index);
|
||||
int DisplayInformation::get_display_mode_height(int display_index);
|
||||
int DisplayInformation::get_display_mode_bits_per_pixel(int display_index);
|
||||
int DisplayInformation::get_display_mode_refresh_rate(int display_index);
|
||||
int DisplayInformation::get_display_mode_fullscreen_only(int display_index);
|
||||
|
||||
int DisplayInformation::get_shader_model();
|
||||
int DisplayInformation::get_video_memory();
|
||||
int DisplayInformation::get_texture_memory();
|
||||
|
||||
PN_uint64 DisplayInformation::get_physical_memory();
|
||||
PN_uint64 DisplayInformation::get_available_physical_memory();
|
||||
|
||||
public:
|
||||
DetectionState _state;
|
||||
int _get_adapter_display_mode_state;
|
||||
int _get_device_caps_state;
|
||||
int _maximum_window_width;
|
||||
int _maximum_window_height;
|
||||
int _window_bits_per_pixel;
|
||||
int _total_display_modes;
|
||||
DisplayMode *_display_mode_array;
|
||||
int _shader_model;
|
||||
int _video_memory;
|
||||
int _texture_memory;
|
||||
PN_uint64 _physical_memory;
|
||||
PN_uint64 _available_physical_memory;
|
||||
};
|
||||
|
||||
#endif
|
105
panda/src/display/displaySearchParameters.cxx
Normal file
105
panda/src/display/displaySearchParameters.cxx
Normal file
@ -0,0 +1,105 @@
|
||||
// Filename: displaySearchParameters.cxx
|
||||
// Created by: aignacio (17Jan07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2007, 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://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "displaySearchParameters.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::Destructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
DisplaySearchParameters::
|
||||
~DisplaySearchParameters() {
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
DisplaySearchParameters::
|
||||
DisplaySearchParameters() {
|
||||
_minimum_width = 640;
|
||||
_minimum_height = 480;
|
||||
_maximum_width = 6400;
|
||||
_maximum_height = 4800;
|
||||
_minimum_bits_per_pixel = 16;
|
||||
_maximum_bits_per_pixel = 32;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::set_minimum_width
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplaySearchParameters::
|
||||
set_minimum_width (int minimum_width) {
|
||||
_minimum_width = minimum_width;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::set_maximum_width
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplaySearchParameters::
|
||||
set_maximum_width (int maximum_width) {
|
||||
_maximum_width = maximum_width;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::set_minimum_height
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplaySearchParameters::
|
||||
set_minimum_height (int minimum_height) {
|
||||
_minimum_height = minimum_height;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::set_maximum_height
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplaySearchParameters::
|
||||
set_maximum_height (int maximum_height) {
|
||||
_maximum_height = maximum_height;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::set_minimum_bits_per_pixel
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplaySearchParameters::
|
||||
set_minimum_bits_per_pixel (int minimum_bits_per_pixel) {
|
||||
_minimum_bits_per_pixel = minimum_bits_per_pixel;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplaySearchParameters::set_maximum_bits_per_pixel
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplaySearchParameters::
|
||||
set_maximum_bits_per_pixel (int maximum_bits_per_pixel) {
|
||||
_maximum_bits_per_pixel = maximum_bits_per_pixel;
|
||||
}
|
49
panda/src/display/displaySearchParameters.h
Normal file
49
panda/src/display/displaySearchParameters.h
Normal file
@ -0,0 +1,49 @@
|
||||
// Filename: displaySearchParameters.h
|
||||
// Created by: aignacio (17Jan07)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2007, 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://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DISPLAYSEARCHPARAMETERS_H
|
||||
#define DISPLAYSEARCHPARAMETERS_H
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DisplaySearchParameters
|
||||
// Description : Parameters used for searching display capabilities.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA DisplaySearchParameters {
|
||||
|
||||
PUBLISHED:
|
||||
DisplaySearchParameters::DisplaySearchParameters();
|
||||
DisplaySearchParameters::~DisplaySearchParameters();
|
||||
|
||||
void DisplaySearchParameters::set_minimum_width(int minimum_width);
|
||||
void DisplaySearchParameters::set_maximum_width(int maximum_width);
|
||||
void DisplaySearchParameters::set_minimum_height(int minimum_height);
|
||||
void DisplaySearchParameters::set_maximum_height(int maximum_height);
|
||||
void DisplaySearchParameters::set_minimum_bits_per_pixel(int minimum_bits_per_pixel);
|
||||
void DisplaySearchParameters::set_maximum_bits_per_pixel(int maximum_bits_per_pixel);
|
||||
|
||||
public:
|
||||
int _minimum_width;
|
||||
int _maximum_width;
|
||||
int _minimum_height;
|
||||
int _maximum_height;
|
||||
int _minimum_bits_per_pixel;
|
||||
int _maximum_bits_per_pixel;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user