Dynamic Drawing with the SceneBuffer..

Started by Draco9898, July 11, 2006, 08:54:55 PM

Previous topic - Next topic

Draco9898

Wow, this has caused me a HUGE headache,

I'm trying to use CopyRect to dynamically copy chunks of one loaded image to another  that acts like image buffer that I draw to the screen (Since CopyRect has no camera/scene support)...

It changes every game loop fine, but I wanted to use it over and over in For X loops to create nice looking 'fill' bars, but DrawImage only recogizes the LASt copy of it every loop when I use SceneCapturing..., no matter how many times you clear it or change it...

At first I thought I got my co-ordanites wrong, then maybe the image number, then maybe my varibles might have been wrong...


My only work around I've thought of is create a 'filler' bar buffer image for every single character...which is a pain...but oh well



`IT seems you can't dynamically clear an image and draw it over and over
`differently with a camera and scenebuffer...

CreateImage 1,72,72
CreateCamera 1
While Spacekey()=0
CaptureToScene:ClsScene
For X=1 to 12
RenderToImage 1
 Cls RGB(X*22, 147, 107)
RenderToScreen
DrawImage 1,72+(X*82),72,1
Next X
DrawCamera 1
Sync
EndWhile

DeleteCamera 1
FlushKeys


`But Without it...you can?

While Spacekey()=0
For X=1 to 12
RenderToImage 1
 Cls RGB(X*22, 147, 107)
RenderToScreen
DrawImage 1,72+(X*82),72,1
Next X
Sync
EndWhile

End
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

kevin

A scene is a list of drawn items to a single surface.  You can not capture surfaces changes.  

I.e.
CaptureToScene
RendertoIMage 10
drawstaff
rendertoimage 0
etc

From your description and subsequent example, I can't work out what your trying to do ?

Draco9898

#2
QuoteA scene is a list of drawn items to a single surface.  You can not capture surfaces changes. 

I.e.
CaptureToScene
RendertoIMage 10
drawstaff
rendertoimage 0
etc

From your description and subsequent example, I can't work out what your trying to do ?

Yes, something like that, ok, thanks. I feel like a big dummy, kinda what I was suspecting :)

I'm trying to render dynamic Health bars using just two images and CopyRect...

but I'll just have 60 different images loaded instead that have the health bar in different positions that I can draw everywhere

or...

I could give every character on the screen their own additional health bar image to render into...probably would be easier
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

Ian Price

Why can't you just create a box/bar for the amount of heatlth remaining?


; PROJECT : Project1
; AUTHOR  : Ian
; CREATED : 13/07/2006
; ---------------------------------------------------------------------

; Health variable
health=100

; Set colour for health bar
r=255
g=100
b=100

while not esckey()

  ink rgb(255,255,255)
 
 ; White box around bar
  box 18,18,123,42,0

 ; Energy bar (change the 100 value to change colour of bar)
for n=0 to health
   ink rgb(r-(100-n),g-(100-n),b-(100-n))
 line n+20,20,n+20,40
next

 ; Increase/decrease bar using LEFT and RIGHT cursors
  if rightkey() and health<100 then health=health+1
  if leftkey() and health>0 then health=health-1

sync

cls rgb(0,0,0)
endwhile
I came. I saw. I played some Nintendo.

Draco9898

1. It's reletively expendsive
2. I can draw a much better looking bar
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

Ian Price

You could always create an image for the bar, then drawing over bar with the mask colour using RenderToImage. I personally thought my example looked better than yours, but you know what you want.

My code wasn't that expensive on CPU time - how much other stuff is going on in your game?

Nice negative reply on the whole. Not sure why I bothered offering assistance now...
I came. I saw. I played some Nintendo.

Draco9898

#6
Sorry Ian, I really do appreciate it, I was busy that day

QuoteYou could always create an image for the bar, then drawing over bar with the mask colour using RenderToImage. I personally thought my example looked better than yours, but you know what you want.

My code wasn't that expensive on CPU time - how much other stuff is going on in your game?

Nice negative reply on the whole. Not sure why I bothered offering assistance now...

That might work, however Im not sure Id work, due to the samething mentioned above: Rendering to the same image and drawing it with changes doesnt work with scenes.

I've already fixed the issue by just making 60 different images of the HP changes...

Thanks the help...sorry it have rubbed you the wrong way
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin