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

Pages: 1 ... 4 5 [6]
76
Window / Clear the Input
« on: August 14, 2010, 05:09:46 pm »
kk....but other errors left here!
Code: [Select]

error: ‘class sf::FloatRect’ has no member named ‘Right’
error: ‘class sf::FloatRect’ has no member named ‘Bottom’



And many issues with the sf::IntRect class...like:
Code: [Select]

‘class sf::IntRect’ has no member named ‘Offset’

Also a renamed class?

77
Window / Clear the Input
« on: August 14, 2010, 05:03:51 pm »
Omg xD Why??? :D

78
Window / Clear the Input
« on: August 14, 2010, 04:18:59 pm »
Code: [Select]

engine.cpp:85: error: ‘class sf::Text’ has no member named ‘SetText’


Just the same

79
Window / Clear the Input
« on: August 13, 2010, 06:57:33 pm »
Ok....I installed SFMl 2!
But...is there something wrong with the sf::String class? With 1.6 my project compiled without any errors...but now I get various errors on using the sf:String class.. :(
like
Code: [Select]

error: ‘class sf::String’ has no member named ‘SetFont’


What the... :-o

80
Window / Clear the Input
« on: August 11, 2010, 12:58:03 pm »
Anything I can do to solve this problem?

81
Window / Clear the Input
« on: August 10, 2010, 03:59:43 pm »
Linux Ubuntu 10.04

82
Window / Clear the Input
« on: August 10, 2010, 11:22:40 am »
This should work:
Code: [Select]

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
sf::RenderWindow window(sf::VideoMode(800,600),"Test");
sf::Event Event;

window.EnableKeyRepeat(false);
int i = 0;

while(window.IsOpened())
    {
window.GetEvent(Event);
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::F1))
{
std::cout << i << std::endl;
i++;
}

window.Clear();
window.Display();
}
}

83
Window / Clear the Input
« on: August 09, 2010, 04:19:54 pm »
It's like:
main.cpp
Code: [Select]

#include "main.h"
#include "engine.h"

int main()
{
engine engine;
engine.game();

return EXIT_SUCCESS;
}


engine.cpp
Code: [Select]

engine::engine()
{
window.EnableKeyRepeat(false);
window.Create(sf::VideoMode(1024,768,32),"RPG");
}

void engine::game()
{
        while(window.IsOpened())
{
while(window.GetEvent(Event))
{
if(Event.Type == sf::Event::Closed)
window.Close();//exit
}

if(GSchanged)//GameState changed
Load();//load stuff for the new GameState

Draw();//Draw everything onto the screen
HandleInput();//handle input for each gamestate
}
}

void engine::HandleInput()
{
        if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::F1))
        {
        //...
        }
}

84
Window / Clear the Input
« on: August 09, 2010, 10:27:27 am »
Quote from: "Laurent"
Just to be sure: you didn't copy & paste the code given by Nexus, right? You wrote window.EnableKeyRepeat(false)? ;)


Sure I did O_o
Version 1.6

Code: [Select]

if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::F1))
{
window.EnableKeyRepeat(false);
Player.levelup();
Text_Playerlevel.SetText(Player.GetLevel());
}


I also tried to put it on the beginning of the main function...the same

85
Window / Clear the Input
« on: August 08, 2010, 10:40:27 pm »
Quote from: "Nexus"
There is a function to enable or disable automatic key repeats:
Code: [Select]
sf::Window::EnableKeyRepeat(bool enable);


Didn't change a thing :-/

86
Window / Clear the Input
« on: August 08, 2010, 09:45:56 pm »
Hey
I'm working on a rpg at the moment. Now I want to know how to clear the Input. For example:
I want to level up the character by pressing 'F1'.
If I do it like:
Code: [Select]

if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::F1))
{
Player.levelup();
        //...
}


it's like 30 level ups by pressing 'f1'....any suggestions?
thanxs,
Finn

87
Network / Get messages from the server
« on: September 22, 2009, 07:09:29 am »
Oh :P I thought it would be something special...but its just connecting and then sending to each other^^ thx

88
Network / Get messages from the server
« on: September 21, 2009, 09:15:13 pm »
I was wondering how to get messages with the client from the server?! If the client connected once, it should be able to send messages from the server to the client on this connection, shouldn't it? If so, how to do it? :P
Thanks for answers
greets Finn

89
Network / Packet problem
« on: September 16, 2009, 04:54:44 pm »
Thank you!Works perfect!  :roll:

90
Network / Packet problem
« on: September 16, 2009, 07:02:43 am »
Is this code correct? Don't know whats wrong... :(
Code: [Select]

//Server
#include <SFML/Network.hpp>
#include <iostream>
using namespace std;

int main()
{
    while(1)//Holding the server open for new connection
    {
        sf::SocketTCP Listener;
        if(!Listener.Listen(2304))
        {
        cout << "Unable to listen to the given Port 2304!" << endl;
        }

        sf::SocketTCP Client;
        sf::IPAddress ClientAddress;
        if(Listener.Accept(Client, &ClientAddress) != sf::Socket::Done)
        {
        cout << "Some error occured.Clients are unable to connect to the Server" << endl;
        }

        sf::Packet Packet;
        std::string Order;
        while(1)
        {
            if(Client.Receive(Packet) == sf::Socket::Disconnected)
        {
            cout << "The client disconnected" << endl;
            break;
            }
        Client.Receive(Packet);
        Packet >> Order;

        cout << ClientAddress << ": " << Order << endl;
        if(Order == "Server.Close"){break;}
        }
        if(Order == "Server.Close"){Listener.Close();Client.Close();}
        //Else: Restart Server
    }
   
}
//Client
#include <SFML/Network.hpp>
#include <iostream>
using namespace std;

int main()
{
    sf::SocketTCP Client;
    if(Client.Connect(2304,"192.168.178.22") != sf::Socket::Done)
    {
    cout << "Unable to connect to the server!" << endl;
    }
   
    std::string Order;
    sf::Packet Packet;
    while(1)
    {
    cout << ">> ";
    cin >> Order;

    Packet << Order;
    Client.Send(Packet);
    if(Order == "Client.Close"){break;}
    }
    Client.Close();
}


The first Packet send isn' displayed at the server...if I send a second Package, the first is displayed at the server and after any packet I send isn't displayed :(
Hope you can help!

Pages: 1 ... 4 5 [6]