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.


Topics - mutonizer

Pages: [1]
1
Window / Logical link between sf::keyboard and ASCI/UNICODE tables?
« on: July 20, 2012, 09:07:15 am »
Morning,

Are there any SFML 2.0 function (or logic) to convert the sf::keyboard enum to an ASCI or UNICODE character table?

The idea is to be able to initialize a class (which is just to display sf:text, but with all events handling taken care of, etc) with a character, to make it a shortcut, and have the class handle the function to automatically edit the text and make all appropriate changes, like adding for example a "a) " in front of the current label text if we set that shortcut to "a", then react through events using sf::keyboard isPressed.

I've been using sf::keyboard to avoid tons of boolean stuff everytime sf::event:keyPressed pops up, but I'm having issues finding a logical conversion between the actual UNICODE key code, and sf::keyboard enum values and I can't just initialize with the enum directly, since I need to display the character in question.

So the question is, before I start doing my personal conversion function, is there already one in place?

2
Graphics / sf::Text in classes...font problem
« on: July 19, 2012, 03:15:37 pm »
Afternoon,

I'm working on some basic classes to have handy Labels, TextArea, InputBox, etc.

In all these, I use sf::text of course, and personal font as well and because of the default font crashing problem,  I've been using pointers to sf::Text in order to control how they initialize directly in the class constructor and a normal sf::font to hold the font, within each class. I figured, that way, the sf::font will stay alive as long as the object is..so no problem there...

That solved the default font crash but I then started getting insanely "wtf" issues on the sf::text draw function, each one regarding fonts in particular, as if they're no longer there at some point while they ARE still in the sf::font variables that was used to create the sf::text, for each objects. Made ZERO sense.

Then I figured: alright, let's make a sf::font right there at the start, and pass it around. But same issue again, when the draw calls arrive, it goes and starts doing font stuff...then returns that there's nothing there.

It's like...when you create a sf::text, it stores some address of something related to the font but can't find it later on!
As a note, everything fine if I just let the default font handle this, but of course, it crashes later on...and I can't use custom fonts...


So my question is...
If you want to put all sf::text calls into a class (let's say Clabel) how do you handle the font?

Another question would be: how the hell does sf::font work in relation to sf::text and especially draw calls?



Thanks in advance, that's driving me nuts :)

edit:
- oh, I use latest SFML 2.0 files, freshly made via CMAKE, and I'm on VS2010. I do have an ATI card (think it's related to the font issue if I got it right).

Pages: [1]