Incorporate squish offset

master
En Yi 2019-11-23 18:05:00 +08:00
parent cd263f0dd5
commit 0a3fefb194
3 changed files with 11 additions and 12 deletions

8
.gitignore vendored
View File

@ -1,4 +1,4 @@
Make*
.vscode
main
main.code-workspace
*
!*.c
!*.h
!.gitignore

5
main.c
View File

@ -38,7 +38,7 @@ int main()
camera.rotation = 0.0f;
camera.zoom = 1.0f;
struct kinematic_obj player = init_kinematic_obj(30, 30);
struct kinematic_obj player = init_kinematic_obj(40, 40);
player.color = BLUE;
struct kinematic_obj tile = init_kinematic_obj(900, 100);
set_position(&player, 400, 300);
@ -92,8 +92,7 @@ int main()
DrawRectangleRec(current->obj->rect, current->obj->color);
current = current->next;
}
DrawTriangle((Vector2){0,0},
(Vector2){screenWidth, screenHeight}, (Vector2){50,0}, BLACK);
DrawFPS(100,100);
draw_squishy(&sqr);
EndMode2D();

View File

@ -33,13 +33,13 @@ void update_squishy(struct squishy_square *square){
square->bottomright.y = square->rect->y + square->rect->height;
square->top_handle.x = square->rect->x + square->rect->width / 2;
square->top_handle.y = square->rect->y;
square->top_handle.y = square->rect->y + square->top_offset;
square->bottom_handle.x = square->rect->x + square->rect->width / 2;
square->bottom_handle.y = square->rect->y + square->rect->height;
square->left_handle.x = square->rect->x;
square->bottom_handle.y = square->rect->y + square->rect->height - square->bottom_offset;
square->left_handle.x = square->rect->x + square->left_offset;
square->left_handle.y = square->rect->y + square->rect->height / 2;
square->right_handle.x = square->rect->x + square->rect->width;
square->right_handle.y = square->rect->y+ square->rect->height / 2;
square->right_handle.x = square->rect->x + square->rect->width - square->right_offset;
square->right_handle.y = square->rect->y+ square->rect->height / 2;
}
void draw_squishy(struct squishy_square *square){