Create a new character? - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10) +---- Thread: Create a new character? (/showthread.php?tid=1422) Pages:
1
2
|
Create a new character? - PhilOfPerth - 01-25-2023 Is there a (simple) way to define a new single character in QB64, without changing to a different character-set? I need a vertical line (like |) but in the right-hand column of the character-space. I know I can use graphics (Pset and Draw) to do this but this doesn't seem to render correctly on different screen resolutions. RE: Create a new character? - bplus - 01-25-2023 Code: (Select All) print "Test this"; CHR$(179);"abc" Any chr$(X) character is going to take up a one character space, but that might work for you, as your insert point. I did use a graphics line for a text box cursor just like you see in forum editor. You could make it blink too. You want this for that last word game as a cursor, correct? RE: Create a new character? - PhilOfPerth - 01-25-2023 Yes, that's what it's for. It's ok to take up a character space - I overwrite it when the cursor is moved, anyway (maybe wrap the cursor in spaces, so at the next print it gets removed). I just want it to be at the RHS of the character box, to make it clear where the insertion point will be. The graphic version seems to be a problem for some users - maybe their screen resolution? RE: Create a new character? - mnrvovrfc - 01-25-2023 (01-25-2023, 03:38 AM)PhilOfPerth Wrote: The graphic version seems to be a problem for some users - maybe their screen resolution? If you did your program in "text mode" you would notice better what is happening. That is, if the "DRAW" statement were turned into another "PRINT" which creates a vertical cursor. One character overwrites the other and anything else that is in the way. In graphics modes as well as in text. It was that way in QuickBASIC/QBasic with nothing to do about it except draw only the pixels of the characters laboriously. QB64 has _PRINTMODE but it's some hassle. It's better to print the character first, then draw the vertical cursor with "DRAW" in your program in the other thread. Otherwise you would have to erase the whole field where the characters are printed, because only pixels would be drawn of the characters which causes the characters to overwrite each other and it could get messy quickly. Code: (Select All) SCREEN 12 Without the _PRINTMODE then this program would just print an "A" at top-left corner of the window. Instead it prints this mutated thing. Using the pipe symbol or a fuzzy block isn't going to help in that case. What you could do is just print a "cursor", which is a pipe or whatever is not a letter, on the place where the player expects to insert a new letter in the game. Instead of using "DRAW" between characters. Like "BYS|T" as opposed to "BY|ST". Just print the "cursor" along with the rest of the text. RE: Create a new character? - bplus - 01-25-2023 Here is start of a custom cursor: Code: (Select All) _Title "MyCurs Test use left and right arrow keys to move cursor" 'b+ 2023-01-24 RE: Create a new character? - bplus - 01-25-2023 OK I moved all the stuff that controls the blinking into the myCurs sub so now main code can focus on it's job. Code: (Select All) _Title "MyCurs Test use left and right arrow keys to move cursor" 'b+ 2023-01-24 RE: Create a new character? - bplus - 01-25-2023 Oh check this out, a tiny editor started! Code: (Select All) _Title "MyCurs Test use left and right arrow keys to move cursor" 'b+ 2023-01-24 Yeah should use ElseIf's... RE: Create a new character? - bplus - 01-25-2023 Some more some better: Code: (Select All) _Title "MyCurs Test use left and right arrow keys to move cursor" 'b+ 2023-01-24 RE: Create a new character? - SMcNeill - 01-25-2023 Perhaps something simple like this? Code: (Select All) SCREEN _NEWIMAGE(640, 480, 32) RE: Create a new character? - PhilOfPerth - 01-25-2023 Thanks for all the suggestions. But, after trying them all, I feel that my original graphical cursor is the clearest and simplest for players to use. @mnrvovrfc: Sorry, but I'm at a loss as to what was happening in your Worm game, and not sure what you mean by "after four words were added..." as only single letters should be added. Can you explain a bit more, and tell me what screen mode you are using? I have made changes to clarify how/if the Wordlists files are being used, and will upload the new version shortly. I'm still experimenting with the suggestions made for using ASCII characters instead of graphics for the cursor. |