beginner's questions

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

Re: beginner's questions

Postby ITomi » Jul 20, 2018 12:41

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: https://www.freebasic.net/forum/viewtopic.php?t=15819
it works well, but is there no built-in FB commands for this?
SARG
Posts: 858
Joined: May 27, 2005 7:15
Location: FRANCE

Re: beginner's questions

Postby SARG » Jul 20, 2018 13:25

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: 1016
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: beginner's questions

Postby badidea » Jul 20, 2018 13:25

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: 3310
Joined: Jan 01, 2009 7:03

Re: beginner's questions

Postby BasicCoder2 » Jul 21, 2018 6:05

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: 304
Joined: Sep 30, 2017 3:22

Re: beginner's questions

Postby sancho3 » Jul 21, 2018 6:09

@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
Posts: 8424
Joined: Apr 22, 2009 12:46
Location: Paris (suburbs), FRANCE

Re: beginner's questions

Postby fxm » Jul 21, 2018 6:18

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

Re: beginner's questions

Postby BasicCoder2 » Jul 21, 2018 7:16

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: 113
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: beginner's questions

Postby ITomi » Jul 21, 2018 8:57

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: 1016
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: beginner's questions

Postby badidea » Jul 21, 2018 9:15

No problem, I think.

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

Re: beginner's questions

Postby dodicat » Jul 21, 2018 10:25

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

Re: beginner's questions

Postby sancho3 » Jul 24, 2018 1:46

@Dodicat, Lol, it could be.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 2 guests