Post by Wayne Rayner on Jul 3, 2010 9:21:19 GMT -5
Ok guys,
I was bored and I decided to make a text box. Things you should know
1) really it's not a text box except a box which has the Text$ variable as a input where that box has been placed. There fore type to many characters and you will exceed the text box
2) where I have loadtext it's not loading anything except a white box. So you don't need any image.
3) This is only version 0.01 - I have more features for this text box as I'm in need of on for my latest project. So look out for some updates fairly soon
here's the code
Now that you can see The main changes I'm going to make in the next version is going to be making the text wrap scroll when it reaches the end of the box.
I hope you still like it
The mose retarded programmer on this forum
Wayne Rayner
P.S You have to click the box, it's really a ingenious invention lol
I was bored and I decided to make a text box. Things you should know
1) really it's not a text box except a box which has the Text$ variable as a input where that box has been placed. There fore type to many characters and you will exceed the text box
2) where I have loadtext it's not loading anything except a white box. So you don't need any image.
3) This is only version 0.01 - I have more features for this text box as I'm in need of on for my latest project. So look out for some updates fairly soon
here's the code
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Text Box '
' A sprite based text box '
' version 0.01 '
' created by Wayne Rayner (wrayn3) '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' variables '
dim Box, cursor(1), TextBoxActive '
dim Text$ '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The Text Box '
Box = NewSprite(LoadTex("noting.bmp")) '
SprSetSize (200,20) '
SprSetPos (320,230) '
BindSprite (Box) '
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The main loop '
while true '
'
cursor(0) = Mouse_X()*640 '
cursor(1) = Mouse_Y()*480 '
'
if cursor(0)>(SprLeft(Box)) and cursor(0)<(SprRight(Box)) and cursor(1)>(SprTop(Box)) and cursor(1)<(SprBottom(Box)) then '
TextBoxActive = 1 '
endif '
'
if Mouse_Button(0) and TextBoxActive = 1 then '
resizetext(windowwidth()/12,windowheight()/14) '
color(255,0,0) '
Locate 18,16 : input Text$ '
endif '
'
wend '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Now that you can see The main changes I'm going to make in the next version is going to be making the text wrap scroll when it reaches the end of the box.
I hope you still like it
The mose retarded programmer on this forum
Wayne Rayner
P.S You have to click the box, it's really a ingenious invention lol