30 lines
		
	
	
		
			674 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			674 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef HEADS_UP_DISPLAY_H
 | 
						|
#define HEADS_UP_DISPLAY_H
 | 
						|
 | 
						|
#include "scene/gui/control.h"
 | 
						|
#include "scene/gui/label.h"
 | 
						|
#include "scene/gui/progress_bar.h"
 | 
						|
 | 
						|
class HeadsUpDisplay : public Control {
 | 
						|
	GDCLASS(HeadsUpDisplay, Control);
 | 
						|
	static void _bind_methods();
 | 
						|
	static HeadsUpDisplay *singleton_instance;
 | 
						|
	void on_child_entered(Node *node);
 | 
						|
	void enter_tree();
 | 
						|
	void exit_tree();
 | 
						|
 | 
						|
protected:
 | 
						|
	void _notification(int what);
 | 
						|
 | 
						|
public:
 | 
						|
	static HeadsUpDisplay *get_singleton();
 | 
						|
	void set_tooltip(String const &tooltip);
 | 
						|
	void set_health_percentage(double health_percentage);
 | 
						|
 | 
						|
private:
 | 
						|
	Label *tooltip{ nullptr };
 | 
						|
	ProgressBar *healthbar{ nullptr };
 | 
						|
};
 | 
						|
 | 
						|
#endif // !HEADS_UP_DISPLAY_H
 |