Transitions mostly working.

--HG--
branch : dev-css-refactor
This commit is contained in:
Martín Lucas Golini
2019-11-30 03:51:44 -03:00
parent 44eb8cdf8d
commit 2c64910048
8 changed files with 123 additions and 112 deletions

View File

@@ -59,6 +59,7 @@ std::string basePath;
Vector2i mousePos;
Clock mouseClock;
Console * console = NULL;
std::map<std::string,std::string> layouts;
std::vector<std::string> recentProjects;
@@ -697,6 +698,10 @@ void mainLoop() {
window->close();
}
if ( window->getInput()->isKeyUp( KEY_F3 ) || window->getInput()->isKeyUp( KEY_WORLD_26 ) || window->getInput()->isKeyUp( KEY_BACKSLASH ) ) {
console->toggle();
}
if ( NULL != uiContainer && window->getInput()->isKeyUp( KEY_F1 ) ) {
resizeWindowToLayout();
}
@@ -722,6 +727,11 @@ void mainLoop() {
refreshStyleSheet();
}
if ( console->isActive() || console->isFading() ) {
appUiSceneNode->invalidate();
uiSceneNode->invalidate();
}
SceneManager::instance()->update();
if ( appUiSceneNode->invalidated() || uiSceneNode->invalidated() ) {
@@ -729,6 +739,8 @@ void mainLoop() {
SceneManager::instance()->draw();
console->draw();
window->display();
} else {
Sys::sleep( Milliseconds(8) );
@@ -828,6 +840,16 @@ EE_MAIN_FUNC int main (int argc, char * argv []) {
window->setCloseRequestCallback( cb::Make1( onCloseRequestCallback ) );
std::string pd;
if ( PixelDensity::getPixelDensity() >= 1.5f ) pd = "1.5x";
else if ( PixelDensity::getPixelDensity() >= 2.f ) pd = "2x";
FontTrueType * font = FontTrueType::New( "NotoSans-Regular", "assets/fonts/NotoSans-Regular.ttf" );
console = eeNew( Console, ( font, true, true, 1024 * 1000, 0, window ) );
theme = UITheme::load( "uitheme" + pd, "uitheme" + pd, "assets/ui/uitheme" + pd + ".eta", font, "assets/ui/uitheme.css" );
uiSceneNode = UISceneNode::New();
SceneManager::instance()->add( uiSceneNode );
@@ -837,14 +859,6 @@ EE_MAIN_FUNC int main (int argc, char * argv []) {
appUiSceneNode->enableDrawInvalidation();
uiSceneNode->enableDrawInvalidation();
std::string pd;
if ( PixelDensity::getPixelDensity() >= 1.5f ) pd = "1.5x";
else if ( PixelDensity::getPixelDensity() >= 2.f ) pd = "2x";
FontTrueType * font = FontTrueType::New( "NotoSans-Regular", "assets/fonts/NotoSans-Regular.ttf" );
theme = UITheme::load( "uitheme" + pd, "uitheme" + pd, "assets/ui/uitheme" + pd + ".eta", font, "assets/ui/uitheme.css" );
appUiSceneNode->combineStyleSheet( theme->getStyleSheet() );
UIThemeManager::instance()->setDefaultEffectsEnabled( true )->setDefaultTheme( theme )->setDefaultFont( font )->add( theme );
@@ -909,6 +923,8 @@ EE_MAIN_FUNC int main (int argc, char * argv []) {
saveConfig();
eeSAFE_DELETE( console );
Engine::destroySingleton();
MemoryManager::showResults();