|
|
@ -27,8 +27,7 @@ bool VirusAttack::OnUserCreate(){ |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
void VirusAttack::HandleDraggingSelection(){ |
|
|
|
// Called once per frame, draws random coloured pixels
|
|
|
|
|
|
|
|
if(GetMouse(0).bPressed){ |
|
|
|
if(GetMouse(0).bPressed){ |
|
|
|
for(std::unique_ptr<Unit>&u:units){ |
|
|
|
for(std::unique_ptr<Unit>&u:units){ |
|
|
|
u->Deselect(); |
|
|
|
u->Deselect(); |
|
|
@ -51,6 +50,16 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
} |
|
|
|
} |
|
|
|
startingDragPos=CONSTANT::UNSELECTED; |
|
|
|
startingDragPos=CONSTANT::UNSELECTED; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void VirusAttack::DrawSelectionRectangle(){ |
|
|
|
|
|
|
|
if(startingDragPos!=CONSTANT::UNSELECTED){ |
|
|
|
|
|
|
|
FillRectDecal(startingDragPos,GetMousePos()-startingDragPos,{255,255,0,128}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
|
|
|
|
HandleDraggingSelection(); |
|
|
|
|
|
|
|
|
|
|
|
for(std::unique_ptr<Unit>&u:units){ |
|
|
|
for(std::unique_ptr<Unit>&u:units){ |
|
|
|
u->Update(fElapsedTime); |
|
|
|
u->Update(fElapsedTime); |
|
|
@ -60,9 +69,8 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
u->Draw(this); |
|
|
|
u->Draw(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(startingDragPos!=CONSTANT::UNSELECTED){ |
|
|
|
DrawSelectionRectangle(); |
|
|
|
FillRectDecal(startingDragPos,GetMousePos()-startingDragPos,{255,255,0,128}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|