Skip to content

Commit

Permalink
Add Editor Main Menu (#7241)
Browse files Browse the repository at this point in the history
  • Loading branch information
Districh-ru authored May 30, 2023
1 parent 48c4740 commit f5ab41d
Show file tree
Hide file tree
Showing 14 changed files with 468 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VisualStudio/fheroes2/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>src\engine;src\fheroes2\gui;src\fheroes2\maps;src\fheroes2\kingdom;src\fheroes2\campaign;src\fheroes2\game;src\fheroes2\dialog;src\fheroes2\system;src\fheroes2\spell;src\fheroes2\monster;src\fheroes2\castle;src\fheroes2\agg;src\fheroes2\heroes;src\fheroes2\resource;src\fheroes2\ai;src\fheroes2\army;src\fheroes2\battle;src\fheroes2\h2d;src\fheroes2\objects;src\fheroes2\world;src\fheroes2\audio;src\fheroes2\image;src\thirdparty\libsmacker;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>src\engine;src\fheroes2\gui;src\fheroes2\maps;src\fheroes2\kingdom;src\fheroes2\campaign;src\fheroes2\game;src\fheroes2\editor;src\fheroes2\dialog;src\fheroes2\system;src\fheroes2\spell;src\fheroes2\monster;src\fheroes2\castle;src\fheroes2\agg;src\fheroes2\heroes;src\fheroes2\resource;src\fheroes2\ai;src\fheroes2\army;src\fheroes2\battle;src\fheroes2\h2d;src\fheroes2\objects;src\fheroes2\world;src\fheroes2\audio;src\fheroes2\image;src\thirdparty\libsmacker;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(FHEROES2_BUILD_NUMBER)'!=''">BUILD_VERSION=$(FHEROES2_BUILD_NUMBER);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
Expand Down
2 changes: 2 additions & 0 deletions VisualStudio/fheroes2/sources.props
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<ClCompile Include="src\fheroes2\dialog\dialog_selectscenario.cpp" />
<ClCompile Include="src\fheroes2\dialog\dialog_system_options.cpp" />
<ClCompile Include="src\fheroes2\dialog\dialog_thievesguild.cpp" />
<ClCompile Include="src\fheroes2\editor\editor_mainmenu.cpp" />
<ClCompile Include="src\fheroes2\game\difficulty.cpp" />
<ClCompile Include="src\fheroes2\game\fheroes2.cpp" />
<ClCompile Include="src\fheroes2\game\game.cpp" />
Expand Down Expand Up @@ -298,6 +299,7 @@
<ClInclude Include="src\fheroes2\dialog\dialog_selectitems.h" />
<ClInclude Include="src\fheroes2\dialog\dialog_selectscenario.h" />
<ClInclude Include="src\fheroes2\dialog\dialog_system_options.h" />
<ClInclude Include="src\fheroes2\editor\editor.h" />
<ClInclude Include="src\fheroes2\game\difficulty.h" />
<ClInclude Include="src\fheroes2\game\game.h" />
<ClInclude Include="src\fheroes2\game\game_credits.h" />
Expand Down
1 change: 1 addition & 0 deletions src/fheroes2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ target_include_directories(
campaign
castle
dialog
editor
game
gui
h2d
Expand Down
19 changes: 18 additions & 1 deletion src/fheroes2/agg/agg_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,15 @@ namespace fheroes2

return true;
}
case ICN::EDITOR:
LoadOriginalICN( id );
if ( !_icnVsSprite[id].empty() ) {
// This is the Editor main menu background which shouldn't have any transform layer.
_icnVsSprite[id][0]._disableTransformLayer();
// Fix the cycling colors in original editor main menu background.
fheroes2::ApplyPalette( _icnVsSprite[id][0], PAL::GetPalette( PAL::PaletteType::NO_CYCLE ) );
}
return true;
case ICN::HEROES:
LoadOriginalICN( id );
if ( !_icnVsSprite[id].empty() ) {
Expand Down Expand Up @@ -3672,7 +3681,15 @@ namespace fheroes2
// We have few ICNs which we need to scale like some related to main screen
bool IsScalableICN( const int id )
{
return id == ICN::HEROES || id == ICN::BTNSHNGL || id == ICN::SHNGANIM;
switch ( id ) {
case ICN::EDITOR:
case ICN::HEROES:
case ICN::BTNSHNGL:
case ICN::SHNGANIM:
return true;
default:
return false;
}
}

const Sprite & GetScaledICN( const int icnId, const uint32_t index )
Expand Down
33 changes: 33 additions & 0 deletions src/fheroes2/editor/editor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/***************************************************************************
* fheroes2: https://github.com/ihhub/fheroes2 *
* Copyright (C) 2023 *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#pragma once

#if defined( WITH_DEBUG )
#include "game.h"
#include "game_mode.h"

namespace Editor
{
fheroes2::GameMode menuMain();
fheroes2::GameMode menuNewMap();
fheroes2::GameMode menuLoadMap();
}
#endif
Loading

0 comments on commit f5ab41d

Please sign in to comment.