2010-11-19 16:55:55 +01:00
|
|
|
/* The MIT License
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2010-11-21 22:48:58 +01:00
|
|
|
|
2010-11-18 23:13:35 +01:00
|
|
|
#ifndef PLATFORM_H
|
|
|
|
#define PLATFORM_H
|
|
|
|
|
2010-11-25 00:36:15 +01:00
|
|
|
#include "prerequisites.h"
|
|
|
|
|
2010-11-18 23:13:35 +01:00
|
|
|
namespace Platform
|
|
|
|
{
|
2011-03-20 21:23:13 +01:00
|
|
|
void init(const char *appName);
|
2010-11-18 23:13:35 +01:00
|
|
|
void terminate();
|
|
|
|
|
2010-11-21 22:48:58 +01:00
|
|
|
/// Poll platform input/window events
|
2010-11-18 23:13:35 +01:00
|
|
|
void poll();
|
|
|
|
|
2011-03-21 00:15:17 +01:00
|
|
|
/// Get current time in milliseconds since init
|
|
|
|
int getTicks();
|
2010-11-21 22:48:58 +01:00
|
|
|
/// Sleep in current thread
|
2010-11-18 23:13:35 +01:00
|
|
|
void sleep(unsigned long miliseconds);
|
|
|
|
|
2011-03-20 19:02:15 +01:00
|
|
|
bool createWindow(int x, int y, int width, int height, int minWidth, int minHeight, bool maximized);
|
2010-11-18 23:13:35 +01:00
|
|
|
void destroyWindow();
|
|
|
|
void showWindow();
|
|
|
|
void setWindowTitle(const char *title);
|
|
|
|
bool isWindowFocused();
|
|
|
|
bool isWindowVisible();
|
2011-03-20 20:55:12 +01:00
|
|
|
int getWindowX();
|
|
|
|
int getWindowY();
|
2010-11-21 22:48:58 +01:00
|
|
|
int getWindowWidth();
|
|
|
|
int getWindowHeight();
|
2011-03-20 20:55:12 +01:00
|
|
|
bool isWindowMaximized();
|
2010-11-18 23:13:35 +01:00
|
|
|
|
2011-03-20 23:10:02 +01:00
|
|
|
int getDisplayHeight();
|
|
|
|
int getDisplayWidth();
|
|
|
|
|
2010-11-21 22:48:58 +01:00
|
|
|
/// Get GL extension function address
|
2010-11-18 23:13:35 +01:00
|
|
|
void *getExtensionProcAddress(const char *ext);
|
2010-11-21 22:48:58 +01:00
|
|
|
/// Check if GL extension is supported
|
2010-11-18 23:13:35 +01:00
|
|
|
bool isExtensionSupported(const char *ext);
|
|
|
|
|
2011-03-20 22:08:57 +01:00
|
|
|
const char *getClipboardText();
|
|
|
|
void setClipboardText(const char *text);
|
2010-11-18 23:13:35 +01:00
|
|
|
|
|
|
|
void hideMouseCursor();
|
|
|
|
void showMouseCursor();
|
|
|
|
|
2010-11-21 22:48:58 +01:00
|
|
|
/// Enable/disable vertical synchronization
|
2010-11-18 23:13:35 +01:00
|
|
|
void setVsync(bool enable = true);
|
2010-11-21 22:48:58 +01:00
|
|
|
/// Swap GL buffers
|
2010-11-18 23:13:35 +01:00
|
|
|
void swapBuffers();
|
2010-11-22 02:19:20 +01:00
|
|
|
|
|
|
|
/// Get the app user directory, the place to save files configurations files
|
2011-03-20 21:23:13 +01:00
|
|
|
const char *getAppUserDir();
|
2010-11-21 22:48:58 +01:00
|
|
|
}
|
2010-11-18 23:13:35 +01:00
|
|
|
|
|
|
|
#endif // PLATFORM_H
|