schreibskript

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

WEBLink

Betreff: schreibskript

BeitragMo, Sep 18, 2006 21:08
Antworten mit Zitat
Benutzer-Profile anzeigen
Jo, cih suche ein code der Input ersetzt.

MfG

Schnittlauch

Unkraut

Betreff: Re: schreibskript

BeitragMo, Sep 18, 2006 21:42
Antworten mit Zitat
Benutzer-Profile anzeigen
Versuch es mal mit getkey()
Ich wars nicht.
 

antome

!!! gesperrt !!!

BeitragMo, Sep 18, 2006 21:45
Antworten mit Zitat
Benutzer-Profile anzeigen
Im AnimB3D Quellcode ist eine Function drin, ich habe sie aus dem offiziellen und etwas verändert.
Ist auch als Text im Codearchiv hier zu finden.
antome

Blitzcoder

Newsposter

BeitragMo, Sep 18, 2006 21:54
Antworten mit Zitat
Benutzer-Profile anzeigen
Sowas kann man sich sehr leicht selber schreiben. Schau dir die Befehler getkey() Chr() Asc() etc an.

MfG Blitzcoder
P4 3 Ghz@3,55Ghz|GF 6600GT 256MB|Samsung 80GB | 2x Samsung 160GB|2048MB DDR-400 RAM|6 Mbit Flatrate | Logitech G15 | Samsung 225BW-TFT | Ubuntu Gutsy Linux | Windows Vista | Desktop | Blog | CollIDE | Worklog
________________
|°°°°°°°°°°°°°°||'""|""\__,_
|______________ ||__ |__|__ |)
|(@) |(@)"""**|(@)(@)****|(@)

WEBLink

BeitragMo, Sep 18, 2006 21:55
Antworten mit Zitat
Benutzer-Profile anzeigen
Mhh, wie meinen?
 

antome

!!! gesperrt !!!

BeitragMo, Sep 18, 2006 21:58
Antworten mit Zitat
Benutzer-Profile anzeigen
Falsche Funktion kann gelöscht werden
antome
  • Zuletzt bearbeitet von antome am Mo, Sep 18, 2006 22:18, insgesamt einmal bearbeitet

WEBLink

BeitragMo, Sep 18, 2006 22:06
Antworten mit Zitat
Benutzer-Profile anzeigen
Bearbeitet dies nicht ein Text?

Mir reicht es schon wenn einer erstellt wird.
 

antome

!!! gesperrt !!!

BeitragMo, Sep 18, 2006 22:17
Antworten mit Zitat
Benutzer-Profile anzeigen
War die falsche Funktion, hier eine kleine Demo
ist zwar etwas groß aber funktioniert.
Taste 1 drücken und dann kannst du Text eingeben

Code: [AUSKLAPPEN]

 

Graphics3D 800,600,0,2 
 
Camera = CreateCamera() 
light = CreateLight() 


While Not KeyDown(1)   

        If KeyDown(2) Then t$ = GetInput$(20,20,"Test ",50)   
   RenderWorld 
   Text 10,100,t$
   Flip 
   
Wend 
 
;Based on Input Function  from the Blitz codesection by Russell 
Function GetInput$(x,y,sPrompt$,iMaxLength = 10,xtest = 0,sFilter$ = "/all")

   FlushKeys
   iFlashInterval = 300      ; The blinking cursor speed

   
   If Lower$(sFilter$) = "/123" Then sFilter$ = "0123456789."               ; All the numbers
   If Lower$(sFilter$) = "/abc" Then sFilter$ = "abcdefghijklmnopqrstuvwxyz"   ; All the letters
   
   iTotalWidth = StringWidth(sPrompt$) + (iMaxLength * FontWidth())
   iTotalHeight = FontHeight()
   
   hTextBuffer = CreateImage(iTotalWidth,iTotalHeight)   ; Where the text will be drawn before blitting to the backbuffer()
   hCleanCopy = CreateImage(iTotalWidth,iTotalHeight)   ; Will hold a clean copy of the backbuffer (not the whole thing)
   MaskImage hTextBuffer,255,0,255                  ; Make the text background transparent so we can show text with BG showing
   SetBuffer ImageBuffer(hTextBuffer)               ; We're going to draw to the text buffer
   ClsColor 255,0,255                           ; Temporarily make the cls color the transparent color (magenta)
   Cls                                       ; Now clear to magenta
   ; Foreground (text) will be drawn in the current color
   
   CopyRect x,y,iTotalWidth,iTotalHeight,0,0,BackBuffer(),ImageBuffer(hCleanCopy)   ; Save a clean copy of the back buffer where the
                                                               ;    text is going to be

   SetBuffer BackBuffer()
   Repeat
      ; Blinking cursor code *******************************************************************************************************
      iCurrentTime = MilliSecs()
      If bFlash = True Then
         If (iCurrentTime - iOldFlashTime) >= iFlashInterval Then
            bFlash = False
            iOldFlashTime = MilliSecs()
         EndIf
      Else
         If (iCurrentTime - iOldFlashTime) >= iFlashInterval Then
            bFlash = True
            iOldFlashTime = MilliSecs()
         EndIf
      EndIf
      
      ; Input starts here **********************************************************************************************************
      iKeyPressed = GetKey()
      If iKeyPressed = 13 Then
         sKeyPressed$ = ""
      Else
         sKeyPressed$ = Chr$(iKeyPressed)
      EndIf
      
      ; IF the key passes, add it to the total *************************************************************************************
      If iKeyPressed Then
         If (sFilter$ = "/all") Or (sFilter$ = "") Or (Instr(sFilter$,sKeyPressed$) > 0) Then ; "all" does not filter any keys out
            If Len(sTotal$) < iMaxLength Then
               sTotal$ = sTotal$ + sKeyPressed$                        ; Add it to the total string IF it passes
               iNumDigits = iNumDigits + 1
            EndIf
         EndIf
      EndIf
      
      ; IF backspace was pressed, delete the last character from the total and update the number of digits *************************
      If KeyDown(14) And iNumDigits > 0 Then
         sTotal$ = Left$(sTotal$,iNumDigits - 1)
         iNumDigits = iNumDigits - 1
         Delay 50
      EndIf
      
      ; Draw the clean background and then the text on the backbuffer() ************************************************************
      DrawBlock hCleanCopy,x,y

      ; Draw the cursor IF enough time has passed (change iFlashInterval for different speeds) *************************************
      If Len(sTotal$) = iMaxLength Then
         rx = StringWidth(sPrompt$ + sTotal$) - StringWidth(Right$(sTotal$,1))
         rw = StringWidth(Right$(sTotal$,1))
      Else
         rx = StringWidth(sPrompt$) +StringWidth(sTotal$); (Len(sTotal$) * FontWidth())
         rw = FontWidth()
      EndIf
        UpdateWorld
        RenderWorld
      If bFlash = True Then
         Text x,y,sPrompt$ + sTotal$
         Rect x + rx,y,rw/6,FontHeight(),True
      Else
         Text x,y,sPrompt$ + sTotal$
      EndIf
       

      Flip
   Until iKeyPressed = 13 ; This is the 'return/enter' key
   
   ClsColor 0,0,0   ; Reset back to black
   Return sTotal$
End Function

WEBLink

BeitragDi, Sep 19, 2006 15:27
Antworten mit Zitat
Benutzer-Profile anzeigen
Hey ich danke dir das müsste eigentlich gehen

WEBLink

BeitragDi, Sep 19, 2006 16:27
Antworten mit Zitat
Benutzer-Profile anzeigen
Schade das skript hält das Programm auch an

PowerProgrammer

BeitragDi, Sep 19, 2006 16:29
Antworten mit Zitat
Benutzer-Profile anzeigen
musste wohl etwas umprogrammieren Razz Gibt viele Skripts im Codearrchiv!
www.xairro.com Alles für Webmaster und Programmierer! Es gibt mehr als bloß einen Counter!

BladeRunner

Moderator

BeitragDi, Sep 19, 2006 16:30
Antworten mit Zitat
Benutzer-Profile anzeigen
1. Keine Doppelposts bitte.
2. Forensuche gibt mehrere Inputroutinen aus Wink
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92

BlitzChecker

BeitragDi, Sep 19, 2006 17:16
Antworten mit Zitat
Benutzer-Profile anzeigen
nach weniger als 10 sekunden fosu:
https://www.blitzforum.de/foru...put+ersatz
https://www.blitzforum.de/foru...put+ersatz
https://www.blitzforum.de/foru...put+ersatz
https://www.blitzforum.de/foru...put+ersatz
https://www.blitzforum.de/foru...put+ersatz
Rolling Eyes
www.xairro.com

PowerProgrammer

BeitragDi, Sep 19, 2006 17:18
Antworten mit Zitat
Benutzer-Profile anzeigen
Jo, stand auch schon eine Kleinigkeit im BlitzFAQ, jetzt auch ein paar Links!
www.xairro.com Alles für Webmaster und Programmierer! Es gibt mehr als bloß einen Counter!
 

antome

!!! gesperrt !!!

BeitragDi, Sep 19, 2006 17:38
Antworten mit Zitat
Benutzer-Profile anzeigen
Wenn es dauernd Zeichen abfangen soll brauchts du sowas ähnliches.

Code: [AUSKLAPPEN]

While Not KeyDown(1)   
Cls
Code=GetKey ()
If Code <> 0 Then   
    If Code <> 13
       in$ = in$ + Chr$(Code)   
    Else
        my$ = in$
        in$ = "" 
    EndIf
EndIf   
 
Text 10,10,in$
Text 10,30,my$ 
Flip
Wend
antome

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group