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

Pages: 1 2 [3] 4 5
31
Feature requests / Recreating the projektion matrix onwindow rescale
« on: April 27, 2008, 12:22:42 pm »
great ;) thx

32
Feature requests / Recreating the projektion matrix onwindow rescale
« on: April 26, 2008, 10:51:11 pm »
Well actually this ain't working out the way I thought..
The code Posted above doesn't work at all.. everything is distorted as always.. However, if I exchange the Viewport recreation with something like:
 
Code: [Select]

glViewport(0, 0, 512, 512);

 (constant size) the OGL cube is rendert properly, but sf::Sprites Strings etc aren't rendert correct.. :? any Idea hjow to fix this?
thx in advance.

33
Feature requests / selectors socket identification.
« on: April 25, 2008, 12:06:37 pm »
I know.. thats exactly, what I wantet to say with
Quote

one possibility would be to have a seconde array of sockets and then using == for testing..
(though maybe not understandable  :wink: )
so maybe having a map <socket, clientId> is the best Idea, since the sockets only are defined by its handle.. sounds good so far ^^

34
Feature requests / selectors socket identification.
« on: April 25, 2008, 11:47:02 am »
Is there a way to identify a socket, that is returned by the Selector.GetSocketReady(int i) (as in the current SVN...)
I would like to use the selector in a server.. now the server must know from which Client he got the package (IP is not enought, since there might be more than one client per IP)
one possibility would be to have a seconde array of sockets  and then using == for testing.. but the better one would be to have a unique SocketID or something for each socket in the selector..
Any chance you would add something like this to the selector class? (I even would do the little bit of coding^^
[/code]

35
General discussions / Addition for Font
« on: April 25, 2008, 10:31:39 am »
sry.. update..

36
General / Contributions
« on: April 25, 2008, 09:10:04 am »

37
General / Contributions
« on: April 24, 2008, 01:42:07 pm »
heres a quite good .ini parser:
(From Irrlicht forum, but should be easy to port)
greetz

38
General discussions / Addition for Font
« on: April 23, 2008, 08:39:21 pm »
A friend of mine+Me are currently building a GUI for SFML.
Doing editfields with mouse support is quite hard without access to the fonts character dimensions. So i did add a member to Font, that will return a Vector containing the size of a given character with a given style and a given scale. Since I got no SVN access I gonna post the patch in here..
(hoping it will be used in the SVN version)

Font.hpp:
Code: [Select]

#include <SFML/System/Vector2.hpp>
//..
//.. Rest of the code here
//..



////////////////////////////////////////////////////////////

    /// gets the size of a given character if renderet with this font

    ///

    /// \param c : The character, whose size should be returned

    /// \param s : The style of the character (default: Regular)

    /// \param scale : Scale of the string (default: 1)

    ///

    /// \return the Vector2f containing the size of the character

    ///

    ////////////////////////////////////////////////////////////
Vector2f  GetCharSize(wchar_t c, int s=0, float scale=1);
Vector2f  GetCharSize(char c, int s=0, float scale=1);


Font.cpp:
Code: [Select]

////////////////////////////////////////////////////////////

/// Gets the Vector2f containing the size of a single Character

////////////////////////////////////////////////////////////
Vector2f  Font::GetCharSize(wchar_t c, int s, float scale)
{
float Factor    = scale / myCharSize;
Vector2f  retValue(0,0);

std::map<wchar_t, Font::Character>::const_iterator It = myCharacters.find(c);

if (It == myCharacters.end())

{

return (retValue);

}

const Character& CurChar = It->second;

const IntRect& Rect = CurChar.Rect;

float Advance = CurChar.Advance * Factor;
// use Advance as size.y of the character

retValue.x += Advance;


// get size.x for  this character

float CharHeight = (myCharSize + Rect.Bottom) * Factor;

retValue.y = CharHeight;

if (s & 1)

    {

        retValue.x  += 1 * Factor;

        retValue.y += 1 * Factor;

    }



    // Add a slight width if we're using the italic style

    if (s & 2)

    {

        retValue.x += 0.208f * scale;

    }



    // Add a slight height if we're using the underlined style

    if (s & 4)

    {

        if (retValue.y < scale + 4 * Factor)

            retValue.y += 4 * Factor;

    }
    return retValue;
}


////////////////////////////////////////////////////////////

/// Gets the Vector2f containing the size of a single Character

////////////////////////////////////////////////////////////
Vector2f  Font::GetCharSize(char c, int s, float scale)
{
return GetCharSize((wchar_t)(c),s,scale);
}


int s is the style of the string, int scale, the scale of the String and c a single character  :lol:
greetz TGM

*edit* one small error in there..
Code: [Select]
Vector2f  Font::GetCharSize(char c, int s, float scale)
{
return GetCharSize((char)(c),s,scale);
}

has to be
Code: [Select]

Vector2f  Font::GetCharSize(char c, int s, float scale)
{
return GetCharSize((wchar_t)(c),s,scale);
}
[/code]

39
Feature requests / Recreating the projektion matrix onwindow rescale
« on: April 21, 2008, 07:10:18 pm »
Actually I was quite aware, that there is a way doing this (though I thought, I would have to digg deeper since SFML manages OGL quite well, and thus Imhot a "Simple" library should be able to manage that.. (just my 2 cent)

40
Feature requests / Recreating the projektion matrix onwindow rescale
« on: April 20, 2008, 06:35:58 pm »
I would be interested if there would be a way to proper recreate the projektion matrix on rescaling of the window.. (or this being done automaticly)
So Sprites wouldn't be distorted after rescaling the window, but instead some part of the world simply lay outside the screen.
something like(from :http://www.lighthouse3d.com/opengl/glut/index.php?3):
Code: [Select]


void changeSize(int w, int h) {

// Prevent a divide by zero, when window is too short
// (you cant make a window of zero width).
if(h == 0)
h = 1;

float ratio = 1.0* w / h;

// Reset the coordinate system before modifying
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

// Set the viewport to be the entire window
glViewport(0, 0, w, h);

// Set the correct perspective.
gluPerspective(45,ratio,1,1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0,0.0,5.0,
     0.0,0.0,-1.0,
 0.0f,1.0f,0.0f);
}

Well, of course you don't use glut, do you? Gonna have a look in the source.. Well, doesn't seems like you do ;) But I guess this code shows pretty well, what I want to say^^

41
Feature requests / Z order
« on: April 20, 2008, 06:22:33 pm »
If you turn of Zbuffering, you will have to render em in the proper back to front order. (start drawing the lowest one, and going on with the higher ones..) otherwise the one last drawn would appear to be the highest one.

42
Feature requests / Z order
« on: April 20, 2008, 05:19:24 pm »
but then again Z sorting via Z position won't work ;)
Than your exacly at the current position -> you have to render em in the right order^^

43
Feature requests / Z order
« on: April 19, 2008, 11:07:35 pm »
besides there ist a problem with every transparent Sprite.. (zBuffer is either set to the sprites Z, or not) So a half transparent sprite would blow up the entire system..

44
Network / stupid question about sending/receiving at the same time.
« on: April 11, 2008, 06:58:17 pm »
Hi.
I know this might sound very retarded, but I tried finding some good tutorials and they always end, before questions as this arise.
I would like to have a 2client 1server system.
Now the server sends packages from one client to another.
Now I would like to be able to send stuff from one client, while I'm still listening for incoming packages.
Well, one could argue "why should you care.. just finish sending and then read what has come inbetween" but unfortunably single packages will melt together to a single big one if I try it this way..
So I tried using two threads one always listening, another the one who has to send the stuff.. (should work- thats what duplex is for, isn't it? besides I'm just using the loopback...) well, it won't work.. somehow, the server complains that the connection was ended / Client.Receive returns with !=sf::Socket::Done. (I just tested having a second thread besides the mainthread that will send stuff)
Any suggestions what to do? Is there a better way doing this, maybe using two ports?? (sounds VERY dump to me..) or is there anything I have to take care of if I want to use one port together with two threads thread?? maybe having a mutex on the send(), so that send() cannot be interupted?? Maybe some links to some more advanced tutorials?
thx in advance.. tgm

*edit* Well, one could prevent the"melting" with sending a size information in the beginning of an package..
the best solution would be a possibility to fast check wether there is any input in the input buffer, or not..

45
General / current SVN version: samples Socket Build Problem
« on: April 11, 2008, 05:47:32 pm »
that socket thingy was old and works fine with the newest version.. (no one noticed this thread all the time^^)
Great you fixed it that fast ;) :P

Pages: 1 2 [3] 4 5
anything