Fixed ASCII rasterizer, abstracted out input and audio, and created CLI client (untested)
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -51,7 +51,7 @@ class SoftwareRasterizer extends Rasterizer {
|
||||
|
||||
// Darken Y-side walls for faux directional lighting
|
||||
if (side == 1) {
|
||||
pixelColor = _shadeColor(pixelColor);
|
||||
pixelColor = shadeColor(pixelColor);
|
||||
}
|
||||
|
||||
_buffer.pixels[y * width + x] = pixelColor;
|
||||
@@ -235,14 +235,6 @@ class SoftwareRasterizer extends Rasterizer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Darkens a 32-bit 0xAABBGGRR color by roughly 30% without touching Alpha
|
||||
int _shadeColor(int color) {
|
||||
int r = (color & 0xFF) * 7 ~/ 10;
|
||||
int g = ((color >> 8) & 0xFF) * 7 ~/ 10;
|
||||
int b = ((color >> 16) & 0xFF) * 7 ~/ 10;
|
||||
return (0xFF000000) | (b << 16) | (g << 8) | r;
|
||||
}
|
||||
|
||||
/// Tints the top 80% of the screen red based on player.damageFlash intensity
|
||||
void _applyDamageFlash() {
|
||||
// Grab the intensity (0.0 to 1.0)
|
||||
|
||||
Reference in New Issue
Block a user