ENIGMA Forums
Contributing to ENIGMA => Function Peer Review => Topic started by: TheExDeus on September 28, 2010, 12:05:55 pm
-
Description: These are all draw_background functions in GM. They are exactly the same except draw_background_general, which has 3 more arguments. It allows not only color for each individual corner, but also alpha. There are also 2 custom functions. draw_background_tiled_area and draw_background_tiled_area_ext which tiles background over a specific region.
Functions:
draw_background(int back, double x, double y);
draw_background_stretched(int back, double x, double y, double w, double h);
draw_background_tiled(int back,double x,double y);
draw_background_tiled_area(int back,double x,double y,double x1,double y1,double x2,double y2);
draw_background_part(int back,double left,double top,double width,double height,double x,double y);
draw_background_ext(int back,double x,double y,double xscale,double yscale,double rot,int color,double alpha);
draw_background_stretched_ext(int back,double x,double y,double w,double h,int color,double alpha);
draw_background_tiled_ext(int back,double x,double y,double xscale,double yscale,int color,double alpha);
draw_background_tiled_area_ext(int back,double x,double y,double x1,double y1,double x2,double y2, double xscale, double yscale, int color, double alpha);
draw_background_part_ext(int back,double left,double top,double width,double height,double x,double y,double xscale,double yscale,int color,double alpha);
draw_background_general(int back,double left,double top,double width,double height,double x,double y,double xscale,double yscale,double rot,int c1,int c2,int c3,int c4,double a1,double a2,double a3,double a4);
As the code itself would be too long to post here, I just added GSbackground.h and GSbackground.cpp as attachments.
Note, there is a bug in that sprite functions will draw a background after one of these functions are called. I already posted a ticket, and when TGMG or Josh fixes that then I guess these functions will need a little upgrading. Also, while working on these functions I noticed that some of the sprite functions are incomplete too. Like draw_sprite_general doesn't use rotation argument. I will maybe change that too.
edit: "Bug" was solved. Redownload attachments.
-
You probably didn't reset the currently bound texture index. enigma::cur_bou_tha_noo_sho_eve_cha_eve or something. Serp shortened it for me. Originally it was massively huge to prevent stupidity.
I will see that these are integrated properly when I merge my current branch and the trunk.
-
Ou thats what enigma::cur_bou_tha_noo_sho_eve_cha_eve is for. For some reason that variable didn't make much sense when it consisted of 8 shortened words(!?). :D
So I added that and now it is fixed. I reuploaded the attachment.
-
Yes, the original was called enigma::currently_bound_texture_index_that_noone_should_ever_change_ever. Because if it's not aligned with the bound index, well, sprites fuck up. Sadly, the check on that variable takes less time than just asking the graphics card to bind it either way. At least, according to an early benchmark. I may re-clock it.
But anyway, serp was unhappy with its deliberately excessive length, and so he shortened it to something nonsensical. *shrug*
-
Okay, seeing those corrections (especially in comparison to TGMG's original code) I am happy with the look of things. These functions will appear in ENIGMA's next revision.
-
why not:
enigma::bounded_texture_index
-
Because serp just felt like shortening it nonsensically.
-
then how about changing it sensically? :D