[{"name":"Messenger.Audio.Audio","comment":"\n\n\n# Audio Module\n\nYou can play audio by emitting `SOMPlayAudio` message with the audio ID, a channel, and an option.\n\nThe channel is an integer that is used to identify the audio channel.\n\nYou **can** play different audio on the same channel at the same time. The previous audio will not be stopped.\n\nHowever, when you stop the channel, all audio on the channel will be stopped.\n\nIf an audio is finished playing, it will be removed from the playing channel.\n\n@docs newAudioChannel\n@docs audioDuration\n\n","unions":[],"aliases":[],"values":[{"name":"audioDuration","comment":" Get the duration of an audio by its ID.\n\nUsage : audioDuration internalData audioId\n\n  - internalData is just env.globaldata.internalData. Just pass it as your first argument.\n  - audioID is the NAME (not ID!) of the desired audio, which should be registered in the resources.elm.\n\nThe output of the function is a Maybe Duration, with which you can extract the Float value of the length in seconds via Duration.inSeconds.\n\nExample: audioDuration id \"Boom\" |> Duration.inSeconds == 1.274 -- the duration in seconds.\n\n","type":"Messenger.Base.InternalData -> String.String -> Maybe.Maybe Duration.Duration"},{"name":"newAudioChannel","comment":" Generate a new unique audio channel number.\n\n    You should add the internal data in globaldata as the parameter, and the returning value is a integer which is the generated channel number.\n        - Note: It is really similar to GenUID.\n\n","type":"Messenger.Base.InternalData -> Basics.Int"}],"binops":[]},{"name":"Messenger.Audio.Base","comment":"\n\n\n# Audio Base\n\n@docs AudioOption, AudioTarget, AudioCommonOption\n\n","unions":[{"name":"AudioOption","comment":" You can play one audio once or loop it.\n\n  - ALoop means the audio will be played repeatedly until a SOMStopAudio is called.\n  - AOnce means the audio will be played only once.\n\n","args":[],"cases":[["ALoop",["Maybe.Maybe Messenger.Audio.Base.AudioCommonOption","Maybe.Maybe Audio.LoopConfig"]],["AOnce",["Maybe.Maybe Messenger.Audio.Base.AudioCommonOption"]]]},{"name":"AudioTarget","comment":" The type used to specify the target of the AudioOptions, for example in SOMStopAudio.\n\n  - AllAudio sets the target to be all of the audios.\n  - AudioChannel sets the target to be a specific channel, which is determined by the Int following it.\n  - AudioName sets the target to be a specific audio piece by stating the Channel(Int) and the name(String) of the audio piece.\n\n","args":[],"cases":[["AllAudio",[]],["AudioChannel",["Basics.Int"]],["AudioName",["Basics.Int","String.String"]]]}],"aliases":[{"name":"AudioCommonOption","comment":" Audio common options.\n\n  - rate refers to the playing speed of the audio. For example, setting rate to 2 will make Messenger play the music at 2x Speed.\n  - start is the starting point where messenger starts to play music. It is a Duration value, and can be transferred from float by Duration.seconds\n\nExample: AudioCommonOption 1.5 <| Duration.seconds 30 -- The audio will be played at 1.5x speed and start from 30.0s.\n\n","args":[],"type":"{ rate : Basics.Float, start : Duration.Duration }"}],"values":[],"binops":[]},{"name":"Messenger.Base","comment":"\n\n\n# Base Module\n\nSome Basic Data Types for the game\n\n@docs WorldEvent\n@docs UserEvent\n@docs GlobalData, InternalData\n@docs Env\n@docs Flags\n@docs removeCommonData, addCommonData\n@docs UserViewGlobalData\n@docs emptyInternalData, userGlobalDataToGlobalData, globalDataToUserGlobalData\n\n","unions":[{"name":"UserEvent","comment":" User Event\n\nThis is the User Event for the game.\n\nUsers can get outside information through these events.\n\n`Tick` is triggered every timeInterval. The int attacked to it is\n\n`KeyDown`, `KeyUp` records the keyboard events.\n\"KeyDown\" event is sent when the key is pressed, \"KeyUp\" is sent when the key is released.\n\n  - Note: if you just want to check if a key is pressed or not, use globalData.pressedKeys instead.\n    check all the keycodes [here](https://www.toptal.com/developers/keycode).\n\n`MouseDown`, `MouseUp` records the button code and position when mouse up and down.\nMouse code 0 represents the left mouse button, 1 represents middle mouse button and 2 represents\nright mouse button.\n\nWe have provide some key and mouse codes in messenger-extra.\n\n`MouseWheel` records the wheel event for mouse, positive value means scrolling down while\nnegative value means scrolling up. It can be also used for touchpad.\n\n`Prompt name result` gives the result user entered in the prompt window.\n\n","args":[],"cases":[["Tick",["Basics.Float"]],["KeyDown",["Basics.Int"]],["KeyUp",["Basics.Int"]],["MouseDown",["Basics.Int","( Basics.Float, Basics.Float )"]],["MouseUp",["Basics.Int","( Basics.Float, Basics.Float )"]],["MouseWheel",["Basics.Int"]],["Prompt",["String.String","String.String"]]]},{"name":"WorldEvent","comment":" World Event\n\nThis is the World Event for the game.\n\nThe events that messenger will receive from outside\n\nBasically users don't need to deal with the world events, they work with user events instead.\n\n","args":[],"cases":[["WTick",["Basics.Float"]],["WKeyDown",["Basics.Int"]],["WKeyUp",["Basics.Int"]],["NewWindowSize",["( Basics.Float, Basics.Float )"]],["WindowVisibility",["Browser.Events.Visibility"]],["SoundLoaded",["String.String","Result.Result Audio.LoadError Audio.Source"]],["REGLRecv",["Json.Encode.Value"]],["WMouseDown",["Basics.Int","( Basics.Float, Basics.Float )"]],["WMouseUp",["Basics.Int","( Basics.Float, Basics.Float )"]],["MouseMove",["( Basics.Float, Basics.Float )"]],["WMouseWheel",["Basics.Int"]],["WPrompt",["String.String","String.String"]],["NullEvent",[]]]}],"aliases":[{"name":"Env","comment":" Environment\n\nEnvironment is provided to users almost all the time.\n\nIt stores GlobalData and CommonData (Similar to GlobalData but just for one scene),\nso you can get and modify them through the Env.\n\n","args":["common","userdata"],"type":"{ globalData : Messenger.Base.GlobalData userdata, commonData : common }"},{"name":"Flags","comment":" The main flags.\n\nGet info from js script.\n\n**Learn more about flags [here](https://guide.elm-lang.org/interop/flags)**\n\n","args":[],"type":"{ timeStamp : Basics.Float, info : String.String }"},{"name":"GlobalData","comment":" GlobalData\n\nGlobalData is the data that doesn't change during the game.\n\nIt won't be reset if you change the scene.\n\nIt is mainly used for display and reading/writing some localstorage data.\n\n  - `globalStartFrame` records the past frames number since the game started\n  - `globalStartTime` records the past time since the game started, in milliseconds\n  - `sceneStartFrame` records the past frames number since this scene started\n  - `sceneStartTime` records the past time since this scene started, in milliseconds\n  - `userdata` records the data that users set to save\n  - `extraHTML` is used to render extra HTML tags. Be careful to use this\n  - `windowVisibility` records whether users stay in this tab/window\n  - `pressedKeys` records the keycodes that are be pressed now\n  - `pressedMouseButtons` records the mouse buttons that are pressed now\n  - `volume` records the volume of the game\n  - `currentScene` records the current scene name\n  - `mousePos` records the mouse position, in virtual coordinate\n  - `camera` records the camera position and zoom level\n\n","args":["userdata"],"type":"{ internalData : Messenger.Base.InternalData, sceneStartTime : Basics.Float, globalStartTime : Basics.Float, globalStartFrame : Basics.Int, sceneStartFrame : Basics.Int, currentTimeStamp : Basics.Float, windowVisibility : Browser.Events.Visibility, mousePos : ( Basics.Float, Basics.Float ), pressedMouseButtons : Set.Set Basics.Int, pressedKeys : Set.Set Basics.Int, extraHTML : Maybe.Maybe (Html.Html Messenger.Base.WorldEvent), canvasAttributes : List.List (Html.Attribute Messenger.Base.WorldEvent), volume : Basics.Float, userData : userdata, currentScene : String.String, camera : REGL.Common.Camera }"},{"name":"InternalData","comment":" Internal GlobalData\n\nBasically users do not need to get or modify them.\n\n  - `browserViewPort` records the browser size.\n  - `sprites` records all the sprites(images).\n\n","args":[],"type":"{ browserViewPort : ( Basics.Float, Basics.Float ), realWidth : Basics.Float, realHeight : Basics.Float, startLeft : Basics.Float, startTop : Basics.Float, sprites : Dict.Dict String.String REGL.Texture, loadedResNum : Basics.Int, totResNum : Basics.Int, fonts : Set.Set String.String, programs : Set.Set String.String, virtualWidth : Basics.Float, virtualHeight : Basics.Float, audioRepo : Messenger.Audio.Internal.AudioRepo }"},{"name":"UserViewGlobalData","comment":" This type is for user to use when initializing the messenger.\nIt is very useful when dealing with local storage.\n","args":["userdata"],"type":"{ sceneStartTime : Basics.Float, globalStartTime : Basics.Float, sceneStartFrame : Basics.Int, globalStartFrame : Basics.Int, camera : REGL.Common.Camera, volume : Basics.Float, extraHTML : Maybe.Maybe (Html.Html Messenger.Base.WorldEvent), canvasAttributes : List.List (Html.Attribute Messenger.Base.WorldEvent), userData : userdata }"}],"values":[{"name":"addCommonData","comment":" Add the common data to a Environment without common data.\n","type":"cdata -> Messenger.Base.Env () userdata -> Messenger.Base.Env cdata userdata"},{"name":"emptyInternalData","comment":" Empty InternalData\n","type":"Messenger.Base.InternalData"},{"name":"globalDataToUserGlobalData","comment":" Turn GlobalData into UserViewGlobalData\n","type":"Messenger.Base.GlobalData userdata -> Messenger.Base.UserViewGlobalData userdata"},{"name":"removeCommonData","comment":" Remove common data from environment.\n\nUseful when dealing with portable components by yourself.\n\nMost of the time it will not be used since it has been built into prepared update functions.\n\n","type":"Messenger.Base.Env cdata userdata -> Messenger.Base.Env () userdata"},{"name":"userGlobalDataToGlobalData","comment":" Turn UserViewGlobalData into GlobalData\n","type":"Messenger.Base.UserViewGlobalData userdata -> Messenger.Base.GlobalData userdata"}],"binops":[]},{"name":"Messenger.Component.Component","comment":"\n\n\n# Component\n\nA component is an object that you may put in your layers.\n\n\n## User components\n\nThese are components that you users can create with custom **basedata**.\n\nBasedata is the data that components with the same type can share.\n\nFor example, you may want a game component to have some common properties like position, velocity, etc.\n\nIn this case, your basedata would be a record with these properties.\n\n@docs AbstractComponent\n@docs ConcreteUserComponent\n@docs genComponent\n@docs updateComponents, updateComponentsWithBlock\n@docs updateComponentsWithTarget\n\n\n## View components\n\n@docs genComponentsRenderList, viewComponentsRenderList\n@docs viewComponents\n\n\n# Type sugar\n\n@docs ComponentInit, ComponentUpdate, ComponentUpdateRec, ComponentView, ComponentMatcher\n@docs ComponentStorage, LevelComponentStorage\n@docs UpdateMiddleStep, UpdateRecMiddleStep\n\n","unions":[],"aliases":[{"name":"AbstractComponent","comment":" Abstract component\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","args":["cdata","userdata","tar","msg","bdata","scenemsg"],"type":"Messenger.GeneralModel.AbstractGeneralModel (Messenger.Base.Env cdata userdata) Messenger.Base.UserEvent tar msg ( REGL.Common.Renderable, Basics.Int ) bdata (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata)"},{"name":"ComponentInit","comment":" Component init type sugar.\n\nReceives the environment and the initializing message (from which you can extract the parameters used to initialize the object, for example position),\nand returns a tuple of (Data, BaseData).\n\n  - Note: data is somehow private, but baseData is public. More precisely, baseData can be accessed safely at layer level since it is the same for every component in the layer.\n\n","args":["cdata","userdata","msg","data","bdata"],"type":"Messenger.Base.Env cdata userdata -> msg -> ( data, bdata )"},{"name":"ComponentMatcher","comment":" Component matcher type sugar\nThe function that is used to judge if this component is the target of a incoming component msg (sent by OtherTar). It will return true if the incoming\ncomponentMatcher matches this component.\n\nIt receives data, basedata, and the componentMatcher value of the incoming message.\n\nHere is an example of it:\n\n    matcher : ComponentMatcher Data BaseData ComponentTarget\n    matcher data basedata tar =\n        tar == Type basedata.ty || tar == Id basedata.id\n\nWhere the matcher will return true if the id or the name matches the incoming message.\n\n","args":["data","bdata","tar"],"type":"data -> bdata -> tar -> Basics.Bool"},{"name":"ComponentStorage","comment":" Component storage type sugar\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","args":["cdata","userdata","tar","msg","bdata","scenemsg"],"type":"msg -> Messenger.Component.Component.LevelComponentStorage cdata userdata tar msg bdata scenemsg"},{"name":"ComponentUpdate","comment":" Component update type sugar\n\nDetermines the behaviour when a UserEvent is sent to the component. This could include, but not limited to, a mouse click, a keyboard press, or most commonly a time tick\n(which means a specific amount of time has passed, see the manual)\n\nReceives the environment env, the UserEvent evnt, the currect data and basedata ,and returns a structure in ((Data,BaseData),List Msg, (Env, Bool)).\n\n  - Note: The last bool determines if the message would be blocked from the next component. If it is set to be True, then all the components behind it will\n    not receive this UserEvent. This is useful when you want the action of the player only influence the front component, but not the conponents behind them.\n\n  - Note: data is somehow private, but baseData is public. More precisely, baseData can be accessed safely at layer level since it is the same for every component in the layer.\n\n","args":["cdata","data","userdata","scenemsg","tar","msg","bdata"],"type":"Messenger.Base.Env cdata userdata -> Messenger.Base.UserEvent -> data -> bdata -> ( ( data, bdata ), List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) )"},{"name":"ComponentUpdateRec","comment":" Component updaterec type sugar\n\nDetermines the behaviour when other components, layers or scene sends messages to the component. For example, a knife component may send a message to the monster component to decrease its blood.\n\nReceives the environment env, the component messages (defined in ComponentBase.elm), the currect data and basedata ,and returns a structure in ((Data,BaseData),List Msg, Env).\n\n  - Note: data is somehow private, but baseData is public. More precisely, baseData can be accessed safely at layer level since it is the same for every component in the layer.\n\n","args":["cdata","data","userdata","scenemsg","tar","msg","bdata"],"type":"Messenger.Base.Env cdata userdata -> msg -> data -> bdata -> ( ( data, bdata ), List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata )"},{"name":"ComponentView","comment":" Component view type sugar\n\nRenders the component. If you want to render multiple things, you should use Canvas.group to assemble them into one renderable.\nThe second entry of the returning tuple is the \"z-index\" of the component. For example, if you want to put something important to the toppest layer of the window (Like the mouse cursor),\nyou can set it to a very high value(like 1000).\n\nReceives environment, data, and basedata.\n\n","args":["cdata","userdata","data","bdata"],"type":"Messenger.Base.Env cdata userdata -> data -> bdata -> ( REGL.Common.Renderable, Basics.Int )"},{"name":"ConcreteUserComponent","comment":" ConcreteUserComponent\n\nNot very likely to be used. The messenger template will handle this for you automatically.\n\n","args":["data","cdata","userdata","tar","msg","bdata","scenemsg"],"type":"Messenger.GeneralModel.ConcreteGeneralModel data (Messenger.Base.Env cdata userdata) Messenger.Base.UserEvent tar msg ( REGL.Common.Renderable, Basics.Int ) bdata (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata)"},{"name":"LevelComponentStorage","comment":" Level component storage type sugar\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","args":["cdata","userdata","tar","msg","bdata","scenemsg"],"type":"Messenger.Base.Env cdata userdata -> Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg"},{"name":"UpdateMiddleStep","comment":" This is a type sugar for dividing a long update function into smaller pieces to enhance code quality. It receives a ((Data,BaseData),List Msg, (Env, Bool)) and returns a tuple of same kind.\nHere is a piece of sample code:\n\n    judgeMsg : UpdateMiddleStep SceneCommonData Data UserData SceneMsg ComponentTarget ComponentMsg BaseData\n    judgeMsg ( ( data, basedata ), msg, ( env, bool ) ) =\n        ( ( data, basedata ), msg, ( env, False ) )\n\nAfter defining this, using this in Update is as simple a a cup of tea.\n\n    case evnt of\n        Tick t ->\n            ( ( data, basedata ), [], ( env, False ) )\n                |> judgeMsg\n\n  - Note: you may add extra argument to your function like this:\n\n    `myFunc : Int -> UpdateMiddleStep`\n\n    and call like this:\n\n    `( ( data, basedata ), [], ( env, False ) ) |> myFunc 1`\n\n","args":["cdata","data","userdata","scenemsg","tar","msg","bdata"],"type":"( ( data, bdata ), List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) ) -> ( ( data, bdata ), List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) )"},{"name":"UpdateRecMiddleStep","comment":" This is a type sugar for dividing a long updateRec function into smaller pieces to enhance code quality. It receives a ((Data,BaseData),List Msg, Env) and returns a tuple of same kind.\nIt is really similar to UpdateMiddleStep, see the examples there.\n","args":["cdata","data","userdata","scenemsg","tar","msg","bdata"],"type":"( ( data, bdata ), List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata ) -> ( ( data, bdata ), List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata )"}],"values":[{"name":"genComponent","comment":" Generate abstract user component from concrete component.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"Messenger.Component.Component.ConcreteUserComponent data cdata userdata tar msg bdata scenemsg -> Messenger.Component.Component.ComponentStorage cdata userdata tar msg bdata scenemsg"},{"name":"genComponentsRenderList","comment":" Generate render list for one list of components.\n\nUseful when there are several component lists.\n\nThe output should be used as the input of `viewComponentsRenderList`.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"Messenger.Base.Env cdata userdata -> List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg) -> List.List ( REGL.Common.Renderable, Basics.Int )"},{"name":"updateComponents","comment":" Update a list of abstract user components.\n","type":"Messenger.Base.Env cdata userdata -> Messenger.Base.UserEvent -> List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg) -> ( List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg), List.List (Messenger.Scene.Scene.MMsgBase msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) )"},{"name":"updateComponentsWithBlock","comment":" Update a list of abstract user components with block indicator.\n\nIt block is True, this function will not update anything.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"Messenger.Base.Env cdata userdata -> Messenger.Base.UserEvent -> Basics.Bool -> List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg) -> ( List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg), List.List (Messenger.Scene.Scene.MMsgBase msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) )"},{"name":"updateComponentsWithTarget","comment":" Update a list of abstract user components with targeted msgs.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"Messenger.Base.Env cdata userdata -> List.List ( tar, msg ) -> List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg) -> ( List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg), List.List (Messenger.Scene.Scene.MMsgBase msg scenemsg userdata), Messenger.Base.Env cdata userdata )"},{"name":"viewComponents","comment":" View one list of abstract components.\n\nUsed when there is only one list of components\n\n","type":"Messenger.Base.Env cdata userdata -> List.List (Messenger.Component.Component.AbstractComponent cdata userdata tar msg bdata scenemsg) -> REGL.Common.Renderable"},{"name":"viewComponentsRenderList","comment":" View the render list of components.\n\nUseful when there are several component lists.\n\nThe input should be generated by several `genComponentsRenderList`.\n\n","type":"List.List ( REGL.Common.Renderable, Basics.Int ) -> REGL.Common.Renderable"}],"binops":[]},{"name":"Messenger.Component.GlobalComponent","comment":"\n\n\n# Global Component\n\n@docs genGlobalComponent\n@docs filterAliveGC\n@docs combinePP\n\n","unions":[],"aliases":[],"values":[{"name":"combinePP","comment":" Combine post processors of all global components.\n","type":"List.List (Messenger.Scene.Scene.AbstractGlobalComponent userdata scenemsg) -> List.List (REGL.Common.Renderable -> REGL.Common.Renderable)"},{"name":"filterAliveGC","comment":" Filter out dead global components.\n","type":"List.List (Messenger.Scene.Scene.AbstractGlobalComponent userdata scenemsg) -> List.List (Messenger.Scene.Scene.AbstractGlobalComponent userdata scenemsg)"},{"name":"genGlobalComponent","comment":" Generate abstract global component from concrete global component.\n","type":"Messenger.Scene.Scene.ConcreteGlobalComponent data userdata scenemsg -> Messenger.Scene.Scene.GCMsg -> Maybe.Maybe Messenger.Scene.Scene.GCTarget -> Messenger.Scene.Scene.GlobalComponentStorage userdata scenemsg"}],"binops":[]},{"name":"Messenger.Coordinate.Camera","comment":"\n\n\n# Camera Tools\n\n@docs setCameraPos, setCameraScale, setCameraAngle\n@docs defaultCamera\n\n","unions":[],"aliases":[],"values":[{"name":"defaultCamera","comment":" Default camera for the game.\n","type":"Messenger.Base.GlobalData u -> REGL.Common.Camera"},{"name":"setCameraAngle","comment":" Set the camera angle.\n","type":"Basics.Float -> Messenger.Base.GlobalData u -> Messenger.Base.GlobalData u"},{"name":"setCameraPos","comment":" Set the camera position.\n","type":"( Basics.Float, Basics.Float ) -> Messenger.Base.GlobalData u -> Messenger.Base.GlobalData u"},{"name":"setCameraScale","comment":" Set the camera scale.\n","type":"Basics.Float -> Messenger.Base.GlobalData u -> Messenger.Base.GlobalData u"}],"binops":[]},{"name":"Messenger.Coordinate.Coordinates","comment":"\n\n\n# Coordinate\n\nThis module deals with the coordinate transformation.\n\nNormally, users do not need to use this module directly, as Messenger will handle the coordinate transformation for you.\n\n@docs fixedPosToReal\n@docs posToReal, posToVirtual\n@docs lengthToReal\n@docs fromRealLength\n@docs maxHandW\n@docs getStartPoint\n@docs judgeMouseRect\n@docs fromMouseToVirtual\n\n","unions":[],"aliases":[],"values":[{"name":"fixedPosToReal","comment":" Same as posToReal, but add the initial position of canvas. That is to say, the function returns the actual coordinate of the point **on the whole screen** of your computer, so it is dependent on the location of your browser windows.\n\nExample: If your screen is 2560\\*1440, the virtual canvas size is 1920\\*1080 and the actual window size 960\\*540 at the center of screen, then the function will map (600,300) to (2560/2-960/2+(960/1920)\\*600,1440/2-540/2+(540/1080)\\*300) = (1100,600)\n\n","type":"Messenger.Base.InternalData -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float )"},{"name":"fromMouseToVirtual","comment":" fromMouseToVirtual conveys the mouse position in the Screen coordinate to the virtual coordinate. In most cases Messenger does this for you.\n\nThe coordinate in the globalData is already in virtual coordinates.\n\n","type":"Messenger.Base.InternalData -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float )"},{"name":"fromRealLength","comment":" The inverse function of widthToReal. Turns the length in real length to virtual length.\n\n  - Note: In the case the actual width-length ratio of the window is different from the virtual ratio, the zooming ratio is calculated based on the WIDTH ratio between the real and virtual canvas size.\n    Usage: `lengthToReal gd x`\n\n  - gd is the internal data.\n\n  - x is the length in real coordinate system.\n\nThe function returns the length in virtual coordinate system.\n\n","type":"Messenger.Base.InternalData -> Basics.Float -> Basics.Float"},{"name":"getStartPoint","comment":" Get the start point of the virtual canvas in the real canvas.\n\nUsed internally.\n\n","type":"( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float )"},{"name":"judgeMouseRect","comment":" judgeMouseRect\nJudge whether the mouse position is in the rectangle.\nUsage: `judgeMouseRect ( mx, my ) ( x, y ) ( w, h )`\n\n  - (mx,my) is the coordinate of the mouse, which you can get easily from globalData.\n  - (x,y) is the starting point(left-top corner) of the desired rectangle.\n  - (w,h) is the width and length of the desired rectangle.\n\nThe function returns a bool indicating whether the mouse is in the rectangle.\n\n","type":"( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> Basics.Bool"},{"name":"lengthToReal","comment":" Use this if you want to draw something based on the length. It turns the virtual length to real length.\nFor example, if the actual window is 960\\*540 and the virtual one is 1920\\*1080, then the function will map 300(virtual length) to 150(real length)\n\n  - Note: In the case the actual width-length ratio of the window is different from the virtual ratio, the zooming ratio is calculated based on the WIDTH ratio between the real and virtual canvas size.\n\nUsage: `lengthToReal gd x`\n\n  - gd is the internal data.\n  - x is the length in virtual coordinate system.\n\nThe function returns the length in real coordinate system.\n\n","type":"Messenger.Base.InternalData -> Basics.Float -> Basics.Float"},{"name":"maxHandW","comment":" Used internally.\n","type":"( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float )"},{"name":"posToReal","comment":" Transform from the virtual coordinate system to the real pixel system.\n\nFor example, if you virtual canvas is 1920\\*1080 but your real window is 960\\*540, then the function will map a point at (1200,600) to (600,300).\n\nUsage : `posToReal gd ( x, y )` where (x,y) is the virtual coordinates and gd the internal data.\n\nThe function returns the position in real canvas.\n\n","type":"Messenger.Base.InternalData -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float )"},{"name":"posToVirtual","comment":" Inverse of posToReal. This is helpful if you need to render sprite with real coordinates.\n\nUsage : `posToReal gd ( x, y )` where (x,y) is the real coordinates and gd the internal data.\nThe function returns the coordinate in virtual coordinate system.\n\n","type":"Messenger.Base.InternalData -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float )"}],"binops":[]},{"name":"Messenger.Coordinate.HTML","comment":"\n\n\n# HTML Coordinate Lib\n\nThis is only useful when you use extraHTML.\n\n@docs genAttribute\n\n","unions":[],"aliases":[],"values":[{"name":"genAttribute","comment":" Generate HTML Attributes that has the correct position\n\nUseful when you try to add extra HTML\n\n","type":"Messenger.Base.InternalData -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> List.List (Html.Attribute msg)"}],"binops":[]},{"name":"Messenger.GeneralModel","comment":"\n\n\n# General Model\n\nGeneral model is designed to be an abstract interface of layers, components, etc..\n\nA General model has the ability to:\n\n  - specialize its own data types\n  - share some data types with objects in the same type\n  - be initialized by some inputs\n  - be updated by event and msgs\n  - be updated in a list of same type objects\n  - send msg to the objects in the same type\n  - send msg to the parent object\n  - render itself\n  - identify itself by a matcher\n\n@docs Msg, MsgBase, filterSOM\n@docs ConcreteGeneralModel, AbstractGeneralModel\n@docs unroll, abstract\n@docs viewModelList\n@docs Matcher\n\n\n## Result Remap\n\n@docs updateResultRemap, updaterecResultRemap\n\n","unions":[{"name":"AbstractGeneralModel","comment":" Rolled Abstract General Model.\n\nCannot be directedly modified.\nUsed for storage.\n\n","args":["env","event","tar","msg","ren","bdata","sommsg"],"cases":[["Roll",["Messenger.GeneralModel.UnrolledAbstractGeneralModel env event tar msg ren bdata sommsg"]]]},{"name":"Msg","comment":" The Basic Msg Model.\n\nUsing **Other** when sending msg to objects in the same type.\nMake sure the `othertar` can pass the matcher of target object.\n\nExamples:\n\n  - Parent <| SOMMsg <| SOMChangeScene (Just NullSceneMsg) \"SelectLevel\" -- Parent\n  - Other <| ( Type \"Camera\", CameraShakeMsg 1 200 ) -- Note here Type \"Camera\" is of Matcher Type (Defined by the user) which indicates the target of the message, and the desired message is the second entry of the tuple.\n\n","args":["othertar","msg","sommsg"],"cases":[["Parent",["Messenger.GeneralModel.MsgBase msg sommsg"]],["Other",["( othertar, msg )"]]]},{"name":"MsgBase","comment":" MsgBase\n\nUsed when sending a msg to parent object.\n\nUsing **SOMMsg** when sending a `SceneOutputMsg`, which will be directly handled by Top-level.\nUse **OtherMsg** when sending a normal message to parent.\n\nExamples:\n\n  - Parent <| SOMMsg <| SOMChangeScene (Just NullSceneMsg) \"SelectLevel\" -- SOMMsg\n  - Parent <| OtherMsg <| genMeteor env.commonData.playerPos env.globalData.globalStartTime -- In a component. This genMeteor message will be handled in the layer containing the component.\n\n","args":["othermsg","sommsg"],"cases":[["SOMMsg",["sommsg"]],["OtherMsg",["othermsg"]]]}],"aliases":[{"name":"ConcreteGeneralModel","comment":" Concrete General Model.\n\nUsers deal with the fields in concrete model. That is to say, you should implement the init,update,updaterec,view and matcher function in the model.\n\n","args":["data","env","event","tar","msg","ren","bdata","sommsg"],"type":"{ init : env -> msg -> ( data, bdata ), update : env -> event -> data -> bdata -> ( ( data, bdata ), List.List (Messenger.GeneralModel.Msg tar msg sommsg), ( env, Basics.Bool ) ), updaterec : env -> msg -> data -> bdata -> ( ( data, bdata ), List.List (Messenger.GeneralModel.Msg tar msg sommsg), env ), view : env -> data -> bdata -> ren, matcher : data -> bdata -> tar -> Basics.Bool }"},{"name":"Matcher","comment":" A general matcher type sugar\n\nSimilar to the matcher function implemented by user in the components and layers.\n\n","args":["data","tar"],"type":"data -> tar -> Basics.Bool"}],"values":[{"name":"abstract","comment":" Abstract a concrete model to an abstract model.\n\nInitialize it with env and msg.\nMessenger will handle this for you.\n\n","type":"Messenger.GeneralModel.ConcreteGeneralModel data env event tar msg ren bdata sommsg -> msg -> env -> Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg"},{"name":"filterSOM","comment":" Filter SOMMsg from list of MsgBase.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"List.List (Messenger.GeneralModel.MsgBase othermsg sommsg) -> List.List sommsg"},{"name":"unroll","comment":" Unroll a rolled abstract model. In this way, you retrieve the data from the storage.\nThis is useful when you want to manipulate and calculate the reactions between components, like in collision handling process.\nFor example, the following function called by the layer can read the position of from AbstractComponent.\nlet\nx\\_data = unroll x\nposX=x\\_data.baseData.position\nin\n...\n","type":"Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg -> Messenger.GeneralModel.UnrolledAbstractGeneralModel env event tar msg ren bdata sommsg"},{"name":"updateResultRemap","comment":" Change the `update` function to remap the result and return the changed abstract general model.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"(( List.List (Messenger.GeneralModel.Msg tar msg sommsg), ( env, Basics.Bool ) ) -> ( List.List (Messenger.GeneralModel.Msg tar msg sommsg), ( env, Basics.Bool ) )) -> Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg -> Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg"},{"name":"updaterecResultRemap","comment":" Change the `updaterec` function to remap the result and return the changed abstract general model.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"(( List.List (Messenger.GeneralModel.Msg tar msg sommsg), env ) -> ( List.List (Messenger.GeneralModel.Msg tar msg sommsg), env )) -> Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg -> Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg"},{"name":"viewModelList","comment":" View model list.\n\n  - Not very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"Messenger.Base.Env common userdata -> List.List (Messenger.GeneralModel.AbstractGeneralModel (Messenger.Base.Env common userdata) Messenger.Base.UserEvent tar msg REGL.Common.Renderable bdata sommsg) -> List.List REGL.Common.Renderable"}],"binops":[]},{"name":"Messenger.Layer.Layer","comment":"\n\n\n# Layer\n\nGeneral Model and Helper functions for Layers.\n\n@docs ConcreteLayer, AbstractLayer\n\n\n## Generate\n\n@docs genLayer\n\n\n## Update\n\n@docs Handler\n@docs handleComponentMsgs\n@docs LayerInit, LayerUpdate, LayerUpdateRec, LayerView\n@docs LayerStorage\n@docs LayerUpdateMiddleStep, LayerUpdateRecMiddleStep\n\n","unions":[],"aliases":[{"name":"AbstractLayer","comment":" Abstract Layer Model.\n\nCannot be directedly modified.\nUsed for storage.\n\n","args":["cdata","userdata","tar","msg","scenemsg"],"type":"Messenger.Scene.Scene.MAbstractGeneralModel cdata userdata tar msg () scenemsg"},{"name":"ConcreteLayer","comment":" Concrete Layer Model\n\nUsers deal with the fields in concrete model.\n\n","args":["data","cdata","userdata","tar","msg","scenemsg"],"type":"{ init : Messenger.Layer.Layer.LayerInit cdata userdata msg data, update : Messenger.Layer.Layer.LayerUpdate cdata userdata tar msg scenemsg data, updaterec : Messenger.Layer.Layer.LayerUpdateRec cdata userdata tar msg scenemsg data, view : Messenger.Layer.Layer.LayerView cdata userdata data, matcher : Messenger.GeneralModel.Matcher data tar }"},{"name":"Handler","comment":" Handler Type.\n\nA handler is used to handle the Component Msg sent to the layer.\n\n**Make handler for every type of component msg.**\n\n","args":["data","cdata","userdata","tar","msg","scenemsg","cmsg"],"type":"Messenger.Base.Env cdata userdata -> Messenger.Scene.Scene.MMsgBase cmsg scenemsg userdata -> data -> ( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata )"},{"name":"LayerInit","comment":" init type sugar\nThe initializing function for layer. It receives the environment, the initializing message, and returns the layer's data.\n","args":["cdata","userdata","msg","data"],"type":"Messenger.Base.Env cdata userdata -> msg -> data"},{"name":"LayerStorage","comment":" Layer Storage\n\nNot very likely to be used. The messenger template will handle this for you automatically.\n\n","args":["cdata","userdata","tar","msg","scenemsg"],"type":"msg -> Messenger.Base.Env cdata userdata -> Messenger.Layer.Layer.AbstractLayer cdata userdata tar msg scenemsg"},{"name":"LayerUpdate","comment":" update type sugar\n\nDetermines the behaviour when a UserEvent is sent to the layer. This could include, but not limited to, a mouse click, a keyboard press, or most commonly a time tick\n(which means a specific amount of time has passed, see the manual). In most cases you should distribute the events to the components belonging to the group.\n\nReceives the environment env, the UserEvent evnt, the currect data of the layer ,and returns a structure in (Data ,List Msg, (Env, Bool)).\n\n  - Note: The last bool determines if the message would be blocked from the next layer. If it is set to be True, then all the layers behind it(generated after it\n    in the initializing of scene) will not receive this UserEvent. This is useful when you want the action of the player only influence the front layers, but not the layers behind them.\n  - Note: This function is also the place where you should handle the routine chores of the layers and collect component message. For more information please read the 5-step update framework in the manual.\n\n","args":["cdata","userdata","tar","msg","scenemsg","data"],"type":"Messenger.Base.Env cdata userdata -> Messenger.Base.UserEvent -> data -> ( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) )"},{"name":"LayerUpdateMiddleStep","comment":" This is a type sugar for dividing a long update function into smaller pieces to enhance code quality. It receives a ((Data,BaseData),List Msg, (Env,bool)) and returns a tuple of same kind.\nIt is really similar to UpdateMiddleStep(which is in Component.elm), see the examples there.\n","args":["cdata","data","userdata","scenemsg","tar","msg"],"type":"( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) ) -> ( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), ( Messenger.Base.Env cdata userdata, Basics.Bool ) )"},{"name":"LayerUpdateRec","comment":" updaterec type sugar\n\nDetermines the behaviour when other components or layers sends messages to the layer. The layer then use the message to change its state, initializing components and/or send relavent message to its component.\n\nReceives the environment env, the layer messages (defined in LayerBase.elm), the currect data, and returns a structure in (Data,List Msg, Env).\n\n","args":["cdata","userdata","tar","msg","scenemsg","data"],"type":"Messenger.Base.Env cdata userdata -> msg -> data -> ( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata )"},{"name":"LayerUpdateRecMiddleStep","comment":" This is a type sugar for dividing a long updateRec function into smaller pieces to enhance code quality. It receives a ((Data,BaseData),List Msg, Env) and returns a tuple of same kind.\nIt is really similar to UpdateMiddleStep(which is in Component.elm), see the examples there.\n","args":["cdata","data","userdata","scenemsg","tar","msg"],"type":"( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata ) -> ( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata )"},{"name":"LayerView","comment":" view type sugar\nRenders the layer. Note that there is no need for you to render the components of the layer. Instead, you can render the background of the map or the decoration of the windows here.\n\nReceives the environment and the data of the layer.\n\n","args":["cdata","userdata","data"],"type":"Messenger.Base.Env cdata userdata -> data -> REGL.Common.Renderable"}],"values":[{"name":"genLayer","comment":" Generate abstract layer by a concrete layer.\n\nInitialize it with env and msg.\nNot very likely to be used. The messenger template will handle this for you automatically.\n\n","type":"Messenger.Layer.Layer.ConcreteLayer data cdata userdata tar msg scenemsg -> Messenger.Layer.Layer.LayerStorage cdata userdata tar msg scenemsg"},{"name":"handleComponentMsgs","comment":" Handle a list of component msgs.\n\n**Note that for several list of component msgs with different types, you may have to use this function repeatedly.**\n\n  - Note its main use is to deal with all the component msgs with the component message handler function (which is designed to handle one message) provided by the user. In real case just\n    determine the handler function and put it as a parameter of this function.\n\n","type":"Messenger.Base.Env cdata userdata -> List.List (Messenger.Scene.Scene.MMsgBase cmsg scenemsg userdata) -> data -> List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata) -> Messenger.Layer.Layer.Handler data cdata userdata tar msg scenemsg cmsg -> ( data, List.List (Messenger.Scene.Scene.MMsg tar msg scenemsg userdata), Messenger.Base.Env cdata userdata )"}],"binops":[]},{"name":"Messenger.Recursion","comment":"\n\n\n# RecursionList\n\nList implementation for the recursion algorithm\n\n@docs updateObjects, updateObjectsWithTarget\n@docs removeObjects\n\n","unions":[],"aliases":[],"values":[{"name":"removeObjects","comment":" Remove all objects by target.\n","type":"tar -> List.List (Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg) -> List.List (Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg)"},{"name":"updateObjects","comment":" Recursively update all the objects in the List\n","type":"env -> event -> List.List (Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg) -> ( List.List (Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg), List.List (Messenger.GeneralModel.MsgBase msg sommsg), ( env, Basics.Bool ) )"},{"name":"updateObjectsWithTarget","comment":" Recursively update all the objects in the List, but also uses target\n","type":"env -> List.List ( tar, msg ) -> List.List (Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg) -> ( List.List (Messenger.GeneralModel.AbstractGeneralModel env event tar msg ren bdata sommsg), List.List (Messenger.GeneralModel.MsgBase msg sommsg), env )"}],"binops":[]},{"name":"Messenger.Render.Texture","comment":"\n\n\n# Texture Rendering\n\n@docs renderSprite\n@docs textureDim\n\n","unions":[],"aliases":[],"values":[{"name":"renderSprite","comment":" Render a sprite with the size automatically calculated from the texture.\n","type":"Messenger.Base.InternalData -> ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> String.String -> REGL.Common.Renderable"},{"name":"textureDim","comment":" Get the width and height of a texture.\n","type":"Messenger.Base.InternalData -> String.String -> ( Basics.Int, Basics.Int )"}],"binops":[]},{"name":"Messenger.Resources.Base","comment":"\n\n\n# Resource\n\nThere are many assets (images) in our game, so it's important to manage them.\n\nIn elm-canvas, we have to preload all the images before the game starts.\n\nThe game will only start when all resources are loaded.\n\nIf some asset is not found, the game will panic and throw an error (alert).\n\nAfter the resources are loaded, we can get those data from globaldata.sprites.\n\n@docs saveSprite\n@docs igetSprite\n@docs ResourceDef, ResourceDefs, resourceNum\n\n","unions":[{"name":"ResourceDef","comment":" Definition for a resource.\n","args":[],"cases":[["TextureRes",["String.String","Maybe.Maybe REGL.TextureOptions"]],["AudioRes",["String.String"]],["FontRes",["String.String","String.String"]],["ProgramRes",["REGL.Program.REGLProgram"]]]}],"aliases":[{"name":"ResourceDefs","comment":" A list of resource definitions.\n","args":[],"type":"List.List ( String.String, Messenger.Resources.Base.ResourceDef )"}],"values":[{"name":"igetSprite","comment":" Get the texture by name.\n","type":"String.String -> Dict.Dict String.String REGL.Texture -> Maybe.Maybe REGL.Texture"},{"name":"resourceNum","comment":" The number of sprites in the game.\n","type":"Messenger.Resources.Base.ResourceDefs -> Basics.Int"},{"name":"saveSprite","comment":" Save the sprite.\n","type":"Dict.Dict String.String REGL.Texture -> String.String -> REGL.Texture -> Dict.Dict String.String REGL.Texture"}],"binops":[]},{"name":"Messenger.Scene.LayeredScene","comment":"\n\n\n# Layered Scene\n\nLayered scene is a pre-defined scene implementation provided by Messenger.\nA layered scene can only handle a list of layers with fixed `cdata`, `userdata`, `tar`, `msg` and `scenemsg` types.\n\n@docs LayeredSceneData\n@docs genLayeredScene\n@docs LayeredSceneInit, LayeredSceneEffectFunc\n\n\n## Scene Prototype\n\n@docs LayeredSceneProtoInit, LayeredSceneLevelInit, initCompose\n\n","unions":[],"aliases":[{"name":"LayeredSceneData","comment":" Layered Scene Data.\n\n    - `renderSettings` is used in `group` while viewing the layers as a whole\n    - `commonData` is the common data for the whole scene\n    - `layers` are the layers of the scene with type `AbstractLayer`  DO REMEMBER TO ADD YOUR LAYERS HERE!\n\nHere is an example for it:\n\n    { renderSettings = []\n    , commonData = cd\n    , layers =\n        [ Main.layer (MainInitData { components = comps, fakeBricks = fakes, isBoss = isBoss }) envcd\n        , TechTree.layer NullLayerMsg envcd\n        , TextLayer.layer (TextInitData levelName) envcd\n        , PauseLayer.layer NullLayerMsg envcd\n        , Guide.layer NullLayerMsg envcd\n        ]\n    }\n\n","args":["cdata","userdata","tar","msg","scenemsg"],"type":"{ renderSettings : List.List REGL.Common.Effect, commonData : cdata, layers : List.List (Messenger.Layer.Layer.AbstractLayer cdata userdata tar msg scenemsg) }"},{"name":"LayeredSceneEffectFunc","comment":" settingsFunc type sugar\nThis function takes the environment, userevent, the data of the scene and add visual effects to the scene.\n","args":["cdata","userdata","tar","msg","scenemsg"],"type":"Messenger.Base.Env () userdata -> Messenger.Base.UserEvent -> Messenger.Scene.LayeredScene.LayeredSceneData cdata userdata tar msg scenemsg -> List.List REGL.Common.Effect"},{"name":"LayeredSceneInit","comment":" init type sugar for normal (not prototype) layered scenes\nReceives Environment and sceneMsg (which stores the initial data), and return a record of data, for example this:\n\n       { renderSettings = []\n        , commonData = cd\n        , layers =\n            [ Opening.layer NullLayerMsg envcd ]\n        }\n\n  - Note: The most important part here is the initialization of scenecommondata. This is so important that it usually takes a separate function to do it.\n\n","args":["cdata","userdata","tar","msg","scenemsg"],"type":"Messenger.Base.Env () userdata -> Maybe.Maybe scenemsg -> Messenger.Scene.LayeredScene.LayeredSceneData cdata userdata tar msg scenemsg"},{"name":"LayeredSceneLevelInit","comment":" init type sugar for levels.\nNormally it is used internally. No need to worry about it.\n","args":["userdata","scenemsg","idata"],"type":"Messenger.Base.Env () userdata -> Maybe.Maybe scenemsg -> Maybe.Maybe idata"},{"name":"LayeredSceneProtoInit","comment":" init type sugar for scene prototypes\nThis defines the initializing function for a scene prototype. It should be like this:\n\nLayeredSceneProtoInit SceneCommonData UserData LayerTarget (LayerMsg SceneMsg) SceneMsg (InitData SceneMsg)\n\nIt receives environment, the initial data to initialize the prototype, and return a layeredSceneData.\n\n","args":["cdata","userdata","tar","msg","scenemsg","idata"],"type":"Messenger.Base.Env () userdata -> Maybe.Maybe idata -> Messenger.Scene.LayeredScene.LayeredSceneData cdata userdata tar msg scenemsg"}],"values":[{"name":"genLayeredScene","comment":" This creates a layered scene.\n\n  - `init` creates the initial layered scene from env data and init msg.\n\n  - `settingsFunc` is a user provided function to modify `renderSettings` each time the scene updates. If you don't need `settingsFunc`, simply provide a `func _ _ _ = settings`\n\n","type":"Messenger.Scene.LayeredScene.LayeredSceneInit cdata userdata tar msg scenemsg -> Messenger.Scene.LayeredScene.LayeredSceneEffectFunc cdata userdata tar msg scenemsg -> Messenger.Scene.Scene.SceneStorage userdata scenemsg"},{"name":"initCompose","comment":" Compose LayeredSceneProtoInit with LayeredSceneLevelInit.\n","type":"Messenger.Scene.LayeredScene.LayeredSceneProtoInit cdata userdata tar msg scenemsg idata -> Messenger.Scene.LayeredScene.LayeredSceneLevelInit userdata scenemsg idata -> Messenger.Base.Env () userdata -> Maybe.Maybe scenemsg -> Messenger.Scene.LayeredScene.LayeredSceneData cdata userdata tar msg scenemsg"}],"binops":[]},{"name":"Messenger.Scene.RawScene","comment":"\n\n\n# RawScene\n\nRaw Scene is a scene without anything. Users can add whatever they like in the raw scene. It is suitable for those who want to imply\ntheir own logic and framework(instead of layer/component) or do a minimum amount of work to achieve simple tasks, like displaying Hello world.\n\n@docs RawSceneInit, RawSceneUpdate, RawSceneView\n@docs genRawScene\n\n\n## Scene Prototype\n\n@docs RawSceneProtoInit, RawSceneProtoLevelInit, initCompose\n\n","unions":[],"aliases":[{"name":"RawSceneInit","comment":" init type sugar\nInitialize the data of the rawscene using environment and scenemsg, and return a SceneData defined by user.\n","args":["data","userdata","scenemsg"],"type":"Messenger.Base.Env () userdata -> Maybe.Maybe scenemsg -> data"},{"name":"RawSceneProtoInit","comment":" init type sugar for scene prototypes\nHere you should generate the data using the initial arguments given by InitData.\nReceives the environment and the initData and returns the data of the scene.\n","args":["data","userdata","idata"],"type":"Messenger.Base.Env () userdata -> Maybe.Maybe idata -> data"},{"name":"RawSceneProtoLevelInit","comment":" init type sugar for levels\nHere you should describe how to generate the InitData of the scene to be passed to the prototype.\nNote in most of the case you may write almost all configs of the scene to be initialized here, like the place of block and the enemies.\nHowever, if you want to pass some parameters at real time inside the game to create new scene, the only pathway is through the scenemsg.\nThis may happen if you want to load some stored information from local storage or generate the scene based on the user's input.\n","args":["userdata","scenemsg","idata"],"type":"Messenger.Base.Env () userdata -> Maybe.Maybe scenemsg -> Maybe.Maybe idata"},{"name":"RawSceneUpdate","comment":" update type sugar\nThe update function, which is similar to that of component and layer(remember the general model)\nreceives Environment env,UserEvent evt,data of the scene data and returns (data,List SOMMsg) and new env.\n\n  - Note that Scene will only send message to messenger core, so here it will output SOMMsg only.\n\n","args":["data","userdata","scenemsg"],"type":"Messenger.Base.Env () userdata -> Messenger.Base.UserEvent -> data -> ( data, List.List (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata), Messenger.Base.Env () userdata )"},{"name":"RawSceneView","comment":" view type sugar\nView the raw scene.\nReceives the environment(which contains the globalData) and the scene data and return a renderable.\n","args":["userdata","data"],"type":"Messenger.Base.Env () userdata -> data -> REGL.Common.Renderable"}],"values":[{"name":"genRawScene","comment":" Generate a raw scene from a concrete scene.\n","type":"Messenger.Scene.Scene.MConcreteScene data userdata scenemsg -> Messenger.Scene.Scene.SceneStorage userdata scenemsg"},{"name":"initCompose","comment":" Compose RawSceneProtoInit with RawSceneProtoLevelInit.\n","type":"Messenger.Scene.RawScene.RawSceneProtoInit data userdata idata -> Messenger.Scene.RawScene.RawSceneProtoLevelInit userdata scenemsg idata -> Messenger.Base.Env () userdata -> Maybe.Maybe scenemsg -> data"}],"binops":[]},{"name":"Messenger.Scene.Scene","comment":"\n\n\n# Scene Base\n\nGeneral Model and Basic types for Scenes\n\n@docs AbstractScene\n@docs MConcreteScene, MAbstractScene\n@docs unroll, abstract\n@docs SceneOutputMsg\n@docs SceneStorage, AllScenes\n@docs MMsg, MMsgBase\n@docs MConcreteGeneralModel, MAbstractGeneralModel\n\n\n## Scene Result Remapper\n\n@docs updateResultRemap\n\n\n# Global Component\n\n@docs GCCommonData, GCBaseData, GCMsg, GCTarget\n@docs AbstractGlobalComponent, ConcreteGlobalComponent\n@docs GlobalComponentInit, GlobalComponentUpdate, GlobalComponentUpdateRec, GlobalComponentView\n@docs GlobalComponentStorage\n\n","unions":[{"name":"AbstractScene","comment":" Rolled Abstract Scene Model.\n\nCannot be directedly modified.\nUsed for storage.\n\n","args":["env","event","ren","scenemsg","userdata"],"cases":[["Roll",["Messenger.Scene.Scene.UnrolledAbstractScene env event ren scenemsg userdata"]]]},{"name":"SceneOutputMsg","comment":" Scene Output Msg is the message directly handled by the top-level core.\n\n`scenemsg` is a custom type which represents the message type users wants\nto send to a scene when switching scenes.\n\n  - `SOMChangeScene (Maybe scenemsg) name` is used to change to a target scene by giving the initial message and name of the scene.\n      - Note: initial message is defined in Scene.elm or Scenebase.elm, depending on whether you use sceneproto or not.\n  - `SOMAlert` makes an alert\n  - `SOMPrompt name title` makes a prompt with name and title. This means the system will eject a some textbox with the given title and name.\n      - Note: The returning message from the user will be given as a worldevent.\n  - `SOMPlayAudio channel name option` is used to play an audio resource by giving **channel name option**\n      - Note: See the docs in Audio.elm for more information on options.\n  - `SOMStopAudio` is used to stop a playing audio by giving the desired AudioTarget(see the docs on AudioTarget)\n  - `SOMTransformAudio` is used to transform a playing audio (e.g., adding some effects).\n  - `SOMSetVolume` is used to set the volume with a value **from 0 to 1**\n  - `SOMSaveGlobalData` saves the global by encode function given in UserConfig\n      - Note: At the beginning of the game messenger will load the stored data into userdata (which is also the only chance to load it)\n  - `SOMLoadGC` is used to load a global component by giving the GC.\n  - `SOMUnloadGC` is used to unload a global component by giving the target.\n  - `SOMCallGC` is used to call a global component by giving the target and message.\n  - `SOMChangeFPS` is used to change the FPS by giving the time interval.\n  - `SOMLoadResource` is used to load a resource by giving the name and resource definition.\n      - Note: The result of the loading will be in globaldata.internaldata. No user event will be triggered.\n\n","args":["scenemsg","userdata"],"cases":[["SOMChangeScene",["Maybe.Maybe scenemsg","String.String"]],["SOMAlert",["String.String"]],["SOMPrompt",["String.String","String.String"]],["SOMPlayAudio",["Basics.Int","String.String","Messenger.Audio.Base.AudioOption"]],["SOMStopAudio",["Messenger.Audio.Base.AudioTarget"]],["SOMTransformAudio",["Messenger.Audio.Base.AudioTarget","Audio.Audio -> Audio.Audio"]],["SOMSetVolume",["Basics.Float"]],["SOMSaveGlobalData",[]],["SOMLoadGC",["Messenger.Scene.Scene.GlobalComponentStorage userdata scenemsg"]],["SOMUnloadGC",["Messenger.Scene.Scene.GCTarget"]],["SOMCallGC",["( Messenger.Scene.Scene.GCTarget, Messenger.Scene.Scene.GCMsg )"]],["SOMChangeFPS",["REGL.TimeInterval"]],["SOMLoadResource",["String.String","Messenger.Resources.Base.ResourceDef"]]]}],"aliases":[{"name":"AbstractGlobalComponent","comment":" Abstract GlobalComponent Model.\n\nCannot be directly modified.\nUsed for storage.\n\n","args":["userdata","scenemsg"],"type":"Messenger.Scene.Scene.MAbstractGeneralModel (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata Messenger.Scene.Scene.GCTarget Messenger.Scene.Scene.GCMsg Messenger.Scene.Scene.GCBaseData scenemsg"},{"name":"AllScenes","comment":" All scenes type\n","args":["userdata","scenemsg"],"type":"Dict.Dict String.String (Messenger.Scene.Scene.SceneStorage userdata scenemsg)"},{"name":"ConcreteGlobalComponent","comment":" Concrete GlobalComponent Model\n","args":["data","userdata","scenemsg"],"type":"{ init : Messenger.Scene.Scene.GlobalComponentInit userdata scenemsg data, update : Messenger.Scene.Scene.GlobalComponentUpdate userdata scenemsg data, updaterec : Messenger.Scene.Scene.GlobalComponentUpdateRec userdata scenemsg data, view : Messenger.Scene.Scene.GlobalComponentView userdata scenemsg data, id : Messenger.Scene.Scene.GCTarget }"},{"name":"GCBaseData","comment":" Global component base data.\n","args":[],"type":"{ dead : Basics.Bool, postProcessor : REGL.Common.Renderable -> REGL.Common.Renderable }"},{"name":"GCCommonData","comment":" Global component common data.\n","args":["userdata","scenemsg"],"type":"Messenger.Scene.Scene.MAbstractScene userdata scenemsg"},{"name":"GCMsg","comment":" Global component message type.\n","args":[],"type":"Json.Decode.Value"},{"name":"GCTarget","comment":" Global component target type.\n","args":[],"type":"String.String"},{"name":"GlobalComponentInit","comment":" init type sugar\n","args":["userdata","scenemsg","data"],"type":"Messenger.Base.Env (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata -> Messenger.Scene.Scene.GCMsg -> ( data, Messenger.Scene.Scene.GCBaseData )"},{"name":"GlobalComponentStorage","comment":" GlobalComponent Storage\n","args":["userdata","scenemsg"],"type":"Messenger.Base.Env (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata -> Messenger.Scene.Scene.AbstractGlobalComponent userdata scenemsg"},{"name":"GlobalComponentUpdate","comment":" update type sugar.\nIn a layered scene, the job is done by Messenger, so you don't have to write this. However, in a raw scene, the logic is up to you to decide, so you are supposed to imply this.\n","args":["userdata","scenemsg","data"],"type":"Messenger.Base.Env (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata -> Messenger.Base.UserEvent -> data -> Messenger.Scene.Scene.GCBaseData -> ( ( data, Messenger.Scene.Scene.GCBaseData ), List.List (Messenger.Scene.Scene.MMsg Messenger.Scene.Scene.GCTarget Messenger.Scene.Scene.GCMsg scenemsg userdata), ( Messenger.Base.Env (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata, Basics.Bool ) )"},{"name":"GlobalComponentUpdateRec","comment":" updaterec type sugar\n","args":["userdata","scenemsg","data"],"type":"Messenger.Base.Env (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata -> Messenger.Scene.Scene.GCMsg -> data -> Messenger.Scene.Scene.GCBaseData -> ( ( data, Messenger.Scene.Scene.GCBaseData ), List.List (Messenger.Scene.Scene.MMsg Messenger.Scene.Scene.GCTarget Messenger.Scene.Scene.GCMsg scenemsg userdata), Messenger.Base.Env (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata )"},{"name":"GlobalComponentView","comment":" view type sugar\n","args":["userdata","scenemsg","data"],"type":"Messenger.Base.Env (Messenger.Scene.Scene.GCCommonData userdata scenemsg) userdata -> data -> Messenger.Scene.Scene.GCBaseData -> REGL.Common.Renderable"},{"name":"MAbstractGeneralModel","comment":" Specialized Abstract Model for Messenger\n","args":["common","userdata","tar","msg","bdata","scenemsg"],"type":"Messenger.GeneralModel.AbstractGeneralModel (Messenger.Base.Env common userdata) Messenger.Base.UserEvent tar msg REGL.Common.Renderable bdata (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata)"},{"name":"MAbstractScene","comment":" Specialized Abstract scene for Messenger\nNote: MAbstractScene concretes the abstract general model with Event type and renderable type that is static regardless of what userdata, data, basedata or commondata is..\n","args":["userdata","scenemsg"],"type":"Messenger.Scene.Scene.AbstractScene (Messenger.Base.Env () userdata) Messenger.Base.UserEvent REGL.Common.Renderable scenemsg userdata"},{"name":"MConcreteGeneralModel","comment":" Specialized Concrete Model for Messenger\n","args":["data","common","userdata","tar","msg","bdata","scenemsg"],"type":"Messenger.GeneralModel.ConcreteGeneralModel data (Messenger.Base.Env common userdata) Messenger.Base.UserEvent tar msg REGL.Common.Renderable bdata (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata)"},{"name":"MConcreteScene","comment":" Specialized Concrete scene for Messenger\n\n  - Note: MConcreteScene concretes the concrete general model with Event type and renderable type that is static regardless of what userdata, data, basedata or commondata is..\n\n","args":["data","userdata","scenemsg"],"type":"Messenger.Scene.Scene.ConcreteScene data (Messenger.Base.Env () userdata) Messenger.Base.UserEvent REGL.Common.Renderable scenemsg userdata"},{"name":"MMsg","comment":" Messenger Msg\n\n  - Note: This is similar to MMsg, by using which messenger can know what is SOMMsg and make reaction to it accordingly.\n\n","args":["othertar","msg","scenemsg","userdata"],"type":"Messenger.GeneralModel.Msg othertar msg (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata)"},{"name":"MMsgBase","comment":" Messenger MsgBase\nThis message base make concrete MMsg type from abstract Msg type. By using MMsgBase, messenger can know what is SOMMsg and make reaction to it accordingly.\nUsers should use Msg at most of the time.\n","args":["othermsg","scenemsg","userdata"],"type":"Messenger.GeneralModel.MsgBase othermsg (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata)"},{"name":"SceneStorage","comment":" The type used to store the scene data.\nYou should not handle this by yourself.\n","args":["userdata","scenemsg"],"type":"Maybe.Maybe scenemsg -> Messenger.Base.Env () userdata -> Messenger.Scene.Scene.MAbstractScene userdata scenemsg"}],"values":[{"name":"abstract","comment":" Abstract a concrete scene to an abstract scene.\n\nInitialize it with env and msg.\n\n","type":"Messenger.Scene.Scene.ConcreteScene data env event ren scenemsg userdata -> Maybe.Maybe scenemsg -> env -> Messenger.Scene.Scene.AbstractScene env event ren scenemsg userdata"},{"name":"unroll","comment":" Unroll a rolled abstract scene.\n","type":"Messenger.Scene.Scene.AbstractScene env event ren scenemsg userdata -> Messenger.Scene.Scene.UnrolledAbstractScene env event ren scenemsg userdata"},{"name":"updateResultRemap","comment":" Change the `update` function to remap the result and return the changed abstract scene.\n","type":"(( List.List (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata), env ) -> ( List.List (Messenger.Scene.Scene.SceneOutputMsg scenemsg userdata), env )) -> Messenger.Scene.Scene.AbstractScene env event ren scenemsg userdata -> Messenger.Scene.Scene.AbstractScene env event ren scenemsg userdata"}],"binops":[]},{"name":"Messenger.UI","comment":"\n\n\n# User Interface\n\nTop-level user interface to the Messenger engine.\n\n@docs Output\n@docs genMain\n\n","unions":[],"aliases":[{"name":"Output","comment":" The output of the Messenger UI.\n","args":["userdata","scenemsg"],"type":"Platform.Program Messenger.Base.Flags (Audio.Model Messenger.Base.WorldEvent (Messenger.Model.Model userdata scenemsg)) (Audio.Msg Messenger.Base.WorldEvent)"}],"values":[{"name":"genMain","comment":" Generate the main program (output) from input.\n\n**Use this for your main function**\n\n","type":"Messenger.UI.Input.Input userdata scenemsg -> Messenger.UI.Output userdata scenemsg"}],"binops":[]},{"name":"Messenger.UI.Input","comment":"\n\n\n# Input to the Messenger UI\n\n@docs Input\n\n","unions":[],"aliases":[{"name":"Input","comment":" The input to the Messenger UI.\n","args":["userdata","scenemsg"],"type":"{ config : Messenger.UserConfig.UserConfig userdata scenemsg, resources : Messenger.Resources.Base.ResourceDefs, scenes : Messenger.Scene.Scene.AllScenes userdata scenemsg, globalComponents : List.List (Messenger.Scene.Scene.GlobalComponentStorage userdata scenemsg) }"}],"values":[],"binops":[]},{"name":"Messenger.UserConfig","comment":"\n\n\n# User Configuration\n\n@docs UserConfig, PortDefs\n@docs EnabledBuiltinProgram\n\n","unions":[{"name":"EnabledBuiltinProgram","comment":" Enabled Builtin Program\n\n  - `NoBuiltinProgram` represents enabling no builtin program\n  - `CustomBuiltinProgramList` represents enabling a list of custom builtin programs\n  - `TextOnlyBuiltinProgram` represents enabling the builtin program for text only\n  - `BasicShapesBuiltinProgram` represents enabling the builtin programs for basic shapes\n  - `CommonBuiltinProgram` represents enabling the builtin programs for common shapes\n  - `AllBuiltinProgram` represents enabling all builtin programs (Recommended)\n\n","args":[],"cases":[["NoBuiltinProgram",[]],["CustomBuiltinProgramList",["List.List String.String"]],["TextOnlyBuiltinProgram",[]],["BasicShapesBuiltinProgram",[]],["AllBuiltinProgram",[]]]}],"aliases":[{"name":"PortDefs","comment":" The ports that the user must provide to the messenger.\n\n**Learn more about ports [here](https://guide.elm-lang.org/interop/ports)**\n\n","args":[],"type":"{ sendInfo : String.String -> Platform.Cmd.Cmd Messenger.Base.WorldEvent, audioPortToJS : Json.Encode.Value -> Platform.Cmd.Cmd (Audio.Msg Messenger.Base.WorldEvent), audioPortFromJS : (Json.Decode.Value -> Audio.Msg Messenger.Base.WorldEvent) -> Platform.Sub.Sub (Audio.Msg Messenger.Base.WorldEvent), alert : String.String -> Platform.Cmd.Cmd Messenger.Base.WorldEvent, prompt : { name : String.String, title : String.String } -> Platform.Cmd.Cmd Messenger.Base.WorldEvent, promptReceiver : ({ name : String.String, result : String.String } -> Messenger.Base.WorldEvent) -> Platform.Sub.Sub Messenger.Base.WorldEvent, reglupdate : (Basics.Float -> Messenger.Base.WorldEvent) -> Platform.Sub.Sub Messenger.Base.WorldEvent, setView : Json.Encode.Value -> Platform.Cmd.Cmd Messenger.Base.WorldEvent, execREGLCmd : Json.Encode.Value -> Platform.Cmd.Cmd Messenger.Base.WorldEvent, recvREGLCmd : (Json.Encode.Value -> Messenger.Base.WorldEvent) -> Platform.Sub.Sub Messenger.Base.WorldEvent }"},{"name":"UserConfig","comment":" User Configuration for the messenger.\n\n`userdata` is a custom type which can store any data in the game.\nusers can **save their own global data** and **implement local storage** here.\n\n`scenemsg` is another custom type which represents the message type users wants\nto send to a scene when switching scenes.\n\n  - `initScene` represents the scene users get start\n  - `initSceneMsg` represents the message to initialize the start scene\n  - `globalDataCodec` is for local storage, users can encode the any data in global data\n    and user data to storage them, and decode them when reopen the game.\n    This globalData is a subset of the real global data, removing all internal data structures\n  - `virtualSize` represents how users want their game be virtual sized. In other words,\n    users make their game in the virtual size, and the game will be resized due to the browser window size\n    but keeping the aspect ratio\n  - `debug` option determines whether enable some simple debugging tools or not\n    remember to disable it when releasing game\n  - `background` determines the background of the game\n    transparent background and colored background is already prepared\n  - `timeInterval` See `TimeInterval`\n  - `ports` stores the ports that users must provide.\n\n","args":["userdata","scenemsg"],"type":"{ initScene : String.String, initSceneMsg : Maybe.Maybe scenemsg, globalDataCodec : { encode : Messenger.Base.UserViewGlobalData userdata -> String.String, decode : String.String -> Messenger.Base.UserViewGlobalData userdata }, virtualSize : { width : Basics.Float, height : Basics.Float }, debug : Basics.Bool, timeInterval : REGL.TimeInterval, ports : Messenger.UserConfig.PortDefs, enabledProgram : Messenger.UserConfig.EnabledBuiltinProgram, fboNum : Basics.Int }"}],"values":[],"binops":[]}]