linsyking/messenger-core/19.0.0

NOTE: the latest version is 20.0.0

Renamed to elm-messenger/messenger-core. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as linsyking/messenger-core still install under that name. 34 versions of 52 come from the new location (see their notes). 7 versions could not be recovered and cannot be installed.

Messenger.UserConfig

User Configuration

type alias UserConfig userdata scenemsg =
{ initScene : String
, initSceneMsg : Maybe scenemsg
, globalDataCodec :
{ encode : GlobalData userdata -> String
, decode : String -> GlobalDataInit userdata
}
, virtualSize :
{ width : Float
, height : Float
}
, debug : Bool
, timeInterval : TimeInterval
, ports : PortDefs
, enabledProgram : EnabledBuiltinProgram
, fboNum : Int
}

User Configuration for the messenger.

userdata is a custom type which can store any data in the game. users can save their own global data and implement local storage here.

scenemsg is another custom type which represents the message type users wants to send to a scene when switching scenes.

  • initScene represents the scene users get start
  • initSceneMsg represents the message to initialize the start scene
  • globalDataCodec is for local storage. Users decode saved data into initial global data, and encode the current global data when saving.
  • virtualSize represents how users want their game be virtual sized. In other words, users make their game in the virtual size, and the game will be resized due to the browser window size but keeping the aspect ratio
  • debug option determines whether enable some simple debugging tools or not remember to disable it when releasing game
  • background determines the background of the game transparent background and colored background is already prepared
  • timeInterval See TimeInterval
  • ports stores the ports that users must provide.
type alias PortDefs =
{ sendInfo : String -> Cmd WorldEvent
, audioPortToJS : Value -> Cmd (Msg WorldEvent)
, audioPortFromJS : (Value -> Msg WorldEvent) -> Sub (Msg WorldEvent)
, alert : String -> Cmd WorldEvent
, prompt :
{ name : String
, title : String
}
-> Cmd WorldEvent
, promptReceiver :
( { name : String
, result : String
}
)
-> Sub WorldEvent
, reglupdate : (Float -> WorldEvent) -> Sub WorldEvent
, setView : Value -> Cmd WorldEvent
, execREGLCmd : Value -> Cmd WorldEvent
, recvREGLCmd : (Value -> WorldEvent) -> Sub WorldEvent
, loadDataFile :
{ name : String
, path : String
}
-> Cmd WorldEvent
, dataFileLoaded :
( { name : String
, data : String
}
)
-> Sub WorldEvent
}

The ports that the user must provide to the messenger.

Learn more about ports here

= NoBuiltinProgram
| CustomBuiltinProgramList (List String)
| TextOnlyBuiltinProgram
| BasicShapesBuiltinProgram
| AllBuiltinProgram

Enabled Builtin Program

  • NoBuiltinProgram represents enabling no builtin program
  • CustomBuiltinProgramList represents enabling a list of custom builtin programs
  • TextOnlyBuiltinProgram represents enabling the builtin program for text only
  • BasicShapesBuiltinProgram represents enabling the builtin programs for basic shapes
  • CommonBuiltinProgram represents enabling the builtin programs for common shapes
  • AllBuiltinProgram represents enabling all builtin programs (Recommended)