Forum | | | | - 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 |
| | | | |
| | | | - Page 2 - |
|  | « this Posting watts as Solution marked. » | | - Page 1 - |
|  | @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: CompileMarkSeparationadd 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. |
 | | | | |  |
| |  | look time Perhaps so:
Download
 CompileMarkSeparation {$cleq}
decimals 2
Windowstyle 31
Windowtitle "Cursorposition ermitteln"
window (maxx-500),(maxy-100)
setcursorpos((winRight-winLeft)\2+winLeft,(winBottom-winTop)\2+winTop)
var speed.realPixelSpeed!=0
var speed.forShow!=0
var tmp&=0
var tmp2&=479
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.realPixelSpeed!=(strecke&-tmp&)*0.5+speed.realPixelSpeed!*0.5
speed.forShow!=speed.realPixelSpeed!*0.001
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$(speed.forShow!)+" km/h"
drawtext 10,160,"ø 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.:"
drawtext 10,160,"ø Geschw.:"
copybmp 1,240 - 640,240 > 0,240;0
usepen 0,0,$00FF00
line 637,tmp2& - 638,(479-speed.realPixelSpeed!*0.02)
tmp2&=479-speed.realPixelSpeed!*0.02
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 class=s2>)
end
whom factor with: CompileMarkSeparationspeed.forShow!=speed.realPixelSpeed!*0.001
or. the *0.001 must hold adjust so that it properly works. |
 | | | | |
| |  funkheld | Jup, thanks. you are yes a Mathefreak.
functions wonderful.
Thank you.
greeting |
| | | | |
| |  | here Gibts Mathefreaks but I be no Mathefreak.  |
| | | | |
| |  funkheld | Perhaps can from this data The speed and the Wegstrecke calculate: an Pedalumdrehung has 41000 Mauspunkte, thereby turn itself the Schwungrad 5x. the Schwungrad has a amplitude of 75 cm.
greeting peter |
| | | | |
| |  | 5 Schwungraddrehungen metern means 5*75=375cm and this corresponds to then well of/ one
Pedalumdrehung -
therefore müsstest the value in strecke& vlt. only with 375/41000/100=0,0091463
multiplizieren and then have You imho The Number of zurückgelegten metres instead of
Pixel. Try time whether this here with you suitable values returns: CompileMarkSeparation {$cleq}
decimals 2
Windowstyle 31
Windowtitle "Cursorposition ermitteln"
window (maxx-500),(maxy-100)
setcursorpos((winRight-winLeft)\2+winLeft,(winBottom-winTop)\2+winTop)
var speed.realPixelSpeed!=0
var speed.forShow!=0
var tmp&=0
var tmp2&=479
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.realPixelSpeed!=(strecke&-tmp&)*0.5+speed.realPixelSpeed!*0.5
speed.forShow!=speed.realPixelSpeed!*0.000091463*36
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.000091463)+" Meter"
drawtext 10,110,"Geschw.: "+str$(speed.forShow!)+" km/h "
drawtext 10,160,"ø Geschw.: "+str$((strecke&*0.000091463)/(1+(getTickCount-tme.start&)\1000))+" Meter/s "
textcolor $00FF00,-1
drawtext 10,10,"Race:"
drawtext 10,60,"Strecke:"
drawtext 10,110,"Geschw.:"
drawtext 10,160,"ø Geschw.:"
copybmp 1,240 - 640,240 > 0,240;0
usepen 0,0,$00FF00
line 637,tmp2& - 638,(479-speed.realPixelSpeed!*0.02)
tmp2&=479-speed.realPixelSpeed!*0.02
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 class=s2>)
end
|
| | | | |
| |  funkheld | Hello, thanks. now comes with of/ one Pedalumdrehung 3,77metres out. this is super.
but Why goes The Geschwindigkeitsanzeige not higher How ca 15Km/h ? is me now first noticed. If I faster tread, becomes too The zurückgelegte way longer in a Zeiteinheit, means the km-counter functions with steigender speed.
Thank you.
greeting |
| | | | |
| |  | Dou you mean with Geschwindigkeitsanzeige whom Graphen? |
| | | | |
| |  funkheld | I mean whom Zahlenwert and the graphic.
greeting peter |
| | | | |
| |  | On my computer can I The mouse so quick moving that even 20 km/h
showing. How big is your hWnd? can it his the The from you genutzte
mouse simply not faster erfassen can? |
| | | | |
| |  funkheld | I have now time : add tme&,200 tuned. now functions it over 15Km/h.
whom Einfluss has the really?
greeting |
| | | | |
| |  | After wievielen Millisekunden The Grafikprozedur run out should -
with 100 means 10 time per second and with 200 5 time per second. |
| | | | |
| |  funkheld | Why increased itself then The speed? is there some Einfluss drin, if I 200 eingebe?
How errechnest You The Geshwindigkeit?
greeting |
| | | | |
|
AnswerTopic-Options | 26.050 Views |
Themeninformationenthis Topic has 3 subscriber: |