Results 1 to 10 of 10

Thread: 13h mode - text

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80

    13h mode - text

    I was just wondering what's the best way to display text in 13h mode (320x200x256). Some people suggest creating bitmap images of characters and just outputting them to the screen. Any other ways? Thanks.

  2. #2
    Zaei
    Guest
    Thats the way to go. Its fast, and easy (about as fast and easy as you can get, in fact). Even in games created today, that is the general method to display text.

    Z.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80
    All right, do you happen to know of an example of this (a source code of some program)? I understand the general idea, but there some little things that I would rather take a look at in action. What would you recommend for the text size (dimensions)?

  4. #4
    Zaei
    Guest
    I use 12x9 pixels, at the moment, and it works well (though it might be large at 320x200...

    The actual code is really easy. Here is the general algorithm:
    Code:
    for each letter:
      find the upper left corner of letter in bitmap
      loop through all pixels in letter, using dimensions you pick
      if the current color is the transparent color, move to the next pixel
    Basically, you are copying the pixels over to the screen, except for the pixels that are the transparent color that you choose.

    Z.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80
    I just tried making a bitmap like that (using the whole ASCII chart) and it didn't really work for me. First of all, what program do you use? I tried doing this with MS Paint, but it doesn't seem to like very small fonts. Also, what font do you use, most fonts seem to have different letter width based on the character (like '!' would have less width then a 'W'), and how would you know what size to use for different dimensions?

  6. #6
    Zaei
    Guest
    I wrote a console app to print out all of the characters after the space character, then print-screened, the stuck it into paint. Its a fixed width font, so I know how big each char is.

    Z.

  7. #7
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    I wrote this code couple of years ago.... I did not test this code for compilers other than Turbo C/C++ 3.0

    In the attached zip are 2 font files a vga.h file, font.h, and a loadfont.cpp

    Look in the vga.h file... you'll find functions you will really love and I spend a realllllyyyyy long time to code them. A lot of nights with little sleep

    Anyways....

    I lost the code with witch I created the font files, if you want to create other fonts, just try to figure out how the LoadFont works....
    Attached Files Attached Files

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80
    That is awesome! Even more that I needed. Thanks.

  9. #9
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    I found the code to create the font files....
    So...
    In this zip.... a cpp to create the font file and a mouse.h that the cpp uses....

    This cpp uses a different type of graphics, I hope it works in your compiler... if it does not, tell me, and i'll make an EXE of the makefont.cpp, then it will work for sure....

    When the app starts, put with & height then you have to press + until you get to the character you want to edit.... and - (minus key) to go back.... I just noticed that I did not make the program check when it goes over 255 (or less than 0) ... don't try it.... i did, and it crashed..

    Also... I did not make it ask in what file name to save everything, instead it will save it in "font3.fnt", you have to change the line "fl = fopen("Font3.fnt", "wb");"

    Again... this code I originally made it for Turbo C/C++ 3.0, not sure if it works on other compiles....

    And.... another thing..... if you use lot's of functions from my code.... and you plan to publish your code or program..... can you add my name to your about.... or wherever you mention your programming people list stuff.....
    It feels like all the nights spent to make this code are for nothing, when I give my code like this.... I hope you understand...
    Attached Files Attached Files

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    80
    Cool, I just tested it out and everything works great. Going to try and make a few fonts myself right now. I'll be sure to include your name in my programs that use this code. Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width