Difference between revisions of "FillArea"

From WikiPrizm
Jump to navigationJump to search
Line 12: Line 12:
 
s+=384-w;
 
s+=384-w;
 
}
 
}
}
+
}</nowiki>
 
== Inputs ==
 
== Inputs ==
 
x - X coordinate of the upper-left corner.
 
x - X coordinate of the upper-left corner.
Line 21: Line 21:
 
== Comment ==
 
== Comment ==
 
Function written by ProgrammerNerd
 
Function written by ProgrammerNerd
</nowiki>
+
[[Category: Useful Routines]]
  
 
== Comment ==
 
== Comment ==
 
Function written by Programmer Nerd.
 
Function written by Programmer Nerd.
 
[[Category: Useful Routines]]
 
[[Category: Useful Routines]]

Revision as of 20:50, 17 April 2014

Synopsis

Fills a rectangular area of (width,height) with upper-left corner at (x,y)

== Source code ==
void fillArea(unsigned x,unsigned y,unsigned w,unsigned h,unsigned short col){
	unsigned short*s=(unsigned short*)0xA8000000;
	s+=(y*384)+x;
	while(h--){
		unsigned w2=w;
		while(w2--)
			*s++=col;
		s+=384-w;
	}
}

Inputs

x - X coordinate of the upper-left corner. x - Y coordinate of the upper-left corner. w - Width of the filled rectangle. h - Height of the filled rectangle. col - Color of the filled rectangle.

Comment

Function written by ProgrammerNerd

Comment

Function written by Programmer Nerd.