Mein_erstes_Spiel

Übersicht BlitzBasic Allgemein

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen

Hagbard

BeitragMo, Jan 16, 2006 23:21
Antworten mit Zitat
Benutzer-Profile anzeigen
@Rotes_Eichhörnchen:
Du kannst das auch woanders hochladen:
http://www.eastwestgames.de/
Dort kannst du dich auch mit deinem BBForum Benutzernamen einloggen.

Rotes_Eichhörnchen

BeitragMo, Jan 16, 2006 23:33
Antworten mit Zitat
Benutzer-Profile anzeigen
das ist ja mal toll.

ich hoffe, die datei wird nicht zu groß sein...^^

http://www.eastwestgames.de/file.php?id=43

da seht ihr mein erstes programm.-..

danke nochmal an alle-.
 

Ava

Gast

BeitragDi, Jan 17, 2006 3:45
Antworten mit Zitat
Na das ist doch mal ein durchweg sympathischer und sehr vorbildlicher Neueinsteiger. *zum Eichhörnchen rüberblinzel* Smile - Ich gratuliere Dir zu Deinem ersten kleinen Blitz-Programm! Very Happy

Also: Wenn es Dir darum geht, konkurenzfähige 2D-Spiele zu schreiben, dann würde ich Dir aus meiner Erfahrung her auf jeden Fall BlitzMax ans Herz legen. Du hast dort viele schöne Möglichkeiten, die Dir in Blitz2D und BlitzPlus verwehrt sind und auch in Blitz3D nur sehr umständlich umzusetzen. Eine auf 3D basierende 2D GrafikEngine ist da das Stichwort. Diese könntest Du Dir bei Blitz3D selber schreiben, Blitzmax baut von selbst genau darauf auf. Wenn Dir (schnelle) Transparenz-, Rotations- und Skalierungseffekte nicht wichtig sind, kannst Du aber auch BlitzPlus für Dich wählen. Da würdest Du am preisgünstigsten mit wegkommen und hättest gleich noch eine (nicht besonders schöne, aber dafür recht einfache und funktionelle) GUI mit dabei.

Dein Code lässt sich leider nicht ganz 1:1 in BMax übernehmen. Es gibt dort ein paar kleine Ändererungen, die man beherzigen muss. Aber auch an die kann man sich schnell gewöhnen. Smile

Gut, soviel dazu ... einen lieben Gruss,
+ Ava +

Rotes_Eichhörnchen

BeitragDi, Jan 17, 2006 17:07
Antworten mit Zitat
Benutzer-Profile anzeigen
hi, danke erst einmal...

ähm...ich werde mir warscheinlich jetzt BlitzPlus zulegen..., kann ich da den Code einfach 1:1 übernehmen?

Und was ist bitteschön GUI?

Klip

BeitragDi, Jan 17, 2006 17:14
Antworten mit Zitat
Benutzer-Profile anzeigen
Wenn du keine 3D-Befehle im Code hast, musst du für BlitzPlus nichts ändern.

Eine GUI ist ein Graphical User Interface. Mit anderen Worten: Die Scrollbalken und x-Buttons eines Programmes, sowie die Reiter und Baumlisten. Du könntest dir mit BlitzPlus also im Prinzip ein eigenes Paint basteln, samt der Menüs und Buttons.

Bei Linux und Mac gibt es heute noch Konsolen (Terminals, Shells), die ohne GUI fungieren, bei Windows wäre das vergleichbare Gegenstück die DOS-Eingabeaufforderung.

Vor längerer Zeit gab es NUR dies nichtgrafische Darstellung, dann noch mit grüner oder brauner Schrift.

soli

BeitragDi, Jan 17, 2006 17:30
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich würde dir auch BMax empfehlen.
Oder versuche mal in Blitzplus so etwas
wie Anitalias hinzubekommen.
--> geht nicht.
solitaire

5k41

BeitragDi, Jan 17, 2006 17:47
Antworten mit Zitat
Benutzer-Profile anzeigen
mh ich weiss nicht...ich kenn mich mit B-Max nicht so aus (sollte mich wohl mal näher damit befassen) aber ich fand BB 3D bis jetzt immer sehr praktisch! Ich mein man hat alles was man brauch und sowieso find ich es viel reizvoller zumindest die 3D->2D engine (oder wie man das uach nennen will) selbst zu schreiben...ich mein BB macht ja sonst generell dir eigentlich schon alles vor...ABER was ich gehört hab, das B-Max die Zukunft gehört.... und nochwas...ich glaub man kann wenn man wirklich intresse daran hat bei E-Bay die BB2D only version noch sehr kostengünstig erwerben...kannst ja mal sehen..
Projekte:
For a better World - Gesellschaftsspiel ( 100%)

User posted image

Rotes_Eichhörnchen

BeitragDi, Jan 17, 2006 17:51
Antworten mit Zitat
Benutzer-Profile anzeigen
ok...ich werd schauen...

mal wieder ne frage:

so...jetzt kann ich schon grafiken darstellen, und Text ausgeben. Supper. Ich kann auch aus Dateien lesen... und sie ausgeben.

Aber das entscheidenste:

WIE kann ich, wenn ich also so ein nettes HinterundBild habe, Text über die Tastatur eingeben? mit imput funzt das ja nicht...

5k41

BeitragDi, Jan 17, 2006 17:59
Antworten mit Zitat
Benutzer-Profile anzeigen
musst du dir ne Input routine per getkey() und Chr selbst schreiben ist eigentlich ganz easy...findest glaub ich auch ne gute auf der site wo du dein game hochgeladen hast (kann leider keinen link posten kann mich nur grob daran erinnern...) und sonst ich mein das ist eigenltich sowieso nicht so schwierig hier ein kleines Beispiel:
Code: [AUSKLAPPEN]

key=getkey()

;hier kannst du jetzt auf sondertasten wie löschen usw. prüfen siehe Onlinehilfe ASC II codes

strg$=strg$+Chr(key)

text 0,0,strg$

so geht das vom prinzip her...
Projekte:
For a better World - Gesellschaftsspiel ( 100%)

User posted image

Rotes_Eichhörnchen

BeitragDi, Jan 17, 2006 18:03
Antworten mit Zitat
Benutzer-Profile anzeigen
ganz verstehe ich das nicht...

key=getkey()

so...jetzt wird gewartet, ob ich eine Taste drücke. sagen wir ich will "Computer" schreiben. Dann wird doch nur das "C" ausgegeben, oder?

außer das ganze ist in einer schleife...oder?


ich hab das gefunden...aber ... bam!!

das ist aber lang...werd mich da jetzt mal reintiegern^^

5k41

BeitragDi, Jan 17, 2006 18:09
Antworten mit Zitat
Benutzer-Profile anzeigen
also er überprüft das ja in einer schleife und wenn du "C" drückst dann liefert er denn ASC II code von "C" nun überprüft er ob das eine deiner sondertasten ist, bei denen er was anderes machen soll und wenn es keine ist dann lässt du ihn den ASC II wert wieder in den echten buchstaben umwandeln und hinten an den String anhängen...danach macht er das ganze für "o" usw. usw...
Projekte:
For a better World - Gesellschaftsspiel ( 100%)

User posted image

Rotes_Eichhörnchen

BeitragDi, Jan 17, 2006 18:09
Antworten mit Zitat
Benutzer-Profile anzeigen
verstehe...in dem Beispiel, wird einfach jeder Tastendruck angegeben, und dann in eine Variable geschrieben...

das bringt mich zu noch eienr Frage:

kann ich unterprogramme Schreiben, die ich dann includiere?

Also, dass ich z.B. die Text-Box verarbeitung in eienr extra Datei abspeichere, der übersicht halber...?

Ralff

BeitragDi, Jan 17, 2006 18:19
Antworten mit Zitat
Benutzer-Profile anzeigen
hi
ja man kann mit dem include befehl andere bb dateien einbinden. das braucht man dann aber erst bei größeren projekten(finde ich...).

für so etwas wie die textbox verwaltung würde ich funktionen verwenden.
damit geht das dann eigentlich ganz einfach...


Ralff
Zieht euch das rein...:
http://myspace.com/ndyderchef
Hammertracks, kostenlos...

N-Dy rulez

Rotes_Eichhörnchen

BeitragDi, Jan 17, 2006 18:24
Antworten mit Zitat
Benutzer-Profile anzeigen
ich versteh das aber nicht... (die textbox)

am anfang ist:
type textbox
end type


oik...verstanden..aebr da steht folgendes dazwischen:

Field X1,X2
Field Y1,Y2

Field Tab
Field Status
Field Cursor
Field CursorBreit

Field MarkiertX1
Field MarkiertX2
Field Markiert
Field Text$
Field MaxLang

Field CursorFarbe
Field TextFarbe[1]
Field HTextFarbe[1]

Field Ins


hmm...ähm,,,kannmir jemand das alles erklären?
Das währe echt der Hammer


[syntax="bb"]
Type InputBoxTyp
Field X1,X2
Field Y1,Y2

Field Tab
Field Status
Field Cursor
Field CursorBreit

Field MarkiertX1
Field MarkiertX2
Field Markiert
Field Text$
Field MaxLang

Field CursorFarbe
Field TextFarbe[1]
Field HTextFarbe[1]

Field Ins
End Type

Const Aktiv=1
Const inaktiv=2


Graphics 640,480,0,2
SetBuffer BackBuffer()
SetFont LoadFont("Courier New",24,False,False,False)

Global InputBox.InputBoxTyp

Global Strg
Global Alt
Global Shift
Global AltGr


Global KeyTimer
Global RepeatTime = 100 ;--> Repetierzeit
Global TimeToRepeat = 500 ;--> Zeit bis zum Einsetzen des Repeatiervorgangs

Global Key$

Global MausTaste[3]

Global ClipBoard$=""

InputBox=New InputBoxTyp

InputBox\X1=50
InputBox\Y1=50
InputBox\X2=400
InputBox\Y2=24
InputBox\Text$=""

InputBox\CursorFarbe=Farbe(0,0,0)
InputBox\Cursor=1
InputBox\MaxLang=30

InputBox\Ins=True

InputBox\TextFarbe[0]=Farbe(0,0,0)

InputBox\HTextFarbe[0]=Farbe(255,255,255)

InputBox\CursorBreit=2

InputBox\Tab=1

InputBox=New InputBoxTyp

InputBox\X1=50
InputBox\Y1=150
InputBox\X2=400
InputBox\Y2=24
InputBox\Text$=""

InputBox\CursorFarbe=Farbe(0,0,0)
InputBox\Cursor=1
InputBox\MaxLang=30

InputBox\Ins=True
InputBox\Tab=2

InputBox\TextFarbe[0]=Farbe(0,0,0)

InputBox\HTextFarbe[0]=Farbe(255,255,255)

InputBox\CursorBreit=2

InputBox\Status=Aktiv

InputBox=New InputBoxTyp

InputBox\X1=50
InputBox\Y1=250
InputBox\X2=400
InputBox\Y2=24
InputBox\Text$=""
InputBox\Tab=3

InputBox\CursorFarbe=Farbe(0,0,0)
InputBox\Cursor=1
InputBox\MaxLang=30

InputBox\Ins=True

InputBox\TextFarbe[0]=Farbe(0,0,0)

InputBox\HTextFarbe[0]=Farbe(255,255,255)

InputBox\CursorBreit=2

ClsColor 92,92,92

Timer=CreateTimer(10)

Repeat
Cls
Keyboad
MausUpdate
Key
DrawInputBox
Flip
WaitTimer Timer
Forever


Function Key()
For InputBox=Each InputBoxTyp
If InputBox\Status=Aktiv Then

If Asc(Key$)>31 Then
If InputBox\Markiert=True Then
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
InputBox\Markiert=False
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Key$+Mid$(InputBox\Text,InputBox\MarkiertX1+1)
InputBox\Cursor=InputBox\MarkiertX1+1
Else
If InputBox\MaxLang>Len(InputBox\Text) Then
If InputBox\Ins=True Then
If InputBox\Cursor>Len(InputBox\Text) Then
If InputBox\Cursor<InputBox\MaxLang Then
InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+1)
InputBox\Cursor=InputBox\Cursor+1
End If
Else
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+1)
InputBox\Cursor=InputBox\Cursor+1
End If
Else
If InputBox\Cursor>Len(InputBox\Text) Then
If InputBox\Cursor<InputBox\MaxLang Then
InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+2)
InputBox\Cursor=InputBox\Cursor+1
End If
Else
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+2)
InputBox\Cursor=InputBox\Cursor+1
End If
End If
End If
End If
Else

If Shift=False And Strg=False Then
Select Asc(Key$)
Case 1;Pos1
InputBox\Cursor=0
InputBox\Markiert=False
Case 2;Ende
InputBox\Cursor=Len(InputBox\Text)
InputBox\Markiert=False
Case 3;Einfügen
InputBox\Ins=True-InputBox\Ins
Case 4;Entf
If InputBox\Markiert=True Then
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
InputBox\Markiert=False
Else
If Len(InputBox\Text)>InputBox\Cursor Then
If InputBox\Markiert=True Then
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
InputBox\Markiert=False
Else
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Mid$(InputBox\Text,InputBox\Cursor+2)
End If
End If
End If
Case 8;Del

If InputBox\Markiert=True Then
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
InputBox\Markiert=False
Else
If Len(InputBox\Text)>0 And InputBox\Cursor=>1 And Len(InputBox\Text)-InputBox\Cursor=>0 Then
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor-1)+Mid$(InputBox\Text,InputBox\Cursor+1)
InputBox\Cursor=InputBox\Cursor-1
ElseIf InputBox\Cursor=>1 Then
InputBox\Cursor=InputBox\Cursor-1
End If
End If
Case 9 ;Tab
TabNr=InputBox\Tab

For InputBox=Each InputBoxTyp

If TabNr<InputBox\Tab Then
If InputBox\Tab<MaxTab Or MaxTab=0 Then
MaxTab=InputBox\Tab

End If
End If
If InputBox\Tab<TabNr Then
If MinTab=0 Or MinTab>InputBox\Tab Then
minTab=InputBox\Tab
End If
End If
Next

If MaxTab<>TabNr And MaxTab<>0 Then
InputBoxNrNeu=MaxTab
Else
InputBoxNrNeu=minTab
End If




If InputBoxNrNeu>0 Then
For InputBox=Each InputBoxTyp
InputBoxZaehler=InputBoxZaehler+1
If InputBoxNrNeu=InputBoxZaehler Then
InputBox\Status=Aktiv
Else
If InputBox\Status=Aktiv Then
InputBox\Status=InAktiv
End If
End If
Next
End If
Return

Case 13;Enter

TabNr=InputBox\Tab

For InputBox=Each InputBoxTyp

If TabNr<InputBox\Tab Then
If InputBox\Tab<MaxTab Or MaxTab=0 Then
MaxTab=InputBox\Tab

End If
End If
If InputBox\Tab<TabNr Then
If MinTab=0 Or MinTab>InputBox\Tab Then
minTab=InputBox\Tab
End If
End If
Next

If MaxTab<>TabNr And MaxTab<>0 Then
InputBoxNrNeu=MaxTab
Else
InputBoxNrNeu=minTab
End If




If InputBoxNrNeu>0 Then
For InputBox=Each InputBoxTyp
InputBoxZaehler=InputBoxZaehler+1
If InputBoxNrNeu=InputBoxZaehler Then
InputBox\Status=Aktiv
Else
If InputBox\Status=Aktiv Then
InputBox\Status=InAktiv
End If
End If
Next
End If
Return

Case 27;ESC
Case 31;links
If InputBox\Cursor>=1 Then
InputBox\Cursor=InputBox\Cursor-1
End If
InputBox\Markiert=False
Case 30;rechts
If InputBox\MaxLang>InputBox\Cursor Then
InputBox\Cursor=InputBox\Cursor+1
End If
InputBox\Markiert=False
End Select
ElseIf Shift=False And Strg=True Then

If KeyDown(30) Then;Strg+A
If Len(InputBox\Text)>0 Then
InputBox\MarkiertX1=0
InputBox\MarkiertX2=Len(InputBox\Text)
InputBox\Markiert=True
End If
End If

If KeyDown(46) Then ;Strg+C
If InputBox\Markiert=True Then
ClipBoard$=Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
End If
End If

If KeyDown(47) Or KeyDown(210) Then ;Strg+V Strg+Einfg
If Len(ClipBoard$)>0 Then
If InputBox\Markiert=True Then

InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
InputBox\Markiert=False
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+ClipBoard$+Mid$(InputBox\Text,InputBox\MarkiertX1+1)
InputBox\Cursor=InputBox\MarkiertX1+Len(ClipBoard$)

ElseIf InputBox\Ins=True Then
InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+ClipBoard$+Mid$(InputBox\Text,InputBox\Cursor+1)
InputBox\Cursor=InputBox\Cursor+Len(ClipBoard$)
Else
If InputBox\Cursor>Len(InputBox\Text) Then
InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
InputBox\Text=InputBox\Text+ClipBoard$
InputBox\Cursor=InputBox\Cursor+Len(ClipBoard$)
Else
InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+ClipBoard$+Mid$(InputBox\Text,InputBox\Cursor+Len(ClipBoard$))
InputBox\Cursor=InputBox\Cursor+Len(ClipBoard$)
End If
End If
End If
End If

If KeyDown(45) Then;Strg+X
If InputBox\Markiert=True Then
ClipBoard$=Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
InputBox\Markiert=False

End If
End If



If KeyDown(203) Then ;Strg+links
Leerzeichen=False
InputBox\Markiert=False
If InputBox\Cursor>Len(InputBox\Text) Then
InputBox\Cursor=Len(InputBox\Text)
End If

If InputBox\Cursor>0 Then
For Pos=InputBox\Cursor-1 To 1 Step -1
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
End If
InputBox\Cursor=Pos
End If

If KeyDown(205) Then ;Strg+rechts
InputBox\Markiert=False
If InputBox\Cursor>Len(InputBox\Text) Then
InputBox\Cursor=Len(InputBox\Text)
End If

If InputBox\Cursor<Len(InputBox\Text) Then
For Pos=InputBox\Cursor+1 To Len(InputBox\Text)
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
InputBox\Cursor=Pos-1
End If
End If

If KeyHit(21) Then

End If

ElseIf Shift=True And Strg=False Then

If KeyDown(205) Then ;Shift+rechts
If InputBox\Markiert=True Then
If InputBox\MarkiertX1<InputBox\Cursor Then
InputBox\MarkiertX1=InputBox\MarkiertX1+1
InputBox\MarkiertX2=InputBox\MarkiertX2-1
If InputBox\MarkiertX2=0 Then InputBox\Markiert=False
Else
If InputBox\MarkiertX1+InputBox\MarkiertX2<Len(InputBox\Text) Then
InputBox\MarkiertX2=InputBox\MarkiertX2+1
End If
End If
Else
If InputBox\Cursor=<Len(InputBox\Text) Then
InputBox\Markiert=True
InputBox\MarkiertX1=InputBox\Cursor
InputBox\MarkiertX2=1
End If
End If
End If

If KeyDown(203) Then ;Shift+links
If InputBox\Markiert=True Then
If InputBox\MarkiertX1=>InputBox\Cursor Then
InputBox\MarkiertX2=InputBox\MarkiertX2-1
If InputBox\MarkiertX2=0 Then InputBox\Markiert=False
Else
If InputBox\MarkiertX1>0 Then
InputBox\MarkiertX1=InputBox\MarkiertX1-1
InputBox\MarkiertX2=InputBox\MarkiertX2+1
End If
End If
Else
If InputBox\Cursor=<Len(InputBox\Text) Then
InputBox\Markiert=True
InputBox\MarkiertX1=InputBox\Cursor-1
InputBox\MarkiertX2=1
End If
End If
End If

If Asc(Key$)=1 And InputBox\Cursor>0 Then ;Shift+Pos1
If InputBox\Cursor<=Len(InputBox\Text) Then
InputBox\Markiert=True
InputBox\MarkiertX1=0
InputBox\MarkiertX2=InputBox\Cursor
Else
InputBox\Markiert=True
InputBox\MarkiertX1=0
InputBox\MarkiertX2=Len(InputBox\Text)
End If
End If

If Asc(Key$)=2 Then ;Shift+Ende
If InputBox\Cursor<Len(InputBox\Text) Then
InputBox\Markiert=True
InputBox\MarkiertX1=InputBox\Cursor
InputBox\MarkiertX2=Len(InputBox\Text)-InputBox\Cursor
End If
End If

If KeyDown(4);Shift+Entf
If InputBox\Markiert=True Then
ClipBoard$=Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
InputBox\Markiert=False
End If
End If


ElseIf Shift=True And Strg=True Then



If KeyDown(203) Then ;Shift+Strg+links
Leerzeichen=False
If InputBox\Markiert=True Then
If InputBox\MarkiertX1=>InputBox\Cursor Then
MarkiertPos=InputBox\MarkiertX2+InputBox\MarkiertX1
For Pos=MarkiertPos-1 To 1 Step -1
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
If Pos<=InputBox\Cursor Then

InputBox\Markiert=False

Else
InputBox\MarkiertX2=Pos-InputBox\MarkiertX1
If InputBox\MarkiertX2=<0 Then InputBox\Markiert=False
End If

Else
If InputBox\MarkiertX1>0 Then
MarkiertPos=InputBox\MarkiertX1
For Pos=MarkiertPos-1 To 1 Step -1
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
InputBox\MarkiertX1=Pos
InputBox\MarkiertX2=MarkiertPos-Pos+InputBox\MarkiertX2

End If
End If
Else
If Len(InputBox\Text)>0 And InputBox\Cursor>0 Then
If InputBox\Cursor>Len(InputBox\Text) Then
MarkiertPos=Len(InputBox\Text)
Else
MarkiertPos=InputBox\Cursor
End If
For Pos=MarkiertPos-1 To 1 Step -1
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
InputBox\MarkiertX1=Pos
InputBox\MarkiertX2=MarkiertPos-Pos
InputBox\Markiert=True

End If
End If
End If

If KeyDown(205) Then ;rechts
Leerzeichen=False
If InputBox\Markiert=True Then
If InputBox\MarkiertX1<InputBox\Cursor Then


MarkiertPos=InputBox\MarkiertX1
For Pos=MarkiertPos+1 To Len(InputBox\Text)
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
InputBox\MarkiertX2=InputBox\MarkiertX2-(Pos-InputBox\MarkiertX1)+1
InputBox\MarkiertX1=Pos-1
If InputBox\MarkiertX2=<0 Then InputBox\Markiert=False
Else
MarkiertPos=InputBox\MarkiertX1+InputBox\MarkiertX2

If MarkiertPos<=Len(InputBox\Text) Then

For Pos=MarkiertPos+1 To Len(InputBox\Text)
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
InputBox\MarkiertX2=Pos-InputBox\MarkiertX1-1
End If
End If
Else

If InputBox\Cursor<=Len(InputBox\Text) Then
For Pos=InputBox\Cursor+1 To Len(InputBox\Text)
If Mid$(InputBox\Text,Pos,1)=" " Then
Leerzeichen=True
Else
If Leerzeichen=True Then
Exit
End If
End If
Next
InputBox\MarkiertX1=InputBox\Cursor
InputBox\MarkiertX2=Pos-inputBox\Cursor-1
InputBox\Markiert=True

End If
End If
End If


End If
End If
End If
Next
End Function




Function MausUpdate()
MausTaste[1]=MouseHit(1)>0
MausTaste[2]=MouseHit(2)>0
MausTaste[3]=MouseHit(3)>0

MausX=MouseX()
MausY=MouseY()

InputBoxNr=0
If MausTaste[1]=True Then
For InputBox=Each InputBoxTyp
InputBoxNr=InputBoxNr+1

If InputBox\X1=<MausX And InputBox\X1+InputBox\X2=>MausX Then

If InputBox\Y1=<MausY And InputBox\Y1+InputBox\Y2=>MausY Then
InputBoxNrNeu=InputBoxNr
Exit
End If
End If
Next


If InputBoxNrNeu>0 Then
FlushKeys
For InputBox=Each InputBoxTyp
InputBoxZaehler=InputBoxZaehler+1
If InputBoxNrNeu=InputBoxZaehler Then
InputBox\Status=Aktiv
Else
If InputBox\Status=Aktiv Then
InputBox\Status=InAktiv
End If
End If
Next
FlushKeys
End If
End If
End Function

Function DrawInputBox()

For InputBox=Each InputBoxTyp

Color 0,0,0
Rect InputBox\X1-1,InputBox\Y1-1,InputBox\X2+2,InputBox\Y2+2,0


ColorI InputBox\HTextFarbe[0]

Rect InputBox\X1,InputBox\Y1,InputBox\X2,InputBox\Y2


ColorI InputBox\TextFarbe[0]
Text InputBox\X1,InputBox\Y1,InputBox\Text

Select InputBox\Status
Case Aktiv
If InputBox\Markiert=True Then
MarkiertX1=StringWidth(Mid$(InputBox\Text+String$(" ",InputBox\MarkiertX1-Len(InputBox\Text)),1,InputBox\MarkiertX1))
Color 0,0,255
Rect InputBox\X1+MarkiertX1,InputBox\Y1,StringWidth(Mid$(InputBox\Text+String$(" ",InputBox\MarkiertX1),InputBox\MarkiertX1+1,InputBox\MarkiertX2)),InputBox\Y2
Color 255,255,255
Text InputBox\X1+MarkiertX1,InputBox\Y1,Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
End If

If InputBox\Markiert=False Then
ColorI InputBox\CursorFarbe
CursorX=InputBox\X1+StringWidth(Mid$(InputBox\Text,1,InputBox\Cursor)+String$(" ",InputBox\Cursor-Len(InputBox\Text)))

If InputBox\Ins=True Then
Rect CursorX,InputBox\Y1,InputBox\CursorBreit,InputBox\Y2
Else
CursorX2=StringWidth(Mid$(InputBox\Text+String$(" ",InputBox\Cursor+1),InputBox\Cursor+1,1))
Rect CursorX,InputBox\Y1,CursorX2,InputBox\Y2,0
End If
End If
End Select
Next
End Function

Function ColorI(I)
Color (I And $FF0000)/$10000,(I And $FF00)/$100,I And $FF
End Function

Function Farbe(r,g,B)
Return r*$10000 + g*$100 + b
End Function

Function Keyboad()
Strg=False
Alt=False
Shift=False
AltGr=False
Key$=""

If KeyDown(42)=True Or KeyDown(54)=True Then Shift=True
If KeyDown(157)=True Or KeyDown(29)=True Then Strg=True
If KeyDown(56)=True Then Alt=True
If KeyDown(184)=True Then AltGr=True


Key$=Chr$(GetKey())
If Key$=Chr$(127) Then key$=""


If Key$=Chr$(0) Then
If KeyTimer<MilliSecs() Then
KeyTimer=MilliSecs()+RepeatTime
;--> Ziffernblock
If KeyHit(82) Then Key$="0" ;0
If KeyHit(79) Then Key$="1" ;1
If KeyHit(80) Then Key$="2" ;2
If KeyHit(81) Then Key$="3" ;3
If KeyHit(75) Then Key$="4" ;4
If KeyHit(76) Then Key$="5" ;5
If KeyHit(77) Then Key$="6" ;6
If KeyHit(71) Then Key$="7" ;7
If KeyHit(72) Then Key$="8" ;8
If KeyHit(73) Then Key$="9" ;9
If KeyHit(181) Then Key$="/" ;/
If KeyHit(55) Then Key$="*" ;*
If KeyHit(74) Then Key$="-" ;-
If KeyHit(78) Then Key$="+" ;+
If KeyHit(83) Then Key$="," ;,

If Strg=True Then
If AltGr=True Then

If KeyDown(11) Then Key$="}" ;}
If KeyDown(3) Then Key$="²" ;²
If KeyDown(4) Then Key$="³" ;³
If KeyDown(8) Then Key$="{" ;{
If KeyDown(9) Then Key$="[" ;[
If KeyDown(10) Then Key$="]" ;]
If KeyDown(12) Then Key$="\" ;\
If KeyDown(16) Then Key$="@" ;@
If KeyDown(27) Then Key$="~" ;~
If KeyDown(86) Then Key$="|" ;|
If KeyDown(18) Then Key$="€" ;Euro
If KeyDown(50) Then Key$="µ" ;µ
End If
Else
If Shift=True Then

If KeyDown(11) Then Key$="=" ;=
If KeyDown(2) Then Key$="!" ;!
If KeyDown(3) Then Key$=Chr$(34) ;"
If KeyDown(4) Then Key$="§" ;§
If KeyDown(5) Then Key$="$" ;$
If KeyDown(6) Then Key$="%" ;%
If KeyDown(7) Then Key$="&" ;&
If KeyDown(8) Then Key$="/" ;/
If KeyDown(9) Then Key$="(" ;(
If KeyDown(10) Then Key$=")" Wink

If KeyDown(30) Then Key$="A" ;A
If KeyDown(48) Then Key$="B" ;B
If KeyDown(46) Then Key$="C" ;C
If KeyDown(32) Then Key$="D" ;D
If KeyDown(18) Then Key$="E" ;E
If KeyDown(33) Then Key$="F" ;F
If KeyDown(34) Then Key$="G" ;G
If KeyDown(35) Then Key$="H" ;H
If KeyDown(23) Then Key$="I" ;I
If KeyDown(36) Then Key$="J" ;J
If KeyDown(37) Then Key$="K" ;K
If KeyDown(38) Then Key$="L" ;L
If KeyDown(50) Then Key$="M" ;M
If KeyDown(49) Then Key$="N" ;N
If KeyDown(24) Then Key$="O" ;O
If KeyDown(25) Then Key$="P" ;P
If KeyDown(16) Then Key$="Q" ;Q
If KeyDown(19) Then Key$="R" ;R
If KeyDown(31) Then Key$="S" ;S
If KeyDown(20) Then Key$="T" ;T
If KeyDown(22) Then Key$="U" ;U
If KeyDown(47) Then Key$="V" ;V
If KeyDown(17) Then Key$="W" ;W
If KeyDown(45) Then Key$="X" ;X
If KeyDown(44) Then Key$="Y" ;Y
If KeyDown(21) Then Key$="Z" ;Z
If KeyDown(40) Then Key$="Ä" ;Ä
If KeyDown(39) Then Key$="Ö" ;Ö
If KeyDown(26) Then Key$="Ü" ;Ü
If KeyDown(12) Then Key$="?" ;?

If KeyDown(13) Then Key$="`" ;`
If KeyDown(86) Then Key$=">" ;>
If KeyDown(51) Then Key$=";" ;;
If KeyDown(52) Then Key$=":" ;:
If KeyDown(53) Then Key$="_" ;_
If KeyDown(43) Then Key$="'" ;'
If KeyDown(41) Then Key$="°" ;°
If KeyDown(27) Then Key$="*" ;*

Else

;--> Ziffernblock
If KeyDown(82) Then Key$="0" ;0
If KeyDown(79) Then Key$="1" ;1
If KeyDown(80) Then Key$="2" ;2
If KeyDown(81) Then Key$="3" ;3
If KeyDown(75) Then Key$="4" ;4
If KeyDown(76) Then Key$="5" ;5
If KeyDown(77) Then Key$="6" ;6
If KeyDown(71) Then Key$="7" ;7
If KeyDown(72) Then Key$="8" ;8
If KeyDown(73) Then Key$="9" ;9
If KeyDown(181) Then Key$="/" ;/
If KeyDown(55) Then Key$="*" ;*
If KeyDown(74) Then Key$="-" ;-
If KeyDown(78) Then Key$="+" ;+
If KeyDown(83) Then Key$="," ;,

If KeyDown(11) Then Key$="0" ;0
If KeyDown(2) Then Key$="1" ;1
If KeyDown(3) Then Key$="2" ;2
If KeyDown(4) Then Key$="3" ;3
If KeyDown(5) Then Key$="4" ;4
If KeyDown(6) Then Key$="5" ;5
If KeyDown(7) Then Key$="6" ;6
If KeyDown(8) Then Key$="7" ;7
If KeyDown(9) Then Key$="8" ;8
If KeyDown(10) Then Key$="9" ;9

If KeyDown(30) Then Key$="a" ;a
If KeyDown(48) Then Key$="b" ;b
If KeyDown(46) Then Key$="c" ;c
If KeyDown(32) Then Key$="d" ;d
If KeyDown(18) Then Key$="e" ;e
If KeyDown(33) Then Key$="f" ;f
If KeyDown(34) Then Key$="g" ;g
If KeyDown(35) Then Key$="h" ;h
If KeyDown(23) Then Key$="i" ;i
If KeyDown(36) Then Key$="j" ;j
If KeyDown(37) Then Key$="k" ;k
If KeyDown(38) Then Key$="l" ;l
If KeyDown(50) Then Key$="m" ;m
If KeyDown(49) Then Key$="n" ;n
If KeyDown(24) Then Key$="o" ;o
If KeyDown(25) Then Key$="p" ;p
If KeyDown(16) Then Key$="q" ;q
If KeyDown(19) Then Key$="r" ;r
If KeyDown(31) Then Key$="s" ;s
If KeyDown(20) Then Key$="t" ;t
If KeyDown(22) Then Key$="u" ;u
If KeyDown(47) Then Key$="v" ;v
If KeyDown(17) Then Key$="w" ;w
If KeyDown(45) Then Key$="x" ;x
If KeyDown(44) Then Key$="y" ;y
If KeyDown(21) Then Key$="z" ;z
If KeyDown(40) Then Key$="ä" ;ä
If KeyDown(39) Then Key$="ö" ;ö
If KeyDown(26) Then Key$="ü" ;ü
If KeyDown(12) Then Key$="ß" ;ß

If KeyDown(13) Then Key$="´" ;´
If KeyDown(86) Then Key$="<" ;<
If KeyDown(51) Then Key$="," ;,
If KeyDown(52) Then Key$="." ;.
If KeyDown(53) Then Key$="-" ;-
If KeyDown(43) Then Key$="#" ;#
If KeyDown(41) Then Key$="^" ;^
If KeyDown(27) Then Key$="+" ;+
;--> Cursortasten



If KeyDown(28) Then Key$=Chr$(13) ;Enter
If KeyDown(1) Then Key$=Chr$(27) ;ESC
If KeyDown(15) Then Key$=Chr$(9) ;Tab

If KeyDown(210) Then Key$=Chr$(3) ;Einfügen
If KeyDown(207) Then Key$=Chr$(2) ;Ende
If KeyDown(199) Then Key$=Chr$(1) ;Pos1
If KeyDown(200) Then Key$=Chr$(28) ;rauf
If KeyDown(208) Then Key$=Chr$(9) ;runter
If KeyDown(203) Then Key$=Chr$(31) ;links
If KeyDown(205) Then Key$=Chr$(30) ;rechts
If KeyDown(211) Then Key$=Chr$(4) ;Entf

;--> Steuertasten
If KeyDown(57) Then Key$=" " ;Leertaste
If KeyDown(14) Then Key$=Chr$(8) ;Del
End If
End If
End If
Else
;--> Verzögerungszeit bis zum Einsetzen des Tastaur-Repeat
KeyTimer=MilliSecs()+TimeToRepeat
End If
End Function


Function Lower$(S$)
Slen=Len(S)
If Slen>0 Then
For P=1 To Slen
ASCII=Asc(Mid$(S$,P,1))
If Ascii>64 And Ascii<92 Then
Ascii=Ascii+32
ElseIf Ascii=220 Then ;ü
Ascii=252
ElseIf Ascii=196 Then ;ä
Ascii=228
ElseIf Ascii=214 Then ;ö
Ascii=246
End If
R$=R$+Chr$(ASCII)
Next
Return R$
End If
End Function

Function Upper$(S$)
Slen=Len(S)
If Slen>0 Then
For P=1 To Slen
ASCII=Asc(Mid$(S$,P,1))
If Ascii>96 And Ascii<123 Then
Ascii=Ascii-32
ElseIf Ascii=252 Then ;ü
Ascii=220
ElseIf Ascii=228 Then ;ä
Ascii=196
ElseIf Ascii=246 Then ;ö
Ascii=214
End If
R$=R$+Chr$(ASCII)
Next
Return R$
End If
End Function
[/syntax]

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group