Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - PeeJay

#16
Nope, it's just you, my senile old friend! However, I would agree that SHOWMOUSE TRUE/FALSE would be a more logical command ....
#17
2D / Re: DrawSpriteRect
2009-Sep-08
Polyvector will do that for you .... and more besides (like lighting effects)  :good:
#18
Extremely useful, yes, for repetitive tiled backgrounds, but also for parallax scrolls (as it fills the viewport, and the offset can be used for the scroll effect)

This is taken from the BB helpfile (as Ian explained, TileImage / TileBlock are basically the same command, just with the latter ignoring transparency)


Code (glbasic) Select
TileImage handle,[x],[y],[frames]
Definition
Tiles the screen with an image (or its frames) of your choice. 

Parameters
handle= variable holding the image's handle
x=starting x location of the tile; assumed 0
y=starting y location of the tile; assumed 0
frames=the frame of the image to tile; optional with imagestrip 

Description
If you want to make a starfield or other easy tiled background, this is YOUR command. All you have to do is specify the image handle (an image loaded with the LoadImage or LoadAnimImage command). Optionally, you can specify a starting x and y location, as well as an optional frame. You can milk some serious parallax effects with a simple imagestrip with a couple of various starfields and the TileImage command. 

Example
; CreateImage/TileImage/ImageBuffer example

; Again, we'll use globals even tho we don't need them here
; One variable for the graphic we'll create, one for a timer
Global gfxStarfield, tmrScreen

; Declare graphic mode
Graphics 640,480,16

; Create a blank image that is 320 pixels wide and 32 high with 10 frames of 32x32
gfxStarfield=CreateImage(32,32,10)

; loop through each frame of the graphic we just made
For t = 0 To 9
; Set the drawing buffer to the graphic frame so we can write on it
SetBuffer ImageBuffer(gfxStarfield,t)
; put 50 stars in the frame at random locations
For y = 1 To 50
Plot Rnd(32),Rnd(32)
Next
Next

; Double buffer mode for smooth screen drawing
SetBuffer BackBuffer()

; Loop until ESC is pressed
While Not KeyHit(1)

; Only update the screen every 300 milliseconds. Change 300 for faster or
; slower screen updates
If MilliSecs() > tmrScreen+300 Then
Cls ; clear the screen

; Tile the screen with a random frame from our new graphic starting at
; x=0 and y=0 location.
TileImage gfxStarfield,0,0,Rnd(9)
Flip ; Flip the screen into view
tmrScreen=MilliSecs() ; reset the time
End If
Wend


You thinking of adding it then, Gernot?  =D
#19
Check your inbox  :x
#20
Hiya John

You might find it useful to have a quick look on my site - there are tutorials on there - you may find the Highway tutorial very useful, especially bearing in mind I wrote that shortly after switching from Blitz to GL myself.

Unfortunately, there isn't a direct translation type lookup table, as there are some things that there is no direct equivalent for (eg Blitz has TILEBLOCK, with no equivalent in GL ..... I miss that! GL has POLYVECTOR, with no equivalent in BB)

Hope that helps ....
#21
There is an even easier way of deleting all entries of a type - using the above example, simply doing
Code (glbasic) Select
DIM _TBoss1[0]
will save all that messing about with the FOR...NEXT loop
#22
Good idea! Failing that, Babelfish is just as good - http://babelfish.yahoo.com/
#23
Well, if you draw a screen and do a SHOWSCREEN right at the start of your code (ie before all of the sprites are loaded, arrays set up - that kind of thing) you hardly notice the "Loading" message at all...
#24
No need to be embarrassed, Gerfy - we've all made silly mistakes from time to time, and it's usually the really obvious problems that leave us scratching our heads wondering what the hell is going wrong! =D
#25
Though if you have had her for 17 years, at least you can benefit from the scrappage scheme ..... =D
#26
I'm not here, I'm over there
#27
Okie dokie, let's take these one step at a time ....

1) You can use separate screens (see CREATESCREEN), but, to be honest, there is no need - GL Basic is that fast at drawing, it shouldn't be necessary to predraw screens. If you want, say, 4 totally different screens, I'd be tempted to put each drawing system in it's own function, and then call that function as and when you want it.

2) You can grab an RGB pixel from the backbuffer only - but there is nothing stopping you from drawing to the backbuffer, grabbing your pixel, then redrawing the backbuffer, and then FLIPping the backbuffer into view - GL Basic is easily fast enough for that. However, and this is a biggie - do NOT rely on GETPIXEL to be 100% accurate - especially given that different people will be running their desktops at different colour depths.

3) There is no single command for Amiga style copper bars, but since this effect is very easy to achieve manually, there's not that much point, really!

Welcome to GL Basic - once you start playing around, you'll be hooked - and there's always people around on here for help and advice .....
#28
Er, this must be a trick question! Obviously, GL Basics users on a GL Basic forum are going to recommend GL Basic!

However, in answer to your question, yes, GL Basic will allow you to get graphics up and running quickly, and, speaking for myself, having come from Blitz Basic (and, in turn, before that I used Dark Basic) I have found that GL Basic offers eveything you need, and since it compiles to C, it runs quickly on low end machines (or in comparison to what I have used in the past)

Of course, any high end language does have limitations (I am basing this on my background as a Sinclair Basic / Z80 assembler coder) - I feel sure that coding in Open GL could achieve more than using GL Basic - but I have yet to find anything I have wanted to do that GL Basic can't handle.
#29
I'm another one who is a huge fan of code folding, but I have a workaround that I use (which may be helpful?)

During dev, I have 2 source files in the project - one for "working", and one that I dump completed functions into - that means that once I have a function done and working properly, I can move it out of the way, so I don't end up scrolling around hugs chunks of code ....
#30
Welcome aboard Havard!

I know that this is going to be well beneath the level of coding you are at, but you may find the tutorials on my site useful (probably more the Highway one) to give you some ideas of nice layout and program control - and bear in mind these were written just after I had made the switch from Blitz to GL myself