Pages: [1]
  Print  
Author Topic: GML: All draw_background functions + 2 custom ones  (Read 1987 times)
Offline (Unknown gender) TheExDeus
Posted on: September 28, 2010, 12:05:55 PM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
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.
« Last Edit: September 28, 2010, 12:55:40 PM by HaRRiKiRi » Logged
Offline (Male) Josh @ Dreamland
Reply #1 Posted on: September 28, 2010, 12:12:55 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2932

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TheExDeus
Reply #2 Posted on: September 28, 2010, 12:56:26 PM

Developer
Joined: Apr 2008
Posts: 1886

View Profile
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.
Logged
Offline (Male) Josh @ Dreamland
Reply #3 Posted on: September 28, 2010, 09:37:08 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2932

View Profile Email
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*
« Last Edit: September 28, 2010, 09:38:42 PM by Josh @ Dreamland » Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Josh @ Dreamland
Reply #4 Posted on: October 16, 2010, 01:27:02 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2932

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #5 Posted on: October 16, 2010, 01:38:51 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
why not:
enigma::bounded_texture_index
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #6 Posted on: October 16, 2010, 01:39:30 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2932

View Profile Email
Because serp just felt like shortening it nonsensically.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #7 Posted on: October 16, 2010, 01:41:27 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
then how about changing it sensically? :D
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Pages: [1]
  Print