File: progressbar.hh

package info (click to toggle)
performous 0.7.0%2Bgit20140715-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,900 kB
  • ctags: 3,470
  • sloc: cpp: 16,647; sh: 2,495; ansic: 2,015; python: 431; xml: 407; objc: 245; makefile: 12
file content (31 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (2)
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
#pragma once

#include "surface.hh"

/// simple progressbar class
class ProgressBar {
  public:
	/// type of progressbar
	enum Mode { HORIZONTAL, VERTICAL, CIRCULAR };
	/**
	* Construct a new progress bar.
	* @param bg filename of background image
	* @param bar filename of the bar image
	* @param mode specifies bar appearance
	* @param begin margin before the bar begins [0, 1]
	* @param end margin after the bar ends [0, 1]
	* @param sliding makes the bar move; the texture is anchored at bar end rather than at bar beginning
	**/
	ProgressBar(fs::path const& bg, fs::path const& bar, Mode mode = HORIZONTAL, float begin = 0.0f, float end = 0.0f, bool sliding = false);
	/** Draw a progress bar with the given percentage [0, 1] **/
	void draw(float value);
  private:
	Texture m_bg, m_bar;
	Mode m_mode;
	float m_begin, m_end;
	bool m_sliding;
  public:
	/// dimensions of progressbar
	Dimensions dimensions;
};