[[package]]
name = "serde"
-version = "1.0.137"
+version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
+checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.137"
+version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
+checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [
"proc-macro2",
"quote",
[build-dependencies]
bindgen = "0.64"
-[features]
-default = []
-no_link_libs = []
-
[lib]
name = "ld45_lib"
-crate-type = ["staticlib"]
-required-features = ["no_link_libs"]
+path = "src/lib.rs"
+crate-type = ["rlib", "staticlib"]
[[bin]]
name = "ld45_bin"
-path = "src/main.rs"
+path = "src/bin.rs"
use std::env;
use std::path::PathBuf;
-#[cfg(not(feature = "no_link_libs"))]
-fn linking_libs() {
+fn main() {
println!("cargo:rustc-link-lib=raylib");
println!("cargo:rustc-link-lib=OpenGL");
-}
-
-#[cfg(feature = "no_link_libs")]
-fn linking_libs() {}
-
-fn main() {
- linking_libs();
println!("cargo:rerun-if-changed=raylib/raylib.h");
let bindings = bindgen::Builder::default()
--- /dev/null
+use ld45_lib::agnostic_interface;
+
+fn will_close() -> bool {
+ unsafe { agnostic_interface::raylib_impl::ffi::WindowShouldClose() }
+}
+
+fn main() {
+ let state_ptr = ld45_lib::ld45_initialize();
+
+ while !will_close() {
+ ld45_lib::ld45_iterate(state_ptr);
+ }
+
+ unsafe {
+ drop(Box::from_raw(state_ptr as *mut ld45_lib::WasmState));
+ }
+}
-mod agnostic_interface;
+pub mod agnostic_interface;
mod faux_quicksilver;
mod original_impl;
mod shaders;
use faux_quicksilver::Window;
use original_impl::GameState;
-struct WasmState {
+pub struct WasmState {
pub window: Window,
pub game_state: GameState,
}
+++ /dev/null
-use agnostic_interface::raylib_impl::RaylibGame;
-use faux_quicksilver::Window;
-use original_impl::GameState;
-
-mod agnostic_interface;
-mod faux_quicksilver;
-mod original_impl;
-mod shaders;
-
-fn will_close() -> bool {
- unsafe { agnostic_interface::raylib_impl::ffi::WindowShouldClose() }
-}
-
-fn main() {
- // TODO
- //run::<GameState>(
- // "One And All - a Ludum Dare 45 compo entry",
- // Vector::new(800, 600),
- // Settings::default(),
- //);
-
- let game_interface = RaylibGame::new_boxed(800, 600);
- let mut window = Window::new(game_interface);
- let mut game_state = GameState::new(&mut window).unwrap();
-
- while !will_close() {
- window.update_music().unwrap();
- game_state.update(&mut window).unwrap();
- game_state.draw(&mut window).unwrap();
- }
-}