Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
692 changes: 28 additions & 664 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fluent = "0.17.0"
fluent-syntax = "0.12.0"
futures-util = "0.3.32"
hex = "0.4.3"
image = { version = "0.25.10", default-features = false }
image = { version = "0.24", default-features = false }
inputbox = "0.1.1"
lru = "0.16.3"
lyon = "1.0.19"
Expand Down Expand Up @@ -57,8 +57,8 @@ objc2-foundation = "0.3.2"
objc2-ui-kit = "0.3.2"
objc2-uniform-type-identifiers = "0.3.2"

macroquad = { git = "https://github.com/Mivik/prpr-macroquad", rev = "b2eab29", default-features = false }
miniquad = { git = "https://github.com/Mivik/prpr-miniquad", rev = "0c525a3" }
macroquad = { git = "https://github.com/2278535805/macroquad" }
# macroquad ={ path = "../macroquad" }
phira = { path = "phira", default-features = false }
phira-mp-client = { git = "https://github.com/TeamFlos/phira-mp", rev = "6967475" }
phira-mp-common = { git = "https://github.com/TeamFlos/phira-mp", rev = "6967475" }
Expand Down
1 change: 0 additions & 1 deletion phira/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ walkdir = { workspace = true }
zip = { workspace = true }
zstd = "0.13"

miniquad = { workspace = true }
phira-mp-client = { workspace = true }
phira-mp-common = { workspace = true }
sanitize-filename = "0.6.0"
Expand Down
4 changes: 2 additions & 2 deletions phira/src/charts_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ impl ChartsView {
.draw_using(&BOLD_FONT);
}
} else {
ui.fill_path(&path, (*self.icons.r#abstract, r));
ui.fill_path(&path, (Texture2D::clone(&self.icons.r#abstract), r));
ui.fill_path(&path, semi_black(0.2));
let ct = r.center();
use crate::page::coll::{tl as page_tl, L10N_LOCAL};
Expand Down Expand Up @@ -596,7 +596,7 @@ impl ChartsView {
let p = if transit.back { p } else { 1. - p };
let r = Rect::tween(&fr, &ui.screen_rect(), p);
let path = r.rounded(0.02 * (1. - p));
ui.fill_path(&path, (*transit.chart.illu.texture.1, r.feather(0.01 * (1. - p))));
ui.fill_path(&path, (Texture2D::clone(&transit.chart.illu.texture.1), r.feather(0.01 * (1. - p))));
ui.fill_path(&path, semi_black(0.55));
}
}
Expand Down
2 changes: 1 addition & 1 deletion phira/src/client/model/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl User {
}

pub fn name_color(&self) -> Color {
Color::from_hex_rgb(if self.badges.iter().any(|it| it == "admin") {
Color::from_hex(if self.badges.iter().any(|it| it == "admin") {
0x673ab7
} else if self.badges.iter().any(|it| it == "sponsor") {
0xff7043
Expand Down
7 changes: 3 additions & 4 deletions phira/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ async fn the_main() -> Result<()> {
set_data(data);
sync_data();
save_data()?;
miniquad::window::set_ime_enabled(false);

let rx = {
let (tx, rx) = mpsc::channel();
Expand All @@ -212,10 +213,8 @@ async fn the_main() -> Result<()> {
rx
};

unsafe { get_internal_gl() }
.quad_context
.display_mut()
.set_pause_resume_listener(on_pause_resume);
// NOTE: set_pause_resume_listener no longer exists in the new miniquad API.
// Pause/resume is now handled through macroquad's window_minimized/window_restored events.

if let Some(me) = &get_data().me {
anti_addiction_action("startup", Some(format!("phira-{}", me.id)));
Expand Down
2 changes: 1 addition & 1 deletion phira/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl Illustration {
}

pub fn shading(&self, r: Rect, t: f32) -> impl Shading {
(*self.texture.0, r, ScaleType::CropCenter, semi_white(self.alpha(t))).into_shading()
(Texture2D::clone(&self.texture.0), r, ScaleType::CropCenter, semi_white(self.alpha(t))).into_shading()
}
}

Expand Down
2 changes: 1 addition & 1 deletion phira/src/page/coll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl Page for CollectionPage {
let r = tr.r;
let r = Rect::new(f32::tween(&r.x, &sr.x, xp), f32::tween(&r.y, &sr.y, yp), f32::tween(&r.w, &sr.w, xp), f32::tween(&r.h, &sr.h, yp));
let ir = Rect::tween(&tr.ir, &sr, xp);
ui.fill_rect(r, (*tr.illu, ir));
ui.fill_rect(r, (Texture2D::clone(&tr.illu), ir));
ui.fill_rect(r, semi_black(0.2 + 0.1 * p));
if p >= 1. && tr.t > 0. {
self.ok_to_transit = true;
Expand Down
4 changes: 2 additions & 2 deletions phira/src/page/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ impl Page for EventPage {
self.btn_down.set(ui, Rect::new(0., d, 0., 0.).feather(s));
self.index = (self.scroll.y_scroller.offset / (ui.top * 2.)).round() as usize;
ui.with(Rotation2::new(std::f32::consts::FRAC_PI_2).into(), |ui| {
ui.fill_rect(r, (*self.icons.back, r, ScaleType::CropCenter, semi_white(if self.index == 0 { 0.3 } else { 1. })));
ui.fill_rect(r, (Texture2D::clone(&self.icons.back), r, ScaleType::CropCenter, semi_white(if self.index == 0 { 0.3 } else { 1. })));
});
ui.with(Rotation2::new(-std::f32::consts::FRAC_PI_2).into(), |ui| {
ui.fill_rect(r, (*self.icons.back, r, ScaleType::CropCenter, semi_white(if self.index + 1 >= events.len() { 0.3 } else { 1. })));
ui.fill_rect(r, (Texture2D::clone(&self.icons.back), r, ScaleType::CropCenter, semi_white(if self.index + 1 >= events.len() { 0.3 } else { 1. })));
});
if events.is_empty() {
ui.text(ttl!("list-empty")).anchor(0.5, 0.5).no_baseline().size(1.4).draw();
Expand Down
14 changes: 7 additions & 7 deletions phira/src/page/favorites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ impl Page for FavoritesPage {
ui.dy(-ui.top + 0.03);
let s = 0.08;
let r = Rect::new(-s, 0., s, s);
ui.fill_rect(r, (*self.icons.menu, r, ScaleType::Fit, WHITE));
ui.fill_rect(r, (Texture2D::clone(&self.icons.menu), r, ScaleType::Fit, WHITE));
self.operations_menu_btn.set(ui, r);
if self.need_show_operations_menu {
self.need_show_operations_menu = false;
Expand All @@ -1127,7 +1127,7 @@ impl Page for FavoritesPage {
}
if get_data().collection_by_index(index).is_owned() {
ui.dx(-r.w - 0.03);
ui.fill_rect(r, (*self.icons.edit, r, ScaleType::Fit, WHITE));
ui.fill_rect(r, (Texture2D::clone(&self.icons.edit), r, ScaleType::Fit, WHITE));
self.edit_btn.set(ui, r);
if self.need_show_edit_menu {
self.need_show_edit_menu = false;
Expand All @@ -1143,9 +1143,9 @@ impl Page for FavoritesPage {
r,
(
if get_data().collection_by_index(index).id.is_some() {
*self.icons.cloud_check
Texture2D::clone(&self.icons.cloud_check)
} else {
*self.icons.cloud_none
Texture2D::clone(&self.icons.cloud_none)
},
r,
ScaleType::Fit,
Expand All @@ -1161,12 +1161,12 @@ impl Page for FavoritesPage {
self.cloud_menu.show(ui, t, Rect::new(r.x - d, r.bottom() + 0.02, r.w + d, h));
}
ui.dx(-r.w - 0.03);
ui.fill_rect(r, (*self.icons.info, r, ScaleType::Fit));
ui.fill_rect(r, (Texture2D::clone(&self.icons.info), r, ScaleType::Fit));
self.info_btn.set(ui, r);

ui.dx(-r.w - 0.03);
if self.fetch_like_task.is_some() {
ui.fill_rect(r, (*self.icons.heart_outline, r, ScaleType::Fit, semi_white(0.4)));
ui.fill_rect(r, (Texture2D::clone(&self.icons.heart_outline), r, ScaleType::Fit, semi_white(0.4)));
let ct = r.center();
ui.loading(
ct.x,
Expand All @@ -1181,7 +1181,7 @@ impl Page for FavoritesPage {
);
} else {
let icon = if self.liked { &self.icons.heart } else { &self.icons.heart_outline };
ui.fill_rect(r, (**icon, r, ScaleType::Fit, if self.liked { ORANGE } else { WHITE }));
ui.fill_rect(r, (Texture2D::clone(icon), r, ScaleType::Fit, if self.liked { ORANGE } else { WHITE }));
self.like_btn.set(ui, r);
}
});
Expand Down
20 changes: 10 additions & 10 deletions phira/src/page/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,28 +286,28 @@ impl HomePage {
let p = (t - self.board_last_time) / BOARD_TRANSIT_TIME;
if p > 1. {
self.board_tex_last = None;
ui.fill_path(&path, (**cur, r));
ui.fill_path(&path, (Texture2D::clone(cur), r));
} else if let Some(last) = &self.board_tex_last {
let (cur, last) = if self.board_dir { (last, cur) } else { (cur, last) };
let p = 1. - (1. - p).powi(3);
let p = if self.board_dir { 1. - p } else { p };
clip_rounded_rect(ui, r, rad, |ui| {
let mut nr = r;
nr.h = r.h * (1. - p);
ui.fill_rect(nr, (**last, nr));
ui.fill_rect(nr, (Texture2D::clone(last), nr));

nr.h = r.h * p;
nr.y = r.bottom() - nr.h;
ui.fill_rect(nr, (**cur, nr));
ui.fill_rect(nr, (Texture2D::clone(cur), nr));
});
} else {
ui.fill_path(&path, (**cur, r, ScaleType::CropCenter, semi_white(p)));
ui.fill_path(&path, (Texture2D::clone(cur), r, ScaleType::CropCenter, semi_white(p)));
}
}
ui.fill_path(&path, (semi_black(0.7), (r.x, r.y), Color::default(), (r.x + 0.6, r.y)));
ui.text(tl!("play")).pos(r.x + pad, r.y + pad).draw();
let r = Rect::new(r.x + 0.02, r.bottom() - 0.18, 0.17, 0.17);
ui.fill_rect(r, (*self.icons.play, r, ScaleType::Fit, semi_white(0.6)));
ui.fill_rect(r, (Texture2D::clone(&self.icons.play), r, ScaleType::Fit, semi_white(0.6)));
});
top + 0.03
})
Expand Down Expand Up @@ -335,10 +335,10 @@ impl HomePage {
let mat = self.btn_other_3d.now(ui, Rect::new(0., top - 0.4, 0.83, 0.23), t);
ui.with_gl(mat, |ui| {
let r = Rect::new(0., top, 0.38, 0.23);
text_and_icon(s, ui, r, &mut self.btn_event, tl!("event"), *self.icons.medal);
text_and_icon(s, ui, r, &mut self.btn_event, tl!("event"), Texture2D::clone(&self.icons.medal));

let r = Rect::new(r.right() + 0.02, top, 0.29, 0.23);
text_and_icon(s, ui, r, &mut self.btn_respack, tl!("respack"), *self.icons.respack);
text_and_icon(s, ui, r, &mut self.btn_respack, tl!("respack"), Texture2D::clone(&self.icons.respack));

let lf = r.right() + 0.02;

Expand All @@ -347,7 +347,7 @@ impl HomePage {
self.btn_msg.render_shadow(ui, r, t, |ui, path| {
ui.fill_path(&path, semi_black(0.4));
let r = r.feather(-0.01);
ui.fill_rect(r, (*self.icons.msg, r, ScaleType::Fit));
ui.fill_rect(r, (Texture2D::clone(&self.icons.msg), r, ScaleType::Fit));
if self.has_new {
let pad = 0.007;
ui.fill_circle(r.right() - pad, r.y + pad, 0.01, RED);
Expand All @@ -358,7 +358,7 @@ impl HomePage {
self.btn_settings.render_shadow(ui, r, t, |ui, path| {
ui.fill_path(&path, semi_black(0.4));
let r = r.feather(0.004);
ui.fill_rect(r, (*self.icons.settings, r, ScaleType::Fit));
ui.fill_rect(r, (Texture2D::clone(&self.icons.settings), r, ScaleType::Fit));
});
});
});
Expand Down Expand Up @@ -649,7 +649,7 @@ impl Page for HomePage {
let p = self.char_appear_p.now(t);
let (ox, oy, ow, oh) = self.character.illu_adjust;
let r = Rect::new(r.x + ox, r.y + (1. - p) * 0.05 + oy, r.w + ow, r.h + oh);
ui.fill_rect(ui.screen_rect(), (**illu, r, ScaleType::CropCenter, semi_white(p)));
ui.fill_rect(ui.screen_rect(), (Texture2D::clone(illu), r, ScaleType::CropCenter, semi_white(p)));
}
self.char_btn.set(ui, r);

Expand Down
20 changes: 10 additions & 10 deletions phira/src/page/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ impl Page for LibraryPage {
self.multi_operation_btn.render_shadow(ui, r, t, |ui, path| {
ui.fill_path(&path, WHITE);
let cr = r.feather(-0.01);
ui.fill_rect(cr, (*self.icons.r#mod, cr, ScaleType::Fit, BLACK));
ui.fill_rect(cr, (Texture2D::clone(&self.icons.r#mod), cr, ScaleType::Fit, BLACK));
});
if self.need_show_multi_operation_menu {
self.need_show_multi_operation_menu = false;
Expand All @@ -1425,7 +1425,7 @@ impl Page for LibraryPage {
self.multi_select_btn.render_shadow(ui, sr, t, |ui, path| {
ui.fill_path(&path, WHITE);
let ir = Rect::new(sr.x + 0.04, sr.center().y, 0., 0.).feather(0.025);
ui.fill_rect(ir, (*self.icons.select, ir, ScaleType::Fit, BLACK));
ui.fill_rect(ir, (Texture2D::clone(&self.icons.select), ir, ScaleType::Fit, BLACK));
ui.text(text)
.pos((ir.right() + sr.right() - 0.01) / 2., sr.center().y)
.size(0.5)
Expand All @@ -1447,7 +1447,7 @@ impl Page for LibraryPage {
self.multi_select_cancel_btn.render_shadow(ui, r, t, |ui, path| {
ui.fill_path(&path, WHITE);
let cr = r.feather(-0.01);
ui.fill_rect(cr, (*self.icons.close, cr, ScaleType::Fit, BLACK));
ui.fill_rect(cr, (Texture2D::clone(&self.icons.close), cr, ScaleType::Fit, BLACK));
});
r.x -= r.w + 0.02;
}
Expand All @@ -1456,7 +1456,7 @@ impl Page for LibraryPage {
self.import_btn.render_shadow(ui, r, t, |ui, path| {
ui.fill_path(&path, semi_black(0.4));
let cr = r.feather(-0.01);
ui.fill_rect(cr, (*self.icons.plus, cr, ScaleType::Fit));
ui.fill_rect(cr, (Texture2D::clone(&self.icons.plus), cr, ScaleType::Fit));
});
r.x -= r.w + 0.02;
}
Expand All @@ -1465,7 +1465,7 @@ impl Page for LibraryPage {
self.filter_btn.render_shadow(ui, r, t, |ui, path| {
ui.fill_path(&path, semi_black(0.4));
let cr = r.feather(-0.01);
ui.fill_rect(cr, (*self.icons.filter, cr, ScaleType::Fit));
ui.fill_rect(cr, (Texture2D::clone(&self.icons.filter), cr, ScaleType::Fit));
});
r.x -= r.w + 0.02;
} else if !multi_select {
Expand All @@ -1474,9 +1474,9 @@ impl Page for LibraryPage {
ui.fill_path(&path, if active { WHITE } else { semi_black(0.4) });
let cr = r.feather(-0.01);
if active {
ui.fill_rect(cr, (*self.icons.star, cr, ScaleType::Fit, Color::from_rgba(255, 193, 7, 255)));
ui.fill_rect(cr, (Texture2D::clone(&self.icons.star), cr, ScaleType::Fit, Color::from_rgba(255, 193, 7, 255)));
} else {
ui.fill_rect(cr, (*self.icons.star_outline, cr, ScaleType::Fit));
ui.fill_rect(cr, (Texture2D::clone(&self.icons.star_outline), cr, ScaleType::Fit));
}
});
r.x -= r.w + 0.02;
Expand All @@ -1485,7 +1485,7 @@ impl Page for LibraryPage {
self.order_btn.render_shadow(ui, r, t, |ui, path| {
ui.fill_path(&path, semi_black(0.4));
let cr = r.feather(-0.01);
ui.fill_rect(cr, (*self.icons.order, cr, ScaleType::Fit));
ui.fill_rect(cr, (Texture2D::clone(&self.icons.order), cr, ScaleType::Fit));
});
if self.need_show_order_meta_menu {
self.need_show_order_meta_menu = false;
Expand Down Expand Up @@ -1517,11 +1517,11 @@ impl Page for LibraryPage {
let mut r = r.feather(-0.01);
r.w = r.h;
if !empty {
ui.fill_rect(r, (*self.icons.close, r, ScaleType::Fit));
ui.fill_rect(r, (Texture2D::clone(&self.icons.close), r, ScaleType::Fit));
self.search_clr_btn.set(ui, r);
r.x += r.w;
}
ui.fill_rect(r, (*self.icons.search, r, ScaleType::Fit));
ui.fill_rect(r, (Texture2D::clone(&self.icons.search), r, ScaleType::Fit));
ui.text(&self.search_str)
.pos(r.right() + 0.01, r.center().y)
.anchor(0., 0.5)
Expand Down
2 changes: 1 addition & 1 deletion phira/src/page/offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl Page for OffsetPage {
let w = NOTE_WIDTH_RATIO_BASE as f32 * config.note_scale * 2.;
let h = w * self.click.height() / self.click.width();
let r = Rect::new(ct.0 - w / 2., ny, w, h);
ui.fill_rect(r, (*self.click, r, ScaleType::Fit));
ui.fill_rect(r, (Texture2D::clone(&self.click), r, ScaleType::Fit));
self.cali_last = true;
} else {
if self.cali_last {
Expand Down
Loading
Loading