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 - P@u1

Pages: 1 2 [3] 4 5 6
31
DotNet / Is it important to Dispose SFML objects?
« on: September 21, 2011, 10:14:18 am »
So far I didn't put Dispose() calls in.
When I end the application quite often an AccessViolationException in SFML code appears.
Why does this happen? Looks like a bug.

Edit: Maybe I will add Dispose() calls and try if it still does happen.

32
DotNet / Is it important to Dispose SFML objects?
« on: September 07, 2011, 10:26:36 am »
Hi everyone,

I wondered if it is important to call Dispose on every single sfml-object or not and what happens if I dont do it.

It probably means that the destructors are not called, but what does this mean?

Just that we loose some memory, or are there also resources which get lost until a computer restart?

I know that the destructor also disposes the objects, but that only happens when the garbage collector collects these objects.
I read that C# does usually not run the garbage collector on shutdown.

33
General / Best library or method for collision
« on: September 05, 2011, 10:52:32 am »
Maybe Box2D can help you.
It works well for me.

34
General / VS2010 C#/.NET and SFML 2.0
« on: September 04, 2011, 09:51:46 pm »
What should I use instead of sf::Clock (it's in the missing system package).

I saw a game made in C# which used dll-imports of QueryPerformanceCounter.
You said that the package is missing, because C# already offers such functionality, so is there a C# clock with the same accuracy as the performancecounter or sf::Clock (which probably also uses the counter)?

And is this the right way to use BitConverter?
Code: [Select]

int toSerialize1 = 42;
int toSerialize1 = 43;
List<byte> bytes = new List<byte>();
byte[] arr = BitConverter.GetBytes(toSerialize1);
foreach(byte b in arr)
{
   list.Add(b);
}
arr = BitConverter.GetBytes(toSerialize2);
foreach(byte b in arr)
{
   list.Add(b);
}
byte[] bytesToSend = new byte[list.Count];

//lets pretend we just received that and want to deserialize it
byte[] received = bytesToSend;
int received1 = BitConverter.ToInt32(received, 0);
int received2 = BitConverter.ToInt32(received, 4);

35
General / VS2010 C#/.NET and SFML 2.0
« on: September 04, 2011, 07:18:32 pm »
Thx 4 your help.
I'm quite new to .Net...
With c++ i used sf::packet to convert data types like int etc. into raw data (void * / unsigned char *)
Then I sent it using enet (not the sfml network classes).

What can I use instead of sf::Packet for this conversion?

36
General / VS2010 C#/.NET and SFML 2.0
« on: September 04, 2011, 07:12:27 pm »
thx, I will try to get it running now.
Btw I see audio, window and graphics.
Where is system and network?
And is the .Net version up to date, or are recent features missing?

37
General / VS2010 C#/.NET and SFML 2.0
« on: September 04, 2011, 07:04:29 pm »
I also want to test sfml 2.0 for .NET
Just downloaded the latest repo snapshot.
I recognized that the bindings folder is not there anymore (I know it was threre in an earlier version).
How can I get sfml 2.0 for .NET working?

38
Graphics / Text::SetString() raises exception
« on: August 06, 2011, 01:57:09 pm »
Static objects are created, before main is entered afaik, this could explain, why you breakpoint is not triggered.

To help with the access violation you must provide more code.

Access violation usually means that you try to acess memory which has been deleted or dereference an uninitialized pointer.

Edit: Also make sure to start in debug mode.

39
Network / No support for serializing a single char?
« on: August 04, 2011, 12:34:16 pm »
Quote from: "Laurent"
It seems like a common problem people have. I should make the read position public, or add a custom type for extracting / inserting raw data directly.


That's a very good idea!
Thanks

40
Network / No support for serializing a single char?
« on: August 04, 2011, 12:27:36 pm »
Isn't char always 1 byte?

What I'm trying to achieve is to take a part of a packet and transfer it to another packet.
And sf::Packet stores it's data in an std::vector<char>.
So it wanted to extract it char-wise, which is not possible.

I more or less solved it by reading to unsigned chars and casting to char, but I'm not 100% sure, if this is portable without problems.

Why there is no operator<< or operator>> for char?

Edit:
That's the code I used:
Code: [Select]

int size;
packet >> size;
if(size == 0)
{
return;
}
char * data = new char[size];
for(int i = 0; i < size; ++i)
{
unsigned char c;
packet >> c;
data[i] = static_cast<char>(c);
}
data_.Append(data, size);
delete[] data;


I can't do it just with a single append, because I can't get the current readpos (as it's private)
Note that the "string" here is not zero terminated and may contain zeros in the middle

41
Network / No support for serializing a single char?
« on: August 04, 2011, 12:14:29 pm »
Hi,

I recognized that sf::Packet offers operator<< and operator>> for
sf::Int8 and sf::Uint8
which are at my platform typedefs for
signed char   and
unsigned char

But if I use
char
Then it won't compile, as it is a different type.

I know that there is support for 0-terminated char-arrays, but that's not what I need.
Laurent could you please add support for char?

42
Graphics / Alpha value of font for chat box
« on: July 26, 2011, 07:12:33 pm »
Thx.
I didn't know, what it does.

1.6
Quote

Set the color of the object.

The default color is white.


2.0
Quote

Set the global color of the object.

This global color affects the entire object, and modulates (multiplies) its original pixels. The default color is white.


What do I need to do if I want to change alpha to 50% and let everything else untouched?

is it
Code: [Select]

SetColor(Color (255, 255, 255, 128));
?

43
Graphics / Alpha value of font for chat box
« on: July 26, 2011, 06:46:01 pm »
Hi everyone,

I'm planning to develop a chat box, which should be partially transparent.
I thought that this is a perfect job for alpha-values.
But how can I set the alpha-value which is used to draw the text?
Or is there any other good solution?

44
Network / Need help with simple UDP game
« on: June 15, 2011, 08:30:36 pm »
I now tried boost::asio for sending/receiving and used sf::Packet to convert data.

It worked very fine!

So probably something with the sfml async udp still does not rly work, or I just used it the wrong way.

45
Network / Need help with simple UDP game
« on: June 13, 2011, 12:11:24 am »
I made some tests and recognized that the received packets often contain less data then when they were sent.

For testing this out I added to following code to the passage from post 1:
Code: [Select]

 case sf::Socket::Done:
      toReceive >> myServerPlayer.xPos >> myServerPlayer.yPos >> myServerPlayer.input
     if(!toReceive)
          cerr << "Partial packet received!" << endl;


And it does print this line very frequently!

This is strange, because I thought that UDP packets are either received as a whole or dropped as a whole.

I also tried sfml 2.0 with the recent fix, but it didn't help.

Do you have any idea, why this happens?

Pages: 1 2 [3] 4 5 6
anything