Beispiel #1
0
bool GSMain::OnKeyEvent(const KeyEvent& ke)
{
#ifdef _DEBUG
  if (ke.keyDown && ke.keyType == AMJU_KEY_CHAR && 
    (ke.key == 'a' || ke.key == 'A'))
  {
    s_showAABBs = !s_showAABBs;
    std::cout << "Show AABBs: " << s_showAABBs << "\n";
    SceneNode::SetGlobalShowAABB(s_showAABBs);
  }
#endif

/*
  if (ke.keyDown && ke.keyType == AMJU_KEY_CHAR && 
    (ke.key == 'd' || ke.key == 'D'))
  {
    TheResourceManager::Instance()->Dump();
    return true;
  }
*/

  if (ke.keyType == AMJU_KEY_CHAR && 
      (ke.key == 'r' || ke.key == 'R'))
  {
    // Reset - may need to go back to load state
    TheGame::Instance()->SetCurrentState(TheGSLoadLevel::Instance());
    return true;
  }

#ifdef EDIT_CAM
  // Switch to debug camera
  if (ke.keyType == AMJU_KEY_CHAR && (ke.key == 'c' || ke.key == 'C'))
  {
    GetGameSceneGraph()->SetCamera(new EditModeCamera(AMJU_EDITCAM_PERSP));
  }
#endif

#ifdef _DEBUG
  if (ke.keyDown && ke.keyType == AMJU_KEY_CHAR && 
      (ke.key == 's' || ke.key == 'S'))
  {
    // S = toggle scrolling
    static float ss = GetScrollSpeed(); 
    if (GetScrollSpeed() < 1)
    {
      std::cout << "Setting scroll speed to " << ss << "\n";
      SetScrollSpeed(ss);
    }
    else 
    {
      std::cout << "Setting scroll speed to zero.\n";
      ss = GetScrollSpeed();
      SetScrollSpeed(0);
    }
  }
#endif
  
  return false;
}
	VerticalScrollingLayer::VerticalScrollingLayer(const char* imageFileName, float scrollSpeed, float translucency, float x, float y)
	{
		SetPosition(x, y);
		SetScrollSpeed(scrollSpeed);
		SetTranslucency(translucency);
		SetImage(imageFileName);
	}
	VerticalScrollingLayer::VerticalScrollingLayer(ImageResource* image, float scrollSpeed, float translucency, float x, float y)
	{
		SetPosition(x, y);
		SetScrollSpeed(scrollSpeed);
		SetTranslucency(translucency);
		SetImage(image);
	}