mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
day/night working client side
This commit is contained in:
parent
240499dc2c
commit
0ca9423b8b
22 changed files with 955 additions and 676 deletions
|
@ -28,9 +28,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <jthread.h>
|
||||
#include <jmutex.h>
|
||||
#include <jmutexautolock.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define sleep_ms(x) Sleep(x)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define sleep_ms(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
#include "common_irrlicht.h"
|
||||
#include "debug.h"
|
||||
#include "strfnd.h"
|
||||
|
@ -1100,5 +1109,43 @@ private:
|
|||
JMutex m_mutex;
|
||||
};
|
||||
|
||||
class SimpleThread : public JThread
|
||||
{
|
||||
bool run;
|
||||
JMutex run_mutex;
|
||||
|
||||
public:
|
||||
|
||||
SimpleThread():
|
||||
JThread(),
|
||||
run(true)
|
||||
{
|
||||
run_mutex.Init();
|
||||
}
|
||||
|
||||
virtual ~SimpleThread()
|
||||
{}
|
||||
|
||||
virtual void * Thread() = 0;
|
||||
|
||||
bool getRun()
|
||||
{
|
||||
JMutexAutoLock lock(run_mutex);
|
||||
return run;
|
||||
}
|
||||
void setRun(bool a_run)
|
||||
{
|
||||
JMutexAutoLock lock(run_mutex);
|
||||
run = a_run;
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
setRun(false);
|
||||
while(IsRunning())
|
||||
sleep_ms(100);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue