mdiehr / Spielmatrix

A tile-based game engine for prototyping abstract games.
3 stars 0 forks source link

Feature/render resize #18

Closed mdiehr closed 9 years ago

mdiehr commented 9 years ago

This feature adds four new options, which can be set by adding attributes to the game's div tag in the html.

sm-width-max

Sets the maximum width of the drawing area, in pixels. Overrides the "renderWidthMax" option. Defaults to 480.

sm-width-max="480"

sm-width-min

Sets the minimum width of the drawing area, in pixels. Overrides the "renderWidthMin" option. Defaults to 240.

sm-width-min="240"

sm-pixel-perfect

Changes the behavior of how the rendering area is allowed to resize. Overrides the "pixelPerfect" option. If true, the tiles are forced to render at an integer multiple of their base size (8px). If false, the tiles can be any integer size. Defaults to true.

sm-pixel-perfect="true"

sm-resize-canvas

If set to true, the canvas is allowed to dynamically resize. Otherwise, it is set to the renderWidthMax initially, and does not change. Overrides the "resizeCanvas" option. Defaults to true.

sm-resize-canvas="true"

Complete div example

<div id="test" sm-width-max="1024" sm-width-min="320" sm-pixel-perfect="true" sm-resize-canvas="true"></div>