GLBasic forum

Main forum => GLBasic - en => Topic started by: fjsantosb on 2010-Feb-19

Title: Change 'hot spot' of sprite and Drawline thickness
Post by: fjsantosb on 2010-Feb-19
Hi there,

I wonder is there is a way to drawsprite by his center, i mean any way to change the 'hot spot' of the sprite.
I know I can use offsets to draw the sprite where must be, but I wonder is there is any method to change this.

In the other hand i wonder is there is any way to change the thickness of drawline (I would like to draw lines more thickness).

Thanks in advance,

Kig Regards, fjsantos.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: MrTAToad on 2010-Feb-19
Would be nice, but the only commands that use a different hotspot are those that rotate a sprite (at which point the centre of the sprite is used).
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: Kitty Hello on 2010-Feb-19
http://www.glbasic.com/forum/index.php?topic=1457.msg9615#msg9615 (http://www.glbasic.com/forum/index.php?topic=1457.msg9615#msg9615)
Roto sprite abound a pivot point.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: fjsantosb on 2010-Feb-22
Hi,

Thanks for the answer, i have found specially interesting the pivot point.

And about thickness of drawline? I am currently using 'X_Line' which can be specify the thick of the line, but i can get same 'effect' using only drawline command?

King Regards, fjsantos.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: Kitty Hello on 2010-Feb-22
you can try glLineWidth (there's an OpenGL wrapper on the forums somewhere)
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: fjsantosb on 2010-Feb-22
Thanks Gernot, i will take a look!

King Regards, fjsantos.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: kamakazieturtle on 2010-Feb-23
Code: GLBasic [Select]
GETSPRITESIZE Image,ImageSizeX,ImageSizeY
ImageCenterX=ImageX+(ImageSizeX/2)
ImageCenterY=ImageY+(ImageSizeY/2)
 

This will tell you the images center.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: fjsantosb on 2010-Feb-23
Hi kamakazieturtle,

I actually use this code to get center of sprite (one time only, when i load the sprites, in the sprites type for speed purposes).
Thanks for sharing.

King Regards, fjsantos.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: fjsantosb on 2010-Feb-23
Hi there,

I finally find the wrapper that Gernot talks me about. The wrapper is:

Code: GLBasic [Select]
INLINE
#define OGL                             ::
typedef float           GLfloat;
ENDINLINE

INLINE
} extern "C" { void __stdcall glLineWidth( GLfloat width );; }; namespace __GLBASIC__ {
ENDINLINE
FUNCTION glLineWidth: width
        INLINE
                OGL glLineWidth(width);
        ENDINLINE
ENDFUNCTION
 

It's works like a charm! But I have a question:

When I compiled it's says 'Warning: Demo mode: This command would require Net or 3D addon'.

I currently have NET addon but not 3D. However it's seems is not in demo mode, cause i can't see the 'demo' image on screen.

Can anyone confirm that with NET addon is enough to compile this?

King Regards, fjsantos.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: Kitty Hello on 2010-Feb-24
oh.
You need the premium for INLINE.

Try this instead:
IMPORT "C" void glLineWidth(float);
and try to use it as if it was an GLBasic command.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: fjsantosb on 2010-Feb-24
Hi Gernot,

Works like a charm!

Anyway, what is the premium module?

King Regards, fjsantos.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: Kitty Hello on 2010-Feb-24
premium = 2D+3D+NET.
Title: Re: Change 'hot spot' of sprite and Drawline thickness
Post by: fjsantosb on 2010-Feb-24
Very interesting,

I am currently working on 2 games on 2D, but i will probably buy 3D module in a few moths for the next games (3D time)!

King Regards, fjsantos.