Skip to content

Commit

Permalink
Merge pull request #20 from sdasda7777/sdasda7777_pages19
Browse files Browse the repository at this point in the history
Probably finally fixed the config for web
  • Loading branch information
sdasda7777 authored Mar 22, 2024
2 parents 102259f + 3c0c2d5 commit 2576881
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion assets/sw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var cacheName = 'egui-template-pwa';
var cacheName = 'minesweeper6d-pwa';
var filesToCache = [
'./',
'./index.html',
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<link data-trunk rel="copy-file" href="assets/icon-256.png" />
<link data-trunk rel="copy-file" href="assets/icon_ios_touch_192.png" />
<link data-trunk rel="copy-file" href="assets/maskable_icon_x512.png" />
<link data-trunk rel="copy-file" href="config.toml" />

<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="icon_ios_touch_192.png">
Expand Down
12 changes: 3 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ extern crate toml;
extern crate rand_chacha;

use itertools::Itertools;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::wasm_bindgen;

pub mod hhmmss;
use hhmmss::Hhmmss;
Expand All @@ -24,7 +22,7 @@ use eframe::{egui, emath::Align2};
use eframe::egui::{Button, containers::panel::TopBottomPanel, Key, KeyboardShortcut,
menu, Modifiers, PointerButton, Response, RichText, Sense};
use eframe::epaint::{Color32, FontId, Pos2, Rect, Rounding, Shadow, Shape, Stroke};
use std::{cmp::min, fs, time::Duration};
use std::{cmp::min, fs, time::Duration, include_str};
use web_time::SystemTime;
use toml::Table;

Expand Down Expand Up @@ -100,6 +98,7 @@ fn main() {
eframe::WebLogger::init(log::LevelFilter::Debug).ok();

let web_options = eframe::WebOptions::default();
let config_content = include_str!("../config.toml").to_owned();

wasm_bindgen_futures::spawn_local(async {
eframe::WebRunner::new()
Expand All @@ -113,18 +112,13 @@ fn main() {
style.visuals.window_rounding = Rounding::ZERO;
style.visuals.window_shadow = Shadow::NONE;
});
Box::new(MinesweeperViewController::new(get_config()))
Box::new(MinesweeperViewController::new(config_content))
}),
)
.await
.expect("failed to start eframe");
});
}
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
extern "C" {
fn get_config() -> String;
}

struct MinesweeperViewController {
current_initial_settings: InitialGameSettings,
Expand Down

0 comments on commit 2576881

Please sign in to comment.