I really have no idea how to ask this question, but I’ll try anyway.
A project I’m helping out with requires multiple tools (like the various types of pen and brush tools in most paint programs).
The tools are things like
>Create wall tool
>Create room tool
>Resize tool
>Move tool
>Delete tool
>Pan tool
etc.
I have no idea how to code this, though.
Something like this would be REALLY inefficient, cluttered, and difficult to add tools to:
//This function is run every time the mouse is down (duh)
function onMouseDown(ev:MouseEvent)
{
select case (currentTool)
{
case wallTool :
...
case roomTool :
...
case moveTool :
...
// etc.
}
}
//Same for the following functions
function onMouseUp() { ... }
function onMouseMove() { ... }
And I want to make it easy to add new tools without hassle.
Any ideas?