diff --git a/src/video.cpp b/src/video.cpp index 00af723d..0d007091 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -48,6 +48,7 @@ private: #if defined _XBOX static Direct3D *d3d_ctx; static D3DDevice *d3d_dev; + static D3DCOLOR clear_color; #endif }; @@ -58,6 +59,7 @@ ivec2 VideoData::saved_viewport(0, 0); #if defined _XBOX Direct3D *VideoData::d3d_ctx; D3DDevice *VideoData::d3d_dev; +D3DCOLOR VideoData::clear_color; #endif /* @@ -85,6 +87,8 @@ void Video::Setup(ivec2 size) size.y = VideoMode.dwDisplayHeight; VideoData::saved_viewport = size; + VideoData::clear_color = D3DCOLOR_XRGB(26, 51, 77); + d3dpp.BackBufferWidth = size.x; d3dpp.BackBufferHeight = size.y; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; @@ -185,13 +189,24 @@ void Video::SetDepth(bool set) #endif } +void Video::SetClearColor(vec4 color) +{ +#if defined _XBOX + VideoData::clear_color = D3DCOLOR_XRGB((int)(color.r * 255.999f), + (int)(color.g * 255.999f), + (int)(color.b * 255.999f)); +#else + glClearColor(color.r, color.g, color.b, color.a); +#endif +} + void Video::Clear() { ivec2 size = GetSize(); #if defined _XBOX VideoData::d3d_dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, - D3DCOLOR_XRGB(26, 51, 77), 1.0f, 0); + VideoData::clear_color, 1.0f, 0); #else glViewport(0, 0, size.x, size.y); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); diff --git a/src/video.h b/src/video.h index d41455f8..5917a722 100644 --- a/src/video.h +++ b/src/video.h @@ -29,6 +29,7 @@ public: static void Destroy(); static void SetFov(float theta); static void SetDepth(bool set); + static void SetClearColor(vec4 color); static void Clear(); static void Capture(uint32_t *buffer); static ivec2 GetSize();