예제 #1
0
DWORD PisteDraw_Videomuistia()
{
	DDCAPS hel_caps, hal_caps;

	DD_INIT_STRUCT(hel_caps);
	DD_INIT_STRUCT(hal_caps);	
	
	if (FAILED(PD_lpdd->GetCaps(&hal_caps,&hel_caps)))	
	{
		strcpy(virhe,"Cannot aquire system information!");
		return PD_VIRHE;
	}
	
	return hal_caps.dwVidMemFree;
}
예제 #2
0
DWORD PisteDraw_Videomuistia_Max()
{
	DDCAPS hel_caps, hal_caps;

	DD_INIT_STRUCT(hel_caps);
	DD_INIT_STRUCT(hal_caps);	
	
	if (FAILED(PD_lpdd->GetCaps(&hal_caps,&hel_caps)))	
	{
		strcpy(virhe,"Cannot aquire system information!");
		PisteLog_Kirjoita("[Error] Piste Draw: Cannot aquire system information! \n");
		return PD_VIRHE;
	}

	return hal_caps.dwVidMemTotal;
}
예제 #3
0
int PisteDraw_Buffer_Uusi(int leveys, int korkeus, bool video_muisti, UCHAR color)
{
	int i = 0, 
		varaus;
	bool find = false;

	DDCAPS hel_caps, hal_caps;

	DD_INIT_STRUCT(hel_caps);
	DD_INIT_STRUCT(hal_caps);

	if (FAILED(PD_lpdd->GetCaps(&hal_caps,&hel_caps)))	
	{
		strcpy(virhe,"Cannot aquire system information!");
		PisteLog_Kirjoita("[Error] Piste Draw: Cannot aquire system information to create a new buffer! \n");
		return PD_VIRHE;
	}

	if ((unsigned long)(leveys*korkeus) > hal_caps.dwVidMemFree) {		//tarkastetaan riittääkö videomuistia
		video_muisti = false;
		PisteLog_Kirjoita("[Warning] Piste Draw: Out of video memory - creating a new buffer in system memory! \n");
	}

	if (video_muisti)
	{
		varaus = DDSCAPS_VIDEOMEMORY;
	}
	else
	{
		varaus = DDSCAPS_SYSTEMMEMORY;
	}

	while ((i < MAX_BUFFEREITA) && !find)
	{
		if (PD_buffers[i].lpdds == NULL)	// Onko puskurin pinta jo varattu?
		{
			if ((PD_buffers[i].lpdds = PisteDraw_Create_Surface(leveys, korkeus, varaus, color)) != NULL)
			{
				PD_buffers[i].leveys			= leveys;
				PD_buffers[i].korkeus			= korkeus;
				PD_buffers[i].klipperi.left		= 0;
				PD_buffers[i].klipperi.top		= 0;
				PD_buffers[i].klipperi.right	= leveys;
				PD_buffers[i].klipperi.bottom	= korkeus;
				PD_buffers[i].video_muisti		= video_muisti;
				PD_buffers[i].lukittu			= false;
				find = true;
				PD_buffereita_varattu++;
			}
			else
			{
				i = PD_VIRHE;
				strcpy(virhe,"Cannot create a new DirectDraw surface!");
				PisteLog_Kirjoita("[Error] Piste Draw: Cannot create a new DirectDraw surface! \n");
			}
		}
		else
		{
			i++;
		}
	}
	
	if (!find)
	{
		strcpy(virhe,"PisteEngine has run out of buffers!");
		PisteLog_Kirjoita("[Error] Piste Draw: PisteDraw has run out of buffers! \n");
		i = PD_VIRHE;
	}

	return i;
}