@ -63,6 +63,8 @@ bool VirusAttack::OnUserCreate(){
unitCreationBox . SetVisible ( false ) ;
unitCreationBox . SetVisible ( false ) ;
testBox . Initialize ( " Hello world, this is a test of the textbox system. \n Maybe even with some newline characters snuck in there. " , { } ) ;
testBox . Initialize ( " Hello world, this is a test of the textbox system. \n Maybe even with some newline characters snuck in there. " , { } ) ;
testBox . SetVisible ( false ) ;
testBox . SetVisible ( false ) ;
memoryAllocatorBox . Initialize ( CONSTANT : : MEMORY_ALLOCATOR_BOX_DISPLAY_STRING , { } , CONSTANT : : MEMORY_ALLOCATOR_BOX_HEADER_STRING ) ;
memoryAllocatorBox . SetVisible ( false ) ;
IMAGES [ MINIMAP_OUTLINE ] = std : : make_unique < Renderable > ( ) ;
IMAGES [ MINIMAP_OUTLINE ] = std : : make_unique < Renderable > ( ) ;
IMAGES [ MINIMAP_OUTLINE ] - > Create ( 64 , 64 ) ;
IMAGES [ MINIMAP_OUTLINE ] - > Create ( 64 , 64 ) ;
@ -183,12 +185,14 @@ void VirusAttack::UpdateUnitCreationListGUI(bool allocatorSelected){
void VirusAttack : : HandleDraggingSelection ( ) {
void VirusAttack : : HandleDraggingSelection ( ) {
auto NotClickingOnMinimap = [ & ] ( ) { return ! ( GetMouseX ( ) > = ScreenWidth ( ) - 64 & & GetMouseY ( ) > = ScreenHeight ( ) - 64 ) ; } ;
auto NotClickingOnMinimap = [ & ] ( ) { return ! ( GetMouseX ( ) > = ScreenWidth ( ) - 64 & & GetMouseY ( ) > = ScreenHeight ( ) - 64 ) ; } ;
bool allocatorSelected = false ;
bool allocatorSelected = false ;
bool memoryAllocatorBoxHovered = false ;
for ( auto & u : units ) {
for ( auto & u : units ) {
u - > UpdateGUIState ( game , player_resources ) ;
u - > UpdateGUIState ( game , player_resources , memoryAllocatorBox , memoryAllocatorBoxHovered ) ;
if ( u - > IsSelected ( ) & & u - > IsAllocator ( ) ) {
if ( u - > IsSelected ( ) & & u - > IsAllocator ( ) ) {
allocatorSelected = true ;
allocatorSelected = true ;
}
}
}
}
if ( ! memoryAllocatorBoxHovered ) memoryAllocatorBox . SetVisible ( false ) ;
UpdateUnitCreationListGUI ( allocatorSelected ) ;
UpdateUnitCreationListGUI ( allocatorSelected ) ;
if ( GetMouse ( 0 ) . bPressed ) {
if ( GetMouse ( 0 ) . bPressed ) {
if ( NotClickingOnMinimap ( ) ) {
if ( NotClickingOnMinimap ( ) ) {
@ -540,8 +544,9 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){
DrawMinimap ( ) ;
DrawMinimap ( ) ;
unitCreationBox . UpdateAndDraw ( GetMousePos ( ) , this , player_resources , IMAGES ) ;
unitCreationBox . UpdateAndDraw ( GetMousePos ( ) + vi2d { 8 , - 28 } , this , player_resources , IMAGES ) ;
testBox . UpdateAndDraw ( GetMousePos ( ) - testBox . GetSize ( ) / 2 , this , player_resources , IMAGES ) ;
testBox . UpdateAndDraw ( GetMousePos ( ) - testBox . GetSize ( ) / 2 , this , player_resources , IMAGES ) ;
memoryAllocatorBox . UpdateAndDraw ( GetMousePos ( ) + vi2d { 8 , - 28 } , this , player_resources , IMAGES ) ;
std : : sort ( units . begin ( ) , units . end ( ) , [ & ] ( auto & u1 , auto & u2 ) {
std : : sort ( units . begin ( ) , units . end ( ) , [ & ] ( auto & u1 , auto & u2 ) {
float dist1 = geom2d : : line < float > ( u1 - > GetGhostPos ( ) , GetWorldMousePos ( ) ) . length ( ) ;
float dist1 = geom2d : : line < float > ( u1 - > GetGhostPos ( ) , GetWorldMousePos ( ) ) . length ( ) ;