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

Pages: [1] 2
1
Graphics / Save a sf::Sprite
« on: July 08, 2008, 08:57:41 pm »
Quote from: "Xylankant"
Well, you could work around that by generating a Window for the scaled Image (same size etc.) and then taking a screenshot, which you can easily safe on your harddisk.


I tried so already but I get very ugly results then. I must save it without to create a window.

2
Graphics / Save a sf::Sprite
« on: July 08, 2008, 07:39:12 pm »
Yes, you are right. But sf::Image hasn't possibilites to rescale and so on...

Yes I just want to saave a cropped and resized image. But I want to do it for much images! I hoped I could do it with SFML. Imagine, I even can. But I cant save my results :(

3
Graphics / Save a sf::Sprite
« on: July 08, 2008, 06:30:20 pm »
Hey,

is there any way to save a sf::Sprite?

Code: [Select]

sf::Sprite spr(img);
sf::Rect<int> rect;
rect.Left = imgX1;
rect.Right = imgX2;
rect.Bottom = imgY2;
rect.Top = imgY1;
spr.SetSubRect(rect);
spr.Resize(32, 32);
// Save???


I need to save it to a png file to continue working with it.

Thanks in advance,
Dummie

4
General / 2 Problems
« on: July 05, 2008, 08:09:36 pm »
When the window that reports me about the crash appear and I press "Debug" I see the problem has something to do with:

Code: [Select]
__tmainCRTStartup()

Any solutions?

5
General / 2 Problems
« on: July 02, 2008, 03:05:14 pm »
I think something is wrong with my computer. I also can't run the sample executables  :( I will reinstall it soon and I hope all will work again fine then.

6
Network / Receive loop
« on: July 02, 2008, 02:47:06 pm »
Quote from: "Kernelpanic"
For such a loop you should not use "for".
It is a semantic absurdity, you should use "while(true)".


Yes, you are right. Thank you!

The loop is working fine now. I dont know what the problem was.

Thank you :) :) :)

7
General / 2 Problems
« on: July 02, 2008, 02:46:08 pm »
Hey,

my settings are working fine with SFML 1.2. Why they dont work with SFML 1.3? I created a project and tried it in debug mode. All worked perfect. I turned the release mode on. Compiling all is fine...

I start my application and it crashs. Could you tell me which settings I should check? I'm using Visual Studio 2008 Express.

Edit:

If I try to link without -s I get linker errors. Like this:

Quote
Main.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static class sf::IPAddress const sf::IPAddress::LocalHost" (?LocalHost@IPAddress@sf@@2V12@B)".


This error doesnt appear if I link to the -s librarys. But the program crashs when I run it.

8
Network / Receive loop
« on: July 01, 2008, 07:27:07 pm »
How will be a receive loop done in SFML?

This seems to be the wrong way:
Code: [Select]

char recvBuf[1024];
size_t received;
for (;;)
{
   sf::Socket::Status status = client.Receive(recvBuf, sizeof(recvBuf), received);
   if (status != sf::Socket::Done)
   {
      std::cerr << "Error: receive" << std::endl;
      return 1;
   }

   if (received == 0)
      break;

   recvBuf[received] = '\0';
   std::cout << "Server: " << recvBuf << std::endl;
}


How will it be done right in SFML?

Thanks,
Dummie

9
General / 2 Problems
« on: June 30, 2008, 01:56:43 pm »
Quote from: "Laurent"

Quote
I turned "Release-Mode" on and when the application start the program crashs

Do you link to the release libraries (without the "-d" suffix) in release mode ?


I'm linking to: sfml-system-s.lib sfml-window-s.lib sfml-graphics-s.lib

It still doesn't work :(

10
General / 2 Problems
« on: June 30, 2008, 10:47:28 am »
Hey,

I got two very annoying problems :(

I installed SFML 1.3 and all is working fine. I turned "Release-Mode" on and when the application start the program crashs. But if I use SFML 1.2 all works fine. But of course, I would prefer to use SFML 1.3.

I tried to link statically to the CRT(Multi-Threaded) so I don't have to provide the .NET-Framework and so on. Unfortunately it doesn't work. I get tons of linking errors. I used SFML 1.2 because SFML 1.3 doesn't work for me in release mode. Is SFML not compatible to it?

In all cases I used the static version of SFML.

Some solutions?

Thanks,
Dummie

11
Network / Client identification
« on: June 27, 2008, 12:21:26 pm »
I understand now. Thanks a lot :)

But I got another problem. How would be a receive loop done?

Code: [Select]

char recvBuf[1024];
size_t received;
for (;;)
{
sf::Socket::Status status = client.Receive(recvBuf, sizeof(recvBuf), received);
if (status != sf::Socket::Done)
{
std::cerr << "Error: receive" << std::endl;
return 1;
}

if (received == 0)
break;

recvBuf[received] = '\0';
std::cout << "Server: " << recvBuf << std::endl;
}



Thanks in advance,
Dummie

12
Network / Client identification
« on: June 26, 2008, 06:40:30 pm »
Quote from: "Laurent"
Hi

A socket is internally just an integer identifier, and SFML socket classes expose this through comnparison operators so that you can use a socket instance as an identifier.

About your comments :
Quote
- 1 is needed, I think. But I didn't see it in tutorial

I don't get it, why -1 ? For what ?

Quote
This is needed, I think. But I didn't see it in tutorial

In the tutorial, I send the ending \0 and read it back on the other side, so I don't need to append it manually ;)

Quote
I hoped I could give numbers to them this way. But all clients got the number 0

Yep, i is the index among the sockets which are ready at the time you read them ; most of time there will only be one socket to read, so i is always 0.


Thank you for the answer. The -1 isn't needed. I made a mistake. Sorry :)

But something else in here:
http://www.sfml-dev.org/tutorials/1.3/network-sockets.php

Code: [Select]

char Buffer[] = "Hi guys !";
if (Client.Send(Buffer, sizeof(Buffer)) != sf::Socket::Done)
{
    // Error...
}


Are you sure sizeof(Buffer) is right? Wouldn't it be more right to use strlen(Buffer)?

13
Network / Client identification
« on: June 26, 2008, 04:22:37 pm »
Hey,

I'm using a selector and all works fine but I don't know how to identificate clients. For example I want to give them numbers. Is there a nice way to do this with help of SFML?

Code: [Select]

const unsigned int numSockets = selector.Wait();

for (unsigned int i = 0; i < numSockets; ++i)
{
sf::SocketTCP socket = selector.GetSocketReady(i);

if (socket == listener)
{
sf::IPAddress address;
sf::SocketTCP client;
listener.Accept(client, &address);
selector.Add(client);
}
else
{
char recvBuf[1024];
size_t received;
if (socket.Receive(recvBuf, sizeof(recvBuf) - 1, received) != sf::Socket::Done)
// ---------->  - 1 is needed, I think. But I didn't see it in tutorial.
{
selector.Remove(socket);
std::cerr << "Error: receive" << std::endl;
continue;
}
recvBuf[received] = '\0'; // ---------->  This is needed, I think. But I didn't see it in tutorial.

std::cout << "Client (" << i << ") : " << recvBuf << std::endl; // ----------> I hoped I could give numbers to them this way. But all clients got the number 0.

std::string sndBuf;
sndBuf = "Thanks for the message: ";
sndBuf.append(recvBuf);

if (socket.Send(sndBuf.c_str(), sndBuf.length()) != sf::Socket::Done)
{
selector.Remove(socket);
std::cerr << "Error: Send" << std::endl;
continue;
}
}
}


Any suggestions?

Thanks in advance,
Dummie

14
Graphics / New sprite dimesions after rotation?
« on: April 29, 2008, 05:39:19 pm »
Quote from: "Laurent"
Width and height don't change after a rotation. They are the local dimensions of the sprite, not the axis-aligned ones.


Is there a way to get the axis-aligned ones? I would need them :)

15
Graphics / New sprite dimesions after rotation?
« on: April 27, 2008, 08:11:41 pm »
Hi,

when I try to rotate a sprite the width and height vlues aren't changed. The functions GetHeight and GetWidth are returning the old values. Why? :)

In my opinion it would be very useful if this would be also done by SFML.
What do you think about it? :)

Thanks in advance,
Dummie

Pages: [1] 2
anything