예제 #1
0
		void ComboBox::render() {
			renderBackground();
			renderArrow();
			renderOverlay();

			Renderer* g = ARK2D::getRenderer();
			if (m_selected != NULL) {
				float tx = 0;
				float ty = 0;
				if (m_state == Button::STATE_DOWN || m_open) {
					tx += 2;
					ty += 2;
				}
				g->drawString(m_selected->m_text, tx, ty);
			}

			if (m_open) {
				int y = 0 + m_originalHeight;
				for(unsigned int i = 0; i < m_items.size(); i++) {
					m_items.at(i)->setLocation(0, y);
					y += m_items.at(i)->getHeight();
				}
				renderChildren();
			}
		}
예제 #2
0
파일: Main.cpp 프로젝트: vihei/GEMCAD-1
void renderCS()
{
	// x
	glPushMatrix();
	glColor3f(1, 0, 0); 
	renderArrow(Vec3f(0.0f, 0.0f, 0.0f), Vec3f(1.0f, 0.0f, 0.0f), 0.04f);
	glPopMatrix();
	// y
	glPushMatrix();
	glColor3f(0, 1, 0);
	renderArrow(Vec3f(0.0f, 0.0f, 0.0f), Vec3f(0.0f, 1.0f, 0.0f), 0.04f);
	glPopMatrix();
	// z
	glPushMatrix();
	glColor3f(0, 0, 1);
	renderArrow(Vec3f(0.0f, 0.0f, 0.0f), Vec3f(0.0f, 0.0f, 1.0f), 0.04f);
	glPopMatrix();
}
예제 #3
0
		void renderWireframe (Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld) const
		{
			renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly);
			renderer.addRenderable(m_renderAABBWire, localToWorld);
			renderArrow(renderer, volume, localToWorld);
			if (GlobalRegistry().get("user/ui/xyview/showEntityNames") == "1") {
				renderer.addRenderable(m_renderName, localToWorld);
			}
		}
예제 #4
0
void renderHEActive(const HalfEdge* he)
{
	if (!he || !he->startV || !he->nextHE || !he->nextHE->startV) return;
	Vec3f& p1 = he->startV->coordinates;
	Vec3f& p2 = he->nextHE->startV->coordinates;
	Vec3f dir = p2 - p1;
	float diameter = dir.length() / 40.0f;
	glColor3f(1.0f, 0.0f, 0.0f);
	renderArrow(p1 + 0.15f * dir, p2 - 0.15f * dir, diameter);
}
예제 #5
0
파일: generic.cpp 프로젝트: clbr/netradiant
 void renderWireframe(Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld) const
 {
   renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly);
   renderer.addRenderable(m_aabb_wire, localToWorld);
   renderArrow(renderer, volume, localToWorld);
   if(g_showNames)
   {
     renderer.addRenderable(m_renderName, localToWorld);
   }
 }
예제 #6
0
파일: ComboBox.cpp 프로젝트: DTwomey/ark2d
		void ComboBox::render() {
			renderBackground();
			renderArrow();
			renderOverlay();

			Renderer* g = ARK2D::getRenderer();
			if (m_selected != NULL) {
				g->drawString(m_selected->m_text, m_x, m_y);
			}

			if (m_open) {
				int y = m_y + m_originalHeight;
				for(unsigned int i = 0; i < m_items.size(); i++) {
					m_items.at(i)->setLocation(m_x, y);
					m_items.at(i)->render();
					y += m_items.at(i)->getHeight();
				}
			}
		}
예제 #7
0
파일: generic.cpp 프로젝트: clbr/netradiant
 void renderSolid(Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld) const
 {
   renderer.SetState(m_entity.getEntityClass().m_state_fill, Renderer::eFullMaterials);
   renderer.addRenderable(m_aabb_solid, localToWorld);
   renderArrow(renderer, volume, localToWorld);
 }
예제 #8
0
void MapperRoomRender::renderRoom(int x, int y, const Room *r)
{
   CRect rp( x, y, x+m_size, y+m_size );
   //CRect base(rp);
   int cs = m_csize;        // corridor size to draw (included)
   int ds = 2;              // doors offset to draw (included) -  x= lefx - ds, len = cs + ds + ds
   int rs = (cs- m_roomsizeDeflate) * 2;
   rp.DeflateRect(cs, cs, rs, rs);

   CRect bk(rp);
   bk.DeflateRect(2,2,0,0);

   HPEN old1 = m_hdc.SelectPen(m_black);
   rp.OffsetRect(1, 1);
   renderRect(rp.left,rp.top,rp.right-rp.left,rp.bottom-rp.top);
   rp.OffsetRect(-1, -1);
   m_hdc.SelectPen(m_white);
   renderRect(rp.left,rp.top,rp.right-rp.left,rp.bottom-rp.top);

   int offset = (rp.right - rp.left - cs) / 2;

   // start points for corridors - top, bottom, left, right
   int leftx = rp.left + offset;
   int topy = rp.top + offset;
   POINT ct = { leftx, rp.top };
   POINT cb = { leftx, rp.bottom };
   POINT cl = { rp.left, topy };
   POINT cr = { rp.right, topy };
  
   if (r->dirs[RD_NORTH].exist)
   {
       if (anotherZone(r, RD_NORTH))
       {
           int x0 = ct.x;
           int x = ct.x - ds;
           int y = ct.y - 1;
           int len = cs + ds + ds;
           m_hdc.SelectPen(m_exit);
           renderLine(x,y,len,0);
           renderLine(x,y+1,len,0);
           renderLine(x,y+2,len,0);
           m_hdc.SelectPen(m_exitL);
           renderLine(x0,y+1,cs,0);
       }
       else if (neighbor(r, RD_NORTH))
       {
           int x = ct.x;
           int x2 = x + cs;
           int y = ct.y;
           int len = -(cs+2);
          
           m_hdc.SelectPen(m_black);
           renderLine(x+1, y, 0, len);
           renderLine(x2, y, 0, len);
           m_hdc.SelectPen(m_white);
           renderLine(x, y, 0, len);
           renderLine(x2-1, y, 0, len);
           renderLine(x2, y, 1, 1);
           m_hdc.SelectPen(m_bkg);
           renderLine(x2-1, y+1, 1, 1);

           len = -(cs + 3);
           fillBkg(x + 2, y + 2, cs - 3, len); // затираем стенку
       }
       else
       {
           m_hdc.SelectPen(m_white);
           int x = ct.x + cs / 2;
           int y = ct.y;
           int dx = 0; int dy = 0;
           if (!calcDestOffset(dx, dy, r, RD_NORTH))
           {
               renderLine(x, y, 0, -3);
               renderLine(x+1, y, 0, -3);
           }
           else {
              dy = dy + rp.bottom-rp.top;
              renderArrow(x+dx, y+dy, -5, 5, 5, 4, 1, 0);
              renderLine(x, y, dx, dy);
              renderLine(x+1, y, dx, dy);
          }
       }
       if (r->dirs[RD_NORTH].door)
       {
          int x = ct.x - ds;
          int y = ct.y;
          int len = cs + ds + ds;
          m_hdc.SelectPen(m_door);
          renderLine(x, y, len, 0);
          m_hdc.SelectPen(m_black);
          renderLine(x,y+1,len,0);
       }
   }
   if (r->dirs[RD_SOUTH].exist)
   {
       if (anotherZone(r, RD_SOUTH))
       {
           int x0 = cb.x;
           int x = cb.x - ds;
           int y = cb.y + 1;
           int len = cs + ds + ds;
           m_hdc.SelectPen(m_exit);
           renderLine(x, y, len, 0);
           renderLine(x, y - 1, len, 0);
           renderLine(x, y - 2, len, 0);
           m_hdc.SelectPen(m_exitL);
           renderLine(x0, y - 1, cs, 0);
       }
       else if (neighbor(r, RD_SOUTH))
       {
           int x = cb.x;
           int x2 = x + cs;
           int y = cb.y;
           int len = cs + 2;
           m_hdc.SelectPen(m_black);
           renderLine(x + 1, y, 0, len);
           renderLine(x2, y, 0, len);
           m_hdc.SelectPen(m_white);
           renderLine(x, y, 0, len);
           renderLine(x2 - 1, y, 0, len);
           m_hdc.SelectPen(m_bkg);
           renderLine(x+1, y-1, 1, 1);

           len = cs + 3;
           fillBkg(x + 2, y - 2, cs-3, len); // затираем стенку
       }
       else 
       {
          m_hdc.SelectPen(m_white);
          int x = cb.x + cs / 2;
          int y = cb.y;
          int dx = 0; int dy = 0;
          if (!calcDestOffset(dx, dy, r, RD_SOUTH))
          {
              renderLine(x, y, 0, 3);
              renderLine(x+1, y, 0, 3);
          }
          else {
              dy = dy - (rp.bottom-rp.top);
              renderArrow(x+dx, y+dy, -5, -5, 5, -4, 1, 0);
              renderLine(x, y, dx, dy);
              renderLine(x+1, y, dx, dy);
          }
       }
       if (r->dirs[RD_SOUTH].door)
       {
           int x = cb.x - ds;
           int y = cb.y ;
           int len = cs + ds + ds;
           m_hdc.SelectPen(m_door);
           renderLine(x, y, len, 0);
           m_hdc.SelectPen(m_black);
           renderLine(x, y-1, len, 0);
        }
   }
   if (r->dirs[RD_WEST].exist)
   {
       if (anotherZone(r, RD_WEST))
       {
           int y0 = cl.y;
           int y = cl.y - ds;
           int x = cl.x + 1;
           int len = cs + ds + ds;
           m_hdc.SelectPen(m_exit);
           renderLine(x, y, 0, len);
           renderLine(x-1 , y, 0, len);
           renderLine(x-2, y, 0, len);
           m_hdc.SelectPen(m_exitL);
           renderLine(x-1, y0, 0, cs);
       }
       else if (neighbor(r, RD_WEST))
       {
           int x = cl.x;
           int y = cl.y;
           int y2 = cl.y + cs;
           int len = -(cs + 2);
           m_hdc.SelectPen(m_black);
           renderLine(x, y+1, len, 0);
           renderLine(x, y2, len, 0 );
           m_hdc.SelectPen(m_white);
           renderLine(x, y, len, 0);
           renderLine(x, y2-1, len, 0);
           renderLine(x, y2, 1, 1);
           m_hdc.SelectPen(m_bkg);
           renderLine(x + 1, y2 - 1, 1, 1);
           len = -(cs + 3);
           fillBkg(x+2, y + 2, len, cs - 3); // затираем стенку
       }
       else
       {
          m_hdc.SelectPen(m_white);
          int x = cl.x;
          int y = cl.y + cs / 2;
          int dx = 0; int dy = 0;
          if (!calcDestOffset(dx, dy, r, RD_WEST))
          {
              renderLine(x, y, -3, 0);
              renderLine(x, y+1, -3, 0);
          }
          else {
              dx = dx + rp.right-rp.left;
              renderArrow(x+dx, y+dy, 5, -5, 4, 5, -1, 0);
              renderLine(x, y, dx, dy);
              renderLine(x, y+1, dx, dy);
          }
       }
       if (r->dirs[RD_WEST].door)
       {
           int x = cl.x;
           int y = cl.y - ds;
           int len = cs + ds + ds;
           m_hdc.SelectPen(m_door);
           renderLine(x, y, 0, len);
           m_hdc.SelectPen(m_black);
           renderLine(x+1, y, 0, len);
       }
   }
   
   if (r->dirs[RD_EAST].exist)
   {
       if (anotherZone(r, RD_EAST)) 
       {
           int y0 = cr.y;
           int y = cr.y - ds;
           int x = cr.x - 1;
           int len = cs + ds + ds;
           m_hdc.SelectPen(m_exit);
           renderLine(x, y, 0, len);
           renderLine(x + 1, y, 0, len);
           renderLine(x + 2, y, 0, len);
           m_hdc.SelectPen(m_exitL);
           renderLine(x + 1, y0, 0, cs);
       }
       else if (neighbor(r, RD_EAST))
       {
           int x = cr.x;
           int y = cr.y;
           int y2 = cr.y + cs;
           int len = cs + 2;

           m_hdc.SelectPen(m_black);
           renderLine(x, y + 1, len, 0);
           renderLine(x, y2, len, 0);
           m_hdc.SelectPen(m_white);
           renderLine(x, y, len, 0);
           renderLine(x, y2 - 1, len, 0);
           m_hdc.SelectPen(m_bkg);
           renderLine(x-1 , y+1, 1, 1);
           len = cs + 3;
           fillBkg(x - 2, y + 2, len, cs - 3); // затираем стенку
       }
       else
       {
          m_hdc.SelectPen(m_white);
          int x = cr.x;
          int y = cr.y + cs / 2;
          int dx = 0; int dy = 0;
          if (!calcDestOffset(dx, dy, r, RD_EAST))
          {
              renderLine(x, y, 3, 0);
              renderLine(x, y+1, 3, 0);
          }
          else {
              dx = dx - (rp.right-rp.left);
              renderArrow(x+dx, y+dy, -5, -5, -4, 5, 0, 1);
              renderLine(x, y, dx, dy);
              renderLine(x, y+1, dx, dy);
          }
       }
       if (r->dirs[RD_EAST].door)
       {
           int x = cr.x;
           int y = cr.y - ds;
           int len = cs + ds + ds;
           m_hdc.SelectPen(m_door);
           renderLine(x, y, 0, len);
           m_hdc.SelectPen(m_black);
           renderLine(x - 1, y, 0, len);
       }
   }

   int bkw = bk.Width()-1; int bkh = bk.Height()-1;
   if (!r->selected) {
       if (!r->use_color)
           fillBkg(bk.left, bk.top, bkw, bkh );
       else
           fillColor(bk.left, bk.top, bkw, bkh, r->color);
   }
   else {
       fillColor(bk.left, bk.top, bkw, bkh, RGB(255, 255, 255));
   }
   
   if (r->icon > 0)
   {
       int icons_count = m_plist->GetImageCount();
       int icon_size = m_icons_size;
       int x = bk.left + (bk.Width() - icon_size) / 2 - 1;
       int y = bk.top + (bk.Height() - icon_size) / 2 - 1;
       if (r->icon <= icons_count)
       {
           HICON icon = m_plist->GetIcon(r->icon - 1);
           ::DrawIconEx(m_hdc, x, y, icon, icon_size, icon_size, 1, NULL, DI_NORMAL);
       }
   }

   int de = cs + 1;  // size up/down corridor
   if (r->dirs[RD_UP].exist)
   {
       int x = rp.left + 3;
       int y = rp.top + 3;
       int x2 = x + de;
       int y2 = y + de;

       m_hdc.SelectPen(m_black);
       renderLine(x2, y, 0, de);
       renderLine(x2, y2, -de, 0);
       m_hdc.SelectPen(m_white);
       renderLine(x,y2,0,-de);
       renderLine(x,y,de+1,0);

       if (r->dirs[RD_UP].door)
       {
           fillWhite(x+1,y+1,de-1,de-1);
       }
       else if (!r->dirs[RD_UP].next_room) // unknown room
       {
           fillBlack(x+1,y+1,de-1,de-1);
       }
       if (anotherZone(r, RD_UP))
       {
           fillExit(x+1,y+1,de-1,de-1);
           m_hdc.SelectPen(m_exitL);
           renderLine(x2, y, 0, de);
           renderLine(x2, y2, -de, 0);
           renderLine(x,y2,0,-de);
           renderLine(x,y,de+1,0);
       }
   }

   if (r->dirs[RD_DOWN].exist)
   {
       int x = rp.right - 3;
       int y = rp.bottom - 3;
       int x2 = x - de;
       int y2 = y - de;

       m_hdc.SelectPen(m_black);
       renderLine(x2, y, 0, -de);
       renderLine(x2, y2, de, 0);
       m_hdc.SelectPen(m_white);
       renderLine(x,y2,0,de);
       renderLine(x,y,-de-1,0);

       if (r->dirs[RD_DOWN].door)
       {
           fillWhite(x,y,-de+1,-de+1);
       }
       else if (!r->dirs[RD_DOWN].next_room) // unknown room
       {
          fillBlack(x,y,-de+1,-de+1);
       }
       if (anotherZone(r, RD_DOWN)) 
       {
           fillExit(x,y,-de+1,-de+1);
           m_hdc.SelectPen(m_exitL);
           renderLine(x2, y, 0, -de);
           renderLine(x2, y2, de, 0);
           renderLine(x,y2,0,de);
           renderLine(x,y,-de-1,0);
       }
   }
   m_hdc.SelectPen(old1);
}
예제 #9
0
파일: BoizStone.cpp 프로젝트: EwanMcA/Cards
void render()
{
	glClearColor(0.38f, 0.32f, 0.3f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	gluLookAt(0.0f, 0.0f, depth, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
	// Do this in the loading screen eventually...
	static GLuint bg_texture = load_texture("wood_grain.jpg");
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, bg_texture);
	///
	//if (gameData.is_my_turn()) { glColor3f(1.0f, 0.9f, 0.9f); }
	//else { glColor3f(0.8f, 0.8f, 1.0f); }
	glColor3f(1.0f, 0.9f, 0.9f);
	glBegin(GL_QUADS);
	glTexCoord2f(0, 0); glVertex3f(-2.2f, -1.4f, 0.0f);
	glTexCoord2f(0, 1); glVertex3f(-2.2f, 1.4f, 0.0f);
	glTexCoord2f(1, 1); glVertex3f(2.2f, 1.4f, 0.0f);
	glTexCoord2f(1, 0); glVertex3f(2.2f, -1.4f, 0.0f);
	glEnd();
	glDisable(GL_TEXTURE_2D);
	switch (gameData.get_game_state()) {
	case CHAT_SCREEN: 
		renderConnectionMenu(gameData.is_player_ready(), msg, messages);
		break;
	case  START_GAME:
		renderGameBoard(GLUT_WINDOW_WIDTH, GLUT_WINDOW_HEIGHT, gameData);
		// render something to see play order.
		break;
	case GAME:
		renderGameBoard(GLUT_WINDOW_WIDTH, GLUT_WINDOW_HEIGHT, gameData);
		for (auto const &it : player.hand) {
			renderCard(it.second, true, hoverCard == &it.second);
		}
		for (std::list<std::pair<int, CardHolder>>::iterator it = drawing_cards.begin(); it != drawing_cards.end(); ++it) {
			renderCard(it->second, true, false);
		}
		for (std::list<std::pair<int, CardHolder>>::iterator it = playing_cards.begin(); it != playing_cards.end(); ++it) {
			renderCard(it->second, true, false);
		}
		for (auto const &it : opponent.hand) {
			renderCard(it.second, false, hoverCard == &it.second);
		}
		for (auto const &it : opponent.in_play) {
			renderCard(it.second, true, (hoverCard == &it.second) || it.second.isAttackable());
		}
		for (auto const &it : player.in_play) {
			renderCard(it.second, true, hoverCard == &it.second);
		}
		for (std::list<std::pair<int, CardHolder>>::iterator it = drawing_cards_opponent.begin(); it != drawing_cards_opponent.end(); ++it) {
			renderCard(it->second, false, false);
		}
		for (std::list<std::pair<int, CardHolder>>::reverse_iterator it = playing_cards_opponent.rbegin(); it != playing_cards_opponent.rend(); ++it) {
			renderCard(it->second, true, false);
		}
		if (attack_drag) {
			renderArrow(attackingCard->getX()+0.075f, attackingCard->getY()+0.15f, 0.0f, arrow_head_x, arrow_head_y, 0.0f);
		}
		if (cardGrabbed) { renderCard(*hoverCard, true, true); }
		/*if (gameData.getPlayFirst()) {glColor3f(1.0, 0.0, 0.0);}
		else {glColor3f(0.0, 0.0, 1.0);}*/
		//glutSolidCube(0.1);
		break;
	};
	glutSwapBuffers();
}