Skip to content
This repository

Darcy Menu

For the impact HTML5 game engine http://impactjs.com fast link to source https://github.com/TigerJ/DarcyMenu/blob/master/lib/plugins/darcy.js What is it?

Darcy Menu is a WIP plugin for impact js that will create and draw menu instances for you. The goal is to reduce the amount of programming required to establish a user interface for games created in Dominic Szablewski's impact HTML5 game framework.

**demo ** http://devbriggs.com/experiment/demo.html

How will it work?

after referencing the plugin you will be able to create a DarcyMenu class with new ig.Darcy() and add items with the .addItem() method for your Darcy class. The properties of the Darcy class will assist in automating most of the code needed to draw your menu instance in canvas or using impact entities.

What currently working?

Currently menu items added to a darcy class are being drawn with canvas standards and their events are properly being mapped to their location.

Darcy Methods

.addItem(menutext, menulabel, inputAction, inputEvent)

creates a DarcyItem class instance and binds properties of the parent menu in addition to the parameters specified. the action is a matching ig.input action already bound with ig.input.bind see http://impactjs.com/documentation/class-reference/input#bind

the inputEvent is a function() you specifiy which will be called when the action occurs inside the boundry of your menu item

example call:

this.mydarcy.addItem("voilett","dog","shoot", function(){console.log("german shepard dog");}); creates a menu button in the menu mydarcy with the menu text violett, the label dog, listens for shoot inside it's boundry on the stage when shoot occurs it writes to the console log

.update()

Add this in the game's update method to update all menu items

.draw()

Add this in the game's draw method to draw all menu items

.rebuildMenu()

Use this to have the MenuItems recalculated for the plugin instance. This currently is only recalculating size and position values but will eventually rebuild the entire array of buttons.

Something went wrong with that request. Please try again.