mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Merge 8d6d1ff6ac
into 2d36d32da8
This commit is contained in:
commit
12596ccaf2
13 changed files with 119 additions and 35 deletions
|
@ -37,12 +37,16 @@ function mm_game_theme.set_engine(hide_decorations)
|
|||
mm_game_theme.set_engine_single("footer")
|
||||
end
|
||||
|
||||
if not have_bg then
|
||||
if core.settings:get_bool("menu_clouds") then
|
||||
core.set_clouds(true)
|
||||
if core.settings:get_bool("menu_dark_theme") then
|
||||
core.set_clouds_color("#1c2a47")
|
||||
core.set_sky_color("#090b1a")
|
||||
else
|
||||
mm_game_theme.set_dirt_bg()
|
||||
core.set_clouds_color("#f0f0ff")
|
||||
core.set_sky_color("#8cbafa")
|
||||
end
|
||||
|
||||
if not have_bg then
|
||||
core.set_clouds(core.settings:get_bool("menu_clouds"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -72,12 +76,16 @@ function mm_game_theme.set_game(gamedetails)
|
|||
mm_game_theme.set_game_single("header", gamedetails)
|
||||
mm_game_theme.set_game_single("footer", gamedetails)
|
||||
|
||||
if not have_bg then
|
||||
if core.settings:get_bool("menu_clouds") then
|
||||
core.set_clouds(true)
|
||||
if core.settings:get_bool("menu_dark_theme") then
|
||||
core.set_clouds_color("#1c2a47")
|
||||
core.set_sky_color("#090b1a")
|
||||
else
|
||||
mm_game_theme.set_dirt_bg()
|
||||
core.set_clouds_color("#f0f0ff")
|
||||
core.set_sky_color("#8cbafa")
|
||||
end
|
||||
|
||||
if not have_bg then
|
||||
core.set_clouds(core.settings:get_bool("menu_clouds"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -145,20 +153,6 @@ function mm_game_theme.set_game_single(identifier, gamedetails)
|
|||
return false
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_game_theme.set_dirt_bg()
|
||||
if mm_game_theme.texturepack ~= nil then
|
||||
local path = mm_game_theme.texturepack .. DIR_DELIM .."default_dirt.png"
|
||||
if core.set_background("background", path, true, 128) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- Use universal fallback texture in textures/base/pack
|
||||
local minimalpath = defaulttexturedir .. "menu_bg.png"
|
||||
core.set_background("background", minimalpath, true, 128)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function mm_game_theme.stop_music()
|
||||
if mm_game_theme.music_handle ~= nil then
|
||||
|
|
|
@ -871,6 +871,9 @@ tooltip_append_itemname (Append item name) bool false
|
|||
# Use a cloud animation for the main menu background.
|
||||
menu_clouds (Clouds in menu) bool true
|
||||
|
||||
# Use dark theme for the main menu background
|
||||
menu_dark_theme (Menu dark theme) bool true
|
||||
|
||||
[**HUD]
|
||||
|
||||
# Modifies the size of the HUD elements.
|
||||
|
|
|
@ -218,6 +218,10 @@ GUI
|
|||
* `minsize`: minimum tile size, images are scaled to at least this size prior
|
||||
doing tiling (background only)
|
||||
* `core.set_clouds(<true/false>)`
|
||||
* `core.set_clouds_color(colorString)`
|
||||
* `colorString` : `"#RRGGBB"` format
|
||||
* `core.set_sky_color(<true/false>)`
|
||||
* `colorString` : `"#RRGGBB"` format
|
||||
* `core.set_topleft_text(text)`
|
||||
* `core.show_touchscreen_layout()`
|
||||
* `core.show_path_select_dialog(formname, caption, is_file_select)`
|
||||
|
|
|
@ -131,7 +131,6 @@ are placeholders intended to be overwritten by the game.
|
|||
|
||||
### Mainmenu textures
|
||||
|
||||
* `menu_bg.png`: used as mainmenu background when the clouds are disabled
|
||||
* `menu_header.png`: header texture when no texture pack is selected
|
||||
|
||||
* `no_screenshot.png`
|
||||
|
|
|
@ -126,7 +126,7 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
|||
g_menucloudsmgr = m_rendering_engine->get_scene_manager()->createNewSceneManager();
|
||||
g_menuclouds = new Clouds(g_menucloudsmgr, ssrc.get(), -1, rand());
|
||||
g_menuclouds->setHeight(100.0f);
|
||||
g_menuclouds->update(v3f(0, 0, 0), video::SColor(255, 240, 240, 255));
|
||||
g_menuclouds->update(v3f(0, 0, 0), m_rendering_engine->getMenuCloudsColor());
|
||||
scene::ICameraSceneNode* camera;
|
||||
camera = g_menucloudsmgr->addCameraSceneNode(NULL, v3f(0, 0, 0), v3f(0, 60, 100));
|
||||
camera->setFarValue(10000);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "irr_ptr.h"
|
||||
|
||||
RenderingEngine *RenderingEngine::s_singleton = nullptr;
|
||||
const video::SColor RenderingEngine::MENU_SKY_COLOR = video::SColor(255, 140, 186, 250);
|
||||
|
||||
/* Helper classes */
|
||||
|
||||
|
@ -309,8 +308,9 @@ void RenderingEngine::draw_load_screen(const std::wstring &text,
|
|||
|
||||
auto *driver = get_video_driver();
|
||||
|
||||
driver->setFog(RenderingEngine::MENU_SKY_COLOR);
|
||||
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
|
||||
driver->setFog(getMenuSkyColor());
|
||||
driver->beginScene(true, true, getMenuSkyColor());
|
||||
|
||||
if (g_settings->getBool("menu_clouds")) {
|
||||
g_menuclouds->step(dtime * 3);
|
||||
g_menucloudsmgr->drawAll();
|
||||
|
@ -401,6 +401,27 @@ void RenderingEngine::finalize()
|
|||
core.reset();
|
||||
}
|
||||
|
||||
void RenderingEngine::setMenuSkyColor(video::SColor& color)
|
||||
{
|
||||
m_menu_sky_color = video::SColor(color);
|
||||
}
|
||||
|
||||
void RenderingEngine::setMenuCloudsColor(video::SColor& color)
|
||||
{
|
||||
m_menu_clouds_color = video::SColor(color);
|
||||
}
|
||||
|
||||
|
||||
const video::SColor RenderingEngine::getMenuSkyColor()
|
||||
{
|
||||
return m_menu_sky_color;
|
||||
}
|
||||
|
||||
const video::SColor RenderingEngine::getMenuCloudsColor()
|
||||
{
|
||||
return m_menu_clouds_color;
|
||||
}
|
||||
|
||||
void RenderingEngine::draw_scene(video::SColor skycolor, bool show_hud,
|
||||
bool draw_wield_tool, bool draw_crosshair)
|
||||
{
|
||||
|
|
|
@ -66,8 +66,6 @@ public:
|
|||
class RenderingEngine
|
||||
{
|
||||
public:
|
||||
static const video::SColor MENU_SKY_COLOR;
|
||||
|
||||
RenderingEngine(MyEventReceiver *eventReceiver);
|
||||
~RenderingEngine();
|
||||
|
||||
|
@ -140,6 +138,11 @@ public:
|
|||
return m_device->run();
|
||||
}
|
||||
|
||||
void setMenuSkyColor(video::SColor &color);
|
||||
void setMenuCloudsColor(video::SColor &color);
|
||||
const video::SColor getMenuSkyColor();
|
||||
const video::SColor getMenuCloudsColor();
|
||||
|
||||
// FIXME: this is still global when it shouldn't be
|
||||
static ShadowRenderer *get_shadow_renderer()
|
||||
{
|
||||
|
@ -160,6 +163,9 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
video::SColor m_menu_sky_color = video::SColor(255, 140, 186, 250);
|
||||
video::SColor m_menu_clouds_color = video::SColor(255, 240, 240, 255);
|
||||
|
||||
static void settingChangedCallback(const std::string &name, void *data);
|
||||
v2u32 _getWindowSize() const;
|
||||
|
||||
|
|
|
@ -285,6 +285,7 @@ void set_default_settings()
|
|||
settings->setDefault("soft_clouds", "false");
|
||||
settings->setDefault("cloud_radius", "12");
|
||||
settings->setDefault("menu_clouds", "true");
|
||||
settings->setDefault("menu_dark_theme", "false");
|
||||
settings->setDefault("translucent_liquids", "true");
|
||||
settings->setDefault("console_height", "0.6");
|
||||
settings->setDefault("console_color", "(0,0,0)");
|
||||
|
|
|
@ -313,7 +313,7 @@ void GUIEngine::run()
|
|||
driver->getFog(fog_color, fog_type, fog_start, fog_end, fog_density,
|
||||
fog_pixelfog, fog_rangefog);
|
||||
|
||||
driver->setFog(RenderingEngine::MENU_SKY_COLOR, fog_type, fog_start,
|
||||
driver->setFog(m_rendering_engine->getMenuSkyColor(), fog_type, fog_start,
|
||||
fog_end, fog_density, fog_pixelfog, fog_rangefog);
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,8 @@ void GUIEngine::run()
|
|||
last_window_info = window_info;
|
||||
}
|
||||
|
||||
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
|
||||
driver->beginScene(true, true, m_rendering_engine->getMenuSkyColor());
|
||||
driver->setFog(m_rendering_engine->getMenuSkyColor());
|
||||
|
||||
if (m_clouds_enabled) {
|
||||
drawClouds(dtime);
|
||||
|
@ -406,10 +407,24 @@ GUIEngine::~GUIEngine()
|
|||
/******************************************************************************/
|
||||
void GUIEngine::drawClouds(float dtime)
|
||||
{
|
||||
g_menuclouds->update(v3f(0, 0, 0), m_rendering_engine->getMenuCloudsColor());
|
||||
g_menuclouds->step(dtime * 3);
|
||||
g_menucloudsmgr->drawAll();
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void GUIEngine::setMainMenuCloudsColor(video::SColor& color)
|
||||
{
|
||||
m_rendering_engine->setMenuCloudsColor(color);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void GUIEngine::setMainMenuSkyColor(video::SColor& color)
|
||||
{
|
||||
m_rendering_engine->setMenuSkyColor(color);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
void GUIEngine::setFormspecPrepend(const std::string &fs)
|
||||
{
|
||||
|
@ -428,7 +443,7 @@ void GUIEngine::drawBackground(video::IVideoDriver *driver)
|
|||
|
||||
/* If no texture, draw background of solid color */
|
||||
if(!texture){
|
||||
video::SColor color(255,80,58,37);
|
||||
video::SColor color = m_rendering_engine->getMenuSkyColor();
|
||||
core::rect<s32> rect(0, 0, screensize.X, screensize.Y);
|
||||
driver->draw2DRectangle(color, rect, NULL);
|
||||
return;
|
||||
|
|
|
@ -264,5 +264,8 @@ private:
|
|||
/** is drawing of clouds enabled atm */
|
||||
bool m_clouds_enabled = true;
|
||||
|
||||
void setMainMenuCloudsColor(video::SColor& color);
|
||||
void setMainMenuSkyColor(video::SColor& color);
|
||||
|
||||
static void fullscreenChangedCallback(const std::string &name, void *data);
|
||||
};
|
||||
|
|
|
@ -222,6 +222,38 @@ int ModApiMainMenu::l_set_clouds(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_set_clouds_color(lua_State* L)
|
||||
{
|
||||
GUIEngine* engine = getGuiEngine(L);
|
||||
sanity_check(engine != NULL);
|
||||
|
||||
std::string value = readParam<std::string>(L, 1);
|
||||
video::SColor color = video::SColor();
|
||||
parseColorString(value, color, false);
|
||||
|
||||
engine->setMainMenuCloudsColor(color);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_set_sky_color(lua_State* L)
|
||||
{
|
||||
GUIEngine* engine = getGuiEngine(L);
|
||||
sanity_check(engine != NULL);
|
||||
|
||||
std::string value = readParam<std::string>(L, 1);
|
||||
video::SColor color = video::SColor();
|
||||
parseColorString(value, color, false);
|
||||
|
||||
engine->setMainMenuSkyColor(color);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int ModApiMainMenu::l_get_textlist_index(lua_State *L)
|
||||
{
|
||||
|
@ -1044,6 +1076,8 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
|
|||
API_FCT(update_formspec);
|
||||
API_FCT(set_formspec_prepend);
|
||||
API_FCT(set_clouds);
|
||||
API_FCT(set_sky_color);
|
||||
API_FCT(set_clouds_color);
|
||||
API_FCT(get_textlist_index);
|
||||
API_FCT(get_table_index);
|
||||
API_FCT(get_worlds);
|
||||
|
|
|
@ -71,7 +71,11 @@ private:
|
|||
|
||||
static int l_set_topleft_text(lua_State *L);
|
||||
|
||||
static int l_set_clouds(lua_State *L);
|
||||
static int l_set_clouds(lua_State* L);
|
||||
|
||||
static int l_set_clouds_color(lua_State* L);
|
||||
|
||||
static int l_set_sky_color(lua_State* L);
|
||||
|
||||
static int l_get_textlist_index(lua_State *L);
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 83 B |
Loading…
Add table
Add a link
Reference in a new issue