linsyking/messenger-core/12.1.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.

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/elm-messenger/messenger-core.

What we checked: The repo moved to github.com/elm-messenger/messenger-core. Rebuilt with git archive from commit a3e8f98eb35e of https://github.com/elm-messenger/messenger-core (zip prefix linsyking-messenger-core-f27cb21/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 495bf88e40bb3574a0d956668b488cc6a86890f3.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/linsyking/messenger-core/zipball/12.1.0/

Messenger.UserConfig

User Configuration

= Fixed Float
| Animation

Time interval between every two frames.

  • Fixed represents the fixed time interval between every two frames. The value is the time interval in milliseconds.
  • Animation will use the browser's requestAnimationFrame to update the game. The frame rate will be dependent on your device. This will make the animation looks smoother.
type alias UserConfig userdata scenemsg =
{ initScene : String
, initSceneMsg : Maybe scenemsg
, globalDataCodec :
{ encode : UserViewGlobalData userdata -> String
, decode : String -> UserViewGlobalData userdata
}
, virtualSize :
{ width : Float
, height : Float
}
, debug : Bool
, background : GlobalData userdata -> Renderable
, timeInterval : TimeInterval
, ports : PortDefs
}

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 can encode the any data in global data and user data to storage them, and decode them when reopen the game. This globalData is a subset of the real global data, removing all internal data structures
  • 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
}

The ports that the user must provide to the messenger.

Learn more about ports here

coloredBackground : Color -> GlobalData userdata -> Renderable

A colored background.

transparentBackground : GlobalData userdata -> Renderable

A transparent background. You should use this for release.

type alias Resources =
{ allTexture : Dict String String
, allAudio : Dict String String
, allSpriteSheets : SpriteSheet
}

Resources

  • allTexture stores all the texture assets users will use in the game. The path is based on the project folder. format: Dict name path
  • allSpriteSheets stores all the sprite sheets users set for this game. users should both name the sprite sheets and every single sprite. Using it by format: "sheet_name.sprite_name" Sprite sheets are useful when managing the art recourses or making frame-by-frame animations
  • allAudio stores all the audio assets users will use in the game. format: Dict name path
resourceNum : Resources -> Int

The number of sprites in the game.