File: screen_sing.hh

package info (click to toggle)
performous 0.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 6,748 kB
  • ctags: 2,894
  • sloc: cpp: 14,729; sh: 275; objc: 245; makefile: 102; xml: 14
file content (95 lines) | stat: -rw-r--r-- 2,544 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#pragma once

#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
#include <deque>
#include "layout_singer.hh"
#include "animvalue.hh"
#include "engine.hh"
#include "guitargraph.hh"
#include "dancegraph.hh"
#include "screen.hh"
#include "backgrounds.hh"
#include "theme.hh"
#include "surface.hh"
#include "opengl_text.hh"
#include "progressbar.hh"
#include "guitargraph.hh"

#include "screen_players.hh"

class Players;
class Audio;
class Capture;
class Database;
class Video;

typedef boost::ptr_vector<GuitarGraph> Instruments;
typedef boost::ptr_vector<DanceGraph> Dancers;

/// shows score at end of song
class ScoreWindow {
  public:
	/// constructor
	ScoreWindow(Instruments& instruments, Database& database, Dancers& dancers);
	/// draws ScoreWindow
	void draw();
	bool empty() { return m_database.scores.empty(); }
  private:
	Database& m_database;
	AnimValue m_pos;
	Surface m_bg;
	ProgressBar m_scoreBar;
	SvgTxtThemeSimple m_score_text;
	SvgTxtTheme m_score_rank;
	std::string m_rank;
};

/// class for actual singing screen
class ScreenSing: public Screen {
  public:
	/// constructor
	ScreenSing(std::string const& name, Audio& audio, Capture& capture, Database& database, Backgrounds& bgs):
	  Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV(), m_only_singers_alive(true)
	{}
	void enter();
	void exit();
	void manageEvent(SDL_Event event);
	void draw();

	void setSong (boost::shared_ptr<Song> song_)
	{
		m_song = song_;
	}

  private:
	/**Activates Songs Screen or Players Screen.
	  This depends on
	  - the configuration (is Hiscore enabled)
	  - did a player reach a new hiscore
	  - is the hiscore file writable
	  */
	void activateNextScreen();
	bool instrumentLayout(double time);
	void danceLayout(double time);
	Audio& m_audio;
	Capture& m_capture;
	Database& m_database;
	Backgrounds& m_backgrounds;
	boost::shared_ptr<Song> m_song; /// Pointer to the current song
	boost::scoped_ptr<ScoreWindow> m_score_window;
	boost::scoped_ptr<ProgressBar> m_progress;
	boost::scoped_ptr<Surface> m_background;
	boost::scoped_ptr<Video> m_video;
	boost::scoped_ptr<Surface> m_pause_icon;
	boost::scoped_ptr<Surface> m_help;
	boost::scoped_ptr<Engine> m_engine;
	boost::scoped_ptr<LayoutSinger> m_layout_singer;
	Instruments m_instruments;
	Dancers m_dancers;
	double m_latencyAV;  // Latency between audio and video output (do not confuse with latencyAR)
	boost::shared_ptr<ThemeSing> theme;
	AnimValue m_quitTimer;
	bool m_only_singers_alive;
};