module Main where

import Control.Applicative ((<$>))
import Control.Monad.Random (evalRandIO)
import Graphics.Gloss (simulate, Display(..), greyN)
import System.Environment (getArgs)

import Initialization
import Render
import Simulate
import Types

width, height :: Int
width = 800
height = 800

parseArgs :: [String] -> Options
parseArgs [] = defaultOptions
parseArgs [scount, axis] = defaultOptions { starCount = read scount, rotationAxis = readAxis axis }
parseArgs _ = error "Usage: STARCOUNT ROTATIONAXIS"

main :: IO ()
main = do
    opts <- parseArgs <$> getArgs
    initModel <- evalRandIO $ initialize opts
    let display = InWindow "Galaxy" (width, height) (10,10)
    simulate display (greyN 0.1) 30 initModel render process
