Skip to content

Commit

Permalink
#15 reduce executable size, fix keyboard input, turn off LOG in relea…
Browse files Browse the repository at this point in the history
…se config
  • Loading branch information
XProger committed Oct 6, 2016
1 parent 74969ee commit 56d5201
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
Binary file modified bin/OpenLara
Binary file not shown.
3 changes: 2 additions & 1 deletion src/nix/build.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions src/nix/howto.txt~

This file was deleted.

11 changes: 4 additions & 7 deletions src/nix/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,21 @@ 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 :
case ButtonRelease : {
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;
}
}
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#else
#define ASSERT(expr)
#define LOG(...) ((void)0)
#define LOG(...)
// #define LOG(...) printf(__VA_ARGS__)
#endif

Expand Down Expand Up @@ -528,4 +528,4 @@ struct Stream {
}
};

#endif
#endif

0 comments on commit 56d5201

Please sign in to comment.