   TextOut() issues and surfaces
  Hi,Im recently creating an RPG game and while the game is running, i want simple text to appear above certain characters, as if they are speaking.Im using ddraw and creating several surfaces to create the game.Anyway, if i use TextOut() function, i have an issue where the text appears to flicker. I believe this is because i need to apply it to the backbuffer surface.If im thinking right, this means that ill have to create another surface, load the text onto that surface (such as loading a bitmap of the text onto it), then Blt() that surface onto the backbuffer.Is this the only way of achieveing simple text without flickering? If there is another way, what is it? How can i achieve this without flickering?ThankyouP.S I know how to load a bitmap onto a surface but is there another way to get text onto a surface?   
  Backbuffers are used to avoid any kind of flickering (text or normal blts). If you're not getting flickering for things other than text you may just be lucky. IIRC creating a backbuffer in DDraw was quite easy, just add a flag to the primary surface creation and retrive the backbuffer pointer using a ddraw method. Render everything to the backbuffer and call swap each frame.   ;  Ok, ive created a back buffer and rendering the textout function to the backbuffer.I can now display text without flickering but its also causing my game to stall. Originally i was doing the following. Inside the main loop.lppdsBackBuffer->GetDC(&hdc);SetTextColor(hdc, RGB(255,0,0));TextOut(hdc, 0,0,"TEST", 4);lpddsBackBuffer->ReleaseDC(hdc);lpddsPrimaryBuffer->Flip(Null, DDFLIP_WAIT);I had that in the main loop so i chucked this linelppdsBackBuffer->GetDC(&hdc);outside of the main loop, in where i initialise my surfaces.However, that didnt show text at all and still stalled my game. Any other suggestions?   ;Quote:Original post by croselOk, ive created a back buffer and rendering the textout function to the backbuffer.I can now display text without flickering but its also causing my game to stall.What do you mean by stall - do you mean run more slowly? That may well be expected - GDI text drawing is slow compared to most game rendering.Quote:Any other suggestions?Perhaps the D3DX text functions would be better. It looks like you're using DirectDraw and that's rarely a good idea these days.;  yea it seems to slow my game down a great deal.Yes im using direct draw. I suppose i could try another approach. Im trying to make a old school RPG game, kinda like Final Fantasy. Would approach would you recommend i take?   ;Quote:Original post by croselyea it seems to slow my game down a great deal.Yes im using direct draw. I suppose i could try another approach. Im trying to make a old school RPG game, kinda like Final Fantasy. Would approach would you recommend i take?When you're getting the DC of the surface you're doing a lock, which is bound to be a tad slow. IIRC it also depends on the size and amount of text you draw. I'd rather use a bitmap font - tool - with color keying to draw properly transparent characters. Wrap it all up in a font class and you can use it when you switch to 3d graphics as well.   ;Quote:Original post by croselYes im using direct draw. I suppose i could try another approach. Im trying to make a old school RPG game, kinda like Final Fantasy. Would approach would you recommend i take?D3D or OpenGL, using textured quads instead of surfaces. You could use ID3DXFont to draw text (And it'll be much faster to draw), and won't need to use GDI at all. And you'll also get things like alpha blending and rotation for free, things that aren't really feasible in DDraw.   