mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 20:02:48 +00:00
- add the appropriate ifdefs for an unix build
This commit is contained in:
parent
5ccc225fa8
commit
ebba32e7ba
7 changed files with 111 additions and 12 deletions
|
@ -61,8 +61,6 @@
|
|||
#define WGL_SAMPLE_BUFFERS 0x2041
|
||||
#define WGL_SAMPLES 0x2042
|
||||
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class OpenGLLoadFunctions
|
||||
|
@ -73,7 +71,7 @@ public:
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
OpenGLContext::OpenGLContext(HWND window) : window(window)
|
||||
OpenGLContext::OpenGLContext(void* windowptr) : window((HWND)windowptr)
|
||||
{
|
||||
dc = GetDC(window);
|
||||
OpenGLCreationHelper helper(window);
|
||||
|
@ -237,3 +235,37 @@ HGLRC OpenGLCreationHelper::CreateContext(HDC hdc, int major_version, int minor_
|
|||
|
||||
return opengl3_context;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
OpenGLContext::OpenGLContext(void* window)
|
||||
{
|
||||
}
|
||||
|
||||
OpenGLContext::~OpenGLContext()
|
||||
{
|
||||
}
|
||||
|
||||
void OpenGLContext::Begin()
|
||||
{
|
||||
}
|
||||
|
||||
void OpenGLContext::End()
|
||||
{
|
||||
}
|
||||
|
||||
void OpenGLContext::SwapBuffers()
|
||||
{
|
||||
}
|
||||
|
||||
int OpenGLContext::GetWidth() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OpenGLContext::GetHeight() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
class OpenGLContext
|
||||
{
|
||||
public:
|
||||
OpenGLContext(HWND window);
|
||||
OpenGLContext(void* window);
|
||||
~OpenGLContext();
|
||||
|
||||
void Begin();
|
||||
|
@ -43,3 +45,26 @@ private:
|
|||
typedef BOOL(WINAPI* ptr_wglGetPixelFormatAttribfvEXT)(HDC, int, int, UINT, int*, FLOAT*);
|
||||
typedef BOOL(WINAPI* ptr_wglChoosePixelFormatEXT)(HDC, const int*, const FLOAT*, UINT, int*, UINT*);
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class OpenGLContext
|
||||
{
|
||||
public:
|
||||
OpenGLContext(void* window);
|
||||
~OpenGLContext();
|
||||
|
||||
void Begin();
|
||||
void End();
|
||||
void SwapBuffers();
|
||||
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
|
||||
explicit operator bool() const { return context != 0; }
|
||||
|
||||
private:
|
||||
void* context = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#include "gl_load/gl_system.h"
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#include "gl_load/gl_system.h"
|
||||
|
||||
#define APART(x) (static_cast<uint32_t>(x) >> 24)
|
||||
#define RPART(x) ((static_cast<uint32_t>(x) >> 16) & 0xff)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "Precomp.h"
|
||||
#include "RawMouse.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#ifndef HID_USAGE_PAGE_GENERIC
|
||||
#define HID_USAGE_PAGE_GENERIC ((USHORT) 0x01)
|
||||
#endif
|
||||
|
@ -39,7 +41,7 @@ public:
|
|||
const TCHAR* ClassName = TEXT("RawMouseWindow");
|
||||
};
|
||||
|
||||
RawMouse::RawMouse(HWND ownerWindow)
|
||||
RawMouse::RawMouse(void* ownerWindow)
|
||||
{
|
||||
static RawMouseWindowClass win32class;
|
||||
handle = CreateWindowEx(0, win32class.ClassName, TEXT(""), WS_POPUP, 0, 0, 100, 100, 0, 0, GetModuleHandle(nullptr), this);
|
||||
|
@ -121,9 +123,31 @@ LRESULT RawMouse::WindowProc(HWND handle, UINT message, WPARAM wparam, LPARAM lp
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
RawMouse::RawMouse(void* ownerWindow)
|
||||
{
|
||||
}
|
||||
|
||||
RawMouse::~RawMouse()
|
||||
{
|
||||
}
|
||||
|
||||
float RawMouse::GetX()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float RawMouse::GetY()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
RawMouse* RawMouse_New(HWND hwnd)
|
||||
RawMouse* RawMouse_New(void* hwnd)
|
||||
{
|
||||
return new RawMouse(hwnd);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
class RawMouse
|
||||
{
|
||||
public:
|
||||
RawMouse(HWND ownerWindow);
|
||||
RawMouse(void* ownerWindow);
|
||||
~RawMouse();
|
||||
|
||||
float GetX();
|
||||
|
@ -19,3 +21,17 @@ private:
|
|||
|
||||
friend class RawMouseWindowClass;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class RawMouse
|
||||
{
|
||||
public:
|
||||
RawMouse(void* ownerWindow);
|
||||
~RawMouse();
|
||||
|
||||
float GetX();
|
||||
float GetY();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "ShaderManager.h"
|
||||
#include <stdexcept>
|
||||
|
||||
RenderDevice::RenderDevice(HWND hwnd) : Context(hwnd)
|
||||
RenderDevice::RenderDevice(void* hwnd) : Context(hwnd)
|
||||
{
|
||||
memset(mUniforms, 0, sizeof(mUniforms));
|
||||
|
||||
|
@ -550,7 +550,7 @@ void RenderDevice::ApplyTextures()
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
RenderDevice* RenderDevice_New(HWND hwnd)
|
||||
RenderDevice* RenderDevice_New(void* hwnd)
|
||||
{
|
||||
RenderDevice *device = new RenderDevice(hwnd);
|
||||
if (!device->Context)
|
||||
|
|
|
@ -74,7 +74,7 @@ enum class UniformName : int
|
|||
class RenderDevice
|
||||
{
|
||||
public:
|
||||
RenderDevice(HWND hwnd);
|
||||
RenderDevice(void* hwnd);
|
||||
~RenderDevice();
|
||||
|
||||
void SetShader(ShaderName name);
|
||||
|
|
Loading…
Reference in a new issue