Removed Camera dependency and resort to TransformedView

CorrectiveAction
sigonasr2 1 year ago
parent 2ec0daf59e
commit cc6669d46b
  1. 28
      olcCodeJam2023Entry/VirusAttack.cpp
  2. 2
      olcCodeJam2023Entry/VirusAttack.h

@ -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;

@ -10,8 +10,6 @@ private:
Renderable TILE;
vf2d camera={213,160};
TileTransformedView game;
vf2d startingDragPos=CONSTANT::UNSELECTED;

Loading…
Cancel
Save