Button Control


You have to:
  • Call the class "Button"
  • Implement "IControl"
    Prerequisites for the Sub "init":
  • Accept a custom Text
  • Accept 3 TextureIdentifiers as a String - A default one, one for hovering and one for mouse down - and use them at the given times, of course. You'll get the Textures out of the TextureManager which is in development. The instance will be placed in the Class "Global". The name of the instance will be "mnu_TextureManager". You can work with the vars. I'll gave you the class of the manager so that you can use all methods.
  • Accept 3 Text colors - A default one, one for hovering and one for mouse down - And again, they should be used.
  • Accept a custom position for the button
  • Accept a custom size for the button - if no size given, use the biggest Textures size
  • Detect whether all parameters are given
    Prerequisites for the Sub "Draw":
  • No calculations or as less as possible!
  • Drawing the current texture at the right position and the text in the right color at the middle of the button (You can cut Linefeeds and the characters which are too much - They have to fit into the size)
    Prerequisites for the Sub "Update":
  • Detect Mouse hovering and mouse down and send events - "stateChanged" on both and "Clicked" only on Mouse down
    Prerequisites for the sub "State(Parameter)":
  • Be able to return every important var. The "default" - key has to be associated with the Text. The other States can have custom keys.
    Prerequisites for the sub "State":
  • return the Text of the button
    Prerequisites of the property "this[string key]":
  • Use the same key definitions as in the "State" - sub
  • Be able to set the most "State"s over the same key
  • throw an error if the key is read only.
  • Call "State(Parameter)" for the "Get" part of the property
Closed Dec 29, 2010 at 10:58 AM by VisibleBasix