Skip to content
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.

GUIのフォントサイズ調整を軽量化 #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,49 +142,6 @@
/DxLib/libbulletcollision_vs2012_x64_d.lib
/DxLib/libbulletcollision_vs2012_x64.lib

/DxLib/DxUseCLib_vs2013_x86_ItrDbgLv0_d.lib
/DxLib/DxUseCLib_vs2013_x86_d.lib
/DxLib/DxUseCLib_vs2013_x86.lib
/DxLib/DxUseCLib_vs2013_x64_ItrDbgLv0_d.lib
/DxLib/DxUseCLib_vs2013_x64_d.lib
/DxLib/DxUseCLib_vs2013_x64.lib
/DxLib/DxUseCLib_vs2012_x86_ItrDbgLv0_d.lib
/DxLib/DxUseCLib_vs2012_x86_d.lib
/DxLib/DxUseCLib_vs2012_x86.lib
/DxLib/DxUseCLib_vs2012_x64_ItrDbgLv0_d.lib
/DxLib/DxUseCLib_vs2012_x64_d.lib
/DxLib/DxUseCLib_vs2012_x64.lib

/DxLib/DxUseCLibW_vs2013_x86_ItrDbgLv0_d.lib
/DxLib/DxUseCLibW_vs2013_x86_d.lib
/DxLib/DxUseCLibW_vs2013_x86.lib
/DxLib/DxUseCLibW_vs2013_x64_ItrDbgLv0_d.lib
/DxLib/DxUseCLibW_vs2013_x64_d.lib
/DxLib/DxUseCLibW_vs2013_x64.lib
/DxLib/DxUseCLibW_vs2012_x86_ItrDbgLv0_d.lib
/DxLib/DxUseCLibW_vs2012_x86_d.lib
/DxLib/DxUseCLibW_vs2012_x86.lib
/DxLib/DxUseCLibW_vs2012_x64_ItrDbgLv0_d.lib
/DxLib/DxUseCLibW_vs2012_x64_d.lib
/DxLib/DxUseCLibW_vs2012_x64.lib

/DxLib/DxLib_vs2012_x86_d.lib
/DxLib/DxLib_vs2012_x86.lib
/DxLib/DxLib_vs2012_x64_d.lib
/DxLib/DxLib_vs2012_x64.lib

/DxLib/DxLibW_vs2012_x86_d.lib
/DxLib/DxLibW_vs2012_x86.lib
/DxLib/DxLibW_vs2012_x64_d.lib
/DxLib/DxLibW_vs2012_x64.lib
/DxLib/DxLibW_d.lib
/DxLib/DxLibW.lib

/DxLib/DxDrawFunc_vs2012_x86_d.lib
/DxLib/DxDrawFunc_vs2012_x86.lib
/DxLib/DxDrawFunc_vs2012_x64_d.lib
/DxLib/DxDrawFunc_vs2012_x64.lib

/DxLib/celt_vs2013_x86_d.lib
/DxLib/celt_vs2013_x86.lib
/DxLib/celt_vs2013_x64_d.lib
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "EventSystem"]
path = EventSystem
url = https://github.com/NoixChou/EventSystem.git
Binary file added DxLib/DxDrawFunc_vs2012_x64.lib
Binary file not shown.
Binary file added DxLib/DxDrawFunc_vs2012_x64_d.lib
Binary file not shown.
Binary file added DxLib/DxDrawFunc_vs2012_x86.lib
Binary file not shown.
Binary file added DxLib/DxDrawFunc_vs2012_x86_d.lib
Binary file not shown.
Binary file added DxLib/DxLibW.lib
Binary file not shown.
Binary file added DxLib/DxLibW_d.lib
Binary file not shown.
Binary file added DxLib/DxLibW_vs2012_x64.lib
Binary file not shown.
Binary file added DxLib/DxLibW_vs2012_x64_d.lib
Binary file not shown.
Binary file added DxLib/DxLibW_vs2012_x86.lib
Binary file not shown.
Binary file added DxLib/DxLibW_vs2012_x86_d.lib
Binary file not shown.
Binary file added DxLib/DxLib_vs2012_x64.lib
Binary file not shown.
Binary file added DxLib/DxLib_vs2012_x64_d.lib
Binary file not shown.
Binary file added DxLib/DxLib_vs2012_x86.lib
Binary file not shown.
Binary file added DxLib/DxLib_vs2012_x86_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2012_x64.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2012_x64_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2012_x64_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2012_x86.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2012_x86_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2012_x86_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2013_x64.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2013_x64_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2013_x64_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2013_x86.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2013_x86_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLibW_vs2013_x86_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2012_x64.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2012_x64_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2012_x64_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2012_x86.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2012_x86_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2012_x86_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2013_x64.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2013_x64_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2013_x64_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2013_x86.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2013_x86_ItrDbgLv0_d.lib
Binary file not shown.
Binary file added DxLib/DxUseCLib_vs2013_x86_d.lib
Binary file not shown.
1 change: 1 addition & 0 deletions EventSystem
Submodule EventSystem added at cd5fdc
10 changes: 9 additions & 1 deletion Otoge/Game/Scenes/Title/TitleScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ TitleScene::TitleScene() : Scene("TitleScene")
MenuOpener_->SetPriority(10.f);
AddChildTask(std::static_pointer_cast<Task>(MenuOpener_));

MenuOpener_->testEvent += events::EventHandler<bool, events::Event&>(this, &TitleScene::TestHandler);

//メニュー項目ボタン
auto l_GroupScreen = ScreenData(20.f, 43.f, 60.f, 14.f);
MenuGroup_ = std::make_shared<Scene>("MenuGroup", l_GroupScreen, DefaultScaler_);
Expand Down Expand Up @@ -203,4 +205,10 @@ void TitleScene::Draw()
engine::CastToInt(fixed.posY),
engine::CastToInt(fixed.width),
engine::CastToInt(fixed.height), color_preset::BLACK, TRUE);
}
}

bool TitleScene::TestHandler(events::Event& e) const
{
Logger_->Warn("Called Event: " + e.name);
return true;
}
5 changes: 4 additions & 1 deletion Otoge/Game/Scenes/Title/TitleScene.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#pragma once
#include "EventSystem/Include/EventSystem.hpp"
#include "../../../System/Task/Scene.hpp"
#include "../../../Util/Calculate/Screen/FlexibleScaler.hpp"
#include "../../../System/GUI/Button.hpp"

class TitleScene : public Scene
class TitleScene : public Scene, events::ManagedEventListener
{
private:
bool IsOpened_ = false;
Expand All @@ -30,4 +31,6 @@ class TitleScene : public Scene

void SceneUpdate(float deltaTime) override;
void Draw() override;

bool TestHandler(events::Event& e) const;
};
16 changes: 8 additions & 8 deletions Otoge/Otoge.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,24 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)</OutDir>
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)</OutDir>
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)</OutDir>
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)</OutDir>
<OutDir>$(SolutionDir)Bin\$(Configuration)\$(PlatformTarget)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../DxLib; $(BOOST_DIR) ;System/PrecompiledHeader</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../DxLib; ../EventSystem; $(BOOST_DIR) ;System/PrecompiledHeader</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
Expand All @@ -128,7 +128,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../DxLib;$(BOOST_DIR);System/PrecompiledHeader</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../DxLib; ../EventSystem; $(BOOST_DIR) ;System/PrecompiledHeader</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
Expand All @@ -154,7 +154,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../DxLib; $(BOOST_DIR) ;System/PrecompiledHeader</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../DxLib; ../EventSystem; $(BOOST_DIR) ;System/PrecompiledHeader</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
Expand Down Expand Up @@ -184,7 +184,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../DxLib; $(BOOST_DIR) ;System/PrecompiledHeader</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../DxLib; ../EventSystem; $(BOOST_DIR) ;System/PrecompiledHeader</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
Expand Down
2 changes: 0 additions & 2 deletions Otoge/System/GUI/DropdownList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,11 @@ void DropdownList<V>::GUIUpdate(float deltaTime)
{
AddPanel();
InvertOpening();
Logger_->Warn("ボタンクリックで切り替え");
}
else
{
if (MouseManager::GetInstance()->IsDownButton(MOUSE_INPUT_LEFT) && (!Panel_->IsOnMouse() && !IsOnMouse()) && IsListOpened_)
{
Logger_->Warn("範囲外クリックで閉じる");
CloseList();
}
}
Expand Down
21 changes: 17 additions & 4 deletions Otoge/System/GUI/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "../../Util/Window/DxSettings.hpp"
#include "../../Util/Encoding/CharacterType.hpp"
#include "../../Util/Encoding/EncodingConverter.h"

int GUI::GlobalGUICount_ = 0;
int GUI::JapaneseFontCount_ = 0;
char* GUI::JapaneseFonts_ = nullptr;
Expand Down Expand Up @@ -56,6 +57,13 @@ void GUI::SceneUpdate(float deltaTime)
{
AdjustFont();
}
if(IsClickedMouse())
{
events::Event e;
e.name = "testClickEvent";
testEvent(e);
}

GUIUpdate(deltaTime);
IsChangedLabel_ = false;
}
Expand All @@ -77,12 +85,17 @@ std::string GUI::GetLabel() const

void GUI::AdjustFont()
{
//if (((FontStringCalculator::GetStringWidth(FontHandle_, Label_) > GetRawScreenWidth()) &&
// (FontStringCalculator::GetStringHeight(FontHandle_) > GetRawScreenHeight())) ||
// (engine::CompareTolerance(FontStringCalculator::GetStringWidth(FontHandle_, Label_), GetRawScreenWidth(), 0.01f) != 0))
//ChangeFontSize(engine::CastToInt(GetRawScreenHeight()));
if (!IsFontSizeInit_)
{
ChangeFontSize(engine::CastToInt(GetRawScreenHeight()));
IsFontSizeInit_ = true;
}
//ChangeFontSize(engine::CastToInt(GetRawScreenHeight()));

if (((FontStringCalculator::GetStringWidth(FontHandle_, Label_) > GetRawScreenWidth()) &&
(FontStringCalculator::GetStringHeight(FontHandle_) > GetRawScreenHeight())) ||
(engine::CompareTolerance(FontStringCalculator::GetStringWidth(FontHandle_, Label_), GetRawScreenWidth(), 0.01f) != 0))
{

while (FontStringCalculator::GetStringWidth(FontHandle_, Label_) > GetRawScreenWidth())
{
Expand Down
6 changes: 5 additions & 1 deletion Otoge/System/GUI/GUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "../Task/Scene.hpp"
#include "../../Util/Calculate/ScreenData.h"

#include "EventSystem/Include/EventSystem.hpp"

class GUI : public Scene
{
private:
Expand All @@ -11,10 +13,12 @@ class GUI : public Scene
protected:
std::string Label_;
bool IsChangedLabel_ = false;
bool IsFontSizeInit_ = false;
bool IsUseFont_ = false;
int FontHandle_ = -1;
public:
bool adjustmentFontSize = true;
events::Delegate<bool, events::Event&> testEvent;
bool adjustmentFontSize = false;
unsigned baseColor;
GUI(const std::string& guiName, const ScreenData& layoutScreen,
std::shared_ptr<FlexibleScaler> parentScaler = nullptr, bool isUseFont = false);
Expand Down
3 changes: 2 additions & 1 deletion Otoge/Util/Calculate/Screen/FlexibleScaler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FlexibleScaler::~FlexibleScaler()
auto result = std::find(Scalers_.begin(), Scalers_.end(), this);
if(result == Scalers_.end())
{
Logger::LowLevelLog("Broken scaler list!!!", "CRITICAL");
Logger::LowLevelLog("Broken scaler list!", "CRITICAL");
}
else
{
Expand All @@ -44,6 +44,7 @@ void FlexibleScaler::ApplyWindowSizeChanges()
s->SetScreenWidth(s->CalculateWidth(GlobalInstance_->CalculatePositionRateX(s->GetScreenWidth())));
s->SetScreenHeight(s->CalculateHeight(GlobalInstance_->CalculatePositionRateY(s->GetScreenHeight())));
}
Logger::LowLevelLog("Completed SizeChange", "FlexScaler");
}

std::shared_ptr<FlexibleScaler> FlexibleScaler::GetWindowBasedInstance()
Expand Down
7 changes: 5 additions & 2 deletions Otoge/Util/Debug/DebugScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ DebugScene::DebugScene() : Scene("DebugScene")
FpsLabel_->baseColor = color_preset::LEAF_GREEN;
FpsLabel_->textAlign = Label::TextAlignment::middle | Label::TextAlignment::right;
FpsLabel_->ChangeFontThickness(8);
FpsLabel_->adjustmentFontSize = true;
l_FpsPanel->AddChildTask(std::static_pointer_cast<Task>(FpsLabel_));
FpsDescLabel_ = std::make_shared<Label>("fps", ScreenData(70.f, 0.f, 30.f, 100.f),
l_FpsPanel->GetDefaultScaler());
FpsDescLabel_->baseColor = color_preset::LEAF_GREEN;
FpsDescLabel_->textAlign = Label::TextAlignment::bottom | Label::TextAlignment::center;
FpsDescLabel_->ChangeFontThickness(2);
FpsDescLabel_->adjustmentFontSize = false;
FpsDescLabel_->adjustmentFontSize = true;
FpsDescLabel_->ChangeFontSize(static_cast<int>(l_FpsPanel->GetDefaultScaler()->CalculateHeight(70.f)));
l_FpsPanel->AddChildTask(std::static_pointer_cast<Task>(FpsDescLabel_));
}
Expand All @@ -62,17 +63,19 @@ DebugScene::DebugScene() : Scene("DebugScene")
DeltaTimeLabel_->baseColor = color_preset::LEMON_YELLOW;
DeltaTimeLabel_->textAlign = Label::TextAlignment::middle | Label::TextAlignment::right;
DeltaTimeLabel_->ChangeFontThickness(6);
DeltaTimeLabel_->adjustmentFontSize = true;
l_DeltaTimePanel->AddChildTask(std::static_pointer_cast<Task>(DeltaTimeLabel_));
DeltaTimeDescLabel_ = std::make_shared<Label>(" ms", ScreenData(70.f, 0.f, 30.f, 100.f),
l_DeltaTimePanel->GetDefaultScaler());
DeltaTimeDescLabel_->baseColor = color_preset::LEMON_YELLOW;
DeltaTimeDescLabel_->textAlign = Label::TextAlignment::bottom | Label::TextAlignment::center;
DeltaTimeDescLabel_->ChangeFontThickness(6);
DeltaTimeDescLabel_->adjustmentFontSize = false;
DeltaTimeDescLabel_->adjustmentFontSize = true;
DeltaTimeDescLabel_->ChangeFontSize(
static_cast<int>(l_DeltaTimePanel->GetDefaultScaler()->CalculateHeight(80.f)));
l_DeltaTimePanel->AddChildTask(std::static_pointer_cast<Task>(DeltaTimeDescLabel_));
}

SetTransparent(80.f);
SetPriority(100.f);
}
Expand Down
5 changes: 4 additions & 1 deletion Otoge/Util/Debug/DebugScene.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#pragma once
#include "EventSystem/Include/EventSystem.hpp"
#include "../../System/Task/Scene.hpp"
#include "../../System/GUI/Label.hpp"
#include "../../System/GUI/Button.hpp"

class DebugScene : public Scene
class DebugScene : public Scene, public events::ManagedEventListener
{
private:
std::shared_ptr<Label> FpsLabel_;
std::shared_ptr<Label> FpsDescLabel_;
std::shared_ptr<Label> DeltaTimeLabel_;
std::shared_ptr<Label> DeltaTimeDescLabel_;

public:
DebugScene();
~DebugScene();
Expand Down
3 changes: 2 additions & 1 deletion Otoge/Util/Debug/Logger.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <EventSystem/Include/EventSystem.hpp>

class Logger
class Logger : public events::ManagedEventListener
{
private:
std::string ModuleName_;
Expand Down
1 change: 0 additions & 1 deletion Otoge/Util/Event/Event.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions Otoge/Util/Event/Event.hpp

This file was deleted.

1 change: 0 additions & 1 deletion Otoge/Util/Event/EventHandler.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions Otoge/Util/Event/EventHandler.hpp

This file was deleted.

11 changes: 0 additions & 11 deletions Otoge/Util/Event/EventManager.cpp

This file was deleted.

13 changes: 0 additions & 13 deletions Otoge/Util/Event/EventManager.hpp

This file was deleted.