How do I use a spritefont for an HTML element's font?

0 favourites
  • 4 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • Like I would prefer to use one of my game's spritefonts for the text entry object instead of actual fonts.

    Or is there an alternative way to do a text entry without using the object?

  • Keyboard - on any key pressed:

    Spritefont - append text - Keyboard.TypedKey

    Not ideal as:

    • You'd need someway to detect whether the SpriteFont should be accepting keyboard input or not (i.e. equivalent of a text entry box having focus)
    • Someway to handle cursor movement, delete, backspace, tab etc.
    • Word wrapping/resizing to fit
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think Hypnospace Outlaw did it this way and it was made with Construct. So it had all the drawbacks you listed.

    The best results I got so far was having a text input object always set to focus when active and hidden, then change a spritefont to its text on a text change, but it's still not ideal because you can do everything, except the cursor being visible or being able to place a sprite for it anywhere in the faked text entry. Otherwise, copy and paste and everything works. But you can't change the sprite cursor based on input like left and right keys, because the keyboard object can't detect input while a text entry is focused.

  • I tried just doing one from scratch. So far it works pretty well aside from repeated keystrokes and highlighting text not working yet, but I can get them to work. Backspace and delete work, I think I just forgot to show them.

    I guess when I get done I can upload a tutorial for it.

    https://drive.google.com/open?id=1YBO28If3sOb7mBSoqzJOI8zmKvqXeTx-&usp=drive_fs

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)