Zecihen mit Maus!
Übersicht

![]() |
IronstormErstklassiger Contest-VeranstalterBetreff: Zecihen mit Maus! |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi @ all!
Weiß jemand ob es geht das man mit der Maus einen Kreis z.b. macht und das es dann vonn BB erkannt wird. Also wie in Black and White 1/2. Gibts da irgendwie was? THX im vorraus. Blitzmaker |
||
..:: blackbird design : blackbird photography : Futuro Verde : X-Commander ::..
MacBook | Intel Core 2 Duo 2,1 GHz | 2048 MB RAM | 80 GB HDD | Mac OS X 10.6.2 (Snow Leopard) | Adobe CS4 Design Premium |
![]() |
skey-z |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hab dir mal ein kleines Beispiel geschrieben, was dir als Grundlage dienen kann, funktioniert noch nihct perfekt, aber das Prinzip sollte es dir erlauben daraus etwas zu machen
BlitzBasic: [AUSKLAPPEN]
für Verbesserungen habe ich auch ein offenes ohr, möchte auch wissen, was da noch nicht richtig läuft. |
||
Awards:
Coffee's Monatswettbewerb Feb. 08: 1. Platz BAC#57: 2. Platz |
![]() |
SoNenTyp |
![]() Antworten mit Zitat ![]() |
---|---|---|
Glaube er meint das anders.
Du zeichnest einen Kreis und das Programm soll erkennen das es einer ist. Das ganze später natürlich noch mit anderen Figuren. |
||
Gruss Der Typ.
User posted image |
![]() |
skey-z |
![]() Antworten mit Zitat ![]() |
---|---|---|
jo jetzt wo du es sagst, ist mir beim 2. durchlesen jetzt auch aufgefallen.
vlt sollte er sich dann noch etwas geauer ausdrücken, wie er es meint |
||
Awards:
Coffee's Monatswettbewerb Feb. 08: 1. Platz BAC#57: 2. Platz |
![]() |
SpionAtom |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich hab auch mal was probiert.
Zunächst berechne ich den Mittelpunkt (zumindest den geahnten Mittelpunkt). Und dann den Radius. Schon habe ich einen geahnten Kreis Den muss ich lediglich mit letzten Mauskoordinaten abgleichen. Ein wenig Toleranz und - tadaa - fertig ist die Kreisabfrage. Sicher auch noch verbesserungswürdig, aber ist schon spät, also müsst ihr das selber machen. ![]() Code: [AUSKLAPPEN] ;Mausgesten ;heute: Kreis ;von SpionAtom Const xr = 800, yr = 600 Graphics xr, yr, 16, 2 SetBuffer BackBuffer() ;Hier werden die Mauskoordinaten gespeichert Type MP Field x Field y End Type Local MP.MP toleranz = 20 doGeste = 0 Repeat If doGeste = 0 And MouseDown(1) Then doGeste = 1: Delete Each MP If Not MouseDown(1) Then doGeste = 0 If doGeste = 1 Then MP = New MP MP\x = MouseX() MP\y = MouseY() End If toleranz = toleranz + MouseZSpeed(): If toleranz < 1 Then toleranz = 1 ;Kreis erahnen minx = xr: miny = yr: maxx = 0:maxy = 0 For MP = Each MP If MP\x < minx Then minx = MP\x If MP\y < miny Then miny = MP\y If MP\x > maxx Then maxx = MP\x If MP\y > maxy Then maxy = MP\y Next radius = ((maxx-minx) + (maxy-miny)) / 4 mittex = (minx+maxx)/2: mittey = (miny+maxy)/2 ;Geste prüfen auf Kreis gefunden = True For MP = Each MP If quad(MP\x-mittex) + quad(MP\y-mittey) > quad(radius + toleranz) Or quad(MP\x-mittex) + quad(MP\y-mittey) < quad(radius - toleranz) Then gefunden = False End If Next ;völlig überladene Ausgabe Cls Color 25, 25, 0 Oval 300, 200, 200, 200, 1 Color 255, 255,255 Oval mittex - (radius+toleranz), mittey - (radius+toleranz), 2 * (radius+toleranz), 2 * (radius+toleranz), 0 Oval mittex - (radius-toleranz), mittey - (radius-toleranz), 2 * (radius-toleranz), 2 * (radius-toleranz), 0 Line minx, 0, minx, yr: Line maxx, 0, maxx, yr: Line 0, miny, xr, miny: Line 0, maxy, xr, maxy Text 0, 0, "Links klicken, um Geste zu vollführen" Text 0, 20, "Toleranz " + toleranz + " (Mausrad zum ändern)" Text 0, 40, "Gefunden " + gefunden + " (1 = ja, 0 = nein)" Color 0, 255, 0 Oval mittex - 5, mittey - 5, 10, 10 Color 0, 0, 255 Line mittex, mittey, mittex-radius, mittey Color 255, 0, 0 For MP = Each MP Oval MP\x - 2, MP\y - 2, 4, 4 Next Flip() Until KeyDown(1) End Function quad(n) Return n * n End Function |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group