bg rendering
This commit is contained in:
parent
db28c7403b
commit
3b70a36e88
Binary file not shown.
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 35 KiB |
@ -1,9 +1,6 @@
|
|||||||
use raylib::{RaylibHandle, RaylibThread};
|
use raylib::{RaylibHandle, RaylibThread};
|
||||||
|
|
||||||
use crate::{
|
use crate::{StaticGameData, utilities::{datastore::{load_texture_from_internal_data, ResourceLoadError}, world_paint_texture::WorldPaintTexture}};
|
||||||
utilities::datastore::{load_texture_from_internal_data, ResourceLoadError},
|
|
||||||
StaticGameData,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::Level;
|
use super::Level;
|
||||||
|
|
||||||
@ -26,13 +23,15 @@ pub fn load_all_levels(
|
|||||||
let mut levels = Vec::new();
|
let mut levels = Vec::new();
|
||||||
|
|
||||||
for level_name in &level_names {
|
for level_name in &level_names {
|
||||||
|
|
||||||
|
|
||||||
levels.push(Level {
|
levels.push(Level {
|
||||||
name: level_name.to_string(),
|
name: level_name.to_string(),
|
||||||
background_tex: load_texture_from_internal_data(
|
background_tex: WorldPaintTexture::new(load_texture_from_internal_data(
|
||||||
raylib_handle,
|
raylib_handle,
|
||||||
thread,
|
thread,
|
||||||
&format!("levels/{}/background.png", level_name),
|
&format!("levels/{}/background.png", level_name),
|
||||||
)?,
|
)?),
|
||||||
platform_tex: load_texture_from_internal_data(
|
platform_tex: load_texture_from_internal_data(
|
||||||
raylib_handle,
|
raylib_handle,
|
||||||
thread,
|
thread,
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
use raylib::{math::Rectangle, texture::Texture2D};
|
use raylib::{math::Rectangle, texture::Texture2D};
|
||||||
|
|
||||||
|
use crate::utilities::world_paint_texture::WorldPaintTexture;
|
||||||
|
|
||||||
pub mod loader;
|
pub mod loader;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Level {
|
pub struct Level {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub background_tex: Texture2D,
|
pub background_tex: WorldPaintTexture,
|
||||||
pub platform_tex: Texture2D,
|
pub platform_tex: Texture2D,
|
||||||
pub colliders: Vec<Rectangle>
|
pub colliders: Vec<Rectangle>
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ impl WorldSpaceRender for InGameScreen {
|
|||||||
let cur_level = self.levels.get(self.current_level_idx).unwrap();
|
let cur_level = self.levels.get(self.current_level_idx).unwrap();
|
||||||
|
|
||||||
// Render the world background
|
// Render the world background
|
||||||
// self.world_background.render(raylib, Vector2::new(0.0, -1080.0), &self.camera);
|
cur_level.background_tex.render(raylib, Vector2::new(0.0, -1080.0), &self.camera);
|
||||||
|
|
||||||
// Render the platform layer
|
// Render the platform layer
|
||||||
raylib.draw_texture_v(
|
raylib.draw_texture_v(
|
||||||
|
Reference in New Issue
Block a user