Skip to content

Commit fb6bf21

Browse files
committed
mostly GUI improvements
1 parent 2f7ca77 commit fb6bf21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1169
-1621
lines changed

sources/Core/Data/Data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,4 @@ class enum_array : public std::array<T, N> {
477477
const T & operator[] (E e) const {
478478
return std::array<T, N>::operator[]((std::size_t)e);
479479
}
480-
};
480+
};

sources/Core/Log/Events.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,11 @@ namespace Events
116116
std::shared_ptr<prop_t_helper<T>> helper(new prop_t_helper<T>());
117117
helper->func = func;
118118
helper->runner = dynamic_cast<Runner*>(owner);
119-
120-
// auto f = std::make_shared<std::function<void(T)>>(func);
121-
// handlers.push_back(f);
122119
auto h = helper.get();
123120
helper->remove_func = [this, h]()
124121
{
125122
std::lock_guard<std::mutex> g(m);
126-
127123
i_helpers.erase(std::find(i_helpers.begin(), i_helpers.end(), h));
128-
// handlers.erase(std::find(handlers.begin(), handlers.end(), f));
129124
};
130125
i_helpers.emplace_back(h);
131126
owner->helpers.push_back(helper);
@@ -330,30 +325,3 @@ namespace Events
330325

331326
}
332327

333-
template<class T>
334-
class Variable
335-
{
336-
T value;
337-
std::string name;
338-
public:
339-
340-
Variable(const T &def, std::string name) :value(def), name(name)
341-
{
342-
343-
}
344-
345-
operator T() const
346-
{
347-
return value;
348-
}
349-
const T operator=(const T& r)
350-
{
351-
352-
return value = r;
353-
}
354-
355-
std::string get_name()
356-
{
357-
return name;
358-
}
359-
};

sources/Core/Threads/Threading.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ void SetThreadName(std::thread* thread, const char* threadName)
3030
DWORD threadId = ::GetThreadId(static_cast<HANDLE>(thread->native_handle()));
3131
SetThreadName(threadId, threadName);
3232
}
33+
34+
thread_local ThreadType ThreadScope::thread_type = ThreadType::NONE;

sources/Core/Threads/Threading.h

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,45 @@ namespace Thread
6767
using guard = thread_tester;
6868
using mutex = std::atomic<std::thread::id>;
6969
};
70-
}
70+
}
71+
72+
73+
enum class ThreadType: int
74+
{
75+
NONE,
76+
GRAPHICS,
77+
GUI
78+
};
79+
80+
81+
struct ThreadScope
82+
{
83+
thread_local static ThreadType thread_type;
84+
85+
ThreadType prev_type;
86+
ThreadScope(ThreadType type)
87+
{
88+
prev_type = thread_type;
89+
thread_type = type;
90+
91+
}
92+
93+
virtual ~ThreadScope()
94+
{
95+
thread_type = prev_type;
96+
}
97+
98+
static void check_type(ThreadType type)
99+
{
100+
assert(thread_type == type);
101+
}
102+
};
103+
104+
#ifdef DEV
105+
#define THREAD_SCOPE(x) volatile ThreadScope UNIQUE_NAME(ThreadType::x);
106+
#define CHECK_THREAD(x) {ThreadScope::check_type(ThreadType::x);};
107+
#else
108+
#define THREAD_SCOPE(x) ;
109+
#define CHECK_THREAD(x) ;
110+
#endif
111+

0 commit comments

Comments
 (0)