HeHe I'm done lesson 9's assignment!
HeHe I'm done lesson 9's assignment!
Hi Hi , I can move color in the box but the result seems like opposite with the result of Chili
- Attachments
-
- Chili DirectX Framework change box color - Copy.zip
- (35.88 KiB) Downloaded 209 times
Re: HeHe I'm done lesson 9's assignment!
Hmm... Can you specify the problem? I'm kinda lazy.
Looks cool for sure.
Looks cool for sure.
ʕ •ᴥ•ʔ
Re: HeHe I'm done lesson 9's assignment!
Check it out!
- Attachments
-
- Chili DirectX Framework change box color - Copy.rar
- (343.32 KiB) Downloaded 185 times
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: HeHe I'm done lesson 9's assignment!
Code: Select all
void Game::ComposeFrame()
{
int y = boxY; // dividing int's where the result is less than 1 but greater than 0 will return 0
// if you want a decimal use float instead of int
while( y < boxY + boxWidth )
{
int x = boxX; // if you change the int y to float y you might want to do the same here.
while( x < boxX + boxWidth )
{
if (x/b==y/b)
// It didn't seem to make a difference, but you forgot the { }
gfx.PutPixel( x,y,(x+50)*b/2/(y+50)*2,(y+50)/(x+50)*b+100,(y+50)*(x+50)/2/b);
else
// again missing the { }
gfx.PutPixel(x,y,x+b,b-y,max(x,y));
x++;
}
y++;
}
// adjust the size of the box
if( kbd.SpaceIsPressed() )
{
// missing the { } and b never changes, b = 400 the entire program so this code
// never gets executed.
if ( b<3 || b>800)f*=-1;
b+= f*2;
}
if( kbd.EnterIsPressed() )
{
boxWidth = boxWidth + 3;
}
// move the box
if( kbd.RightIsPressed() )
{
boxX = boxX + 3;
}
if( kbd.LeftIsPressed() )
{
boxX = boxX - 3;
}
if( kbd.UpIsPressed() )
{
boxY = boxY - 3;
}
if( kbd.DownIsPressed() )
{
boxY = boxY + 3;
}
}
Code: Select all
while( y < boxY + boxWidth )
https://www.dropbox.com/s/psuv1y1rg6rsf ... ompare.png
Left half is what is displayed with x and y being int and right half is x and y being float.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com