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 - Elarys

Pages: [1]
1
Graphics / Re: sf::String
« on: August 03, 2012, 12:09:19 pm »
You're probably right, I jumped ahead too fast in efforts to keep up motivation and 'fun'.

Back to C++ Primer it is. Sorry

Edit: Turns out I had a case of Visual Studio Intellisense failure. When using +, it was highlighting the + with red underlines to suggest an error. So I assumed I was being an noob, and so I then tried << as per my original post. Which then wouldn't compile.

2
Graphics / sf::String
« on: August 03, 2012, 01:27:46 am »
I'm trying to do some error handling, and also playing around with SFML while learning C++, so I might be missing something here. But why am I not allowed to just string 2 sf::String strings together with << like I can with cout.

For example, this fails to compile at <<

        sf::String hdr, msg;
        sf::Font myFont;
        sf::Text myText;
        sf::String fontFamily = "kaiu.ttf";

        if (!myFont.loadFromFile(fontFamily))
        {
                hdr = "Warning, unable to load font";
                msg = "Unable to load font " << fontFamily;
        }

Thanks

3
Graphics / Re: SFML2 Unicode
« on: July 29, 2012, 12:59:00 pm »
Thanks, and I found my problem too. When I was trying this late at night I ended up removing this line

myText.setFont(myFont);

So my chosen font wasn't actually being loaded at all. I had it there for my first few attempts, but removed it to let SFML use the default font... I forgot to put that line back in! My fault, sorry.

Thanks for the advice on Unicode though, I need to research encoding next.

Edit: On this note, is it possible SFML can load the font from the OS itself? Or do I need to specify a fully qualified path to the ttf file?

4
Graphics / Re: SFML2 Unicode
« on: July 29, 2012, 01:13:41 am »
I've also tried the 22mb arialuni.ttf Arial Unicode MS, that comes with office which supports

Quote
Arabic script (Arabic, Balochi, Persian, Shahmukhi, Urdu), Armenian, Cyrillic (all or most of range), Devanagari, Georgian (Mkhedruli and Asomtavruli), Greek (including polytonic and Coptic characters), Gurmukhi, Hebrew, IPA, Japanese (Hiragana, Katakana, Kanji/Han Ideographs), Kannada, Korean (Hangul only), Latin, Tamil, Thai, Vietnamese

Same thing happens even with this font file.

5
Graphics / [SOLVED] SFML2 Unicode
« on: July 29, 2012, 12:39:24 am »
I'm still relatively new to C++, and I chose SFML over SDL based on advise from various others. Working in a multi-language environment, I figured I'd try and get something working with multiple languages.

I've used the initial SFML2 Tutorial, and modified it a little after poking around the documentation. But I still can't get a simple hello world to work with anything outside the ASCII range. What am I doing wrong please?

All I get is 5 square blocks displayed. And so far this is just Japanese, I'd like to throw Korean and Chinese at this too.

My source code is here:
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(300, 200), "SFML works!");

        sf::Font myFont;
        myFont.loadFromFile("arial.ttf");
        //myFont.getDefaultFont();

        sf::String s;
        s = L"&#12371;&#12435;&#12395;&#12385;&#12399;";
        //s = "Test";

        sf::Text myText;
        myText.setString(s);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(myText);
        window.display();
    }

    return 0;
}

Pages: [1]
anything