Skip to content

Commit

Permalink
Now moving texture stuff into its own directory. This will help me sp…
Browse files Browse the repository at this point in the history
…lit that code more up later.
  • Loading branch information
CaspianA1 committed Jan 21, 2025
1 parent d29e81b commit 7222a16
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/dashboard_defs/easing_fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn ease_out_bounce(mut x: f64) -> f64 {
//////////

pub mod scroll {
use crate::texture::TextTextureScrollEaser;
use crate::texture::texture::TextTextureScrollEaser;

pub const STAY_PUT: TextTextureScrollEaser = (|_, _| (0.0, true), 1.0);

Expand Down Expand Up @@ -54,7 +54,7 @@ pub mod scroll {
pub mod transition {
pub mod opacity {
use crate::{
texture::TextureTransitionOpacityEaser,
texture::texture::TextureTransitionOpacityEaser,

dashboard_defs::easing_fns::{
ease_out_bounce,
Expand Down Expand Up @@ -92,7 +92,7 @@ pub mod transition {
pub mod aspect_ratio {
use crate::{
dashboard_defs::easing_fns::ease_out_bounce,
texture::TextureTransitionAspectRatioEaser
texture::texture::TextureTransitionAspectRatioEaser
};

pub const LINEAR: TextureTransitionAspectRatioEaser = |percent_done| percent_done;
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/funky_remake_transitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
generic_result::*
},

texture::{
texture::texture::{
TexturePool,
TextureCreationInfo,
RemakeTransitionInfo,
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/shared_window_state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
spinitron::state::SpinitronState,
texture::{FontInfo, TextureCreationInfo},
texture::texture::{FontInfo, TextureCreationInfo},
dashboard_defs::{twilio::TwilioState, clock::ClockHands, error::ErrorState}
};

Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/spinitron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
shared_window_state::SharedWindowState
},

texture::{
texture::texture::{
DisplayText,
TextDisplayInfo,
TextureCreationInfo
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/surprise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::{
update_rate::{Seconds, UpdateRateCreator}
},

texture::{TexturePool, TextureCreationInfo},
texture::texture::{TexturePool, TextureCreationInfo},
dashboard_defs::shared_window_state::SharedWindowState

};
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/themes/barebones.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use sdl2::{render::BlendMode, ttf::{FontStyle, Hinting}};
use crate::{
themes::shared_utils::*,
spinitron::{model::SpinitronModelName, state::SpinitronState},
texture::{FontInfo, TextureCreationInfo, TexturePool, RemakeTransitionInfo},
texture::texture::{FontInfo, TextureCreationInfo, TexturePool, RemakeTransitionInfo},

utility_types::{
file_utils,
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/themes/retro_room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use sdl2::{render::BlendMode, ttf::{FontStyle, Hinting}};
use crate::{
themes::shared_utils::*,
spinitron::{model::SpinitronModelName, state::SpinitronState},
texture::{FontInfo, TextureCreationInfo, TexturePool, RemakeTransitionInfo},
texture::texture::{FontInfo, TextureCreationInfo, TexturePool, RemakeTransitionInfo},

utility_types::{
file_utils,
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/themes/shared_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use crate::{
error_msg,
window_tree::{Window, WindowContents},
texture::{TextureCreationInfo, TexturePool},
texture::texture::{TextureCreationInfo, TexturePool},

utility_types::{
file_utils,
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/themes/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use sdl2::{render::BlendMode, ttf::{FontStyle, Hinting}};
use crate::{
themes::shared_utils::*,
spinitron::{model::SpinitronModelName, state::SpinitronState},
texture::{FontInfo, TextureCreationInfo, TexturePool, RemakeTransitionInfo},
texture::texture::{FontInfo, TextureCreationInfo, TexturePool, RemakeTransitionInfo},

utility_types::{
file_utils,
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/twilio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
},

window_tree::{ColorSDL, Window, WindowContents, WindowUpdaterParams},
texture::{FontInfo, DisplayText, TextDisplayInfo, TextureCreationInfo, TextureHandle, TexturePool, RemakeTransitionInfo}
texture::texture::{FontInfo, DisplayText, TextDisplayInfo, TextureCreationInfo, TextureHandle, TexturePool, RemakeTransitionInfo}
};

// TODO: split this file up into some smaller files
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard_defs/updatable_text_pattern.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::borrow::Cow;

use crate::{
texture::{
texture::texture::{
FontInfo,
DisplayText,
TextDisplayInfo,
Expand Down
4 changes: 3 additions & 1 deletion src/dashboard_defs/weather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::HashMap, borrow::Cow};

use crate::{
request,
texture::{DisplayText, TextDisplayInfo, TextureCreationInfo},
texture::texture::{DisplayText, TextDisplayInfo, TextureCreationInfo},

utility_types::{
vec2f::Vec2f,
Expand Down Expand Up @@ -82,6 +82,8 @@ impl Updatable for WeatherStateData {

// TODO: while the weather is fetched every 10 minutes, use the other 9 minutes' forecasts for more updated data
async fn update(&mut self, _: &Self::Param) -> MaybeError {
// return Ok(()); // Use this line when developing locally, and you don't want to rate-limit this API in the studio!

let all_info_json: serde_json::Value = request::as_type(request::get(&self.request_url)).await?;

let current_weather_json = &all_info_json["data"]["timelines"][0]["intervals"][0]["values"];
Expand Down
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn get_fps(sdl_timer: &sdl2::TimerSubsystem,
}

/*
fn check_for_texture_pool_memory_leak(initial_num_textures_in_pool: &mut Option<usize>, texture_pool: &texture::TexturePool) {
fn check_for_texture_pool_memory_leak(initial_num_textures_in_pool: &mut Option<usize>, texture_pool: &texture::texture::TexturePool) {
let num_textures_in_pool = texture_pool.size();
match initial_num_textures_in_pool {
Expand All @@ -79,7 +79,8 @@ fn check_for_texture_pool_memory_leak(initial_num_textures_in_pool: &mut Option<
panic!("Memory leak! Texture pool grew by {growth_amount} past the first frame.");
}
},
None => {
_ => {
*initial_num_textures_in_pool = Some(num_textures_in_pool);
}
}
Expand Down Expand Up @@ -203,7 +204,7 @@ async fn main() -> MaybeError {
let mut rendering_params =
window_tree::PerFrameConstantRenderingParams {
sdl_canvas,
texture_pool: texture::TexturePool::new(&texture_creator, &sdl_ttf_context, max_texture_size, MAX_REMAKE_TRANSITION_QUEUE_SIZE),
texture_pool: texture::texture::TexturePool::new(&texture_creator, &sdl_ttf_context, max_texture_size, MAX_REMAKE_TRANSITION_QUEUE_SIZE),
frame_counter: FrameCounter::new(),
shared_window_state: DynamicOptional::NONE
};
Expand Down
2 changes: 1 addition & 1 deletion src/spinitron/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use derive_alias::derive_alias;
use serde::{Serialize, Deserialize};

use crate::{
texture::TextureCreationInfo,
texture::texture::TextureCreationInfo,

utility_types::{
time::*,
Expand Down
2 changes: 1 addition & 1 deletion src/spinitron/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::borrow::Cow;

use crate::{
request,
texture::TextureCreationInfo,
texture::texture::TextureCreationInfo,
dashboard_defs::error::ErrorState,

utility_types::{
Expand Down
1 change: 1 addition & 0 deletions src/texture/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod texture;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/window_tree.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sdl2::{self, rect::FRect};

use crate::{
texture::{
texture::texture::{
TexturePool,
TextureHandle,
TextureCreationInfo,
Expand Down

0 comments on commit 7222a16

Please sign in to comment.