Exemplo n.º 1
0
GuiElement::~GuiElement()
{
	if ( this->zGuiImage && GetGraphics()->IsRunning()) 
	{
		GetGraphics()->DeleteImage(this->zGuiImage);
		this->zGuiImage = NULL;
	}
	else if(this->zGuiImage && !GetGraphics()->IsRunning())
		throw("Image leaked!");
}
Exemplo n.º 2
0
void GuiManager::ShowCircularItemGui()
{
	if (this->zInventoryOpen)
	{
		//Check Collision
		if (!this->zCircularInventorySelectionOpen)
		{
			//Set Gui Position to Mouse Position
			Vector2 mousePosition = this->zEng->GetKeyListener()->GetMousePosition();
			Vector2 dimension = this->zInvCircGui->GetDimension();

			float x = mousePosition.x - dimension.x * 0.5f;
			float y = mousePosition.y - dimension.y * 0.5f;

			float windowWidth = (float)GetGraphics()->GetEngineParameters().WindowWidth;
			float windowHeight = (float)GetGraphics()->GetEngineParameters().WindowHeight;

			bool changeYPos = false;
			bool changeXPos = false;

			if(x  > windowWidth - dimension.x)
			{
				x = windowWidth - dimension.x;
				changeXPos = true;
			}
			else if(x < 0)
			{
				x = 0;
				changeXPos = true;
			}

			if(y > windowHeight - dimension.y)
			{
				y = windowHeight - dimension.y;
				changeYPos = true;
			}
			else if(y < 0)
			{
				y = 0;
				changeYPos = true;
			}

			if(changeXPos || changeYPos)
			{
				GetGraphics()->GetKeyListener()->SetMousePosition(Vector2(x + (dimension.x * 0.5f), y + (dimension.y * 0.5f)));
			}
			this->zInvCircGui->SetPosition(Vector2(x, y));

			//Show Gui
			this->zCircularInventorySelectionOpen = true;
			this->zInvCircGui->AddToRenderer(this->zEng);
		}
	}
}
Exemplo n.º 3
0
void CircularListGui::SetPosition( Vector2 pos )
{
	GuiElement::SetPosition(pos);

	float windowWidth = (float)(GetGraphics()->GetEngineParameters().WindowWidth);
	float windowHeight = (float)(GetGraphics()->GetEngineParameters().WindowHeight);

	float dx = ((float)windowHeight * 4.0f) / 3.0f;
	float offSet = (float)(windowWidth - dx) / 2.0f;

	zTextImagePos[0] = Vector2(pos.x + (60.0f / 1024.0f) * dx, pos.y + (60.0f / 768.0f) * windowHeight);
	zTextImagePos[1] = Vector2(pos.x + (140.0f / 1024.0f) * dx, pos.y + (60.0f / 768.0f) * windowHeight);
	zTextImagePos[2] = Vector2(pos.x + (60.0f / 1024.0f) * dx, pos.y + (140.0f / 768.0f) * windowHeight);
	zTextImagePos[3] = Vector2(pos.x + (140.0f / 1024.0f) * dx, pos.y + (140.0f / 768.0f) * windowHeight);
}
Exemplo n.º 4
0
void ConfirmPrompt::OnDraw()
{
	Graphics * g = GetGraphics();

	g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255);
}
Exemplo n.º 5
0
int main(){
  int i,newdata;
  
  if (Graphics) GUI();

  init();
  while (!done){
    if (Graphics){
      Events(newdata);
      GetGraphics();
      DrawGraphs();
    } else {done=1;Pause=0;}
    if (!Pause||sstep){
      sstep=0;
      newdata=1;
      for (i=0;i<Repeat;i++){
	iterations++;
	circleBC();
	iteration();
	iterationColloid();
	TotMomentum();
	analysis(iterations);
      }
    } else sleep(1);
  }
  return 0;
}
Exemplo n.º 6
0
void SignWindow::OnDraw()
{
	Graphics * g = GetGraphics();

	g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255);
}
Exemplo n.º 7
0
_Use_decl_annotations_
StaticLevelData* AssetLoader::LoadStaticLevel(const char* filename) const
{
    char source[MAX_PATH];
    sprintf_s(source, "%s%s", GetConfig().ContentRoot, filename);

    // TODO: Replace this with real level data file

    GeometryFileData data;
    LoadGeometryFileData(source, &data);

    uint32_t numMaterials = data.NumMaterials;
    std::unique_ptr<MaterialSource[]> materials(new MaterialSource[numMaterials]);

    MaterialSource* material = materials.get();
    for (uint32_t i = 0; i < numMaterials; ++i, ++material)
    {
        strcpy_s(material->Diffuse, data.MaterialTextures[i]);
    }

    StaticLevelData* level = new StaticLevelData(GetGraphics().GetContext(), reinterpret_cast<StaticGeometryVertex*>(data.Vertices), data.NumVertices, data.Indices, data.NumIndices, materials, numMaterials, 256 * 1024 * 1024);

    FreeGeometryFileData(&data);

    return level;
}
Exemplo n.º 8
0
int PBLineEdit::OnDraw(bool force)
{
	PBGraphics *graphics;

	if (IsVisible() && (IsChanged() || force) && (graphics = GetGraphics()) != NULL)
	{
		graphics->FillArea(GetClientLeft() + PBEDIT_BORDER,
				   GetClientTop() + PBEDIT_BORDER,
				   GetClientWidth() - (PBEDIT_BORDER << 1),
				   GetClientHeight() - (PBEDIT_BORDER << 1),
				   WHITE);

		if (m_text[0])
		{
			SetFont(m_font, BLACK);
			graphics->DrawTextRect(GetClientLeft() + PBEDIT_BORDER,
					       GetClientTop() + PBEDIT_BORDER,
					       GetClientWidth() - (PBEDIT_BORDER << 1),
					       GetClientHeight() - (PBEDIT_BORDER << 1),
					       m_text,
					       ALIGN_LEFT | VALIGN_MIDDLE | DOTS);
		}

		graphics->DrawRect(GetLeft(), GetTop(), GetWidth(), GetHeight(), BLACK);
	}
	return 0;
}
Exemplo n.º 9
0
void ErrorMessage::OnDraw()
{
	Graphics * g = GetGraphics();

	g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255);
}
Exemplo n.º 10
0
int tcButtonConsole::Draw() 
{
    if (tcSoundConsole::Draw())
    {
        Gdiplus::Graphics *graphics;
        if (!GetGraphics(graphics)) 
        {   
            std::cerr << "Failed to get Graphics object in tcButtonConsole::Draw()" << std::endl;  
            return 0;
        } 
        /**
        size_t nButtons = buttons.size();
        for(size_t n=0;n<nButtons;n++)
        {
            buttons[n]->Draw(graphics);
        }
        */
        DrawChildren(graphics);
        ReleaseGraphics(graphics);
        return 1;
    }
    else
    {
        return 0;
    }
}
Exemplo n.º 11
0
int PBProgressBar::OnDraw(bool force)
{
    int drawBarWidth, drawBarHeight, leftSideWidth, rightSideWidth;

	if ( IsVisible() && (IsChanged() || force) )
    {
		PBGraphics *graphics = GetGraphics();
		graphics->DrawRect(GetLeft(), GetTop(), GetWidth(), GetHeight(), BLACK);

		if (m_value)
		{
			drawBarWidth = GetWidth() - (m_rectOffset << 1);
			drawBarHeight = GetHeight() - (m_rectOffset << 1);
			leftSideWidth = m_value ? (drawBarWidth * m_value) / 100 : 0;
			rightSideWidth = m_value != 100 ? (drawBarWidth - leftSideWidth) : 0;

			if (leftSideWidth)
				graphics->DimArea(GetLeft() + m_rectOffset, GetTop() + m_rectOffset, leftSideWidth, drawBarHeight, BLACK);

			if (rightSideWidth)
				graphics->FillArea(GetLeft() + m_rectOffset + leftSideWidth,  GetTop() + m_rectOffset, rightSideWidth, drawBarHeight, WHITE);
		}
    }
    return 0;
}
Exemplo n.º 12
0
	//----------------------------------------------------------------------------------
	//
	//----------------------------------------------------------------------------------
	DepthBuffer_Imp::DepthBuffer_Imp(Graphics* graphics, Vector2DI size)
		: DeviceObject(graphics)
		, m_size(size)
	{
		auto g = (Graphics_Imp*) GetGraphics();
		g->IncVRAM(m_size.X * m_size.Y * 4);
	}
Exemplo n.º 13
0
//-----------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------
void VertexBuffer_Imp_DX11::Unlock()
{
	auto g = (Graphics_Imp_DX11*) GetGraphics();

	assert(m_isLock || m_ringBufferLock);

	if (m_isLock)
	{
		if (m_isDynamic)
		{
			D3D11_MAPPED_SUBRESOURCE mappedResource;
			g->GetContext()->Map(
				m_buffer,
				0,
				D3D11_MAP_WRITE_DISCARD,
				0,
				&mappedResource);

			memcpy(mappedResource.pData, m_resource, m_offset);

			g->GetContext()->Unmap(m_buffer, 0);
		}
		else
		{
			g->GetContext()->UpdateSubresource(
				m_buffer,
				0,
				nullptr,
				m_resource,
				m_offset,
				0
				);
		}
	}

	if (m_ringBufferLock)
	{
		D3D11_MAPPED_SUBRESOURCE mappedResource;
		g->GetContext()->Map(
			m_buffer,
			0,
			m_ringLockedOffset != 0 ? D3D11_MAP_WRITE_NO_OVERWRITE : D3D11_MAP_WRITE_DISCARD,
			0,
			&mappedResource);

		uint8_t* dst = (uint8_t*) mappedResource.pData;
		dst += m_ringLockedOffset;

		uint8_t* src = (uint8_t*) m_resource;
		src += m_ringLockedOffset;

		memcpy(dst, src, m_ringLockedSize);

		g->GetContext()->Unmap(m_buffer, 0);
	}

	m_resource = NULL;
	m_isLock = false;
	m_ringBufferLock = false;
}
Exemplo n.º 14
0
void DropDown::Draw(const Point& screenPos)
{
	if(!drawn)
	{
		if(optionIndex!=-1)
			TextPosition(options[optionIndex].first);
		drawn = true;
	}
	Graphics * g = GetGraphics();
	Point Position = screenPos;

	ui::Colour textColour = Appearance.TextInactive;
	ui::Colour borderColour = Appearance.BorderInactive;
	ui::Colour backgroundColour = Appearance.BackgroundInactive;

	if (isMouseInside)
	{
		textColour = Appearance.TextHover;
		borderColour = Appearance.BorderHover;
		backgroundColour = Appearance.BackgroundHover;
	}
	else
	{
		textColour = Appearance.TextInactive;
		borderColour = Appearance.BorderInactive;
		backgroundColour = Appearance.BackgroundInactive;
	}

	g->fillrect(Position.X-1, Position.Y-1, Size.X+2, Size.Y+2, backgroundColour.Red, backgroundColour.Green, backgroundColour.Blue, backgroundColour.Alpha);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha);
	if(optionIndex!=-1)
		g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, options[optionIndex].first, textColour.Red, textColour.Green, textColour.Blue, textColour.Alpha);
}
void ColourPickerActivity::OnDraw()
{
	Graphics * g = GetGraphics();
	//g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
	g->fillrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3, 0, 0, 0, currentAlpha);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);

	g->drawrect(Position.X+4, Position.Y+4, 258, 130, 180, 180, 180, 255);

	g->drawrect(Position.X+4, Position.Y+4+4+128, 258, 12, 180, 180, 180, 255);


	int offsetX = Position.X+5;
	int offsetY = Position.Y+5;


	//draw color square
	int lastx = -1, currx = 0;
	for(int saturation = 0; saturation <= 255; saturation+=2)
	{
		for(int hue = 0; hue <= 359; hue++)
		{
			currx = clamp_flt(hue, 0, 359)+offsetX;
			if (currx == lastx)
				continue;
			lastx = currx;
			int cr = 0;
			int cg = 0;
			int cb = 0;
			HSV_to_RGB(hue, 255-saturation, currentValue, &cr, &cg, &cb);
			g->blendpixel(currx, (saturation/2)+offsetY, cr, cg, cb, currentAlpha);
		}
	}

	//draw brightness bar
	for(int value = 0; value <= 255; value++)
		for(int i = 0;  i < 10; i++)
		{
			int cr = 0;
			int cg = 0;
			int cb = 0;
			HSV_to_RGB(currentHue, currentSaturation, value, &cr, &cg, &cb);

			g->blendpixel(value+offsetX, i+offsetY+127+5, cr, cg, cb, currentAlpha);
		}

	//draw color square pointer
	int currentHueX = clamp_flt(currentHue, 0, 359);
	int currentSaturationY = ((255-currentSaturation)/2);
	g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY-1);
	g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY+1, offsetX+currentHueX, offsetY+currentSaturationY+5);
	g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX-1, offsetY+currentSaturationY);
	g->xor_line(offsetX+currentHueX+1, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY);

	//draw brightness bar pointer
	int currentValueX = restrict_flt(currentValue, 0, 254);
	g->xor_line(offsetX+currentValueX, offsetY+4+128, offsetX+currentValueX, offsetY+13+128);
	g->xor_line(offsetX+currentValueX+1, offsetY+4+128, offsetX+currentValueX+1, offsetY+13+128);
}
Exemplo n.º 16
0
void FileBrowserActivity::OnDraw()
{
	Graphics * g = GetGraphics();

	//Window Background+Outline
	g->clearrect(Position.X-2, Position.Y-2, Size.X+4, Size.Y+4);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);
}
Exemplo n.º 17
0
void CMeshCoordinate::render(const Vec3D& vCoordShow)
{
	{
		init();
	}
	CRenderSystem& R = CRenderSystem::getSingleton();
	CGraphics& G=GetGraphics();

	R.setWorldMatrix(getWorldMatrix());

	R.SetShader("Coordinate1");
	SetMeshSource();
	draw();

	G.DrawLine3D(m_CoordLines[CLT_X].vBegin,m_CoordLines[CLT_X].vEnd,vCoordShow.x>0?COORD_SELECT_COLOR:COORD_X_COLOR);
	G.DrawLine3D(m_CoordLines[CLT_X_Y].vBegin,m_CoordLines[CLT_X_Y].vEnd,(vCoordShow.x>0&&vCoordShow.y>0)?COORD_SELECT_COLOR:COORD_X_COLOR);
	G.DrawLine3D(m_CoordLines[CLT_X_Z].vBegin,m_CoordLines[CLT_X_Z].vEnd,(vCoordShow.x>0&&vCoordShow.z>0)?COORD_SELECT_COLOR:COORD_X_COLOR);

	G.DrawLine3D(m_CoordLines[CLT_Y].vBegin,m_CoordLines[CLT_Y].vEnd,vCoordShow.y>0?COORD_SELECT_COLOR:COORD_Y_COLOR);
	G.DrawLine3D(m_CoordLines[CLT_Y_X].vBegin,m_CoordLines[CLT_Y_X].vEnd,(vCoordShow.x>0&&vCoordShow.y>0)?COORD_SELECT_COLOR:COORD_Y_COLOR);
	G.DrawLine3D(m_CoordLines[CLT_Y_Z].vBegin,m_CoordLines[CLT_Y_Z].vEnd,(vCoordShow.y>0&&vCoordShow.z>0)?COORD_SELECT_COLOR:COORD_Y_COLOR);

	G.DrawLine3D(m_CoordLines[CLT_Z].vBegin,m_CoordLines[CLT_Z].vEnd,vCoordShow.z>0?COORD_SELECT_COLOR:COORD_Z_COLOR);
	G.DrawLine3D(m_CoordLines[CLT_Z_X].vBegin,m_CoordLines[CLT_Z_X].vEnd,(vCoordShow.x>0&&vCoordShow.z>0)?COORD_SELECT_COLOR:COORD_Z_COLOR);
	G.DrawLine3D(m_CoordLines[CLT_Z_Y].vBegin,m_CoordLines[CLT_Z_Y].vEnd,(vCoordShow.y>0&&vCoordShow.z>0)?COORD_SELECT_COLOR:COORD_Z_COLOR);


	R.SetShader("Coordinate2");
	if (vCoordShow.x>0&&vCoordShow.y>0)
	{
		//	G.fillQuad(Vec3D(0,0,0),m_CoordLines[CLT_X_Y].vBegin,m_CoordLines[CLT_X_Y].vEnd,m_CoordLines[CLT_Y_X].vBegin,COORD_PLANE_COLOR);
	}
	if (vCoordShow.y>0&&vCoordShow.z>0)
	{
		//	G.fillQuad(Vec3D(0,0,0),m_CoordLines[CLT_Y_Z].vBegin,m_CoordLines[CLT_Y_Z].vEnd,m_CoordLines[CLT_Z_Y].vBegin,COORD_PLANE_COLOR);
	}
	if (vCoordShow.z>0&&vCoordShow.x>0)
	{
		//	G.fillQuad(Vec3D(0,0,0),m_CoordLines[CLT_Z_X].vBegin,m_CoordLines[CLT_Z_X].vEnd,m_CoordLines[CLT_X_Z].vBegin,COORD_PLANE_COLOR);
	}

// 	R.SetBlendFunc(true);
// 	R.SetTextureColorOP(0,TBOP_MODULATE);
// 	R.SetTextureAlphaOP(0,TBOP_MODULATE);

	//int nFontHeight = GetTextRender().GetCharHeight();
	//Pos2D posScreen;
	//R.world2Screen(getWorldMatrix()*Vec3D(1.0f,0.0f,0.0f),posScreen);
	//GetTextRender().drawText(L"X",posScreen.x,posScreen.y-nFontHeight,vCoordShow.x>0?COORD_SELECT_COLOR:COORD_X_COLOR);

	//R.world2Screen(getWorldMatrix()*Vec3D(0.0f,1.0f,0.0f),posScreen);
	//GetTextRender().drawText(L"Y",posScreen.x,posScreen.y-nFontHeight,vCoordShow.y>0?COORD_SELECT_COLOR:COORD_Y_COLOR);

	//R.world2Screen(getWorldMatrix()*Vec3D(0.0f,0.0f,1.0f),posScreen);
	//GetTextRender().drawText(L"Z",posScreen.x,posScreen.y-nFontHeight,vCoordShow.z>0?COORD_SELECT_COLOR:COORD_Z_COLOR);
}
Exemplo n.º 18
0
void PBListBox::DrawSelect(int index, int color)
{
	if (index >= m_listOffset && index < (m_listOffset + calcListCapacity()))
	{
		PBGraphics *graphics = GetGraphics();
		graphics->DrawSelection(GetClientLeft() + PBLIST_BORDER,
							GetClientTop() + PBLIST_BORDER + (index - m_listOffset) * m_itemHeight,
							GetClientWidth() - (PBLIST_BORDER << 1),
							m_itemHeight, color);
	}
}
Exemplo n.º 19
0
int PBListBox::OnDraw(bool force)
{
    int elem_iter;
    int elem_render_count, elem_count;

	if ( IsVisible() && (IsChanged() || force) && m_font)
    {
		PBGraphics *graphics = GetGraphics();

		if (m_properties & DRAW_BORDER)
			graphics->DrawRect(GetLeft(), GetTop(), GetWidth(), GetHeight(), BLACK);

		graphics->FillArea(GetClientLeft() + PBLIST_BORDER, GetClientTop() + PBLIST_BORDER, GetClientWidth() - (PBLIST_BORDER << 1), GetClientHeight() - (PBLIST_BORDER << 1), WHITE);

		elem_count = count();
		elem_render_count = calcListCapacity();

		// corect elements for render
		if (elem_render_count > elem_count)
			elem_render_count = elem_count;

		if (elem_render_count)
		{
			if (m_AutoScroll)
			{
				if (elem_render_count < elem_count)
				{
					if (m_listOffset > m_selected) m_listOffset = m_selected;
					if (m_selected > (m_listOffset + elem_render_count)) m_listOffset = m_selected - elem_render_count;
				}
			}
			else m_AutoScroll = 1;

			updateScrollBar();

			if (m_selected != -1)
				DrawSelect(m_selected, BLACK);

			SetFont(m_font, BLACK);
			elem_iter = 0;
			while( elem_iter <  elem_render_count)
			{
				graphics->DrawTextRect(GetClientLeft() + (PBLIST_BORDER << 2),
									   GetClientTop() + PBLIST_BORDER + elem_iter * m_itemHeight,
									   GetClientWidth() - (PBLIST_BORDER << 3),
									   m_itemHeight,
									   text(elem_iter + m_listOffset), // m_stringList[elem_iter + m_listOffset].c_str(),
									   ALIGN_LEFT | VALIGN_MIDDLE | DOTS);
				elem_iter++;
			}
		}
    }
	return 0;//PBWindow::Draw();
}
Exemplo n.º 20
0
public func GetMenuInvIcon()
{
	var gfx = GetGraphics();
	var offset = 0;

	if(gfx == "Amulet")
		offset = 1;
	if(gfx == "Crown")
		offset = 2;

	return Format("{{%i:%d}}",GetID(),offset);
}
void ElementSearchActivity::OnDraw()
{
	Graphics * g = GetGraphics();
	g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);

	g->drawrect(Position.X+searchField->Position.X, Position.Y+searchField->Position.Y+searchField->Size.Y+8, searchField->Size.X, Size.Y-(searchField->Position.Y+searchField->Size.Y+8)-23, 255, 255, 255, 180);
	if (toolTipPresence && toolTip.length())
	{
		g->drawtext(10, Size.Y+70, (char*)toolTip.c_str(), 255, 255, 255, toolTipPresence>51?255:toolTipPresence*5);
	}
}
Exemplo n.º 22
0
bool App::CreateWorld()
{
	m_pkCamera	= NULL;
	m_hSphere	= NULL;

	// COMMENT : Create and setup camera
	m_pkCamera	= new FreeCamera(GetGraphics());
	if(false == m_pkCamera->CreateRenderCamera(GetWindowWidth(), GetWindowHeight())) {return false;}
	m_pkCamera->CalculateProjection(CORE3D_PI * 0.5f, 10.0f, 0.1f);
	m_pkCamera->SetPosition(C3DVECTOR3(0.0f, 0.0f, -2.0f));
	m_pkCamera->SetLookAt(C3DVECTOR3(0.0f, 0.0f, 0.0f), C3DVECTOR3(0.0f, 1.0f, 0.0f));
	m_pkCamera->CalculateView();

	// COMMENT : Register board entity and create an instance
	GetScene()->RegisterEntityType(_T("DisplacedSphere"), &Core3D::CreateDisplacedSphere);
	m_hSphere	= GetScene()->CreateEntity(_T("DisplacedSphere"));
	if(NULL == m_hSphere) {return false;}

	DisplacedSphere* pkSphere = static_cast<DisplacedSphere*>(GetScene()->GetEntity(m_hSphere));
	if(false == pkSphere->Initialize(1.0f, 12, 12, _T("earth.png"))) {return false;}

	// COMMENT : Enable Core3D's subdivision stage, which will be the base for displacement mapping.
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONMODE, Core3D::SUBDIV_ADAPTIVE);
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONLEVELS, 1);

	const C3DFLOAT32 fSubdivisionMaxScreenArea = 14.0f * 14.0f; // Triangles larger than 14x14 square-pixels will be subdivided.
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONMAXSCREENAREA, *(C3DUINT32*)&fSubdivisionMaxScreenArea);
	GetGraphics()->SetRenderState(Core3D::RS_SUBDIVISIONMAXINNERLEVELS, 2);
	
	GetGraphics()->SetRenderState(Core3D::RS_FILLMODE, Core3D::FILL_WIREFRAME);

	return true;
}
Exemplo n.º 23
0
void LocalSaveActivity::OnDraw()
{
	Graphics * g = GetGraphics();
	g->draw_rgba_image(save_to_disk_image, 0, 0, 0.7f);
	g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);

	if(thumbnail)
	{
		g->draw_image(thumbnail.get(), Position.X+(Size.X-thumbnail->Width)/2, Position.Y+45, 255);
		g->drawrect(Position.X+(Size.X-thumbnail->Width)/2, Position.Y+45, thumbnail->Width, thumbnail->Height, 180, 180, 180, 255);
	}
}
Exemplo n.º 24
0
	void RenderedCameraObject3D::Flip(float deltaTime)
	{
		RenderedObject3D::Flip(deltaTime);

		proxy->ZNear = m_values.znear;
		proxy->ZFar = m_values.zfar;
		proxy->FOV = m_values.fov;
		proxy->Focus = m_values.focus;
		proxy->SetWindow(GetGraphics(), m_values.size, m_values.hdrMode);

		proxy->postEffectCount = m_values.postEffectCount;

		proxy->m_postEffectCommands_RT = m_postEffectCommands;
	}
Exemplo n.º 25
0
void WebEditBox::EnsureCursorVisible (void)
{
	WebGraphics *gc = GetGraphics();
	WebFont font = mFont.GetFont();

	if (gc && font && mpText)
	{
		DISPLAY_INT cursorX = gc->TextWidthLen(mpText + GetLineOffset(miCurrentLine), font, miCursorPos - GetLineOffset(miCurrentLine)) - miXOffset;
		DISPLAY_INT cursorY = WEB_FONT_HEIGHT(font)*miCurrentLine - miYOffset;
		WebRect box;

		GetTextRect(&box);

		cursorX += box.left;
		cursorY += box.top;

		if (cursorY < box.top)
		{
			miYOffset -= (box.top - cursorY);
		}
		else if ((cursorY + WEB_FONT_HEIGHT(font)) > box.bottom)
		{
			miYOffset += (cursorY + WEB_FONT_HEIGHT(font)) - box.bottom;
		}

		if (cursorX > box.right)
		{
			// overshoot by a bit
			miXOffset += cursorX - box.right + 10;
		}
		else if (cursorX < box.left)
		{
			miXOffset -= (box.left - cursorX);
		}

		if (mpVScroll)
		{
			mpVScroll->SetPosition(miYOffset);
		}

		if (mpHScroll)
		{
			mpHScroll->SetPosition(miXOffset);
		}

		mEditFlags &= ~EDIT_FLAG_ENSURE_CURSOR_VISIBLE;
	}
}
Exemplo n.º 26
0
void ServerSaveActivity::OnDraw()
{
	Graphics * g = GetGraphics();
	g->draw_rgba_image(save_to_server_image, -10, 0, 0.7f);
	g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
	g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255);

	if(Size.X>220)
		g->draw_line(Position.X+(Size.X/2)-1, Position.Y, Position.X+(Size.X/2)-1, Position.Y+Size.Y-1, 255, 255, 255, 255);

	if(thumbnail)
	{
		g->draw_image(thumbnail.get(), Position.X+(Size.X/2)+((Size.X/2)-thumbnail->Width)/2, Position.Y+25, 255);
		g->drawrect(Position.X+(Size.X/2)+((Size.X/2)-thumbnail->Width)/2, Position.Y+25, thumbnail->Width, thumbnail->Height, 180, 180, 180, 255);
	}
}
Exemplo n.º 27
0
void SignWindow::DoDraw()
{
	for(std::vector<sign>::iterator iter = sim->signs.begin(), end = sim->signs.end(); iter != end; ++iter)
	{
		sign & currentSign = *iter;
		int x, y, w, h, dx, dy;
		String::value_type type = 0;
		Graphics * g = GetGraphics();
		String text = currentSign.getText(sim);
		sign::splitsign(currentSign.text, &type);
		currentSign.pos(text, x, y, w, h);
		g->clearrect(x, y, w+1, h);
		g->drawrect(x, y, w+1, h, 192, 192, 192, 255);
		if (!type)
			g->drawtext(x+3, y+3, text, 255, 255, 255, 255);
		else if(type == 'b')
			g->drawtext(x+3, y+3, text, 211, 211, 40, 255);
		else
			g->drawtext(x+3, y+3, text, 0, 191, 255, 255);

		if (currentSign.ju != sign::None)
		{
			x = currentSign.x;
			y = currentSign.y;
			dx = 1 - currentSign.ju;
			dy = (currentSign.y > 18) ? -1 : 1;
#ifdef OGLR
			glBegin(GL_LINES);
			glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
			glVertex2i(x, y);
			glVertex2i(x+(dx*4), y+(dy*4));
			glEnd();
#else
			for (int j=0; j<4; j++)
			{
				g->blendpixel(x, y, 192, 192, 192, 255);
				x+=dx;
				y+=dy;
			}
#endif
		}
	}
	if(!signMoving)
	{
		ui::Window::DoDraw();
	}
}
Exemplo n.º 28
0
_Use_decl_annotations_
void AssetLoader::LoadMipsIntoLocation(const char* filename, uint32_t sourceStartingMip, uint32_t numMips, const ComPtr<ID3D11Texture2D>& dest, uint32_t destIndex, uint32_t destStartingMip) const
{
    char source[MAX_PATH];
    sprintf_s(source, "%s%s", GetConfig().ContentRoot, filename);

    ImageFileData data;
    LoadImageFileData(source, &data);

    ComPtr<ID3D11Device> device;
    dest->GetDevice(&device);

    ComPtr<ID3D11DeviceContext> context;
    device->GetImmediateContext(&context);

    D3D11_TEXTURE2D_DESC desc;
    dest->GetDesc(&desc);

    assert(destStartingMip + numMips <= desc.MipLevels);
    assert(sourceStartingMip + numMips <= (uint32_t)data.MipCount);

    uint8_t* dataSrc = (uint8_t*)data.Data;
    uint32_t dataHeight = data.Height;
    uint32_t dataPitch = data.Pitch;

    // advance to source starting mip
    for (uint32_t i = 0; i < sourceStartingMip; ++i)
    {
        dataSrc += static_cast<uint32_t>(dataPitch * dataHeight);
        dataHeight /= 2;
        dataPitch /= 2;
    }

    auto lock = GetGraphics().LockContext();

    for (uint8_t i = 0; i < numMips; ++i)
    {
        context->UpdateSubresource(dest.Get(), D3D11CalcSubresource(destStartingMip + i, destIndex, numMips), nullptr, dataSrc, dataPitch, static_cast<uint32_t>(dataPitch * dataHeight));
        dataSrc += static_cast<uint32_t>(dataPitch * dataHeight);
        dataHeight /= 2;
        dataPitch /= 2;
    }
}
Exemplo n.º 29
0
void WebDropBox::SetManager(DisplayManager* manager)
{
	DisplayElement::SetManager(manager);

	WebGraphics* gc = GetGraphics();
	if (gc)
	{
		WebBitmap downArrow = gc->GetBitmapByIndex(WGB_DOWN_ARROW);
		mButton.SetDefaultBitmap(downArrow);
		mButton.SetDownBitmap(downArrow);
		mButton.SetOverBitmap(downArrow);
		if (downArrow)
		{
			mButton.SetWidth(10 + WEB_BITMAP_WIDTH(downArrow));
            /* Now set the slider width to be the same as the button width, so they line up */
			mListbox.SetSliderWidth(mButton.mRect.Width());
		}
	}
}
Exemplo n.º 30
0
int PBImage::OnDraw(bool force)
{
	if (IsVisible() && (IsChanged() || force))
	{
		PBGraphics *graphics = GetGraphics();
		if (m_Fill)
			graphics->FillArea(GetLeft(), GetTop(), GetWidth(), GetHeight(), m_Background);
		if (m_BW)
		{
			graphics->DrawBitmapRectBW(GetClientLeft(), GetClientTop(), GetClientWidth(), GetClientHeight(), GetBitmap(), GetProperties());
		}
		else
		{
			graphics->DrawBitmapRect(GetClientLeft(), GetClientTop(), GetClientWidth(), GetClientHeight(), GetBitmap(), GetProperties());
		}
	}
	
	return 0;
}