VS 2015 compiling cocos2d-x 3.3 error “fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration”

Until now, Many libraries & programs used snprintf() function by defining it as _snprintf(), since _snprintf() was supported. #define snprintf _snprintf Finally, Visual Studio 14 defines snprintf()! Since, snprintf() is now officially supported. We should never #define it. Doing it will overshadow new snprintf() function defined in stdio.h. To restrict that, this is added in … Read more

Getting the dimensions of the soft keyboard

We did it with this myLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { Rect r = new Rect(); parent.getWindowVisibleDisplayFrame(r); int screenHeight = parent.getRootView().getHeight(); int heightDifference = screenHeight – (r.bottom – r.top); Log.d(“Keyboard Size”, “Size: ” + heightDifference); } }); We only resize views with the keyboard, so we could use this.