Advertising (This ad goes away for registered users. You can Login or Register)

[Release] Ya2d lib by Xerpi Remix [camera support]

Most of the homebrews discussed in this forum can be downloaded here
Post Reply
Camxpspx123
Banned
Posts: 265
Joined: Sun Jul 15, 2012 6:23 pm

[Release] Ya2d lib by Xerpi Remix [camera support]

Post by Camxpspx123 » Sun Oct 18, 2015 3:35 pm

http://www.mediafire.com/download/yjpjz ... _Remix.rar

New functions : see post bellow

Image

I am drawing 4096x4096 grid cases, that's enormous, be you can draw this without problem using the specified drawing grid function :D


Instructions :
-> Download the original : https://github.com/xerpi/ya2d https://github.com/xerpi/libtinyfont
-> Install my remix
-> start coding !

Thanks kiss :*
Advertising
Last edited by Camxpspx123 on Mon Oct 19, 2015 6:50 pm, edited 3 times in total.

Camxpspx123
Banned
Posts: 265
Joined: Sun Jul 15, 2012 6:23 pm

Re: [YA2D/VITA2DLIB RMX] mod of util lib by Xerpi !

Post by Camxpspx123 » Mon Oct 19, 2015 6:40 pm

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

Post Reply

Return to “Homebrews”