{-# OPTIONS --allow-unsolved-metas #-}
module GUI.GUICompilationFeaturesPaper where
open import Data.List
open import Data.Fin hiding (_+_)
open import Data.Nat
open import Data.Product
open import Data.Sum
open import Function
open import Size
open import SizedIO.Base renaming (IO to IO∞; IO' to IO)
open import SizedIO.Console using (consoleI; translateIOConsole; translateIOConsoleTODO)
open import heap.libraryVec using (Tuple)
open import GUI.Debug using (showNat)
open import NativeIO
open import GUI.GUIFeaturesPart2Paper
open import GUI.GUIDefinitions
open import GUI.RasterificFFI using (SDLWindow; getEventsFFI; renderFrameToScreenFFI; createWindowFFI)
import GUI.GUICompilation renaming (compile to compileRegularGUI)
mutual
stateMachine2Method : ∀{i} (S : Set)(sm : StateMachine S)(s : S) → GUIObj {i} (sm s .view)
stateMachine2Method S sm s m = sm s .handleUserInput m >>=' λ sNEW →
return (compileToGUI S sm sNEW)
compileToGUI : ∀{i} (S : Set)(sm : StateMachine S)(s : S) → GUI {i}
compileToGUI S sm s .gui = sm s .view
compileToGUI S sm s .method = stateMachine2Method S sm s
compileToGUI' : ∀{i} {S : Set}(sm : StateMachine S)(s : S) → GUI {i}
compileToGUI' {i} {S} sm s = compileToGUI {i} S sm s
compileGUI : (S : Set)(sm : StateMachine S)(s : S) → NativeIO Unit
compileGUI S sm s =
createWindowFFI native>>= λ win →
GUI.GUICompilation.compileRegularGUI win (compileToGUI S sm s)
compileGUI' : {S : Set}(sm : StateMachine S)(s : S) → NativeIO Unit
compileGUI' {S} = compileGUI S
compileRegularGUI : (g : GUI) → NativeIO Unit
compileRegularGUI g =
createWindowFFI native>>= λ win →
GUI.GUICompilation.compileRegularGUI win g
compileStateMachine : {S : Set} (sm : StateMachine S) (s : S)
→ NativeIO Unit
compileStateMachine {S} sm s =
compileGUI S sm s