realbasic-games
[Top] [All Lists]

Canvases sometimes black

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Canvases sometimes black
From: Troy Rollins <troy at rpsystems dot net>
Date: Sun, 26 Jun 2005 19:46:36 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
I have some code, which is painted to a canvas. I switched to Lars' buffer canvas today, but this problem occurs in a regular one and the buffered one. I'm pretty sure it is just me using it wrongly, but sometimes the same code will work, other times it will just fill the canvas with black.

The method which seems to be working, is the one I manually call periodically -

sub updateGameScreen()
  Dim g As Graphics = GD.GameCanvas1.Graphics

  g.DrawPicture(GameBack, 0 ,0) // this is a full frame PNG

  g.TextFont = "ARIAL"
  g.Bold = TRUE
  g.TextSize = 30
  g.forecolor = RGB(255, 255, 255)

  g.DrawString("Team : " + currentTeam, 10, 50)
  g.DrawString("Captain : " + currentCaptain, 10, 90)

GD.GameCanvas1.PaintBuffered() // if I don't use these all over, the frame gets filled with black

  g.forecolor = Team1Color
  g.DrawString( ControlWindow.TeamName(0).text, 250, 680)
  g.forecolor = Team2Color
  g.DrawString( ControlWindow.TeamName(1).text, 250, 740)

  GD.GameCanvas1.PaintBuffered()

  Dim tStyle As New StyledText
  tStyle = StyledTextIO.LoadStyledText( Qlist(1).styledQ )

// this is using an extension of graphics by J.J. at RS
  g.DrawStyledText( tStyle, 30, 160 , 960 )

--------------------------------------------------------------

However to make it work, I have to keep sprinkling GD.GameCanvas1.PaintBuffered() throughout. Is this normal, or am I just doing something pretty screwed up?

I have nothing in my paint event in the canvas. Do I need to? Something about persistence of background?

Sorry, I've been saving this part of my project till last, hoping to pick up enough familiarity with RB to have a clue, but, it seems I still need one. I don't have a good handle on how to employ canvases in a dynamic way. My goal is to use a single canvas into which I draw everything, rather than a bunch of canvases. It will include styled text, animation, and pictures.

I plan to look through some of the samples I've collected next, but thought I ask you guys as well.

Thanks for the pointers, as usual.

--
Troy
RPSystems, Ltd.
http://www.rpsystems.net

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>