1 // Copyright 2008 Dolphin Emulator Project
2 // Licensed under GPLv2+
3 // Refer to the license.txt file included.
4 
5 #pragma once
6 
7 #include <string>
8 
9 #include "Common/CommonTypes.h"
10 
11 enum GLInterfaceMode {
12 	MODE_DETECT = 0,
13 	MODE_DETECT_ES,
14 	MODE_OPENGL,
15 	MODE_OPENGLES2,
16 	MODE_OPENGLES3,
17 };
18 
19 class cInterfaceBase {
20 protected:
21 	// Window dimensions.
22 	u32 s_backbuffer_width;
23 	u32 s_backbuffer_height;
24 
25 	u32 s_opengl_mode;
26 public:
cInterfaceBase()27 	cInterfaceBase() : s_backbuffer_width(0), s_backbuffer_height(0), s_opengl_mode(MODE_DETECT) {}
~cInterfaceBase()28 	virtual ~cInterfaceBase() {}
Swap()29 	virtual void Swap() {}
SetMode(u32 mode)30 	virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
GetMode()31 	virtual u32 GetMode() { return s_opengl_mode; }
GetFuncAddress(const std::string & name)32 	virtual void* GetFuncAddress(const std::string& name) { return nullptr; }
33 	virtual bool Create(void *window_handle, bool core = true, bool use16bit = false) = 0;
MakeCurrent()34 	virtual bool MakeCurrent() { return true; }
ClearCurrent()35 	virtual bool ClearCurrent() { return true; }
Shutdown()36 	virtual void Shutdown() {}
37 
SwapInterval(int Interval)38 	virtual void SwapInterval(int Interval) { }
GetBackBufferWidth()39 	virtual u32 GetBackBufferWidth() { return s_backbuffer_width; }
GetBackBufferHeight()40 	virtual u32 GetBackBufferHeight() { return s_backbuffer_height; }
41 
42 	virtual void OverrideBackbufferDimensions(int w, int h) = 0;
43 
SetBackBufferDimensions(u32 W,u32 H)44 	virtual void SetBackBufferDimensions(u32 W, u32 H) {s_backbuffer_width = W; s_backbuffer_height = H; }
Update()45 	virtual void Update() { }
PeekMessages()46 	virtual bool PeekMessages() { return false; }
47 };
48 
49 
50 cInterfaceBase* HostGL_CreateGLInterface();
51