mirror of
https://github.com/sigonasr2/hamster.git
synced 2025-04-18 06:39:39 -05:00
Fix radar.
This commit is contained in:
parent
d3bc589235
commit
b114907cae
@ -497,7 +497,7 @@ void HamsterGame::DrawRadar(){
|
||||
};
|
||||
|
||||
const auto DeferRenderingBasedOnPosition=[this,&icon](const vf2d&pos,const IconType powerupIcon,const uint8_t iconAlpha){
|
||||
if(geom2d::contains(geom2d::circle<float>{{43.f+5.f,44.f+8.f},43},geom2d::rect<float>{pos-vf2d{8.f,8.f},{16.f,16.f}}))DrawPartialRotatedDecal(pos+vf2d{5.f,8.f},GetGFX("radaricons.png").Decal(),0.f,{8.f,8.f},icon.at(powerupIcon).pos,icon.at(powerupIcon).size,{1.f,1.f},{255,255,255,iconAlpha});
|
||||
if(geom2d::contains(geom2d::circle<float>{{43.f+5.f,44.f+8.f},43},pos+vf2d{5.f,8.f}))DrawPartialRotatedDecal(pos+vf2d{5.f,8.f},GetGFX("radaricons.png").Decal(),0.f,{8.f,8.f},icon.at(powerupIcon).pos,icon.at(powerupIcon).size,{1.f,1.f},{255,255,255,iconAlpha});
|
||||
};
|
||||
|
||||
for(const Powerup&powerup:Powerup::GetPowerups()){
|
||||
|
14
src/Menu.cpp
14
src/Menu.cpp
@ -98,7 +98,11 @@ void Menu::Transition(const TransitionType type,const MenuType gotoMenu,const fl
|
||||
currentTransition=type;
|
||||
}
|
||||
void Menu::OnMenuTransition(){
|
||||
selectedButton.reset();
|
||||
switch(currentMenu){
|
||||
case MAIN_MENU:{
|
||||
//selectedButton
|
||||
}break;
|
||||
case LOADING:{
|
||||
colorNumb=util::random()%8+1;
|
||||
loading=true;
|
||||
@ -208,4 +212,14 @@ void Menu::OnLevelLoaded(){
|
||||
|
||||
void Menu::UpdateLoadingProgress(const float pctLoaded){
|
||||
loadingPct=pctLoaded;
|
||||
}
|
||||
|
||||
Menu::Button::Button(const vf2d pos,std::string buttonText,Renderable&buttonImg,std::function<void()>onClick)
|
||||
:pos(pos),buttonText(buttonText),buttonImg(buttonImg),onClick(onClick){}
|
||||
|
||||
void Menu::Button::Update(const float fElapsedTime){
|
||||
|
||||
}
|
||||
void Menu::Button::Draw(HamsterGame&game){
|
||||
|
||||
}
|
10
src/Menu.h
10
src/Menu.h
@ -38,11 +38,19 @@ All rights reserved.
|
||||
#pragma once
|
||||
|
||||
#include "olcPixelGameEngine.h"
|
||||
#include <functional>
|
||||
|
||||
class HamsterGame;
|
||||
class Menu{
|
||||
class Button{
|
||||
std::string buttonText;
|
||||
vf2d pos;
|
||||
Renderable&buttonImg;
|
||||
std::function<void()>onClick;
|
||||
public:
|
||||
Button(const vf2d pos,std::string buttonText,Renderable&buttonImg,std::function<void()>onClick={});
|
||||
void Update(const float fElapsedTime);
|
||||
void Draw(HamsterGame&game);
|
||||
};
|
||||
enum MenuType{
|
||||
INITIALIZE,
|
||||
@ -81,7 +89,9 @@ class Menu{
|
||||
int colorNumb{1};
|
||||
bool loading{false};
|
||||
float loadingPct{0.f};
|
||||
std::vector<Button>menuButtons;
|
||||
std::string selectedMap{"StageI.tmx"};
|
||||
std::optional<int>selectedButton;
|
||||
void Transition(const TransitionType type,const MenuType gotoMenu,const float transitionTime);
|
||||
void Draw(HamsterGame&game,const MenuType menu,const vi2d pos);
|
||||
void DrawTransition(HamsterGame&game);
|
||||
|
Loading…
x
Reference in New Issue
Block a user