Switched menu button system to component inheritance system.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
#include "MenuType.h"
|
||||
#include <functional>
|
||||
|
||||
class Menu;
|
||||
class Crawler;
|
||||
|
||||
class MenuComponent{
|
||||
friend class Menu;
|
||||
MenuType menuDest;
|
||||
std::string label;
|
||||
MenuFunc onClick;
|
||||
bool hovered=false;
|
||||
private:
|
||||
float hoverEffect=0;
|
||||
protected:
|
||||
geom2d::rect<float>rect;
|
||||
public:
|
||||
MenuComponent(geom2d::rect<float>rect,std::string label,MenuFunc onClick);
|
||||
MenuComponent(geom2d::rect<float>rect,std::string label,MenuType menuDest,MenuFunc onClick);
|
||||
virtual void Update(Crawler*game);
|
||||
virtual void Draw(Crawler*game,vf2d parentPos);
|
||||
};
|
||||
|
||||
class MenuIconButton:public MenuComponent{
|
||||
private:
|
||||
Decal*icon;
|
||||
public:
|
||||
MenuIconButton(geom2d::rect<float>rect,Decal*icon,MenuFunc onClick);
|
||||
protected:
|
||||
virtual void Update(Crawler*game)override;
|
||||
virtual void Draw(Crawler*game,vf2d parentPos)override;
|
||||
};
|
||||
Reference in New Issue
Block a user