mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-05 18:10:09 +03:00
Cleaned Up AppPlatform & Input Classes
* Cleaned up AppPlatform classes * Documented & improved Keyboard & Mouse classes * Improved input-handling code in the Windows & SDL main.cpp files
This commit is contained in:
committed by
iProgramInCpp
parent
e731fefbea
commit
d5ee7bfc08
@@ -8,80 +8,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(USE_SDL)
|
||||||
|
|
||||||
#define NOMINMAX
|
|
||||||
#ifdef _XBOX
|
|
||||||
#include <xtl.h>
|
|
||||||
#else
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <Windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
//fake keycodes for windows
|
|
||||||
AKEYCODE_UNKNOWN = 0,
|
|
||||||
|
|
||||||
AKEYCODE_MENU = VK_ESCAPE, // pause screen
|
|
||||||
AKEYCODE_SEARCH = VK_F5, // toggle third person mode
|
|
||||||
|
|
||||||
AKEYCODE_BACK = 'Y', // used to go left 1 slot
|
|
||||||
AKEYCODE_BUTTON_X = 'U', // used to go right 1 slot
|
|
||||||
AKEYCODE_BUTTON_Y = 'E', // show inventory
|
|
||||||
|
|
||||||
AKEYCODE_DPAD_UP = 'W',
|
|
||||||
AKEYCODE_DPAD_DOWN = 'S',
|
|
||||||
AKEYCODE_DPAD_LEFT = 'A',
|
|
||||||
AKEYCODE_DPAD_RIGHT = 'D',
|
|
||||||
AKEYCODE_DPAD_CENTER = ' ',
|
|
||||||
|
|
||||||
AKEYCODE_BUTTON_L1 = 'X',
|
|
||||||
AKEYCODE_BUTTON_R1 = 'C',
|
|
||||||
|
|
||||||
AKEYCODE_SHIFT_LEFT = VK_SHIFT,
|
|
||||||
AKEYCODE_SHIFT_RIGHT = VK_SHIFT,
|
|
||||||
|
|
||||||
AKEYCODE_DEL = VK_BACK,
|
|
||||||
AKEYCODE_FORWARD_DEL = VK_DELETE,
|
|
||||||
|
|
||||||
AKEYCODE_COMMA = VK_OEM_COMMA, // ',<'
|
|
||||||
AKEYCODE_PERIOD = VK_OEM_PERIOD,// '.>'
|
|
||||||
AKEYCODE_PLUS = VK_OEM_PLUS, // '=+'
|
|
||||||
AKEYCODE_MINUS = VK_OEM_MINUS, // '-_'
|
|
||||||
AKEYCODE_SEMICOLON = VK_OEM_1, // ';:'
|
|
||||||
AKEYCODE_SLASH = VK_OEM_2, // '/?'
|
|
||||||
AKEYCODE_GRAVE = VK_OEM_3, // '`~'
|
|
||||||
AKEYCODE_LEFT_BRACKET=VK_OEM_4, // '[{'
|
|
||||||
AKEYCODE_BACKSLASH = VK_OEM_5, // '\|'
|
|
||||||
AKEYCODE_RIGHT_BRACKET=VK_OEM_6,// ']}'
|
|
||||||
AKEYCODE_APOSTROPHE = VK_OEM_7, // ''"'
|
|
||||||
AKEYCODE_SPACE = VK_SPACE,
|
|
||||||
|
|
||||||
AKEYCODE_F3 = VK_F3,
|
|
||||||
AKEYCODE_F4 = VK_F4,
|
|
||||||
|
|
||||||
AKEYCODE_0 = '0',
|
|
||||||
AKEYCODE_1 = '1',
|
|
||||||
//...
|
|
||||||
AKEYCODE_9 = '9',
|
|
||||||
|
|
||||||
AKEYCODE_ENTER = VK_RETURN,
|
|
||||||
|
|
||||||
// note: You have to add these here instead of using the
|
|
||||||
// characters themselves, otherwise android won't pick it up
|
|
||||||
AKEYCODE_A = 'A',
|
|
||||||
AKEYCODE_Q = 'Q',
|
|
||||||
AKEYCODE_T = 'T',
|
|
||||||
AKEYCODE_Z = 'Z',
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// this sucks
|
|
||||||
#define AKEYCODE_ARROW_LEFT VK_LEFT
|
|
||||||
#define AKEYCODE_ARROW_RIGHT VK_RIGHT
|
|
||||||
|
|
||||||
#elif defined(USE_SDL)
|
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
@@ -188,6 +115,79 @@ static inline int translate_sdl_key_to_mcpe(int key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
|
||||||
|
#define NOMINMAX
|
||||||
|
#ifdef _XBOX
|
||||||
|
#include <xtl.h>
|
||||||
|
#else
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
//fake keycodes for windows
|
||||||
|
AKEYCODE_UNKNOWN = 0,
|
||||||
|
|
||||||
|
AKEYCODE_MENU = VK_ESCAPE, // pause screen
|
||||||
|
AKEYCODE_SEARCH = VK_F5, // toggle third person mode
|
||||||
|
|
||||||
|
AKEYCODE_BACK = 'Y', // used to go left 1 slot
|
||||||
|
AKEYCODE_BUTTON_X = 'U', // used to go right 1 slot
|
||||||
|
AKEYCODE_BUTTON_Y = 'E', // show inventory
|
||||||
|
|
||||||
|
AKEYCODE_DPAD_UP = 'W',
|
||||||
|
AKEYCODE_DPAD_DOWN = 'S',
|
||||||
|
AKEYCODE_DPAD_LEFT = 'A',
|
||||||
|
AKEYCODE_DPAD_RIGHT = 'D',
|
||||||
|
AKEYCODE_DPAD_CENTER = ' ',
|
||||||
|
|
||||||
|
AKEYCODE_BUTTON_L1 = 'X',
|
||||||
|
AKEYCODE_BUTTON_R1 = 'C',
|
||||||
|
|
||||||
|
AKEYCODE_SHIFT_LEFT = VK_SHIFT,
|
||||||
|
AKEYCODE_SHIFT_RIGHT = VK_SHIFT,
|
||||||
|
|
||||||
|
AKEYCODE_DEL = VK_BACK,
|
||||||
|
AKEYCODE_FORWARD_DEL = VK_DELETE,
|
||||||
|
|
||||||
|
AKEYCODE_COMMA = VK_OEM_COMMA, // ',<'
|
||||||
|
AKEYCODE_PERIOD = VK_OEM_PERIOD,// '.>'
|
||||||
|
AKEYCODE_PLUS = VK_OEM_PLUS, // '=+'
|
||||||
|
AKEYCODE_MINUS = VK_OEM_MINUS, // '-_'
|
||||||
|
AKEYCODE_SEMICOLON = VK_OEM_1, // ';:'
|
||||||
|
AKEYCODE_SLASH = VK_OEM_2, // '/?'
|
||||||
|
AKEYCODE_GRAVE = VK_OEM_3, // '`~'
|
||||||
|
AKEYCODE_LEFT_BRACKET = VK_OEM_4, // '[{'
|
||||||
|
AKEYCODE_BACKSLASH = VK_OEM_5, // '\|'
|
||||||
|
AKEYCODE_RIGHT_BRACKET = VK_OEM_6,// ']}'
|
||||||
|
AKEYCODE_APOSTROPHE = VK_OEM_7, // ''"'
|
||||||
|
AKEYCODE_SPACE = VK_SPACE,
|
||||||
|
|
||||||
|
AKEYCODE_F3 = VK_F3,
|
||||||
|
AKEYCODE_F4 = VK_F4,
|
||||||
|
|
||||||
|
AKEYCODE_0 = '0',
|
||||||
|
AKEYCODE_1 = '1',
|
||||||
|
//...
|
||||||
|
AKEYCODE_9 = '9',
|
||||||
|
|
||||||
|
AKEYCODE_ENTER = VK_RETURN,
|
||||||
|
|
||||||
|
// note: You have to add these here instead of using the
|
||||||
|
// characters themselves, otherwise android won't pick it up
|
||||||
|
AKEYCODE_A = 'A',
|
||||||
|
AKEYCODE_Q = 'Q',
|
||||||
|
AKEYCODE_T = 'T',
|
||||||
|
AKEYCODE_Z = 'Z',
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// this sucks
|
||||||
|
#define AKEYCODE_ARROW_LEFT VK_LEFT
|
||||||
|
#define AKEYCODE_ARROW_RIGHT VK_RIGHT
|
||||||
|
|
||||||
#elif defined(PLATFORM_ANDROID)
|
#elif defined(PLATFORM_ANDROID)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
HWND GetHWND();
|
HWND GetHWND();
|
||||||
extern LPCTSTR g_GameTitle;
|
|
||||||
|
|
||||||
// Don't undefine. It will make the game MUCH slower.
|
// Don't undefine. It will make the game MUCH slower.
|
||||||
#define USE_HARDWARE_GL_BUFFERS
|
#define USE_HARDWARE_GL_BUFFERS
|
||||||
@@ -49,7 +48,7 @@ void xglInit()
|
|||||||
|
|
||||||
#ifdef USE_HARDWARE_GL_BUFFERS
|
#ifdef USE_HARDWARE_GL_BUFFERS
|
||||||
if (!xglInitted())
|
if (!xglInitted())
|
||||||
MessageBox(GetHWND(), TEXT("Error initializing GL extensions. Update your graphics drivers!"), g_GameTitle, MB_OK);
|
MessageBox(GetHWND(), TEXT("Error initializing GL extensions. Update your graphics drivers!"), "Error", MB_OK);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,28 +13,6 @@ AppPlatform_sdl::AppPlatform_sdl(std::string storageDir, SDL_Window *window)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure Screenshots Folder Exists
|
|
||||||
void ensure_screenshots_folder(const char *screenshots)
|
|
||||||
{
|
|
||||||
// Check Screenshots Folder
|
|
||||||
struct stat obj;
|
|
||||||
if (stat(screenshots, &obj) != 0 || !S_ISDIR(obj.st_mode))
|
|
||||||
{
|
|
||||||
// Create Screenshots Folder
|
|
||||||
#ifdef _WIN32
|
|
||||||
int ret = mkdir(screenshots);
|
|
||||||
#else
|
|
||||||
int ret = mkdir(screenshots, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
||||||
#endif
|
|
||||||
if (ret != 0)
|
|
||||||
{
|
|
||||||
// Unable To Create Folder
|
|
||||||
LogMsg("Error Creating Directory: %s: %s", screenshots, strerror(errno));
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take Screenshot
|
// Take Screenshot
|
||||||
static int save_png(const char *filename, unsigned char *pixels, int line_size, int width, int height)
|
static int save_png(const char *filename, unsigned char *pixels, int line_size, int width, int height)
|
||||||
{
|
{
|
||||||
@@ -110,6 +88,28 @@ ret:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure Screenshots Folder Exists
|
||||||
|
void AppPlatform_sdl::ensureDirectoryExists(const char* path)
|
||||||
|
{
|
||||||
|
// Check Screenshots Folder
|
||||||
|
struct stat obj;
|
||||||
|
if (stat(screenshots, &obj) != 0 || !S_ISDIR(obj.st_mode))
|
||||||
|
{
|
||||||
|
// Create Screenshots Folder
|
||||||
|
#ifdef _WIN32
|
||||||
|
int ret = mkdir(screenshots);
|
||||||
|
#else
|
||||||
|
int ret = mkdir(screenshots, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||||
|
#endif
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
// Unable To Create Folder
|
||||||
|
LogMsg("Error Creating Directory: %s: %s", screenshots, strerror(errno));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AppPlatform_sdl::saveScreenshot(const std::string& filename, int glWidth, int glHeight)
|
void AppPlatform_sdl::saveScreenshot(const std::string& filename, int glWidth, int glHeight)
|
||||||
{
|
{
|
||||||
// Get Directory
|
// Get Directory
|
||||||
|
|||||||
@@ -2,12 +2,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
|
|
||||||
#include "AppPlatform_sdlbase.hpp"
|
#include "AppPlatform_sdlbase.hpp"
|
||||||
|
|
||||||
void ensure_screenshots_folder(const char *screenshots);
|
|
||||||
|
|
||||||
class AppPlatform_sdl : public AppPlatform_sdlbase
|
class AppPlatform_sdl : public AppPlatform_sdlbase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -15,4 +11,6 @@ public:
|
|||||||
|
|
||||||
void saveScreenshot(const std::string& fileName, int width, int height) override;
|
void saveScreenshot(const std::string& fileName, int width, int height) override;
|
||||||
Texture loadTexture(const std::string& path, bool b = false) override;
|
Texture loadTexture(const std::string& path, bool b = false) override;
|
||||||
|
protected:
|
||||||
|
void ensureDirectoryExists(const char* path) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#else
|
#else
|
||||||
#include <png.h>
|
|
||||||
|
|
||||||
#include "compat/GL.hpp"
|
#include "compat/GL.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -24,6 +22,8 @@ void AppPlatform_sdlbase::_init(std::string storageDir, SDL_Window *window)
|
|||||||
|
|
||||||
m_bShiftPressed[0] = false;
|
m_bShiftPressed[0] = false;
|
||||||
m_bShiftPressed[1] = false;
|
m_bShiftPressed[1] = false;
|
||||||
|
|
||||||
|
ensureDirectoryExists(_storageDir.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppPlatform_sdlbase::_init(std::string storageDir, SDL_Window *window, const Texture& icon)
|
void AppPlatform_sdlbase::_init(std::string storageDir, SDL_Window *window, const Texture& icon)
|
||||||
@@ -68,6 +68,11 @@ int AppPlatform_sdlbase::checkLicense()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* const AppPlatform_sdlbase::getWindowTitle() const
|
||||||
|
{
|
||||||
|
return SDL_GetWindowTitle(_window);
|
||||||
|
}
|
||||||
|
|
||||||
int AppPlatform_sdlbase::getScreenWidth() const
|
int AppPlatform_sdlbase::getScreenWidth() const
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
@@ -120,3 +125,65 @@ int AppPlatform_sdlbase::getUserInputStatus()
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mouse::ButtonType AppPlatform_sdlbase::GetMouseButtonType(SDL_Event event)
|
||||||
|
{
|
||||||
|
switch (event.button.button)
|
||||||
|
{
|
||||||
|
case SDL_BUTTON_LEFT:
|
||||||
|
return Mouse::ButtonType::LEFT;
|
||||||
|
case SDL_BUTTON_RIGHT:
|
||||||
|
return Mouse::ButtonType::RIGHT;
|
||||||
|
case SDL_BUTTON_MIDDLE:
|
||||||
|
return Mouse::ButtonType::MIDDLE;
|
||||||
|
default:
|
||||||
|
return Mouse::ButtonType::NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Mouse::ButtonState AppPlatform_sdlbase::GetMouseButtonState(SDL_Event event)
|
||||||
|
{
|
||||||
|
Mouse::ButtonState result;
|
||||||
|
|
||||||
|
switch (event.type)
|
||||||
|
{
|
||||||
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
|
result = Mouse::ButtonState::DOWN;
|
||||||
|
break;
|
||||||
|
case SDL_MOUSEBUTTONUP:
|
||||||
|
result = Mouse::ButtonState::UP;
|
||||||
|
break;
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
|
{
|
||||||
|
short wheelDelta = event.wheel.y;
|
||||||
|
if (wheelDelta > 0)
|
||||||
|
{
|
||||||
|
// "A positive value indicates that the wheel was rotated forward, away from the user."
|
||||||
|
result = Mouse::ButtonState::UP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// "A negative value indicates that the wheel was rotated backward, toward the user."
|
||||||
|
result = Mouse::ButtonState::DOWN;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
result = Mouse::ButtonState::UP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Keyboard::KeyState AppPlatform_sdlbase::GetKeyState(SDL_Event event)
|
||||||
|
{
|
||||||
|
switch (event.key.state)
|
||||||
|
{
|
||||||
|
case SDL_RELEASED:
|
||||||
|
return Keyboard::KeyState::UP;
|
||||||
|
case SDL_PRESSED:
|
||||||
|
default:
|
||||||
|
return Keyboard::KeyState::DOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
#include "AppPlatform.hpp"
|
#include "AppPlatform.hpp"
|
||||||
|
|
||||||
#ifdef ORIGINAL_CODE
|
#include "client/player/input/Mouse.hpp"
|
||||||
#error "This isn't original code. You probably shouldn't try to compile this"
|
#include "client/player/input/Keyboard.hpp"
|
||||||
#endif
|
|
||||||
|
|
||||||
void ensure_screenshots_folder(const char *screenshots);
|
|
||||||
|
|
||||||
class AppPlatform_sdlbase : public AppPlatform
|
class AppPlatform_sdlbase : public AppPlatform
|
||||||
{
|
{
|
||||||
@@ -28,6 +24,7 @@ public:
|
|||||||
~AppPlatform_sdlbase();
|
~AppPlatform_sdlbase();
|
||||||
|
|
||||||
int checkLicense() override;
|
int checkLicense() override;
|
||||||
|
const char* const getWindowTitle() const;
|
||||||
int getScreenWidth() const override;
|
int getScreenWidth() const override;
|
||||||
int getScreenHeight() const override;
|
int getScreenHeight() const override;
|
||||||
Texture loadTexture(const std::string& path, bool b = false) override = 0;
|
Texture loadTexture(const std::string& path, bool b = false) override = 0;
|
||||||
@@ -42,6 +39,10 @@ public:
|
|||||||
// Also add these to allow proper text input within the game.
|
// Also add these to allow proper text input within the game.
|
||||||
bool shiftPressed() override;
|
bool shiftPressed() override;
|
||||||
void setShiftPressed(bool b, bool isLeft);
|
void setShiftPressed(bool b, bool isLeft);
|
||||||
|
|
||||||
|
static Mouse::ButtonType GetMouseButtonType(SDL_Event event);
|
||||||
|
static Mouse::ButtonState GetMouseButtonState(SDL_Event event);
|
||||||
|
static Keyboard::KeyState GetKeyState(SDL_Event event);
|
||||||
private:
|
private:
|
||||||
SDL_Window *_window;
|
SDL_Window *_window;
|
||||||
|
|
||||||
@@ -56,4 +57,6 @@ private:
|
|||||||
static SDL_Surface* getSurfaceForTexture(const Texture* const texture);
|
static SDL_Surface* getSurfaceForTexture(const Texture* const texture);
|
||||||
protected:
|
protected:
|
||||||
std::string _storageDir;
|
std::string _storageDir;
|
||||||
|
|
||||||
|
virtual void ensureDirectoryExists(const char* path) { }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
#include "compat/GL.hpp"
|
#include "compat/GL.hpp"
|
||||||
#include "compat/AKeyCodes.hpp"
|
|
||||||
#include "App.hpp"
|
#include "App.hpp"
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
#include "../emscripten/AppPlatform_emscripten.hpp"
|
#include "../emscripten/AppPlatform_emscripten.hpp"
|
||||||
typedef AppPlatform_emscripten UsedAppPlatform;
|
typedef AppPlatform_emscripten UsedAppPlatform;
|
||||||
#else
|
#else
|
||||||
#include "AppPlatform_sdl.hpp"
|
#include "AppPlatform_sdl.hpp"
|
||||||
typedef AppPlatform_sdl UsedAppPlatform;
|
typedef AppPlatform_sdl UsedAppPlatform;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "NinecraftApp.hpp"
|
#include "NinecraftApp.hpp"
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
@@ -82,6 +83,7 @@ static void handle_events()
|
|||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
{
|
{
|
||||||
|
// TODO: Shouldn't we be handling this in Keyboard?
|
||||||
if (event.key.keysym.sym == SDLK_F2)
|
if (event.key.keysym.sym == SDLK_F2)
|
||||||
{
|
{
|
||||||
if (event.key.state == SDL_PRESSED && g_pAppPlatform != nullptr)
|
if (event.key.state == SDL_PRESSED && g_pAppPlatform != nullptr)
|
||||||
@@ -90,7 +92,7 @@ static void handle_events()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Keyboard::feed(event.key.state == SDL_PRESSED ? 1 : 0, translate_sdl_key_to_mcpe(event.key.keysym.sym));
|
Keyboard::feed(AppPlatform_sdlbase::GetKeyState(event), translate_sdl_key_to_mcpe(event.key.keysym.sym));
|
||||||
if (event.key.keysym.sym == SDLK_LSHIFT || event.key.keysym.sym == SDLK_RSHIFT)
|
if (event.key.keysym.sym == SDLK_LSHIFT || event.key.keysym.sym == SDLK_RSHIFT)
|
||||||
{
|
{
|
||||||
g_pAppPlatform->setShiftPressed(event.key.state == SDL_PRESSED, event.key.keysym.sym == SDLK_LSHIFT);
|
g_pAppPlatform->setShiftPressed(event.key.state == SDL_PRESSED, event.key.keysym.sym == SDLK_LSHIFT);
|
||||||
@@ -100,8 +102,8 @@ static void handle_events()
|
|||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
{
|
{
|
||||||
float scale = g_fPointToPixelScale;
|
const float scale = g_fPointToPixelScale;
|
||||||
Mouse::feed(event.button.button == SDL_BUTTON_LEFT ? 1 : 2, event.button.state == SDL_PRESSED ? 1 : 0, event.button.x * scale, event.button.y * scale);
|
Mouse::feed(AppPlatform_sdlbase::GetMouseButtonType(event), AppPlatform_sdlbase::GetMouseButtonState(event), event.button.x * scale, event.button.y * scale);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
@@ -109,14 +111,13 @@ static void handle_events()
|
|||||||
float scale = g_fPointToPixelScale;
|
float scale = g_fPointToPixelScale;
|
||||||
float x = event.motion.x * scale;
|
float x = event.motion.x * scale;
|
||||||
float y = event.motion.y * scale;
|
float y = event.motion.y * scale;
|
||||||
Mouse::setX(x); Mouse::setY(y);
|
Mouse::feed(Mouse::ButtonType::NONE, Mouse::ButtonState::UP, x, y);
|
||||||
Mouse::feed(0, 0, x, y);
|
g_AppPlatform->setMouseDiff(event.motion.xrel * scale, event.motion.yrel * scale);
|
||||||
g_pAppPlatform->setMouseDiff(event.motion.xrel * scale, event.motion.yrel * scale);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
Mouse::feed(3, event.wheel.y * g_fPointToPixelScale, Mouse::getX(), Mouse::getY());
|
Mouse::feed(Mouse::ButtonType::MIDDLE, AppPlatform_sdlbase::GetMouseButtonState(event), Mouse::getX(), Mouse::getY());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_TEXTINPUT:
|
case SDL_TEXTINPUT:
|
||||||
@@ -308,9 +309,6 @@ int main(int argc, char *argv[])
|
|||||||
storagePath = getenv("HOME");
|
storagePath = getenv("HOME");
|
||||||
#endif
|
#endif
|
||||||
storagePath += "/.reminecraftpe";
|
storagePath += "/.reminecraftpe";
|
||||||
#ifndef __EMSCRIPTEN__
|
|
||||||
ensure_screenshots_folder(storagePath.c_str());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Start MCPE
|
// Start MCPE
|
||||||
g_pApp = new NinecraftApp;
|
g_pApp = new NinecraftApp;
|
||||||
|
|||||||
@@ -12,15 +12,16 @@
|
|||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
|
||||||
#include "AppPlatform_windows.hpp"
|
#include "AppPlatform_windows.hpp"
|
||||||
#include "client/player/input/Mouse.hpp"
|
|
||||||
|
|
||||||
#include "thirdparty/stb_image.h"
|
#include "thirdparty/stb_image.h"
|
||||||
#include "thirdparty/stb_image_write.h"
|
#include "thirdparty/stb_image_write.h"
|
||||||
|
|
||||||
extern LPCTSTR g_GameTitle;
|
|
||||||
|
|
||||||
AppPlatform_windows::AppPlatform_windows()
|
AppPlatform_windows::AppPlatform_windows()
|
||||||
{
|
{
|
||||||
|
m_WindowTitle = "ReMinecraftPE";
|
||||||
|
// just assume an 854x480 window for now:
|
||||||
|
m_ScreenWidth = C_DEFAULT_SCREEN_WIDTH;
|
||||||
|
m_ScreenHeight = C_DEFAULT_SCREEN_HEIGHT;
|
||||||
m_UserInputStatus = -1;
|
m_UserInputStatus = -1;
|
||||||
|
|
||||||
m_bIsFocused = false;
|
m_bIsFocused = false;
|
||||||
@@ -32,13 +33,6 @@ AppPlatform_windows::AppPlatform_windows()
|
|||||||
m_MouseDiffX = 0, m_MouseDiffY = 0;
|
m_MouseDiffX = 0, m_MouseDiffY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppPlatform_windows::initConsts()
|
|
||||||
{
|
|
||||||
// just assume an 854x480 window for now:
|
|
||||||
m_ScreenWidth = C_DEFAULT_SCREEN_WIDTH;
|
|
||||||
m_ScreenHeight = C_DEFAULT_SCREEN_HEIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AppPlatform_windows::checkLicense()
|
int AppPlatform_windows::checkLicense()
|
||||||
{
|
{
|
||||||
// we own the game!!
|
// we own the game!!
|
||||||
@@ -47,7 +41,7 @@ int AppPlatform_windows::checkLicense()
|
|||||||
|
|
||||||
void AppPlatform_windows::buyGame()
|
void AppPlatform_windows::buyGame()
|
||||||
{
|
{
|
||||||
MessageBox(GetHWND(), TEXT("Buying the game!"), g_GameTitle, MB_OK | MB_ICONINFORMATION);
|
MessageBox(GetHWND(), TEXT("Buying the game!"), getWindowTitle(), MB_OK | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppPlatform_windows::saveScreenshot(const std::string& fileName, int width, int height)
|
void AppPlatform_windows::saveScreenshot(const std::string& fileName, int width, int height)
|
||||||
@@ -93,26 +87,6 @@ void AppPlatform_windows::saveScreenshot(const std::string& fileName, int width,
|
|||||||
delete[] pixels;
|
delete[] pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AppPlatform_windows::getScreenWidth() const
|
|
||||||
{
|
|
||||||
return m_ScreenWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AppPlatform_windows::getScreenHeight() const
|
|
||||||
{
|
|
||||||
return m_ScreenHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> AppPlatform_windows::getUserInput()
|
|
||||||
{
|
|
||||||
return m_UserInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AppPlatform_windows::getUserInputStatus()
|
|
||||||
{
|
|
||||||
return m_UserInputStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AppPlatform_windows::createUserInput()
|
void AppPlatform_windows::createUserInput()
|
||||||
{
|
{
|
||||||
m_UserInput.clear();
|
m_UserInput.clear();
|
||||||
@@ -167,7 +141,7 @@ Texture AppPlatform_windows::loadTexture(const std::string& str, bool b)
|
|||||||
|
|
||||||
_error:
|
_error:
|
||||||
const std::string msg = "Error loading " + realPath + ". Did you unzip the Minecraft assets?";
|
const std::string msg = "Error loading " + realPath + ". Did you unzip the Minecraft assets?";
|
||||||
MessageBoxA(GetHWND(), msg.c_str(), g_GameTitle, MB_OK);
|
MessageBoxA(GetHWND(), msg.c_str(), getWindowTitle(), MB_OK);
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
@@ -196,9 +170,6 @@ std::vector<std::string> AppPlatform_windows::getOptionStrings()
|
|||||||
{
|
{
|
||||||
std::vector<std::string> o;
|
std::vector<std::string> o;
|
||||||
|
|
||||||
//o.push_back("mp_username");
|
|
||||||
//o.push_back("iProgramInCpp");
|
|
||||||
|
|
||||||
std::ifstream ifs("options.txt");
|
std::ifstream ifs("options.txt");
|
||||||
if (!ifs.is_open())
|
if (!ifs.is_open())
|
||||||
return o;
|
return o;
|
||||||
@@ -360,12 +331,67 @@ void AppPlatform_windows::updateFocused(bool focused)
|
|||||||
setMouseGrabbed(m_bGrabbedMouse);
|
setMouseGrabbed(m_bGrabbedMouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppPlatform_windows::shiftPressed()
|
Mouse::ButtonType AppPlatform_windows::GetMouseButtonType(UINT iMsg)
|
||||||
{
|
{
|
||||||
return m_bShiftPressed;
|
switch (iMsg)
|
||||||
|
{
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
return Mouse::ButtonType::LEFT;
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
return Mouse::ButtonType::RIGHT;
|
||||||
|
case WM_MBUTTONUP:
|
||||||
|
case WM_MBUTTONDOWN:
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
return Mouse::ButtonType::MIDDLE;
|
||||||
|
default:
|
||||||
|
return Mouse::ButtonType::NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppPlatform_windows::setShiftPressed(bool b)
|
Mouse::ButtonState AppPlatform_windows::GetMouseButtonState(UINT iMsg, WPARAM wParam)
|
||||||
{
|
{
|
||||||
m_bShiftPressed = b;
|
Mouse::ButtonState result;
|
||||||
|
|
||||||
|
switch (iMsg)
|
||||||
|
{
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
case WM_MBUTTONDOWN:
|
||||||
|
result = Mouse::ButtonState::DOWN;
|
||||||
|
break;
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
|
{
|
||||||
|
short wheelDelta = GET_WHEEL_DELTA_WPARAM(wParam);
|
||||||
|
if (wheelDelta > 0)
|
||||||
|
{
|
||||||
|
// "A positive value indicates that the wheel was rotated forward, away from the user."
|
||||||
|
result = Mouse::ButtonState::UP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// "A negative value indicates that the wheel was rotated backward, toward the user."
|
||||||
|
result = Mouse::ButtonState::DOWN;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
result = Mouse::ButtonState::UP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Keyboard::KeyState AppPlatform_windows::GetKeyState(UINT iMsg)
|
||||||
|
{
|
||||||
|
switch (iMsg)
|
||||||
|
{
|
||||||
|
case WM_KEYUP:
|
||||||
|
return Keyboard::KeyState::UP;
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
default:
|
||||||
|
return Keyboard::KeyState::DOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,35 +8,31 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "compat/GL.hpp"
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
#include "compat/GL.hpp"
|
||||||
#include "AppPlatform.hpp"
|
#include "AppPlatform.hpp"
|
||||||
|
|
||||||
|
#include "client/player/input/Mouse.hpp"
|
||||||
|
#include "client/player/input/Keyboard.hpp"
|
||||||
#include "common/Utils.hpp"
|
#include "common/Utils.hpp"
|
||||||
|
|
||||||
#ifdef ORIGINAL_CODE
|
|
||||||
#error "This isn't original code. You probably shouldn't try to compile this"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// note: probably won't add AppPlatform_android until it's time
|
|
||||||
// to build an Android app
|
|
||||||
|
|
||||||
class AppPlatform_windows : public AppPlatform
|
class AppPlatform_windows : public AppPlatform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppPlatform_windows();
|
AppPlatform_windows();
|
||||||
void initConsts();
|
|
||||||
void buyGame() override;
|
void buyGame() override;
|
||||||
void saveScreenshot(const std::string& fileName, int width, int height) override;
|
void saveScreenshot(const std::string& fileName, int width, int height) override;
|
||||||
int checkLicense() override;
|
int checkLicense() override;
|
||||||
void createUserInput() override;
|
void createUserInput() override;
|
||||||
std::vector<std::string> getUserInput() override;
|
std::vector<std::string> getUserInput() override { return m_UserInput; }
|
||||||
int getUserInputStatus() override;
|
int getUserInputStatus() override { return m_UserInputStatus; }
|
||||||
int getScreenWidth() const override;
|
int getScreenWidth() const override { return m_ScreenWidth; }
|
||||||
int getScreenHeight() const override;
|
int getScreenHeight() const override { return m_ScreenHeight; }
|
||||||
void showDialog(eDialogType) override;
|
void showDialog(eDialogType) override;
|
||||||
std::string getDateString(int time) override;
|
std::string getDateString(int time) override;
|
||||||
Texture loadTexture(const std::string& str, bool b) override;
|
Texture loadTexture(const std::string& str, bool b) override;
|
||||||
std::vector<std::string> getOptionStrings() override;
|
std::vector<std::string> getOptionStrings() override;
|
||||||
|
|
||||||
// Also add these to allow proper turning within the game.
|
// Also add these to allow proper turning within the game.
|
||||||
void recenterMouse() override;
|
void recenterMouse() override;
|
||||||
@@ -46,8 +42,8 @@ public:
|
|||||||
void updateFocused(bool focused) override;
|
void updateFocused(bool focused) override;
|
||||||
|
|
||||||
// Also add these to allow proper text input within the game.
|
// Also add these to allow proper text input within the game.
|
||||||
bool shiftPressed() override;
|
bool shiftPressed() override { return m_bShiftPressed; }
|
||||||
void setShiftPressed(bool b);
|
void setShiftPressed(bool b) { m_bShiftPressed = b; }
|
||||||
|
|
||||||
// Also add these to allow saving options.
|
// Also add these to allow saving options.
|
||||||
void setOptionStrings(const std::vector <std::string>& str) override;
|
void setOptionStrings(const std::vector <std::string>& str) override;
|
||||||
@@ -56,8 +52,14 @@ public:
|
|||||||
std::string getPatchData() override;
|
std::string getPatchData() override;
|
||||||
|
|
||||||
void setScreenSize(int width, int height);
|
void setScreenSize(int width, int height);
|
||||||
|
const char* const getWindowTitle() const { return m_WindowTitle; }
|
||||||
|
|
||||||
|
static Mouse::ButtonType GetMouseButtonType(UINT iMsg);
|
||||||
|
static Mouse::ButtonState GetMouseButtonState(UINT iMsg, WPARAM wParam);
|
||||||
|
static Keyboard::KeyState GetKeyState(UINT iMsg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const char* m_WindowTitle;
|
||||||
int m_ScreenWidth;
|
int m_ScreenWidth;
|
||||||
int m_ScreenHeight;
|
int m_ScreenHeight;
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,11 @@
|
|||||||
#include "AppPlatform_windows.hpp"
|
#include "AppPlatform_windows.hpp"
|
||||||
#include "NinecraftApp.hpp"
|
#include "NinecraftApp.hpp"
|
||||||
|
|
||||||
LPCTSTR g_GameTitle = TEXT("ReMinecraftPE");
|
|
||||||
LPCTSTR g_WindowClassName = TEXT("MCPEClass");
|
LPCTSTR g_WindowClassName = TEXT("MCPEClass");
|
||||||
|
|
||||||
|
AppPlatform_windows g_AppPlatform;
|
||||||
|
NinecraftApp* g_pApp;
|
||||||
|
|
||||||
void LogMsg(const char* fmt, ...)
|
void LogMsg(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list lst;
|
va_list lst;
|
||||||
@@ -58,18 +60,6 @@ void LogMsgNoCR(const char* fmt, ...)
|
|||||||
va_end(lst);
|
va_end(lst);
|
||||||
}
|
}
|
||||||
|
|
||||||
AppPlatform_windows g_AppPlatform;
|
|
||||||
NinecraftApp* g_pApp;
|
|
||||||
|
|
||||||
bool g_LButtonDown, g_RButtonDown;
|
|
||||||
int g_MousePosX, g_MousePosY;
|
|
||||||
|
|
||||||
void UpdateMouse()
|
|
||||||
{
|
|
||||||
Mouse::setX(g_MousePosX);
|
|
||||||
Mouse::setY(g_MousePosY);
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (iMsg)
|
switch (iMsg)
|
||||||
@@ -85,69 +75,31 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
{
|
|
||||||
if (g_LButtonDown)
|
|
||||||
{
|
|
||||||
g_LButtonDown = false;
|
|
||||||
UpdateMouse();
|
|
||||||
|
|
||||||
Mouse::feed(1, 0, g_MousePosX, g_MousePosY);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
{
|
|
||||||
if (!g_LButtonDown)
|
|
||||||
{
|
|
||||||
g_LButtonDown = true;
|
|
||||||
UpdateMouse();
|
|
||||||
|
|
||||||
Mouse::feed(1, 1, g_MousePosX, g_MousePosY);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
{
|
|
||||||
if (g_RButtonDown)
|
|
||||||
{
|
|
||||||
g_RButtonDown = false;
|
|
||||||
UpdateMouse();
|
|
||||||
|
|
||||||
Mouse::feed(2, 0, g_MousePosX, g_MousePosY);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
{
|
case WM_MBUTTONUP:
|
||||||
if (!g_RButtonDown)
|
case WM_MBUTTONDOWN:
|
||||||
{
|
|
||||||
g_RButtonDown = true;
|
|
||||||
UpdateMouse();
|
|
||||||
|
|
||||||
Mouse::feed(2, 1, g_MousePosX, g_MousePosY);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
|
case WM_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
int xPos = GET_X_LPARAM(lParam);
|
Mouse::ButtonType buttonType = AppPlatform_windows::GetMouseButtonType(iMsg);
|
||||||
int yPos = GET_Y_LPARAM(lParam);
|
Mouse::ButtonState buttonState = AppPlatform_windows::GetMouseButtonState(iMsg, wParam);
|
||||||
|
int posX, posY;
|
||||||
g_MousePosX = xPos;
|
if (iMsg == WM_MOUSEMOVE)
|
||||||
g_MousePosY = yPos;
|
{
|
||||||
|
posX = GET_X_LPARAM(lParam);
|
||||||
UpdateMouse();
|
posY = GET_Y_LPARAM(lParam);
|
||||||
|
}
|
||||||
Mouse::feed(0, 0, g_MousePosX, g_MousePosY);
|
else
|
||||||
|
{
|
||||||
|
posX = Mouse::getX();
|
||||||
|
posY = Mouse::getY();
|
||||||
|
}
|
||||||
|
Mouse::feed(buttonType, buttonState, posX, posY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef ENH_ALLOW_SCROLL_WHEEL
|
|
||||||
case WM_MOUSEWHEEL:
|
|
||||||
Mouse::feed(3, GET_WHEEL_DELTA_WPARAM(wParam), g_MousePosX, g_MousePosY);
|
|
||||||
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
UINT width = LOWORD(lParam);
|
UINT width = LOWORD(lParam);
|
||||||
@@ -164,24 +116,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case WM_KEYUP:
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
{
|
{
|
||||||
Keyboard::feed(1, int(wParam));
|
Keyboard::KeyState state = AppPlatform_windows::GetKeyState(iMsg);
|
||||||
|
Keyboard::feed(state, int(wParam));
|
||||||
|
|
||||||
if (wParam == VK_SHIFT)
|
if (wParam == VK_SHIFT)
|
||||||
g_AppPlatform.setShiftPressed(true);
|
g_AppPlatform.setShiftPressed(state == Keyboard::KeyState::DOWN);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_KEYUP:
|
|
||||||
{
|
|
||||||
Keyboard::feed(0, int(wParam));
|
|
||||||
|
|
||||||
if (wParam == VK_SHIFT)
|
|
||||||
g_AppPlatform.setShiftPressed(false);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
{
|
{
|
||||||
if (lParam & (1 << 31))
|
if (lParam & (1 << 31))
|
||||||
@@ -193,6 +141,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
g_pApp->handleCharInput(char(wParam));
|
g_pApp->handleCharInput(char(wParam));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -205,6 +154,7 @@ extern bool g_bAreCloudsAvailable; // client/renderer/LevelRenderer.cpp
|
|||||||
|
|
||||||
void CheckOptionalTextureAvailability()
|
void CheckOptionalTextureAvailability()
|
||||||
{
|
{
|
||||||
|
// TODO: These should be inside of an initialized "Minecraft" instance rather than the global namespace
|
||||||
// Optional features that you really should be able to get away with not including.
|
// Optional features that you really should be able to get away with not including.
|
||||||
g_bIsMenuBackgroundAvailable = XPL_ACCESS("assets/gui/background/panorama_0.png", 0) == 0;
|
g_bIsMenuBackgroundAvailable = XPL_ACCESS("assets/gui/background/panorama_0.png", 0) == 0;
|
||||||
g_bAreCloudsAvailable = XPL_ACCESS("assets/environment/clouds.png", 0) == 0;
|
g_bAreCloudsAvailable = XPL_ACCESS("assets/environment/clouds.png", 0) == 0;
|
||||||
@@ -214,8 +164,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLin
|
|||||||
{
|
{
|
||||||
SetInstance(hInstance);
|
SetInstance(hInstance);
|
||||||
|
|
||||||
g_AppPlatform.initConsts();
|
|
||||||
|
|
||||||
// register the window class:
|
// register the window class:
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
wc.style = CS_OWNDC;
|
wc.style = CS_OWNDC;
|
||||||
@@ -238,11 +186,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLin
|
|||||||
|
|
||||||
if (!RegisterClass(&wc))
|
if (!RegisterClass(&wc))
|
||||||
{
|
{
|
||||||
MessageBox(NULL, TEXT("Could not register Minecraft class"), g_GameTitle, MB_ICONERROR | MB_OK);
|
MessageBox(NULL, TEXT("Could not register Minecraft class"), g_AppPlatform.getWindowTitle(), MB_ICONERROR | MB_OK);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND hWnd = CreateWindowEx(0, g_WindowClassName, g_GameTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, w, h, NULL, NULL, hInstance, g_pApp);
|
HWND hWnd = CreateWindowEx(0, g_WindowClassName, g_AppPlatform.getWindowTitle(), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, w, h, NULL, NULL, hInstance, g_pApp);
|
||||||
|
|
||||||
CenterWindow(hWnd);
|
CenterWindow(hWnd);
|
||||||
ShowWindow(hWnd, nCmdShow);
|
ShowWindow(hWnd, nCmdShow);
|
||||||
@@ -307,4 +255,4 @@ _cleanup:
|
|||||||
delete g_pApp;
|
delete g_pApp;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ add_library(reminecraftpe-core STATIC
|
|||||||
client/gui/screens/InvalidLicenseScreen.cpp
|
client/gui/screens/InvalidLicenseScreen.cpp
|
||||||
client/gui/screens/ConfirmScreen.cpp
|
client/gui/screens/ConfirmScreen.cpp
|
||||||
client/gui/screens/DeleteWorldScreen.cpp
|
client/gui/screens/DeleteWorldScreen.cpp
|
||||||
|
client/gui/screens/DeathScreen.cpp
|
||||||
client/gui/screens/ChatScreen.cpp
|
client/gui/screens/ChatScreen.cpp
|
||||||
client/gui/screens/RenameMPLevelScreen.cpp
|
client/gui/screens/RenameMPLevelScreen.cpp
|
||||||
client/gui/screens/ProgressScreen.cpp
|
client/gui/screens/ProgressScreen.cpp
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ static const char* g_panoramaList[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static float g_panoramaAngle = 0.0f;
|
static float g_panoramaAngle = 0.0f;
|
||||||
|
// TODO: This should be inside of an initialized "Minecraft" instance rather than the global namespace
|
||||||
bool g_bIsMenuBackgroundAvailable = false;
|
bool g_bIsMenuBackgroundAvailable = false;
|
||||||
|
|
||||||
void Screen::renderMenuBackground(float f)
|
void Screen::renderMenuBackground(float f)
|
||||||
@@ -328,9 +329,9 @@ void Screen::mouseEvent()
|
|||||||
if (pAction->isButton())
|
if (pAction->isButton())
|
||||||
{
|
{
|
||||||
if (Mouse::getEventButtonState())
|
if (Mouse::getEventButtonState())
|
||||||
mouseClicked (m_width * pAction->field_8 / Minecraft::width, m_height * pAction->field_C / Minecraft::height - 1, Mouse::getEventButton());
|
mouseClicked (m_width * pAction->_posX / Minecraft::width, m_height * pAction->_posY / Minecraft::height - 1, Mouse::getEventButton());
|
||||||
else
|
else
|
||||||
mouseReleased(m_width * pAction->field_8 / Minecraft::width, m_height * pAction->field_C / Minecraft::height - 1, Mouse::getEventButton());
|
mouseReleased(m_width * pAction->_posX / Minecraft::width, m_height * pAction->_posY / Minecraft::height - 1, Mouse::getEventButton());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void SelectWorldScreen::init()
|
|||||||
m_buttons.push_back(&m_btnBack);
|
m_buttons.push_back(&m_btnBack);
|
||||||
m_buttons.push_back(&m_btnDelete);
|
m_buttons.push_back(&m_btnDelete);
|
||||||
|
|
||||||
field_12C = Mouse::getButtonState(1) == 0;
|
field_12C = Mouse::getButtonState(Mouse::ButtonType::NONE) == Mouse::ButtonState::UP;
|
||||||
|
|
||||||
m_buttonTabList.push_back(&m_btnUnknown);
|
m_buttonTabList.push_back(&m_btnUnknown);
|
||||||
m_buttonTabList.push_back(&m_btnDelete);
|
m_buttonTabList.push_back(&m_btnDelete);
|
||||||
@@ -171,7 +171,7 @@ void SelectWorldScreen::render(int mouseX, int mouseY, float f)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pWorldSelectionList->render(0, 0, f);
|
m_pWorldSelectionList->render(0, 0, f);
|
||||||
field_12C = Mouse::getButtonState(1) == 0;
|
field_12C = Mouse::getButtonState(Mouse::ButtonType::LEFT) == Mouse::ButtonState::UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
Screen::render(mouseX, mouseY, f);
|
Screen::render(mouseX, mouseY, f);
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
std::vector<KeyboardAction> Keyboard::_inputs;
|
std::vector<KeyboardAction> Keyboard::_inputs;
|
||||||
int Keyboard::_index = -1;
|
int Keyboard::_index = -1;
|
||||||
int Keyboard::_states[KEYBOARD_STATES_SIZE];
|
Keyboard::KeyState Keyboard::_states[KEYBOARD_STATES_SIZE];
|
||||||
|
|
||||||
void Keyboard::feed(int down, int key)
|
void Keyboard::feed(KeyState state, int key)
|
||||||
{
|
{
|
||||||
#ifndef ORIGINAL_CODE
|
#ifndef ORIGINAL_CODE
|
||||||
// Prevent Crashes
|
// Prevent Crashes
|
||||||
@@ -23,9 +23,9 @@ void Keyboard::feed(int down, int key)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_inputs.push_back(KeyboardAction(key, down));
|
_inputs.push_back(KeyboardAction(key, state));
|
||||||
|
|
||||||
_states[key] = down;
|
_states[key] = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Keyboard::next()
|
bool Keyboard::next()
|
||||||
@@ -39,12 +39,12 @@ bool Keyboard::next()
|
|||||||
|
|
||||||
int Keyboard::getEventKey()
|
int Keyboard::getEventKey()
|
||||||
{
|
{
|
||||||
return _inputs[_index].field_4;
|
return _inputs[_index]._keyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Keyboard::getEventKeyState()
|
int Keyboard::getEventKeyState()
|
||||||
{
|
{
|
||||||
return _inputs[_index].field_0;
|
return _inputs[_index]._keyState;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Keyboard::isKeyDown(int keyCode)
|
bool Keyboard::isKeyDown(int keyCode)
|
||||||
@@ -52,7 +52,7 @@ bool Keyboard::isKeyDown(int keyCode)
|
|||||||
if (keyCode < 0 || keyCode >= KEYBOARD_STATES_SIZE)
|
if (keyCode < 0 || keyCode >= KEYBOARD_STATES_SIZE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _states[keyCode] == 1;
|
return _states[keyCode] == KeyState::DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Keyboard::reset()
|
void Keyboard::reset()
|
||||||
|
|||||||
@@ -16,22 +16,18 @@
|
|||||||
|
|
||||||
#define KEYBOARD_STATES_SIZE 256
|
#define KEYBOARD_STATES_SIZE 256
|
||||||
|
|
||||||
struct KeyboardAction
|
struct KeyboardAction;
|
||||||
{
|
|
||||||
int field_0;
|
|
||||||
uint8_t field_4;
|
|
||||||
|
|
||||||
KeyboardAction(uint8_t key, int state)
|
|
||||||
{
|
|
||||||
field_0 = state;
|
|
||||||
field_4 = key;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Keyboard
|
class Keyboard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void feed(int down, int key);
|
enum KeyState : bool
|
||||||
|
{
|
||||||
|
UP,
|
||||||
|
DOWN
|
||||||
|
};
|
||||||
|
|
||||||
|
static void feed(KeyState state, int key);
|
||||||
static bool next();
|
static bool next();
|
||||||
static int getEventKey();
|
static int getEventKey();
|
||||||
static int getEventKeyState();
|
static int getEventKeyState();
|
||||||
@@ -40,7 +36,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<KeyboardAction> _inputs;
|
static std::vector<KeyboardAction> _inputs;
|
||||||
static int _states[KEYBOARD_STATES_SIZE];
|
static Keyboard::KeyState _states[KEYBOARD_STATES_SIZE];
|
||||||
static int _index;
|
static int _index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct KeyboardAction
|
||||||
|
{
|
||||||
|
int _keyState;
|
||||||
|
uint8_t _keyCode;
|
||||||
|
|
||||||
|
KeyboardAction(uint8_t keyCode, Keyboard::KeyState keyState)
|
||||||
|
{
|
||||||
|
_keyState = keyState;
|
||||||
|
_keyCode = keyCode;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -10,22 +10,25 @@
|
|||||||
|
|
||||||
std::vector<MouseAction> Mouse::_inputs;
|
std::vector<MouseAction> Mouse::_inputs;
|
||||||
int Mouse::_index, Mouse::_x, Mouse::_y;
|
int Mouse::_index, Mouse::_x, Mouse::_y;
|
||||||
int Mouse::_xOld, Mouse::_yOld, Mouse::_buttonStates[3];
|
int Mouse::_xOld, Mouse::_yOld;
|
||||||
|
Mouse::ButtonState Mouse::_buttonStates[MOUSE_STATES_SIZE];
|
||||||
|
|
||||||
void Mouse::feed(int x1, int x2, int x3, int x4)
|
void Mouse::feed(ButtonType buttonType, ButtonState buttonState, int posX, int posY)
|
||||||
{
|
{
|
||||||
_inputs.push_back(MouseAction(x1, x2, x3, x4));
|
_inputs.push_back(MouseAction(buttonType, buttonState, posX, posY));
|
||||||
|
|
||||||
if (x1 >= 3)
|
// Make sure button type is valid
|
||||||
return;
|
if (buttonType <= ButtonType::_MAX)
|
||||||
|
{
|
||||||
|
// Check if we're processing a button-state update
|
||||||
|
if (buttonType != ButtonType::NONE)
|
||||||
|
_buttonStates[buttonType] = buttonState;
|
||||||
|
|
||||||
if (x1 != 0)
|
_xOld = _x;
|
||||||
Mouse::_buttonStates[x1] = x2;
|
_yOld = _y;
|
||||||
|
_x = posX;
|
||||||
_xOld = _x;
|
_y = posY;
|
||||||
_yOld = _y;
|
}
|
||||||
_x = x3;
|
|
||||||
_y = x4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
short Mouse::getX()
|
short Mouse::getX()
|
||||||
@@ -40,16 +43,16 @@ short Mouse::getY()
|
|||||||
|
|
||||||
bool Mouse::next()
|
bool Mouse::next()
|
||||||
{
|
{
|
||||||
if (_index + 1 >= int(_inputs.size()))
|
if (_index + 1 >= _inputs.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_index++;
|
_index++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mouse::getEventButton()
|
Mouse::ButtonType Mouse::getEventButton()
|
||||||
{
|
{
|
||||||
return _inputs[_index].field_0;
|
return _inputs[_index]._buttonType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mouse::isButtonDown(int btn)
|
bool Mouse::isButtonDown(int btn)
|
||||||
@@ -68,10 +71,10 @@ MouseAction* Mouse::getEvent()
|
|||||||
return &_inputs[_index];
|
return &_inputs[_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mouse::getButtonState(int btn)
|
Mouse::ButtonState Mouse::getButtonState(ButtonType btn)
|
||||||
{
|
{
|
||||||
if (btn <= 0 || btn >= 3)
|
if (btn <= ButtonType::_MIN || btn > ButtonType::_MAX)
|
||||||
return 0;
|
return ButtonState::UP;
|
||||||
|
|
||||||
return _buttonStates[btn];
|
return _buttonStates[btn];
|
||||||
}
|
}
|
||||||
@@ -92,7 +95,7 @@ void Mouse::reset2()
|
|||||||
_yOld = _y;
|
_yOld = _y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mouse::getEventButtonState()
|
Mouse::ButtonState Mouse::getEventButtonState()
|
||||||
{
|
{
|
||||||
return _inputs[_index].field_4;
|
return _inputs[_index]._buttonState;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,46 +10,39 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct MouseAction
|
#define MOUSE_STATES_SIZE (Mouse::ButtonState::MAX + 1)
|
||||||
{
|
|
||||||
int field_0;
|
|
||||||
int field_4;
|
|
||||||
int field_8;
|
|
||||||
int field_C;
|
|
||||||
|
|
||||||
MouseAction()
|
struct MouseAction;
|
||||||
{
|
|
||||||
field_0 = 0;
|
|
||||||
field_4 = 0;
|
|
||||||
field_8 = 0;
|
|
||||||
field_C = 0;
|
|
||||||
}
|
|
||||||
MouseAction(int x1, int x2, int x3, int x4)
|
|
||||||
{
|
|
||||||
field_0 = x1;
|
|
||||||
field_4 = x2;
|
|
||||||
field_8 = x3;
|
|
||||||
field_C = x4;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isButton()
|
|
||||||
{
|
|
||||||
return field_0 == 1 || field_0 == 2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Mouse
|
class Mouse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void feed(int, int, int, int);
|
enum ButtonType
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
LEFT,
|
||||||
|
RIGHT,
|
||||||
|
MIDDLE,
|
||||||
|
_MIN = LEFT,
|
||||||
|
_MAX = MIDDLE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ButtonState : bool
|
||||||
|
{
|
||||||
|
UP,
|
||||||
|
DOWN,
|
||||||
|
MAX = DOWN // God yes, I love C++. It doesn't let me name this _MAX despite it being in a DIFFERENT ENUM ENTIRELY...
|
||||||
|
};
|
||||||
|
|
||||||
|
static void feed(ButtonType buttonType, ButtonState buttonState, int posX, int posY);
|
||||||
|
|
||||||
static short getX();
|
static short getX();
|
||||||
static short getY();
|
static short getY();
|
||||||
static bool next();
|
static bool next();
|
||||||
static bool isButtonDown(int btn);
|
static bool isButtonDown(int btn);
|
||||||
static int getButtonState(int btn);
|
static ButtonState getButtonState(ButtonType btn);
|
||||||
static int getEventButton();
|
static ButtonType getEventButton();
|
||||||
static int getEventButtonState();
|
static ButtonState getEventButtonState();
|
||||||
static MouseAction* getEvent();
|
static MouseAction* getEvent();
|
||||||
static void setX(int x);
|
static void setX(int x);
|
||||||
static void setY(int y);
|
static void setY(int y);
|
||||||
@@ -63,6 +56,36 @@ private:
|
|||||||
static int _index;
|
static int _index;
|
||||||
static int _x, _y;
|
static int _x, _y;
|
||||||
static int _xOld, _yOld;
|
static int _xOld, _yOld;
|
||||||
static int _buttonStates[3];
|
static ButtonState _buttonStates[MOUSE_STATES_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct MouseAction
|
||||||
|
{
|
||||||
|
Mouse::ButtonType _buttonType;
|
||||||
|
Mouse::ButtonState _buttonState;
|
||||||
|
int _posX;
|
||||||
|
int _posY;
|
||||||
|
|
||||||
|
MouseAction()
|
||||||
|
{
|
||||||
|
_buttonType = Mouse::ButtonType::NONE;
|
||||||
|
_buttonState = Mouse::ButtonState::DOWN;
|
||||||
|
_posX = 0;
|
||||||
|
_posY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseAction(Mouse::ButtonType buttonType, Mouse::ButtonState buttonState, int posX, int posY)
|
||||||
|
{
|
||||||
|
_buttonType = buttonType;
|
||||||
|
_buttonState = buttonState;
|
||||||
|
_posX = posX;
|
||||||
|
_posY = posY;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isButton()
|
||||||
|
{
|
||||||
|
return _buttonType == Mouse::ButtonType::LEFT ||
|
||||||
|
_buttonType == Mouse::ButtonType::RIGHT ||
|
||||||
|
_buttonType == Mouse::ButtonType::MIDDLE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -1244,6 +1244,7 @@ void LevelRenderer::renderSky(float f)
|
|||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This should be inside of an initialized "Minecraft" instance rather than the global namespace
|
||||||
bool g_bAreCloudsAvailable = false; // false because 0.1 didn't have them
|
bool g_bAreCloudsAvailable = false; // false because 0.1 didn't have them
|
||||||
|
|
||||||
void LevelRenderer::renderClouds(float f)
|
void LevelRenderer::renderClouds(float f)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
int g_TimeSecondsOnInit = 0;
|
int g_TimeSecondsOnInit = 0;
|
||||||
|
|
||||||
#ifndef USE_SDL
|
#if !defined(USE_SDL) || defined(_WIN32)
|
||||||
|
|
||||||
DIR* opendir(const char* name)
|
DIR* opendir(const char* name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\compat\AKeyCodes.hpp" />
|
||||||
<ClInclude Include="..\GameMods.hpp" />
|
<ClInclude Include="..\GameMods.hpp" />
|
||||||
<ClInclude Include="..\platforms\openal\SoundSystemAL.hpp" />
|
<ClInclude Include="..\platforms\openal\SoundSystemAL.hpp" />
|
||||||
<ClInclude Include="..\platforms\PlatformDefinitions.hpp" />
|
<ClInclude Include="..\platforms\PlatformDefinitions.hpp" />
|
||||||
@@ -740,15 +741,14 @@
|
|||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<ProjectGuid>{ad85f5f3-6ad0-4c11-bb1d-33adb8eeb0b9}</ProjectGuid>
|
<ProjectGuid>{ad85f5f3-6ad0-4c11-bb1d-33adb8eeb0b9}</ProjectGuid>
|
||||||
<RootNamespace>minecraftcpp</RootNamespace>
|
<RootNamespace>minecraftcpp</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
||||||
<ProjectName>minecraftcpp</ProjectName>
|
<ProjectName>minecraftcpp</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugAsan|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugAsan|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
@@ -847,14 +847,12 @@
|
|||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>
|
|
||||||
</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win32</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win32\</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAsan|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAsan|Win32'">
|
||||||
@@ -866,14 +864,12 @@
|
|||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>
|
|
||||||
</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win32</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win32\</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -887,8 +883,6 @@
|
|||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>
|
|
||||||
</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -896,7 +890,7 @@
|
|||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win32</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win32\</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@@ -908,14 +902,12 @@
|
|||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>
|
|
||||||
</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\x64\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win64</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\x64\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win64\</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAsan|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAsan|x64'">
|
||||||
@@ -927,14 +919,12 @@
|
|||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>
|
|
||||||
</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\x64\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win64</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\x64\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win64\</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@@ -948,8 +938,6 @@
|
|||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<ShowIncludes>false</ShowIncludes>
|
<ShowIncludes>false</ShowIncludes>
|
||||||
<AdditionalIncludeDirectories>
|
|
||||||
</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -957,7 +945,7 @@
|
|||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>opengl32.lib;glu32.lib;ws2_32.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\x64\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win64</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(CONTRIB_PATH)\SDK\Lib\x64\;$(SolutionDir)..\thirdparty\OpenAL\libs\Win64\</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|||||||
@@ -79,9 +79,6 @@
|
|||||||
<Filter Include="source\platforms">
|
<Filter Include="source\platforms">
|
||||||
<UniqueIdentifier>{31101b35-f1ce-490e-a6b9-a5a1fab80b27}</UniqueIdentifier>
|
<UniqueIdentifier>{31101b35-f1ce-490e-a6b9-a5a1fab80b27}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="source\platforms\windows">
|
|
||||||
<UniqueIdentifier>{4cc1a780-f0a9-41b1-bee2-dc28f00fb958}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="source\platforms\openal">
|
<Filter Include="source\platforms\openal">
|
||||||
<UniqueIdentifier>{cc57a0f6-733d-44fa-8478-b1826b074d66}</UniqueIdentifier>
|
<UniqueIdentifier>{cc57a0f6-733d-44fa-8478-b1826b074d66}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
@@ -924,12 +921,6 @@
|
|||||||
<ClInclude Include="..\source\world\level\levelgen\biome\BiomeSource.hpp">
|
<ClInclude Include="..\source\world\level\levelgen\biome\BiomeSource.hpp">
|
||||||
<Filter>source\world\level\levelgen\biome</Filter>
|
<Filter>source\world\level\levelgen\biome</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\platforms\windows\AppPlatform_windows.hpp">
|
|
||||||
<Filter>source\platforms\windows</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\platforms\windows\SoundSystemWindows.hpp">
|
|
||||||
<Filter>source\platforms\windows</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\platforms\PlatformDefinitions.hpp">
|
<ClInclude Include="..\platforms\PlatformDefinitions.hpp">
|
||||||
<Filter>source\platforms</Filter>
|
<Filter>source\platforms</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -2018,15 +2009,6 @@
|
|||||||
<ClCompile Include="..\source\world\level\levelgen\biome\Biome.cpp">
|
<ClCompile Include="..\source\world\level\levelgen\biome\Biome.cpp">
|
||||||
<Filter>source\world\level\levelgen\biome</Filter>
|
<Filter>source\world\level\levelgen\biome</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\platforms\windows\main.cpp">
|
|
||||||
<Filter>source\platforms\windows</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\platforms\windows\SoundSystemWindows.cpp">
|
|
||||||
<Filter>source\platforms\windows</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\platforms\windows\AppPlatform_windows.cpp">
|
|
||||||
<Filter>source\platforms\windows</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\thirdparty\stb_image_impl.c">
|
<ClCompile Include="..\thirdparty\stb_image_impl.c">
|
||||||
<Filter>thirdparty</Filter>
|
<Filter>thirdparty</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
Reference in New Issue
Block a user