Minor cleanup

This commit is contained in:
Henrik Rydgard 2015-09-05 19:42:58 +02:00
parent 825662d06e
commit 86a02fed61
3 changed files with 22 additions and 48 deletions

View File

@ -237,7 +237,7 @@ void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int S
COORD Co = {BufferWidth, BufferHeight};
SB = SetConsoleScreenBufferSize(hConsole, Co);
// Change the screen buffer window size
SMALL_RECT coo = {0,0,ScreenWidth, ScreenHeight}; // top, left, right, bottom
SMALL_RECT coo = {(SHORT)0, (SHORT)0, (SHORT)ScreenWidth, (SHORT)ScreenHeight}; // top, left, right, bottom
SW = SetConsoleWindowInfo(hConsole, TRUE, &coo);
}
else
@ -246,7 +246,7 @@ void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int S
SMALL_RECT coo = {0,0, ScreenWidth, ScreenHeight}; // top, left, right, bottom
SW = SetConsoleWindowInfo(hConsole, TRUE, &coo);
// Change screen buffer size
COORD Co = {BufferWidth, BufferHeight};
COORD Co = {(SHORT)BufferWidth, (SHORT)BufferHeight};
SB = SetConsoleScreenBufferSize(hConsole, Co);
}
#endif

View File

@ -3,21 +3,21 @@
namespace DX9 {
DirectxState dxstate;
DirectXState dxstate;
GLExtensions gl_extensions;
int DirectxState::state_count = 0;
int DirectXState::state_count = 0;
void DirectxState::Initialize() {
if(initialized) return;
void DirectXState::Initialize() {
if (initialized)
return;
Restore();
initialized = true;
}
void DirectxState::Restore() {
void DirectXState::Restore() {
int count = 0;
blend.restore(); count++;
@ -29,17 +29,15 @@ void DirectxState::Restore() {
scissorTest.restore(); count++;
scissorRect.restore(); count++;
//cullFace.restore(); count++;
//cullFaceMode.restore(); count++;
cullMode.restore(); count++;
depthTest.restore(); count++;
// depthRange.restore(); count++;
depthFunc.restore(); count++;
depthWrite.restore(); count++;
colorMask.restore(); count++;
// why not?
// viewport.restore(); count++;
alphaTest.restore(); count++;
@ -59,9 +57,6 @@ void DirectxState::Restore() {
texMipLodBias.restore(); count++;
texAddressU.restore(); count++;
texAddressV.restore(); count++;
//assert(count == state_count && "DirectxState::Restore is missing some states");
}
void CheckGLExtensions() {
@ -69,31 +64,10 @@ void CheckGLExtensions() {
if (done)
return;
done = true;
memset(&gl_extensions, 0, sizeof(gl_extensions));
/*
gl_extensions.OES_packed_depth_stencil = strstr(extString, "GL_OES_packed_depth_stencil") != 0;
gl_extensions.OES_depth24 = strstr(extString, "GL_OES_depth24") != 0;
gl_extensions.OES_depth_texture = strstr(extString, "GL_OES_depth_texture") != 0;
gl_extensions.EXT_discard_framebuffer = strstr(extString, "GL_EXT_discard_framebuffer") != 0;
#ifdef USING_GLES2
gl_extensions.FBO_ARB = true;
gl_extensions.FBO_EXT = false;
#else
gl_extensions.FBO_ARB = strstr(extString, "GL_ARB_framebuffer_object") != 0;
gl_extensions.FBO_EXT = strstr(extString, "GL_EXT_framebuffer_object") != 0;
#endif
*/
}
void DirectxState::SetVSyncInterval(int interval) {
/*
#ifdef _WIN32
if( wglSwapIntervalEXT )
wglSwapIntervalEXT(interval);
#endif
*/
void DirectXState::SetVSyncInterval(int interval) {
}
};
} // namespace DX9

View File

@ -6,14 +6,14 @@
namespace DX9 {
class DirectxState {
class DirectXState {
private:
template<D3DRENDERSTATETYPE cap, bool init>
class BoolState {
bool _value;
public:
BoolState() : _value(init) {
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(bool value) {
@ -45,7 +45,7 @@ private:
DWORD p1;
public:
DxState1() : _state1(state1), p1(p1def) {
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(DWORD newp1) {
@ -65,7 +65,7 @@ private:
DWORD p1;
public:
DxSampler0State1() : _state1(state1), p1(p1def) {
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(DWORD newp1) {
@ -89,7 +89,7 @@ private:
};
public:
DxSampler0State1Float() : _state1(state1), p1d(p1def) {
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(FLOAT newp1) {
@ -111,7 +111,7 @@ private:
DWORD p2;
public:
DxState2() : _state1(state1),_state2(state2), p1(p1def), p2(p2def) {
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(DWORD newp1, DWORD newp2) {
@ -213,7 +213,7 @@ private:
public:
SavedBlendFactor() {
c = 0xFFFFFFFF;
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(const float v[4]) {
DWORD newc = D3DCOLOR_COLORVALUE(v[0], v[1], v[2], v[3]);
@ -232,7 +232,7 @@ private:
public:
SavedColorMask() {
mask = D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA;
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(bool r, bool g, bool b, bool a) {
@ -264,7 +264,7 @@ private:
class BoolUnused {
public:
BoolUnused() {
DirectxState::state_count++;
DirectXState::state_count++;
}
inline void set(bool) {
@ -349,7 +349,7 @@ private:
public:
static int state_count;
DirectxState() : initialized(false) {}
DirectXState() : initialized(false) {}
void Initialize();
void Restore();
@ -400,7 +400,7 @@ public:
#undef STATE1
#undef STATE2
extern DirectxState dxstate;
extern DirectXState dxstate;
struct GLExtensions {
bool OES_depth24;