Пример #1
0
bool CPetControl::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) {
	if (isInputLocked())
		return false;

	bool result = _sections[_currentArea]->VirtualKeyCharMsg(msg);

	if (!result) {
		switch (msg->_keyState.keycode) {
		case Common::KEYCODE_F1:
			result = true;
			setArea(PET_INVENTORY);
			break;
		case Common::KEYCODE_F2:
			result = true;
			setArea(PET_CONVERSATION);
			break;
		case Common::KEYCODE_F3:
			result = true;
			setArea(PET_REMOTE);
			break;
		case Common::KEYCODE_F4:
			result = true;
			setArea(PET_ROOMS);
			break;
		case Common::KEYCODE_F5:
			result = true;
			setArea(PET_REAL_LIFE);
			break;
		default:
			break;
		}
	}

	return result;
}
Пример #2
0
CGO_Player::CGO_Player ()
{
	ani = NULL;
	shadow = &a_shadow;
	setArea(ea_gameBoard);
	moveAbs(0, 0);

	dx = CGO_Player::dy = 3;
	setActive(false);
	setLifeState(LALIVE);
	setAniDirState(SSTAND, ASOUTH);
	setRunState(XSTAND);
	setColor(cred);
	setType(GOT_PLAYER);
	setName("Unnamed Player");
	setTeam(TEAM_RED);
	dropedBombs = 0;

	powerups[PBOMB ] = BWBOMB;
	powerups[PFLAME ] = BWFLAME;
	powerups[PSKATE ] = BWSKATE;
	powerups[PKICKER ] = BWKICKER;
	powerups[PJELLY ] = BWJELLY;
	powerups[PTRIGGER ] = BWTRIGGER;
	powerups[PPUNCH ] = BWPUNCH;
	powerups[PGRAB ] = BWGRAB;
	powerups[PSPOOGE ] = BWSPOOGE;
	powerups[PGOLDFLAME] = BWGOLDFLAME;
	powerups[PDISEASE ] = BWDISEASE;
	powerups[PDISEASE3 ] = BWDISEASE3;
}
Пример #3
0
//----------------------------------------------------------------------------//
void Element::onNonClientChanged(ElementEventArgs& e)
{
    // TODO: Be less wasteful with this update
    setArea(getArea());

    fireEvent(EventNonClientChanged, e, EventNamespace);
}
Пример #4
0
//----------------------------------------------------------------------------//
void NullTextureTarget::declareRenderSize(const Size& sz)
{
	Rect r;
	r.setSize(sz);
	r.setPosition(Point(0, 0));
    setArea(r);
}
Пример #5
0
/**
 * Creates a 3D area based on the supplied start and end points.
 *
 * @param startX the leftmost X position
 * @param startY the topmost Y position
 * @param startZ the frontmost Z position
 * @param endX the rightmost X position
 * @param endY the bottommost Y position
 * @param endZ the backmost Z position
 */
Area3D::Area3D(const Displacement &startX, const Displacement &startY,
               const Displacement &startZ,
               const Displacement &endX, const Displacement &endY,
               const Displacement &endZ) {
    nullTheData();
    setArea(startX, startY, startZ, endX, endY, endZ);
}
Пример #6
0
void MI0283QT9::fillCircle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t color)
{
  int16_t err, x, y;
  
  err = -radius;
  x   = radius;
  y   = 0;

  setArea(0, 0, lcd_width-1, lcd_height-1);

  while(x >= y)
  {
    drawLine(x0 - x, y0 + y, x0 + x, y0 + y, color);
    drawLine(x0 - x, y0 - y, x0 + x, y0 - y, color);
    drawLine(x0 - y, y0 + x, x0 + y, y0 + x, color);
    drawLine(x0 - y, y0 - x, x0 + y, y0 - x, color);

    err += y;
    y++;
    err += y;
    if(err >= 0)
    {
      x--;
      err -= x;
      err -= x;
    }
  }

  return;
}
Пример #7
0
void CPetControl::addToInventory(CGameObject *item) {
	item->detach();

	if (item->getName() == "CarryParcel") {
		CCarry *child = dynamic_cast<CCarry *>(getLastChild());
		if (child)
			child->detach();

		item->petMoveToHiddenRoom();
		if (!child)
			return;

		item = child;
	}

	item->addUnder(this);
	_inventory.itemsChanged();

	setArea(PET_INVENTORY);
	if (_currentArea == PET_INVENTORY)
		_inventory.highlightItem(item);

	makeDirty();
	CPETGainedObjectMsg msg;
	msg.execute(item);
}
Пример #8
0
void Radiosity::Reset() {
  delete [] area;
  delete [] undistributed;
  delete [] absorbed;
  delete [] radiance;

  // create and fill the data structures
  num_faces = mesh->numFaces();
  area = new float[num_faces];
  undistributed = new glm::vec3[num_faces];
  absorbed = new glm::vec3[num_faces];
  radiance = new glm::vec3[num_faces];
  for (int i = 0; i < num_faces; i++) {
    Face *f = mesh->getFace(i);
    f->setRadiosityPatchIndex(i);
    setArea(i,f->getArea());
    glm::vec3 emit = f->getMaterial()->getEmittedColor();
    setUndistributed(i,emit);
    setAbsorbed(i,glm::vec3(0,0,0));
    setRadiance(i,emit);
  }

  // find the patch with the most undistributed energy
  findMaxUndistributed();
}
Пример #9
0
void Layout::onAreaChanged(Widget& widget)
{
    if (expanding)
        setArea(Rect(vec2(0.f), widget.getSize()));

    update();
}
Пример #10
0
void markupText::setText( QString textIn )
{
    text = textIn;

    // Update the area to accommodate the new text
    setArea();
}
Пример #11
0
void DirtyArea::setTextDisplay(const TextDisplay *textDisplay) {
	_bounds.left = textDisplay->_bounds.left;
	_bounds.top = textDisplay->_bounds.top;

	setArea(textDisplay->_bounds.width(), textDisplay->_bounds.height(),
		MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT);
}
Пример #12
0
	bool FrameWindow::onMouseMove(void)
	{
		if(m_tracking)
		{
			point pt = transformToWndCoord(m_system.getCursor().getPosition());
			point newpos = pt - m_offset;

			Rect testarea(m_area);
			testarea.setPosition(newpos);

			if(m_clampToScreen && m_parent)
			{
				Size me = m_area.getSize();
				Size max = m_parent->getSize();
				if(testarea.m_left < 0.f)
					testarea.m_left = 0.f;
				if(testarea.m_top < 0.f)
					testarea.m_top = 0.f;
				if(testarea.m_right > max.width)
					testarea.m_left = max.width - me.width;
				if(testarea.m_bottom > max.height)
					testarea.m_top = max.height - me.height;

				testarea.setSize(me);
			}
			
			setArea(testarea);

			EventArgs a;
			a.name = "On_Move";
			callHandler(&a);
		}
		return true;
	}
Пример #13
0
void GraphicsLib::fillRect(int_least16_t x0, int_least16_t y0, int_least16_t w, int_least16_t h, uint_least16_t color)
{
    uint_least32_t size;

    if(x0   >= lcd_width)  {
        x0 = lcd_width-1;
    }
    if(y0   >= lcd_height) {
        y0 = lcd_height-1;
    }
    if(x0+w >= lcd_width)  {
        w  = lcd_width-x0;
    }
    if(y0+h >= lcd_height) {
        h  = lcd_height-y0;
    }

    setArea(x0, y0, x0+w-1, y0+h-1);

    drawStart();

    for(size=((uint_least32_t)w*h); size!=0; size--)
    {
        draw(color);
    }

    drawStop();

    return;
}
Пример #14
0
RigidBody::~RigidBody() {
	DEBUG_M("Entering function...");
	setArea(NULL);
	delete body_;
	delete shape_;
	delete motionState_;
}
Пример #15
0
//----------------------------------------------------------------------------//
void OgreTextureTarget::declareRenderSize(const Sizef& sz)
{
    // exit if current size is enough
    if ((d_area.getWidth() >= sz.d_width) && (d_area.getHeight() >=sz.d_height))
        return;

    Ogre::TexturePtr rttTex = Ogre::TextureManager::getSingleton().createManual(
        OgreTexture::getUniqueName(),
        Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        Ogre::TEX_TYPE_2D, sz.d_width, sz.d_height, 1, 0, Ogre::PF_A8R8G8B8,
        Ogre::TU_RENDERTARGET);

    d_renderTarget = rttTex->getBuffer()->getRenderTarget();

    Rectf init_area(
        Vector2f(0, 0),
        Sizef(d_renderTarget->getWidth(), d_renderTarget->getHeight())
    );

    setArea(init_area);

    // delete viewport and reset ptr so a new one is generated.  This is
    // required because we have changed d_renderTarget so need a new VP also.
    delete d_viewport;
    d_viewport = 0;

    // because Texture takes ownership, the act of setting the new ogre texture
    // also ensures any previous ogre texture is released.
    d_CEGUITexture->setOgreTexture(rttTex, true);

    clear();
}
//----------------------------------------------------------------------------//
void NullTextureTarget::declareRenderSize(const Sizef& sz)
{
	Rectf r;
	r.setSize(sz);
    r.setPosition(glm::vec2(0, 0));
    setArea(r);
}
Пример #17
0
TabBarWidget::TabBarWidget(QWidget *parent) : QTabBar(parent),
	m_previewWidget(NULL),
	m_tabSize(0),
	m_maximumTabSize(40),
	m_minimumTabSize(250),
	m_pinnedTabsAmount(0),
	m_clickedTab(-1),
	m_hoveredTab(-1),
	m_previewTimer(0),
	m_showCloseButton(true),
	m_showUrlIcon(true),
	m_enablePreviews(true)
{
	qRegisterMetaType<WindowLoadingState>("WindowLoadingState");
	setDrawBase(false);
	setExpanding(false);
	setMovable(true);
	setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
	setElideMode(Qt::ElideRight);
	setMouseTracking(true);
	setDocumentMode(true);
	setMaximumSize(0, 0);
	setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	setStyle(new TabBarStyle());

	m_closeButtonPosition = static_cast<QTabBar::ButtonPosition>(QApplication::style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition));
	m_iconButtonPosition = ((m_closeButtonPosition == QTabBar::RightSide) ? QTabBar::LeftSide : QTabBar::RightSide);

	optionChanged(QLatin1String("TabBar/ShowCloseButton"), SettingsManager::getValue(QLatin1String("TabBar/ShowCloseButton")));
	optionChanged(QLatin1String("TabBar/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("TabBar/ShowUrlIcon")));
	optionChanged(QLatin1String("TabBar/EnablePreviews"), SettingsManager::getValue(QLatin1String("TabBar/EnablePreviews")));
	optionChanged(QLatin1String("TabBar/MaximumTabSize"), SettingsManager::getValue(QLatin1String("TabBar/MaximumTabSize")));
	optionChanged(QLatin1String("TabBar/MinimumTabSize"), SettingsManager::getValue(QLatin1String("TabBar/MinimumTabSize")));

	ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent);

	if (toolBar)
	{
		setArea(toolBar->getArea());

		connect(toolBar, SIGNAL(areaChanged(Qt::ToolBarArea)), this, SLOT(setArea(Qt::ToolBarArea)));
	}

	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
	connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
}
Пример #18
0
void Image::setAround(unsigned x, unsigned y, unsigned pixelSize, Color color) {
	unsigned halfSize = (double)pixelSize/2;
	unsigned top = y > halfSize ? y - halfSize : 0;
	unsigned left = x > halfSize ? x - halfSize : 0;
	unsigned bottom = y + halfSize < height ? y + halfSize : height;
	unsigned right = x + halfSize < width ? x + halfSize : width;
	setArea(top, left, bottom, right, color);
}
Пример #19
0
ClickableArea::ClickableArea(CIntObject * object, CFunctionList<void()> callback):
	callback(callback),
	area(nullptr)
{
	if (object)
		pos = object->pos;
	setArea(object);
}
Пример #20
0
/**
 * Creates a 3D area based on the supplied dimensions.
 *
 * @param startX the leftmost X position
 * @param startY the topmost Y position
 * @param startZ the frontmost Z position
 * @param width the width of the X dimension
 * @param height the height of the Y dimension
 * @param depth the depth of the Z dimension
 */
Area3D::Area3D(const Displacement &startX, const Displacement &startY,
               const Displacement &startZ,
               const Distance &width, const Distance &height,
               const Distance &depth) {
    nullTheData();
    setArea(startX, startY, startZ,
            startX + width, startY + height, startZ + depth);
}
Пример #21
0
void markupText::moveTo( const QPoint posIn )
{
    // Limit position to within the image
    QPoint limPos = limitPointToImage( posIn );

    rect.translate( limPos - owner->grabOffset );

    setArea();
}
Пример #22
0
CGO_Bomb::CGO_Bomb ()
{
    ani = &(a_bomb[BREG]);
    setArea(ea_gameBoard);
    ticksTimeoutDefault = 2000;
    ticksTimeout = ticksTimeoutDefault;

    moveAbs(0, 0);
}
Пример #23
0
//----------------------------------------------------------------------------//
void OpenGLFBOTextureTarget::declareRenderSize(const Size& sz)
{
    // exit if current size is enough
    if ((d_area.getWidth() >= sz.d_width) && (d_area.getHeight() >=sz.d_height))
        return;

    setArea(Rect(d_area.getPosition(), d_owner.getAdjustedTextureSize(sz)));
    resizeRenderTexture();
}
Пример #24
0
void markupEllipse::moveTo( const QPoint posIn )
{
    // Limit position to within the image
    QPoint limPos = limitPointToImage( posIn );

    rect.translate( limPos - owner->grabOffset );

    // Update the area the ellipse now occupies
    setArea();
}
//----------------------------------------------------------------------------//
void Direct3D11TextureTarget::declareRenderSize(const Size& sz)
{
    // exit if current size is enough
    if ((d_area.getWidth() >= sz.d_width) && (d_area.getHeight() >=sz.d_height))
        return;

    setArea(Rect(d_area.getPosition(), sz));
    resizeRenderTexture();
    clear();
}
Пример #26
0
//----------------------------------------------------------------------------//
void OgreWindowTarget::initRenderTarget(Ogre::RenderTarget& target)
{
    d_renderTarget = &target;

    Rectf init_area(glm::vec2(0.0f, 0.0f),
                    Sizef(static_cast<float>(d_renderTarget->getWidth()), 
                          static_cast<float>(d_renderTarget->getHeight())) );

    setArea(init_area);
}
Пример #27
0
Highlighter::Highlighter(const ElementArea& area)
  : QWidget()
{
  setWindowTitle("Highlighter");
  setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
  setWindowOpacity(0.5);

  setArea(area);
  createCloseButton();
}
Пример #28
0
void DirtyArea::setUISlot(const UISlot *slot) {
	int type = slot->_flags;
	if (type <= IMG_UPDATE_ONLY)
		type += -IMG_UPDATE_ONLY;
	if (type >= 0x40)
		type &= ~0x40;

	MSurface &intSurface = _vm->_game->_scene._userInterface;
	switch (type) {
	case IMG_REFRESH:
		_bounds.left = 0;
		_bounds.top = 0;
		setArea(intSurface.w, intSurface.h, intSurface.w, intSurface.h);
		break;

	case IMG_OVERPRINT:
		_bounds.left = slot->_position.x;
		_bounds.top = slot->_position.y;
		_bounds.setWidth(slot->_width);
		_bounds.setHeight(slot->_height);
		setArea(slot->_width, slot->_height, intSurface.w, intSurface.h);
		break;

	default: {
		SpriteAsset *asset = _vm->_game->_scene._sprites[slot->_spritesIndex];
		MSprite *frame = asset->getFrame(slot->_frameNumber - 1);
		int w = frame->w;
		int h = frame->h;

		if (slot->_segmentId == IMG_SPINNING_OBJECT) {
			_bounds.left = slot->_position.x;
			_bounds.top = slot->_position.y;
		} else {
			_bounds.left = slot->_position.x + w / 2;
			_bounds.top = slot->_position.y - h + 1;
		}

		setArea(w, h, intSurface.w, intSurface.h);
		break;
	}
	}
}
Пример #29
0
void CPetControl::postLoad() {
	CProjectItem *root = getRoot();

	if (!_activeNPCName.empty() && root)
		_activeNPC = root->findByName(_activeNPCName);
	if (!_remoteTargetName.empty() && root)
		_remoteTarget = dynamic_cast<CGameObject *>(root->findByName(_remoteTargetName));

	setArea(_currentArea, true);
	loaded();
}
Пример #30
0
void MI0283QT9::setOrientation(uint_least16_t o)
{
  uint_least8_t p;

  #define MEM_Y   (7) //MY row address order
  #define MEM_X   (6) //MX column address order 
  #define MEM_V   (5) //MV row / column exchange 
  #define MEM_L   (4) //ML vertical refresh order
  #define MEM_H   (2) //MH horizontal refresh order
  #define MEM_BGR (3) //RGB-BGR Order 

       if((o ==   9) || 
          (o ==  90))
  {
    lcd_orientation = 90;
    lcd_width  = LCD_HEIGHT;
    lcd_height = LCD_WIDTH;
    p = (1<<MEM_BGR) | (1<<MEM_X);
  }

  else if((o ==  18) || 
          (o == 180))
  {
    lcd_orientation = 180;
    lcd_width  = LCD_WIDTH;
    lcd_height = LCD_HEIGHT;
    p = (1<<MEM_BGR) | (1<<MEM_L) | (1<<MEM_V);
  }

  else if((o ==  27) || 
          (o ==  14) || 
          (o == 270))
  {
    lcd_orientation = 270;
    lcd_width  = LCD_HEIGHT;
    lcd_height = LCD_WIDTH;
    p = (1<<MEM_BGR) | (1<<MEM_Y);
  }

  else
  {
    lcd_orientation = 0;
    lcd_width  = LCD_WIDTH;
    lcd_height = LCD_HEIGHT;
    p = (1<<MEM_BGR) | (1<<MEM_X) | (1<<MEM_Y) | (1<<MEM_V);
  }

  wr_cmd(LCD_CMD_MEMACCESS_CTRL);
  wr_data(p);

  setArea(0, 0, lcd_width-1, lcd_height-1);

  return;
}