removes unused resources, and embedded font fix

This commit is contained in:
Llywelwyn 2023-07-28 01:51:14 +01:00
parent d2648c4560
commit 32044dbb6a
16 changed files with 21 additions and 140 deletions

View file

@ -1,12 +0,0 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D screenTexture;
void main()
{
vec3 col = texture(screenTexture, TexCoords).rgb;
FragColor = vec4(col, 1.0);
}

View file

@ -1,11 +0,0 @@
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
void main()
{
TexCoords = aTexCoords;
gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
}

View file

@ -1,17 +0,0 @@
#version 330 core
out vec4 FragColor;
in vec3 ourColor;
in vec2 TexCoord;
in vec3 ourBackground;
// texture sampler
uniform sampler2D texture1;
void main()
{
vec4 original = texture(texture1, TexCoord);
if (original.r < 0.1f || original.g < 0.1f || original.b < 0.1f) discard;
vec4 fg = original * vec4(ourColor, 1.f);
FragColor = fg;
}

View file

@ -1,17 +0,0 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aColor;
layout (location = 2) in vec3 bColor;
layout (location = 3) in vec2 aTexCoord;
out vec3 ourColor;
out vec3 ourBackground;
out vec2 TexCoord;
void main()
{
gl_Position = vec4(aPos, 1.0);
ourColor = aColor;
ourBackground = bColor;
TexCoord = vec2(aTexCoord.x, aTexCoord.y);
}

View file

@ -1,16 +0,0 @@
#version 330 core
out vec4 FragColor;
in vec3 ourColor;
in vec2 TexCoord;
in vec3 ourBackground;
// texture sampler
uniform sampler2D texture1;
void main()
{
vec4 original = texture(texture1, TexCoord);
vec4 fg = original.r > 0.1f || original.g > 0.1f || original.b > 0.1f ? original * vec4(ourColor, 1.f) : vec4(ourBackground, 1.f);
FragColor = fg;
}

View file

@ -1,17 +0,0 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aColor;
layout (location = 2) in vec3 bColor;
layout (location = 3) in vec2 aTexCoord;
out vec3 ourColor;
out vec3 ourBackground;
out vec2 TexCoord;
void main()
{
gl_Position = vec4(aPos, 1.0);
ourColor = aColor;
ourBackground = bColor;
TexCoord = vec2(aTexCoord.x, aTexCoord.y);
}

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,26 +0,0 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D screenTexture;
uniform vec3 screenSize;
uniform bool screenBurn;
void main()
{
vec3 col = texture(screenTexture, TexCoords).rgb;
float scanLine = mod(gl_FragCoord.y, 2.0) * 0.25;
vec3 scanColor = col.rgb - scanLine;
if (col.r < 0.1f && col.g < 0.1f && col.b < 0.1f) {
if (screenBurn) {
float dist = (1.0 - distance(vec2(gl_FragCoord.x / screenSize.x, gl_FragCoord.y / screenSize.y), vec2(0.5,0.5))) * 0.2;
FragColor = vec4(0.0, dist, dist, 1.0);
} else {
FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
} else {
FragColor = vec4(scanColor, 1.0);
}
}

View file

@ -1,11 +0,0 @@
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
void main()
{
TexCoords = aTexCoords;
gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
}

View file

@ -37,12 +37,10 @@ mod particle_system;
use particle_system::{ParticleBuilder, DEFAULT_PARTICLE_LIFETIME, LONG_PARTICLE_LIFETIME}; use particle_system::{ParticleBuilder, DEFAULT_PARTICLE_LIFETIME, LONG_PARTICLE_LIFETIME};
mod random_table; mod random_table;
mod rex_assets; mod rex_assets;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
// Embedded resources for use in wasm build
rltk::embedded_resource!(CURSES14X16, "../resources/curses_14x16.png");
//Consts //Consts
pub const SHOW_MAPGEN: bool = false; pub const SHOW_MAPGEN: bool = false;
@ -208,7 +206,12 @@ impl State {
// Notify player, restore health up to a point. // Notify player, restore health up to a point.
let player_entity = self.ecs.fetch::<Entity>(); let player_entity = self.ecs.fetch::<Entity>();
gamelog::Logger::new().append("You descend the stairwell, and take a moment to gather your strength.").log(); gamelog::Logger::new()
.append("Taking a short rest, you manage to")
.colour((0, 255, 0))
.append("recover some of your strength")
.period()
.log();
let mut player_health_store = self.ecs.write_storage::<CombatStats>(); let mut player_health_store = self.ecs.write_storage::<CombatStats>();
let player_health = player_health_store.get_mut(*player_entity); let player_health = player_health_store.get_mut(*player_entity);
if let Some(player_health) = player_health { if let Some(player_health) = player_health {
@ -482,15 +485,20 @@ const DISPLAYWIDTH: i32 = 100;
const DISPLAYHEIGHT: i32 = 56; const DISPLAYHEIGHT: i32 = 56;
fn main() -> rltk::BError { fn main() -> rltk::BError {
rltk::link_resource!(CURSES14X16, "../resources/curses_14x16.png"); // Embedded resources for use in wasm build
const CURSES_14_16_BYTES: &[u8] = include_bytes!("../resources/curses14x16.png");
rltk::embedding::EMBED.lock().add_resource("resources/curses14x16.png".to_string(), CURSES_14_16_BYTES);
//rltk::link_resource!(CURSES14X16, "../resources/curses_14x16.png");
use rltk::RltkBuilder; use rltk::RltkBuilder;
let context = RltkBuilder::new() let context = RltkBuilder::new()
.with_title("rust-rl") .with_title("rust-rl")
.with_dimensions(DISPLAYWIDTH, DISPLAYHEIGHT) .with_dimensions(DISPLAYWIDTH, DISPLAYHEIGHT)
.with_fps_cap(60.0) .with_fps_cap(60.0)
.with_font("curses_14x16.png", 14, 16) .with_font("curses14x16.png", 14, 16)
.with_tile_dimensions(14, 16) .with_tile_dimensions(14, 16)
.with_fancy_console(DISPLAYWIDTH, DISPLAYHEIGHT, "curses_14x16.png") .with_fancy_console(DISPLAYWIDTH, DISPLAYHEIGHT, "curses14x16.png")
//.with_simple_console_no_bg(DISPLAYWIDTH, DISPLAYHEIGHT, "terminal8x8.jpg") //.with_simple_console_no_bg(DISPLAYWIDTH, DISPLAYHEIGHT, "terminal8x8.jpg")
.build()?; .build()?;

View file

@ -801,16 +801,16 @@ function __wbg_get_imports() {
const ret = wasm.memory; const ret = wasm.memory;
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper718 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper780 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 155, __wbg_adapter_20); const ret = makeMutClosure(arg0, arg1, 127, __wbg_adapter_20);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper1688 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper1798 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 359, __wbg_adapter_23); const ret = makeMutClosure(arg0, arg1, 375, __wbg_adapter_23);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper1690 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper1800 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 359, __wbg_adapter_23); const ret = makeMutClosure(arg0, arg1, 375, __wbg_adapter_23);
return addHeapObject(ret); return addHeapObject(ret);
}; };

Binary file not shown.