mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
Reintroduce display mode information in Windows via Win32 API
Also clean up the CPUID code in winGraphicsPipe a bit
This commit is contained in:
parent
23441aa5bb
commit
e515cbdbd1
@ -15,10 +15,52 @@
|
||||
#include "graphicsStateGuardian.h"
|
||||
#include "displayInformation.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayMode::Comparison Operator
|
||||
// Access: Published
|
||||
// Description: Returns true if these two DisplayModes are identical.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool DisplayMode::
|
||||
operator == (const DisplayMode &other) const {
|
||||
return (width == other.width && height == other.height &&
|
||||
bits_per_pixel == other.bits_per_pixel &&
|
||||
refresh_rate == other.refresh_rate &&
|
||||
fullscreen_only == other.fullscreen_only);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayMode::Comparison Operator
|
||||
// Access: Published
|
||||
// Description: Returns false if these two DisplayModes are identical.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool DisplayMode::
|
||||
operator != (const DisplayMode &other) const {
|
||||
return !operator == (other);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayMode::output
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplayMode::
|
||||
output(ostream &out) const {
|
||||
out << width << 'x' << height;
|
||||
if (bits_per_pixel > 0) {
|
||||
out << ' ' << bits_per_pixel << "bpp";
|
||||
}
|
||||
if (refresh_rate > 0) {
|
||||
out << ' ' << refresh_rate << "Hz";
|
||||
}
|
||||
if (fullscreen_only > 0) {
|
||||
out << " (fullscreen only)";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::Destructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
DisplayInformation::
|
||||
~DisplayInformation() {
|
||||
@ -181,6 +223,21 @@ get_total_display_modes() {
|
||||
return _total_display_modes;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_display_mode
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
const DisplayMode &DisplayInformation::
|
||||
get_display_mode(int display_index) {
|
||||
#ifndef NDEBUG
|
||||
static DisplayMode err_mode = {0};
|
||||
nassertr(display_index >= 0 && display_index < _total_display_modes, err_mode);
|
||||
#endif
|
||||
|
||||
return _display_mode_array[display_index];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayInformation::get_display_mode_width
|
||||
// Access: Published
|
||||
|
@ -17,29 +17,30 @@
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
typedef struct {
|
||||
struct EXPCL_PANDA_DISPLAY DisplayMode {
|
||||
PUBLISHED:
|
||||
int width;
|
||||
int height;
|
||||
int bits_per_pixel;
|
||||
int refresh_rate;
|
||||
int fullscreen_only;
|
||||
}
|
||||
DisplayMode;
|
||||
|
||||
bool operator == (const DisplayMode &other) const;
|
||||
bool operator != (const DisplayMode &other) const;
|
||||
void output(ostream &out) const;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DisplayInformation
|
||||
// Description : This class contains various display information.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EXPCL_PANDA_DISPLAY DisplayInformation {
|
||||
|
||||
PUBLISHED:
|
||||
|
||||
enum DetectionState {
|
||||
DS_unknown,
|
||||
DS_success,
|
||||
DS_unknown,
|
||||
DS_success,
|
||||
|
||||
DS_direct_3d_create_error,
|
||||
DS_direct_3d_create_error,
|
||||
DS_create_window_error,
|
||||
DS_create_device_error,
|
||||
};
|
||||
@ -54,6 +55,10 @@ PUBLISHED:
|
||||
int get_window_bits_per_pixel();
|
||||
|
||||
int get_total_display_modes();
|
||||
const DisplayMode &get_display_mode(int display_index);
|
||||
MAKE_SEQ(get_display_modes, get_total_display_modes, get_display_mode);
|
||||
|
||||
// Older interface for display modes.
|
||||
int get_display_mode_width(int display_index);
|
||||
int get_display_mode_height(int display_index);
|
||||
int get_display_mode_bits_per_pixel(int display_index);
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user