~comcloudway/little_town

e994682af51367b91d48a806397510ecfb5159f7 — Jakob Meier 1 year, 8 months ago e12fe30
Fixed featureless compilation
2 files changed, 6 insertions(+), 1 deletions(-)

M src/main.rs
M src/screens/welcome.rs
M src/main.rs => src/main.rs +1 -1
@@ 35,7 35,7 @@ async fn main() {
    let mut screen = Screen::default();

    let mut ctx = AudioContext::new();
    let mut sound = Sound::load(&mut ctx, include_bytes!("../assets/music.wav"));
    let sound = Sound::load(&mut ctx, include_bytes!("../assets/music.wav"));
    sound.play(&mut ctx, PlaySoundParams{
        looped: true,
        volume: 0.2

M src/screens/welcome.rs => src/screens/welcome.rs +5 -0
@@ 11,6 11,7 @@ use crate::ui::{
    ButtonEvent
};
use super::map_select::SelectScreen;
#[cfg(feature = "multiplayer")]
use super::build::BuildScreen;
use super::Screen;



@@ 22,6 23,7 @@ pub struct WelcomeScreen {
    /// level select button widget
    widget_select: TextButton,
    /// join-host button widget
    #[cfg(feature = "multiplayer")]
    widget_join: TextButton,
    /// game quit button widget
    widget_quit: TextButton,


@@ 34,6 36,7 @@ impl WelcomeScreen {
                .with_font_size(100),
            widget_select: TextButton::new("Maps", 0.35, 0.55)
                .with_font_size(40),
            #[cfg(feature = "multiplayer")]
            widget_join: TextButton::new("Join", 0.5, 0.55)
                .with_font_size(40),
            widget_quit: TextButton::new("Quit", 0.65, 0.55)


@@ 66,6 69,7 @@ impl GameComponent for WelcomeScreen {
        self.widget_title.draw(&assets).await;

        self.widget_select.draw(&assets).await;
        #[cfg(feature = "multiplayer")]
        self.widget_join.draw(&assets).await;
        self.widget_quit.draw(&assets).await;
    }


@@ 76,6 80,7 @@ impl GameComponent for WelcomeScreen {
            ButtonEvent::LeftClick => return GameEvent::ChangeScreen(Screen::Select(SelectScreen::new())),
            _ => ()
        }
        #[cfg(feature = "multiplayer")]
        match self.widget_join.ev_loop() {
            ButtonEvent::LeftClick => return GameEvent::ChangeScreen(Screen::Build(BuildScreen::join())),
            _ => ()