Skip to content

Commit

Permalink
doc: module level doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sjfhsjfh committed Jul 18, 2024
1 parent 740c203 commit 575605a
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 10 deletions.
12 changes: 12 additions & 0 deletions prpr/src/bin.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//! Binary serialization and deserialization for prpr data structures.
//! Currently:
//! - [crate::core::Chart]
//! - [crate::core::ChartSettings]
//! - [crate::core::JudgeLine]
//! - [crate::core::Note]
//! - [crate::core::Object]
//! - [crate::core::CtrlObject]
//! - [crate::core::Anim]
//! - [crate::core::Keyframe]
//! - [macroquad::prelude::Color]
use crate::{
core::{
Anim, AnimVector, BezierTween, BpmList, Chart, ChartExtra, ChartSettings, ClampedTween, CtrlObject, JudgeLine, JudgeLineCache, JudgeLineKind,
Expand Down
3 changes: 3 additions & 0 deletions prpr/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! Configuration module of the playing environment.\
//! e.g. player name, volume, speed, autoplay, etc.
use bitflags::bitflags;
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
Expand Down
12 changes: 12 additions & 0 deletions prpr/src/core.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
//! Core module for prpr, submodules:
//! - [crate::core::anim]
//! - [crate::core::chart]
//! - [crate::core::effect]
//! - [crate::core::line]
//! - [crate::core::note]
//! - [crate::core::object]
//! - [crate::core::render]
//! - [crate::core::resource]
//! - [crate::core::smooth]
//! - [crate::core::tween]
pub use macroquad::color::Color;

pub const NOTE_WIDTH_RATIO_BASE: f32 = 0.13175016;
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/core/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::{AnimFloat, AnimVector, Color, Matrix, Resource, Vector};
use macroquad::prelude::*;
use nalgebra::Rotation2;

/// Describes the animation of an in-game object's local coordinate system in the parent coordinate system
#[derive(Default)]
pub struct Object {
pub alpha: AnimFloat,
Expand Down Expand Up @@ -72,6 +73,7 @@ impl Object {
}
}

/// Describes the animation of an in-game object in its local coordinate system
#[derive(Default, Clone)]
pub struct CtrlObject {
pub alpha: AnimFloat,
Expand Down
1 change: 1 addition & 0 deletions prpr/src/core/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use macroquad::{
};
use miniquad::{gl::GLuint, RenderPass, Texture, TextureFormat};

// TODO: doc
pub struct MSRenderTarget {
dim: (u32, u32),
fbo: GLuint,
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/dir.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Directory helper
use anyhow::{bail, Result};
use std::{
fs::{File, ReadDir},
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/ext.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Miscellaneous utilities.
use crate::{
config::Config,
core::{Matrix, Point, Vector},
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/fs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! File system abstraction
use crate::{ext::spawn_task, info::ChartInfo};
use anyhow::{anyhow, bail, Context, Result};
use async_trait::async_trait;
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Chart metadata
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

Expand Down
2 changes: 2 additions & 0 deletions prpr/src/judge.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Judgement system
use crate::{
config::Config,
core::{BadNote, Chart, NoteKind, Point, Resource, Vector, NOTE_WIDTH_RATIO_BASE},
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/l10n.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Localization utilities.
pub use fluent::{fluent_args, FluentBundle, FluentResource};
pub use once_cell::sync::Lazy;
pub use unic_langid::{langid, LanguageIdentifier};
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/log.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Logging utilities.
use colored::Colorize;
use miniquad::{debug, error, info, trace, warn};
use tracing::{field::Visit, Level, Subscriber};
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/parse.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Chart parsers
mod extra;
pub use extra::parse_extra;

Expand Down
20 changes: 10 additions & 10 deletions prpr/src/particle.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// This is from https://raw.githubusercontent.com/not-fl3/macroquad/master/particles/src/lib.rs
// We can't use macroquad-particles directly, since it implicitly depends on quad-snd (which is
// obviously a mistake) and that conflicts with kira.

// Edits:
// 1. nanoserde related parts are removed for simplicity's sake.
// 2. apply_viewport
// 3. clippy
// 4. time can be customized by input argument
// 5. Remove EmittersCache
//! This is from https://raw.githubusercontent.com/not-fl3/macroquad/master/particles/src/lib.rs
//! We can't use macroquad-particles directly, since it implicitly depends on quad-snd (which is
//! obviously a mistake) and that conflicts with kira.
//! Edits:
//! 1. nanoserde related parts are removed for simplicity's sake.
//! 2. apply_viewport
//! 3. clippy
//! 4. time can be customized by input argument
//! 5. Remove EmittersCache
use macroquad::prelude::*;
use macroquad::window::miniquad::*;
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/scene.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Scene management module.
crate::tl_file!("scene" ttl);

mod ending;
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/task.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Time consuming task management.
use std::{
future::Future,
sync::{Arc, Mutex, MutexGuard},
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/time.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Time manager for music time and real time synchronization.
use crate::config::Config;

pub struct TimeManager {
Expand Down
2 changes: 2 additions & 0 deletions prpr/src/ui.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! UI utilities.
mod billboard;
pub use billboard::{BillBoard, Message, MessageHandle, MessageKind};

Expand Down

0 comments on commit 575605a

Please sign in to comment.