Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dewyatt

Pages: 1 [2] 3 4 5
16
SFML projects / sfttf - truetype scalable fonts in SFML
« on: December 31, 2008, 09:27:37 pm »
Okay, I finally got around to releasing this thing.
This library provides scalable truetype font support for SFML.
sf::String does this but in a different way, and does not support a few of the features this library provides (yet!).
Right now this has only been tested with the newest SVN!
I'm not sure if it would compile/work with older versions.
This is intended as an alternative to SFML's sf::String until SFML supports outlines, etc.

Screenshots


Features
-Kerning support
-Outlined/stroked text
-Sizeable outlines
-Unicode

Download
I actually set up a Google Code project page for it since it seemed a little large for a wiki (and I wanted SVN).
http://code.google.com/p/sfttf/downloads/list
sfttf-0.2 comes with precompiled libs/test program.

Example
Code: [Select]

sfttf::FontManager FontMgr;
FontMgr.Initialize();
sfttf::Font* Font = FontMgr.loadFont("Font.ttf");

Font->setOutline(true);
Font->setFill(false);
Font->drawString("Hello, World!", 300.0f, 300.0f);

Everything is in the sfttf namespace.
You need a FontManager to load fonts (FontManager::loadFont).
The FontManager will unload all the fonts upon destruction or you can call FontManager::unloadFont.
See the readme/example for more info.

Project files are provided for Windows+Linux (codeblocks/vc2008).

Notes
Right now there are a few simple things that I have not added like rotations.
It only supports horizontal text, it does not support vertical layout.
It probably does not work with languages like Thai that have multiple levels per line.
It does not use exceptions. If something can fail, a boolean is returned.
I removed support for control characters '\r\n\t\v' (etc) at the last second as it complicated a few things.

17
General / [C++] exception handling problem
« on: December 31, 2008, 03:09:39 pm »
No problem. :)

18
General / [C++] exception handling problem
« on: December 31, 2008, 03:41:01 am »
This is obviously not SFML-specific.
The General forum is for general SFML-related stuff.

You would have been better off posting on a C++ forum.
Anyways, operator[] does not do range checking.
Use the at() member function:
http://www.cplusplus.com/reference/stl/vector/at.html

This would work:
Code: [Select]

#include <iostream>
#include <stdexcept>
#include <vector>

using std::vector;
using std::cout;
using std::cerr;
using std::endl;
using std::out_of_range;

int main()
{
    vector<int> intVec;
    try {
        int integer = intVec.at(-1);
        cout << "This won't get executed :)" << endl;
    }
    catch(out_of_range &e)
    {
        cout << "This won't get executed too :( on my machine" << endl;
        cerr << e.what() << endl;
    }
    catch(...)
    {
        cerr << "unhandled exception" << endl;
    }
}

19
Feature requests / Upgrade to freetype 2.3.7
« on: December 29, 2008, 10:19:07 pm »
Quote from: "Laurent"
Quote
Hopefully my code will give you an idea.

Where can I find it?
Anyway, my concern is not how to generate the outline, but rather how to use it properly. In SFML, the bitmap font is a black and white texture which is then modulated with a global color. How do you handle this with outlines? Do you have a separate texture containing only the outline, or do you use static colors?

Well I plan on releasing it within a week or so.
Maybe today or tomorrow actually.
I just want to add a few necessary features.

And yes, I store a separate texture containing the outline.
This means:
Pros:
-Flexibility
-Ease of use
Cons:
-Slight increase in memory usage
-Slight decrease in performance (tests showed about 15%)

I understand the hardest thing would be working it into SFML's design/style.
Quote from: "dabo"
Looks great!

Quote from: "Imbue"
That really does look great. This would be a great feature for SFML.

Thanks!
I hope one day it will be standard SFML. :)
Until then, I'll be working on it.

20
Feature requests / Upgrade to freetype 2.3.7
« on: December 29, 2008, 07:15:34 pm »
Quote from: "dabo"

I would love a screenshot :)

Here you go :wink:

All the text there is drawn with my library.
It shows:
-Outlined only (the Japanese at the bottom)
-Filled only (the FPS and mouse pos at the top)
-Outlined + Filled  (everything else)
It also shows that the outline size is adjustable.

Quote from: "Laurent"
Well, I don't really refuse to implement it ;)

It's just that I don't see how to do it properly.

Hopefully my code will give you an idea.
I don't think it would be too hard. :)

21
Feature requests / Upgrade to freetype 2.3.7
« on: December 29, 2008, 03:49:00 pm »
Quote from: "dabo"
So you can draw outlined text now? I want that too but Laurent refuses to implement it ;)

Well yes, with TrueType fonts.
I just never got around to releasing the code.

I should be releasing it within a week now though.  :D

22
Feature requests / Upgrade to freetype 2.3.7
« on: December 29, 2008, 08:23:36 am »
While I'm on the subject, a debug version of freetype.lib should be provided and used in debug builds.
This will avoid the "defaultlib 'msvcrt.lib' conflicts" warning.
Read the Caution at the bottom of:
http://msdn.microsoft.com/en-us/library/2kzt1wy3(VS.71).aspx
(URL tag does not support parentheses, copy&paste it)

23
Feature requests / Upgrade to freetype 2.3.7
« on: December 28, 2008, 10:27:33 pm »
I'm not sure why the latest SVN of SFML is using freetype 2.1.10 but I'm requesting an upgrade it to the latest 2.3.7.
I'm finally rewriting my SFML font system in preparation for its release and I'm not familiar with the older FT_Stroker interface of 2.1.10 (this is needed for outlined fonts).

I've already upgraded my local copy and have had no problems (it compiled at least).

24
SFML projects / Ovid the Owl - Freeware Game
« on: September 10, 2008, 03:47:31 pm »
Awww darn, I finished Act I!
This was a fun game!
Thanks for sharing it. :)
And if you complete Act II, I would love to play it.

25
SFML projects / Ovid the Owl - Freeware Game
« on: September 10, 2008, 03:14:01 pm »
Yes! So that was it. I don't get how I was supposed to come to that conclusion.
Was I really just supposed to 'Worry' and basically try all combinations?
Anyways, sorry you had to spell it out for me.  :P

26
SFML projects / Ovid the Owl - Freeware Game
« on: September 09, 2008, 03:38:11 pm »
Quote from: "lzr"
*SPOILER*
The clue is in the word WORRY. Specifically the letters W.O.R.R.Y.
*\SPOILER*

 :? I tried again but still can't figure it out. I do see the word but I have no idea on what to do...this is hard!

27
SFML projects / Ovid the Owl - Freeware Game
« on: September 05, 2008, 12:26:32 pm »
Spoiler:

So, once I'm in the submarine...where do I go from here!?
Am I supposed to do something with all this floating seaweed (or whatever it is)?
There seems to be a pipe at the bottom here but I can't go in it.

28
SFML projects / Ovid the Owl - Freeware Game
« on: September 03, 2008, 10:30:52 pm »
I just played this finally and it's awesome!
It's fun, playful, and I like the music.

It's too dark for me though, I can barely see what's going on.
I'm stuck in some caves, trying to avoid hitting things I can't even see.  :shock:

But it's very fun.  :D

29
SFML projects / BrainFuck
« on: September 03, 2008, 09:30:41 pm »
Quote from: "hacky"
who cares?

Rude.

30
SFML projects / Particles!
« on: September 03, 2008, 09:20:52 pm »
Wow, funny enough I just did this exact same thing about a month ago.
I based it off of Ogre3D's system as well.

I wrote Squirrel bindings for mine so you could have scripts like:
Code: [Select]

TestParticleSys = ParticleMgr.addSystem(300);
local Params =
{
Position = Vector2f(getMouseX().tofloat(), getMouseY().tofloat()),
Direction = Vector2f(1.0, 1.0),
EmissionRate = 100.0,
MinimumAngle = 0.0,
MaximumAngle = 360.0,
MinimumSpeed = 20.0,
MaximumSpeed = 20.0,
MinimumTimeToLive = 1.0,
MaximumTimeToLive = 1.0,
MinimumColor = Color(0, 0, 255, 255),
MaximumColor = Color(0, 120, 255, 255),
MinimumScale = 0.5,
MaximumScale = 0.6,
};
TestEmitter = TestParticleSys.addEmitter("Point", Params);
Params =
{
SubtractAlpha = 0.5
};
TestParticleSys.addAffector("Color Fader", Params);


Particle systems are too much fun.
I've spent so many hours just staring at cool particle effects.

P.S: I wish your screenshots would load.  :(

Pages: 1 [2] 3 4 5