1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Move big chunky pixel colors to separate function

Again, to make sure colors don't update more than 1000/34 frames a
second, we'll need to separate this color calculation from rendeirng
functions.
This commit is contained in:
Misa 2020-04-30 14:57:21 -07:00 committed by Ethan Lee
parent fce56fde09
commit 4c2d219e45
2 changed files with 15 additions and 9 deletions

View file

@ -1599,15 +1599,7 @@ void Graphics::drawentities()
case 3: // Big chunky pixels! case 3: // Big chunky pixels!
prect.x = xp; prect.x = xp;
prect.y = yp - yoff; prect.y = yp - yoff;
//A seperate index of colours, for simplicity FillRect(backBuffer, prect, bigchunkygetcol(obj.entities[i].colour));
if(obj.entities[i].colour==1)
{
FillRect(backBuffer, prect, (fRandom() * 64), 10, 10);
}
else if (obj.entities[i].colour == 2)
{
FillRect(backBuffer,prect, int(160- help.glow/2 - (fRandom()*20)), 200- help.glow/2, 220 - help.glow);
}
break; break;
case 4: // Small pickups case 4: // Small pickups
huetilesetcol(obj.entities[i].colour); huetilesetcol(obj.entities[i].colour);
@ -2673,6 +2665,19 @@ void Graphics::huetilesetcol(int t)
} }
} }
Uint32 Graphics::bigchunkygetcol(int t)
{
//A seperate index of colours, for simplicity
switch (t)
{
case 1:
return getRGB((fRandom() * 64), 10, 10);
case 2:
return getRGB(int(160- help.glow/2 - (fRandom()*20)), 200- help.glow/2, 220 - help.glow);
}
return 0x00000000;
}
void Graphics::setwarprect( int a, int b, int c, int d ) void Graphics::setwarprect( int a, int b, int c, int d )
{ {
warprect.x = a; warprect.x = a;

View file

@ -34,6 +34,7 @@ public:
void drawhuetile(int x, int y, int t); void drawhuetile(int x, int y, int t);
void huetilesetcol(int t); void huetilesetcol(int t);
Uint32 bigchunkygetcol(int t);
void drawgravityline(int t); void drawgravityline(int t);