Add prelude with UNUSED macro
parent
b52deb3342
commit
b89e6619af
|
@ -0,0 +1,14 @@
|
|||
#ifndef ENGINE_PRELUDE_H_
|
||||
#define ENGINE_PRELUDE_H_
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
# define UNUSED __attribute__((unused))
|
||||
|
||||
#else // __GNUC__
|
||||
|
||||
# define UNUSED
|
||||
|
||||
#endif // __GNUC__
|
||||
|
||||
#endif // ENGINE_PRELUDE_H_
|
|
@ -5,6 +5,7 @@
|
|||
#include <GL/glxew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "_prelude.h"
|
||||
#include "input.h"
|
||||
#include "logger.h"
|
||||
#include "performance.h"
|
||||
|
@ -111,6 +112,6 @@ EngineConfig defaultConfig() {
|
|||
.swapInterval = 1 };
|
||||
}
|
||||
|
||||
static void onGlfwError(int error, const char* description) {
|
||||
static void onGlfwError(int error UNUSED, const char* description) {
|
||||
logError("GLFW error: %s", description);
|
||||
}
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "_prelude.h"
|
||||
#include "render.h"
|
||||
|
||||
static void (*keyboardInputCallback) (int, int, int, int);
|
||||
|
||||
|
||||
|
||||
void onKeyboardEvent(GLFWwindow* window, int key, int scancode, int action, int mods) {
|
||||
void onKeyboardEvent(GLFWwindow* window UNUSED, int key, int scancode, int action, int mods) {
|
||||
if (!(mods & GLFW_MOD_CONTROL)) {
|
||||
if (keyboardInputCallback) {
|
||||
keyboardInputCallback(key, scancode, action, mods);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "ui.h"
|
||||
|
||||
#include "_prelude.h"
|
||||
#include "render.h"
|
||||
|
||||
void resizeStage(GLFWwindow* window, int width, int height) {
|
||||
void resizeStage(GLFWwindow* window UNUSED, int width, int height) {
|
||||
if (height == 0)
|
||||
height = 1;
|
||||
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "engine/_prelude.h"
|
||||
|
||||
#include "player.h"
|
||||
|
||||
void keyboardInput(int key, int scancode, int action, int mods) {
|
||||
void keyboardInput(int key, int scancode UNUSED, int action, int mods UNUSED) {
|
||||
switch (key) {
|
||||
case GLFW_KEY_W:
|
||||
if (action == GLFW_PRESS) {
|
||||
|
|
Loading…
Reference in New Issue