Boolean QFMotionPlayer::windowResize(IResizeEvent &event)
{
  IRectangle screenRectangle;
  if (screen)
  {
    screenRectangle = (qf.controller() ?
                       IRectangle(IPoint(0, CONTROL_PANEL_HEIGHT), IPoint(event.newSize())) :
                       IRectangle(event.newSize()));
    screen->moveSizeTo(screenRectangle);
    if (movieWindow)
    {
      IRectangle movieRectangle = IRectangle(screenRectangle.size());
      if (qf.scale() == QF_SCALE_CENTER && moviePlayer && howLongMovieWillPlay)
        movieRectangle = IRectangle(((IMMDigitalVideo*)moviePlayer)->videoFileWidth(),
                                    ((IMMDigitalVideo*)moviePlayer)->videoFileHeight()).
                                    centeredAt(movieRectangle.center());
      movieWindow->moveSizeTo(movieRectangle);
    }
  }

  if (qf.controller())
  {
    float armPercent = .0;
    if (filePrepared && !isPlaying && moviePlayer->position())
    {
      armPercent = moviePlayer->position();
      armPercent /= howLongMovieWillPlay;
    }
    qf.createController(armPercent);
  }

  return false;
}
Example #2
0
void DestroyChipsOrder::Draw(IPoint pos, bool vertical)
{
	if(_timeAppearText > 0)
	{
		//Текст
		Render::BeginAlphaMul(math::clamp(0.f, 1.f, _timeAppearText));
		if(_drawShowCount > 0.0f && !Completed())
		{
			IPoint textOffset = vertical ? IPoint(40, 14) : IPoint(54, 24);
			Render::FreeType::BindFont("OrderOnLock");
			Render::PrintString(pos + textOffset, utils::lexical_cast(math::ceil(_drawShowCount)), 1.f, CenterAlign, CenterAlign);
		}
		Render::EndAlphaMul();
	}
	if(_timeAppearIcon > 0)
	{
		FPoint iconOffset = vertical ? FPoint(40.0f, 53.0f) : FPoint(24.0f, 24.0f);
		//Иконка
		Render::BeginAlphaMul(math::clamp(0.f, 1.f, _timeAppearIcon));
		FRect rect, frect;
		GetOrderIconRect(_rect_num, rect, frect);
		rect.MoveBy(FPoint(0, 30.f)*(1.f - _timeAppearIcon) + pos + iconOffset);
		Game::ordersTexture->Bind();
		Render::DrawRect(rect, frect);
		Render::EndAlphaMul();
	}
}
void QFMotionPlayer::setWindow(IWindow& window)
{
  window_p = &window;

  handler.IResizeHandler::handleEventsFor(window_p);
  handler.IPaintHandler::handleEventsFor(window_p);
  handler.ICommandHandler::handleEventsFor(window_p);
  handler.QFPlayerHandler::handleEventsFor(window_p);
  menu = new IPopUpMenu(IResourceId(MOTION_POPUP_ID, QuickFlick::resourceLibrary()), window_p);
  menu->disableItem(MI_MOTION_SAVEAS);

  IRectangle screenRectangle = (qf.controller() ?
                                IRectangle(IPoint(0, CONTROL_PANEL_HEIGHT), IPoint(window_p->size())) :
                                IRectangle(window_p->size()));
  screen = new IStaticText(SCREEN_ID, window_p, window_p, screenRectangle,
                           IWindow::noStyle | IWindow::clipChildren);
  screen->setFillColor(IColor::paleGray);
  screen->setBackgroundColor(IColor::paleGray);
  screen->enableFillBackground();
  screen->setAlignment(IStaticText::topLeftWrapped);
  screen->setFont(IFont("Helv", 8));
  if (qf.disabled())
    setScreenText("This version of QuickFlick has expired.\nTo upgrade:\n - Open Netscape\n - Choose Help->About Plug-ins->Practice");
  handler.IMenuHandler::handleEventsFor(screen);
  screen->show();
}
void ChipSelecter::Draw()
{
	Render::device.SetTexturing(false);
	Render::BeginColor(Color(100, 100, 100, 180));
	Render::DrawRect(IRect(200, 150, 400, 300));
	Render::EndColor();
	
	Render::device.SetTexturing(true);
	
	//IRect rect = Game::ChipColor::DRAW_RECT;
	//Тут должно быть 44х44!
	IRect rect = IRect(0,0,44,44);

	for (int i = 0; i <= 6; i++)
	{
		int x = _chipXLeft + 50*(i%7);
		int y = _chipYDown + 50*(3 - i/7);
		FRect uv = Game::GetChipRect(i, false, false, false);
		_chipsTex->Draw(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)), uv);
	}

	for (size_t i = 0; i < _chipColors.size(); i++)
	{
		int color = _chipColors[i];
		int x = _chipXLeft + 50*(color%7);
		int y = _chipYDown + 50*(3 - color/7);

		Render::BeginColor(Color(100, 255, 255, 255));
		for (int q = -1; q<=1; q++)
		{
			for (int w = -1; w<=1; w++)
			{
				DrawRamka(x+q, y+w);
			}
		}
		Render::EndColor();

		FRect uv = Game::GetChipRect(color, false, false, false);	

		Render::device.SetAlpha(static_cast<int>(150+80*sinf(_timer*6 + x - y/3)));
		Render::device.SetBlendMode(Render::ADD);
		_chipsTex->Draw(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)), uv);
		Render::device.SetBlendMode(Render::ALPHA);
	}

	if (_underMouseChip >= 0)
	{
		int color = _underMouseChip;
		int x = _chipXLeft + 50*(color%7);
		int y = _chipYDown + 50*(3 - color/7);
		Render::BeginColor(Color(0, 255, 0, 255));
		DrawRamka(x, y);
		Render::EndColor();
	}

	Render::BindFont("debug");
	Render::PrintString(IPoint(370, 170), utils::lexical_cast(static_cast<int>(_chipColors.size())) + " colors", 1.f, CenterAlign);
}
Example #5
0
IPoint GameObject::isInsideRect(IRect& bounds) const
{
	IPoint normal(0, 0);
	if (_position.x - _radius < bounds.x) normal += IPoint(1, 0);
	else if (_position.x + _radius > bounds.width) normal += IPoint(-1, 0);
	if (_position.y - _radius < bounds.y) normal += IPoint(0, 1);
	else if (_position.y + _radius > bounds.height) normal += IPoint(0, -1);
	return normal;
}
//----------------------------------------------------------------------------
// Method: NewControl::paintWindow
//
// Description: 'paintWindow' is called in response to a paint event, 'evt'.
//              It establishes the colors to paint as well as determines
//              how large and where to draw the text.
//----------------------------------------------------------------------------
Boolean NewControl::paintWindow(IPaintEvent& evt)
   {
   IColor clrBackground(defclrBackground);
   IColor clrForeground(defclrForeground);
   IColor clrHilite(defclrHilite);

   IPresSpaceHandle hps = evt.presSpaceHandle();

   // Should make a separate method which sets the logical
   // color table for the HPS into RGB mode and sets all our
   // colors. Also, colors could be cached in private data
   // and only updated when presparams change.
   establishColor(clrBackground, background, defclrBackground);
   establishColor(clrForeground, foreground, defclrForeground);
   establishColor(clrHilite, hilite, defclrHilite);

   evt.clearBackground(clrBackground);

   // Create the text to draw
   IString theText(dummyText);
   IString theNumber(clicks);
   theNumber.rightJustify(4);
   IString both(theText + theNumber);

   POINTL aptl[TXTBOX_COUNT];
   POINTL ptl = {0,0};

   // Find where we're going to draw our text and how big it will be.
   GpiQueryTextBox(hps,
                   strlen((char*)both),
                   (char*)both,
                   TXTBOX_COUNT,
                   aptl);

   long textWidth = MAX(aptl[TXTBOX_TOPRIGHT].x,
                        aptl[TXTBOX_BOTTOMRIGHT].x);
   long textHeight = MAX(aptl[TXTBOX_TOPLEFT].y,
                         aptl[TXTBOX_TOPRIGHT].y);

   // Center the text before drawing it.
   long x = (cx - textWidth) / 2;
   long y = (cy - textHeight) / 2;

   evt.drawText(theText, IPoint(x, y), clrForeground);

   GpiQueryTextBox(hps,
                   strlen((char*)theText),
                   (char*)theText,
                   TXTBOX_COUNT,
                   aptl);

   // Draw the number to the side of the text
   x += aptl[TXTBOX_CONCAT].x;
   evt.drawText(theNumber, IPoint(x, y), clrHilite);

   return true;
   }
ChangeEnergySpeed::ChangeEnergySpeed()
	: _sliderTime(IPoint(330, 85), 150, false, 6, 14)
{
	Gamefield = NULL;
	_snapPoint = IPoint(-1, -1);
	
	_energyTimeScale = 1.f;
	_activated = false;
	_selected = false;

	_sliderTime.SetFactor(0.1f);
}
void MixedModelLayout::doCall(
	PlanRep &PG,
	adjEntry adjExternal,
	GridLayout &gridLayout,
	IPoint &boundingBox,
	bool fixEmbedding)
{
	// handle graphs with less than 3 nodes
	node v1, v2;
	switch (PG.numberOfNodes()) {
	case 0:
		boundingBox = IPoint(0,0);
		return;

	case 1:
		v1 = PG.firstNode();
		gridLayout.x(v1) = gridLayout.y(v1) = 0;
		boundingBox = IPoint(0,0);
		return;

	case 2:
		v1 = PG.firstNode();
		v2 = v1->succ();
		gridLayout.x(v1) = gridLayout.y(v1) = gridLayout.y(v2) = 0;
		gridLayout.x(v2) = 1;
		boundingBox = IPoint(1,0);
		return;
	}

	MixedModelBase mm(PG,gridLayout);

	if(fixEmbedding) {
		OGDF_ASSERT(PG.representsCombEmbedding());
		PlanarAugmentationFix fixAugmenter;
		mm.computeOrder(fixAugmenter, 0, adjExternal, m_compOrder.get());
	} else
		mm.computeOrder(m_augmenter.get(),&m_embedder.get(),0,m_compOrder.get());

	mm.assignIopCoords();
	mm.placeNodes();
	mm.postprocessing1();
	mm.setBends();
	mm.postprocessing2();

	m_crossingsBeautifier.get().call(PG,gridLayout);

	int xmin, ymin;
	gridLayout.computeBoundingBox(xmin,boundingBox.m_x,ymin,boundingBox.m_y);
}
Example #9
0
void SchnyderLayout::doCall(
	const Graph &G,
	adjEntry adjExternal,
	GridLayout &gridLayout,
	IPoint &boundingBox,
	bool fixEmbedding)
{
	// check for double edges & self loops
	OGDF_ASSERT(isSimple(G));

	// handle special case of graphs with less than 3 nodes
	if (G.numberOfNodes() < 3) {
		node v1, v2;
		switch (G.numberOfNodes()) {
		case 0:
			boundingBox = IPoint(0, 0);
			return;

		case 1:
			v1 = G.firstNode();
			gridLayout.x(v1) = gridLayout.y(v1) = 0;
			boundingBox = IPoint(0, 0);
			return;

		case 2:
			v1 = G.firstNode();
			v2 = G.lastNode();
			gridLayout.x(v1) = gridLayout.y(v1) = gridLayout.y(v2) = 0;
			gridLayout.x(v2) = 1;
			boundingBox = IPoint(1, 0);
			return;
		}
	}

	// make a copy for triangulation
	GraphCopy GC(G);

	// embed
	if (!fixEmbedding) {
		if (planarEmbed(GC) == false) {
			OGDF_THROW_PARAM(PreconditionViolatedException, pvcPlanar);
		}
	}

	triangulate(GC);

	schnyderEmbedding(GC, gridLayout, adjExternal);
}
bool SnapGadgets::Editor_MouseMove(const IPoint& mouse_pos, Game::Square *sq)
{
	if(EditorUtils::activeEditBtn !=  EditorUtils::SnapGadgetAdd)
	{
		return false;	
	}
	int x = sq->address.GetCol();
	int y = sq->address.GetRow();

	if(_drag_gadget)
	{
		IPoint to_pos = IPoint(x,y);
		_currentEditorGadget->Editor_MoveElements(IRect(0,0,200,200), to_pos - _fromPos);
		_fromPos = to_pos;
		return true;
	}
	if (!_dragGadget)
	{
		return true;
	}
	if (_dragElementId == -1)
	{
		return true;
	}

	if (_dragElementId == -2)
	{
		IPoint p;

		p.x = mouse_pos.x + GameSettings::FieldCoordMouse().x;
		p.y = mouse_pos.y + GameSettings::FieldCoordMouse().y;

		//Округление к ПОЛОВИНЕ ПОЛОВИНЫ КЛЕТКИ чтобы небыло стартового смещения)
		_dragGadget -> SetSnapPoint(p + (GameSettings::CELL_HALF*0.5f).Rounded());
	}
	else
	{
		if(!Game::isVisible(sq))
		{
			return true;
		}

		SnapGadgetBaseElement::SHARED_PTR e = _dragGadget -> GetElement(_dragElementId);
		e->SetIndex(IPoint(x, y));

	}
	return true;
}
void ChangeEnergySpeedItems::LoadLevel(rapidxml::xml_node<> *root)
{
	Clear(); // Удаляем, еcли еcть что-то...

	rapidxml::xml_node<> *gadgets = root -> first_node("EnergySpeed");
	if (!gadgets) return;

	rapidxml::xml_node<> *gadget = gadgets -> first_node("Item");

	while (gadget)
	{
		ChangeEnergySpeed *g = new ChangeEnergySpeed();

		int x = 0;
		int y = 0;
		float speed = 0.f;

		x = utils::lexical_cast<int> (std::string(gadget ->first_attribute("x")->value()));
		y = utils::lexical_cast<int> (std::string(gadget ->first_attribute("y")->value()));
		speed = utils::lexical_cast<float> (std::string(gadget ->first_attribute("speed")->value()));
		
		g -> SetPosition(IPoint(x, y));
		g -> SetEnergyTimeScale(speed);
		g -> _sliderTime.SetFactor((speed - 1.f) / 50.f);

		Gadgets::energySpeedChangers.AddGadget(g);

		gadget = gadget ->next_sibling("Item");
	}
}
int ChangeEnergySpeed::Editor_CaptureGadget(const IPoint& mouse_pos, int x, int y)
{
	// Преобразовываем координаты к координатам на поле
	int mx = mouse_pos.x + GameSettings::FieldCoordMouse().x;
	int my = mouse_pos.y + GameSettings::FieldCoordMouse().y;

	IRect r (mx - (GameSettings::SQUARE_SIDE / 2), my - (GameSettings::SQUARE_SIDE / 2), 0, 0);
	r.Inflate((GameSettings::SQUARE_SIDE / 2));
	
	_sliderRect = IRect(_snapPoint.x * GameSettings::SQUARE_SIDE,_snapPoint.y * GameSettings::SQUARE_SIDE - 30,200,30); 

	if (r.Contains(_snapPoint * GameSettings::SQUARE_SIDE)) 
	{
		return (-2);
	}
	else if (_sliderRect.Contains(IPoint(mx,my))) 
	{

		return (-3);
	}
	else 
	{
		return (-1);
	}
}
Example #13
0
int main(void) {
  const Mesh m(IPoint(MV::fill,2,2));
  Tensor<DataMesh> t(3,"aa",m ,0.0);
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){

      for(int k=0;k<m.Size();k++){
	srand ( time(NULL) );
	 t(i,j)[k]=rand()/((k+1)*10);

      }
    }


  }
 
  
  Tensor<DataMesh> inv = findInverse(t);
  Tensor<DataMesh> inv2 = findInverse(inv);
  
  checkInverse(inv,inv2);
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){

      
      std::cout<<inv(i,j)-inv2(i,j)<<std::endl;
    }
  }
  
  
  return EXIT_SUCCESS;
}
Example #14
0
	void Application::MouseWheelGL(int button, int dir, int x, int y) {
		float xx = (x * 1.f) / screen.Width() * screen.GLWidth();
		float yy = screen.GLHeight() - (y * 1.f) / screen.Height() * screen.GLHeight();
		if (dir != 0) {
			MouseWheel(dir, IPoint(xx, yy));
		}
	}
/**************************************************************************
* Class Star::setPoint - Sets the point where a star is located           *
**************************************************************************/
Star
 &Star::setPoint(const IGPoint2D &pt)
{
  setStartPoint(pt);
  setEndPoint(IPoint(pt.fX+1, pt.fY+1));
  return *this;
}
strgen::strgen(
      unsigned long id, 
      IWindow* parent, 
      IWindow* owner, 
      const IRectangle& rect, 
      const IFrameWindow::Style& style, 
      const char* title)
   : IFrameWindow((partWindowId) ? partWindowId : id, parent, owner, rect, style, title)
{
   partWindowId = (partWindowId) ? partWindowId : id;
   iCanvas = new ICanvas(
      IC_FRAME_CLIENT_ID, 
      this, 
      this, 
      IRectangle());
   iCollectionViewListBox1 = new ICollectionViewListBox< Customer*, IVSequence< Customer* > >(
      partWindowId+WNDOFFSET_strgen_CollectionViewListBox1, 
      iCanvas, 
      iCanvas, 
      IRectangle(IPoint(65,107),ISize(383, 183)), 
      IBaseListBox::defaultStyle ( ), 
      IStringGenerator<Customer*>(new strgen::strgenFn()));
   iStaticText1 = new IStaticText(
      partWindowId+WNDOFFSET_strgen_StaticText1, 
      iCanvas, 
      iCanvas, 
      IRectangle(IPoint(70,296),ISize(285, 25)));
   iCustomer1 = new Customer();
   iCustomer2 = new Customer();
   iVSequence1 = new IVSequence< Customer* >();

   conn0 = new strgenConn0();
   conn1 = new strgenConn1();
   conn2 = new strgenConn2();

   this->setFocus();
   this->setClient(iCanvas);
   iStaticText1->setText("Customer - CollectionViewListBox");
   iCustomer1->setName("John Smith");
   iCustomer1->setStreet("123 42nd Street");
   iCustomer1->setPhone("512-235-8212");
   iCustomer1->setCity("NewYork");
   iCustomer2->setName("Mike Lawrence");
   iCustomer2->setStreet("88 Columbus Ave");
   iCustomer2->setPhone("416-123-8888");
   iCustomer2->setCity("Ajax");
}     //end constructor
Example #17
0
void FillEnergyOrder::Draw(IPoint pos, bool vertical)
{
	if(!Completed())
	{
		Render::FreeType::BindFont("debug");
		Render::PrintString(pos + IPoint(GameSettings::SQUARE_SIDE*3/4, GameSettings::SQUARE_SIDE*3/4), utils::lexical_cast(_area.size()), 1.f, CenterAlign, CenterAlign);
	}
}
Example #18
0
void GridLayoutModule::mapGridLayout(const Graph &G,
	GridLayout &gridLayout,
	GraphAttributes &AG)
{
	// maximum width of columns and rows
	double maxWidth = 0;
	double yMax = 0;

	for(node v : G.nodes) {
		Math::updateMax<double>(maxWidth, AG.width(v));
		Math::updateMax<double>(maxWidth, AG.height(v));
		Math::updateMax<double>(yMax, gridLayout.y(v));
	}

	maxWidth += m_separation;

	// set position of nodes
	for(node v : G.nodes) {
		AG.x(v) = gridLayout.x(v) * maxWidth;
		AG.y(v) = (yMax - gridLayout.y(v)) * maxWidth;
	}

	// transform bend points of edges
	for(edge e : G.edges) {
		IPolyline ipl = gridLayout.polyline(e);

		// Remove superfluous bendpoints
		node v = e->source();
		while(!ipl.empty() && ipl.front() == IPoint(gridLayout.x(v), gridLayout.y(v))) {
			ipl.popFront();
		}
		v = e->target();
		while(!ipl.empty() && ipl.back() == IPoint(gridLayout.x(v), gridLayout.y(v))) {
			ipl.popBack();
		}

		DPolyline &dpl = AG.bends(e);
		dpl.clear();

		for (const IPoint &ip : ipl) {
			dpl.pushBack(DPoint(ip.m_x*maxWidth, (yMax-ip.m_y)*maxWidth));
		}

		dpl.normalize();
	}
}
Example #19
0
int main(void) {
  TensorStructure s(3,"ab");
  // Tensor<DataMesh> t1(s); // will fail to compile
  const Mesh m(IPoint(MV::fill,2,2));
  Tensor<DataMesh> t2(s,m); // will be fine
  Tensor<DataMesh> t3(s,m, 0.0); // this initializes all DataMesh points to zero
  Tensor<DataMesh> t4(3,"ab",m, 0.0); // this is the same as before
}
Example #20
0
 // Konstruktor f�r geschachtelte MDI-Fenster                                                                                                                       
 MDIFrame (const IResourceId &r,  IFrameWindow *parent,                                                                                                             
 const char *title = 0,   const IRectangle &rec = IRectangle (),                                                                                                    
 const IFrameWindow::Style &s =  defaultStyle () &~ windowList | alignNoAdjust) :                                                                                   
    IFrameWindow (r, parent->client (), parent->client (),                                                                                                          
    rec == IRectangle () ?   IRectangle (IPoint (), parent->client ()->size ()) : rec, s, title),                                                                   
    Client (0x8008, this, this)                                                                                                                                     
 {                                                                                                                                                                  
     setClient (&Client);                                                                                                                                           
 }                                                                                                                                                                  
void ChipSelecter::DrawRamka(int x, int y)
{
	//Тут должно быть 44х44!
	IRect rect = IRect(0,0,44,44);

	Render::device.SetTexturing(false);
	Render::DrawFrame(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)));
	Render::device.SetTexturing(true);
}
Example #22
0
 ToolButton (unsigned long id, IWindow *parent,                                                                                                    
                                             const IPointerHandle &pict) :                                                                         
         IGraphicPushButton (id, parent, parent, pict,                                                                                             
                 IRectangle (IPoint (), ISize (20, 20)),                                                                                           
                 // verkleinere Grafik falls n�tig                                                                                                 
                 defaultStyle () | sizeToGraphic)                                                                                                  
 // ISetCanvas benutzt Minimumgr��e um Controls zu                                                                                                 
 // Positionieren                                                                                                                                  
 { setMinimumSize (ISize (30, 30)); }                                                                                                              
LProdInfoDialog::LProdInfoDialog( IWindow *owner )
  :IFrameWindow( ID_PRODINFO, IWindow::desktopWindow(), owner,
                 IRectangle(),
                 IFrameWindow::systemMenu
                 | IFrameWindow::dialogBackground
                 | IFrameWindow::dialogBorder )
  ,canvas( ID_PRODINFO_CANVAS, this, this )
  ,iconCtl( ID_PRODINFO_ICON, &canvas, &canvas )
  ,text1( ID_PRODINFO_TEXT1, &canvas, &canvas )
  ,text2( ID_PRODINFO_TEXT2, &canvas, &canvas )
  ,text3( ID_PRODINFO_TEXT3, &canvas, &canvas )
  ,text4( ID_PRODINFO_TEXT4, &canvas, &canvas )
  ,text5( ID_PRODINFO_TEXT5, &canvas, &canvas )
  ,button( ID_PRODINFO_OK, &canvas, &canvas )
{
   // Set self as command event handler
   handleEventsFor(this);

   // Set text for the controls
   iconCtl.setIcon( ID_MAIN );
   text1.setText( IResourceId( STR_MAIN_TITLE ) );
   text1.setForegroundColor( IColor::kRed );
   text2.setText( IResourceId( STR_PRODINFO_TEXT2 ) );
   text3.setText( IResourceId( STR_PRODINFO_TEXT3 ) );
   text4.setText( IResourceId( STR_PRODINFO_TEXT4 ) );
   text5.setText( IResourceId( STR_PRODINFO_TEXT5 ) );
   button.setText( IResourceId( STR_OK ) );

   // Set the canvas orientation to veritical
   // Set the canvas alignment to center all the controls
   canvas.setDeckOrientation( ISetCanvas::vertical );
   canvas.setAlignment( ISetCanvas::centerCenter );

   // Set the client as the canvas
   setClient( &canvas );

/*-----------------------------------------------------------------------------
| Resize the window based on the minimum size of the canvas                   |
-----------------------------------------------------------------------------*/
   moveSizeToClient( IRectangle( IPoint(
                     IWindow::desktopWindow()->size().width()/2,
                     IWindow::desktopWindow()->size().height()/2 ),
                     canvas.minimumSize() ) );

/*-----------------------------------------------------------------------------
| Center the frame window                                                     |
-----------------------------------------------------------------------------*/
   moveSizeTo( rect().centerAt( IWindow::desktopWindow()->rect().center() ) );

/*-----------------------------------------------------------------------------
| Show the dialog window                                                      |
-----------------------------------------------------------------------------*/
   setFocus();
   show();

}
	void SpriteCardItem::init(Container* parent, rapidxml::xml_node<>* xml_item)
	{
		MapItem::init(parent, xml_item);

		rapidxml::xml_node<>* xml_info = xml_item->first_node("info");	
		IPoint offset(xml_info);
		Render::Texture *texture = Core::resourceManager.Get<Render::Texture>(Xml::GetStringAttribute(xml_info, "id"));
		rapidxml::xml_node<>* xml_rect = xml_info->first_node("rect");
		IRect screenRect(offset + IPoint(xml_rect), Xml::GetIntAttribute(xml_rect, "w"), Xml::GetIntAttribute(xml_rect, "h"));
		part = PartSheet(texture, screenRect, FRect(0.f, 1.f, 0.f, 1.f));
	}
	void DrawArrows()
	{
		//—трелы показывающие продолжение пол¤
		IPoint lines[4][3] = {	
			{Game::activeRect.RightBottom() + IPoint(1,-1), Game::activeRect.RightTop() + IPoint(1,1), IPoint(0,1)},
			{Game::activeRect.RightTop() + IPoint(1,1), Game::activeRect.LeftTop() + IPoint(-1,1), IPoint(-1,0)},
			{Game::activeRect.LeftTop() + IPoint(-1,1), Game::activeRect.LeftBottom() + IPoint(-1,-1), IPoint(0,-1)},
			{Game::activeRect.LeftBottom() + IPoint(-1,-1), Game::activeRect.RightBottom() + IPoint(1,-1), IPoint(1,0)}
		};
		float time = arrow_time*6.f;
		for(size_t i = 0; i < 4; i++)
		{
			for(IPoint p = lines[i][0], dir = lines[i][2]; p != lines[i][1]; p += dir)
			{
				Game::Square *sq = GameSettings::gamefield[p];
				//time += math::PI/2.f;
				if(!Game::isVisible(sq) || !(sq->IsFlyType(sq->FLY_NO_DRAW) || sq->IsFlyType(sq->FLY_HIDING)))
				{
					continue;
				}
				IPoint near_index = p + IPoint(-dir.y, dir.x);
				Game::Square *sq_near = GameSettings::gamefield[near_index];
				if(Game::isVisible(sq_near) && !sq_near->IsFlyType(Game::Square::FLY_NO_DRAW))
				{
					if(Gadgets::squareDist[p] > Gadgets::squareDist[near_index])
					{
						continue;
					}
					Render::device.PushMatrix();
					Render::device.MatrixTranslate(sq_near->GetCellPos() - FPoint(-dir.y, dir.x)*(GameSettings::SQUARE_SIDEF*0.47f + 2.f*sinf(time)) + GameSettings::CELL_HALF);
					Game::MatrixSquareScale();
					Render::device.MatrixRotate(math::Vector3(0.f, 0.f, 1.f), i*90.f);
					Render::device.MatrixScale(0.95f + 0.05f*sinf(time));
					Render::BeginAlphaMul(sq_near->_flyArrowAlpha*math::clamp(0.f, 1.f, 0.7f + 0.3f*sinf(time)));
					float offset_x = -27.f;
					arrow_texture->Draw(offset_x, -40.f);
					Render::EndAlphaMul();
					Render::device.PopMatrix();	

				}
			}
		}
	}
Example #26
0
bool PlanarGridLayoutModule::handleTrivial(const Graph &G, GridLayout &gridLayout, IPoint &boundingBox)
{
	// handle special case of graphs with less than 3 nodes
	node v1, v2;
	switch (G.numberOfNodes()) {
	case 0:
		boundingBox = IPoint(0, 0);
		return true;
	case 1:
		v1 = G.firstNode();
		gridLayout.x(v1) = gridLayout.y(v1) = 0;
		boundingBox = IPoint(0, 0);
		return true;
	case 2:
		v1 = G.firstNode();
		v2 = G.lastNode();
		gridLayout.x(v1) = gridLayout.y(v1) = gridLayout.y(v2) = 0;
		gridLayout.x(v2) = 1;
		boundingBox = IPoint(1, 0);
		return true;
	}
	return false;
}
void EnergyReceiver::LoadLevel(rapidxml::xml_node<>* root)
{
	_can_walk = Xml::GetBoolAttributeOrDef(root, "walk", false);
	SetIndex(IPoint(root->first_node("Position")));

	rapidxml::xml_node<>* orderElem = root->first_node("Order");
	if( orderElem )
	{
		_order = Game::Order::Load(orderElem);
		if(_order) {
			_order->SetAddress(_index);
		}
	}
	ReleaseEffects();
}
Example #28
0
 int main(void) {
   TensorStructure s1(3,"ab");
   TensorStructure s2(3,"b");
   const Mesh m(IPoint(MV::fill,2,2));
   Tensor<DataMesh> t1(s2,m,0.0); // will initialize all elements to zero
   Tensor<Tensor<DataMesh> > tt1(s1, t1); // will be a tensor of tensors, with all elements being zero
   Tensor<Tensor<DataMesh> > tt2(s1,s2, m, 0.0); // this gives the same result
   std::cout << "tt2(1,2)="<<tt2(1,2) <<"\n"; // will print out a Tensor<DataMesh>
   std::cout << "tt2(1,2)(0)="<<tt2(1,2)(0) <<"\n"; // will print out a single DatMesh
   // tt2(1,2) = 15; // will fail to compile
   tt2(1,2) = t1;    // this is fine
   tt2(1,2)(0) = -3; // will be fine.
  
   return EXIT_SUCCESS;
 }
Example #29
0
int main(void) {
  const IPoint extents(MV::Size(3), 10);
  const Mesh m(extents);
  DataMesh myDM(m);
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      for(int k=0; k<10; k++){
        myDM[myDM.DataOffset(IPoint(MV::fill, i, j, k))] = 1000*i + 100*j + 100000*k;
      }
    }
  }
  std::cout << "My datamesh:" <<myDM<<"\n";

  return EXIT_SUCCESS;
}
Example #30
0
void GameView::SpawnCatcher(const IPoint& position) {
	const GameInfo& gameInfo = Game::instance().GetGameInfo();
	CatchersPtr catcher = m_catcherPool.get();
	if (catcher) {
		catcher->Invalidate();
		catcher->SetPosition(IPoint(position.x, position.y));
		catcher->SetStartScale(.1f);
		catcher->SetEndScale(1.f);
		catcher->SetScale(.1f);
		catcher->SetLifetime(gameInfo.getCatcherBornTime() + gameInfo.getCatcherLifetime());
		catcher->SetGrowTime(gameInfo.getCatcherBornTime());
		catcher->SetHideTIme(gameInfo.getCatcherHidetime());
		m_catchers.push_back(std::move(catcher));
		MM::manager.PlaySample("hide_in", false, 1.f);
	}
}