package me.hammerle.supersnuvi.rendering;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.stage.Stage;
import me.hammerle.supersnuvi.util.SoundUtils;

public class GameWindow extends Application
{
    public static boolean isRunning;
    
    public static void main(String[] args) 
    {
        Application.launch(args);
    }

    @Override
    public void init() throws Exception 
    {
        super.init();
        isRunning = true;
    }
    
    @Override
    public void start(Stage stage) throws Exception 
    {
        stage.setTitle("Super Snuvi");
         
        Group root = new Group();
        Scene scene = new Scene(root);

        stage.setScene(scene);
        
        Canvas canvas = new Canvas(800, 600);     
        root.getChildren().add(canvas);
              
        GameRenderer timer = new GameRenderer(scene, canvas);
        timer.start();
        
        stage.show();
    }

    @Override
    public void stop() throws Exception 
    {
        super.stop();
        isRunning = false;
        SoundUtils.playSounds();
    }
}
