mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-20 07:11:12 -06:00 
			
		
		
		
	Save and load window size. Add fps average output.
This commit is contained in:
		
							parent
							
								
									8126cdd507
								
							
						
					
					
						commit
						bb8a6b898f
					
				
					 1 changed files with 15 additions and 2 deletions
				
			
		|  | @ -218,6 +218,8 @@ class MyFrame: public wxFrame | ||||||
|      |      | ||||||
|     uqptr<SLAJob> m_ui_job; |     uqptr<SLAJob> m_ui_job; | ||||||
|      |      | ||||||
|  |     double m_fps_avg = 0.; | ||||||
|  |      | ||||||
| public: | public: | ||||||
|     MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, const Slic3r::GL::CSGSettings &settings); |     MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, const Slic3r::GL::CSGSettings &settings); | ||||||
|      |      | ||||||
|  | @ -234,6 +236,11 @@ public: | ||||||
|             std::string model_name; |             std::string model_name; | ||||||
|             std::getline(stream, model_name); |             std::getline(stream, model_name); | ||||||
|             load_model(model_name); |             load_model(model_name); | ||||||
|  |              | ||||||
|  |             int w, h; | ||||||
|  |             stream >> w >> h; | ||||||
|  |             SetSize(w, h); | ||||||
|  |              | ||||||
|             m_mouse.load(stream); |             m_mouse.load(stream); | ||||||
|             m_mouse.play(); |             m_mouse.play(); | ||||||
|         } |         } | ||||||
|  | @ -243,6 +250,8 @@ public: | ||||||
|     const Canvas * canvas() const { return m_canvas.get(); } |     const Canvas * canvas() const { return m_canvas.get(); } | ||||||
|      |      | ||||||
|     void bind_canvas_events(MouseInput &msinput); |     void bind_canvas_events(MouseInput &msinput); | ||||||
|  |      | ||||||
|  |     double get_fps_average() const { return m_fps_avg; } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static const std::vector<wxString> CSG_ALGS  = {"Auto", "Goldfeather", "SCS"}; | static const std::vector<wxString> CSG_ALGS  = {"Auto", "Goldfeather", "SCS"}; | ||||||
|  | @ -308,6 +317,7 @@ public: | ||||||
|             m_frame->Show( true ); |             m_frame->Show( true ); | ||||||
|             m_frame->play_back_mouse(fname.ToStdString()); |             m_frame->play_back_mouse(fname.ToStdString()); | ||||||
|             m_frame->Close( true ); |             m_frame->Close( true ); | ||||||
|  |             std::cout << m_frame->get_fps_average() << std::endl; | ||||||
|              |              | ||||||
|         } else m_frame->Show( true ); |         } else m_frame->Show( true ); | ||||||
|          |          | ||||||
|  | @ -416,8 +426,9 @@ MyFrame::MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size, | ||||||
|      |      | ||||||
|     auto fpstext = new wxStaticText(control_panel, wxID_ANY, ""); |     auto fpstext = new wxStaticText(control_panel, wxID_ANY, ""); | ||||||
|     console_sizer->Add(fpstext, 0, wxALL, 5); |     console_sizer->Add(fpstext, 0, wxALL, 5); | ||||||
|     m_canvas->get_ocsg_display()->get_fps_counter().add_listener([fpstext](double fps) { |     m_canvas->get_ocsg_display()->get_fps_counter().add_listener([this, fpstext](double fps) { | ||||||
|         fpstext->SetLabel(wxString::Format("fps: %.2f", fps) ); |         fpstext->SetLabel(wxString::Format("fps: %.2f", fps) ); | ||||||
|  |         m_fps_avg = 0.9 * m_fps_avg + 0.1 * fps; | ||||||
|     }); |     }); | ||||||
|      |      | ||||||
|     auto record_btn = new wxToggleButton(control_panel, wxID_ANY, "Record"); |     auto record_btn = new wxToggleButton(control_panel, wxID_ANY, "Record"); | ||||||
|  | @ -533,6 +544,8 @@ MyFrame::MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size, | ||||||
|                  |                  | ||||||
|                 if (stream.good()) { |                 if (stream.good()) { | ||||||
|                     stream << m_ui_job->get_project_fname() << "\n"; |                     stream << m_ui_job->get_project_fname() << "\n"; | ||||||
|  |                     wxSize winsize = GetSize(); | ||||||
|  |                     stream << winsize.x << " " << winsize.y << "\n"; | ||||||
|                     m_mouse.save(stream); |                     m_mouse.save(stream); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tamasmeszaros
						tamasmeszaros