1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-01-17 21:09:00 +01:00

#15 reduce executable size, fix keyboard input, turn off LOG in release config

This commit is contained in:
XProger 2016-10-07 01:14:45 +03:00
parent 74969eea7e
commit 56d5201c0f
5 changed files with 8 additions and 13 deletions

Binary file not shown.

View File

@ -1 +1,2 @@
clang++ -std=c++11 -Os -s -fno-exceptions -fno-rtti main.cpp ../libs/stb_vorbis/stb_vorbis.c -I../ -o../../bin/OpenLara -lX11 -lGL -lm -lpthread -lpulse-simple -lpulse -ffunction-sections -fdata-sections -Wl,--gc-sections
clang++ -std=c++11 -Os -s -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG main.cpp ../libs/stb_vorbis/stb_vorbis.c -I../ -o../../bin/OpenLara -lX11 -lGL -lm -lpthread -lpulse-simple -lpulse
strip ../../bin/OpenLara --strip-all --remove-section=.comment --remove-section=.note

View File

@ -1,3 +0,0 @@
sudo apt-get install git g++ libx11-dev libgl1-mesa-dev libpulse-dev
git clone https://github.com/XProger/OpenLara
cd OpenLara/src/nix

View File

@ -104,6 +104,10 @@ void WndProc(const XEvent &e) {
break;
case KeyPress :
case KeyRelease :
if (e.type == KeyPress && (e.xkey.state & Mod1Mask) && e.xkey.keycode == 36) {
// TODO: windowed <-> fullscreen switch
break;
}
Input::setDown(keyToInputKey(e.xkey.keycode), e.type == KeyPress);
break;
case ButtonPress :
@ -111,12 +115,10 @@ void WndProc(const XEvent &e) {
InputKey key = mouseToInputKey(e.xbutton.button);
Input::setPos(key, Input::mouse.pos);
Input::setDown(key, e.type == ButtonPress);
printf("%d\n", (int)e.xbutton.button);
break;
}
case MotionNotify :
Input::setPos(ikMouseL, vec2((float)e.xmotion.x, (float)e.xmotion.y));
printf("mouse: %d %d\n", (int)e.xmotion.x, (int)e.xmotion.y);
break;
}
}
@ -152,11 +154,6 @@ int main() {
Atom WM_DELETE_WINDOW = XInternAtom(dpy, "WM_DELETE_WINDOW", 0);
XSetWMProtocols(dpy, wnd, &WM_DELETE_WINDOW, 1);
// XGrabPointer(dpy, wnd, false,
// ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ButtonMotionMask,
// GrabModeAsync, GrabModeAsync, wnd, None, CurrentTime);
XGrabKeyboard(dpy, wnd, false, 1, 1, 0);
sndInit();
Game::init();

View File

@ -19,7 +19,7 @@
#else
#define ASSERT(expr)
#define LOG(...) ((void)0)
#define LOG(...)
// #define LOG(...) printf(__VA_ARGS__)
#endif
@ -528,4 +528,4 @@ struct Stream {
}
};
#endif
#endif