aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Utils')
-rw-r--r--src/libjin/Utils/CSV/CSV.cpp0
-rw-r--r--src/libjin/Utils/CSV/CSV.h1
-rw-r--r--src/libjin/Utils/Component/Component.h30
-rw-r--r--src/libjin/Utils/Component/GameObject.h40
-rw-r--r--src/libjin/Utils/EventMsgCenter/EventMsgCenter.h20
-rw-r--r--src/libjin/Utils/EventMsgCenter/Events.h20
-rw-r--r--src/libjin/Utils/Json/Json.cpp0
-rw-r--r--src/libjin/Utils/Json/Json.h1
-rw-r--r--src/libjin/Utils/Proxy/lock.h4
-rw-r--r--src/libjin/Utils/XML/XML.cpp0
-rw-r--r--src/libjin/Utils/XML/XML.h1
-rw-r--r--src/libjin/Utils/je_endian.h (renamed from src/libjin/Utils/endian.h)14
-rw-r--r--src/libjin/Utils/je_log.cpp (renamed from src/libjin/Utils/Log.cpp)2
-rw-r--r--src/libjin/Utils/je_log.h (renamed from src/libjin/Utils/Log.h)7
-rw-r--r--src/libjin/Utils/je_macros.h17
-rw-r--r--src/libjin/Utils/je_unittest.cpp (renamed from src/libjin/Utils/unittest.cpp)4
-rw-r--r--src/libjin/Utils/je_utils.h9
-rw-r--r--src/libjin/Utils/log.h134
-rw-r--r--src/libjin/Utils/macros.h17
-rw-r--r--src/libjin/Utils/utils.h9
20 files changed, 38 insertions, 292 deletions
diff --git a/src/libjin/Utils/CSV/CSV.cpp b/src/libjin/Utils/CSV/CSV.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/libjin/Utils/CSV/CSV.cpp
+++ /dev/null
diff --git a/src/libjin/Utils/CSV/CSV.h b/src/libjin/Utils/CSV/CSV.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/libjin/Utils/CSV/CSV.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/libjin/Utils/Component/Component.h b/src/libjin/Utils/Component/Component.h
deleted file mode 100644
index f63fb59..0000000
--- a/src/libjin/Utils/Component/Component.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __JIN_TOOLS_COMPONENT_H
-#define __JIN_TOOLS_COMPONENT_H
-#include "../../modules.h"
-#if JIN_MODULES_TOOLS && JIN_TOOLS_COMPONENT
-
-namespace jin
-{
-namespace utils
-{
-
- class GameObject;
-
- class Component
- {
- public:
- Component(GameObject* obj)
- : gameObject(obj)
- {}
-
- virtual void update(float dt) = 0;
-
- private:
- GameObject* gameObject;
- };
-
-} // tools
-} // jin
-
-#endif // JIN_MODULES_TOOLS && JIN_TOOLS_COMPONENT
-#endif // __JIN_TOOLS_COMPONENT_H \ No newline at end of file
diff --git a/src/libjin/Utils/Component/GameObject.h b/src/libjin/Utils/Component/GameObject.h
deleted file mode 100644
index e4f3aa5..0000000
--- a/src/libjin/Utils/Component/GameObject.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef __JIN_TOOLS_GAMEOBJECT_H
-#define __JIN_TOOLS_GAMEOBJECT_H
-#include "../../modules.h"
-#if JIN_MODULES_TOOLS && JIN_TOOLS_COMPONENT
-
-#include <vector>
-#include "Component.h"
-
-namespace jin
-{
-namespace utils
-{
-
- class GameObject
- {
- public:
-
- GameObject()
- : components()
- {
- }
-
- virtual void update(float dt)
- {
- for each (Component* component in components)
- component->update(dt);
- }
-
- virtual void draw() = 0;
-
- protected:
-
- std::vector<Component*> components;
- };
-
-} // tools
-} // jin
-
-#endif // JIN_MODULES_TOOLS && JIN_TOOLS_COMPONENT
-#endif // __JIN_TOOLS_GAMEOBJECT_H \ No newline at end of file
diff --git a/src/libjin/Utils/EventMsgCenter/EventMsgCenter.h b/src/libjin/Utils/EventMsgCenter/EventMsgCenter.h
deleted file mode 100644
index 6717b83..0000000
--- a/src/libjin/Utils/EventMsgCenter/EventMsgCenter.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __JIN_TOOLS_EVENTMSGCENTER_H
-#define __JIN_TOOLS_EVENTMSGCENTER_H
-#include "../../modules.h"
-#if JIN_MODULES_TOOLS && JIN_TOOLS_EVENTMSGCENTER
-
-namespace jin
-{
-namespace utils
-{
-
- class EventMSGCenter
- {
-
- };
-
-} // tools
-} // jin
-
-#endif // JIN_MODULES_TOOLS && JIN_TOOLS_EVENTMSGCENTER
-#endif // __JIN_TOOLS_EVENTMSGCENTER_H \ No newline at end of file
diff --git a/src/libjin/Utils/EventMsgCenter/Events.h b/src/libjin/Utils/EventMsgCenter/Events.h
deleted file mode 100644
index 9ebc30d..0000000
--- a/src/libjin/Utils/EventMsgCenter/Events.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __JIN_TOOLS_EVENTS_H
-#define __JIN_TOOLS_EVENTS_H
-#include "../../modules.h"
-#if JIN_MODULES_TOOLS && JIN_TOOLS_EVENTMSGCENTER
-
-namespace jin
-{
-namespace utils
-{
-
- enum Event
- {
-
- };
-
-} // tools
-} // jin
-
-#endif // JIN_MODULES_TOOLS && JIN_TOOLS_EVENTMSGCENTER
-#endif // __JIN_TOOLS_EVENTS_H \ No newline at end of file
diff --git a/src/libjin/Utils/Json/Json.cpp b/src/libjin/Utils/Json/Json.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/libjin/Utils/Json/Json.cpp
+++ /dev/null
diff --git a/src/libjin/Utils/Json/Json.h b/src/libjin/Utils/Json/Json.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/libjin/Utils/Json/Json.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/libjin/Utils/Proxy/lock.h b/src/libjin/Utils/Proxy/lock.h
deleted file mode 100644
index 29194a1..0000000
--- a/src/libjin/Utils/Proxy/lock.h
+++ /dev/null
@@ -1,4 +0,0 @@
-class Lock
-{
-
-}; \ No newline at end of file
diff --git a/src/libjin/Utils/XML/XML.cpp b/src/libjin/Utils/XML/XML.cpp
deleted file mode 100644
index e69de29..0000000
--- a/src/libjin/Utils/XML/XML.cpp
+++ /dev/null
diff --git a/src/libjin/Utils/XML/XML.h b/src/libjin/Utils/XML/XML.h
deleted file mode 100644
index 6f70f09..0000000
--- a/src/libjin/Utils/XML/XML.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once
diff --git a/src/libjin/Utils/endian.h b/src/libjin/Utils/je_endian.h
index d4c441a..db8c8fd 100644
--- a/src/libjin/Utils/endian.h
+++ b/src/libjin/Utils/je_endian.h
@@ -1,23 +1,23 @@
-#ifndef JIN_LIL_ENDIAN && JIN_BIG_ENDIAN
+#ifndef jin_endian_lil && jin_endian_big
-#define JIN_LIL_ENDIAN 2
-#define JIN_BIG_ENDIAN 4
+#define jin_endian_lil 2
+#define jin_endian_big 4
#endif
-#ifndef JIN_BYTEORDER
+#ifndef jin_byte_order
#ifdef __linux__
#include <endian.h>
-#define JIN_BYTEORDER __BYTE_ORDER
+#define jin_byte_order __BYTE_ORDER
#else /* __linux__ */
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
defined(__sparc__)
-#define JIN_BYTEORDER JIN_BIG_ENDIAN
+#define jin_byte_order jin_endian_big
#else
-#define JIN_BYTEORDER JIN_LIL_ENDIAN
+#define jin_byte_order jin_endian_lil
#endif
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */ \ No newline at end of file
diff --git a/src/libjin/Utils/Log.cpp b/src/libjin/Utils/je_log.cpp
index 5299942..2bcb25a 100644
--- a/src/libjin/Utils/Log.cpp
+++ b/src/libjin/Utils/je_log.cpp
@@ -1,2 +1,2 @@
#define LOGHELPER_IMPLEMENT
-#include "log.h" \ No newline at end of file
+#include "je_log.h" \ No newline at end of file
diff --git a/src/libjin/Utils/Log.h b/src/libjin/Utils/je_log.h
index e4ed879..928a009 100644
--- a/src/libjin/Utils/Log.h
+++ b/src/libjin/Utils/je_log.h
@@ -1,9 +1,6 @@
-/**
-* Single.h/loghelper.h
-* Copyright (C) 2017~2018 chai
-*/
#ifndef __LOG_HELPER_H
#define __LOG_HELPER_H
+
#include <string>
#include <iostream>
#include <fstream>
@@ -131,4 +128,4 @@ void Loghelper::close()
#endif
-#endif
+#endif \ No newline at end of file
diff --git a/src/libjin/Utils/je_macros.h b/src/libjin/Utils/je_macros.h
new file mode 100644
index 0000000..475a482
--- /dev/null
+++ b/src/libjin/Utils/je_macros.h
@@ -0,0 +1,17 @@
+#ifndef __JE_MACROS_H
+#define __JE_MACROS_H
+#include <cstring>
+
+//#define implement // ʵֽӿ
+//
+//#define shared // ķ
+//
+//#define MASK // enum
+//
+//#define onlyonce // ֻһ
+//#define CALLONCE(call) static char __dummy__=(call, 1) // ֻһ
+//#define SAFECALL(func, params) if(func) func(params)
+//
+//#define zero(mem) memset(&mem, 0, sizeof(mem))
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Utils/unittest.cpp b/src/libjin/Utils/je_unittest.cpp
index 44f1ae5..294351b 100644
--- a/src/libjin/Utils/unittest.cpp
+++ b/src/libjin/Utils/je_unittest.cpp
@@ -1,4 +1,4 @@
-#include "utils.h"
+#include "je_utils.h"
#if UNITTEST
#include <iostream>
@@ -7,7 +7,7 @@
#include "../audio/sdl/source.h"
#include "../audio/sdl/audio.h"
-using namespace jin::audio;
+using namespace JinEngine::audio;
using namespace std;
int main(int argc, char* argv[])
diff --git a/src/libjin/Utils/je_utils.h b/src/libjin/Utils/je_utils.h
new file mode 100644
index 0000000..21c507d
--- /dev/null
+++ b/src/libjin/Utils/je_utils.h
@@ -0,0 +1,9 @@
+#ifndef __JE_UTILS_H
+#define __JE_UTILS_H
+
+#include "je_macros.h"
+#include "je_endian.h"
+
+#define UNITTEST 0
+
+#endif \ No newline at end of file
diff --git a/src/libjin/Utils/log.h b/src/libjin/Utils/log.h
deleted file mode 100644
index e4ed879..0000000
--- a/src/libjin/Utils/log.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
-* Single.h/loghelper.h
-* Copyright (C) 2017~2018 chai
-*/
-#ifndef __LOG_HELPER_H
-#define __LOG_HELPER_H
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <stdarg.h>
-
-class Loghelper
-{
-public:
- // logĿ
- enum Direction
- {
- DIR_CERR = 1 << 1, // ׼
- DIR_FILE = 1 << 2, // logļ
- };
-
- // ȼ
- enum Level
- {
- LV_NONE = 0, // none
- LV_ERROR = 1 << 1, // error
- LV_WARN = 1 << 2, // warn
- LV_INFO = 1 << 3, // info
- LV_DEBUG = 1 << 4, // debug
- LV_ALL = 0xffffffff
- };
-
- static void log(Level _level, const char* _fmt, ...);
-
- // ض
- static void redirect(unsigned int _dir, char* _path = nullptr);
-
- // ɸѡȼ
- static void restrict(unsigned int levels);
-
- static void close();
-
-private:
- static unsigned int dir; // Ŀ
- static unsigned int levels; // ȼ
- static std::ofstream fs; // ļ
-};
-
-typedef Loghelper::Level Loglevel;
-
-#ifdef LOGHELPER_IMPLEMENT
-
-#define hasbit(flag, bit) ((flag & bit) == bit)
-
-unsigned int Loghelper::dir = Loghelper::Direction::DIR_CERR;
-unsigned int Loghelper::levels = Loghelper::Level::LV_ALL;
-std::ofstream Loghelper::fs;
-
-void Loghelper::log(Level _level, const char* _fmt, ...)
-{
- if (!hasbit(levels, _level))
- return;
-#define FORMAT_MSG_BUFFER_SIZE (204800)
- const char* levelStr = nullptr;
- switch (_level)
- {
- case LV_ERROR:
- levelStr = "[Jin Error]:";
- break;
- case LV_WARN:
- levelStr = "[Jin Warn]:";
- break;
- case LV_INFO:
- levelStr = "[Jin Info]:";
- break;
- case LV_DEBUG:
- levelStr = "[Jin Debug]:";
- break;
- default:
- levelStr = "[Jin Unknown]:";
- break;
- }
- char buffer[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 };
- strcpy(buffer, levelStr);
- va_list args;
- va_start(args, _fmt);
- vsnprintf(buffer + strlen(buffer), FORMAT_MSG_BUFFER_SIZE, _fmt, args);
- va_end(args);
- if (hasbit(dir, DIR_CERR))
- {
- std::cerr << buffer << std::endl;
- }
- if (hasbit(dir, DIR_FILE))
- {
- fs << buffer << std::endl;
- }
-#undef FORMAT_MSG_BUFFER_SIZE
-}
-
-// ض
-void Loghelper::redirect(unsigned int _dir, char* _path)
-{
- dir = _dir;
- if (hasbit(dir, DIR_FILE))
- {
- try
- {
- fs.open(_path, std::ios_base::app);
- }
- catch (std::ios_base::failure& e) {
- dir = DIR_CERR;
- log(Level::LV_WARN, "ضlog· %s ʧ", _path);
- }
- }
-}
-
-// ɸѡȼ
-void Loghelper::restrict(unsigned int _levels)
-{
- levels = _levels;
-}
-
-void Loghelper::close()
-{
- if (!fs.fail())
- fs.close();
- fs.clear();
-}
-
-#undef hasbit
-
-#endif
-
-#endif
diff --git a/src/libjin/Utils/macros.h b/src/libjin/Utils/macros.h
deleted file mode 100644
index a57cb7c..0000000
--- a/src/libjin/Utils/macros.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __JIN_MACROS_H
-#define __JIN_MACROS_H
-#include <cstring>
-
-#define implement // ʵֽӿ
-
-#define shared // ķ
-
-#define MASK // enum
-
-#define onlyonce // ֻһ
-#define CALLONCE(call) static char __dummy__=(call, 1) // ֻһ
-#define SAFECALL(func, params) if(func) func(params)
-
-#define zero(mem) memset(&mem, 0, sizeof(mem))
-
-#endif \ No newline at end of file
diff --git a/src/libjin/Utils/utils.h b/src/libjin/Utils/utils.h
deleted file mode 100644
index cf0920e..0000000
--- a/src/libjin/Utils/utils.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __JIN_UTILS_H
-#define __JIN_UTILS_H
-
-#include "macros.h"
-#include "endian.h"
-
-#define UNITTEST 0
-
-#endif \ No newline at end of file