#include "olcPixelGameEngine.h" #include "olcSoundWaveEngine.h" #include "olcPGEX_TransformedView.h" #include "Unit.h" #include "Constant.h" #include "Image.h" #include "DeathAnimation.h" #include "olcPGEX_AudioListener.h" #include "olcPGEX_AudioSource.h" #include "Sound.h" #include "DebuffIcon.h" #include "CollectionPoint.h" #include "Resources.h" #include "Textbox.h" struct Letter{ vf2d pos; float spd; char c; }; class VirusAttack : public olc::PixelGameEngine { private: std::vector>queuedUnits; std::vector>units; std::vector>collectionPoints; std::vector>deathAnimations; std::vectordebuffIcons; std::map>IMAGES; std::map>SOUNDS; olcPGEX_AudioListener AL; Audio*bgm; Resources player_resources,enemy_resources; TileTransformedView game; Textbox unitCreationBox,testBox,memoryAllocatorBox; QuickGUI::Manager unitCreationList; QuickGUI::ImageButton*leftShifterButton; QuickGUI::ImageButton*rightShifterButton; QuickGUI::ImageButton*bitRestorerButton; QuickGUI::ImageButton*memorySwapperButton; QuickGUI::ImageButton*corrupterButton; QuickGUI::ImageButton*platformButton; float matrixTimer=0; float updatePixelsTimer=0; const std::arraymatrixLetters={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',}; std::vectoractiveLetters; vf2d startingDragPos=CONSTANT::UNSELECTED; void HandleDraggingSelection(); void DrawSelectionRectangle(); void HandleRightClickMove(); void CollisionChecking(std::shared_ptru,std::shared_ptru2); void IdentifyClosestTarget(std::weak_ptr&closestUnit,float&closestDist,std::shared_ptru,std::shared_ptru2); vf2d GetWorldMousePos(); void HandlePanAndZoom(float fElapsedTime); void DrawMinimap(); void HandleMinimapClick(); void InitializeImages(); void UpdateMatrixTexture(float fElapsedTime); void RenderCollectionPoints(CollectionPoint*cp); void RenderFogOfWar(); void InitializeSounds(); void DrawResourceBar(); bool UnitCreationClickHandled(); void InitializeUnitCreationGUI(); bool CanAfford(Resources&resources,std::vector&unitCosts); void ExpendResources(Resources&resources,std::vector&unitCosts); void UpdateUnitCreationListGUI(bool allocatorSelected); public: VirusAttack(); public: bool OnUserCreate() override; bool OnUserUpdate(float fElapsedTime) override; };