* Add clouds! (optional feature)

This commit is contained in:
iProgramInCpp
2023-08-13 20:38:52 +03:00
parent 206bc5cce0
commit 2da5c2e2fe
11 changed files with 148 additions and 11 deletions

View File

@@ -208,6 +208,13 @@ static EM_BOOL main_loop(double time, void *user_data)
}
extern bool g_bIsMenuBackgroundAvailable; // client/gui/Screen.cpp
extern bool g_bAreCloudsAvailable; // client/renderer/LevelRenderer.cpp
void CheckOptionalTextureAvailability()
{
g_bIsMenuBackgroundAvailable = XPL_ACCESS("assets/gui/background/panorama_0.png", 0) == 0;
g_bAreCloudsAvailable = XPL_ACCESS("assets/environment/clouds.png", 0) == 0;
}
// Main
int main(int argc, char *argv[])
@@ -237,7 +244,7 @@ int main(int argc, char *argv[])
Minecraft::height = std::stoi(argv[2]);
#endif
g_bIsMenuBackgroundAvailable = XPL_ACCESS("assets/gui/background/panorama_0.png", 0) == 0;
CheckOptionalTextureAvailability();
// Create Window
window = SDL_CreateWindow("ReMinecraftPE", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, Minecraft::width, Minecraft::height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);

View File

@@ -70,8 +70,6 @@ void UpdateMouse()
Mouse::setY(g_MousePosY);
}
extern bool g_bIsMenuBackgroundAvailable;
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch (iMsg)
@@ -201,6 +199,16 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
return 0;
}
extern bool g_bIsMenuBackgroundAvailable; // client/gui/Screen.cpp
extern bool g_bAreCloudsAvailable; // client/renderer/LevelRenderer.cpp
void CheckOptionalTextureAvailability()
{
// 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_bAreCloudsAvailable = XPL_ACCESS("assets/environment/clouds.png", 0) == 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
SetInstance(hInstance);
@@ -220,7 +228,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLin
wc.lpszMenuName = NULL;
wc.lpszClassName = g_WindowClassName;
g_bIsMenuBackgroundAvailable = XPL_ACCESS("assets/gui/background/panorama_0.png", 0) == 0;
CheckOptionalTextureAvailability();
RECT wr = { 0,0, g_AppPlatform.getScreenWidth(), g_AppPlatform.getScreenHeight() };
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, false);