Difference between revisions of "FillArea"
From WikiPrizm
Jump to navigationJump to search (Don't use a hard-coded address.) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Synopsis == | == Synopsis == | ||
Fills a rectangular area of (width,height) with upper-left corner at (x,y) | Fills a rectangular area of (width,height) with upper-left corner at (x,y) | ||
− | |||
== Source code == | == Source code == | ||
− | void fillArea(unsigned x,unsigned y,unsigned w,unsigned h,unsigned short col){ | + | <nowiki>void fillArea(unsigned x,unsigned y,unsigned w,unsigned h,unsigned short col){ |
− | unsigned short*s=(unsigned short*) | + | unsigned short*s=(unsigned short*)GetVRAMAddress(); |
s+=(y*384)+x; | s+=(y*384)+x; | ||
while(h--){ | while(h--){ | ||
Line 13: | Line 12: | ||
} | } | ||
}</nowiki> | }</nowiki> | ||
+ | |||
== Inputs == | == Inputs == | ||
− | x - X coordinate of the upper-left corner. | + | x - X coordinate of the upper-left corner.<br /> |
− | x - Y coordinate of the upper-left corner. | + | x - Y coordinate of the upper-left corner.<br /> |
− | w - Width of the filled rectangle. | + | w - Width of the filled rectangle.<br /> |
− | h - Height of the filled rectangle. | + | h - Height of the filled rectangle.<br /> |
− | col - Color of the filled rectangle. | + | col - Color of the filled rectangle.<br /> |
== Comment == | == Comment == | ||
Function written by ProgrammerNerd | Function written by ProgrammerNerd | ||
− | |||
− | |||
− | |||
− | |||
[[Category: Useful Routines]] | [[Category: Useful Routines]] |
Latest revision as of 19:14, 1 May 2021
Contents
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*)GetVRAMAddress(); 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