gloss-1.13.2.1: Painless 2D vector graphics, animations and simulations.

Safe Haskell | None
Language | Haskell2010

Graphics.Gloss.Data.ViewState

Synopsis

- data Command
  - = CRestore
  - | CTranslate
  - | CRotate
  - | CScale
  - | CBumpZoomOut
  - | CBumpZoomIn
  - | CBumpLeft
  - | CBumpRight
  - | CBumpUp
  - | CBumpDown
  - | CBumpClockwise
  - | CBumpCClockwise
- type CommandConfig = [(Command, [(Key, Maybe Modifiers)])]
- defaultCommandConfig :: CommandConfig
- data ViewState = ViewState {
  - viewStateCommands :: !(Map Command [(Key, Maybe Modifiers)])
  - viewStateScaleStep :: !Float
  - viewStateRotateFactor :: !Float
  - viewStateScaleFactor :: !Float
  - viewStateTranslateMark :: !(Maybe (Float, Float))
  - viewStateRotateMark :: !(Maybe (Float, Float))
  - viewStateScaleMark :: !(Maybe (Float, Float))
  - viewStateViewPort :: ViewPort
  }
- viewStateInit :: ViewState
- viewStateInitWithConfig :: CommandConfig -> ViewState
- updateViewStateWithEvent :: Event -> ViewState -> ViewState
- updateViewStateWithEventMaybe :: Event -> ViewState -> Maybe ViewState

# Documentation

data Command #

The commands suported by the view controller.

Constructors

CRestore |
CTranslate |
CRotate |
CScale |
CBumpZoomOut |
CBumpZoomIn |
CBumpLeft |
CBumpRight |
CBumpUp |
CBumpDown |
CBumpClockwise |
CBumpCClockwise |

#### Instances

Instances details

Eq Command # |
Instance details Defined in Graphics.Gloss.Data.ViewState Methods (==) :: Command -> Command -> Bool # (/=) :: Command -> Command -> Bool #
Ord Command # |
Instance details Defined in Graphics.Gloss.Data.ViewState Methods compare :: Command -> Command -> Ordering # (<) :: Command -> Command -> Bool # (<=) :: Command -> Command -> Bool # (>) :: Command -> Command -> Bool # (>=) :: Command -> Command -> Bool # max :: Command -> Command -> Command # min :: Command -> Command -> Command #
Show Command # |
Instance details Defined in Graphics.Gloss.Data.ViewState Methods showsPrec :: Int -> Command -> ShowS # show :: Command -> String # showList :: [Command] -> ShowS #

type CommandConfig = [(Command, [(Key, Maybe Modifiers)])] #

defaultCommandConfig :: CommandConfig #

The default commands. Left click pans, wheel zooms, right click rotates, "r" key resets.

data ViewState #

State for controlling the viewport. These are used by the viewport control component.

Constructors

ViewState |
Fields viewStateCommands :: !(Map Command [(Key, Maybe Modifiers)]) The command list for the viewport controller. These can be safely overwridden at any time by deleting or adding entries to the list. Entries at the front of the list take precedence. viewStateScaleStep :: !Float How much to scale the world by for each step of the mouse wheel. viewStateRotateFactor :: !Float How many degrees to rotate the world by for each pixel of x motion. viewStateScaleFactor :: !Float Ratio to scale the world by for each pixel of y motion. viewStateTranslateMark :: !(Maybe (Float, Float)) During viewport translation, where the mouse was clicked on the window to start the translate. viewStateRotateMark :: !(Maybe (Float, Float)) During viewport rotation, where the mouse was clicked on the window to starte the rotate. viewStateScaleMark :: !(Maybe (Float, Float)) During viewport scale, where the mouse was clicked on the window to start the scale. viewStateViewPort :: ViewPort The current viewport.

viewStateInit :: ViewState #

The initial view state.

viewStateInitWithConfig :: CommandConfig -> ViewState #

Initial view state, with user defined config.

updateViewStateWithEvent :: Event -> ViewState -> ViewState #

Apply an event to a `ViewState`.

updateViewStateWithEventMaybe :: Event -> ViewState -> Maybe ViewState #

Like `updateViewStateWithEvent`, but returns `Nothing` if no update was needed.