Español
Foro

Ratón al Schwungrad vom Trimmrad: y-Mausposition conjunto , abfragen y ausgeben überfordert

 
- Página 1 -



funkheld
¡Hola, guten Tag.
Yo habe una kombinationsproblem con ratón.

Yo habe encima el Schwungrad de mi Trimmrad una optische Mausplatine befestigt(5 Euro-Ratón). El Befestigung es así, el, si yo trete, el Mausposition de y-0 después de y-Max va.

¿Cómo se puede uno lo hacer, el el Ratón zb en y=0 gesetzt se y en y>500 una Zähler gezählt se y el Ratón entonces otra vez en y=0 gesetzt se.
Dies entonces en uno Bucle abläuft.

Diese kombination bekomme Yo no hin, porque el Ratón en una cierta Geschwindigkeit überfordert es, ellos zählt entonces no mehr más.
Mit "sleep 1" es auch no.

Woran liegt el.
Yo compiliere con XPSE.
KompilierenMarcaSeparación
 {$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


Gracias.

Gruss
 
10.07.2012  
 



« Dieser Contribución wurde como Solución gekennzeichnet. »

@Funkheld: Hab Usted hier algo el Strecke misst... algo como?

Descargar
KompilierenMarcaSeparación
 {$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='./../../funktionsreferenzen/XProfan/end/'>end

Si usted el add strecke Línea dahin änderst:
KompilierenMarcaSeparación
add strecke&,(long(my2MousePositions&,0)-long(my2MousePositions&,8))+(long(my2MousePositions&,4)-long(my2MousePositions&,12))
(also sin abs), Luego se el rückwärtsgefahrene Strecke auch de el Streckenlänge
subtrahiert en lugar de a Streckenlänge addiert.

PS: En XPSE necesidad el ganzen Standard-APIs no deklarieren y es
incluso sinnvoller lo entonces auch no a tun como el Aufrufe en deutlich schnellere
Calls umgewandelt voluntad.

1.247 kB
Hochgeladen:10.07.2012
Ladeanzahl180
Descargar
 
10.07.2012  
 




RICOSCH
ha el platine auch el microtaster para rechte y linke maustaste ?
Yo sería más bien en esta tasten conjunto !

y qué se eigendlich gezählt voluntad ? probablemente no el anzahl el tritte ?
si encima el schwungrad befestigt es ?
 
I LOVE TOOLS
10.07.2012  
 



@Funkheld: Hab Usted hier algo el Strecke misst... algo como?

Descargar
KompilierenMarcaSeparación
 {$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='./../../funktionsreferenzen/XProfan/end/'>end

Si usted el add strecke Línea dahin änderst:
KompilierenMarcaSeparación
add strecke&,(long(my2MousePositions&,0)-long(my2MousePositions&,8))+(long(my2MousePositions&,4)-long(my2MousePositions&,12))
(also sin abs), Luego se el rückwärtsgefahrene Strecke auch de el Streckenlänge
subtrahiert en lugar de a Streckenlänge addiert.

PS: En XPSE necesidad el ganzen Standard-APIs no deklarieren y es
incluso sinnvoller lo entonces auch no a tun como el Aufrufe en deutlich schnellere
Calls umgewandelt voluntad.

1.247 kB
Hochgeladen:10.07.2012
Ladeanzahl180
Descargar
 
10.07.2012  
 




funkheld


y qué se eigendlich gezählt voluntad ? probablemente no el anzahl el tritte ?
si encima el schwungrad befestigt es ?


Yo zähl el Mausschritte.
Bis a una cierta Geschwindigkeit funktioniert lo, danach se fast garnicht gezählt, si yo otra vez algo langsamer voluntad, zählt lo otra vez.

Gruss
 
10.07.2012  
 



funkheld (10.07.12)
Bis a una cierta Geschwindigkeit funktioniert lo, danach se fast garnicht gezählt, si yo otra vez algo langsamer voluntad, zählt lo otra vez.


Bezieht se el en media Ver código fuente?

Wenn sí, entonces dies imho de mindestens esta 2 Gründen vorstellbar:

+ el Schrittweite pro "Frame" es größer como el Ventana (probiere veces windowstyle 80 y window (maxx-100),(maxy-100) - also größeres Ventana)

+ el Chip en ratón es no rápidamente genug o. el abtast-Frequenz a niedrig (hier podría lo helfen si con un "Getriebe" el letztendliche Rotationsgeschwindigkeit des Mausrades reduzierst)
 
10.07.2012  
 




funkheld
¡Hola, dein Programa funktioniert ya wesentlich mejor, Geschwindigkeit kann ya verdoppelt voluntad. Gracias.

Gruss
 
10.07.2012  
 



Noch "schneller" könntest sólo si el Ventana vergrößert y si el todavía
no reicht entonces sólo el WaitInput 10 auskommentieren y si el entonces siempre
todavía no reicht entonces simplemente otra vez informe. ^ ^
 
10.07.2012  
 




funkheld
Jup, habe "Waitinput" rausgenommen y el Bildschirm vergrössert. y habe el Maussensor encima el Treibriemen gesetzt, porque el Rad langsamer dreht como el Schwungrad. Funktioniert wunderbar con deinem Programa.
Yo glaube dadurch es auch otra vez mehr spielraum en el Bucle para algo Grafisches

Cuestión:
¿Cómo se puede uno ahora como veces como Test en el Bucle irgendetwas Grafisches reinmachen para el Optik?

Gracias.

Gruss
KompilierenMarcaSeparación
 {$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&)
='./../../funktionsreferenzen/XProfan/end/'>end

125 kB
Hochgeladen:10.07.2012
Ladeanzahl89
Descargar
141 kB
Hochgeladen:10.07.2012
Ladeanzahl99
Descargar
 
10.07.2012  
 



Hehe muy fresco -

como Yo 16 war (antes 17 Jahren ^ ^) Tuve el con uno normalen Kugelmaus bastante
ähnlich gemacht -

mein Radl hatte solch analog-Tacho el de uno einfachen Drahtwelle angetrieben
wurde -

esta Welle Tuve con uno Ratón-Achse verbunden.



Etwas Mostrar kannst Usted cualquier -

como gibts auch viele Wege el con XProfan umzusetzen.

Ein Ejemplo:
KompilierenMarcaSeparación
 {$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:10.07.2012
Ladeanzahl85
Descargar
 
10.07.2012  
 




funkheld
He, dein Grafikprogramm funktioniert ya prima con meiner Ratón al Trimmrad.
Gracias.

Muss ahora sólo veces schauen ,por qué el Durchschnittsgeschwindigkeit así langsam en "0" runtergeht , si yo aufhöre a treten.

Gruss
 
10.07.2012  
 



Na porque el Tiempo weiterläuft aber el Strecke igual restos -

es sólo "Durchschnittsgeschwindigkeit " y no el aktuelle Tretgeschwindigkeit.
 
10.07.2012  
 




funkheld
Hmm.., como puede ser eigentlich el Geschwindigkeit ermitteln, así ungefähr?

Gruss
 
10.07.2012  
 




Respuesta


Título del Tema, max. 100 Signo.
 

Systemprofile:

Kein Systemprofil creado. [anlegen]

XProfan:

 Contribución  Font  Smilies  ▼ 

Bitte registro en una Contribución a verfassen.
 

Tema opciones

25.212 Views

Untitledvor 0 min.
Ralf Netz22.05.2021
Heltal23.01.2015
Jochen Roxlau04.10.2014
Julian Schmidt22.06.2013
Más...

Themeninformationen

Dieses Thema ha 3 subscriber:

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


Admins  |  AGB  |  Applications  |  Autores  |  Chat  |  Política de Privacidad  |  Descargar  |  Entrance  |  Ayuda  |  Merchantportal  |  Pie de imprenta  |  Mart  |  Interfaces  |  SDK  |  Services  |  Juegos  |  Búsqueda  |  Support

Ein Projekt aller XProfan, el lo son!


Mi XProfan
Privado Noticias
Eigenes Ablageforum
Temas-Merkliste
Eigene Beiträge
Eigene Temas
Zwischenablage
Cancelar
 Deutsch English Français Español Italia
Traducciones

Política de Privacidad


Wir uso Cookies sólo como Session-Cookies wegen el technischen Notwendigkeit y en uns hay no Cookies de Drittanbietern.

Wenn du hier en unsere Webseite klickst oder navigierst, stimmst du unserer Erfassung de Informationen en unseren Cookies en XProfan.Net a.

Weitere Informationen a unseren Cookies y dazu, como du el Kontrolle darüber behältst, findest du en unserer nachfolgenden Datenschutzerklärung.


einverstandenDatenschutzerklärung
Yo möchte no Cookie