mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-04 19:36:43 +03:00
* * Undo some of the changes done in the "* Work on survival mode." commit. * TEST_SURVIVAL_MODE is now on by default. * * Dying no longer crashes the game. * * Death seems to work ok. * * Improve some of the damage code. * x * work * Fixed the Makefile (#54) * * Finally fix the crack texture appearing to flicker/restart * * Add VS2010 as an optional target. Fix build with VS2010 (both windows_vs and xenon_vs). * * Disable survival mode. Getting ready to merge now! --------- Co-authored-by: Alexander Argentakis <38327951+MFDGaming@users.noreply.github.com>
79 lines
1.4 KiB
C++
79 lines
1.4 KiB
C++
/********************************************************************
|
|
Minecraft: Pocket Edition - Decompilation Project
|
|
Copyright (C) 2023 iProgramInCpp
|
|
|
|
The following code is licensed under the BSD 1 clause license.
|
|
SPDX-License-Identifier: BSD-1-Clause
|
|
********************************************************************/
|
|
|
|
#pragma once
|
|
|
|
// CThread - Object oriented pthread wrapper
|
|
|
|
#if defined(_WIN32)
|
|
|
|
#if defined(_XBOX) || defined(USE_OLD_CPP)
|
|
// USE_WIN32_THREADS - Use a Win32 implementation of threads instead of using pthread
|
|
#define USE_WIN32_THREADS
|
|
#else
|
|
// USE_CPP11_THREADS - Use a C++11 implementation of threads instead of using pthread
|
|
#define USE_CPP11_THREADS
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define USE_PTHREADS
|
|
|
|
#endif
|
|
|
|
#ifdef USE_CPP11_THREADS
|
|
// C++11
|
|
#include <thread>
|
|
|
|
#elif defined(USE_WIN32_THREADS)
|
|
|
|
// win32
|
|
#include <stdint.h>
|
|
|
|
#ifdef _XBOX
|
|
#include <xtl.h>
|
|
#else
|
|
#define WIN32_LEAN_AND_MEAN
|
|
#include <Windows.h>
|
|
#endif
|
|
|
|
#else
|
|
|
|
// pthreads
|
|
#include <pthread.h>
|
|
|
|
#endif
|
|
|
|
#ifdef USE_WIN32_THREADS
|
|
typedef LPTHREAD_START_ROUTINE CThreadFunction;
|
|
#else
|
|
typedef void* (*CThreadFunction)(void*);
|
|
#endif
|
|
|
|
class CThread
|
|
{
|
|
public:
|
|
CThread(CThreadFunction, void* param);
|
|
~CThread();
|
|
|
|
static void sleep(uint32_t ms);
|
|
|
|
private:
|
|
CThreadFunction m_func;
|
|
|
|
#ifdef USE_CPP11_THREADS
|
|
std::thread m_thrd;
|
|
#elif defined (USE_WIN32_THREADS)
|
|
HANDLE m_thrd;
|
|
#else
|
|
pthread_t m_thrd;
|
|
pthread_attr_t m_thrd_attr;
|
|
#endif
|
|
};
|
|
|