If nobody's started, I'll dive in. I might drown, but hey.
EDIT: A start.
Code: Select all
GUIHLine:
cmp ecx,0
jl near .nodraw
cmp eax,255
jg near .nodraw
cmp eax,0
jnl .noofx
mov eax,0
.noofx
cmp ecx,255
jng .noofx2
mov ecx,255
.noofx2
cmp ebx,0
jl .nodraw
cmp ebx,223
jg .nodraw
sub ecx,eax
inc ecx
mov edi,[vidbuffer]
add edi,eax
add edi,16
mov eax,ebx
shl eax,8
add edi,eax
mov eax,ebx
shl eax,5
add edi,eax
mov eax,edx
rep stosb
.nodraw
ret
Code: Select all
const int vidBufferWidth = 256;
const int vidBufferHeight = 224;
void GUIHLine( unsigned char *vidBuffer, int startX, int endX, int y, unsigned char color ) {
int width, ctr;
unsigned char *dest;
if( endX < 0 || startX >= vidBufferWidth ) return;
if( startX < 0 ) startX = 0;
if( endX >= vidBufferWidth ) endX = vidBufferWidth - 1;
if( y < 0 || y >= vidBufferHeight ) return;
width = endX - startX + 1;
dest = vidBuffer + startX + 16 + (y * vidBufferWidth);
dest += y * 32;
for( ctr = width; ctr > 0; --ctr ) {
*dest = color;
++dest;
}
return;
}