mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-01 05:02:05 +02:00
Update to v094r24 release.
byuu says: Finally!! Compilation works once again on Windows. However, it's pretty buggy. Modality isn't really working right, you can still poke at other windows, but when you select ListView items, they redraw as empty boxes (need to process WM_DRAWITEM before checking modality.) The program crashes when you close it (probably a ruby driver's term() function, that's what it usually is.) The Layout::setEnabled(false) call isn't working right, so you get that annoying chiming sound and cursor movement when mapping keyboard keys to game inputs. The column sizing seems off a bit on first display for the Hotkeys tab. And probably lots more.
This commit is contained in:
@@ -11,24 +11,24 @@ typedef HRESULT (__stdcall* TextureProc)(LPDIRECT3DDEVICE9, LPCTSTR, LPDIRECT3DT
|
||||
|
||||
namespace ruby {
|
||||
|
||||
class pVideoD3D {
|
||||
public:
|
||||
LPDIRECT3D9 lpd3d;
|
||||
LPDIRECT3DDEVICE9 device;
|
||||
LPDIRECT3DVERTEXBUFFER9 vertex_buffer;
|
||||
LPDIRECT3DVERTEXBUFFER9* vertex_ptr;
|
||||
struct pVideoD3D {
|
||||
LPDIRECT3D9 lpd3d = nullptr;
|
||||
LPDIRECT3DDEVICE9 device = nullptr;
|
||||
LPDIRECT3DVERTEXBUFFER9 vertex_buffer = nullptr;
|
||||
LPDIRECT3DVERTEXBUFFER9* vertex_ptr = nullptr;
|
||||
D3DPRESENT_PARAMETERS presentation;
|
||||
D3DSURFACE_DESC d3dsd;
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
D3DRASTER_STATUS d3drs;
|
||||
D3DCAPS9 d3dcaps;
|
||||
LPDIRECT3DTEXTURE9 texture;
|
||||
LPDIRECT3DSURFACE9 surface;
|
||||
LPD3DXEFFECT effect;
|
||||
LPDIRECT3DTEXTURE9 texture = nullptr;
|
||||
LPDIRECT3DSURFACE9 surface = nullptr;
|
||||
LPD3DXEFFECT effect = nullptr;
|
||||
string shader_source_markup;
|
||||
|
||||
bool lost;
|
||||
unsigned iwidth, iheight;
|
||||
bool lost = true;
|
||||
unsigned iwidth;
|
||||
unsigned iheight;
|
||||
|
||||
struct d3dvertex {
|
||||
float x, y, z, rhw; //screen coords
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
} caps;
|
||||
|
||||
struct {
|
||||
HWND handle;
|
||||
bool synchronize;
|
||||
unsigned filter;
|
||||
HWND handle = nullptr;
|
||||
bool synchronize = false;
|
||||
unsigned filter = Video::FilterLinear;
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
@@ -61,7 +61,11 @@ public:
|
||||
unsigned height;
|
||||
} state;
|
||||
|
||||
bool cap(const string& name) {
|
||||
~pVideoD3D() {
|
||||
term();
|
||||
}
|
||||
|
||||
auto cap(const string& name) -> bool {
|
||||
if(name == Video::Handle) return true;
|
||||
if(name == Video::Synchronize) return true;
|
||||
if(name == Video::Filter) return true;
|
||||
@@ -69,40 +73,40 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
any get(const string& name) {
|
||||
auto get(const string& name) -> any {
|
||||
if(name == Video::Handle) return (uintptr_t)settings.handle;
|
||||
if(name == Video::Synchronize) return settings.synchronize;
|
||||
if(name == Video::Filter) return settings.filter;
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
bool set(const string& name, const any& value) {
|
||||
if(name == Video::Handle) {
|
||||
settings.handle = (HWND)any_cast<uintptr_t>(value);
|
||||
auto set(const string& name, const any& value) -> bool {
|
||||
if(name == Video::Handle && value.is<uintptr_t>()) {
|
||||
settings.handle = (HWND)value.get<uintptr_t>();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(name == Video::Synchronize) {
|
||||
settings.synchronize = any_cast<bool>(value);
|
||||
if(name == Video::Synchronize && value.is<bool>()) {
|
||||
settings.synchronize = value.get<bool>();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(name == Video::Filter) {
|
||||
settings.filter = any_cast<unsigned>(value);
|
||||
if(name == Video::Filter && value.is<unsigned>()) {
|
||||
settings.filter = value.get<unsigned>();
|
||||
if(lpd3d) update_filter();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(name == Video::Shader) {
|
||||
if(name == Video::Shader && value.is<string>()) {
|
||||
return false;
|
||||
set_shader(any_cast<const char*>(value));
|
||||
return true;
|
||||
//set_shader(value.get<string>());
|
||||
//return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool recover() {
|
||||
auto recover() -> bool {
|
||||
if(!device) return false;
|
||||
|
||||
if(lost) {
|
||||
@@ -142,7 +146,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned rounded_power_of_two(unsigned n) {
|
||||
auto rounded_power_of_two(unsigned n) -> unsigned {
|
||||
n--;
|
||||
n |= n >> 1;
|
||||
n |= n >> 2;
|
||||
@@ -152,7 +156,7 @@ public:
|
||||
return n + 1;
|
||||
}
|
||||
|
||||
void resize(unsigned width, unsigned height) {
|
||||
auto resize(unsigned width, unsigned height) -> void {
|
||||
if(iwidth >= width && iheight >= height) return;
|
||||
|
||||
iwidth = rounded_power_of_two(max(width, iwidth ));
|
||||
@@ -167,7 +171,7 @@ public:
|
||||
device->CreateTexture(iwidth, iheight, 1, flags.t_usage, D3DFMT_X8R8G8B8, (D3DPOOL)flags.t_pool, &texture, NULL);
|
||||
}
|
||||
|
||||
void update_filter() {
|
||||
auto update_filter() -> void {
|
||||
if(!device) return;
|
||||
if(lost && !recover()) return;
|
||||
|
||||
@@ -188,11 +192,11 @@ public:
|
||||
//
|
||||
// (x,y) screen coords, in pixels
|
||||
// (u,v) texture coords, betweeen 0.0 (top, left) to 1.0 (bottom, right)
|
||||
void set_vertex(
|
||||
auto set_vertex(
|
||||
uint32_t px, uint32_t py, uint32_t pw, uint32_t ph,
|
||||
uint32_t tw, uint32_t th,
|
||||
uint32_t x, uint32_t y, uint32_t w, uint32_t h
|
||||
) {
|
||||
) -> void {
|
||||
d3dvertex vertex[4];
|
||||
vertex[0].x = vertex[2].x = (double)(x - 0.5);
|
||||
vertex[1].x = vertex[3].x = (double)(x + w - 0.5);
|
||||
@@ -217,7 +221,7 @@ public:
|
||||
device->SetStreamSource(0, vertex_buffer, 0, sizeof(d3dvertex));
|
||||
}
|
||||
|
||||
void clear() {
|
||||
auto clear() -> void {
|
||||
if(lost && !recover()) return;
|
||||
|
||||
texture->GetLevelDesc(0, &d3dsd);
|
||||
@@ -236,7 +240,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) {
|
||||
auto lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) -> bool {
|
||||
if(lost && !recover()) return false;
|
||||
|
||||
if(width != settings.width || height != settings.height) {
|
||||
@@ -251,13 +255,13 @@ public:
|
||||
return data = (uint32_t*)d3dlr.pBits;
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
auto unlock() -> void {
|
||||
surface->UnlockRect();
|
||||
surface->Release();
|
||||
surface = nullptr;
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
auto refresh() -> void {
|
||||
if(lost && !recover()) return;
|
||||
|
||||
RECT rd, rs; //dest, source rectangles
|
||||
@@ -333,7 +337,7 @@ public:
|
||||
if(device->Present(0, 0, 0, 0) == D3DERR_DEVICELOST) lost = true;
|
||||
}
|
||||
|
||||
void set_shader(const char* source) {
|
||||
auto set_shader(const char* source) -> void {
|
||||
if(!caps.shader) return;
|
||||
|
||||
if(effect) {
|
||||
@@ -347,9 +351,9 @@ public:
|
||||
}
|
||||
shader_source_markup = source;
|
||||
|
||||
XML::Document document(shader_source_markup);
|
||||
bool is_hlsl = document["shader"]["language"].data == "HLSL";
|
||||
string shader_source = document["shader"]["source"].data;
|
||||
auto document = BML::unserialize(shader_source_markup);
|
||||
bool is_hlsl = document["shader"]["language"].text() == "HLSL";
|
||||
string shader_source = document["shader"]["source"].text();
|
||||
if(shader_source == "") return;
|
||||
|
||||
HMODULE d3dx;
|
||||
@@ -373,7 +377,7 @@ public:
|
||||
effect->SetTechnique(hTech);
|
||||
}
|
||||
|
||||
bool init() {
|
||||
auto init() -> bool {
|
||||
term();
|
||||
|
||||
RECT rd;
|
||||
@@ -428,32 +432,18 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void release_resources() {
|
||||
auto release_resources() -> void {
|
||||
if(effect) { effect->Release(); effect = 0; }
|
||||
if(vertex_buffer) { vertex_buffer->Release(); vertex_buffer = 0; }
|
||||
if(surface) { surface->Release(); surface = 0; }
|
||||
if(texture) { texture->Release(); texture = 0; }
|
||||
}
|
||||
|
||||
void term() {
|
||||
auto term() -> void {
|
||||
release_resources();
|
||||
if(device) { device->Release(); device = 0; }
|
||||
if(lpd3d) { lpd3d->Release(); lpd3d = 0; }
|
||||
}
|
||||
|
||||
pVideoD3D() {
|
||||
effect = 0;
|
||||
vertex_buffer = 0;
|
||||
surface = 0;
|
||||
texture = 0;
|
||||
device = 0;
|
||||
lpd3d = 0;
|
||||
lost = true;
|
||||
|
||||
settings.handle = 0;
|
||||
settings.synchronize = false;
|
||||
settings.filter = Video::FilterLinear;
|
||||
}
|
||||
};
|
||||
|
||||
DeclareVideo(D3D)
|
||||
|
@@ -2,51 +2,56 @@
|
||||
|
||||
namespace ruby {
|
||||
|
||||
class pVideoDD {
|
||||
public:
|
||||
LPDIRECTDRAW lpdd;
|
||||
LPDIRECTDRAW7 lpdd7;
|
||||
LPDIRECTDRAWSURFACE7 screen, raster;
|
||||
LPDIRECTDRAWCLIPPER clipper;
|
||||
struct pVideoDD {
|
||||
LPDIRECTDRAW lpdd = nullptr;
|
||||
LPDIRECTDRAW7 lpdd7 = nullptr;
|
||||
LPDIRECTDRAWSURFACE7 screen = nullptr;
|
||||
LPDIRECTDRAWSURFACE7 raster = nullptr;
|
||||
LPDIRECTDRAWCLIPPER clipper = nullptr;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
DDSCAPS2 ddscaps;
|
||||
unsigned iwidth, iheight;
|
||||
unsigned iwidth;
|
||||
unsigned iheight;
|
||||
|
||||
struct {
|
||||
HWND handle;
|
||||
bool synchronize;
|
||||
HWND handle = nullptr;
|
||||
bool synchronize = false;
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
} settings;
|
||||
|
||||
bool cap(const string& name) {
|
||||
~pVideoDD() {
|
||||
term();
|
||||
}
|
||||
|
||||
auto cap(const string& name) -> bool {
|
||||
if(name == Video::Handle) return true;
|
||||
if(name == Video::Synchronize) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
any get(const string& name) {
|
||||
auto get(const string& name) -> any {
|
||||
if(name == Video::Handle) return (uintptr_t)settings.handle;
|
||||
if(name == Video::Synchronize) return settings.synchronize;
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
bool set(const string& name, const any& value) {
|
||||
if(name == Video::Handle) {
|
||||
settings.handle = (HWND)any_cast<uintptr_t>(value);
|
||||
auto set(const string& name, const any& value) -> bool {
|
||||
if(name == Video::Handle && value.is<uintptr_t>()) {
|
||||
settings.handle = (HWND)value.get<uintptr_t>();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(name == Video::Synchronize) {
|
||||
settings.synchronize = any_cast<bool>(value);
|
||||
if(name == Video::Synchronize && value.is<bool>()) {
|
||||
settings.synchronize = value.get<bool>();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void resize(unsigned width, unsigned height) {
|
||||
auto resize(unsigned width, unsigned height) -> void {
|
||||
if(iwidth >= width && iheight >= height) return;
|
||||
|
||||
iwidth = max(width, iwidth);
|
||||
@@ -85,7 +90,7 @@ public:
|
||||
if(lpdd7->CreateSurface(&ddsd, &raster, 0) == DD_OK) return clear();
|
||||
}
|
||||
|
||||
void clear() {
|
||||
auto clear() -> void {
|
||||
DDBLTFX fx;
|
||||
fx.dwSize = sizeof(DDBLTFX);
|
||||
fx.dwFillColor = 0x00000000;
|
||||
@@ -93,7 +98,7 @@ public:
|
||||
raster->Blt(0, 0, 0, DDBLT_WAIT | DDBLT_COLORFILL, &fx);
|
||||
}
|
||||
|
||||
bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) {
|
||||
auto lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) -> bool {
|
||||
if(width != settings.width || height != settings.height) {
|
||||
resize(settings.width = width, settings.height = height);
|
||||
}
|
||||
@@ -106,11 +111,11 @@ public:
|
||||
return data = (uint32_t*)ddsd.lpSurface;
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
auto unlock() -> void {
|
||||
raster->Unlock(0);
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
auto refresh() -> void {
|
||||
if(settings.synchronize) {
|
||||
while(true) {
|
||||
BOOL in_vblank;
|
||||
@@ -134,7 +139,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool init() {
|
||||
auto init() -> bool {
|
||||
term();
|
||||
|
||||
DirectDrawCreate(0, &lpdd, 0);
|
||||
@@ -162,23 +167,13 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void term() {
|
||||
auto term() -> void {
|
||||
if(clipper) { clipper->Release(); clipper = 0; }
|
||||
if(raster) { raster->Release(); raster = 0; }
|
||||
if(screen) { screen->Release(); screen = 0; }
|
||||
if(lpdd7) { lpdd7->Release(); lpdd7 = 0; }
|
||||
if(lpdd) { lpdd->Release(); lpdd = 0; }
|
||||
}
|
||||
|
||||
pVideoDD() {
|
||||
lpdd = 0;
|
||||
lpdd7 = 0;
|
||||
screen = 0;
|
||||
raster = 0;
|
||||
clipper = 0;
|
||||
|
||||
settings.handle = 0;
|
||||
}
|
||||
};
|
||||
|
||||
DeclareVideo(DD)
|
||||
|
@@ -2,40 +2,48 @@
|
||||
|
||||
namespace ruby {
|
||||
|
||||
class pVideoGDI {
|
||||
public:
|
||||
uint32_t* buffer;
|
||||
HBITMAP bitmap;
|
||||
HDC bitmapdc;
|
||||
struct pVideoGDI {
|
||||
uint32_t* buffer = nullptr;
|
||||
HBITMAP bitmap = nullptr;
|
||||
HDC bitmapdc = nullptr;
|
||||
BITMAPINFO bmi;
|
||||
|
||||
struct {
|
||||
HWND handle;
|
||||
HWND handle = nullptr;
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
} settings;
|
||||
|
||||
bool cap(const string& name) {
|
||||
pVideoGDI() {
|
||||
buffer = (uint32_t*)memory::allocate(1024 * 1024 * sizeof(uint32_t));
|
||||
}
|
||||
|
||||
~pVideoGDI() {
|
||||
if(buffer) memory::free(buffer);
|
||||
term();
|
||||
}
|
||||
|
||||
auto cap(const string& name) -> bool {
|
||||
if(name == Video::Handle) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
any get(const string& name) {
|
||||
auto get(const string& name) -> any {
|
||||
if(name == Video::Handle) return (uintptr_t)settings.handle;
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
bool set(const string& name, const any& value) {
|
||||
if(name == Video::Handle) {
|
||||
settings.handle = (HWND)any_cast<uintptr_t>(value);
|
||||
auto set(const string& name, const any& value) -> bool {
|
||||
if(name == Video::Handle && value.is<uintptr_t>()) {
|
||||
settings.handle = (HWND)value.get<uintptr_t>();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) {
|
||||
auto lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) -> bool {
|
||||
settings.width = width;
|
||||
settings.height = height;
|
||||
|
||||
@@ -43,11 +51,11 @@ public:
|
||||
return data = buffer;
|
||||
}
|
||||
|
||||
void unlock() {}
|
||||
auto unlock() -> void {}
|
||||
|
||||
void clear() {}
|
||||
auto clear() -> void {}
|
||||
|
||||
void refresh() {
|
||||
auto refresh() -> void {
|
||||
RECT rc;
|
||||
GetClientRect(settings.handle, &rc);
|
||||
|
||||
@@ -57,7 +65,7 @@ public:
|
||||
ReleaseDC(settings.handle, hdc);
|
||||
}
|
||||
|
||||
bool init() {
|
||||
auto init() -> bool {
|
||||
HDC hdc = GetDC(settings.handle);
|
||||
bitmapdc = CreateCompatibleDC(hdc);
|
||||
assert(bitmapdc);
|
||||
@@ -80,19 +88,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void term() {
|
||||
auto term() -> void {
|
||||
DeleteObject(bitmap);
|
||||
DeleteDC(bitmapdc);
|
||||
}
|
||||
|
||||
pVideoGDI() {
|
||||
buffer = (uint32_t*)malloc(1024 * 1024 * sizeof(uint32_t));
|
||||
settings.handle = 0;
|
||||
}
|
||||
|
||||
~pVideoGDI() {
|
||||
if(buffer) free(buffer);
|
||||
}
|
||||
};
|
||||
|
||||
DeclareVideo(GDI)
|
||||
|
@@ -9,19 +9,23 @@ struct pVideoWGL : OpenGL {
|
||||
HGLRC (APIENTRY* wglCreateContextAttribs)(HDC, HGLRC, const int*) = nullptr;
|
||||
BOOL (APIENTRY* wglSwapInterval)(int) = nullptr;
|
||||
|
||||
HDC display;
|
||||
HGLRC wglcontext;
|
||||
HWND window;
|
||||
HINSTANCE glwindow;
|
||||
HDC display = nullptr;
|
||||
HGLRC wglcontext = nullptr;
|
||||
HWND window = nullptr;
|
||||
HINSTANCE glwindow = nullptr;
|
||||
|
||||
struct {
|
||||
HWND handle;
|
||||
bool synchronize;
|
||||
unsigned filter;
|
||||
HWND handle = nullptr;
|
||||
bool synchronize = false;
|
||||
unsigned filter = Video::FilterNearest;
|
||||
string shader;
|
||||
} settings;
|
||||
|
||||
bool cap(const string& name) {
|
||||
~pVideoWGL() {
|
||||
term();
|
||||
}
|
||||
|
||||
auto cap(const string& name) -> bool {
|
||||
if(name == Video::Handle) return true;
|
||||
if(name == Video::Synchronize) return true;
|
||||
if(name == Video::Filter) return true;
|
||||
@@ -29,22 +33,22 @@ struct pVideoWGL : OpenGL {
|
||||
return false;
|
||||
}
|
||||
|
||||
any get(const string& name) {
|
||||
auto get(const string& name) -> any {
|
||||
if(name == Video::Handle) return (uintptr_t)settings.handle;
|
||||
if(name == Video::Synchronize) return settings.synchronize;
|
||||
if(name == Video::Filter) return settings.filter;
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
|
||||
bool set(const string& name, const any& value) {
|
||||
if(name == Video::Handle) {
|
||||
settings.handle = (HWND)any_cast<uintptr_t>(value);
|
||||
auto set(const string& name, const any& value) -> bool {
|
||||
if(name == Video::Handle && value.is<uintptr_t>()) {
|
||||
settings.handle = (HWND)value.get<uintptr_t>();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(name == Video::Synchronize) {
|
||||
if(settings.synchronize != any_cast<bool>(value)) {
|
||||
settings.synchronize = any_cast<bool>(value);
|
||||
if(name == Video::Synchronize && value.is<bool>()) {
|
||||
if(settings.synchronize != value.get<bool>()) {
|
||||
settings.synchronize = value.get<bool>();
|
||||
if(wglcontext) {
|
||||
init();
|
||||
OpenGL::shader(settings.shader);
|
||||
@@ -53,36 +57,36 @@ struct pVideoWGL : OpenGL {
|
||||
}
|
||||
}
|
||||
|
||||
if(name == Video::Filter) {
|
||||
settings.filter = any_cast<unsigned>(value);
|
||||
if(settings.shader.empty()) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
|
||||
if(name == Video::Filter && value.is<unsigned>()) {
|
||||
settings.filter = value.get<unsigned>();
|
||||
if(!settings.shader) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(name == Video::Shader) {
|
||||
settings.shader = any_cast<const char*>(value);
|
||||
if(name == Video::Shader && value.is<string>()) {
|
||||
settings.shader = value.get<string>();
|
||||
OpenGL::shader(settings.shader);
|
||||
if(settings.shader.empty()) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
|
||||
if(!settings.shader) OpenGL::filter = settings.filter ? GL_LINEAR : GL_NEAREST;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) {
|
||||
auto lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height) -> bool {
|
||||
OpenGL::size(width, height);
|
||||
return OpenGL::lock(data, pitch);
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
auto unlock() -> void {
|
||||
}
|
||||
|
||||
void clear() {
|
||||
auto clear() -> void {
|
||||
OpenGL::clear();
|
||||
SwapBuffers(display);
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
auto refresh() -> void {
|
||||
RECT rc;
|
||||
GetClientRect(settings.handle, &rc);
|
||||
outputWidth = rc.right - rc.left, outputHeight = rc.bottom - rc.top;
|
||||
@@ -90,7 +94,7 @@ struct pVideoWGL : OpenGL {
|
||||
SwapBuffers(display);
|
||||
}
|
||||
|
||||
bool init() {
|
||||
auto init() -> bool {
|
||||
term();
|
||||
|
||||
GLuint pixel_format;
|
||||
@@ -133,26 +137,14 @@ struct pVideoWGL : OpenGL {
|
||||
return true;
|
||||
}
|
||||
|
||||
void term() {
|
||||
auto term() -> void {
|
||||
OpenGL::term();
|
||||
|
||||
if(wglcontext) {
|
||||
wglDeleteContext(wglcontext);
|
||||
wglcontext = 0;
|
||||
wglcontext = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
pVideoWGL() {
|
||||
settings.handle = 0;
|
||||
settings.synchronize = false;
|
||||
settings.filter = 0;
|
||||
|
||||
window = 0;
|
||||
wglcontext = 0;
|
||||
glwindow = 0;
|
||||
}
|
||||
|
||||
~pVideoWGL() { term(); }
|
||||
};
|
||||
|
||||
DeclareVideo(WGL)
|
||||
|
Reference in New Issue
Block a user