@@ -55,6 +55,8 @@ enum CreateMode
5555 int _ioWidth ;
5656 int _ioHeight ;
5757 System . Numerics . Vector4 _ioColor ;
58+
59+ System . Numerics . Vector3 _ioBgColor ;
5860 bool _dialogFilePicker = false ;
5961 bool _dialogCompatibility = false ;
6062
@@ -88,8 +90,9 @@ protected override void OnLoad()
8890 base . OnLoad ( ) ;
8991
9092 //Helper.EnableDebugMode();
93+ _ioBgColor = new System . Numerics . Vector3 ( 0.1f , 0.1f , 0.1f ) ;
94+ GL . ClearColor ( _ioBgColor . X , _ioBgColor . Y , _ioBgColor . Z , 1.0f ) ;
9195
92- GL . ClearColor ( 0.1f , 0.1f , 0.1f , 1.0f ) ; // TODO: Magic value
9396 GL . Enable ( EnableCap . Multisample ) ;
9497
9598 _userMode = UserMode . Idle ;
@@ -138,7 +141,6 @@ protected override void OnUpdateFrame(FrameEventArgs e)
138141 x = _mouseOriginalState . X ;
139142 }
140143 Title += String . Format ( " (delta x: {0} delta y: {1})" , x - _mouseOriginalState . X , y - _mouseOriginalState . Y ) ;
141-
142144 }
143145
144146 // Update title based on current context
@@ -161,26 +163,6 @@ protected override void OnRenderFrame(FrameEventArgs e)
161163
162164 _timeline . OnRenderFrame ( e , this ) ;
163165
164- if ( KeyboardState . IsKeyDown ( Keys . Q ) )
165- {
166- ////Console.WriteLine("Draw me please");
167- //foreach (KeyValuePair<int, List<Shape>> shapes in thetimeline)
168- //{
169- // foreach (Shape shape in shapes.Value)
170- // {
171- // shape.ImplementObject();
172- // shape.Draw(ClientSize);
173- // }
174- //}
175- //if (_selectedShape != null)
176- // _selectedShape.ImplementObject(); // Reset VAOS for selected shape
177- }
178-
179- //if (KeyboardState.IsKeyDown(Keys.Space))
180- // _userMode = UserMode.Move;
181- //else if (KeyboardState.WasKeyDown(Keys.Space) && KeyboardState.IsKeyDown(Keys.Space) == false)
182- // _userMode = UserMode.Idle;
183-
184166 if ( KeyboardState . IsKeyDown ( Keys . Escape ) )
185167 ResetSelection ( ) ;
186168
@@ -639,17 +621,23 @@ public void ShowUI()
639621 ImGui . EndTable ( ) ;
640622 }
641623
642- ImGui . Spacing ( ) ;
643- ImGui . Separator ( ) ;
644624 ImGui . Spacing ( ) ;
645625
646- ImGui . Text ( "Color" ) ;
647- ImGui . Spacing ( ) ;
648626 if ( SelectedShape == null )
649627 ImGui . BeginDisabled ( ) ;
650- ImGui . ColorEdit4 ( "Color" , ref _ioColor ) ;
628+ ImGui . Text ( "Color" ) ;
629+ ImGui . ColorEdit4 ( "##Color" , ref _ioColor ) ;
651630 if ( SelectedShape == null )
652631 ImGui . EndDisabled ( ) ;
632+
633+ ImGui . Spacing ( ) ;
634+ ImGui . Separator ( ) ;
635+ ImGui . Spacing ( ) ;
636+
637+ ImGui . Text ( "Background Color" ) ;
638+ ImGui . Spacing ( ) ;
639+ if ( ImGui . ColorEdit3 ( "##BgColor" , ref _ioBgColor ) )
640+ GL . ClearColor ( _ioBgColor . X , _ioBgColor . Y , _ioBgColor . Z , 1.0f ) ;
653641 ImGui . End ( ) ;
654642
655643 // Tree view side
@@ -782,8 +770,6 @@ public void ShowUI()
782770 if ( picker . Draw ( ) )
783771 {
784772 ResetSelection ( ) ;
785- _timeline . ResetTimeline ( ) ;
786- //ResetTimeline();
787773 bool compatibilityFlag ;
788774
789775 switch ( _importMode )
@@ -795,6 +781,7 @@ public void ShowUI()
795781 case ImportMode . Override :
796782 default :
797783 ( Shapes , compatibilityFlag ) = Importer . ImportFromFile ( picker . SelectedFile ) ;
784+ _timeline . ResetTimeline ( ) ;
798785 break ;
799786 }
800787 FilePicker . RemoveFilePicker ( this ) ;
@@ -850,8 +837,8 @@ static void HelpMarker(string desc)
850837
851838 public void SaveCurrentScreenToMP4 ( )
852839 {
853- using VideoWriter w = new VideoWriter ( "output.mp4" , 12 , new System . Drawing . Size ( ClientSize . X , ClientSize . Y ) , true ) ;
854- for ( int i = 0 ; i <= 100 ; i ++ ) // TODO: please dont hardcode this
840+ using VideoWriter w = new VideoWriter ( "output.mp4" , _timeline . IoFps , new System . Drawing . Size ( ClientSize . X , ClientSize . Y ) , true ) ;
841+ for ( int i = Timeline . MIN_TIMELINE ; i <= Timeline . MAX_TIMELINE ; i ++ ) // TODO: please dont hardcode this
855842 {
856843 RenderFrameBySecondIndex ( i ) ;
857844 w . Write ( TakeSnap ( ) . ToMat ( ) ) ;
@@ -861,7 +848,7 @@ public void SaveCurrentScreenToGIF()
861848 {
862849 using ( var gif = AnimatedGif . AnimatedGif . Create ( "output.gif" , 1000 / _timeline . IoFps ) )
863850 {
864- for ( int i = 0 ; i < 100 ; i ++ ) // TODO: please dont hardcode this
851+ for ( int i = Timeline . MIN_TIMELINE ; i <= Timeline . MAX_TIMELINE ; i ++ ) // TODO: please dont hardcode this
865852 {
866853 RenderFrameBySecondIndex ( i ) ;
867854 gif . AddFrame ( TakeSnap ( ) , delay : - 1 , quality : GifQuality . Bit8 ) ;
0 commit comments