Преглед изворни кода

add api to enable|disable scaling (unimplemented)

AlexVinS пре 11 година
родитељ
комит
61b31e5c60
3 измењених фајлова са 16 додато и 0 уклоњено
  1. 7 0
      client/CSpellWindow.cpp
  2. 2 0
      client/CVideoHandler.cpp
  3. 7 0
      client/CVideoHandler.h

+ 7 - 0
client/CSpellWindow.cpp

@@ -516,13 +516,20 @@ void CSpellWindow::deactivate()
 void CSpellWindow::turnPageLeft()
 {
 	if (settings["video"]["spellbookAnimation"].Bool())
+	{
+		CCS->videoh->setScaling(false);
 		CCS->videoh->openAndPlayVideo("PGTRNLFT.SMK", pos.x+13, pos.y+15, screen);
+	}
+		
 }
 
 void CSpellWindow::turnPageRight()
 {
 	if (settings["video"]["spellbookAnimation"].Bool())
+	{
+		CCS->videoh->setScaling(false);
 		CCS->videoh->openAndPlayVideo("PGTRNRGH.SMK", pos.x+13, pos.y+15, screen);
+	}		
 }
 
 void CSpellWindow::keyPressed(const SDL_KeyboardEvent & key)

+ 2 - 0
client/CVideoHandler.cpp

@@ -71,6 +71,8 @@ CVideoPlayer::CVideoPlayer()
 	// combination of av_register_input_format() /
 	// av_register_output_format() / av_register_protocol() instead.
 	av_register_all();
+	
+	doScale = true;
 }
 
 bool CVideoPlayer::open(std::string fname)

+ 7 - 0
client/CVideoHandler.h

@@ -14,6 +14,8 @@ public:
 	virtual bool wait()=0;
 	virtual int curFrame() const =0;
 	virtual int frameCount() const =0;
+	
+	virtual void setScaling(bool enabled) =0;
 
 };
 
@@ -40,6 +42,7 @@ public:
 	virtual void close() {};
 	virtual bool wait() {return false;};
 	virtual bool open( std::string name ) {return false;};
+	void setScaling(bool enabled) override {};
 };
 
 
@@ -83,6 +86,8 @@ class CVideoPlayer : public IMainVideoPlayer
 	int refreshWait; // Wait several refresh before updating the image
 	int refreshCount;
 	bool doLoop;				// loop through video
+	
+	bool doScale;
 
 	bool playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey);
 	bool open(std::string fname, bool loop, bool useOverlay = false);
@@ -108,6 +113,8 @@ public:
 	int curFrame() const {return -1;};
 	int frameCount() const {return -1;};
 
+	void setScaling(bool enabled) override {doScale = enabled;};
+
 	// public to allow access from ffmpeg IO functions
 	std::unique_ptr<CInputStream> data;
 };