Skip to content

Commit

Permalink
update macroquad
Browse files Browse the repository at this point in the history
  • Loading branch information
sparshg committed Sep 25, 2023
1 parent 9a8b8f7 commit 2cc652c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ version = "0.1.0"
edition = "2021"

[dependencies]
egui = "0.21.0"
egui-macroquad = "0.15.0"
macroquad = "0.3.25"
macroquad = "0.4.4"

[profile.release]
opt-level = 'z' # Optimize for size
lto = true # Enable link-time optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = 'abort' # Abort on panic
strip = true # Strip symbols from binary*
strip = true # Strip symbols from binary*
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{theme::setup_theme, ui::Graph};
use cart::Cart;
use egui::{pos2, Color32};
use egui_macroquad::egui;
use macroquad::prelude::*;
use ui::{draw_blue_grid, draw_speedometer, draw_ui, draw_vingette};
mod camera;
Expand Down Expand Up @@ -75,7 +76,7 @@ async fn main() {
cart.state.w as f32,
9.,
0.8,
font,
&font,
14.,
false,
);
Expand All @@ -94,12 +95,12 @@ async fn main() {
cart.state.v as f32,
20.,
0.8,
font,
&font,
14.,
true,
);
draw_ui(w_init, grid, &mut cart, &mut forceplt, &mut forceplt1);
draw_vingette(vingette);
draw_vingette(&vingette);
next_frame().await;
}
}
1 change: 1 addition & 0 deletions src/theme.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use egui::{epaint, style, Color32, Context, Rounding};
use egui_macroquad::egui;

pub fn setup_theme() {
egui_macroquad::cfg(|ctx| {
Expand Down
7 changes: 4 additions & 3 deletions src/ui.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use egui_macroquad::egui;
use std::{collections::VecDeque, f32::INFINITY};

use egui::{
Expand Down Expand Up @@ -123,7 +124,7 @@ pub fn draw_speedometer(
speed: f32,
max_speed: f32,
extent: f32,
font: Font,
font: &Font,
fsize: f32,
oneway: bool,
) {
Expand Down Expand Up @@ -176,7 +177,7 @@ pub fn draw_speedometer(
(0.5 + center.x) * screen_width() - size.width * 0.5,
0.5 * (screen_height() - center.y * screen_width()) + size.offset_y + size.height,
TextParams {
font: font,
font: Some(font),
font_size: fsize as u16 * 2,
font_scale: 0.5,
color: Color::new(1., 1., 1., 0.75),
Expand Down Expand Up @@ -409,7 +410,7 @@ pub fn draw_blue_grid(grid: f32, color: Color, thickness: f32, bold_every: i32,
}
}

pub fn draw_vingette(tex: Texture2D) {
pub fn draw_vingette(tex: &Texture2D) {
set_default_camera();
draw_texture_ex(
tex,
Expand Down

0 comments on commit 2cc652c

Please sign in to comment.