November 25, 2020, 08:27:17 AM

Author Topic: [bb] Use bitmap fonts with user input by slenkar [ 1+ years ago ]  (Read 602 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Use bitmap fonts with user input
Author : slenkar
Posted : 1+ years ago

Description : Allows you to get the players name or other input while using bitmap fonts,(use your own bitmap font code!)

Code :
Code: BlitzBasic
  1. Graphics 800,600
  2. Global player_name$
  3. Global name_chosen=no
  4.  
  5. While Not name_chosen
  6. Cls
  7. FlushKeys()
  8.  
  9. While Not player_input
  10. player_input=GetKey()
  11. Text (400,200,"Enter name (max 7 characters)",True,True)
  12. Text (400,300,player_name+"$",True,True)
  13. Flip
  14. Wend
  15.  
  16. actual_character$=0
  17. actual_character=Chr(player_input)
  18. If player_input<>13 And player_input<>8 And Len(player_name)<7
  19. player_name$=player_name$+actual_character
  20. Else
  21. If player_input=13 And Len (player_name)>0
  22. name_chosen=True
  23. EndIf
  24. If player_input=8
  25. player_name=delete_letter(player_name)
  26. EndIf
  27. EndIf
  28. player_input=0
  29. Wend
  30. Print "your name is: "+player_name+" press a key to start game"
  31. WaitKey
  32. End
  33.  
  34. Function delete_letter$(St$)
  35.  
  36.   If Len(St$) = 0 Then Return ""
  37.  
  38.   Return Left$(St$, Len(St$) - 1)
  39.  
  40.  
  41. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal