Konsolen Modul für BMAX (Neue Version 1.4)
Übersicht BlitzMax, BlitzMax NG Codearchiv & Module
klepto2Betreff: Konsolen Modul für BMAX (Neue Version 1.4) |
Fr, Mai 20, 2005 10:33 Antworten mit Zitat |
|
---|---|---|
Um etwas mehr in die OOP und das Erstellen von Modulen in BMAX zukommen habe ich folgendes kleines Modul geschrieben.
Es handelt sich um eine einfache Konsole die folgende Features enthält : - Verschieden Größe der Konsole - Einstellbarer Alpha Wert - Integrierter FPS Counter (an un ausschaltbar) - volle Bearbeitung des Strings (durch Cursor bewegung mit den Pfeiltasten) - Durch alle vorher eingegebeben Strings rotieren (um einen String zu erhalten,den man vorher eingegeben hat. - Übergabe des letzten eingegebenen Strings an das Hauptprogramm - Senden von Strings aus dem Hauptprogramm an die Console. geplante Features: - anpassbares Design der Konsole(über Skins) - auswahl der Schriften und TextGröße Version 0.53 : Type Console Function Create(_length:Int,_height:int,_alpha:Float,_max_chars:int) Method Update() Method SetStatus(_st:Int) ; 1 = Sichtbar 0 = Versteckt Method Set_alpha(_al:Float) Method Return_Alpha:Float() Method Return_Status:Int() Method Return_last:String() ; gibt den letzten Eingegebenen String zurück Method SetFPS(f_st:Byte) ; True = zeigt FPS an False = zeigt kein FPS Method Send_Text(txt:String) ; Sendet einen beliebigen Text an die Console Method Set_CursorSpeed(_blink:int) ; Setzt die Blinkgeschwindigkeit auf den an gegebenen Wert ( je kleiner der Wert desto schneller die Blinkgeschwindigkeit) Code: [AUSKLAPPEN] Module Pub.Console ModuleInfo "Name: A Console Module for BMAX" ModuleInfo "License : None(Credits would be nice)" ModuleInfo "Copyright 2005 Benjamin 'Klepto2' Rössig" ModuleInfo "Simple Console like in some Shooters or similar" ModuleInfo "Version: 0.6" Import BRL.GLMax2d Import BRL.Max2D Import BRL.Keycodes Import BRL.Retro Import BRL.LinkedList Import BRL.Font Global CText_List:Tlist Global CSysItem_List:TList Type CConsole Field length:Int Field height:Int Field index:Int = 0 Field Alpha:Float Field Status:Int Field tc:Int Field temp_Text:String Field Return_Text:String = "" Field Show_FPS:Byte = True Field Dep_FPS:Byte = True Field fc,ms,mn,fr Field MAX_Chars:int Field c_timer1:Int = 0 Field c_timer2:int = 0 Field c_ms:Int Field c_pos:int = 0 Field list_index:int = 0 Field c_blink:Int = 500 Field Show_Statusbar:Byte = False Field Dep_Statusbar:Byte = False Field C_Length:Int = 200 Field tcr,tcb,tcg : int Field bcr,bcb,bcg : Int Function Create:CConsole(_length:Int,_height:int,_alpha:Float,_max_chars:Int) local c:CConsole = New CConsole c.length = _length c.height = _height c.Alpha = _Alpha c.MAX_Chars = _max_chars c.tcr = 255 c.tcb = 255 c.tcg = 255 c.bcr = 25 c.bcb = 25 c.bcg = 25 ' SetImageFont(Null) Return c End Function Method Update() if status = 1 then 'SetImageFont(c_Font) if Background = Null then SetBlend Alphablend SetAlpha alpha SetColor bcr,bcb,bcg Drawrect(0,0,length,height) SetColor tcr,tcb,tcg Drawline 0,height-25,length,height-25,0 local t_index:Int = 0 if Ctext_List <> Null then For t_Text:CText = eachin Ctext_list SetColor tcr,tcb,tcg Drawtext(t_Text.Text,0,height-(40+(t_index*20))) t_index = t_index + 1 next Endif endif tc = Getchar() SetColor tcr,tcb,tcg SetAlpha alpha*2 if c_pos = temp_text.Length then if tc <> 0 and temp_text.Length < max_chars and tc <> key_backspace and not keydown(key_alt) and tc <> key_enter then Temp_Text = Temp_text + CHR(tc) c_pos = c_pos + 1 Endif if tc = key_backspace then Temp_text = left(Temp_Text,Temp_text.length - 1) if c_pos > 0 then c_pos = c_pos - 1 Endif else if tc <> 0 and temp_text.Length < max_chars and tc <> key_backspace and tc <> key_enter then t_text1:String = left(temp_text,c_pos) t_text2:String = right(temp_text,temp_text.length-c_pos) T_Text2 = CHR(tc) + T_Text2 Temp_text = T_text1 + T_text2 Temp_Text = left(temp_text,temp_text.length) Debuglog t_text1.Length + " : " + t_text2.length + " : " + temp_text.Length c_pos = c_pos + 1 Endif if tc = key_backspace then t_text1:String = left(temp_text,c_pos-1) t_text2:String = right(temp_text,temp_text.length-c_pos) Temp_text = t_text1 + t_text2 Temp_Text = left(temp_text,temp_text.length) Debuglog t_text1.Length + " : " + t_text2.length + " : " + temp_text.Length if c_pos > 0 then c_pos = c_pos - 1 Endif Endif if keyhit(key_right) then if c_pos < temp_text.length then c_pos = c_pos + 1 Endif endif if keyhit(key_left) then if c_pos > 0 then c_pos = c_pos - 1 Endif endif if keyhit(key_up) then if Ctext_List <> Null then if list_index <= Ctext_list.Count() then list_index = list_index + 1 if list_index > Ctext_list.Count() then List_index = 1 local n = 0 For t_Text:CText = eachin Ctext_list temp_text = t_text.Text n = n + 1 if n = list_index then n = 0 exit endif Next Endif c_pos = temp_text.Length endif if keyhit(key_Down) then if Ctext_List <> Null then if list_index >= 0 then list_index = list_index - 1 if list_index < 0 then List_index = Ctext_list.Count()-1 For t_Text:CText = eachin Ctext_list temp_text = t_text.Text n = n + 1 if n = list_index then n = 0 exit endif Next Endif c_pos = temp_text.Length endif if tc = key_Enter then 'Temp_Text = left(temp_text,temp_text.length-1) CText.Create(Temp_Text.Trim()) Return_Text = Temp_Text Temp_Text = "" c_pos = 0 list_index = 0 end if DrawText(Temp_text,0,height-20) 'Draw Cursor if c_timer1 = 0 then c_timer1 = millisecs() if c_ms - c_timer1 > c_blink then DrawText "_",c_pos*8,height-18 if c_timer2 = 0 then c_timer2 = millisecs() if c_ms - c_timer2 > c_blink then c_timer1 = 0 c_timer2 = 0 endif endif c_ms = millisecs() ' Debuglog temp_text.length 'End Cursor endif 'End Console and Start of new added Items if fc = 0 then ms = Millisecs() mn = Millisecs() - ms fc = fc + 1 if mn > 1000 then fr = fc fc = 0 endif SetBlend Alphablend SetAlpha alpha if Dep_FPS = False and Status = 1 then Dep_FPS = True elseif Dep_FPS = True and Status = 0 Dep_FPS = False end if if Show_FPS = True And Dep_Fps = True and Show_Statusbar = False then SetColor bcr,bcb,bcg Drawrect(length,0,30,15) SetColor tcr,tcb,tcg DrawText fr,length,0 end if if Show_FPS = True And Dep_Fps = False and Show_Statusbar = False then SetColor bcr,bcb,bcg Drawrect(Graphicswidth()- Textwidth(fr),0,Textwidth(fr),Textheight(fr)) SetColor tcr,tcb,tcg DrawText fr,Graphicswidth()- Textwidth(fr),0 endif if Dep_Statusbar = False and Status = 1 then Dep_Statusbar = True Show_FPS = False elseif Dep_Statusbar = True and Status = 0 Dep_Statusbar = False Show_FPS = False end if if Show_Statusbar = True And Dep_Statusbar = True then SetColor bcr,bcb,bcg Drawrect (length,0,C_Length,45) SetColor tcr,tcb,tcg DrawText "FPS : "+fr,length,0 DrawText "Memalloced : "+Memalloced(),length,15 DrawText "MemUsage : "+MemUsage(),length,30 If CsysItem_List <> Null then SetColor bcr,bcb,bcg Drawrect (length,45,C_Length,CsysItem_list.Count() * 15) SetColor tcr,tcb,tcg Drawline C_Length+length,45,length,45,0 w_i = 0 For i_Item:IText = eachin CsysItem_list DrawText i_Item.Text+ var I_item.w_PTR,length,45 + w_i * 15 w_i:+1 next For S_Item:SText = eachin CsysItem_list DrawText S_Item.Text+ var S_item.w_PTR,length,45 + w_i * 15 w_i:+1 next For F_Item:FText = eachin CsysItem_list DrawText F_Item.Text+ var F_item.w_PTR,length,45 + w_i * 15 w_i:+1 next For D_Item:DText = eachin CsysItem_list DrawText D_Item.Text+ var D_item.w_PTR,length,45 + w_i * 15 w_i :+1 next For L_Item:LText = eachin CsysItem_list DrawText L_Item.Text+ var L_item.w_PTR,Length,45 + w_i * 15 w_i:+1 next For B_Item:BText = eachin CsysItem_list DrawText B_Item.Text+ var B_item.w_PTR,Length,45 + w_i * 15 w_i:+1 next Endif end if if Show_Statusbar = True And Dep_Statusbar = False then SetColor bcr,bcb,bcg Drawrect(Graphicswidth()- C_Length,0,C_Length,45) SetColor tcr,tcb,tcg DrawText "FPS : "+fr,Graphicswidth()- C_Length,0 DrawText "Memalloced : "+Memalloced(),Graphicswidth()- C_Length,15 DrawText "MemUsage : "+MemUsage(),Graphicswidth()- C_Length,30 If CsysItem_List <> Null then SetColor bcr,bcb,bcg Drawrect (Graphicswidth()- C_Length,45,C_Length,CsysItem_list.Count() * 15) SetColor tcr,tcb,tcg w_i = 0 Drawline c_Length+Graphicswidth()- C_Length,45,Graphicswidth()- C_Length,45,0 For I_Item:IText = eachin CsysItem_list DrawText I_Item.Text+ var I_item.w_PTR,Graphicswidth()- C_Length,45 + w_i * 15 w_i:+1 next For S_Item:SText = eachin CsysItem_list DrawText S_Item.Text+ var S_item.w_PTR,Graphicswidth()- C_Length,45 + w_i * 15 w_i:+1 next For F_Item:FText = eachin CsysItem_list DrawText F_Item.Text+ var F_item.w_PTR,Graphicswidth()- C_Length,45 + w_i * 15 w_i:+1 next For D_Item:DText = eachin CsysItem_list DrawText D_Item.Text+ var D_item.w_PTR,Graphicswidth()- C_Length,45 + w_i * 15 w_i :+1 next For L_Item:LText = eachin CsysItem_list DrawText L_Item.Text+ var L_item.w_PTR,Graphicswidth()- C_Length,45 + w_i * 15 w_i:+1 next For B_Item:BText = eachin CsysItem_list DrawText B_Item.Text+ var B_item.w_PTR,Graphicswidth()- C_Length,45 + w_i * 15 w_i:+1 next Endif end if End Method Method SetStatus(st:int) Status = st Flushkeys() End Method Method Set_Statusbar(b_st:Byte) Show_Statusbar = b_st End Method Method Set_Alpha(_al:Float) Alpha = _al End Method Method Return_Alpha:Float() Return Alpha End Method Method Return_Status:Int() Return Status End Method Method Return_last:String() Return Return_text End Method Method SetFPS(f_ST:Byte,d_ST:Byte = True) dep_FPS = d_st Show_FPS = f_ST End Method Method Get_FPS:Int() Return fr End Method Method Send_Text(txt:String) CText.Create(txt) End Method Method Set_CursorSpeed(_blink:int) c_blink = _blink End Method Method Set_CFont(_C_Font:String,_smooth:Int = 0) c_Font = LoadImageFont(_C_Font,15,_smooth) End Method Method Set_BackColor(_r:Int,_b:Int,_g:int) bcr = _r bcb = _b bcg = _g End Method Method Set_TextColor(_r:Int,_b:Int,_g:int) tcr = _r tcb = _b tcg = _g End Method Method Add_IntWatch(Name:String,_ptr:Int Ptr) Assert name.length < 11 else "Add_IntWatch : Name to long !! " +Name+" (max. 10 chars)" If name.length < 10 then Repeat Name = Name + " " until Name.Length = 10 Endif if Name.Length <= 10 then Name = Name + " : " if CsysItem_List = Null then CsysItem_List = New TList I_ITEM:IText = New IText I_ITEM.Text = Name I_Item.w_ptr = _ptr if TextWidth(name + var _PTR)> C_Length then C_Length = TextWidth(name + var _PTR) CsysItem_List.AddLast(I_Item) endif End Method Method Add_StringWatch(Name:String,_ptr:String Ptr) Assert name.length < 11 else "Add_StringWatch : Name to long !!" +Name+" (max. 10 chars)" If name.length < 10 then Repeat Name = Name + " " until Name.Length = 10 Endif if Name.Length <= 10 then Name = Name + " : " if CsysItem_List = Null then CsysItem_List = New TList S_ITEM:SText = New SText S_ITEM.Text = Name S_Item.w_ptr = _ptr if TextWidth(name + var _PTR)> C_Length then C_Length = TextWidth(name + var _PTR) CsysItem_List.AddLast(S_Item) endif End Method Method Add_FloatWatch(Name:String,_ptr:Float Ptr) Assert name.length < 11 else "Add_FloatWatch : Name to long !!" +Name+" (max. 10 chars)" If name.length < 10 then Repeat Name = Name + " " until Name.Length = 10 Endif if Name.Length <= 10 then Name = Name + " : " if CsysItem_List = Null then CsysItem_List = New TList F_ITEM:FText = New FText F_ITEM.Text = Name F_Item.w_ptr = _ptr if TextWidth(name + var _PTR)> C_Length then C_Length = TextWidth(name + var _PTR) CsysItem_List.AddLast(F_Item) endif End Method Method Add_DoubleWatch(Name:String,_ptr:Double Ptr) Assert name.length < 11 else "Add_DoubleWatch : Name to long !!" +Name+" (max. 10 chars)" If name.length < 10 then Repeat Name = Name + " " until Name.Length = 10 Endif if Name.Length <= 10 then Name = Name + " : " if CsysItem_List = Null then CsysItem_List = New TList D_ITEM:DText = New DText D_ITEM.Text = Name D_Item.w_ptr = _ptr if TextWidth(name + var _PTR)> C_Length then C_Length = TextWidth(name + var _PTR) CsysItem_List.AddLast(D_Item) endif End Method Method Add_LongWatch(Name:String,_ptr:long Ptr) Assert name.length < 11 else "Add_LongWatch : Name to long !!" +Name+" (max. 10 chars)" If name.length < 10 then Repeat Name = Name + " " until Name.Length = 10 Endif if Name.Length <= 10 then Name = Name + " : " if CsysItem_List = Null then CsysItem_List = New TList L_ITEM:LText = New LText L_ITEM.Text = Name L_Item.w_ptr = _ptr if TextWidth(name + var _PTR)> C_Length then C_Length = TextWidth(name + var _PTR) CsysItem_List.AddLast(L_Item) endif End Method Method Add_ByteWatch(Name:String,_ptr:Byte Ptr) Assert name.length < 11 else "Add_ByteWatch : Name to long !!" +Name+" (max. 10 chars)" If name.length < 10 then Repeat Name = Name + " " until Name.Length = 10 Endif if Name.Length <= 10 then Name = Name + " : " if CsysItem_List = Null then CsysItem_List = New TList B_ITEM:BText = New BText B_ITEM.Text = Name B_Item.w_ptr = _ptr if TextWidth(name + var _PTR)> C_Length then C_Length = TextWidth(name + var _PTR) CsysItem_List.AddLast(B_Item) endif End Method End Type Type CText Field Text:String Function Create(_Text:String) if CText_List = Null then CText_list = New TList t_Text:CText = New CText t_Text.Text = _Text CText_List.Addfirst(t_Text) End Function End type ' Types for Byte Short Int Long Float Double Object String Type IText Field Text:String Field w_PTR:int PTR End Type Type SText Field Text:String Field w_PTR:String PTR End Type Type FText Field Text:String Field w_PTR:Float PTR End Type Type DText Field Text:String Field w_PTR:Double PTR End Type Type LText Field Text:String Field w_PTR:Long PTR End Type Type BText Field Text:String Field w_PTR:Byte PTR End Type Hier noch ein Beispiel : Code: [AUSKLAPPEN] Framework pub.console Graphics(800,600,32,-1) TestF:Float = 0.0 TestS:String = "This is a String" TestD:Double = 23 TestI:Int = 2 TestL:Long = 200 TestB:Byte = 1 Rem At first the Init of the Console itself: Normally it is very simple console.create(witdth,height,alpha,length of the text you could enter) At the Start the Colorvalues for the Console are set to 25,25,25 (Background) and 255,255,255 (Text) by default. EndREM c:Cconsole = Cconsole.Create(400,150,.5,20) Rem Two simple commands : setFPS toogles a little FPS Window on and off setStatus toogles the console itself on and off Note: if the console is turned off you're available of the SetFPS command. But then the FPS is shown in the top right corner instead of glueing on the console position. Note 2: setfps has also a second optional parameter which is set to true by default by setting this parameter to false you can make the fps display unparented and could show it as if the console is turned off. end Rem c.setFPS(False) c.setstatus(1) Rem Now here comes one more feature of this Console: It is a kind of Variable Watcher. You can add Variables to a special Window of the Console(declared later) Currently you can add Int,Long,Float,Double,Byte and Strings to the console by using their own Function. I'm sorry for that different Functions but I haven't found a way to do it in one Function.(If you have a solution,please tell me) All these Function works the same. Add_****Watch(Name of your Variable:String, VarPtr Your Variable you want to watch) *Name maximum chars = 10 End Rem c.Add_DoubleWatch("TestD",varPtr TestD) c.Add_LongWatch("TestL",varPtr TestL) c.Add_ByteWatch("TestB",varPtr TestB) c.Add_Floatwatch("TestF",varPtr testF) c.Add_intwatch("TestI",varPtr TestI) c.Add_StringWatch("TestS",varPTR TestS) While Not KeyHit(key_escape) Cls SetAlpha 1.0 Global A_st:Float = c.Return_Alpha() TestF = RND(0.0,100000.0) If KeyHit(key_space) And KeyDown(key_alt) Then _st = 1 - _st c.setstatus(_st) End If If KeyHit(key_F) And KeyDown(key_alt) Then F_st = 1 - f_st c.setFPS(F_st,F_st1) End If If KeyHit(key_G) And KeyDown(key_alt) Then F_st1 = 1 - f_st1 c.setFPS(F_st,F_st1) End If If KeyDown(key_A) And KeyDown(key_alt) Then A_st:Float = A_St + .001 End If If KeyDown(key_Y) And KeyDown(key_alt) Then A_st:Float = a_st - .001 End If Rem With this Method you can send Text directly to the Console like debugging infos or maybe 'Cheat enabled' Easy to use: Send_Text(Your Text:String) End REM If KeyHit(KEY_1) And KeyDown(key_alt) Then c.send_Text("This is a Text,sended to the Console") EndIf REm With this methods you can simply change the blinkrate of the cursor higher = slower lower = faster End REM if keyhit(KEY_2) and keydown(key_alt) then c.set_CursorSpeed(500) endif if keyhit(KEY_3) and keydown(key_alt) then c.set_CursorSpeed(50) endif Rem The Statusbar is the thing your 'Watches' are shown.It has the same Options as the FPS command. You can only show the FPS or the Statusbar but not both the same time. Also with no added watches, the Statusbar will show some infos. FPS MemAlloc MemUsage End REM if keyhit(KEY_4) and keydown(key_alt) then F_st2 = 1 - f_st2 c.set_Statusbar(F_st2) endif Rem With the following Methods you can change the Colors to your behaviour. End Rem if keyhit(KEY_5) and keydown(key_alt) then col_t1 = RND(0,255) col_t2 = RND(0,255) col_t3 = RND(0,255) col_b1 = col_t1/10 col_b2 = col_t2/10 col_b3 = col_t3/10 c.set_Backcolor(col_b1,col_b2,col_b3) c.set_TextColor(col_t1,col_t2,col_t3) endif Rem One very importend Command is the 'Return_text'.With this command you can read out the last entered Text in your console and let your App react on it. i.e Console Text = 'GOD Mode 1' Reaction Send to Console 'Cheat enabled' and set God = 1 End REM DrawText(c.Return_text,320,240) Rem Set_Alpha allows you to change the Alpha value in runtime With Return_Alpha you can get the current Alpha End Rem c.set_Alpha(A_st) Rem Last but not least the main Method of this console Importend: It always have to be at the end of the main loop like in this case else there will be some issues with entering Text End REM c.Update() DrawText("Alt + Space toggles Console on and off",0,400) DrawText("Alt + F toggles FPS ",0,420) DrawText("Alt + G unparent FPS",0,440) DrawText("Alt + A increase Alpha",0,460) DrawText("Alt + Y decrease Alpha",0,480) DrawText("Alt + 1 sends a text to the Console",0,500) DrawText("Alt + 2 set Cursor BlinkSpeed to 500",0,520) DrawText("Alt + 3 set Cursor BlinkSpeed to 50",0,540) DrawText("Alt + 4 toggles the Statusbar",0,560) Drawtext("Alt + 5 changes the Back and Text color",0,580) FlushMem() Flip Wend Edit: Neue Version: folgender Fehler wurde beseitigt: Wenn man einen vorher eingegeben String bearbeitet hat wurde der Cursor immer falsch angezeigt. Dies ist nun beseitigt. Im Moment müsst ihr das Module noch selber compilieren. Aber die nächste Version kommt auch compiliert als Zip. Ich hoffe es ist für einige nützlich. PS: Ich weiß der Code ist nicht gut struktoriert aber ich war noch nie ein Freund von Ordnung. |
||
- Zuletzt bearbeitet von klepto2 am Do, Jul 28, 2005 9:54, insgesamt 5-mal bearbeitet
klepto2 |
Mo, Mai 23, 2005 19:49 Antworten mit Zitat |
|
---|---|---|
Neue Version (Code aus vorherigem Post geändert) 0.6:
[Edit:] Neue Version steht ebenfalls compiliert als Download zur Verfügung: http://klepto2.kl.funpic.de/DL/ (ConsoleMod.rar) In der Readme.txt stehen weitere Details. Neue Befehle zur Variablen Überwachung: s. Beispiel ... Befehle um die Überwachung anzuzeigen. s. Beispiel ... Befehle um die Farben der Console anzupassen s. Beispiel ... Leider wird noch immer der default Font verwendet, wird sich aber mit der nächsten Version ändern. Außerdem wäre es nett, wenn ihr mir eure Meinung und vorallem Verbesserungsvorschläge geben könntet. Danke |
||
klepto2 |
Mo, Mai 30, 2005 23:14 Antworten mit Zitat |
|
---|---|---|
Neue Version 0.7:
Support für statische und animierte Bilder Support für Fonts optional kann nun auch ein Rahmen um das Konsolenfenster gezeichnet werden. neue Rar heißt ConsoleMod07.rar ---> www.brsoftware.de.vu/DL/ |
||
klepto2 |
Do, Jun 09, 2005 10:29 Antworten mit Zitat |
|
---|---|---|
Version 1.01b
Änderungen der Readme.txt entnehmen. Neue Features : Kompatibel mit Bmax 1.10 Multiline support für gesendete Texte Methode zum aufsplitten des return_text in einen Array. Files : ConsoleMODV101.rar Consolehotfix.rar bitte beide downloaden |
||
klepto2 |
Di, Jul 05, 2005 23:51 Antworten mit Zitat |
|
---|---|---|
Neue Version 1.3
Änderungen aus der Readme.txt Code: [AUSKLAPPEN] Features: Full OOP Design (IMO) Uses Max2d (so I think it may compatible with later 3DModule by Mark) COnfigureable size FPS Counter Watch Functions Sending Text to the Console and receiving Input from the Console Alpha support Easy to use Different Fonts usable static and animated Images as background supported Frame supported Frame could be changed via runtime Roll in and out feature Caption support Multiple line for sended text ***New Feature*** Added Functionptr to set unique Console Commands : With this simple method you can init an integrated help command for the console: C.Add_Command("/Help",Help,Null,Null,0) Function Help() For Local h:TCommand = EachIn c.Command_List C.Send_Text(h.Command) Next End Function For more examples take a look in the sample. Trimming a return Text to different parts : i.e : the Return_text 'Load Map MyMap.dat' will result in text[0] = 'Load' text[1] = 'Map' text[2] = 'MyMap.dat' by using following code : local text:String[] text = c.Return_TrimText[32] ' The '32' stays for the ASCII Code of ' " " in this case After that you can get the different parts of text by using a For next loop. For further details look in the sample. Added another method quite the same as Return_TrimText but this is called Return_Trim_text2(_Trim:String) Instead of giving an int to the Method like in the first method you can enter a String like " :" or "ABCDEF" The difference between both methods is the following : In some cases you have entered a text like "Load Map:MyMap.dat" With Method 1 (Return_TrimText(32)): text[0] = 'Load' text[1] = 'Map:MyMap.dat' With Method 2 (Return_TrimText2(" :")): text[0] = 'Load' text[1] = 'Map' text[2] = 'MyMap.dat' Download : http://www.brsoftware.de.vu/DL/ File: ConsoleMod13.RAR |
||
klepto2 |
Do, Jul 28, 2005 9:51 Antworten mit Zitat |
|
---|---|---|
Neue Version 1.4:
Neue Features: StaticText Support (fester Text,der immer im oberen Teil der Konsole angezeigt wird und unterschiedliche Farbe und FOnt haben kann) 1.Version mit integrierter Hilfe (bbdoc) Support für prozdurales Programmieren Download : http://www.brsoftware.de.vu/DL/ File: ConsoleModV14.RAR |
||
Wild-Storm |
Sa, Jun 02, 2007 1:35 Antworten mit Zitat |
|
---|---|---|
Wieso bekomm ich hier
Code: [AUSKLAPPEN] DrawText i_Item.Text+ Var I_item.w_PTR,length,45 + w_i * 15
beim Kpmilieren den Fehler Code: [AUSKLAPPEN] Compile Error: Expecting expression but encountered Var
Jemand ne Idee? |
||
Visit http://www.next-dimension.org
------------------------------------------------- Freeware Modelle, Texturen & Sounds: http://www.blitzforum.de/forum...hp?t=12875 |
Dreamora |
Sa, Jun 02, 2007 1:49 Antworten mit Zitat |
|
---|---|---|
weil es da kein VAR geben kann.
Da werden ganz klare angaben erwartet, entweder du fürgst da einen Wert hinzu oder tust es nicht. Will heissen: nimm das VAR weg und sollte das Ding ein BytePtr sein, mach einen String draus sollte es ein String sein (siehe String Dokumentation für die Antwort nach dem "wie") oder nen Int Ptr / Float Ptr und nutze dann [0] um die Daten auszulesen Alternativ: Nutz keine Pointer wenn du nicht weisst wie sie funktionieren, denn BM wird ihre Daten nicht freigeben -> Memory Leak |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
Wild-Storm |
Sa, Jun 02, 2007 11:08 Antworten mit Zitat |
|
---|---|---|
Was mich nur verwundert ist, wie Klepto das kompilieren konnte.
edit:// Zitat von Klepto im englischen Forum auf die Frage "Does this work with the current blitz version": Zitat: unfortunatly not. there where a lot of changes that was making it a too much work to convert the code especialy the pointer thing.
Erklärt einiges |
||
Visit http://www.next-dimension.org
------------------------------------------------- Freeware Modelle, Texturen & Sounds: http://www.blitzforum.de/forum...hp?t=12875 |
Übersicht BlitzMax, BlitzMax NG Codearchiv & Module
Powered by phpBB © 2001 - 2006, phpBB Group