diff --git a/olcCodeJam2023Entry/VirusAttack.cpp b/olcCodeJam2023Entry/VirusAttack.cpp index 71c9617..0ca6e0d 100644 --- a/olcCodeJam2023Entry/VirusAttack.cpp +++ b/olcCodeJam2023Entry/VirusAttack.cpp @@ -1,11 +1,7 @@ #define OLC_PGE_APPLICATION -#include "olcPixelGameEngine.h" #define OLC_SOUNDWAVE -#include "olcSoundWaveEngine.h" #define OLC_PGEX_TRANSFORMEDVIEW -#include "olcPGEX_TransformedView.h" #include "olcUTIL_Geometry2D.h" -#include "olcUTIL_Camera2D.h" #include "VirusAttack.h" @@ -121,7 +117,29 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ HandleDraggingSelection(); HandleRightClickMove(); - game.HandlePanAndZoom(); + if(GetKey(A).bHeld){ + game.MoveWorldOffset({-256*fElapsedTime,0}); + } + if(GetKey(W).bHeld){ + game.MoveWorldOffset({0,-256*fElapsedTime}); + } + if(GetKey(S).bHeld){ + game.MoveWorldOffset({0,256*fElapsedTime}); + } + if(GetKey(D).bHeld){ + game.MoveWorldOffset({256*fElapsedTime,0}); + } + + if(GetMouseWheel()>0){ + if(game.GetWorldScale().x<2){ + game.ZoomAtScreenPos(1.25,GetMousePos()); + } + } else + if(GetMouseWheel()<0){ + if(game.GetWorldScale().x>0.5){ + game.ZoomAtScreenPos(0.75,GetMousePos()); + } + } for(auto&u:units){ Unit*closestUnit=nullptr; diff --git a/olcCodeJam2023Entry/VirusAttack.h b/olcCodeJam2023Entry/VirusAttack.h index dc7182e..f821b80 100644 --- a/olcCodeJam2023Entry/VirusAttack.h +++ b/olcCodeJam2023Entry/VirusAttack.h @@ -10,8 +10,6 @@ private: Renderable TILE; - vf2d camera={213,160}; - TileTransformedView game; vf2d startingDragPos=CONSTANT::UNSELECTED;