Commit e95aa1a1 authored by ewen.madec's avatar ewen.madec

ajustement graphismes

parent ae7fe2e6
......@@ -101,7 +101,7 @@ void Panel_drawGame(Panel * self)
Panel_drawNode( self, &(self->world->nodes[i]) );
}
//Panel_drawBasis(self);
EndDrawing();
//EndDrawing();
}
void Panel_drawBasis(Panel * self)
......
......@@ -99,14 +99,14 @@ void Graphic_MouseHoverNodeRecrutement(Player * player, Vector2 mousePosition, P
}
void Graphic_MouseHoverNodeChooseAttacker(Player * player, Vector2 mousePosition, Panel * panel){
for(int nodeIndex = 0; nodeIndex < player->nodeCount; nodeIndex++){
for(int nodeIndex = 0; nodeIndex < player-> nodeCount; nodeIndex++){
Node* currentNode = player->nodes[nodeIndex];
if(CheckCollisionPointRec(mousePosition, currentNode->collisionHitbox)){
Vector2 screenPosition= Panel_pixelFromPosition(panel, &(currentNode->position) );
DrawRing(screenPosition, 24.0, 28.0, 0.0, 360.0, 0.1, GOLD);
//DrawCircleV(screenPosition, 45, RAYWHITE);
if(!player->hasSelectedNode){
Vector2 screenPosition= Panel_pixelFromPosition(panel, &(currentNode->position) );
if(!player->hasSelectedNode && currentNode->soldiers > 1){
DrawRing(screenPosition, 24.0, 28.0, 0.0, 360.0, 0.1, GOLD);
DrawText("attacker", (int)screenPosition.x + 30 , (int)screenPosition.y, 20, GOLD);
Graphic_MouseHoverNodeChooseTarget(currentNode, mousePosition, panel);
}
}
}
......@@ -119,12 +119,13 @@ void Graphic_MouseHoverNodeChooseAttacker(Player * player, Vector2 mousePosition
void Graphic_MouseHoverNodeChooseTarget(Node * originNode, Vector2 mousePosition, Panel * panel){
for(int neighbourIndex = 0; neighbourIndex < originNode->card; neighbourIndex++){
Vector2 screenPosition = Panel_pixelFromPosition(panel, &(originNode->edges[neighbourIndex]._target->position) );
if( &(originNode->edges[neighbourIndex]._target->color) != &(originNode->color)){
if( originNode->edges[neighbourIndex]._target->color.r != originNode->color.r || originNode->edges[neighbourIndex]._target->color.g != originNode->color.g || originNode->edges[neighbourIndex]._target->color.b != originNode->color.b || originNode->edges[neighbourIndex]._target->color.a != originNode->color.a){
DrawRing(screenPosition, 24.0, 30.0, 0.0, 360.0, 0.1, GREEN);
if(CheckCollisionPointRec(mousePosition, originNode->edges[neighbourIndex]._target->collisionHitbox) && &(originNode->edges[neighbourIndex]._target->color) != &(originNode->color)){
DrawRing(screenPosition, 30.0, 33.0, 0.0, 360.0, 0.1, MAROON);
}
}
if(CheckCollisionPointRec(mousePosition, originNode->edges[neighbourIndex]._target->collisionHitbox) && &(originNode->edges[neighbourIndex]._target->color) != &(originNode->color)){
DrawRing(screenPosition, 30.0, 33.0, 0.0, 360.0, 0.1, MAROON);
}
}
}
......@@ -172,8 +173,8 @@ int Graphic_ChooseNumberOfAttackers(Player * attacker, Player * defender, Node *
ClearBackground(RAYWHITE);
Vector2 mousePosition = GetMousePosition();
DrawTextEx(font, whoseTurnToAttack, (Vector2){screenWidth/2 - (MeasureTextEx(font, whoseTurnToAttack, 50.0, 3.0).x) + 50 , 70} , 50.0, 3.0, attacker->color);
DrawTextEx(font, whoseTurnToDefend, (Vector2){screenWidth/2 + 50 , 70}, 50.0, 3.0, defender->color);
DrawTextEx(font, whoseTurnToAttack, (Vector2){screenWidth/2 - (MeasureTextEx(font, whoseTurnToAttack, 50.0, 3.0).x) + 100 , 70} , 50.0, 3.0, attacker->color);
DrawTextEx(font, whoseTurnToDefend, (Vector2){screenWidth/2 + 100 , 70}, 50.0, 3.0, defender->color);
DrawText("How many dices do you want to involve in the fight ?", screenWidth/2 - (MeasureTextEx(font, "How many dice do you want to involve in the fight ?", 30.0, 3.0).x)/2 + 50 , 150 , 30, attacker->color);
for(int i = 1 ; i < originNode->soldiersToAdd + originNode->soldiers ; i ++){
DrawRectangleRec(nbAttackerRectangle[i], BLACK);
......@@ -246,8 +247,6 @@ void diceRolling(Player * attacker, Player * defender, Node * originNode, Node *
}
for(int i = 0 ; i < defendersCount + 1 ; i++){
positionDiceDefender[i] = (Vector2){1000 + (i)*150, screenHeight - 500};
printf("position dice defender %d x : %f \n", i , positionDiceDefender[i].x);
printf("position dice defender %d y : %f \n", i , positionDiceDefender[i].y);
}
// Main game loop
......@@ -276,10 +275,10 @@ void diceRolling(Player * attacker, Player * defender, Node * originNode, Node *
ClearBackground(RAYWHITE);
DrawTextEx(font, whoseTurnToAttack, (Vector2){250 , 200} , 30.0, 3.0, attacker->color);
DrawTextEx(font, whoseTurnToDefend, (Vector2){screenWidth-700, 200}, 30.0, 3.0, defender->color);
DrawTextEx(font, " attacker", (Vector2){250 + MeasureTextEx(font, "Player X ", 30.0, 3.0).x , 210} , 15.0, 3.0, attacker->color);
DrawTextEx(font, " defender", (Vector2){screenWidth-700 + MeasureTextEx(font, "Player X ", 30.0, 3.0).x, 210}, 15.0, 3.0, defender->color);
DrawTextEx(font, whoseTurnToAttack, (Vector2){250 , 100} , 40.0, 3.0, attacker->color);
DrawTextEx(font, whoseTurnToDefend, (Vector2){screenWidth-700, 100}, 40.0, 3.0, defender->color);
DrawTextEx(font, " attacker", (Vector2){250 , 150} , 30.0, 3.0, attacker->color);
DrawTextEx(font, " defender", (Vector2){screenWidth-700, 150}, 30.0, 3.0, defender->color);
for(int i = 0 ; i < nbOfAttackers ; i++){
DrawTextureRec(diceTexture, frameRec, positionDiceAttacker[i], WHITE);
}
......@@ -321,10 +320,10 @@ void diceRolling(Player * attacker, Player * defender, Node * originNode, Node *
ClearBackground(RAYWHITE);
DrawTextEx(font, whoseTurnToAttack, (Vector2){250 , 200} , 30.0, 3.0, attacker->color);
DrawTextEx(font, whoseTurnToDefend, (Vector2){screenWidth-700, 200}, 30.0, 3.0, defender->color);
DrawTextEx(font, " attacker", (Vector2){250 + MeasureTextEx(font, "Player X ", 30.0, 3.0).x , 210} , 15.0, 3.0, attacker->color);
DrawTextEx(font, " defender", (Vector2){screenWidth-700 + MeasureTextEx(font, "Player X ", 30.0, 3.0).x, 210}, 15.0, 3.0, defender->color);
DrawTextEx(font, whoseTurnToAttack, (Vector2){250 , 100} , 40.0, 3.0, attacker->color);
DrawTextEx(font, whoseTurnToDefend, (Vector2){screenWidth-700, 100}, 40.0, 3.0, defender->color);
DrawTextEx(font, " attacker", (Vector2){250 , 150} , 30.0, 3.0, attacker->color);
DrawTextEx(font, " defender", (Vector2){screenWidth-700, 150}, 30.0, 3.0, defender->color);
for(int i = 0 ; i < nbOfAttackers ; i++){
switch (listOfDices[i])
{
......@@ -407,13 +406,13 @@ void diceRolling(Player * attacker, Player * defender, Node * originNode, Node *
if(listOfDices[index] > listOfDices[index + attackersCount]){
//targetNode->soldiers--;
//printf("Defenders lose a soldier\n");
DrawTextEx(font, "Defenders lose a soldier", (Vector2){screenWidth/2 - MeasureTextEx(font, "Defenders lose a soldier",50.0, 3.0 ).x/2 , 600}, 50.0, 3.0, BLACK);
DrawTextEx(font, "Defenders lose a soldier", (Vector2){screenWidth/2 - MeasureTextEx(font, "Defenders lose a soldier",50.0, 3.0 ).x/2 -50 , 600}, 50.0, 3.0, BLACK);
}else{
//originNode->soldiers--;
//remainingAttackers--;
//printf("Attackers lose a soldier\n");
DrawTextEx(font, "Attackers lose a soldier", (Vector2){screenWidth/2 - MeasureTextEx(font, "Attackers lose a soldier",50.0, 3.0 ).x/2 , 600}, 50.0, 3.0, BLACK);
DrawTextEx(font, "Attackers lose a soldier", (Vector2){screenWidth/2 - MeasureTextEx(font, "Attackers lose a soldier",50.0, 3.0 ).x/2 -50 , 600}, 50.0, 3.0, BLACK);
}
}
......
......@@ -84,6 +84,7 @@ int main(int nbArg, char ** arg)
}
break;
case game_ui:
BeginDrawing();
Panel_control(panel);
//Draw the hitboxes for each node
for(int index = 0; index < world->size; index++){
......@@ -92,6 +93,7 @@ int main(int nbArg, char ** arg)
world->nodes[index].collisionHitbox.y = screenPosition.y - 24;
}
game_update(world, players, gameFont, panel);
EndDrawing();
break;
case options:
//Activate/Deactivate inputs on click and detect click on the save btn
......@@ -196,6 +198,7 @@ void game_update(NetWorld * world, Player * players, Font font, Panel * panel)
int * listOfDices = Player_attack_Node(currentPlayer, &(players[nodePlayerID]), originNode, currentNode, nbOfAttackers);
int defendersCount = currentNode->soldiers >= 3? 2:1;
diceRolling(currentPlayer, &(players[nodePlayerID]), originNode, currentNode, nbOfAttackers , listOfDices ,font);
currentPlayer->hasSelectedNode = false;
free(listOfDices);
}else{
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment