Allegro 5, C++, and Math -


i'm writing game, , i've decided use allegro 5 , c/c++. i've worked out of bugs in code far, i've come graphics , mathematical computations included, , i'm stuck.

here's short version:

al_draw_rotated_bitmap(...) doesn't much. image onscreen, other times isn't. i've verified loaded drawing al_draw_bitmap(...), , well, plus, no segfaults on drawing, else works.

just reference, documentation says arguments of al_draw_rotated_bitmap(...):

al_draw_rotated_bitmap(allegro_bitmap *bitmap, float cx, float cy, float dx, float dy, float angle, int flags)

where cx x-center, cy y-center, dx x-destination, dy y-destination, angle angle rotate in radians, , flags combination of things telling allegro if should perform +/- 90 degree turn on bitmap.

i've tried many things, , none of them produce desired results. i've tried making c&d(x,y) same, different, setting dx&dy center of rotation, cx&cy various points in bitmap, in backbuffer, on center of rotation, etc. i'm being really, stupid , missing here, haven't been able figure out. if knows how function works , willing me out making work, glad have advice. thank you.

2014-04-08: asked post code relevant function, here goes:

the actual drawing:

void renderplayer(player player)     { cout << player.x << " " << player.y << endl; float angle = 0; al_draw_rotated_bitmap(player.tex, 200, 200, 0, 0, angle, null); } 

this struct definition of player:

struct player   { float x; float y; float r; float t; int radius; int sizex; int sizey; int health; int speed; allegro_bitmap *tex; weapon weapon; }; 

okay, i'm not sure why didn't work before... way should work follows:

al_draw_rotated_bitmap(allegro_bitmap *yourbmp, int bitmap_coord_x, int bitmap_coord_y, int screen_coord_x, int screen_coord_y, float angle_in_radians, int flags)

that works fine me! still bewilders me why didn't work @ first... suspect else in code.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -