mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Pass clang-format on 14 trivial header files fixes
Also remove them from whitelist
This commit is contained in:
parent
271d7c31e6
commit
4af99b75cf
@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#define S_CLIENT_H_
|
#define S_CLIENT_H_
|
||||||
|
|
||||||
#include "cpp_api/s_base.h"
|
#include "cpp_api/s_base.h"
|
||||||
#include "util/string.h"
|
|
||||||
#include "mapnode.h"
|
#include "mapnode.h"
|
||||||
|
#include "util/string.h"
|
||||||
|
|
||||||
#ifdef _CRT_MSVCP_CURRENT
|
#ifdef _CRT_MSVCP_CURRENT
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
class ClientEnvironment;
|
class ClientEnvironment;
|
||||||
|
|
||||||
class ScriptApiClient: virtual public ScriptApiBase
|
class ScriptApiClient : virtual public ScriptApiBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Calls on_shutdown handlers
|
// Calls on_shutdown handlers
|
||||||
|
@ -26,8 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
struct ToolCapabilities;
|
struct ToolCapabilities;
|
||||||
|
|
||||||
class ScriptApiPlayer
|
class ScriptApiPlayer : virtual public ScriptApiBase
|
||||||
: virtual public ScriptApiBase
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ScriptApiPlayer();
|
virtual ~ScriptApiPlayer();
|
||||||
@ -36,17 +35,16 @@ public:
|
|||||||
void on_dieplayer(ServerActiveObject *player);
|
void on_dieplayer(ServerActiveObject *player);
|
||||||
bool on_respawnplayer(ServerActiveObject *player);
|
bool on_respawnplayer(ServerActiveObject *player);
|
||||||
bool on_prejoinplayer(const std::string &name, const std::string &ip,
|
bool on_prejoinplayer(const std::string &name, const std::string &ip,
|
||||||
std::string *reason);
|
std::string *reason);
|
||||||
void on_joinplayer(ServerActiveObject *player);
|
void on_joinplayer(ServerActiveObject *player);
|
||||||
void on_leaveplayer(ServerActiveObject *player, bool timeout);
|
void on_leaveplayer(ServerActiveObject *player, bool timeout);
|
||||||
void on_cheat(ServerActiveObject *player, const std::string &cheat_type);
|
void on_cheat(ServerActiveObject *player, const std::string &cheat_type);
|
||||||
bool on_punchplayer(ServerActiveObject *player,
|
bool on_punchplayer(ServerActiveObject *player, ServerActiveObject *hitter,
|
||||||
ServerActiveObject *hitter, float time_from_last_punch,
|
float time_from_last_punch, const ToolCapabilities *toolcap,
|
||||||
const ToolCapabilities *toolcap, v3f dir, s16 damage);
|
v3f dir, s16 damage);
|
||||||
s16 on_player_hpchange(ServerActiveObject *player, s16 hp_change);
|
s16 on_player_hpchange(ServerActiveObject *player, s16 hp_change);
|
||||||
void on_playerReceiveFields(ServerActiveObject *player,
|
void on_playerReceiveFields(ServerActiveObject *player,
|
||||||
const std::string &formname, const StringMap &fields);
|
const std::string &formname, const StringMap &fields);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* S_PLAYER_H_ */
|
#endif /* S_PLAYER_H_ */
|
||||||
|
@ -22,12 +22,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include "lua_api/l_base.h"
|
#include "lua_api/l_base.h"
|
||||||
|
|
||||||
|
|
||||||
class AreaStore;
|
class AreaStore;
|
||||||
|
|
||||||
class LuaAreaStore : public ModApiBase {
|
class LuaAreaStore : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const char className[];
|
static const char className[];
|
||||||
static const luaL_reg methods[];
|
static const luaL_reg methods[];
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef L_METADATA_H_
|
#ifndef L_METADATA_H_
|
||||||
#define L_METADATA_H_
|
#define L_METADATA_H_
|
||||||
|
|
||||||
#include "lua_api/l_base.h"
|
|
||||||
#include "irrlichttypes_bloated.h"
|
#include "irrlichttypes_bloated.h"
|
||||||
|
#include "lua_api/l_base.h"
|
||||||
|
|
||||||
class Metadata;
|
class Metadata;
|
||||||
|
|
||||||
@ -28,14 +28,15 @@ class Metadata;
|
|||||||
NodeMetaRef
|
NodeMetaRef
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MetaDataRef : public ModApiBase {
|
class MetaDataRef : public ModApiBase
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~MetaDataRef() {}
|
virtual ~MetaDataRef() {}
|
||||||
protected:
|
protected:
|
||||||
static MetaDataRef *checkobject(lua_State *L, int narg);
|
static MetaDataRef *checkobject(lua_State *L, int narg);
|
||||||
|
|
||||||
virtual void reportMetadataChange() {}
|
virtual void reportMetadataChange() {}
|
||||||
virtual Metadata* getmeta(bool auto_create) = 0;
|
virtual Metadata *getmeta(bool auto_create) = 0;
|
||||||
virtual void clearMeta() = 0;
|
virtual void clearMeta() = 0;
|
||||||
|
|
||||||
virtual void handleToTable(lua_State *L, Metadata *meta);
|
virtual void handleToTable(lua_State *L, Metadata *meta);
|
||||||
|
@ -22,12 +22,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include "l_base.h"
|
#include "l_base.h"
|
||||||
|
|
||||||
|
|
||||||
class Minimap;
|
class Minimap;
|
||||||
|
|
||||||
class LuaMinimap : public ModApiBase {
|
class LuaMinimap : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const char className[];
|
static const char className[];
|
||||||
static const luaL_reg methods[];
|
static const luaL_reg methods[];
|
||||||
|
|
||||||
@ -49,6 +48,7 @@ private:
|
|||||||
static int l_toggle_shape(lua_State *L);
|
static int l_toggle_shape(lua_State *L);
|
||||||
|
|
||||||
Minimap *m_minimap;
|
Minimap *m_minimap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaMinimap(Minimap *m);
|
LuaMinimap(Minimap *m);
|
||||||
~LuaMinimap() {}
|
~LuaMinimap() {}
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
static void create(lua_State *L, Minimap *object);
|
static void create(lua_State *L, Minimap *object);
|
||||||
|
|
||||||
static LuaMinimap *checkobject(lua_State *L, int narg);
|
static LuaMinimap *checkobject(lua_State *L, int narg);
|
||||||
static Minimap* getobject(LuaMinimap *ref);
|
static Minimap *getobject(LuaMinimap *ref);
|
||||||
|
|
||||||
static void Register(lua_State *L);
|
static void Register(lua_State *L);
|
||||||
};
|
};
|
||||||
|
@ -20,12 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef L_NODETIMER_H_
|
#ifndef L_NODETIMER_H_
|
||||||
#define L_NODETIMER_H_
|
#define L_NODETIMER_H_
|
||||||
|
|
||||||
#include "lua_api/l_base.h"
|
|
||||||
#include "irr_v3d.h"
|
#include "irr_v3d.h"
|
||||||
|
#include "lua_api/l_base.h"
|
||||||
|
|
||||||
class ServerEnvironment;
|
class ServerEnvironment;
|
||||||
|
|
||||||
class NodeTimerRef : public ModApiBase {
|
class NodeTimerRef : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
v3s16 m_p;
|
v3s16 m_p;
|
||||||
ServerEnvironment *m_env;
|
ServerEnvironment *m_env;
|
||||||
@ -62,6 +63,4 @@ public:
|
|||||||
static void Register(lua_State *L);
|
static void Register(lua_State *L);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* L_NODETIMER_H_ */
|
#endif /* L_NODETIMER_H_ */
|
||||||
|
@ -20,14 +20,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef L_NOISE_H_
|
#ifndef L_NOISE_H_
|
||||||
#define L_NOISE_H_
|
#define L_NOISE_H_
|
||||||
|
|
||||||
#include "lua_api/l_base.h"
|
|
||||||
#include "irr_v3d.h"
|
#include "irr_v3d.h"
|
||||||
|
#include "lua_api/l_base.h"
|
||||||
#include "noise.h"
|
#include "noise.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LuaPerlinNoise
|
LuaPerlinNoise
|
||||||
*/
|
*/
|
||||||
class LuaPerlinNoise : public ModApiBase {
|
class LuaPerlinNoise : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
NoiseParams np;
|
NoiseParams np;
|
||||||
static const char className[];
|
static const char className[];
|
||||||
@ -57,7 +58,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
LuaPerlinNoiseMap
|
LuaPerlinNoiseMap
|
||||||
*/
|
*/
|
||||||
class LuaPerlinNoiseMap : public ModApiBase {
|
class LuaPerlinNoiseMap : public ModApiBase
|
||||||
|
{
|
||||||
NoiseParams np;
|
NoiseParams np;
|
||||||
Noise *noise;
|
Noise *noise;
|
||||||
bool m_is3d;
|
bool m_is3d;
|
||||||
@ -95,7 +97,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
LuaPseudoRandom
|
LuaPseudoRandom
|
||||||
*/
|
*/
|
||||||
class LuaPseudoRandom : public ModApiBase {
|
class LuaPseudoRandom : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
PseudoRandom m_pseudo;
|
PseudoRandom m_pseudo;
|
||||||
|
|
||||||
@ -111,8 +114,7 @@ private:
|
|||||||
static int l_next(lua_State *L);
|
static int l_next(lua_State *L);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaPseudoRandom(s32 seed) :
|
LuaPseudoRandom(s32 seed) : m_pseudo(seed) {}
|
||||||
m_pseudo(seed) {}
|
|
||||||
|
|
||||||
// LuaPseudoRandom(seed)
|
// LuaPseudoRandom(seed)
|
||||||
// Creates an LuaPseudoRandom and leaves it on top of stack
|
// Creates an LuaPseudoRandom and leaves it on top of stack
|
||||||
@ -126,7 +128,8 @@ public:
|
|||||||
/*
|
/*
|
||||||
LuaPcgRandom
|
LuaPcgRandom
|
||||||
*/
|
*/
|
||||||
class LuaPcgRandom : public ModApiBase {
|
class LuaPcgRandom : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
PcgRandom m_rnd;
|
PcgRandom m_rnd;
|
||||||
|
|
||||||
@ -146,10 +149,8 @@ private:
|
|||||||
static int l_rand_normal_dist(lua_State *L);
|
static int l_rand_normal_dist(lua_State *L);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaPcgRandom(u64 seed) :
|
LuaPcgRandom(u64 seed) : m_rnd(seed) {}
|
||||||
m_rnd(seed) {}
|
LuaPcgRandom(u64 seed, u64 seq) : m_rnd(seed, seq) {}
|
||||||
LuaPcgRandom(u64 seed, u64 seq) :
|
|
||||||
m_rnd(seed, seq) {}
|
|
||||||
|
|
||||||
// LuaPcgRandom(seed)
|
// LuaPcgRandom(seed)
|
||||||
// Creates an LuaPcgRandom and leaves it on top of stack
|
// Creates an LuaPcgRandom and leaves it on top of stack
|
||||||
@ -160,11 +161,11 @@ public:
|
|||||||
static void Register(lua_State *L);
|
static void Register(lua_State *L);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LuaSecureRandom
|
LuaSecureRandom
|
||||||
*/
|
*/
|
||||||
class LuaSecureRandom : public ModApiBase {
|
class LuaSecureRandom : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
static const size_t RAND_BUF_SIZE = 2048;
|
static const size_t RAND_BUF_SIZE = 2048;
|
||||||
static const char className[];
|
static const char className[];
|
||||||
|
@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include "lua_api/l_base.h"
|
#include "lua_api/l_base.h"
|
||||||
|
|
||||||
class ModApiServer : public ModApiBase {
|
class ModApiServer : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
// request_shutdown([message], [reconnect])
|
// request_shutdown([message], [reconnect])
|
||||||
static int l_request_shutdown(lua_State *L);
|
static int l_request_shutdown(lua_State *L);
|
||||||
@ -107,7 +108,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static void Initialize(lua_State *L, int top);
|
static void Initialize(lua_State *L, int top);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* L_SERVER_H_ */
|
#endif /* L_SERVER_H_ */
|
||||||
|
@ -24,51 +24,51 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
class LuaSettings : public ModApiBase {
|
class LuaSettings : public ModApiBase
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
static const char className[];
|
static const char className[];
|
||||||
static const luaL_reg methods[];
|
static const luaL_reg methods[];
|
||||||
|
|
||||||
// garbage collector
|
// garbage collector
|
||||||
static int gc_object(lua_State* L);
|
static int gc_object(lua_State *L);
|
||||||
|
|
||||||
// get(self, key) -> value
|
// get(self, key) -> value
|
||||||
static int l_get(lua_State* L);
|
static int l_get(lua_State *L);
|
||||||
|
|
||||||
// get_bool(self, key) -> boolean
|
// get_bool(self, key) -> boolean
|
||||||
static int l_get_bool(lua_State* L);
|
static int l_get_bool(lua_State *L);
|
||||||
|
|
||||||
// set(self, key, value)
|
// set(self, key, value)
|
||||||
static int l_set(lua_State* L);
|
static int l_set(lua_State *L);
|
||||||
|
|
||||||
// remove(self, key) -> success
|
// remove(self, key) -> success
|
||||||
static int l_remove(lua_State* L);
|
static int l_remove(lua_State *L);
|
||||||
|
|
||||||
// get_names(self) -> {key1, ...}
|
// get_names(self) -> {key1, ...}
|
||||||
static int l_get_names(lua_State* L);
|
static int l_get_names(lua_State *L);
|
||||||
|
|
||||||
// write(self) -> success
|
// write(self) -> success
|
||||||
static int l_write(lua_State* L);
|
static int l_write(lua_State *L);
|
||||||
|
|
||||||
// to_table(self) -> {[key1]=value1,...}
|
// to_table(self) -> {[key1]=value1,...}
|
||||||
static int l_to_table(lua_State* L);
|
static int l_to_table(lua_State *L);
|
||||||
|
|
||||||
bool m_write_allowed;
|
bool m_write_allowed;
|
||||||
Settings* m_settings;
|
Settings *m_settings;
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaSettings(const char* filename, bool write_allowed);
|
LuaSettings(const char *filename, bool write_allowed);
|
||||||
~LuaSettings();
|
~LuaSettings();
|
||||||
|
|
||||||
// LuaSettings(filename)
|
// LuaSettings(filename)
|
||||||
// Creates an LuaSettings and leaves it on top of stack
|
// Creates an LuaSettings and leaves it on top of stack
|
||||||
static int create_object(lua_State* L);
|
static int create_object(lua_State *L);
|
||||||
|
|
||||||
static LuaSettings* checkobject(lua_State* L, int narg);
|
static LuaSettings *checkobject(lua_State *L, int narg);
|
||||||
|
|
||||||
static void Register(lua_State* L);
|
|
||||||
|
|
||||||
|
static void Register(lua_State *L);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,19 +29,19 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include "threads.h"
|
#include "threads.h"
|
||||||
|
|
||||||
#if USE_CPP11_MUTEX
|
#if USE_CPP11_MUTEX
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include "threading/mutex.h"
|
#include "threading/mutex.h"
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** A syncronization primitive that will wake up one waiting thread when signaled.
|
/** A syncronization primitive that will wake up one waiting thread when signaled.
|
||||||
* Calling @c signal() multiple times before a waiting thread has had a chance
|
* Calling @c signal() multiple times before a waiting thread has had a chance
|
||||||
* to notice the signal will wake only one thread. Additionally, if no threads
|
* to notice the signal will wake only one thread. Additionally, if no threads
|
||||||
* are waiting on the event when it is signaled, the next call to @c wait()
|
* are waiting on the event when it is signaled, the next call to @c wait()
|
||||||
* will return (almost) immediately.
|
* will return (almost) immediately.
|
||||||
*/
|
*/
|
||||||
class Event {
|
class Event
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Event();
|
Event();
|
||||||
#ifndef USE_CPP11_MUTEX
|
#ifndef USE_CPP11_MUTEX
|
||||||
|
@ -21,21 +21,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#define THREADING_SEMAPHORE_H
|
#define THREADING_SEMAPHORE_H
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined(__MACH__) && defined(__APPLE__)
|
#elif defined(__MACH__) && defined(__APPLE__)
|
||||||
#include <mach/semaphore.h>
|
#include <mach/semaphore.h>
|
||||||
#else
|
#else
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "util/basic_macros.h"
|
#include "util/basic_macros.h"
|
||||||
|
|
||||||
class Semaphore {
|
class Semaphore
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Semaphore(int val=0);
|
Semaphore(int val = 0);
|
||||||
~Semaphore();
|
~Semaphore();
|
||||||
|
|
||||||
void post(unsigned int num=1);
|
void post(unsigned int num = 1);
|
||||||
void wait();
|
void wait();
|
||||||
bool wait(unsigned int time_ms);
|
bool wait(unsigned int time_ms);
|
||||||
|
|
||||||
@ -52,4 +53,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,36 +20,41 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef TILEANIMATION_HEADER
|
#ifndef TILEANIMATION_HEADER
|
||||||
#define TILEANIMATION_HEADER
|
#define TILEANIMATION_HEADER
|
||||||
|
|
||||||
#include "irrlichttypes_bloated.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "irrlichttypes_bloated.h"
|
||||||
|
|
||||||
enum TileAnimationType {
|
enum TileAnimationType
|
||||||
|
{
|
||||||
TAT_NONE = 0,
|
TAT_NONE = 0,
|
||||||
TAT_VERTICAL_FRAMES = 1,
|
TAT_VERTICAL_FRAMES = 1,
|
||||||
TAT_SHEET_2D = 2,
|
TAT_SHEET_2D = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TileAnimationParams {
|
struct TileAnimationParams
|
||||||
|
{
|
||||||
enum TileAnimationType type;
|
enum TileAnimationType type;
|
||||||
union {
|
union
|
||||||
|
{
|
||||||
// struct {
|
// struct {
|
||||||
// } none;
|
// } none;
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
int aspect_w; // width for aspect ratio
|
int aspect_w; // width for aspect ratio
|
||||||
int aspect_h; // height for aspect ratio
|
int aspect_h; // height for aspect ratio
|
||||||
float length; // seconds
|
float length; // seconds
|
||||||
} vertical_frames;
|
} vertical_frames;
|
||||||
struct {
|
struct
|
||||||
int frames_w; // number of frames left-to-right
|
{
|
||||||
int frames_h; // number of frames top-to-bottom
|
int frames_w; // number of frames left-to-right
|
||||||
|
int frames_h; // number of frames top-to-bottom
|
||||||
float frame_length; // seconds
|
float frame_length; // seconds
|
||||||
} sheet_2d;
|
} sheet_2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
void serialize(std::ostream &os, u16 protocol_version) const;
|
void serialize(std::ostream &os, u16 protocol_version) const;
|
||||||
void deSerialize(std::istream &is, u16 protocol_version);
|
void deSerialize(std::istream &is, u16 protocol_version);
|
||||||
void determineParams(v2u32 texture_size, int *frame_count,
|
void determineParams(v2u32 texture_size, int *frame_count, int *frame_length_ms,
|
||||||
int *frame_length_ms, v2u32 *frame_size) const;
|
v2u32 *frame_size) const;
|
||||||
void getTextureModifer(std::ostream &os, v2u32 texture_size, int frame) const;
|
void getTextureModifer(std::ostream &os, v2u32 texture_size, int frame) const;
|
||||||
v2f getTextureCoords(v2u32 texture_size, int frame) const;
|
v2f getTextureCoords(v2u32 texture_size, int frame) const;
|
||||||
};
|
};
|
||||||
|
@ -19,15 +19,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#ifndef TOUCHSCREENGUI_HEADER
|
#ifndef TOUCHSCREENGUI_HEADER
|
||||||
#define TOUCHSCREENGUI_HEADER
|
#define TOUCHSCREENGUI_HEADER
|
||||||
|
|
||||||
#include <IGUIEnvironment.h>
|
|
||||||
#include <IGUIButton.h>
|
|
||||||
#include <IEventReceiver.h>
|
#include <IEventReceiver.h>
|
||||||
|
#include <IGUIButton.h>
|
||||||
|
#include <IGUIEnvironment.h>
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "game.h"
|
|
||||||
#include "client/tile.h"
|
#include "client/tile.h"
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
using namespace irr::core;
|
using namespace irr::core;
|
||||||
@ -68,32 +68,32 @@ typedef enum {
|
|||||||
#define SETTINGS_BAR_Y_OFFSET 6.5
|
#define SETTINGS_BAR_Y_OFFSET 6.5
|
||||||
#define RARE_CONTROLS_BAR_Y_OFFSET 4
|
#define RARE_CONTROLS_BAR_Y_OFFSET 4
|
||||||
|
|
||||||
extern const char** touchgui_button_imagenames;
|
extern const char **touchgui_button_imagenames;
|
||||||
|
|
||||||
struct button_info {
|
struct button_info
|
||||||
float repeatcounter;
|
{
|
||||||
float repeatdelay;
|
float repeatcounter;
|
||||||
irr::EKEY_CODE keycode;
|
float repeatdelay;
|
||||||
|
irr::EKEY_CODE keycode;
|
||||||
std::vector<int> ids;
|
std::vector<int> ids;
|
||||||
IGUIButton* guibutton = NULL;
|
IGUIButton *guibutton = NULL;
|
||||||
bool immediate_release;
|
bool immediate_release;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoHideButtonBar
|
class AutoHideButtonBar
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
AutoHideButtonBar(IrrlichtDevice *device, IEventReceiver *receiver);
|
||||||
|
|
||||||
AutoHideButtonBar( IrrlichtDevice *device, IEventReceiver* receiver );
|
void init(ISimpleTextureSource *tsrc, const char *starter_img, int button_id,
|
||||||
|
v2s32 UpperLeft, v2s32 LowerRight, autohide_button_bar_dir dir,
|
||||||
void init(ISimpleTextureSource* tsrc, const char* starter_img,
|
float timeout);
|
||||||
int button_id, v2s32 UpperLeft, v2s32 LowerRight,
|
|
||||||
autohide_button_bar_dir dir, float timeout);
|
|
||||||
|
|
||||||
~AutoHideButtonBar();
|
~AutoHideButtonBar();
|
||||||
|
|
||||||
/* add button to be shown */
|
/* add button to be shown */
|
||||||
void addButton(touch_gui_button_id id, const wchar_t* caption,
|
void addButton(touch_gui_button_id id, const wchar_t *caption,
|
||||||
const char* btn_image);
|
const char *btn_image);
|
||||||
|
|
||||||
/* detect settings bar button events */
|
/* detect settings bar button events */
|
||||||
bool isButton(const SEvent &event);
|
bool isButton(const SEvent &event);
|
||||||
@ -114,40 +114,41 @@ public:
|
|||||||
void show();
|
void show();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ISimpleTextureSource* m_texturesource;
|
ISimpleTextureSource *m_texturesource;
|
||||||
irr::video::IVideoDriver* m_driver;
|
irr::video::IVideoDriver *m_driver;
|
||||||
IGUIEnvironment* m_guienv;
|
IGUIEnvironment *m_guienv;
|
||||||
IEventReceiver* m_receiver;
|
IEventReceiver *m_receiver;
|
||||||
v2u32 m_screensize;
|
v2u32 m_screensize;
|
||||||
button_info m_starter;
|
button_info m_starter;
|
||||||
std::vector<button_info*> m_buttons;
|
std::vector<button_info *> m_buttons;
|
||||||
|
|
||||||
v2s32 m_upper_left;
|
v2s32 m_upper_left;
|
||||||
v2s32 m_lower_right;
|
v2s32 m_lower_right;
|
||||||
|
|
||||||
/* show settings bar */
|
/* show settings bar */
|
||||||
bool m_active;
|
bool m_active;
|
||||||
|
|
||||||
bool m_visible;
|
bool m_visible;
|
||||||
|
|
||||||
/* settings bar timeout */
|
/* settings bar timeout */
|
||||||
float m_timeout;
|
float m_timeout;
|
||||||
float m_timeout_value;
|
float m_timeout_value;
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
autohide_button_bar_dir m_dir;
|
autohide_button_bar_dir m_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TouchScreenGUI
|
class TouchScreenGUI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TouchScreenGUI(IrrlichtDevice *device, IEventReceiver* receiver);
|
TouchScreenGUI(IrrlichtDevice *device, IEventReceiver *receiver);
|
||||||
~TouchScreenGUI();
|
~TouchScreenGUI();
|
||||||
|
|
||||||
void translateEvent(const SEvent &event);
|
void translateEvent(const SEvent &event);
|
||||||
|
|
||||||
void init(ISimpleTextureSource* tsrc);
|
void init(ISimpleTextureSource *tsrc);
|
||||||
|
|
||||||
double getYawChange() {
|
double getYawChange()
|
||||||
|
{
|
||||||
double res = m_camera_yaw_change;
|
double res = m_camera_yaw_change;
|
||||||
m_camera_yaw_change = 0;
|
m_camera_yaw_change = 0;
|
||||||
return res;
|
return res;
|
||||||
@ -166,28 +167,28 @@ public:
|
|||||||
void show();
|
void show();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IrrlichtDevice* m_device;
|
IrrlichtDevice *m_device;
|
||||||
IGUIEnvironment* m_guienv;
|
IGUIEnvironment *m_guienv;
|
||||||
IEventReceiver* m_receiver;
|
IEventReceiver *m_receiver;
|
||||||
ISimpleTextureSource* m_texturesource;
|
ISimpleTextureSource *m_texturesource;
|
||||||
v2u32 m_screensize;
|
v2u32 m_screensize;
|
||||||
std::map<int,rect<s32> > m_hud_rects;
|
std::map<int, rect<s32>> m_hud_rects;
|
||||||
std::map<int,irr::EKEY_CODE> m_hud_ids;
|
std::map<int, irr::EKEY_CODE> m_hud_ids;
|
||||||
bool m_visible; // is the gui visible
|
bool m_visible; // is the gui visible
|
||||||
|
|
||||||
/* value in degree */
|
/* value in degree */
|
||||||
double m_camera_yaw_change;
|
double m_camera_yaw_change;
|
||||||
double m_camera_pitch;
|
double m_camera_pitch;
|
||||||
|
|
||||||
line3d<f32> m_shootline;
|
line3d<f32> m_shootline;
|
||||||
|
|
||||||
rect<s32> m_control_pad_rect;
|
rect<s32> m_control_pad_rect;
|
||||||
|
|
||||||
int m_move_id;
|
int m_move_id;
|
||||||
bool m_move_has_really_moved;
|
bool m_move_has_really_moved;
|
||||||
s32 m_move_downtime;
|
s32 m_move_downtime;
|
||||||
bool m_move_sent_as_mouse_event;
|
bool m_move_sent_as_mouse_event;
|
||||||
v2s32 m_move_downlocation;
|
v2s32 m_move_downlocation;
|
||||||
|
|
||||||
button_info m_buttons[after_last_element_id];
|
button_info m_buttons[after_last_element_id];
|
||||||
|
|
||||||
@ -206,9 +207,10 @@ private:
|
|||||||
float repeat_delay = BUTTON_REPEAT_DELAY);
|
float repeat_delay = BUTTON_REPEAT_DELAY);
|
||||||
|
|
||||||
/* load texture */
|
/* load texture */
|
||||||
void loadButtonTexture(button_info* btn, const char* path, rect<s32> button_rect);
|
void loadButtonTexture(button_info *btn, const char *path, rect<s32> button_rect);
|
||||||
|
|
||||||
struct id_status{
|
struct id_status
|
||||||
|
{
|
||||||
int id;
|
int id;
|
||||||
int X;
|
int X;
|
||||||
int Y;
|
int Y;
|
||||||
@ -236,7 +238,8 @@ private:
|
|||||||
int getGuiButtonSize();
|
int getGuiButtonSize();
|
||||||
|
|
||||||
/* doubleclick detection variables */
|
/* doubleclick detection variables */
|
||||||
struct key_event {
|
struct key_event
|
||||||
|
{
|
||||||
unsigned int down_time;
|
unsigned int down_time;
|
||||||
s32 x;
|
s32 x;
|
||||||
s32 y;
|
s32 y;
|
||||||
|
@ -29,15 +29,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_UNORDERED_CONTAINERS
|
#ifdef USE_UNORDERED_CONTAINERS
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#define UNORDERED_MAP std::unordered_map
|
#define UNORDERED_MAP std::unordered_map
|
||||||
#define UNORDERED_SET std::unordered_set
|
#define UNORDERED_SET std::unordered_set
|
||||||
#else
|
#else
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#define UNORDERED_MAP std::map
|
#define UNORDERED_MAP std::map
|
||||||
#define UNORDERED_SET std::set
|
#define UNORDERED_SET std::set
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -248,7 +248,6 @@ src/script/cpp_api/s_async.h
|
|||||||
src/script/cpp_api/s_base.cpp
|
src/script/cpp_api/s_base.cpp
|
||||||
src/script/cpp_api/s_base.h
|
src/script/cpp_api/s_base.h
|
||||||
src/script/cpp_api/s_client.cpp
|
src/script/cpp_api/s_client.cpp
|
||||||
src/script/cpp_api/s_client.h
|
|
||||||
src/script/cpp_api/s_entity.cpp
|
src/script/cpp_api/s_entity.cpp
|
||||||
src/script/cpp_api/s_entity.h
|
src/script/cpp_api/s_entity.h
|
||||||
src/script/cpp_api/s_env.cpp
|
src/script/cpp_api/s_env.cpp
|
||||||
@ -265,13 +264,11 @@ src/script/cpp_api/s_node.h
|
|||||||
src/script/cpp_api/s_nodemeta.cpp
|
src/script/cpp_api/s_nodemeta.cpp
|
||||||
src/script/cpp_api/s_nodemeta.h
|
src/script/cpp_api/s_nodemeta.h
|
||||||
src/script/cpp_api/s_player.cpp
|
src/script/cpp_api/s_player.cpp
|
||||||
src/script/cpp_api/s_player.h
|
|
||||||
src/script/cpp_api/s_security.cpp
|
src/script/cpp_api/s_security.cpp
|
||||||
src/script/cpp_api/s_security.h
|
src/script/cpp_api/s_security.h
|
||||||
src/script/cpp_api/s_server.cpp
|
src/script/cpp_api/s_server.cpp
|
||||||
src/script/cpp_api/s_server.h
|
src/script/cpp_api/s_server.h
|
||||||
src/script/lua_api/l_areastore.cpp
|
src/script/lua_api/l_areastore.cpp
|
||||||
src/script/lua_api/l_areastore.h
|
|
||||||
src/script/lua_api/l_base.cpp
|
src/script/lua_api/l_base.cpp
|
||||||
src/script/lua_api/l_base.h
|
src/script/lua_api/l_base.h
|
||||||
src/script/lua_api/l_craft.cpp
|
src/script/lua_api/l_craft.cpp
|
||||||
@ -291,15 +288,11 @@ src/script/lua_api/l_mainmenu.cpp
|
|||||||
src/script/lua_api/l_mainmenu.h
|
src/script/lua_api/l_mainmenu.h
|
||||||
src/script/lua_api/l_mapgen.cpp
|
src/script/lua_api/l_mapgen.cpp
|
||||||
src/script/lua_api/l_metadata.cpp
|
src/script/lua_api/l_metadata.cpp
|
||||||
src/script/lua_api/l_metadata.h
|
|
||||||
src/script/lua_api/l_minimap.cpp
|
src/script/lua_api/l_minimap.cpp
|
||||||
src/script/lua_api/l_minimap.h
|
|
||||||
src/script/lua_api/l_nodemeta.cpp
|
src/script/lua_api/l_nodemeta.cpp
|
||||||
src/script/lua_api/l_nodemeta.h
|
src/script/lua_api/l_nodemeta.h
|
||||||
src/script/lua_api/l_nodetimer.cpp
|
src/script/lua_api/l_nodetimer.cpp
|
||||||
src/script/lua_api/l_nodetimer.h
|
|
||||||
src/script/lua_api/l_noise.cpp
|
src/script/lua_api/l_noise.cpp
|
||||||
src/script/lua_api/l_noise.h
|
|
||||||
src/script/lua_api/l_object.cpp
|
src/script/lua_api/l_object.cpp
|
||||||
src/script/lua_api/l_object.h
|
src/script/lua_api/l_object.h
|
||||||
src/script/lua_api/l_particles.cpp
|
src/script/lua_api/l_particles.cpp
|
||||||
@ -307,9 +300,7 @@ src/script/lua_api/l_particles.h
|
|||||||
src/script/lua_api/l_rollback.cpp
|
src/script/lua_api/l_rollback.cpp
|
||||||
src/script/lua_api/l_rollback.h
|
src/script/lua_api/l_rollback.h
|
||||||
src/script/lua_api/l_server.cpp
|
src/script/lua_api/l_server.cpp
|
||||||
src/script/lua_api/l_server.h
|
|
||||||
src/script/lua_api/l_settings.cpp
|
src/script/lua_api/l_settings.cpp
|
||||||
src/script/lua_api/l_settings.h
|
|
||||||
src/script/lua_api/l_sound.cpp
|
src/script/lua_api/l_sound.cpp
|
||||||
src/script/lua_api/l_storage.cpp
|
src/script/lua_api/l_storage.cpp
|
||||||
src/script/lua_api/l_util.cpp
|
src/script/lua_api/l_util.cpp
|
||||||
@ -347,21 +338,17 @@ src/terminal_chat_console.cpp
|
|||||||
src/terminal_chat_console.h
|
src/terminal_chat_console.h
|
||||||
src/threading/atomic.h
|
src/threading/atomic.h
|
||||||
src/threading/event.cpp
|
src/threading/event.cpp
|
||||||
src/threading/event.h
|
|
||||||
src/threading/mutex_auto_lock.h
|
src/threading/mutex_auto_lock.h
|
||||||
src/threading/mutex.cpp
|
src/threading/mutex.cpp
|
||||||
src/threading/mutex.h
|
src/threading/mutex.h
|
||||||
src/threading/semaphore.cpp
|
src/threading/semaphore.cpp
|
||||||
src/threading/semaphore.h
|
|
||||||
src/threading/thread.cpp
|
src/threading/thread.cpp
|
||||||
src/threading/thread.h
|
src/threading/thread.h
|
||||||
src/threads.h
|
src/threads.h
|
||||||
src/tileanimation.cpp
|
src/tileanimation.cpp
|
||||||
src/tileanimation.h
|
|
||||||
src/tool.cpp
|
src/tool.cpp
|
||||||
src/tool.h
|
src/tool.h
|
||||||
src/touchscreengui.cpp
|
src/touchscreengui.cpp
|
||||||
src/touchscreengui.h
|
|
||||||
src/treegen.cpp
|
src/treegen.cpp
|
||||||
src/treegen.h
|
src/treegen.h
|
||||||
src/unittest/test_areastore.cpp
|
src/unittest/test_areastore.cpp
|
||||||
@ -398,7 +385,6 @@ src/util/base64.cpp
|
|||||||
src/util/base64.h
|
src/util/base64.h
|
||||||
src/util/basic_macros.h
|
src/util/basic_macros.h
|
||||||
src/util/container.h
|
src/util/container.h
|
||||||
src/util/cpp11_container.h
|
|
||||||
src/util/directiontables.cpp
|
src/util/directiontables.cpp
|
||||||
src/util/directiontables.h
|
src/util/directiontables.h
|
||||||
src/util/enriched_string.cpp
|
src/util/enriched_string.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user