beginner's questions

New to FreeBASIC? Post your questions here.
ITomi
Posts: 154
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: beginner's questions

Post by ITomi »

I have 2 questions to skilled FB programmers:
1. How can I hide the mouse cursor without deactivating it? The SetMouse is not good for me, because it although hide, but deactivate the mouse. Or is there a possibility to change the mouse cursor to other sprite?
2. Is there a possibility in FB to scaling the graphics sprites? Can I resize those in the program? And how?
I tried D.J. Peters' demo from here: viewtopic.php?t=15819
it works well, but is there no built-in FB commands for this?
SARG
Posts: 1766
Joined: May 27, 2005 7:15
Location: FRANCE

Re: beginner's questions

Post by SARG »

Hi ITomi,
ITomi wrote:I have 2 questions to skilled FB programmers:
1. How can I hide the mouse cursor without deactivating it? The SetMouse is not good for me, because it although hide, but deactivate the mouse. Or is there a possibility to change the mouse cursor to other sprite?
The mouse is not desactivated. In the snippet below (just the example setmouse changed a bit), the mouse is not visible and still active.

ITomi wrote: is there a possibility to change the mouse cursor to other sprite?
Just set the mouse invisible and draw your sprite (instead circle as in the example) at the mouse coordinnates.
ITomi wrote:it works well, but is there no built-in FB commands for this?
No there is not. But the DJP's tool is fine or write your own :-)

Code: Select all

Dim As Integer x, y, buttons

' create a screen 640*480
ScreenRes 640, 480
Print "Click the mouse button to center the mouse"
SetMouse 320, 240,0
Do
    ' get mouse x, y and button state (wait until mouse is onscreen)
Do: Sleep 1: 
   
   GetMouse( x, y , , buttons)
  circle(x,y),5,15
   If buttons<>0 Then Exit Do
Loop Until 0

    If buttons And 1 Then
        ' on left mouse click, center mouse
        SetMouse 320, 240
    End If

    ' run loop until a key is pressed or the window is closed
Loop While Inkey = ""
Last edited by SARG on Jul 20, 2018 13:28, edited 1 time in total.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: beginner's questions

Post by badidea »

Bumping an old thread :-)
ITomi wrote:I have 2 questions to skilled FB programmers:
1. How can I hide the mouse cursor without deactivating it? The SetMouse is not good for me, because it although hide, but deactivate the mouse. Or is there a possibility to change the mouse cursor to other sprite?

Code: Select all

#include "fbgfx.bi"

Type mouse
    As Integer res
    As Integer x, y, wheel, clip
    Union
        buttons As Integer
        Type
            Left:1 As Integer
            Right:1 As Integer
            middle:1 As Integer
        End Type
    End Union
End Type
 
Screenres 800, 600, 32
Setmouse , , 0
Dim As mouse m
Do
    m.res = GetMouse( m.x, m.y, m.wheel, m.buttons, m.clip )
    ScreenLock
    'Cls
    Circle (m.x, m.y), 5, &h004488AA
    locate 1,1
    Print Using "res = #"; m.res
    Print Using "x = ###; y = ###; wheel = +###; clip = ##"; m.x; m.y; m.wheel; m.clip
    Print Using "buttons = ##; left = #; middle = #; right = #"; m.buttons; m.left; m.middle; m.right
    ScreenUnlock
    Sleep 11, 1
Loop While Inkey = ""
Last edited by badidea on Jul 21, 2018 8:09, edited 1 time in total.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: beginner's questions

Post by BasicCoder2 »

ron wrote:Hi I've just heard of FreeBASIC for the first time.
Why do the stats say that ron joined Jun 02 2006 if he has just joined?
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: beginner's questions

Post by sancho3 »

@basiccoder:
The thread was "bumped" by Itomi.
It was originally started by ron in 2006, and then Itomi posted here in 2018.
I don't know why he didn't start his own thread but he got answered and thats all that counts.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: beginner's questions

Post by fxm »

Moreover ron did not fizzle on the forum: only 4 days!
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: beginner's questions

Post by BasicCoder2 »

sancho3 wrote:@basiccoder:
The thread was "bumped" by Itomi.
Now I just feel silly for not noticing that. Can we delete all the posts backs to my last one?
ITomi
Posts: 154
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: beginner's questions

Post by ITomi »

Sorry, I just thought I don't open a new topic because of my two questions if already exist a topic with similar title. I thought, it is a good idea to put these into one instead of open a new topic, as I'm also a beginner.
Sorry once more... :-(
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: beginner's questions

Post by badidea »

No problem, I think.

Issue 2 (scaling): No built-in command as far as I know.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: beginner's questions

Post by dodicat »

Perhaps ron did a sancho2
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: beginner's questions

Post by sancho3 »

@Dodicat, Lol, it could be.
Post Reply