English
Forum

mouse on the Schwungrad of Trimmrad: y-Mausposition settle , inquire and spend überfordert

 
- Page 1 -



funkheld
Hello, good day.
I have one kombinationsproblem with the mouse.

I have over the Schwungrad of my Trimmrad a optische Mausplatine fasten(5 Euro-mouse). The Befestigung is so, the, if I tread, The Mausposition of y-0 to y-Max goes.

How can it make, the The mouse zb on y=0 staid and is with y>500 one counter counted and is The mouse then again on y=0 staid becomes.
this then in a Loop expires.

These combination I get not there, because the mouse with of/ one designed speed überfordert is, tappt im dunkeln counts then not any more moreover.
with "sleep 1" goes it neither.

Why the.
I compiliere with XPSE.
CompileMarkSeparation
 {$cleq}
Def @Getcursorpos(1) !"user32","GetCursorPos"
Def @Setcursorpos(2) !"USER32","SetCursorPos"
Struct Mauskoordinaten = X&,Y&
Declare Xpos&,Ypos&,Curpos#,zaehler&
Windowstyle 31
Windowtitle "Cursorposition ermitteln"
Window 200,0 - 440,440
@Setcursorpos (100,0)

While 0 = 0

    Sleep 5
    Dim Curpos#,Mauskoordinaten
    @Getcursorpos(Curpos#)
    Xpos& = Curpos#.X&
    Ypos& = Curpos#.Y&

    if Ypos& > 500

        @Setcursorpos (100,0)
        zaehler&=zaehler&+1

    endif

    Dispose Curpos#
    Drawtext 0,0,"Zähler: " + zaehler& + @Space$(30)

Endwhile


Thank you.

greeting
 
07/10/12  
 



« this Posting watts as Solution marked. »

@Funkheld: Have you here something The way misst... something like?

Download
CompileMarkSeparation
 {$cleq}
Windowstyle 31
Windowtitle "Cursorposition ermitteln"
Window 500,500
setcursorpos((winRight-winLeft)\2+winLeft,(winBottom-winTop)\2+winTop)
var modified&=0
var strecke&=0
var my2MousePositions&=globalAlloc(gPTR,16)
getCursorPos(my2MousePositions&)
rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)

while 1

    waitinput 10
    getCursorPos(my2MousePositions&)
    settext hWnd,"X:"+str$(long(my2MousePositions&,0))+" Y:"+str$(long(my2MousePositions&,4))+" Strecke:"+str$(strecke&)
    add strecke&,abs(long(my2MousePositions&,0)-long(my2MousePositions&,8))+abs(long(my2MousePositions&,4)-long(my2MousePositions&,12))

    if long(my2MousePositions&,0) > winRight

        long my2MousePositions&,0=winLeft
        inc modified&

    endif

    if long(my2MousePositions&,0) < winLeft

        long my2MousePositions&,0=winRight
        inc modified&

    endif

    if long(my2MousePositions&,4) < winTop

        long my2MousePositions&,4=winBottom
        inc modified&

    endif

    if long(my2MousePositions&,4) > winBottom

        long my2MousePositions&,4=winTop
        inc modified&

    endif

    if modified&

        modified&=0
        setCursorPos(long(my2MousePositions&,0),long(my2MousePositions&,4))

    endif

    rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)

wend

globalFree(my2MousePositions&)
f='./../../Function-References/XProfan/end/'>end

If you The add way row to there änderst:
CompileMarkSeparation
add strecke&,(long(my2MousePositions&,0)-long(my2MousePositions&,8))+(long(my2MousePositions&,4)-long(my2MousePositions&,12))
(means without abs), then becomes The rückwärtsgefahrene way too from the Streckenlänge
subtrahiert instead of to Streckenlänge add.

PS: with XPSE need The whole standard-APIs not deklarieren and its
even sinnvoller it then neither To do since the Aufrufe in explicit faster
Calls transformed go.

1.247 kB
Hochgeladen:07/10/12
Downloadcounter194
Download
 
07/10/12  
 




RICOSCH
has The platine too The microtaster for rights and left maustaste ?
i'd rather on these Keys settle !

and what should eigendlich counted go ? well not The number the tritte ?
if it over the schwungrad fasten is ?
 
I LOVE TOOLS
07/10/12  
 



@Funkheld: Have you here something The way misst... something like?

Download
CompileMarkSeparation
 {$cleq}
Windowstyle 31
Windowtitle "Cursorposition ermitteln"
Window 500,500
setcursorpos((winRight-winLeft)\2+winLeft,(winBottom-winTop)\2+winTop)
var modified&=0
var strecke&=0
var my2MousePositions&=globalAlloc(gPTR,16)
getCursorPos(my2MousePositions&)
rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)

while 1

    waitinput 10
    getCursorPos(my2MousePositions&)
    settext hWnd,"X:"+str$(long(my2MousePositions&,0))+" Y:"+str$(long(my2MousePositions&,4))+" Strecke:"+str$(strecke&)
    add strecke&,abs(long(my2MousePositions&,0)-long(my2MousePositions&,8))+abs(long(my2MousePositions&,4)-long(my2MousePositions&,12))

    if long(my2MousePositions&,0) > winRight

        long my2MousePositions&,0=winLeft
        inc modified&

    endif

    if long(my2MousePositions&,0) < winLeft

        long my2MousePositions&,0=winRight
        inc modified&

    endif

    if long(my2MousePositions&,4) < winTop

        long my2MousePositions&,4=winBottom
        inc modified&

    endif

    if long(my2MousePositions&,4) > winBottom

        long my2MousePositions&,4=winTop
        inc modified&

    endif

    if modified&

        modified&=0
        setCursorPos(long(my2MousePositions&,0),long(my2MousePositions&,4))

    endif

    rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)

wend

globalFree(my2MousePositions&)
f='./../../Function-References/XProfan/end/'>end

If you The add way row to there änderst:
CompileMarkSeparation
add strecke&,(long(my2MousePositions&,0)-long(my2MousePositions&,8))+(long(my2MousePositions&,4)-long(my2MousePositions&,12))
(means without abs), then becomes The rückwärtsgefahrene way too from the Streckenlänge
subtrahiert instead of to Streckenlänge add.

PS: with XPSE need The whole standard-APIs not deklarieren and its
even sinnvoller it then neither To do since the Aufrufe in explicit faster
Calls transformed go.

1.247 kB
Hochgeladen:07/10/12
Downloadcounter194
Download
 
07/10/12  
 




funkheld


and what should eigendlich counted go ? well not The number the tritte ?
if it over the schwungrad fasten is ?


I zähl The Mausschritte.
up to of/ one designed speed functions it, thereafter becomes almost not at all counted, if I again something slower will be, counts it again.

greeting
 
07/10/12  
 



funkheld (10.07.12)
up to of/ one designed speed functions it, thereafter becomes almost not at all counted, if I again something slower will be, counts it again.


relating itself the on my View source?

if so, then is this imho from at least this 2 Found vorstellbar:

+ The Schrittweite per "Frame" is larger as the window (Try time windowstyle 80 and window (maxx-100),(maxy-100) - means größeres Window)

+ the Chip on the mouse isn't quick enough or. The abtast-frequency To squat (here could it help if you with a "Getriebe" The letztendliche Rotationsgeschwindigkeit the Mausrades reduce)
 
07/10/12  
 




funkheld
Hello, your Program functions already integral rather, speed can already double go. thanks.

greeting
 
07/10/12  
 



yet "schneller" could hold if you the window vergrößert and if the still
not reicht then hold the WaitInput 10 comment and if the then always
not yet reicht then simply again report. ^^
 
07/10/12  
 




funkheld
Jup, have "Waitinput" rausgenommen and the screen vergrössert. and I whom Maussensor over the Treibriemen staid, because the wheel slower turn as the Schwungrad. functions wonderful with your Program.
I faith therefore is again More spielraum in the Loop for something Grafisches

question:
How can now there time as Test in the Loop something Grafisches reinmachen for Optik?

Thank you.

greeting
CompileMarkSeparation
 {$cleq}
Windowstyle 31
Windowtitle "Cursorposition ermitteln"
window (maxx-500),(maxy-100)
setcursorpos((winRight-winLeft)\2+winLeft,(winBottom-winTop)\2+winTop)
var modified&=0
var strecke&=0
var my2MousePositions&=globalAlloc(gPTR,16)
getCursorPos(my2MousePositions&)
rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)

while 1

    getCursorPos(my2MousePositions&)
    settext hWnd,"X:"+str$(long(my2MousePositions&,0))+" Y:"+str$(long(my2MousePositions&,4))+" Strecke:"+str$(strecke&)
    add strecke&,abs(long(my2MousePositions&,0)-long(my2MousePositions&,8))+abs(long(my2MousePositions&,4)-long(my2MousePositions&,12))

    if long(my2MousePositions&,0) > winRight

        long my2MousePositions&,0=winLeft
        inc modified&

    endif

    if long(my2MousePositions&,0) < winLeft

        long my2MousePositions&,0=winRight
        inc modified&

    endif

    if long(my2MousePositions&,4) < winTop

        long my2MousePositions&,4=winBottom
        inc modified&

    endif

    if long(my2MousePositions&,4) > winBottom

        long my2MousePositions&,4=winTop
        inc modified&

    endif

    if modified&

        modified&=0
        setCursorPos(long(my2MousePositions&,0),long(my2MousePositions&,4))

    endif

    rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)

wend

globalFree(my2MousePositions&)
='./../../Function-References/XProfan/end/'>end

125 kB
Hochgeladen:07/10/12
Downloadcounter91
Download
141 kB
Hochgeladen:07/10/12
Downloadcounter101
Download
 
07/10/12  
 



Hehe very calm -

as i 16 was (to 17 years ^^) I had with the of/ one normalen Kugelmaus integrally
similar made -

my Radl having such analog-Tacho the a einfachen Drahtwelle powered
watts -

these Welle I had with of/ one mouse-axis joined.



something Show can You discretionary -

there Gibts too many ways with the XProfan umzusetzen.

One example:
CompileMarkSeparation
 {$cleq}
 {$notmp}
 {$compiler c:\xprofan12}
 {$runtime c:\xprofan12}
decimals 2
Windowstyle 31
Windowtitle "Cursorposition ermitteln"
window (maxx-500),(maxy-100)
setcursorpos((winRight-winLeft)\2+winLeft,(winBottom-winTop)\2+winTop)
var speed!=0
var tmp&=0
var tme&=getTickCount
var tme.start&=getTickCount
var modified&=0
var strecke&=0
var my2MousePositions&=globalAlloc(gPTR,16)
getCursorPos(my2MousePositions&)
rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)
mcls 640,480,0

while 1

    if tme&<getTickCount

        add tme&,100// nur alle 100ms etwas tun
        speed!=((strecke&-tmp&)*0.03)*0.01+speed!*0.99
        tmp&=strecke&
        startpaint -1
        usefont "Arial",50,0,0,0,0
        textcolor $FFFF,0
        drawtext 10,10,"Race: "+str$((getTickCount-tme.start&)\1000)+" Sekunden"
        drawtext 10,60,"Strecke: "+str$(strecke&*0.0001)+" Meter"
        drawtext 10,110,"ø Geschw.: "+str$((strecke&*0.0001)/(1+(getTickCount-tme.start&)\1000))+" Meter/s  "
        textcolor $00FF00,-1
        drawtext 10,10,"Race:"
        drawtext 10,60,"Strecke:"
        drawtext 10,110,"ø Geschw.:"
        copybmp 1,240 - 640,240 > 0,240;0
        setpixel 638,479-speed!,$FFFFFF
        endpaint
        mcopysizedbmp 0,0 - 640,480 > 0,0 - width(hWnd),height(hWnd);0

    endif

    getCursorPos(my2MousePositions&)
    settext hWnd,"X:"+str$(long(my2MousePositions&,0))+" Y:"+str$(long(my2MousePositions&,4))+" Strecke:"+str$(strecke&)
    add strecke&,abs(long(my2MousePositions&,0)-long(my2MousePositions&,8))+abs(long(my2MousePositions&,4)-long(my2MousePositions&,12))

    if long(my2MousePositions&,0) > winRight

        long my2MousePositions&,0=winLeft
        inc modified&

    endif

    if long(my2MousePositions&,0) < winLeft

        long my2MousePositions&,0=winRight
        inc modified&

    endif

    if long(my2MousePositions&,4) < winTop

        long my2MousePositions&,4=winBottom
        inc modified&

    endif

    if long(my2MousePositions&,4) > winBottom

        long my2MousePositions&,4=winTop
        inc modified&

    endif

    if modified&

        modified&=0
        setCursorPos(long(my2MousePositions&,0),long(my2MousePositions&,4))

    endif

    rtlMoveMemory(my2MousePositions&+8,my2MousePositions&,8)

wend

globalFree(my2MousePositions&ss=s2>)
end

72 kB
Hochgeladen:07/10/12
Downloadcounter86
Download
 
07/10/12  
 




funkheld
hey, your Grafikprogramm functions already lovely with my mouse on the Trimmrad.
Thank you.

must now only time look ,Why The Durchschnittsgeschwindigkeit so slow on "0" runtergeht , if I aufhöre To zurück.

greeting
 
07/10/12  
 



well because the Time weiterläuft but the way same remaining -

is hold "averagesgeschwindigkeit "And not The actually Tretgeschwindigkeit.
 
07/10/12  
 




funkheld
Hmm.., how can one really The speed detect, thereabouts?

greeting
 
07/10/12  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

26.051 Views

Untitledvor 0 min.
Ralf Netz05/22/21
Heltal01/23/15
Jochen Roxlau10/04/14
Julian Schmidt06/22/13
More...

Themeninformationen

this Topic has 3 subscriber:

funkheld (16x)
iF (15x)
RICOSCH (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie