Thread: Creating Fonts in C program

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    9

    Creating Fonts in C program

    I am programming a game and the standard DOS font for my C complier will not work in the different area of the graphics.

    1) Is there a graphics library somewhere on the net.

    Or

    2) Do I need to write my own code for fonts. If so how. Using pixel commands to draw them?

    Thanks

    Ace

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Do you mean the default Windows System font, or are you actually coding a DOS program? If you give more information about your code, we might be able to make suggestions. For instance, is this a console game, or a Windowed game?

    Todd

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    9

    DOS Sorry

    Yeah I know DOS but I'm trying to remember how to work in C so I can grad on to C++ or C#.

    I am currently writing a SIMPLE baseball game. I have the back bone of the game operation completed. I'm now working on the graphical interface. Using printf with the standard DOS out put, I get the same size font. Some times too big and some places too small.

    So the questions are. Is there a graphical/font library I can use for DOS. or will I have to write my own. If I do my own, do I simply draw each characture using a pixle command and then save as a function of my overall program?

    Thanks
    Ace

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    graphics.h

    There's that textcolor() function and cprintf.
    Google it, you'll find more info about it.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well if you're still thinking in "DOS" terms, then chances are your compiler is something like TurboC, or some other fossil from the previous millennium.

    No wait, the kicker is that your OS is also XP. Welcome to your horse drawn Ferrari.
    Isn't it time you joined the real world?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Nov 2007
    Posts
    9

    got a point

    Well as for the textcolor. I can print color and change background color. I just can't change sizes.

    And for the Horse drawn car. Well you do have a point. But my goal was to (re)learn the programming flow with my MS Quick C and then graduate on. I have done some programming with the MFC library in Visual C++ but that was a while ago and it exposed things I didn't quite understand. SO I decided to take a step back.

    It's hard to create music when your still trying to master the instrument. But thanks for the advice.

    Ace

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    But if you decide to try and learn ANSI-C from the outset, then all this "it works with the foo compiler" stuff goes away.

    When you know what the separation between the language (what all compilers support) and the implementation (whatever is specific to that compiler), then you can start to make better choices. For instance, you would recognise that a question about "fonts" is actually meaningless unless qualified by some additional implementation details.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Are you trying to say that because you are using a DOS-based compiler, it's easier to learn [because it's less advanced, or because it's older, or because it has less features or what??]? That's like saying a violin is easier to play than an electric guitar, because the violin has been around longer and doesn't use electrics [I can't play any instrument at all - not even the triangle - but I think you get the idea that I'm trying to promote here].

    There is one MAJOR difference in DOS [including "emulated DOS on top of Windows"] and Windows/Linux native programming: There's REAL MEMORY PROTECTION. That means, instead of just behaving really strangely when you do the most common types of pointer errors, the OS catches you trying to access an invalid address, and stops the code. It's a great safety net.

    And I agree with Salem, if you concentrate on learning the language C properly [and what is and isn't part of the standard], then you can much better apply what you learn and understand as a whole.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    Nov 2007
    Posts
    9

    Follow Up

    Well Im guessing there isn't a Font library, but in case you were curious to my reason for MS C. I haven't programmed for about 2 years. I wasn't a God at MS QC but ok. I started learning MFC in Visual C++. I even made a few small programs. I was getting the hang of Classes and a grasp of OOP. My issue was the flow. It wasn't a top down type lang. As I remember it involved running from a "monitoring" function. I'm sure it's easy to learn but I've probably developed bad habits in the past and it was frustating for me. Kinda like forcing yourself to drive backwards every where when you already can go forwards a lot easier.

    Anyway, my plan is to get back to VC++ soon,I just wanted to kick this B-Ball game around a little before getting back in to it.

    So any help you could give me on fonts would be greatly appreciated. Thanks

    Ace

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating a program to help with modding
    By chuck22 in forum C++ Programming
    Replies: 9
    Last Post: 02-16-2006, 10:16 AM
  2. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 09:48 AM
  3. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM
  4. creating a simple program to accept a password.
    By boy1015 in forum C++ Programming
    Replies: 11
    Last Post: 02-05-2002, 08:34 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM