SimpleSplash.cpp
Go to the documentation of this file.
1 #include "SimpleSplash.hpp"
2 
3 namespace iv
4 {
5 
7  Slot( inst ),
8  DelayedLoader( inst ),
9  cm( inst, this, "SimpleSplash" ),
10  anim( inst )
11 {
12  this->cm.inherits( this->Slot::cm, this->DelayedLoader::cm );
13  this->cm.owns( this->anim.cm );
14 
15  auto background = this->createChild< Image >()
16  ->filename( "/ivorium_UI/SimpleSplash/background.png" )
17  ->resizeStage( FlatShader::ResizeStage::Frame )
18  ->translucent( true );
19 
20  auto logo = this->createChild< Border >()
21  ->createChild< Image >()
22  ->filename( "/ivorium_UI/SimpleSplash/logo.png" )
24  ->translucent( true );
25 
26  //------ anim ---------
27  this->in_enabled = this->anim.Node( false )
28  ->label( "in_enabled" );
29 
30  AnimNode< float > * out_background_alpha = this->anim.Attribute_DestinationNode( &background->shading.alpha, 0.0f )
31  ->label( "out_background_alpha" );
32 
33  AnimNode< float > * out_logo_alpha = this->anim.Attribute_DestinationNode( &logo->shading.alpha, 0.0f )
34  ->label( "out_logo_alpha" );
35 
36  AnimNode< float > * state_timeout= this->anim.State_DestinationNode( 0.0f )
37  ->label( "state_timeout" );
38 
39  this->lambda = this->anim.Make_Lambda_Connector()
40  ->AddParent( this->in_enabled )
41  ->AddChild( out_background_alpha )
42  ->AddChild( out_logo_alpha )
43  ->AddChild( state_timeout );
44 
45  this->lambda->Retargeting(
46  [ = ]( bool warping )
47  {
48  //LumaStyle const & style = this->style();
49 
50  if( this->in_enabled->Target() )
51  {
52  out_logo_alpha->Target( 1.0 )
53  ->Speed_inf();
54  out_background_alpha->Target( 1.0 )
55  ->Speed_inf();
56 
57  state_timeout->Target( 0.7f )
58  ->Speed( 1.0f );
59  }
60  else if( state_timeout->IsInTarget() )
61  {
62  state_timeout->Target( 0.0f )
63  ->Speed_inf();
64 
65  out_logo_alpha->Target( 0.0 )
66  ->Speed( 2.0 );
67 
68  if( out_logo_alpha->IsInTarget( 0.0 ) )
69  out_background_alpha->Target( 0.0 )
70  ->Speed( 3.0 );
71  }
72  }
73  );
74 
75  //-----------------------
76  if( this->LoadingRunning() )
77  this->LoadStart();
78 }
79 
81 {
82  this->in_enabled->Target( true );
83 }
84 
86 {
87  this->in_enabled->Target( false );
88 }
89 
90 }