本文整理汇总了C++中LPDIRECTDRAWPALETTE::SetEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWPALETTE::SetEntries方法的具体用法?C++ LPDIRECTDRAWPALETTE::SetEntries怎么用?C++ LPDIRECTDRAWPALETTE::SetEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWPALETTE
的用法示例。
在下文中一共展示了LPDIRECTDRAWPALETTE::SetEntries方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PisteDraw_Paletti_Pyorita
int PisteDraw_Paletti_Pyorita(UCHAR eka_vari, UCHAR vika_vari)
{
UCHAR i;
if (FAILED(PD_lpddpal->GetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette get entries failed!\n");
return PD_VIRHE;
}
PALETTEENTRY temp_vari;
temp_vari.peRed = PD_paletti_nyt[vika_vari].peRed;
temp_vari.peGreen = PD_paletti_nyt[vika_vari].peGreen;
temp_vari.peBlue = PD_paletti_nyt[vika_vari].peBlue;
for (i=vika_vari;i>eka_vari;i--)
{
PD_paletti_nyt[i].peRed = PD_paletti_nyt[i-1].peRed;
PD_paletti_nyt[i].peGreen = PD_paletti_nyt[i-1].peGreen;
PD_paletti_nyt[i].peBlue = PD_paletti_nyt[i-1].peBlue;
}
PD_paletti_nyt[eka_vari].peRed = temp_vari.peRed;
PD_paletti_nyt[eka_vari].peGreen = temp_vari.peGreen;
PD_paletti_nyt[eka_vari].peBlue = temp_vari.peBlue;
if (FAILED(PD_lpddpal->SetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette set entries failed!\n");
return PD_VIRHE;
}
return 0;
}
示例2: PisteDraw_Paletti_Set
int PisteDraw_Paletti_Set(void)
{
if (FAILED(PD_lpddpal->SetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette set failed!\n");
return PD_VIRHE;
}
return 0;
}
示例3: ReloadPrimarySurfacePaletteEntries
void ReloadPrimarySurfacePaletteEntries()
{
if (!primary_surface_palette_ref)
return;
HRESULT err;
ddrawPaletteSetEntries.Unhook();
if (FAILED(err = primary_surface_palette_ref->SetEntries(0, 0, numEntries, entries)))
{
logOutput << CurrentTimeString() << "ReloadPrimarySurfacePaletteEntries(): could not set entires" << endl;
printDDrawError(err);
}
ddrawPaletteSetEntries.Rehook();
}
示例4: Set_Palette_Entry
int Set_Palette_Entry(int index, int red, int blue, int green)
{
PALETTEENTRY colour;
colour.peRed = (BYTE)red;
colour.peGreen = (BYTE)green;
colour.peBlue = (BYTE)blue;
colour.peFlags = PC_NOCOLLAPSE;
lpddpal->SetEntries(0,index,1,&colour);
memcpy(&colour_palette[index], &colour, sizeof(PALETTEENTRY));
return 1;
}
示例5: screen_updatepalette
static void screen_updatepalette(void)
{
HRESULT ret;
int idx;
if (!lpDDPal)
return;
//log("screen_updatepalette\n");
// for (idx = 1; idx < 17; idx ++)
// DD_RGBTOPAL(idx, win_rgbmap[idx]);
/* ret = lpDDPal->SetEntries(0, 0, 17, pals+rand()%16);
if (ret != DD_OK)
error(_("videoupdatepalette: SetPalette failed (%d)\n"), ret);*/
for (idx = 0; idx < 17; idx ++)
DD_RGBTOPAL(idx, win_rgbmap[idx]);
ret = lpDDPal->SetEntries(0, 0, 17, pals);
if (ret != DD_OK)
module_logger(&win32DirectDrawVideo, _L|LOG_ERROR|LOG_USER, _("videoupdatepalette: SetPalette failed (%d)\n"), ret);
}
示例6: PaletteSetEntries
HRESULT STDMETHODCALLTYPE PaletteSetEntries(LPDIRECTDRAWPALETTE palette, DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
{
//logOutput << CurrentTimeString() << "Hooked SetEntries()" << endl;
ddrawPaletteSetEntries.Unhook();
HRESULT hr = palette->SetEntries(dwFlags, dwStartingEntry, dwCount, lpEntries);
ddrawPaletteSetEntries.Rehook();
// update buffer palette
if (SUCCEEDED(hr))
{
if (g_CurrentPalette.bInitialized)
{
memcpy(g_CurrentPalette.entries + dwStartingEntry, lpEntries, 4 * dwCount); // each entry is 4 bytes if DDCAPS_8BITENTRIES flag is not set
}
}
return hr;
}
示例7: PisteDraw_Fade_Paletti_Do
int PisteDraw_Fade_Paletti_Do(int pros)
{
UCHAR i;
if (FAILED(PD_lpddpal->GetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette get entries failed!\n");
return PD_VIRHE;
}
for (i=0;i<255;i++)
{
PD_paletti_nyt[i].peRed = (PD_paletti[i].peRed * pros / 100);
PD_paletti_nyt[i].peGreen = (PD_paletti[i].peGreen * pros / 100);
PD_paletti_nyt[i].peBlue = (PD_paletti[i].peBlue * pros / 100);
}
if (FAILED(PD_lpddpal->SetEntries(0,0,255,PD_paletti_nyt))) {
PisteLog_Kirjoita("[Error] Piste Draw: Palette set entries failed!\n");
return PD_VIRHE;
}
return 0;
}
示例8: failed
static void win_SetFullScreenMode(void)
{
HRESULT ret;
// log("win_SetFullScreenMode\n");
if (lpDD)
{
/* get exclusive mode (for fullscreen and memory locking access) */
ret = lpDD->SetCooperativeLevel(hWndScreen,
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT |
DDSCL_ALLOWMODEX);
if (ret != DD_OK)
DDFAIL(_("SetCooperativeLevel failed (%d)\n"), ret);
/* Set our video mode */
ret = lpDD->SetDisplayMode(fsx, fsy, 8, 0, DDSDM_STANDARDVGAMODE);
if (ret != DD_OK)
DDFAIL(_("SetDisplayMode\n"), ret);
/* Use our palette */
if (lpDDPal)
{
ret = lpDDPal->SetEntries(0 /*flags */, 0, 256, pals);
if (ret != DD_OK)
DDFAIL(_("SetEntries failed (%d)\n"), ret);
}
#warning fix this later
// adjust rect for text mode!
screenrect.left = 0;
screenrect.top = 0;
screenrect.right = 256;
screenrect.bottom = 192;
}
}
示例9: Game_Init
int Game_Init(void *parms = NULL, int num_parms = 0)
{
// this is called once after the initial window is created and
// before the main event loop is entered, do all your initialization
// here
// create IDirectDraw interface 7.0 object and test for error
if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))
return(0);
// set cooperation to full screen
if (FAILED(lpdd->SetCooperativeLevel(main_window_handle,
DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX |
DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)))
return(0);
// set display mode to 640x480x8
if (FAILED(lpdd->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,0,0)))
return(0);
// we need a complex surface system with a primary and backbuffer
// clear ddsd and set size
DDRAW_INIT_STRUCT(ddsd);
// enable valid fields
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
// set the backbuffer count field to 1, use 2 for triple buffering
ddsd.dwBackBufferCount = 1;
// request a complex, flippable
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
// create the primary surface
if (FAILED(lpdd->CreateSurface(&ddsd, &lpddsprimary, NULL)))
return(0);
// now query for attached surface from the primary surface
// this line is needed by the call
ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
// get the attached back buffer surface
if (FAILED(lpddsprimary->GetAttachedSurface(&ddsd.ddsCaps, &lpddsback)))
return(0);
// build up the palette data array
for (int color=1; color < 255; color++)
{
// fill with random RGB values
palette[color].peRed = rand()%256;
palette[color].peGreen = rand()%256;
palette[color].peBlue = rand()%256;
// set flags field to PC_NOCOLLAPSE
palette[color].peFlags = PC_NOCOLLAPSE;
} // end for color
// now fill in entry 0 and 255 with black and white
palette[0].peRed = 0;
palette[0].peGreen = 0;
palette[0].peBlue = 0;
palette[0].peFlags = PC_NOCOLLAPSE;
palette[255].peRed = 255;
palette[255].peGreen = 255;
palette[255].peBlue = 255;
palette[255].peFlags = PC_NOCOLLAPSE;
// create the palette object
if (FAILED(lpdd->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256 |
DDPCAPS_INITIALIZE,
palette,&lpddpal, NULL)))
return(0);
// finally attach the palette to the primary surface
if (FAILED(lpddsprimary->SetPalette(lpddpal)))
return(0);
// set clipper up on back buffer since that's where well clip
RECT screen_rect= {0,0,SCREEN_WIDTH-1,SCREEN_HEIGHT-1};
lpddclipper = DDraw_Attach_Clipper(lpddsback,1,&screen_rect);
// load the 8-bit image
if (!Load_Bitmap_File(&bitmap,"alley8.bmp"))
return(0);
// load it's palette into directdraw
if (FAILED(lpddpal->SetEntries(0,0,MAX_COLORS_PALETTE,bitmap.palette)))
return(0);
// clean the surfaces
DDraw_Fill_Surface(lpddsprimary,0);
DDraw_Fill_Surface(lpddsback,0);
// create the buffer to hold the background
lpddsbackground = DDraw_Create_Surface(640,480,0,-1);
// copy the background bitmap image to the background surface
//.........这里部分代码省略.........
示例10: PisteDraw_Lataa_Kuva
int PisteDraw_Lataa_Kuva(int index, char *filename, bool lataa_paletti)
{
BITMAP_FILE bitmap;
bool ok = false;
char paate[4];
for (int i=0;i<4;i++)
paate[i] = toupper(filename[strlen(filename)-3+i]);
paate[4] = '\0';
if (strcmp(paate,"BMP")==0)
{
ok = true;
if (PD_buffers[index].lpdds)
{
if (PisteDraw_Load_Bitmap(&bitmap, filename) != 0)
{
strcpy(virhe,"Could not load picture ");
strcat(virhe,filename);
strcat(virhe,"!");
PisteLog_Kirjoita("[Error] Piste Draw: ");
PisteLog_Kirjoita(virhe);
PisteLog_Kirjoita("\n");
return PD_VIRHE;
}
DD_INIT_STRUCT(PD_ddsd);
if (FAILED(PD_buffers[index].lpdds->Lock(NULL,&PD_ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,NULL)))
{
strcpy(virhe,"Could not lock surface after loading a picture!");
PisteLog_Kirjoita("[Error] Piste Draw: Could not lock surface after loading a picture! \n");
return PD_VIRHE;
}
UCHAR *back_buffer = (UCHAR *)PD_ddsd.lpSurface;
int x;
int y;
int leveys, korkeus;
if (bitmap.bitmapinfoheader.biWidth > PD_buffers[index].leveys)
leveys = PD_buffers[index].leveys;
else
leveys = bitmap.bitmapinfoheader.biWidth;
if (bitmap.bitmapinfoheader.biHeight > PD_buffers[index].korkeus)
korkeus = PD_buffers[index].korkeus;
else
korkeus = bitmap.bitmapinfoheader.biHeight;
for (y=0; y<korkeus; y++)
{
for (x=0; x<leveys; x++)
{
back_buffer[x+y*PD_ddsd.lPitch] = bitmap.buffer[x+y*bitmap.bitmapinfoheader.biWidth];
}
}
if (FAILED(PD_buffers[index].lpdds->Unlock(NULL)))
{
strcpy(virhe,"Could not unlock surface after loading a picture!");
PisteLog_Kirjoita("[Error] Piste Draw: Could not unlock surface after loading a picture! \n");
return PD_VIRHE;
}
PisteDraw_Unload_Bitmap_File(&bitmap);
if (lataa_paletti)
{
if (FAILED(PD_lpddpal->SetEntries(0,0,PD_max_varit, bitmap.paletti)))
{
strcpy(virhe,"Could not set palette after loading a picture!");
PisteLog_Kirjoita("[Error] Piste Draw: Could not set palette after loading a picture! \n");
return PD_VIRHE;
}
for (int pi=0;pi<256;pi++)
{
PD_paletti[pi].peBlue = bitmap.paletti[pi].peBlue;
PD_paletti[pi].peRed = bitmap.paletti[pi].peRed;
PD_paletti[pi].peGreen = bitmap.paletti[pi].peGreen;
PD_paletti[pi].peFlags = bitmap.paletti[pi].peFlags;
}
}
}
else
return PD_VIRHE;
}
if (strcmp(paate,"PCX")==0)
{
ok = true;
if (PisteDraw_Lataa_PCX(filename, index, lataa_paletti) == PD_VIRHE) {
//.........这里部分代码省略.........