| |
|
|
- 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 |
|
|
| |
|
|
 |
« Dieser Contribución wurde como Solución gekennzeichnet. » |
|
- Página 1 - |
|
 | @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ónadd 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. |
 |
|
| |
|
 |
|
|
| |
|
- Página 2 - |
|
 | Auf mi Computer kann Yo el Ratón así rápidamente bewegen dass incluso 20 km/h
adecuado voluntad. Como groß es Su hWnd? Kann lo ser el el de Usted genutzte
Simple ratón no más rápido erfassen kann? |
|
|
| |
|
|
|
 funkheld | Yo habe ahora veces : add tme&,200 eingestellt. Jetzt funktioniert lo encima 15Km/h.
Welchen Einfluss ha el eigentlich?
Gruss |
|
|
| |
|
|
|
 | Nach wievielen Millisekunden el Grafikprozedur ablaufen se -
en 100 also 10 veces pro Sekunde y en 200 5 veces pro Sekunde. |
|
|
| |
|
|
| |
|
- Página 3 - |
|
|
 funkheld | ¿Por qué aumenta se entonces el Geschwindigkeit? Ist como irgendein Einfluss drin, si yo 200 eingebe?
Como errechnest du el Geshwindigkeit?
Gruss |
|
|
| |
|
|
|
 | Na lo son doch strecke& y todos X ms merke Yo en tmp& strecke& y así es klar wieviel strecke en el Tiempo gemacht wurde. Si usted sólo 5 veces en lugar de 10 veces pro Sekunde rechnest entonces kann doppelt así viel Strecke en el Tiempo gemacht voluntad aber el Kalkulation dürfte entonces no mehr stimmen como en 100 ms abgestimmt.
Si usted todos 200 en lugar de 100 ms rechnest entonces müsstest Geschwindigkeit por 2 nehmen. |
|
|
| |
|
|
|
 funkheld | Ach así...., danke para el Hinweiss.
Un Grafische spielerei: Usted hast doch ya viele Sachen en Opengl programmiert. Yo möchte veces una Geländeplatte sin Höhen y Tiefen con Spritebäumen unendlich bewegen, je después de el como rápidamente uno en el Pedale tritt.
¿Cómo se puede al realiseren ?
Gruss peter |
|
|
| |
|
|
|
 | Yo sería empfehlen el primero separat de diesem Programa hier a realisieren y
el en un eigenen Thema a behandeln. |
|
|
| |
|
|
|
 funkheld | ¡Hola, guten Tag. Yo habe una Programa, wo se una Ogl-Sprite je después de Tretgeschwindikeit de unten después de oben bewegt, a a el Geschwindigkeit wo el Dateneinlesen el Lasermaus aussetzt. El Steigerung el Geschwindigkeit es no así deutlich erkennbar beim Sprite. ¿Cómo se puede uno lo hier ahora en el Programa pro Zeiteiheit así messen, el beim schnelleren Treten una deutliche erkennbare Bewegung des Sprites erkennbar es. Lo kommt ahora no en el genaue Geschwindigkeit a, pero lo kommt ahora en el Bewegung des Sprites a.
Gracias.
Gruss KompilierenMarcaSeparación {$cleq}
declare hWin&,hintergrpic&,vordergrpic&
declare ende&,winkel!,groesse&,dib&,array&
declare bild_auto&,tex.auto&
declare bmi#,ogl_rgb#
declare x1!,y1!,dx!,dy!
declare bereich#
Dim Bereich#, 16
Def &GL_BGR $80E0
DEF CreateDIB(2) !"dib","CreateDIB"
DEF FreeDIB(1) !"dib","FreeDIB"
DEF DrawDIB(4) !"dib","DrawDIB"
DEF CloneDIB(1) !"dib","CloneDIB"
dib&=usedll("dib.dll")
hintergrpic& = create("hNewPic", 400,700,rgb(255,255,0))
vordergrpic& = create("hNewPic", 400,700,rgb(255,255,0))
bild_auto& = create("hNewPic", 128,128,rgb(255,255,0))
array&=CreateDIB(128,128)
groesse&=128*128*4
dim ogl_rgb#,groesse&
Window 20,20-800,800
Cls @RGB(220,220,220)
hWin& = @Create("text", %hWnd, "Test1", 10, 10, 128,128)
oGL("Init", hwin&, 0,0, 0, 0)
oGL("PosMode", 1)
ogl("glReadBuffer",~GL_Back)
tex.auto&=oGL("LoadTextureBMP","data\\auto.bmp",1)
drawglscene
ende&=1
winkel!=90
dx!=100
dy!=600
WHILE ende&
getCursorPos(bereich#)
if long(bereich#,4) > 700
setCursorPos(100,0)
y1!=Sin(-(winkel!)/180.0*pi())*2
x1!=Cos(-(winkel!)/180.0*pi())*2
dx!=dx!+x1!
dy!=dy!+y1!
if dy! < 0.0
dy!=600
endif
endif
if isKey(81)
winkel!=winkel!+1.0
endif
if isKey(69)
winkel!=winkel!-1.0
endif
drawglscene
ENDWHILE
end
proc drawglscene
OGL("Clear")
OGL("origin",0,0,-1.11)
OGL("texture",tex.auto&,1)
OGL("rotate",0,0,winkel!)
OGL("quad",0.5,0.5)
OGL("show")
ogl("glReadPixels",0,0,128,128,&GL_BGR,~GL_UNSIGNED_BYTE,ogl_rgb#)
~setDIBits(%hdc,bild_auto&,0,128,ogl_rgb#,array&,0)
StartPaint vordergrpic&
DrawPic hintergrpic&,0,0;0
drawpic bild_auto&,dx!,dy!;-1
endpaint
DrawPic vordergrpic&, 300,5;pan>
ENDPROC
|
 |
|
| |
|
|
|
 | Imho fehlen Archivos como z.B.:
 |
|
|
| |
|
|
|
 funkheld | ¡Hola,Yo el DIB hier de el Foro. Posesiones ellos ahora drangehängt.
Tal vez podría uno en efecto una 2D-Hintergrund herstellen sin Opengl, el se je después de Geschwindigkeit bewegt y en el Vordergrund una Fahrradfahrer-Bmp.
Gruss |
|
|
| |
|
|
|
 | Es sí alles bastante simplemente.
Was es hiermit? [...]  |
|
|
| |
|
|
|
 funkheld | Jup, es ahora gelöst con deinem Programa.
Gracias.
Gruss |
|
|
| |
|
|