You can create a camera like this :
Code: Select all
struct ya2d_camera *CAMERA;
//we center camera on the screen
CAMERA = ya2d_init_camera(240.0f, 136.0f, 4.0f, 1.0f, 1.0f);
//params : camera x ; camera y ; camera speed; camera zoom (1.0f default dont change this for the moment) ;
camera zoom speed (useless for the moment)
if(CAMERA == NULL) goto exit;
New functions are this (explained well) :
Code: Select all
tinyfont_draw_stringf(@x, @y, @font_size, @color, @"hello world ! %d", @int variable);
tinyfont_draw_rotated_string(@x, @y, @font_size, @color, @"hello world !");
/* if you wanna set parameters in draw string rotated you need use sprintf function (look on the internet how to use it) */
Code: Select all
/* note : if you not using camera set NULL, it will draw thhe thing normaly on screen */
ya2d_draw_pixel(struct ya2d_camera *c, int x, int y, unsigned int color);
ya2d_draw_line(struct ya2d_camera *c, int x0, int y0, int x1, int y1, unsigned int color);
ya2d_draw_rect(struct ya2d_camera *c, int x, int y, int w, int h, unsigned int color, int filled);
ya2d_draw_grid(struct ya2d_camera *c, int start_x, int start_y, int size_x, int size_y, int num_x, int num_y, int line_size, unsigned int color);
ya2d_draw_grid_centered(struct ya2d_camera *c, int start_x, int start_y, int size_x, int size_y, int num_x, int num_y, int line_size, unsigned int color);
Code: Select all
ya2d_draw_texture_scale_size_defined(struct ya2d_texture *texture, int x, int y, int size_x, int size_y);
here you can have a look at the sample file for more training :
http://pastebin.com/q5KvTXNM
Advertising