/// Overloaded. Updates the Displable component based on recent changes. virtual void update(XInfo* xinfo, GameTime* gameTime) { // retrieves the state monitor devices for both the keyboard and mouse KeyboardState* keyboard = xinfo->getKeyboardState(); MouseState* mouse = xinfo->getMouseState(); // series of actions based on the keyboard actions if(keyboard->isKeyDown(KEY_SPACE)) { // creates a new text component with the string "SPACEBAR" and specified color // this is created at a location relative to the current mouse position Text* spaceText = new Text(mouse->getX() - 50, mouse->getY() - 2, "SPACEBAR", color); polyLine->add_point(mouse->getX(), mouse->getY()); addComponent(spaceText); } // changes the color if the left arrow key is pressed if(keyboard->isKeyDown(KEY_LEFT)) { xinfo->setColor(polyLine->getLineContext(), ColorConstants::COLOR_GREEN); } // changes the color if the right arrow key is pressed if(keyboard->isKeyDown(KEY_RIGHT)) { xinfo->setColor(polyLine->getLineContext(), ColorConstants::COLOR_RED); } }