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

Pages: [1]
1
Feature requests / Re: sf:Color float form
« on: September 03, 2012, 08:26:29 pm »
I understand that SMFL is not graphics engine. But of course, all of you knows, that videocard store all values in float. Not in unsigned chars :)

So even if you dont mess up with OpenGL 3+ deprecated stuff, users may store values in float.
Yes, convert is simple:
sf:Color ( (int)(MyFloatColor_R * 255.0f), ... );

But converting can be done in constructor, taking float values.

Nevermind. Its not important )

2
Feature requests / sf:Color float form
« on: September 03, 2012, 06:21:10 pm »
nothing special, just float form for sf::Color clamped to 0..1

sf::Color ( 1.0f, 1.0f, 1.0f ) == sf::Color ( 255, 255, 255 );

3
General / Re: [SFML 2.0] VS2008 Compile error
« on: September 02, 2012, 08:24:59 pm »
So, in SFML 2.0 text drawing function will be like this:
Maybe it help others who have trouble with this )

...
setlocale(LC_ALL, "Russian");
...

wchar_t* MultiCharToUniChar(char* mbString)
{
  int len = 0;
  len = (int)strlen(mbString) + 1;
  wchar_t *ucString = new wchar_t[len];
  mbstowcs(ucString, mbString, len);
  return ucString;
}

void DrawText ( int x, int y, char *format, ... )
{
        char buffer[512];
        wchar_t *wbuffer = NULL;

        va_list msg;
        va_start(msg, format);
        vsnprintf(buffer, 512, format, msg);
        va_end(msg);

        wbuffer = MultiCharToUniChar ( buffer );

        sf::Text text ( wbuffer, YOUR_FONT, YOUR_FONT_SIZE );
        text.setPosition ( x, y );

        sfRenderWindow.pushGLStates();
        sfRenderWindow.draw ( text );
        sfRenderWindow.popGLStates();

              delete []wbuffer;
}
 

After that you can call it like this:

DrawText ( 10, 10, "SDL, давай, до свидания! also current fps: %0.f", MyGameFPSCounterFloat );


Still, its probably more harder than in 1.6 ver, because in 1.6 there is no need in wchar, thanx to "handmade" charsets.

4
General / Re: [SFML 2.0] VS2008 Compile error
« on: September 02, 2012, 12:18:33 pm »
Project settings > C++ > Language > Treat wchar_t as native type --> yes

Yes! It works! Many many thanks :)
Russian letters also works perfect.

Goodbye SDL  ;D

5
General / [SFML 2.0] VS2008 Compile error
« on: September 01, 2012, 10:11:50 pm »
Everything works fine, except sf::String. Its in constructor with wchar or something...

This code:
sf::Text text ( std::wstring(L"hello") , Font, 50 );
 

generate compiller error
error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"


my programm use cyrillic fonts, and i think in 2.0 using wchar is only way to proper render it.
In 1.6 ver you just need to set your own charset, like
std::wstring std_charset = L"russian letters :)";
sf::Font Font1;
Font1.LoadFromFile("some.ttf", 30, std_charset );
 

but in 2.0 i dont see this option. Maybe you rename it or some?

Pages: [1]
anything