mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-06 21:26:56 +02:00
#15 reduce executable size, fix keyboard input, turn off LOG in release config
This commit is contained in:
BIN
bin/OpenLara
BIN
bin/OpenLara
Binary file not shown.
@@ -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
|
||||||
|
@@ -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
|
|
@@ -104,6 +104,10 @@ void WndProc(const XEvent &e) {
|
|||||||
break;
|
break;
|
||||||
case KeyPress :
|
case KeyPress :
|
||||||
case KeyRelease :
|
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);
|
Input::setDown(keyToInputKey(e.xkey.keycode), e.type == KeyPress);
|
||||||
break;
|
break;
|
||||||
case ButtonPress :
|
case ButtonPress :
|
||||||
@@ -111,12 +115,10 @@ void WndProc(const XEvent &e) {
|
|||||||
InputKey key = mouseToInputKey(e.xbutton.button);
|
InputKey key = mouseToInputKey(e.xbutton.button);
|
||||||
Input::setPos(key, Input::mouse.pos);
|
Input::setPos(key, Input::mouse.pos);
|
||||||
Input::setDown(key, e.type == ButtonPress);
|
Input::setDown(key, e.type == ButtonPress);
|
||||||
printf("%d\n", (int)e.xbutton.button);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MotionNotify :
|
case MotionNotify :
|
||||||
Input::setPos(ikMouseL, vec2((float)e.xmotion.x, (float)e.xmotion.y));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,11 +154,6 @@ int main() {
|
|||||||
Atom WM_DELETE_WINDOW = XInternAtom(dpy, "WM_DELETE_WINDOW", 0);
|
Atom WM_DELETE_WINDOW = XInternAtom(dpy, "WM_DELETE_WINDOW", 0);
|
||||||
XSetWMProtocols(dpy, wnd, &WM_DELETE_WINDOW, 1);
|
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();
|
sndInit();
|
||||||
Game::init();
|
Game::init();
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
#define ASSERT(expr)
|
#define ASSERT(expr)
|
||||||
#define LOG(...) ((void)0)
|
#define LOG(...)
|
||||||
// #define LOG(...) printf(__VA_ARGS__)
|
// #define LOG(...) printf(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -528,4 +528,4 @@ struct Stream {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user