Game Development Reference
In-Depth Information
13
Low Coupling Command System
Gustavo A. Carrazoni
13.1 Introduction
Applications developed for the daily work of artists and game designers have a
rich user interface and usability that is designed to increase the performance of the
development team. In this chapter, we propose a versatile and flexible command
system to manage the user input that is suitable for monolithic applications and
open and extensible systems.
13.2 The Most Basic Command
An example generally used to justify the necessity of a command system is the user
interface as it consists of several elements, such as buttons and menus, with logic
that does not really need to know the details of the operations it executes; it just
needs to know which operation to execute.
Thus, the operation details are bundled into objects called commands (each
command is a class that performs a specific operation), and our user interface is
com m and
Application
UIItem
Command
Activated()
Execute()
Init()
...
item = new UIItem();
command = new SpecificCommand();
item->SetCommand(command);
...
...
command->Execute()
...
SpecificCommand
Execute()
Figure 13.1. Command pattern.
193
 
 
Search WWH ::




Custom Search