|
Post by Wayne Rayner on Apr 21, 2010 18:32:17 GMT -5
Hey guys, If you have seen a lot of my code I like to use a lot of inputs. Is there a way to make this look better by making a text box or text field thingy. Like on websites. It would make my games so much easier for the users and me. . thanks for your help
|
|
|
Post by Adam on Apr 21, 2010 22:30:43 GMT -5
here, this is the messiest code I have ever written I think.... but you get the idea Dim __ScanKey, __ScanKey$, __Temp$, _windowIncrement Dim Text$(2)
Textmode(text_overlaid)
Sub _Incremnt(&Message$()) For _windowIncrement = ArrayMax(Message$) To 3 Step -1 Message$(_windowIncrement) = Message$(_windowIncrement-1) Next message$(2) = __Temp$ End Sub
Sub _Decremnt(&Message$()) __Temp$ = Message$(0) Message$(0) = Message$(2) For _windowIncrement = 2 To ArrayMax(Message$)-1 Message$(_windowIncrement) = Message$(_windowIncrement+1) Next Message$(ArrayMax(Message$)) = __Temp$ End Sub
Function _TextBox$(&Message$()) __ScanKey = INSCANKEY() __ScanKey$ = INKEY$() Print Message$(0) Color((cosd(performancecounter()/2.5)/4+.5)*255,(cosd(performancecounter()/2.5)/4+.5)*255,(cosd(performancecounter()/2.5)/4+.5)*255) Print "|" Color(0,0,0):Print Message$(1) IF __ScanKey = 0 Then Return "" Endif IF __ScanKey = 8 Then Message$(0) = Left$(Message$(0),Len(Message$(0))-1) ElseIF __ScanKey = 13 Then __TEMP$ = Message$(0)+Message$(1): Message$(0) = "": Message$(1) = "": IF __Temp$ = "" Then Return chr$(0) Else _Incremnt(Message$): Return __Temp$ Endif ElseIF __ScanKey = 35 Then Message$(0) = Message$(0) + Message$(1): Message$(1) = "" ElseIF __ScanKey = 36 Then Message$(1) = Message$(0) + Message$(1): Message$(0) = "" ElseIF __ScanKey = 37 Then Message$(1) = Right$(Message$(0),1)+Message$(1): Message$(0) = Left$(Message$(0),Len(Message$(0))-1) ElseIF __ScanKey = 38 Then _Decremnt(Message$) ElseIF __ScanKey = 39 Then Message$(0) = Message$(0) + Left$(Message$(1),1):Message$(1) = Right$(Message$(1),Len(Message$(1))-1) ElseIF __ScanKey = 46 Then Message$(1) = Right$(Message$(1),Len(Message$(1))-1) ElseIF Asc(__ScanKey$) > 31 Then Message$(0) = Message$(0) + __ScanKey$ Endif Return "" End Function
dim returnText as string resizetext(windowwidth()/2/20,1) glEnable(GL_SCISSOR_TEST) Do glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) cls glScissor(windowwidth()/4,windowheight()-(windowheight()/3),windowwidth()/2,20) glviewport(windowwidth()/4,windowheight()-(windowheight()/3),windowwidth()/2,20) glclearcolor(1,1,1,1) returnText = _Textbox$(text$)
drawtext() swapbuffers() loop until returnText <> ""
color(255,255,255) glScissor(0,0,windowwidth(),windowheight()) glviewport(0,0,windowwidth(),windowheight()) glclearcolor(0,0,0,1) resizetext(windowwidth()/16,windowheight()/20) do cls glclear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) print "you just entered:" +returnText drawtext() swapbuffers() loop
|
|
|
Post by Wayne Rayner on Apr 21, 2010 23:15:20 GMT -5
Ok that is nice but it's such a shame I don't understand OpenGL. But I will study and hopefully I can work it out.
|
|
|
Post by Supermonkey on Apr 22, 2010 6:57:28 GMT -5
Messy? maybe, but a nice example none the less
|
|
|
Post by twasik4 on Apr 26, 2010 7:09:24 GMT -5
you should put that into a [.code] block. xD
|
|
|
Post by Supermonkey on Apr 26, 2010 8:13:48 GMT -5
It gets rid of all the formatting in your code (tabs mainly) I prefer using the pre tag
|
|
|
Post by twasik4 on Apr 26, 2010 9:24:29 GMT -5
Well.. either way, that was my reasoning.. the tabs weren't working on it and it was all on one line.. and i didn't feel like tabing it >.>
|
|
|
Post by Supermonkey on Apr 26, 2010 10:22:34 GMT -5
Do you mean when you copy and paste the code? Can't say I've ever had that problem...
|
|
|
Post by twasik4 on Apr 26, 2010 13:49:12 GMT -5
Lol, lucky you. Unfortunately.. if it copies and pastes like that i don't even waste my time sorting/looking at the code.. =/
|
|
|
Post by Supermonkey on Apr 26, 2010 14:08:03 GMT -5
Probably dependent on what browser you use. Why can't they combine the code and pre tags so we can have nicely formatted code that can be copied?!
|
|
|
Post by twasik4 on Apr 26, 2010 19:37:15 GMT -5
I agree =S
|
|
|
Post by Wayne Rayner on Apr 26, 2010 22:59:39 GMT -5
wat about lol that would be epic awesome lol
|
|