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.


Topics - Shay9999

Pages: [1]
1
Network / Socket Unresponsive?
« on: August 05, 2011, 04:17:24 am »
I'm having some problems with these two programs that seem to be unresponsive after a certain point:

Program 1:
Code: [Select]
#include <SFML/Network.hpp>
#include <iostream>

int main()
{
unsigned short Port;
sf::IpAddress Address1 = sf::IpAddress::GetPublicAddress();
sf::UdpSocket Socket;
char Buffer[] = "Hi guys!";
std::cin>>Port;
if (Socket.Send(Buffer, sizeof(Buffer), Address2, Port) != sf::Socket::Done)
{
std::cout<<"Socket (Send) Failed to Send"<<std::endl;
}
else if (Socket.Send(Buffer, sizeof(Buffer), Address1, Port) == sf::Socket::Done)
{
std::cout<<"Message sent"<<std::endl;
}
return 0;
}


Program 2:
Code: [Select]
#include <SFML/Network.hpp>
#include <iostream>

int main()
{
unsigned short Port;
sf::IpAddress Address1 = sf::IpAddress::GetPublicAddress();
        std::cin>>Port;
sf::UdpSocket Listen;
if (Listen.Bind(Port) == sf::Socket::Done)
{
std::cout<<"Successfully bound to Port: "<<Port<<std::endl;
}
unsigned short portn = Listen.GetLocalPort();

std::size_t Received;
char Buffer2[128];
if (Listen.Receive(Buffer2, sizeof(Buffer2),Received,Address1,portn) != sf::Socket::Done)
{
std::cout<<"Error"<<std::endl;
}
else if (Listen.Receive(Buffer2, sizeof(Buffer2),Received,Address1,portn) == sf::Socket::Done)
{
std::cout<<"Message From:"<<std::endl;
std::cout<<Address1<<":"<<Listen.GetLocalPort()<<std::endl;
std::cout<<Buffer2<<std::endl;
}
else
std::cout<<"Unknown Problem";
return 0;
}



These are just snippings from the code, so if there's an error, it's probably me doing bad copy/pasting. Anyways, the send program seems to work fine, but the Listen program becomes unresponsive when it hits the .Receive...

So, what am I doing wrong?

2
Network / No sockets?
« on: July 27, 2011, 11:36:55 pm »
I don't seem to have the sf::SocketUDP function on my Vis C++. I have sf::Socket, but this doesn't do the same effect as the tutorial was nudging me toward. Is there another function I can use?

3
General / Loading Resource
« on: July 22, 2011, 04:22:43 am »
I'm having this issue with a project I'm doing and I'm unsure on how to do it.

When the program is finished, the files and libraries will be loaded from another folder (when they are needed). However, I have little to know knowledge on how to do this and I was wondering if anyone had a clue as to what to do ^_^

This is what I currently have (and what currently does not work):

Code: [Select]
LoadResource("\\system\\sfml-window-2.dll");
LoadResource("\\system\\sfml-window-d-2.dll");


I assume that it's because I'm supposed to use some other line of code with this, but MSDN is just not helpful >_< I need an example >_<.

All help is appreciated ^_^

4
Window / Disabling Re-size
« on: July 18, 2011, 08:22:06 am »
Hey, I don't know if this is a function already, I couldn't find it, but is there a way to disable the option to re-size the window? Like, get rid of the maximize button and make it impossible for the user to increase the height and width of the window >_>?

Please respond ^_^

5
Audio / Music Error
« on: June 11, 2011, 04:15:20 am »
Code: [Select]

sf::Music Music1;
if(Music1.OpenFromFile("DevoWhip.mp3"))
Music1.Play();



Console:
Quote

Failed to read sound file "DevoWhip.mp3" (File contains data in an unknown format.)
Failed to open "DevoWhip.mp3" for reading


So, what did I do wrong >_<!?

Please help :(

6
Graphics / String Class
« on: June 09, 2011, 04:23:10 am »
I have a problem with the String class. I get an Error saying that certain functions such as SetFont and SetScale are not part of sf::String class. I want to be able to draw text onto the screen

Code: [Select]
sf::RenderWindow Window;
...
Window.Draw (Text);


but this problem is getting me into some errors. This is what I have so far along with the lines above:
Code: [Select]
sf::String Text = "Nacho Cheese";
Text.SetFont(sf::Font::GetDefaultFont());
Text.SetScale(2.f, 2.f);


I have a feeling the error has something to do with making a Text class item, but I have no idea. Anyone know what I'm doing wrong?

7
General / Browser capabilities
« on: June 06, 2011, 11:01:04 am »
As a general question, does anyone know if it's possible to use SFML to make a browser application that can be uploaded to a website or what not?

Pages: [1]