Flickering.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • USBZ0r
    New Member
    • Mar 2009
    • 20

    Flickering.

    Hi guys, im using DrawString to write some text over a game's screen. The problem is because im having to run it on a timer, realtime (to keep the text on the game screen or will will dissapear) its causing the written text to flicker. iv done some googling about something for forms called backbuffer, but iv enabled that for my forms but it seems to be only for Forms. Also one of my text boxes gets updated and that flickers too.

    Wondering if someone knows a simple solution. Maybe a way to freeze the text on the screen and only change it when the value updates?

    Thanks

    Here's my Drawstring code

    Code:
            private void timer2_Tick(object sender, EventArgs e)
            {
                string kills = txtBoxkills.Text
                IntPtr hWnd = WinApi.FindWindowA("WindowName", null);
                IntPtr hDC = WinApi.GetDC(hWnd);
                Graphics memDC = Graphics.FromHdc(hDC);
                memDC.DrawString(kills, new Font("Arial", 15, FontStyle.Bold), Brushes.Blue, new PointF(10, 100));
                WinApi.ReleaseDC(hWnd, hDC);
            }
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    I think the problem is the overall design. For a game putting standard controls like textboxes on top of the graphics is always going to do this.

    Might want to look at DirectX for this.

    Or look at the design of this. I have no idea how you are producing the "game screen". Is it a picture box with a bunch of text boxes on top for example?

    Maybe the solution is to build the game screen in memory, draw all the text data on the image, then draw that entire composited image to the screen for the user - doing it all in rapid succession.

    Comment

    • USBZ0r
      New Member
      • Mar 2009
      • 20

      #3
      the game is Call of duty "directx game" but i figured this might have an issue with it due to the framerate or whatever. i did think directx was the answer, guess il have to learn directX then! :D

      Thanks

      Comment

      Working...