master
orange 12 years ago
parent 53f90ed803
commit 697f7dfd27

@ -25,7 +25,7 @@ struct cb {
int start;
int end;
elem_t * elems;
elem_t *elems;
};
typedef struct cb cb_t;
@ -45,7 +45,7 @@ void cb_init(cb_t * cb, int size) {
cb->start = 0;
cb->elems = malloc(sizeof(elem_t)*size);
cb->elems = malloc(sizeof(elem_t) * size);
if (!cb->elems)
dienomem();
}

@ -17,7 +17,7 @@ void xy2rc(float x, float y, int *r, int *c) {
}
float lerp(float from, float to, float t) {
return from + t * (to-from);
return from + t * (to - from);
}
float ball_x = 0.0;
@ -36,7 +36,7 @@ void paint_ball() {
void paint_paddles() {
int r, c;
xy2rc( 0, pad_l, &r, &c);
xy2rc(0, pad_l, &r, &c);
mvaddch(r, c, ACS_VLINE);
xy2rc(MAX_X, pad_r, &r, &c);
@ -53,17 +53,17 @@ void paint() {
}
int main() {
initscr(); /* Start curses mode */
curs_set(0); /* Disable cursor */
initscr(); /* Start curses mode */
curs_set(0); /* Disable cursor */
while(true) {
while (true) {
ball_x += dir_x;
ball_y += dir_y;
if (ball_x>MAX_X || ball_x<0) {
if (ball_x > MAX_X || ball_x < 0) {
dir_x = -dir_x;
}
if (ball_y>MAX_Y || ball_y<0) {
if (ball_y > MAX_Y || ball_y < 0) {
dir_y = -dir_y;
}
@ -79,6 +79,6 @@ int main() {
usleep(50000);
}
getch(); /* Wait for user input */
endwin(); /* End curses mode */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
}

@ -5,7 +5,7 @@ struct test {
};
typedef struct test test_t;
int main(int argc, char * argv[]) {
int main(int argc, char *argv[]) {
test_t a = { 23 };
test_t b = { 42 };

Loading…
Cancel
Save