示例#1
0
void cAiBlock::Collision(cObject* a_pOther)
{
   if (a_pOther->GetType() == GetType())
   {
      SitFlush(a_pOther);
      m_AiLabel.setPosition(
         static_cast<int32_t>(GetPosition().x + GetBoundingBox().width / 2 - m_AiLabel.getLocalBounds().width / 2),
         static_cast<int32_t>(GetPosition().y + GetBoundingBox().height / 2 - m_AiLabel.getCharacterSize() / 2.0 - 10)
         );
      SetVelocityY(0, kNormal);

      sMessage l_Message;
      l_Message.m_From = GetUniqueId();
      l_Message.m_Category =GetResources()->GetMessageDispatcher()->Any();
      l_Message.m_Key = GetResources()->GetMessageDispatcher()->Any();
      l_Message.m_Value = "Settled";
      GetResources()->GetMessageDispatcher()->PostMessage(l_Message);

      m_Falling = false;

      PlaySound("Media/Sounds/BigFall.ogg");


   }
}
示例#2
0
void nofBuildingWorker::TryToWork()
{
    // Wurde die Produktion eingestellt?
    if(workplace->IsProductionDisabled())
    {
        state = STATE_WAITINGFORWARES_OR_PRODUCTIONSTOPPED;
        // Nun arbeite ich nich mehr
        StartNotWorking();
    }
    // Falls man auf Waren wartet, kann man dann anfangen zu arbeiten
    // (bei Bergwerken müssen zusätzlich noch Rohstoffvorkommen vorhanden sein!)
    // (bei Brunnen muss ebenfalls auf Wasser geprüft werden!)
    // Spähturm-Erkunder arbeiten nie!
    // Charburner doesn't need wares for harvesting!
    // -> Wares are considered when calling GetPointQuality!
    else if( (workplace->WaresAvailable() || job == JOB_CHARBURNER) &&
             (job != JOB_MINER || GetResources(workplace->GetBuildingType() - BLD_GRANITEMINE)) &&
             (job != JOB_HELPER || GetResources(4)) &&
             job != JOB_SCOUT)
    {
        state = STATE_WAITING1;
        current_ev = em->AddEvent(this, (GetGOT() == GOT_NOF_CATAPULTMAN) ? CATAPULT_WAIT1_LENGTH : JOB_CONSTS[job].wait1_length, 1);
        StopNotWorking();

    }
    else
    {
        state = STATE_WAITINGFORWARES_OR_PRODUCTIONSTOPPED;
        // Nun arbeite ich nich mehr
        StartNotWorking();
    }
}
示例#3
0
cCreditsString::cCreditsString(cResources* a_pResources)
   : cObject(a_pResources),
     m_CreditText(),
     m_CreditText2(),
     m_ContinueString(),
     m_pSfmlLogo(NULL)
{
   SetType("CreditsString");
   SetSolid(false);
   SetCollidable(false);

   std::shared_ptr<sf::Font> l_Font
      = GetResources()->LoadFont("Media/junegull.ttf");

   // Set up the strings
   m_CreditText.setFont(*(l_Font.get()));
   m_CreditText.setString("A game by Corbin A.");
   m_CreditText.setCharacterSize(30);
   m_CreditText.setColor(sf::Color::Black);

   m_CreditText2.setFont(*(l_Font.get()));
   m_CreditText2.setString("Created with");
   m_CreditText2.setCharacterSize(30);
   m_CreditText2.setColor(sf::Color::Black);

   // Set up the continue message
   m_ContinueString.setFont(*(l_Font.get()));
   m_ContinueString.setCharacterSize(18);
   m_ContinueString.setColor(sf::Color::White);
   m_ContinueString.setString("Press any button to continue");

   m_pSfmlLogo = new cSfmlLogo(GetResources());

}
示例#4
0
void cCreditsString::Initialize()
{
   sf::Vector3<double> l_Position = GetPosition();
   l_Position.x += (GetBoundingBox().width/2) - m_CreditText.getLocalBounds().width / 2;
   l_Position.x = static_cast<int32_t>(l_Position.x);
   m_CreditText.setPosition(l_Position.x, l_Position.y);

   l_Position = GetPosition();
   l_Position.x += (GetBoundingBox().width/2) - m_CreditText2.getLocalBounds().width / 2;
   l_Position.x = static_cast<int32_t>(l_Position.x);
   l_Position.y +=
      m_CreditText.getLocalBounds().height
      + m_CreditText.getLocalBounds().top
      + 100;
   m_CreditText2.setPosition(l_Position.x, l_Position.y);

   l_Position.x = GetPosition().x;
   l_Position.x += (GetBoundingBox().width/2) - m_pSfmlLogo->GetBoundingBox().width / 2;
   l_Position.y +=
      m_CreditText2.getLocalBounds().height
      + m_CreditText2.getLocalBounds().top
      + 10;
   m_pSfmlLogo->SetPosition(l_Position, kNormal, false);
   m_pSfmlLogo->Initialize();

   // Set the position relative to the camera
   float l_X = GetResources()->GetWindow()->getSize().x - m_ContinueString.getLocalBounds().width - 10;
   float l_Y = GetResources()->GetWindow()->getSize().y - m_ContinueString.getCharacterSize() - 10;
   m_ContinueString.setPosition(l_X, l_Y);
}
示例#5
0
文件: Resources.c 项目: aosm/X11libs
XtCacheRef *_XtGetResources(
    register 	Widget	  	w,
    		ArgList	  	args,
    		Cardinal  	num_args,
		XtTypedArgList	typed_args,
		Cardinal*	num_typed_args)
{
    XrmName	    *names, names_s[50];
    XrmClass	    *classes, classes_s[50];
    XrmQuark	    quark_cache[100];
    XrmQuarkList    quark_args;
    WidgetClass     wc;
    ConstraintWidgetClass   cwc;
    XtCacheRef	    *cache_refs, *cache_refs_core;
    Cardinal	    count;

    wc = XtClass(w);

    count = CountTreeDepth(w);
    names = (XrmName*) XtStackAlloc (count * sizeof(XrmName), names_s);
    classes = (XrmClass*) XtStackAlloc (count * sizeof(XrmClass), classes_s);
    if (names == NULL || classes == NULL) _XtAllocError(NULL);

    /* Get names, classes for widget and ancestors */
    GetNamesAndClasses(w, names, classes);
   
    /* Compile arg list into quarks */
    CacheArgs(args, num_args, typed_args, *num_typed_args, quark_cache,
	      XtNumber(quark_cache), &quark_args);

    /* Get normal resources */
    LOCK_PROCESS;
    cache_refs = GetResources(w, (char*)w, names, classes,
	(XrmResourceList *) wc->core_class.resources,
	wc->core_class.num_resources, quark_args, args, num_args,
	typed_args, num_typed_args, XtIsWidget(w));

    if (w->core.constraints != NULL) {
	cwc = (ConstraintWidgetClass) XtClass(w->core.parent);
	cache_refs_core =
	    GetResources(w, (char*)w->core.constraints, names, classes,
	    (XrmResourceList *) cwc->constraint_class.resources,
	    cwc->constraint_class.num_resources,
	    quark_args, args, num_args, typed_args, num_typed_args, False);
	if (cache_refs_core) {
	    XtFree((char *)cache_refs_core);
	}
    }
    FreeCache(quark_cache, quark_args);
    UNLOCK_PROCESS;
    XtStackFree((XtPointer)names, names_s);
    XtStackFree((XtPointer)classes, classes_s);
    return cache_refs;
} /* _XtGetResources */
UINT CXTPCalendarViewGroup::GetScheduleID()
{
	UINT uScheduleID = XTP_CALENDAR_UNKNOWN_SCHEDULE_ID;
	if (XTP_SAFE_GET1(GetResources(), GetCount(), 0) &&
		XTP_SAFE_GET3(GetResources(), GetAt(0), GetSchedules(), GetSize(), 0) )
	{
		uScheduleID = XTP_SAFE_GET3(GetResources(), GetAt(0), GetSchedules(),
									GetAt(0), 0);
	}

	return uScheduleID;
}
示例#7
0
void PolylinesRenderer::InitializeGL() {
  StockResources stock(GetResources());

  geom_ = GetResources()->MakeGeometry();
  material_ = stock.NewMaterial(StockResources::kPerVertexColorNoLighting);

  // Draw fat thick lines.
  material_->SetLineWidth(10.0f);

  draw_node_ = GetScene()->MakeDrawNode(GetBaseNode(), geom_, material_);

  UpdateGeometry();
}
示例#8
0
文件: myOS.cpp 项目: live-clones/gmsh
long GetMemoryUsage()
{
  long mem = 0;
  double s = 0.;
  GetResources(&s, &mem);
  return mem;
}
示例#9
0
文件: myOS.cpp 项目: live-clones/gmsh
double Cpu()
{
  long mem = 0;
  double s = 0.;
  GetResources(&s, &mem);
  return s;
}
示例#10
0
void cButton::Event(std::list<sf::Event> * a_pEventList)
{
   for (std::list<sf::Event>::iterator i = a_pEventList->begin();
      i != a_pEventList->end();
      ++i
      )
   {
      if (i->type == sf::Event::MouseButtonPressed)
      {
         // See if the mouse press was on us
         sf::Rect<int32_t> l_PositionBox = GetBoundingBox();
         l_PositionBox.left += GetPosition().x;
         l_PositionBox.top += GetPosition().y;

         if (l_PositionBox.contains(i->mouseButton.x, i->mouseButton.y))
         {
            PlayAnimationLoop(m_SpritePressedImage.second);
            PlaySound("Media/Sounds/Click1.ogg");
            sMessage l_Message;
            l_Message.m_From = GetUniqueId();
            l_Message.m_Category = "Widget";
            l_Message.m_Key = "Button";
            l_Message.m_Value = "Pressed";
            GetResources()->GetMessageDispatcher()->PostMessage(l_Message);
         }
      }
      else if (i->type == sf::Event::MouseButtonReleased)
      {
         PlayAnimationLoop(m_SpriteImage.second);
      }
   }
}
示例#11
0
void cButton::Draw(const sf::Vector2<float> & a_rkInterpolationOffset)
{
   sf::Vector2<float> l_OldPosition = m_Label.getPosition();
   m_Label.setPosition(l_OldPosition + a_rkInterpolationOffset);
   GetResources()->GetWindow()->draw(m_Label);
   m_Label.setPosition(l_OldPosition);
}
示例#12
0
void ModelRenderer::LoadModelGL() {
  Scene::Ptr scene = GetScene();

  // Clear out any previously loaded model.
  ClearModel();

  // Load the model as a scene graph resource.
  Scene::Ptr model = AssetImporter::ImportFile(GetResources(), model_fname_);

  if (!model) {
    return;
  }

  // Create a node in the main scene graph.
  node_ = scene->MakeGroup(GetBaseNode());

  // Instantiate the model as a child of the newly created node.
  scene->MakeGroupFromScene(node_, model);

  // Scale and translate the model so that it fits inside a unit cube
  // centered at the origin.
  const AxisAlignedBox& box = model->Root()->WorldBoundingBox();
  const QVector3D span = box.Max() - box.Min();
  const float max_span = std::max(std::max(span.x(), span.y()), span.z());
  const double scale_factor = 1.0 / max_span;
  node_->SetScale(QVector3D(scale_factor, scale_factor, scale_factor));
  node_->SetTranslation(-0.5 * scale_factor * (box.Max() + box.Min()));

  GetViewport()->ScheduleRedraw();
}
示例#13
0
/* Open a graphics device with file node. */
HDEVICE OpenDeviceFromFD(int fd)
{
	struct drm_version version = { 0 };
	if (ioctl(fd, DRM_IOCTL_VERSION, &version)) {
		return NULL;
	}

	struct stat data;
	data.st_rdev = 0;
	if (fstat(fd, &data)) {
	}

	struct drm_auth auth;
	if (ioctl(fd, DRM_IOCTL_GET_MAGIC, &auth)) {
		return NULL;
	}

	struct IDevice *device = NULL;
	if (!(device = (struct IDevice*)calloc(1, sizeof(struct IDevice)))) {
		return NULL;
	}

	device->fd = fd;
	device->dev = data.st_rdev;
	device->magic = auth.magic;
	device->driver.device = device;
	device->driver.fd = fd;
	IListAdd(&device->node, &devlist);
	GetResources(device);
	LoadDriver(device);
	return (HDEVICE)device;
}
示例#14
0
void CResourceBase::Release()
{
	if ( 0 == --m_cRef )
	{
		GetResources()->Destroy(this);
	}
}
示例#15
0
void cTextBox::Draw(const sf::Vector2<float> & a_rkInterpolationOffset)
{
   sf::Vector2<float> l_OldPosition = m_Data.getPosition();
   m_Data.setPosition(l_OldPosition + a_rkInterpolationOffset);
   GetResources()->GetWindow()->draw(m_Data);
   m_Data.setPosition(l_OldPosition);
}
示例#16
0
bool CDRMUtils::OpenDrm()
{
  std::vector<const char*>modules =
  {
    "i915",
    "amdgpu",
    "radeon",
    "nouveau",
    "vmwgfx",
    "msm",
    "imx-drm",
    "rockchip",
    "vc4",
    "virtio_gpu",
    "sun4i-drm",
  };

  for(int i = 0; i < 10; ++i)
  {
    std::string device = "/dev/dri/card";
    device.append(std::to_string(i));

    for (auto module : modules)
    {
      m_fd = drmOpen(module, device.c_str());
      if (m_fd >= 0)
      {
        if(!GetResources())
        {
          continue;
        }

        if(!GetConnector())
        {
          continue;
        }

        drmModeFreeResources(m_drm_resources);
        m_drm_resources = nullptr;

        drmModeFreeConnector(m_connector->connector);
        m_connector->connector = nullptr;

        drmModeFreeObjectProperties(m_connector->props);
        m_connector->props = nullptr;

        drmModeFreeProperty(*m_connector->props_info);
        *m_connector->props_info = nullptr;

        CLog::Log(LOGDEBUG, "CDRMUtils::%s - opened device: %s using module: %s", __FUNCTION__, device.c_str(), module);
        return true;
      }

      drmClose(m_fd);
      m_fd = -1;
    }
  }

  return false;
}
示例#17
0
void cFreePlayMenu::Draw(const sf::Vector2<float> & a_rkInterpolationOffset)
{
   sf::Vector2<float> l_OldPosition = m_Player1Label.getPosition();
   m_Player1Label.setPosition(l_OldPosition + a_rkInterpolationOffset);
   GetResources()->GetWindow()->draw(m_Player1Label);
   m_Player1Label.setPosition(l_OldPosition);

   l_OldPosition = m_Player2Label.getPosition();
   m_Player2Label.setPosition(l_OldPosition + a_rkInterpolationOffset);
   GetResources()->GetWindow()->draw(m_Player2Label);
   m_Player2Label.setPosition(l_OldPosition);

   l_OldPosition = m_GameSpeedLabel.getPosition();
   m_GameSpeedLabel.setPosition(l_OldPosition + a_rkInterpolationOffset);
   GetResources()->GetWindow()->draw(m_GameSpeedLabel);
   m_GameSpeedLabel.setPosition(l_OldPosition);
}
示例#18
0
bool CDRMUtils::InitDrm()
{
  if(m_fd >= 0)
  {
    /* caps need to be set before allocating connectors, encoders, crtcs, and planes */
    auto ret = drmSetClientCap(m_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
    if (ret)
    {
      CLog::Log(LOGERROR, "CDRMUtils::%s - failed to set Universal planes capability: %s", __FUNCTION__, strerror(errno));
      return false;
    }

    if(!GetResources())
    {
      return false;
    }

    if(!GetConnector())
    {
      return false;
    }

    if(!GetEncoder())
    {
      return false;
    }

    if(!GetCrtc())
    {
      return false;
    }

    if(!GetPlanes())
    {
      return false;
    }
  }

  drmModeFreeResources(m_drm_resources);
  m_drm_resources = nullptr;

  if(m_fd < 0)
  {
    return false;
  }

  if(!GetPreferredMode())
  {
    return false;
  }

  drmSetMaster(m_fd);

  m_orig_crtc = drmModeGetCrtc(m_fd, m_crtc->crtc->crtc_id);

  return true;
}
示例#19
0
cCountdownStart::cCountdownStart(cResources* a_pResources)
   : cObject(a_pResources),
     m_State(kThreeState),
     m_TimeAlive(0)
{
   SetType("CountdownStart");
   SetSolid(true);
   SetCollidable(false);
   GetResources()->GetBackGroundMusic()->stop();
   GetResources()->PlayBackgroundMusic("Media/Music/GetIt.ogg");
   GetResources()->GetBackGroundMusic()->setLoop(true);

   cFadeTransition * l_pFadeTransition = new cFadeTransition(GetResources());
   l_pFadeTransition->SetFadeDirection(cFadeTransition::kFadeDirectionIn);
   l_pFadeTransition->SetTransitionTime(1000);
   // Make sure the transition is in front of everything
   l_pFadeTransition->SetDepth(-10);
}
示例#20
0
void cButton::SetLabel(std::string a_String, uint32_t a_Size)
{
   std::shared_ptr<sf::Font> l_Font
      = GetResources()->LoadFont("Media/junegull.ttf");
   m_Label.setFont(*(l_Font.get()));
   m_Label.setCharacterSize(a_Size);
   m_Label.setColor(sf::Color::Black);
   m_Label.setString(a_String);
}
示例#21
0
ECode Context::GetString(
    /* [in] */ Int32 resId,
    /* [out] */ String* str)
{
    VALIDATE_NOT_NULL(str)
    *str = String(NULL);
    AutoPtr<IResources> resources;
    FAIL_RETURN(GetResources((IResources**) &resources));
    return resources->GetString(resId, str);
}
void
HdStBufferArrayRangeGL::GetBufferSpecs(HdBufferSpecVector *specs) const
{
    HD_TRACE_FUNCTION();

    HdStBufferResourceGLNamedList const &resources = GetResources();

    TF_FOR_ALL(it, resources) {
        specs->emplace_back(it->first, it->second->GetTupleType());
    }
示例#23
0
void cFreePlayMenu::Step (uint32_t a_ElapsedMiliSec)
{
   if (GetPosition() != GetPreviousPosition())
   {
      sf::Vector3<double> l_Position = GetPosition();
      m_Player1Label.setPosition(GetPosition().x, l_Position.y + 4);
      l_Position.y += m_pPlayer1Option->GetBoundingBox().height + 5;
      m_Player2Label.setPosition(GetPosition().x, l_Position.y + 4);
      l_Position.y += m_pPlayer2Option->GetBoundingBox().height + 5;
      m_GameSpeedLabel.setPosition(GetPosition().x, l_Position.y + 4);
   }

   // We can't post a message from inside the MessageReceived function, so it
   // gets deferred to here instead.
   // TODO: This might not actually be true. It might only be registering for
   // messages that is problematic.
   if (m_PostBackMessage)
   {
      sMessage l_Message;
      l_Message.m_From = GetUniqueId();
      l_Message.m_Category = "Button";
      l_Message.m_Key = "Menu Change";
      l_Message.m_Value = "cMainMenu";
      GetResources()->GetMessageDispatcher()->PostMessage(l_Message);
      m_PostBackMessage = false;
   }

   if (GetVelocity().x < 0)
   {
      if (GetPosition().x + m_Player1Label.getLocalBounds().width < GetResources()->GetWindow()->getSize().x / 2)
      {
         SetVelocityX(0, kNormal);
      }
   }
   else if (GetVelocity().x > 0)
   {
      if (GetPosition().x > GetResources()->GetWindow()->getSize().x)
      {
         SetVelocityX(0, kNormal);
      }
   }
}
示例#24
0
bool
nsPerformanceStatsService::StopwatchStart(uint64_t iteration) {
  mIteration = iteration;

  nsresult rv = GetResources(&mUserTimeStart, &mSystemTimeStart);
  if (NS_FAILED(rv)) {
    return false;
  }

  return true;
}
示例#25
0
// These functions are overloaded from cObject
void cFreePlayMenu::Initialize()
{
   sf::Vector3<double> l_Position = GetPosition();
   m_Player1Label.setPosition(GetPosition().x, l_Position.y + 4);
   l_Position.x += 90;
   m_pPlayer1Option->SetPosition(l_Position, kNormal, false);
   m_pPlayer1Option->Initialize();

   l_Position.y += m_pPlayer1Option->GetBoundingBox().height + 5;
   m_Player2Label.setPosition(GetPosition().x, l_Position.y + 4);
   m_pPlayer2Option->SetPosition(l_Position, kNormal, false);
   m_pPlayer2Option->Initialize();

   l_Position.y += m_pPlayer2Option->GetBoundingBox().height + 5;
   m_GameSpeedLabel.setPosition(GetPosition().x, l_Position.y + 4);
   m_pGameSpeedOption->SetPosition(l_Position, kNormal, false);
   m_pGameSpeedOption->Initialize();

   l_Position.y += m_pGameSpeedOption->GetBoundingBox().height + 10;
   m_pStartButton->SetPosition(l_Position, kNormal, false);
   l_Position.x += m_pStartButton->GetBoundingBox().width + 5;
   m_pBackButton->SetPosition(l_Position, kNormal, false);

   // Receive messages when The start button is pushed.
   sMessage l_Request;
   l_Request.m_From = m_pStartButton->GetUniqueId();
   l_Request.m_Category = GetResources()->GetMessageDispatcher()->Any();
   l_Request.m_Key = GetResources()->GetMessageDispatcher()->Any();
   l_Request.m_Value = GetResources()->GetMessageDispatcher()->Any();

   std::function<void(sMessage)> l_MessageCallback =
      std::bind(&cFreePlayMenu::MessageReceived, this, std::placeholders::_1);

   GetResources()->GetMessageDispatcher()->RegisterForMessages(
      GetUniqueId(),
      l_MessageCallback,
      l_Request
      );

   // Receive messages when the back button is pushed.
   l_Request.m_From = m_pBackButton->GetUniqueId();
   l_Request.m_Category = GetResources()->GetMessageDispatcher()->Any();
   l_Request.m_Key = GetResources()->GetMessageDispatcher()->Any();
   l_Request.m_Value = GetResources()->GetMessageDispatcher()->Any();

   GetResources()->GetMessageDispatcher()->RegisterForMessages(
      GetUniqueId(),
      l_MessageCallback,
      l_Request
      );
}
示例#26
0
文件: appbase.cpp 项目: newobj/taz
void CAppBase::Release()
{
	if ( 0 != --m_cRef ) return;

	GetInput()->Release();
	GetClasses()->Release();
	GetUi()->Release();
	GetRender()->Release();
	GetVideo()->Release();
	GetResources()->Release();
	GetGlue()->RemoveGlued(this);
	GetGlue()->Release();
}
示例#27
0
// These functions are overloaded from cObject
void cSelectionBox::Initialize()
{
   sf::Vector3<double> l_Position = GetPosition();
   m_pLeftArrowButton->SetPosition(l_Position, kNormal, false);
   m_pLeftArrowButton->Initialize();

   l_Position.x += m_pLeftArrowButton->GetBoundingBox().width;
   m_pTextBox->SetPosition(l_Position, kNormal, false);
   m_pTextBox->Initialize();

   l_Position.x += m_pTextBox->GetBoundingBox().width;
   m_pRightArrowButton->SetPosition(l_Position, kNormal, false);
   m_pRightArrowButton->Initialize();

   // Receive messages when buttons are pushed.
   sMessage l_Request;
   l_Request.m_From = m_pLeftArrowButton->GetUniqueId();
   l_Request.m_Category = GetResources()->GetMessageDispatcher()->Any();
   l_Request.m_Key = GetResources()->GetMessageDispatcher()->Any();
   l_Request.m_Value = GetResources()->GetMessageDispatcher()->Any();

   std::function<void(sMessage)> l_MessageCallback =
      std::bind(&cSelectionBox::MessageReceived, this, std::placeholders::_1);

   GetResources()->GetMessageDispatcher()->RegisterForMessages(
      GetUniqueId(),
      l_MessageCallback,
      l_Request
      );

   l_Request.m_From = m_pRightArrowButton->GetUniqueId();

   GetResources()->GetMessageDispatcher()->RegisterForMessages(
      GetUniqueId(),
      l_MessageCallback,
      l_Request
      );
}
示例#28
0
void cCloud::Step (uint32_t a_ElapsedMiliSec)
{
   if (GetPosition().x > GetResources()->GetWindow()->getSize().x)
   {
      //std::cout << "Resetting" << std::endl;
      sf::Vector3<double> l_NewPosition(
         0 - static_cast<double>(GetBoundingBox().width),
         GetPosition().y,
         0
         );

      SetPosition(l_NewPosition, kNormal, false, false);
   }
}
示例#29
0
ECode Context::GetDrawable(
    /* [in] */ Int32 id,
    /* [out] */ IDrawable** drawable)
{
    VALIDATE_NOT_NULL(drawable)
    *drawable = NULL;

    AutoPtr<IResourcesTheme> theme;
    FAIL_RETURN(GetTheme((IResourcesTheme**)&theme))
    AutoPtr<IResources> resources;
    FAIL_RETURN(GetResources((IResources**) &resources));

    return resources->GetDrawable(id, theme, drawable);
}
示例#30
0
void cFreePlayMenu::MessageReceived(sMessage a_Message)
{
   if (a_Message.m_From == m_pStartButton->GetUniqueId())
   {
      //~ std::cout << "Start button pressed" << std::endl;
      GetResources()->SetActiveLevel("Level1", true);

      std::string l_Player1Option = m_pPlayer1Option->GetSelectedOption();
      std::string l_Player2Option = m_pPlayer2Option->GetSelectedOption();
      std::string l_GameSpeed = m_pGameSpeedOption->GetSelectedOption();

      GetResources()->GetGameConfigData()->SetProperty("Player1", l_Player1Option);
      GetResources()->GetGameConfigData()->SetProperty("Player2", l_Player2Option);
      GetResources()->GetGameConfigData()->SetProperty("GameType", "FreePlay");
      GetResources()->GetGameConfigData()->SetProperty("GameSpeed", l_GameSpeed);

   }
   else if (a_Message.m_From == m_pBackButton->GetUniqueId())
   {
      SetVelocityX(1000, kNormal);
      m_PostBackMessage = true;
   }
}