Пример #1
0
	CTetrisBrick* CreateOBrick(CTetris* tetris)
	{
		assert(tetris != nullptr);
		auto brick = new CTetrisBrick(tetris, 3, 3, 1);

		brick->ModifyRotation(0, 0, 0, 5);
		brick->ModifyRotation(0, 0, 1, 5);
		brick->ModifyRotation(0, 1, 0, 5);
		brick->ModifyRotation(0, 1, 1, 5);


		brick->SetCurRotation(0);
		return brick;
	}
Пример #2
0
	CTetrisBrick* CreateTBrick(CTetris* tetris)
	{
		assert(tetris != nullptr);
		auto brick = new CTetrisBrick(tetris, 3, 3, 4);

		brick->ModifyRotation(0, 1, 0, 6);
		brick->ModifyRotation(0, 1, 1, 6);
		brick->ModifyRotation(0, 1, 2, 6);
		brick->ModifyRotation(0, 2, 1, 6);

		brick->ModifyRotation(1, 0, 1, 6);
		brick->ModifyRotation(1, 1, 1, 6);
		brick->ModifyRotation(1, 2, 1, 6);
		brick->ModifyRotation(1, 1, 0, 6);

		brick->ModifyRotation(2, 1, 1, 6);
		brick->ModifyRotation(2, 2, 0, 6);
		brick->ModifyRotation(2, 2, 1, 6);
		brick->ModifyRotation(2, 2, 2, 6);

		brick->ModifyRotation(3, 0, 1, 6);
		brick->ModifyRotation(3, 1, 1, 6);
		brick->ModifyRotation(3, 2, 1, 6);
		brick->ModifyRotation(3, 1, 2, 6);


		brick->SetCurRotation(0);
		return brick;
	}
Пример #3
0
	CTetrisBrick* CreateIBrick(CTetris* tetris)
	{
		assert(tetris != nullptr);
		auto brick = new CTetrisBrick(tetris, 4, 4, 2);

		brick->ModifyRotation(0, 1, 0, 7);
		brick->ModifyRotation(0, 1, 1, 7);
		brick->ModifyRotation(0, 1, 2, 7);
		brick->ModifyRotation(0, 1, 3, 7);

		brick->ModifyRotation(1, 0, 2, 7);
		brick->ModifyRotation(1, 1, 2, 7);
		brick->ModifyRotation(1, 2, 2, 7);
		brick->ModifyRotation(1, 3, 2, 7);

		brick->SetCurRotation(0);
		brick->CanKick(false);
		return brick;
	}
Пример #4
0
  // Execute with the specified argument list and return value.  Return true if
  // the method was handled.
  virtual bool Execute(const CefString& name,
                       CefRefPtr<CefV8Value> object,
                       const CefV8ValueList& arguments,
                       CefRefPtr<CefV8Value>& retval,
                       CefString& exception)
  {
    if(name == "modifyRotation") {
      // This function requires one argument.
      if(arguments.size() != 1)
        return false;

      float increment = 0.;
      if(arguments[0]->IsInt()) {
        // The argument is an integer value.
        increment = static_cast<float>(arguments[0]->GetIntValue());
      } else if(arguments[0]->IsDouble()) {
        // The argument is an double value.
        increment = static_cast<float>(arguments[0]->GetDoubleValue());
      }

      if(increment != 0.) {
        // Modify the rotation accordingly.
        ModifyRotation(increment);
        return true;
      }
    } else if(name == "resetRotation") {
      // Reset the rotation value.
      ResetRotation();
      return true;
    } else if(name == "viewSource") {
      // View the page source.
      AppGetBrowser()->GetMainFrame()->ViewSource();
      return true;
    }

    return false;
  }