some simple rotation

This commit is contained in:
Frank Villaro-Dixon 2015-01-01 07:40:25 +01:00
parent b45f1d015d
commit 94ad076fc8
2 changed files with 6 additions and 9 deletions

5
main.c
View file

@ -27,8 +27,6 @@ start:
add_obstacle(&ga, a);
int rotation = 0;
while(1) {
SDL_FillRect(ga.screen, NULL, 0);
if(!(ga.counter % 28)) {
@ -50,8 +48,7 @@ start:
ga.counter++;
ga.general_rotation += rotation;
ga.general_rotation %= ANGLE_MAX;
ga.general_rotation = ga.counter*3;
ga.sexual_pulsation = 0.3 * fabs(cos(ga.counter*M_PI/45)) + 1 +
0.3 * fabs(sin(ga.counter*M_PI/90));

View file

@ -14,7 +14,7 @@
#include "SDL/SDL.h"
SDL_Point
get_hexagon_vertice(struct s_game *g, int faceno, int dist) { //{{{
get_hexagon_vertice(int faceno, int dist) { //{{{
SDL_Point p1;
p1.x = dist * cos((M_PI/3)*faceno);
@ -28,10 +28,10 @@ void
draw_hexagon_side(struct s_game *g, int faceno, int dist, int thick, int col) { //{{{
SDL_Point p1, p2, p3, p4;
p1 = get_hexagon_vertice(g, faceno, dist);
p2 = get_hexagon_vertice(g, faceno+1, dist);
p3 = get_hexagon_vertice(g, faceno+1, dist+thick);
p4 = get_hexagon_vertice(g, faceno, dist+thick);
p1 = get_hexagon_vertice(faceno, dist);
p2 = get_hexagon_vertice(faceno+1, dist);
p3 = get_hexagon_vertice(faceno+1, dist+thick);
p4 = get_hexagon_vertice(faceno, dist+thick);
SDL_Point points[4] = {to_screen_coords(g, p1),
to_screen_coords(g, p2),