From 87e3d64b6395b5f5a7b90e722cc6d7dea9cb751e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 3 May 2020 03:39:31 -0300 Subject: [PATCH] Added renamed Display::getPixelDensity() to Display::getPixelDensitySize() and now Display::getPixelDensity() returns the float value of the pixel density. Moved the global test to tests/test_all. Added a ui_perf_test used to test specific performance issues in the UI. Fixed the element/widget inline style (now respects the specificity). Some optimizations in UIListBox. --- bin/assets/layouts/test_widgets.xml | 4 +- include/eepp/ui/css/stylesheetproperty.hpp | 3 +- include/eepp/ui/uiwidget.hpp | 2 +- include/eepp/window/displaymanager.hpp | 4 +- premake4.lua | 20 ++-- premake5.lua | 20 ++-- projects/linux/ee.creator.user | 82 +++++++++++++++- projects/linux/ee.files | 6 +- src/eepp/ui/css/stylesheetproperty.cpp | 7 +- src/eepp/ui/uilistbox.cpp | 37 +++---- src/eepp/ui/uistyle.cpp | 28 +++--- src/eepp/ui/uitextview.cpp | 2 +- src/eepp/ui/uiwidget.cpp | 10 +- src/eepp/window/displaymanager.cpp | 6 +- src/eepp/window/engine.cpp | 2 +- .../eetest.cpp => tests/test_all/test.cpp} | 2 +- .../eetest.hpp => tests/test_all/test.hpp} | 0 src/tests/ui_perf_test/ui_perf_test.cpp | 97 +++++++++++++++++++ src/tools/mapeditor/mapeditor.cpp | 2 +- .../textureatlaseditor/textureatlaseditor.cpp | 2 +- src/tools/uieditor/uieditor.cpp | 2 +- 21 files changed, 263 insertions(+), 75 deletions(-) rename src/{test/eetest.cpp => tests/test_all/test.cpp} (99%) rename src/{test/eetest.hpp => tests/test_all/test.hpp} (100%) create mode 100644 src/tests/ui_perf_test/ui_perf_test.cpp diff --git a/bin/assets/layouts/test_widgets.xml b/bin/assets/layouts/test_widgets.xml index d623cc3a6..642e1f664 100644 --- a/bin/assets/layouts/test_widgets.xml +++ b/bin/assets/layouts/test_widgets.xml @@ -62,7 +62,7 @@ - + @@ -70,7 +70,7 @@ - + diff --git a/include/eepp/ui/css/stylesheetproperty.hpp b/include/eepp/ui/css/stylesheetproperty.hpp index 6a97ec3eb..d7ac05a53 100644 --- a/include/eepp/ui/css/stylesheetproperty.hpp +++ b/include/eepp/ui/css/stylesheetproperty.hpp @@ -38,7 +38,8 @@ class EE_API StyleSheetProperty { const Uint32& index = 0 ); explicit StyleSheetProperty( const std::string& name, const std::string& value, - const bool& trimValue = true ); + const bool& trimValue = true, const Uint32& specificity = 0, + const Uint32& index = 0 ); explicit StyleSheetProperty( const std::string& name, const std::string& value, const Uint32& specificity, const bool& isVolatile = false, diff --git a/include/eepp/ui/uiwidget.hpp b/include/eepp/ui/uiwidget.hpp index 5f8d30883..656e992ae 100644 --- a/include/eepp/ui/uiwidget.hpp +++ b/include/eepp/ui/uiwidget.hpp @@ -65,7 +65,7 @@ class EE_API UIWidget : public UINode { void updateAnchorsDistances(); - Rect getLayoutMargin() const; + const Rect& getLayoutMargin() const; UIWidget* setLayoutMargin( const Rect& margin ); diff --git a/include/eepp/window/displaymanager.hpp b/include/eepp/window/displaymanager.hpp index e2d20625d..17af78061 100644 --- a/include/eepp/window/displaymanager.hpp +++ b/include/eepp/window/displaymanager.hpp @@ -31,7 +31,9 @@ class EE_API Display { virtual ~Display(); - PixelDensitySize getPixelDensity(); + PixelDensitySize getPixelDensitySize(); + + Float getPixelDensity(); protected: int index; diff --git a/premake4.lua b/premake4.lua index ee0ed5301..d6089ae00 100644 --- a/premake4.lua +++ b/premake4.lua @@ -981,12 +981,6 @@ solution "eepp" build_eepp( "eepp" ) -- Examples - project "eepp-test" - set_kind() - language "C++" - files { "src/test/*.cpp" } - build_link_configuration( "eepp-test", true ) - project "eepp-external-shader" set_kind() language "C++" @@ -1076,6 +1070,20 @@ solution "eepp" files { "src/tools/texturepacker/*.cpp" } build_link_configuration( "eepp-TexturePacker", true ) + -- Tests + project "eepp-test" + set_kind() + language "C++" + files { "src/tests/test_all/*.cpp" } + build_link_configuration( "eepp-test", true ) + + project "eepp-ui-perf-test" + set_kind() + language "C++" + files { "src/tests/ui_perf_test/*.cpp" } + includedirs { "src/thirdparty" } + build_link_configuration( "eepp-ui-perf-test", true ) + if os.isfile("external_projects.lua") then dofile("external_projects.lua") end diff --git a/premake5.lua b/premake5.lua index fbf0e19ec..43ace94a6 100644 --- a/premake5.lua +++ b/premake5.lua @@ -732,12 +732,6 @@ workspace "eepp" build_eepp( "eepp" ) -- Examples - project "eepp-test" - set_kind() - language "C++" - files { "src/test/*.cpp" } - build_link_configuration( "eepp-test", true ) - project "eepp-external-shader" set_kind() language "C++" @@ -826,6 +820,20 @@ workspace "eepp" files { "src/tools/texturepacker/*.cpp" } build_link_configuration( "eepp-TexturePacker", true ) + -- Tests + project "eepp-test" + set_kind() + language "C++" + files { "src/tests/test_all/*.cpp" } + build_link_configuration( "eepp-test", true ) + + project "eepp-ui-perf-test" + set_kind() + language "C++" + files { "src/tests/ui_perf_test/*.cpp" } + includedirs { "src/thirdparty" } + build_link_configuration( "eepp-ui-perf-test", true ) + if os.isfile("external_projects.lua") then dofile("external_projects.lua") end diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index c182b7e4a..3808bb948 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -1531,7 +1531,7 @@ eepp-UIEditor-debug ProjectExplorer.CustomExecutableRunConfiguration - -x assets/layouts/test.xml -c assets/layouts/test.css -u + -x assets/layouts/test_widgets.xml -c assets/ui/breeze.css false true @@ -1695,6 +1695,82 @@ %{buildDir}../../../bin/ + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 0 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + %{buildDir}../../../bin/eepp-ui-perf-test-debug + eepp-ui-perf-test-debug + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + true + false + false + false + false + false + %{buildDir}../../../bin/ + + dwarf @@ -2303,7 +2379,7 @@ %{buildDir}../../../bin/ - 18 + 19 diff --git a/projects/linux/ee.files b/projects/linux/ee.files index 2bf4bf8fa..cb1e04a6b 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -908,7 +908,11 @@ ../../src/examples/ui_hello_world/ui_hello_world.cpp ../../src/examples/vbo_fbo_batch/vbo_fbo_batch.cpp ../../src/test/eetest.cpp -../../src/test/eetest.hpp +../../src/tests/test_all/test.cpp +../../src/tests/test_all/test.hpp +../../src/tests/test_everything/test.cpp +../../src/tests/test_everything/test.hpp +../../src/tests/ui_perf_test/ui_perf_test.cpp ../../src/thirdparty/SOIL2/src/SOIL2/etc1_utils.c ../../src/thirdparty/SOIL2/src/SOIL2/etc1_utils.h ../../src/thirdparty/SOIL2/src/SOIL2/image_DXT.c diff --git a/src/eepp/ui/css/stylesheetproperty.cpp b/src/eepp/ui/css/stylesheetproperty.cpp index 938b85f47..161b6791d 100644 --- a/src/eepp/ui/css/stylesheetproperty.cpp +++ b/src/eepp/ui/css/stylesheetproperty.cpp @@ -64,13 +64,14 @@ StyleSheetProperty::StyleSheetProperty( const bool& isVolatile, } StyleSheetProperty::StyleSheetProperty( const std::string& name, const std::string& value, - const bool& trimValue ) : + const bool& trimValue, const Uint32& specificity, + const Uint32& index ) : mName( String::toLower( String::trim( name ) ) ), mNameHash( String::hash( mName ) ), mValue( trimValue ? String::trim( value ) : value ), mValueHash( String::hash( mValue ) ), - mSpecificity( 0 ), - mIndex( 0 ), + mSpecificity( specificity ), + mIndex( index ), mVolatile( false ), mImportant( false ), mIsVarValue( false ), diff --git a/src/eepp/ui/uilistbox.cpp b/src/eepp/ui/uilistbox.cpp index 2d6f63e6d..8a117c718 100644 --- a/src/eepp/ui/uilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -51,24 +51,21 @@ UIListBox::UIListBox( const std::string& tag ) : mContainer->setPosition( 0, 0 ); mContainer->clipEnable(); - mVScrollBar = UIScrollBar::New(); - mVScrollBar->setOrientation( UIOrientation::Vertical ); + mVScrollBar = UIScrollBar::NewVertical(); mVScrollBar->setParent( this ); mVScrollBar->setPosition( getSize().getWidth() - 8, 0 ); mVScrollBar->setSize( 8, getSize().getHeight() ); mVScrollBar->setEnabled( false )->setVisible( false ); mVScrollBar->addEventListener( Event::OnSizeChange, cb ); + mVScrollBar->addEventListener( Event::OnValueChange, + cb::Make1( this, &UIListBox::onScrollValueChange ) ); - mHScrollBar = UIScrollBar::New(); - mHScrollBar->setOrientation( UIOrientation::Horizontal ); + mHScrollBar = UIScrollBar::NewHorizontal(); mHScrollBar->setParent( this ); mHScrollBar->setSize( getSize().getWidth() - mVScrollBar->getSize().getWidth(), 8 ); mHScrollBar->setPosition( 0, getSize().getHeight() - 8 ); mHScrollBar->setEnabled( false )->setVisible( false ); mHScrollBar->addEventListener( Event::OnSizeChange, cb ); - - mVScrollBar->addEventListener( Event::OnValueChange, - cb::Make1( this, &UIListBox::onScrollValueChange ) ); mHScrollBar->addEventListener( Event::OnValueChange, cb::Make1( this, &UIListBox::onHScrollValueChange ) ); @@ -131,9 +128,11 @@ void UIListBox::addListBoxItems( std::vector Texts ) { mTexts.reserve( mTexts.size() + Texts.size() ); for ( Uint32 i = 0; i < Texts.size(); i++ ) { - addListBoxItem( Texts[i] ); + mTexts.push_back( Texts[i] ); + mItems.push_back( NULL ); } + updatePageStep(); updateScroll(); } @@ -164,22 +163,6 @@ Uint32 UIListBox::addListBoxItem( const String& text ) { mTexts.push_back( text ); mItems.push_back( NULL ); - const UIFontStyleConfig& fontStyleConfig = mDummyItem->getFontStyleConfig(); - - if ( NULL != fontStyleConfig.getFont() ) { - Text textCache; - textCache.setStyleConfig( fontStyleConfig ); - textCache.setString( text ); - - Uint32 twidth = textCache.getTextWidth(); - - if ( twidth > mMaxTextWidth ) { - mMaxTextWidth = twidth; - - updateListBoxItemsSize(); - } - } - updatePageStep(); updateScroll(); @@ -412,8 +395,6 @@ void UIListBox::updateListBoxItemsSize() { for ( Uint32 i = 0; i < size; i++ ) itemUpdateSize( mItems[i] ); - - invalidateDraw(); } void UIListBox::itemUpdateSize( UIListBoxItem* Item ) { @@ -545,6 +526,7 @@ void UIListBox::updateScroll( bool fromScrollChange ) { bool wasScrollVisible = mVScrollBar->isVisible(); bool wasHScrollVisible = mHScrollBar->isVisible(); + bool wasFirstTime = mVisibleFirst == 0 && mVisibleLast == 0; updateScrollBarState(); @@ -682,6 +664,9 @@ void UIListBox::updateScroll( bool fromScrollChange ) { setHScrollStep(); + if ( wasFirstTime ) + updateScrollBarState(); + invalidateDraw(); } diff --git a/src/eepp/ui/uistyle.cpp b/src/eepp/ui/uistyle.cpp index 7f8693115..e79fcf4ca 100644 --- a/src/eepp/ui/uistyle.cpp +++ b/src/eepp/ui/uistyle.cpp @@ -37,24 +37,22 @@ bool UIStyle::stateExists( const EE::Uint32& ) const { } void UIStyle::setStyleSheetProperty( const StyleSheetProperty& property ) { - std::vector properties; - if ( StyleSheetSpecification::instance()->isShorthand( property.getName() ) ) { + std::vector properties; + properties = StyleSheetSpecification::instance() ->getShorthand( property.getName() ) ->parse( property.getValue() ); - } else { - properties.emplace_back( property ); - } - for ( auto& prop : properties ) { - mElementStyle.get()->setProperty( prop ); + for ( auto& prop : properties ) { + mElementStyle->setProperty( prop ); + } + } else { + mElementStyle->setProperty( property ); } } void UIStyle::load() { - mElementStyle->clearProperties(); - mGlobalDefinition = mWidget->getUISceneNode()->getStyleSheet().getElementStyles( mWidget, false ); @@ -664,12 +662,12 @@ void UIStyle::removeAnimation( const PropertyDefinition* propertyDefinition, } StyleSheetProperty* UIStyle::getLocalProperty( Uint32 propId ) { - StyleSheetProperty* property = nullptr; - if ( nullptr != mDefinition ) - property = mDefinition->getProperty( propId ); - if ( nullptr == property ) - return mElementStyle->getPropertyById( propId ); - return property; + StyleSheetProperty* defProperty = mDefinition->getProperty( propId ); + StyleSheetProperty* elemProperty = mElementStyle->getPropertyById( propId ); + if ( defProperty && elemProperty ) + return defProperty->getSpecificity() > elemProperty->getSpecificity() ? defProperty + : elemProperty; + return defProperty ? defProperty : elemProperty; } }} // namespace EE::UI diff --git a/src/eepp/ui/uitextview.cpp b/src/eepp/ui/uitextview.cpp index e032be941..467c8f293 100644 --- a/src/eepp/ui/uitextview.cpp +++ b/src/eepp/ui/uitextview.cpp @@ -631,7 +631,7 @@ bool UITextView::applyProperty( const StyleSheetProperty& attribute ) { break; } case PropertyId::FontSize: - setFontSize( attribute.asDpDimensionI() ); + setFontSize( lengthFromValueAsDp( attribute ) ); break; case PropertyId::FontStyle: { Uint32 flags = attribute.asFontStyle(); diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index 8720620fd..3eed41689 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -79,7 +79,7 @@ void UIWidget::updateAnchorsDistances() { } } -Rect UIWidget::getLayoutMargin() const { +const Rect& UIWidget::getLayoutMargin() const { return mLayoutMargin; } @@ -1720,14 +1720,18 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) { for ( pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait ) { // Create a property without triming its value - StyleSheetProperty prop( ait->name(), ait->value(), false ); + StyleSheetProperty prop( ait->name(), ait->value(), false, + StyleSheetSelectorRule::SpecificityInline ); if ( prop.getShorthandDefinition() != NULL ) { auto properties = prop.getShorthandDefinition()->parse( ait->value() ); - for ( auto& property : properties ) + for ( auto& property : properties ) { + mStyle->setStyleSheetProperty( property ); applyProperty( property ); + } } else { + mStyle->setStyleSheetProperty( prop ); applyProperty( prop ); } } diff --git a/src/eepp/window/displaymanager.cpp b/src/eepp/window/displaymanager.cpp index d3f7244ae..03c00c581 100644 --- a/src/eepp/window/displaymanager.cpp +++ b/src/eepp/window/displaymanager.cpp @@ -4,10 +4,14 @@ namespace EE { namespace Window { Display::Display( int displayIndex ) : index( displayIndex ) {} -PixelDensitySize Display::getPixelDensity() { +PixelDensitySize Display::getPixelDensitySize() { return PixelDensity::fromDPI( getDPI() ); } +Float Display::getPixelDensity() { + return PixelDensity::toFloat( PixelDensity::fromDPI( getDPI() ) ); +} + Display::~Display() {} DisplayManager::~DisplayManager() { diff --git a/src/eepp/window/engine.cpp b/src/eepp/window/engine.cpp index 44fb01d80..1c0748bb8 100644 --- a/src/eepp/window/engine.cpp +++ b/src/eepp/window/engine.cpp @@ -249,7 +249,7 @@ WindowSettings Engine::createWindowSettings( IniFile* ini, std::string iniKeyNam if ( !pixelDensityStr.empty() ) { if ( String::toLower( pixelDensityStr ) == "auto" ) { Display* currentDisplay = Engine::instance()->getDisplayManager()->getDisplayIndex( 0 ); - pixelDensity = PixelDensity::toFloat( currentDisplay->getPixelDensity() ); + pixelDensity = currentDisplay->getPixelDensity(); } else { float pd = 1; bool res = String::fromString( pd, pixelDensityStr ); diff --git a/src/test/eetest.cpp b/src/tests/test_all/test.cpp similarity index 99% rename from src/test/eetest.cpp rename to src/tests/test_all/test.cpp index 307d207ce..58ca2a1d8 100644 --- a/src/test/eetest.cpp +++ b/src/tests/test_all/test.cpp @@ -1,4 +1,4 @@ -#include "eetest.hpp" +#include "test.hpp" Demo_Test::EETest* TestInstance = NULL; diff --git a/src/test/eetest.hpp b/src/tests/test_all/test.hpp similarity index 100% rename from src/test/eetest.hpp rename to src/tests/test_all/test.hpp diff --git a/src/tests/ui_perf_test/ui_perf_test.cpp b/src/tests/ui_perf_test/ui_perf_test.cpp new file mode 100644 index 000000000..b1f4ba613 --- /dev/null +++ b/src/tests/ui_perf_test/ui_perf_test.cpp @@ -0,0 +1,97 @@ +#include + +// This file is used to test some UI related stuffs. +// It's not a benchmark or a real test suite. +// It's just used to test whatever I need to test at any given moment. + +EE::Window::Window* win = NULL; + +void mainLoop() { + win->getInput()->update(); + + if ( win->getInput()->isKeyUp( KEY_ESCAPE ) ) { + win->close(); + } + + // Update the UI scene. + SceneManager::instance()->update(); + + // Check if the UI has been invalidated ( needs redraw ). + if ( SceneManager::instance()->getUISceneNode()->invalidated() ) { + win->clear(); + + // Redraw the UI scene. + SceneManager::instance()->draw(); + + win->display(); + } else { + Sys::sleep( Milliseconds( 8 ) ); + } +} + +EE_MAIN_FUNC int main( int argc, char* argv[] ) { + win = Engine::instance()->createWindow( WindowSettings( 320, 240, "eepp - UI Hello World" ), + ContextSettings( true ) ); + + if ( win->isOpen() ) { + PixelDensity::setPixelDensity( + Engine::instance()->getDisplayManager()->getDisplayIndex( 0 )->getPixelDensity() ); + FontTrueType* font = + FontTrueType::New( "NotoSans-Regular", "assets/fonts/NotoSans-Regular.ttf" ); + UISceneNode* uiSceneNode = UISceneNode::New(); + SceneManager::instance()->add( uiSceneNode ); + uiSceneNode->getUIThemeManager()->setDefaultFont( font ); + StyleSheetParser styleSheetParser; + styleSheetParser.loadFromFile( "assets/ui/breeze.css" ); + uiSceneNode->setStyleSheet( styleSheetParser.getStyleSheet() ); + std::vector strings; + for ( size_t i = 0; i < 10000; i++ ) + strings.emplace_back( String::format( + "This is a very long string number %ld. Cover the full width of the listbox.", + i ) ); + + auto* vlay = UILinearLayout::NewVertical(); + vlay->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::MatchParent ); + + Clock clock, total; + /* ListBox test *//* + auto* lbox = UIListBox::New(); + std::cout << "Time New: " << clock.getElapsed().asMilliseconds() << " ms" << std::endl; + lbox->setParent( vlay ); + std::cout << "Time setParent: " << clock.getElapsed().asMilliseconds() << " ms" + << std::endl; + lbox->setLayoutMargin( Rect( 4, 4, 4, 4 ) ); + std::cout << "Time setLayoutMargin: " << clock.getElapsed().asMilliseconds() << " ms" + << std::endl; + lbox->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::MatchParent ); + std::cout << "Time setLayoutSizePolicy: " << clock.getElapsed().asMilliseconds() << " ms" + << std::endl; + for ( size_t i = 0; i < 10; i++ ) + lbox->addListBoxItem( String::format( + "This is a very long string number %ld. Cover the full width of the listbox.", + i ) ); + std::cout << "Time addListBoxItem: " << clock.getElapsed().asMilliseconds() << " ms" + << std::endl; + lbox->addListBoxItems( strings ); + std::cout << "Time addListBoxItems: " << clock.getElapsed().asMilliseconds() << " ms" + << std::endl; + */ + /* Create Widget test */ + for ( size_t i = 0; i < 5000; i++ ) { + auto* widget = UIWidget::New(); + widget->setParent( vlay ); + //widget->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent ); + } + std::cout << "Time total: " << total.getElapsedTime().asMilliseconds() << " ms" + << std::endl; + + win->close(); + + win->runMainLoop( &mainLoop ); + } + + Engine::destroySingleton(); + MemoryManager::showResults(); + + return EXIT_SUCCESS; +} diff --git a/src/tools/mapeditor/mapeditor.cpp b/src/tools/mapeditor/mapeditor.cpp index 9d4ca2407..c27f05d1f 100644 --- a/src/tools/mapeditor/mapeditor.cpp +++ b/src/tools/mapeditor/mapeditor.cpp @@ -75,7 +75,7 @@ void mainLoop() { EE_MAIN_FUNC int main( int argc, char* argv[] ) { Display* currentDisplay = Engine::instance()->getDisplayManager()->getDisplayIndex( 0 ); - Float pixelDensity = PixelDensity::toFloat( currentDisplay->getPixelDensity() ); + Float pixelDensity = currentDisplay->getPixelDensity(); win = Engine::instance()->createWindow( WindowSettings( 1280, 720, "eepp - Map Editor", WindowStyle::Default, diff --git a/src/tools/textureatlaseditor/textureatlaseditor.cpp b/src/tools/textureatlaseditor/textureatlaseditor.cpp index a977d41de..7f2f4ca74 100644 --- a/src/tools/textureatlaseditor/textureatlaseditor.cpp +++ b/src/tools/textureatlaseditor/textureatlaseditor.cpp @@ -74,7 +74,7 @@ void mainLoop() { EE_MAIN_FUNC int main( int argc, char* argv[] ) { Display* currentDisplay = Engine::instance()->getDisplayManager()->getDisplayIndex( 0 ); - Float pixelDensity = PixelDensity::toFloat( currentDisplay->getPixelDensity() ); + Float pixelDensity = currentDisplay->getPixelDensity(); win = Engine::instance()->createWindow( WindowSettings( 1280, 720, "eepp - Texture Atlas Editor", WindowStyle::Default, diff --git a/src/tools/uieditor/uieditor.cpp b/src/tools/uieditor/uieditor.cpp index 4ca0b5abd..3f1afaa71 100644 --- a/src/tools/uieditor/uieditor.cpp +++ b/src/tools/uieditor/uieditor.cpp @@ -965,7 +965,7 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { fileWatcher->watch(); Display* currentDisplay = Engine::instance()->getDisplayManager()->getDisplayIndex( 0 ); - Float pixelDensity = PixelDensity::toFloat( currentDisplay->getPixelDensity() ); + Float pixelDensity = currentDisplay->getPixelDensity(); if ( pixelDenstiyConf ) { pixelDensity = pixelDenstiyConf.Get();