View RSS Feed

code_glitch

Prometheus TTF

Rate this Entry
Writing the font support procedures and functions into Prometheus_Vid unit now. Just wondering whether people would prefer:

Code:
Load Font -> variable
Drawtext (x,y, font, text)
or

Code:
Loadfont(fontname, source)
DrawText(x,y, fontname, text)
They're similar, but one uses a library and the other uses a specific font variable... Any thoughts? At this point I'm leaning towards the former option, but I have used the latter in experiments just as well.

cheers,
code_glitch

Submit "Prometheus TTF" to Digg Submit "Prometheus TTF" to del.icio.us Submit "Prometheus TTF" to StumbleUpon Submit "Prometheus TTF" to Google

Tags: prometheus Add / Edit Tags
Categories
Uncategorized

Comments

  1. WILL's Avatar
    Well how does this work in a memory management way?

    I think the code of the second might be easier to understand, but I might be thinking from an experienced programmer's point of view.

    Though here is a question I have about using the font name, would you not then have to make a totally new variable to store the name of the font for each instance where you'd use it? Why not just make it it's own type you have to declare anyhow? Then their variable names would essentially be their font names in code..?
  2. Nitrogen's Avatar
    I'm not a big fan of the "pass by reference" style procedures that change the value of one of the arguments, as it's not as clear as a direct assignment.

    I'm guessing that loadFont(fontname, source) will take an empty fontname object/record/class and fill it with the loaded info?

    I'd prefer something like fontname := loadFont(source); as it seems easier to read to me.

    In my Font Studio font loading class I did it in the OOP style:

    font := TFont.create(source);
    font.drawtext(x,y,"blah");
  3. code_glitch's Avatar
    I totally agree there nitro. But, a beginner might not like the whole New(sdl_colour) and all associated hassle. The idea behind this is to have a NewColour(name, R,G,B,Y,A), a getcolour(name) and a deletecolour(name) that handle everything a beginner might not want to do.