Add in zoom targeting and ease-in functions for the camera system. Release Build 10094.
This commit is contained in:
parent
352847ab27
commit
ed4a755d1c
@ -706,6 +706,10 @@ void AiL::UpdateCamera(float fElapsedTime){
|
||||
worldShake=player->GetPos()+worldShakeVel;
|
||||
}
|
||||
camera.Update(fElapsedTime);
|
||||
if(view.GetZoom().x!=targetZoom){
|
||||
if(view.GetZoom().x<targetZoom)view.SetZoom(std::min(view.GetZoom().x+zoomAdjustSpeed*fElapsedTime,targetZoom),camera.GetTarget());
|
||||
else view.SetZoom(std::max(view.GetZoom().x-zoomAdjustSpeed*fElapsedTime,targetZoom),camera.GetTarget());
|
||||
}
|
||||
view.SetWorldOffset(camera.GetViewPosition());
|
||||
}
|
||||
|
||||
@ -2354,7 +2358,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
||||
Audio::muted=true;
|
||||
Audio::UpdateBGMVolume();
|
||||
#endif
|
||||
game->view.SetZoom(1.f,game->view.WorldToScreen(game->camera.GetViewPosition()));
|
||||
targetZoom=1.f;
|
||||
game->view.SetZoom(1.2f,game->view.WorldToScreen(game->camera.GetViewPosition()));
|
||||
worldColor=WHITE;
|
||||
worldColorFunc=[&](vi2d pos){return game->worldColor;};
|
||||
levelTime=0;
|
||||
@ -2371,7 +2376,6 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
||||
Inventory::ResetLoadoutItemsUsed();
|
||||
Input::StopVibration();
|
||||
|
||||
|
||||
Input::SetLightbar({255,0,255});
|
||||
GetPlayer()->hp=GetPlayer()->GetMaxHealth();
|
||||
GetPlayer()->mana=GetPlayer()->GetMaxMana();
|
||||
|
@ -225,6 +225,8 @@ private:
|
||||
std::optional<vf2d>bossIndicatorPos{};
|
||||
bool steamAPIEnabled{true};
|
||||
Overlay hudOverlay{"pixel.png",BLANK};
|
||||
float targetZoom{1.f};
|
||||
float zoomAdjustSpeed{0.1f};
|
||||
public:
|
||||
AiL();
|
||||
bool OnUserCreate() override;
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 3
|
||||
#define VERSION_BUILD 10093
|
||||
#define VERSION_BUILD 10094
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -102,6 +102,7 @@ namespace olc
|
||||
olc::vf2d GetWorldVisibleArea() const;
|
||||
void ZoomAtScreenPos(const float fDeltaZoom, const olc::vi2d& vPos);
|
||||
void SetZoom(const float fZoom, const olc::vf2d& vPos);
|
||||
const vf2d&GetZoom()const;
|
||||
void StartPan(const olc::vi2d& vPos);
|
||||
void UpdatePan(const olc::vi2d& vPos);
|
||||
void EndPan(const olc::vi2d& vPos);
|
||||
@ -292,6 +293,10 @@ namespace olc
|
||||
m_vWorldOffset += vOffsetBeforeZoom - vOffsetAfterZoom;
|
||||
}
|
||||
|
||||
const vf2d&TransformedView::GetZoom()const{
|
||||
return m_vWorldScale;
|
||||
}
|
||||
|
||||
void TransformedView::StartPan(const olc::vi2d& vPos)
|
||||
{
|
||||
m_bPanning = true;
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user