Niko/Journal for windows

This commit is contained in:
Mathew Velasquez 2016-11-03 18:36:11 -04:00
parent e80454a0d6
commit 78c4c3b9bf
10 changed files with 803 additions and 302 deletions

5
.gitignore vendored
View file

@ -3,13 +3,16 @@
*.bak
*.xxd
*.exe
*.bmp
/Makefile*
/oneshot
/steamshim_parent/steamshim
/build
/build*
/debug
/release
object_script.*
rpgscript.bat

View file

@ -73,8 +73,9 @@ void graphicsBindingInit();
void fileIntBindingInit();
void screenBindingInit();
void journalBindingInit();
void wallpaperBindingInit();
void nikoBindingInit();
void oneshotBindingInit();
void steamBindingInit();
@ -106,8 +107,9 @@ static void mriBindingInit()
graphicsBindingInit();
fileIntBindingInit();
screenBindingInit();
journalBindingInit();
wallpaperBindingInit();
nikoBindingInit();
oneshotBindingInit();
steamBindingInit();

View file

@ -0,0 +1,76 @@
#include "binding-util.h"
#include "binding-types.h"
#include "pipe.h"
#include "debugwriter.h"
#include <SDL.h>
#define OUT_BUFFER_SIZE 256
static SDL_Thread *thread = NULL;
static SDL_mutex *mutex = NULL;
static volatile char message_buffer[OUT_BUFFER_SIZE];
static volatile int message_len = 0;
int server_thread(void *data)
{
(void)data;
HANDLE pipe = CreateNamedPipeW(L"\\\\.\\pipe\\oneshot-journal-to-game",
PIPE_ACCESS_OUTBOUND,
PIPE_TYPE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
OUT_BUFFER_SIZE,
OUT_BUFFER_SIZE,
0,
NULL);
for (;;) {
ConnectNamedPipe(pipe, NULL);
SDL_LockMutex(mutex);
WriteFile(pipe, (const void*)message_buffer, OUT_BUFFER_SIZE, NULL, NULL);
SDL_UnlockMutex(mutex);
FlushFileBuffers(pipe);
DisconnectNamedPipe(pipe);
}
CloseHandle(pipe);
return 0;
}
RB_METHOD(journalSet)
{
RB_UNUSED_PARAM;
const char *name;
int len;
rb_get_args(argc, argv, "s", &name, &len RB_ARG_END);
#ifdef _WIN32
if (thread == NULL) {
thread = SDL_CreateThread(server_thread, "journal", NULL);
}
HANDLE pipe = CreateFileW(L"\\\\.\\pipe\\oneshot-game-to-journal",
GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
SDL_LockMutex(mutex);
strcpy((char*)message_buffer, name);
message_len = len;
SDL_UnlockMutex(mutex);
if (pipe != INVALID_HANDLE_VALUE) {
WriteFile(pipe, (const void*)message_buffer, OUT_BUFFER_SIZE, NULL, NULL);
FlushFileBuffers(pipe);
CloseHandle(pipe);
}
#endif
return Qnil;
}
void journalBindingInit()
{
mutex = SDL_CreateMutex();
VALUE module = rb_define_module("Journal");
_rb_define_module_function(module, "set", journalSet);
}

View file

@ -0,0 +1,52 @@
#include "binding-util.h"
#include "binding-types.h"
#include "sharedstate.h"
#include "eventthread.h"
#include "debugwriter.h"
#ifdef _WIN32
#include <shlwapi.h>
#endif
#include <SDL.h>
#include <SDL_syswm.h>
RB_METHOD(nikoStart)
{
RB_UNUSED_PARAM;
// Calculate where to stick the window
POINT pos;
pos.x = (9 * 16 - 4) * 2;
pos.y = (13 * 16) * 2;
SDL_SysWMinfo syswindow;
SDL_VERSION(&syswindow.version);
SDL_GetWindowWMInfo(shState->rtData().window, &syswindow);
ClientToScreen(syswindow.info.win.window, &pos);
// Start process
#ifdef _WIN32
WCHAR path[MAX_PATH];
WCHAR args[MAX_PATH];
GetModuleFileNameW(NULL, path, MAX_PATH);
PathRemoveFileSpecW(path);
wcscat(path, L"\\journal.exe");
wsprintfW(args, L"journal.exe %d %d", pos.x, pos.y);
STARTUPINFOW si;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
CreateProcessW(path, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
#else
#ifdef linux
#else
#endif
#endif
return Qnil;
}
void nikoBindingInit()
{
VALUE module = rb_define_module("Niko");
//Functions
_rb_define_module_function(module, "do_your_thing", nikoStart);
}

169
journal/journal.cpp Normal file
View file

@ -0,0 +1,169 @@
#include <windows.h>
#define DEFAULT_WIDTH 800
#define DEFAULT_HEIGHT 600
#define IN_BUFFER_SIZE 256
static const WCHAR journal_classname[] = L"journal";
static HBITMAP image_handle = NULL;
static HANDLE image_mutex = NULL;
static HWND window = NULL;
static void loadImage(const char *name) {
if (image_handle) {
DeleteObject(image_handle);
}
image_handle = LoadBitmapA(GetModuleHandleW(NULL), name);
}
// Window procedure
LRESULT CALLBACK journal_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc;
HDC hdcMem;
WaitForSingleObject(image_mutex, INFINITE);
hdc = BeginPaint(hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
HANDLE oldBitmap = SelectObject(hdcMem, image_handle);
BitBlt(hdc, 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, oldBitmap);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
ReleaseMutex(image_mutex);
} break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
// IPC thread
#include <stdio.h>
DWORD WINAPI ipc_thread(LPVOID lpParam)
{
(void)lpParam;
char message[IN_BUFFER_SIZE];
DWORD len;
HANDLE pipe = CreateNamedPipeW(L"\\\\.\\pipe\\oneshot-game-to-journal",
PIPE_ACCESS_INBOUND,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
IN_BUFFER_SIZE,
IN_BUFFER_SIZE,
0,
NULL);
for (;;) {
if (!ConnectNamedPipe(pipe, NULL))
continue;
for (;;) {
if (ReadFile(pipe, (void*)message, IN_BUFFER_SIZE, &len, NULL)
&& len == IN_BUFFER_SIZE)
{
WaitForSingleObject(image_mutex, INFINITE);
if (strcmp(message, "default") == 0) {
exit(0);
}
loadImage(message);
InvalidateRect(window, NULL, FALSE);
ReleaseMutex(image_mutex);
} else {
break;
}
}
DisconnectNamedPipe(pipe);
}
CloseHandle(pipe);
return 0;
}
int do_journal()
{
// Create
HINSTANCE module = GetModuleHandleW(NULL);
loadImage("default");
// Initial image
char message[IN_BUFFER_SIZE];
DWORD len;
HANDLE pipe = CreateFileW(L"\\\\.\\pipe\\oneshot-journal-to-game",
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (pipe != INVALID_HANDLE_VALUE) {
if (ReadFile(pipe, (void*)message, IN_BUFFER_SIZE, &len, NULL)
&& len == IN_BUFFER_SIZE)
{
loadImage(message);
}
CloseHandle(pipe);
}
WNDCLASSEXW wc;
wc.cbSize = sizeof(wc);
wc.style = 0;
wc.lpfnWndProc = journal_proc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = module;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = journal_classname;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx(&wc))
return 1;
if (!(window = CreateWindowExW(WS_EX_COMPOSITED | WS_EX_LAYERED | WS_EX_TOPMOST,
journal_classname,
L"",
WS_OVERLAPPEDWINDOW ^ (WS_THICKFRAME | WS_MAXIMIZEBOX),
CW_USEDEFAULT, CW_USEDEFAULT,
DEFAULT_WIDTH, DEFAULT_HEIGHT,
NULL, NULL, module, NULL))) {
return 1;
}
SetLayeredWindowAttributes(window, RGB(0, 255, 0), 0, LWA_COLORKEY);
ShowWindow(window, SW_SHOWNOACTIVATE);
UpdateWindow(window);
image_mutex = CreateMutexW(NULL, NULL, NULL);
HANDLE thread = CreateThread(NULL, 0, ipc_thread, NULL, 0, NULL);
// Dispatch messages
for (;;) {
MSG msg;
if (GetMessage(&msg, window, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
} else {
break;
}
}
// TODO make this less messy?
TerminateThread(thread, 0);
DestroyWindow(window);
return 0;
}

12
journal/journal.pro Normal file
View file

@ -0,0 +1,12 @@
TEMPLATE = app
CONFIG += c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp \
niko.cpp \
journal.cpp
LIBS += -lgdi32
RC_FILE = resources.rc

27
journal/main.cpp Normal file
View file

@ -0,0 +1,27 @@
#include <windows.h>
extern int do_niko(int x, int y);
extern int do_journal();
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
(void)hInstance;
(void)hPrevInstance;
(void)lpCmdLine;
(void)nCmdShow;
int argc;
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
// argc == 3, assume niko
if (argc == 3) {
int x = _wtoi(argv[1]);
int y = _wtoi(argv[2]);
return do_niko(x, y);
}
// assume journal
return do_journal();
}

130
journal/niko.cpp Normal file
View file

@ -0,0 +1,130 @@
#include <windows.h>
static const WCHAR niko_classname[] = L"niko";
static HWND niko = NULL;
static HBITMAP niko_bmps[3] = {NULL};
static int niko_offset = 0;
// Window procedure
LRESULT CALLBACK niko_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_CLOSE:
return 0;
case WM_PAINT: {
static int frame = 0;
if (niko_offset % 32 >= 16) {
frame = 1;
} else {
if ((niko_offset / 32) % 2)
frame = 0;
else
frame = 2;
}
PAINTSTRUCT ps;
HDC hdc;
BITMAP bitmap;
HDC hdcMem;
HGDIOBJ oldBitmap;
hdc = BeginPaint(hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
oldBitmap = SelectObject(hdcMem, niko_bmps[frame]);
GetObject(niko_bmps[frame], sizeof(bitmap), &bitmap);
BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, oldBitmap);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
}
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int do_niko(int x, int y)
{
// Create
HINSTANCE module = GetModuleHandleW(NULL);
niko_bmps[0] = LoadBitmapW(module, L"NIKO1");
niko_bmps[1] = LoadBitmapW(module, L"NIKO2");
niko_bmps[2] = LoadBitmapW(module, L"NIKO3");
WNDCLASSEXW wc;
wc.cbSize = sizeof(wc);
wc.style = 0;
wc.lpfnWndProc = niko_proc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = module;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = niko_classname;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx(&wc))
return 1;
if (!(niko = CreateWindowExW(WS_EX_COMPOSITED | WS_EX_LAYERED | WS_EX_TOPMOST | WS_EX_TOOLWINDOW,
niko_classname,
L"Niko",
WS_POPUP,
x, y,
24 * 2, 32 * 2,
NULL, NULL, module, NULL))) {
return 1;
}
SetLayeredWindowAttributes(niko, RGB(0, 255, 0), 0, LWA_COLORKEY);
ShowWindow(niko, SW_SHOWNOACTIVATE);
UpdateWindow(niko);
// Thread
int screenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
// Get starting position
RECT area;
GetWindowRect(niko, &area);
// Just keep walking down
for (;;) {
// Dispatch messages
unsigned long tick = GetTickCount();
for (;;) {
MSG msg;
if (PeekMessage(&msg, niko, 0, 0, PM_REMOVE) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
} else {
if (GetTickCount() - tick >= 1000 / 60)
break;
}
}
niko_offset += 2;
if (area.top + niko_offset >= screenHeight)
break;
SetWindowPos(niko, NULL, area.left, area.top + niko_offset, 0, 0, SWP_NOSIZE);
InvalidateRect(niko, NULL, FALSE);
}
DestroyWindow(niko);
for (int i = 0; i < 3; i++) {
if (niko_bmps[i])
DeleteObject(niko_bmps[i]);
}
return 0;
}

29
journal/resources.rc Normal file
View file

@ -0,0 +1,29 @@
#include <winuser.h>
NIKO1 BITMAP "niko1.bmp"
NIKO2 BITMAP "niko2.bmp"
NIKO3 BITMAP "niko3.bmp"
default BITMAP "default.bmp"
t1 BITMAP "t1.bmp"
t2 BITMAP "t2.bmp"
t3 BITMAP "t3.bmp"
t4 BITMAP "t4.bmp"
t5 BITMAP "t5.bmp"
t6 BITMAP "t6.bmp"
t7 BITMAP "t7.bmp"
t8 BITMAP "t8.bmp"
t9 BITMAP "t9.bmp"
t10 BITMAP "t10.bmp"
t11 BITMAP "t11.bmp"
t12 BITMAP "t12.bmp"
t13 BITMAP "t13.bmp"
t14 BITMAP "t14.bmp"
t15 BITMAP "t15.bmp"
t16 BITMAP "t16.bmp"
c1 BITMAP "c1.bmp"
c2 BITMAP "c2.bmp"
c3 BITMAP "c3.bmp"
c4 BITMAP "c4.bmp"
c5 BITMAP "c5.bmp"
c6 BITMAP "c6.bmp"
c7 BITMAP "c7.bmp"

599
mkxp.pro
View file

@ -1,299 +1,300 @@
TEMPLATE = app
QT =
TARGET = oneshot
DEPENDPATH += src shader assets
INCLUDEPATH += . src
CONFIG -= qt
CONFIG += link_pkgconfig
CONFIG(release, debug|release): DEFINES += NDEBUG
isEmpty(BINDING) {
BINDING = MRI
}
contains(BINDING, MRI) {
contains(_HAVE_BINDING, YES) {
error("Only one binding may be selected")
}
_HAVE_BINDING = YES
CONFIG += BINDING_MRI
}
contains(BINDING, MRUBY) {
contains(_HAVE_BINDING, YES) {
error("Only one binding may be selected")
}
_HAVE_BINDING = YES
CONFIG += BINDING_MRUBY
}
contains(BINDING, NULL) {
contains(_HAVE_BINDING, YES) {
error("Only one binding may be selected")
}
_HAVE_BINDING = YES
CONFIG += BINDING_NULL
}
unix {
CONFIG += c++11
PKGCONFIG += sigc++-2.0 pixman-1 vorbisfile \
sdl2 SDL2_image SDL2_ttf SDL_sound physfs
LIBS += -ldl
macx: {
CONFIG -= app_bundle
INCLUDEPATH += $$QMAKE_MAC_SDK_PATH/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers
LIBS += -framework OpenAL
}
!macx: {
PKGCONFIG += openal zlib
INCLUDEPATH += /usr/include/AL /usr/local/include/AL
}
}
win32 {
QMAKE_CXXFLAGS += -std=gnu++11
QMAKE_LFLAGS += -std=gnu++11
PKGCONFIG += sigc++-2.0 pixman-1 zlib \
sdl2 SDL2_image SDL2_ttf openal SDL_sound vorbisfile freetype2
LIBS += -lphysfs -lsecur32
release {
RC_FILE = assets/resources.rc
}
}
# Deal with boost paths...
isEmpty(BOOST_I) {
BOOST_I = $$(BOOST_I)
}
isEmpty(BOOST_I) {}
else {
INCLUDEPATH += $$BOOST_I
}
isEmpty(BOOST_L) {
BOOST_L = $$(BOOST_L)
}
isEmpty(BOOST_L) {}
else {
LIBS += -L$$BOOST_L
}
isEmpty(BOOST_LIB_SUFFIX) {
BOOST_LIB_SUFFIX = $$(BOOST_LIB_SUFFIX)
}
LIBS += -lboost_program_options$$BOOST_LIB_SUFFIX
STEAM {
DEFINES += STEAM
}
# Input
HEADERS += \
src/quadarray.h \
src/audio.h \
src/binding.h \
src/bitmap.h \
src/disposable.h \
src/etc.h \
src/etc-internal.h \
src/eventthread.h \
src/flashable.h \
src/font.h \
src/input.h \
src/plane.h \
src/scene.h \
src/sprite.h \
src/table.h \
src/texpool.h \
src/tilequad.h \
src/transform.h \
src/viewport.h \
src/window.h \
src/serializable.h \
src/shader.h \
src/glstate.h \
src/quad.h \
src/tilemap.h \
src/tilemap-common.h \
src/graphics.h \
src/gl-debug.h \
src/global-ibo.h \
src/exception.h \
src/filesystem.h \
src/serial-util.h \
src/intrulist.h \
src/binding.h \
src/gl-util.h \
src/util.h \
src/config.h \
src/settingsmenu.h \
src/keybindings.h \
src/tileatlas.h \
src/sharedstate.h \
src/al-util.h \
src/boost-hash.h \
src/debugwriter.h \
src/gl-fun.h \
src/gl-meta.h \
src/vertex.h \
src/soundemitter.h \
src/aldatasource.h \
src/alstream.h \
src/audiostream.h \
src/rgssad.h \
src/sdl-util.h \
src/oneshot.h \
src/pipe.h
SOURCES += \
src/main.cpp \
src/audio.cpp \
src/bitmap.cpp \
src/eventthread.cpp \
src/filesystem.cpp \
src/font.cpp \
src/input.cpp \
src/plane.cpp \
src/scene.cpp \
src/sprite.cpp \
src/table.cpp \
src/tilequad.cpp \
src/viewport.cpp \
src/window.cpp \
src/texpool.cpp \
src/shader.cpp \
src/glstate.cpp \
src/tilemap.cpp \
src/autotiles.cpp \
src/graphics.cpp \
src/gl-debug.cpp \
src/etc.cpp \
src/config.cpp \
src/settingsmenu.cpp \
src/keybindings.cpp \
src/tileatlas.cpp \
src/sharedstate.cpp \
src/gl-fun.cpp \
src/gl-meta.cpp \
src/vertex.cpp \
src/soundemitter.cpp \
src/sdlsoundsource.cpp \
src/alstream.cpp \
src/audiostream.cpp \
src/rgssad.cpp \
src/vorbissource.cpp \
src/oneshot.cpp \
binding-mri/steam-binding.cpp \
src/xdg-user-dir-lookup.c \
src/screen.cpp \
binding-mri/screen-binding.cpp \
binding-mri/wallpaper-binding.cpp
STEAM {
HEADERS += src/steam.h steamshim/steamshim_child.h
SOURCES += src/steam.cpp steamshim/steamshim_child.c
}
EMBED = \
shader/common.h \
shader/transSimple.frag \
shader/trans.frag \
shader/hue.frag \
shader/sprite.frag \
shader/plane.frag \
shader/gray.frag \
shader/bitmapBlit.frag \
shader/flatColor.frag \
shader/simple.frag \
shader/simpleColor.frag \
shader/simpleAlpha.frag \
shader/simpleAlphaUni.frag \
shader/flashMap.frag \
shader/obscured.frag \
shader/minimal.vert \
shader/simple.vert \
shader/simpleColor.vert \
shader/sprite.vert \
shader/tilemap.vert \
shader/blur.frag \
shader/blurH.vert \
shader/blurV.vert \
shader/simpleMatrix.vert \
assets/icon.png \
assets/gamecontrollerdb.txt
defineReplace(xxdOutput) {
return($$basename(1).xxd)
}
# xxd
xxd.output_function = xxdOutput
xxd.commands = xxd -i ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
xxd.depends = $$EMBED
xxd.input = EMBED
xxd.variable_out = HEADERS
QMAKE_EXTRA_COMPILERS += xxd
BINDING_NULL {
SOURCES += binding-null/binding-null.cpp
}
BINDING_MRI {
isEmpty(MRIVERSION) {
MRIVERSION = 2.2
}
PKGCONFIG += ruby-$$MRIVERSION
DEFINES += BINDING_MRI
# EMBED2 = binding-mri/module_rpg.rb
# xxdp.output = ${QMAKE_FILE_NAME}.xxd
# xxdp.commands = xxd+/xxd+ ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} --string
# xxdp.depends = $$EMBED2
# xxdp.input = EMBED2
# xxdp.variable_out = HEADERS
# QMAKE_EXTRA_COMPILERS += xxdp
HEADERS += \
binding-mri/binding-util.h \
binding-mri/binding-types.h \
binding-mri/serializable-binding.h \
binding-mri/disposable-binding.h \
binding-mri/sceneelement-binding.h \
binding-mri/viewportelement-binding.h \
binding-mri/flashable-binding.h
SOURCES += \
binding-mri/binding-mri.cpp \
binding-mri/binding-util.cpp \
binding-mri/table-binding.cpp \
binding-mri/etc-binding.cpp \
binding-mri/bitmap-binding.cpp \
binding-mri/font-binding.cpp \
binding-mri/graphics-binding.cpp \
binding-mri/input-binding.cpp \
binding-mri/sprite-binding.cpp \
binding-mri/viewport-binding.cpp \
binding-mri/plane-binding.cpp \
binding-mri/window-binding.cpp \
binding-mri/tilemap-binding.cpp \
binding-mri/audio-binding.cpp \
binding-mri/module_rpg.cpp \
binding-mri/filesystem-binding.cpp \
binding-mri/oneshot-binding.cpp
}
OTHER_FILES += $$EMBED
TEMPLATE = app
QT =
TARGET = oneshot
DEPENDPATH += src shader assets
INCLUDEPATH += . src
CONFIG -= qt
CONFIG += link_pkgconfig
CONFIG(release, debug|release): DEFINES += NDEBUG
isEmpty(BINDING) {
BINDING = MRI
}
contains(BINDING, MRI) {
contains(_HAVE_BINDING, YES) {
error("Only one binding may be selected")
}
_HAVE_BINDING = YES
CONFIG += BINDING_MRI
}
contains(BINDING, MRUBY) {
contains(_HAVE_BINDING, YES) {
error("Only one binding may be selected")
}
_HAVE_BINDING = YES
CONFIG += BINDING_MRUBY
}
contains(BINDING, NULL) {
contains(_HAVE_BINDING, YES) {
error("Only one binding may be selected")
}
_HAVE_BINDING = YES
CONFIG += BINDING_NULL
}
unix {
CONFIG += c++11
PKGCONFIG += sigc++-2.0 pixman-1 vorbisfile \
sdl2 SDL2_image SDL2_ttf SDL_sound physfs
LIBS += -ldl
macx: {
CONFIG -= app_bundle
INCLUDEPATH += $$QMAKE_MAC_SDK_PATH/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers
LIBS += -framework OpenAL
}
!macx: {
PKGCONFIG += openal zlib
INCLUDEPATH += /usr/include/AL /usr/local/include/AL
SOURCES += src/xdg-user-dir-lookup.c
}
}
win32 {
QMAKE_CXXFLAGS += -std=gnu++11
QMAKE_LFLAGS += -std=gnu++11
PKGCONFIG += sigc++-2.0 pixman-1 zlib \
sdl2 SDL2_image SDL2_ttf openal SDL_sound vorbisfile freetype2
LIBS += -lphysfs -lsecur32
release {
RC_FILE = assets/resources.rc
}
}
# Deal with boost paths...
isEmpty(BOOST_I) {
BOOST_I = $$(BOOST_I)
}
isEmpty(BOOST_I) {}
else {
INCLUDEPATH += $$BOOST_I
}
isEmpty(BOOST_L) {
BOOST_L = $$(BOOST_L)
}
isEmpty(BOOST_L) {}
else {
LIBS += -L$$BOOST_L
}
isEmpty(BOOST_LIB_SUFFIX) {
BOOST_LIB_SUFFIX = $$(BOOST_LIB_SUFFIX)
}
LIBS += -lboost_program_options$$BOOST_LIB_SUFFIX
STEAM {
DEFINES += STEAM
}
# Input
HEADERS += \
src/quadarray.h \
src/audio.h \
src/binding.h \
src/bitmap.h \
src/disposable.h \
src/etc.h \
src/etc-internal.h \
src/eventthread.h \
src/flashable.h \
src/font.h \
src/input.h \
src/plane.h \
src/scene.h \
src/sprite.h \
src/table.h \
src/texpool.h \
src/tilequad.h \
src/transform.h \
src/viewport.h \
src/window.h \
src/serializable.h \
src/shader.h \
src/glstate.h \
src/quad.h \
src/tilemap.h \
src/tilemap-common.h \
src/graphics.h \
src/gl-debug.h \
src/global-ibo.h \
src/exception.h \
src/filesystem.h \
src/serial-util.h \
src/intrulist.h \
src/binding.h \
src/gl-util.h \
src/util.h \
src/config.h \
src/settingsmenu.h \
src/keybindings.h \
src/tileatlas.h \
src/sharedstate.h \
src/al-util.h \
src/boost-hash.h \
src/debugwriter.h \
src/gl-fun.h \
src/gl-meta.h \
src/vertex.h \
src/soundemitter.h \
src/aldatasource.h \
src/alstream.h \
src/audiostream.h \
src/rgssad.h \
src/sdl-util.h \
src/oneshot.h \
src/pipe.h
SOURCES += \
src/main.cpp \
src/audio.cpp \
src/bitmap.cpp \
src/eventthread.cpp \
src/filesystem.cpp \
src/font.cpp \
src/input.cpp \
src/plane.cpp \
src/scene.cpp \
src/sprite.cpp \
src/table.cpp \
src/tilequad.cpp \
src/viewport.cpp \
src/window.cpp \
src/texpool.cpp \
src/shader.cpp \
src/glstate.cpp \
src/tilemap.cpp \
src/autotiles.cpp \
src/graphics.cpp \
src/gl-debug.cpp \
src/etc.cpp \
src/config.cpp \
src/settingsmenu.cpp \
src/keybindings.cpp \
src/tileatlas.cpp \
src/sharedstate.cpp \
src/gl-fun.cpp \
src/gl-meta.cpp \
src/vertex.cpp \
src/soundemitter.cpp \
src/sdlsoundsource.cpp \
src/alstream.cpp \
src/audiostream.cpp \
src/rgssad.cpp \
src/vorbissource.cpp \
src/oneshot.cpp \
src/screen.cpp \
binding-mri/journal-binding.cpp
STEAM {
HEADERS += src/steam.h steamshim/steamshim_child.h
SOURCES += src/steam.cpp steamshim/steamshim_child.c
}
EMBED = \
shader/common.h \
shader/transSimple.frag \
shader/trans.frag \
shader/hue.frag \
shader/sprite.frag \
shader/plane.frag \
shader/gray.frag \
shader/bitmapBlit.frag \
shader/flatColor.frag \
shader/simple.frag \
shader/simpleColor.frag \
shader/simpleAlpha.frag \
shader/simpleAlphaUni.frag \
shader/flashMap.frag \
shader/obscured.frag \
shader/minimal.vert \
shader/simple.vert \
shader/simpleColor.vert \
shader/sprite.vert \
shader/tilemap.vert \
shader/blur.frag \
shader/blurH.vert \
shader/blurV.vert \
shader/simpleMatrix.vert \
assets/icon.png \
assets/gamecontrollerdb.txt
defineReplace(xxdOutput) {
return($$basename(1).xxd)
}
# xxd
xxd.output_function = xxdOutput
xxd.commands = xxd -i ${QMAKE_FILE_NAME} > ${QMAKE_FILE_OUT}
xxd.depends = $$EMBED
xxd.input = EMBED
xxd.variable_out = HEADERS
QMAKE_EXTRA_COMPILERS += xxd
BINDING_NULL {
SOURCES += binding-null/binding-null.cpp
}
BINDING_MRI {
isEmpty(MRIVERSION) {
MRIVERSION = 2.2
}
PKGCONFIG += ruby-$$MRIVERSION
DEFINES += BINDING_MRI
# EMBED2 = binding-mri/module_rpg.rb
# xxdp.output = ${QMAKE_FILE_NAME}.xxd
# xxdp.commands = xxd+/xxd+ ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} --string
# xxdp.depends = $$EMBED2
# xxdp.input = EMBED2
# xxdp.variable_out = HEADERS
# QMAKE_EXTRA_COMPILERS += xxdp
HEADERS += \
binding-mri/binding-util.h \
binding-mri/binding-types.h \
binding-mri/serializable-binding.h \
binding-mri/disposable-binding.h \
binding-mri/sceneelement-binding.h \
binding-mri/viewportelement-binding.h \
binding-mri/flashable-binding.h
SOURCES += \
binding-mri/binding-mri.cpp \
binding-mri/binding-util.cpp \
binding-mri/table-binding.cpp \
binding-mri/etc-binding.cpp \
binding-mri/bitmap-binding.cpp \
binding-mri/font-binding.cpp \
binding-mri/graphics-binding.cpp \
binding-mri/input-binding.cpp \
binding-mri/sprite-binding.cpp \
binding-mri/viewport-binding.cpp \
binding-mri/plane-binding.cpp \
binding-mri/window-binding.cpp \
binding-mri/tilemap-binding.cpp \
binding-mri/audio-binding.cpp \
binding-mri/module_rpg.cpp \
binding-mri/filesystem-binding.cpp \
binding-mri/oneshot-binding.cpp \
binding-mri/steam-binding.cpp \
binding-mri/wallpaper-binding.cpp \
binding-mri/niko-binding.cpp
}
OTHER_FILES += $$EMBED