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

Pages: 1 [2]
16
General / Compiling program on Linux
« on: August 09, 2013, 09:38:33 am »
I'm following the SFML 2.0 tutorial for testing a program on Linux, but I'm getting the following error. I downloaded the precompiled SFML 2.1 32bit for Linux.

command:
g++ test.o -o test -L/home/crumb/sfml2.1-dev/lib -lsfml-network
 

result:
/usr/bin/ld:/home/crumb/sfml2.1-dev/lib/libsfml-network.so: file format not recognized; treating as linker script
/usr/bin/ld:/home/crumb/sfml2.1-dev/lib/libsfml-network.so:1: syntax error
collect2: ld returned 1 exit status
 

17
Window / Re: Issue with sf::Keyboard::isPressed
« on: August 03, 2013, 10:33:52 am »
It wasn't working for the life of me earlier, but after clearing my mind playing TF2 and restarting Visual Studio it worked.

I'm working on a TCP server/client chat. I've just been reading the documentation and examples, so I have a rough approach. I have a thread each for sending information and receiving information because when I was reading input it would wait on cin.

18
Window / [Solved] Issue with sf::Keyboard::isPressed
« on: August 03, 2013, 09:03:38 am »
Hello I've recently been learning to use multiple threads and using sf::Keyboard for unbuffered input. The issue I'm running into is that when I press A with the following code it doesn't run the what's within the if block.
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::A)) { // Returns false
        message_out += "a";
        std::cout << "WORKED";
}
 

But when trying this it works properly and prints "WORKED"
bool test = sf::Keyboard::isKeyPressed(sf::Keyboard::Key::A); // Returns true
    if (test == true) {
        message_out += "a";
                std::cout << "WORKED";
    }
 

Is this an issue with threads or a bug?

19
General / Issues with linking SFML statically?
« on: June 30, 2013, 08:30:52 am »
I have SFML linked statically, and I've done some googling on my issue. I believe it has to do with global variables, but if that's the issue how can I avoid it when the variable is a static member of the class? Any way to guarantee that it is initialized after all the linking is done?

Root.hpp
#include <SFML/Graphics.hpp>

class Root {
private:
    static sf::RenderWindow render_window;
};
 

Root.cpp
#include "Root.hpp"

sf::RenderWindow Root::render_window;

int main(int argc, char **argv) {
        //sf::RenderWindow test(sf::VideoMode(200, 200), "TEST");
        return 0;
}

20
Graphics / Re: Reading pixel color issue
« on: June 01, 2013, 11:50:46 pm »
I re-saved the image again and it seems to be working fine. Was not an issue with SFML :) I guess it had to do with the way I saved it.

21
Graphics / Re: Reading pixel color issue
« on: June 01, 2013, 10:53:03 pm »
The image loads fine.
Through debugging SFML gives me the value 2, 0, 1 while in Photoshop it gives me 0, 0, 0
I tried printing it out, and I'm not getting the same results. I'll look more into it.

22
Graphics / Re: Reading pixel color issue
« on: June 01, 2013, 09:49:35 pm »
Sorry I didn't know what you meant by a minimal example  ;D
I still don't understand what's going on.
#include <SFML/Graphics.hpp>
#include <iostream>

int main(int argc, char **argv) {
    sf::Image img;
    img.loadFromFile("D:/Maps/001.png");
    sf::Color tmp(img.getPixel(0, 0));
    if (tmp == sf::Color (0, 0, 0)) {
        std::cout << "Black";
    } else {
        std::cout << "Other";
    }
}

23
Graphics / Re: Reading pixel color issue
« on: June 01, 2013, 09:02:17 pm »
Fixed now. I went through debugging and the value of the pixel at 0, 0 returns 2, 0, 1 for getPixel(). Code below was used to test it while debugging.
uchar TileGrid::ColorToIndex(sf::Color &color) {
    return 1;
    if (color == sf::Color(2, 0, 1)) {
        return 2;
    } else if (color == sf::Color(0, 255, 0)) {
        return 1;
    } else {
        Root::SetStatus(EXIT_FAILURE);
        return 255;
    }
}

24
Graphics / Re: Reading pixel color issue
« on: June 01, 2013, 08:57:08 pm »
    sf::Image map;
    ImageHandler::SetImage(map, "/Data/Maps/001.png");
    for (uchar x = 0; x < map_width; ++x) {
        for (uchar y = 0; y < map_height; ++y) {
            tiles[x][y].index = ColorToIndex(map.getPixel(x, y));
            SetTile(x, y, tiles[x][y].index);
        }
    }

25
Graphics / [Solved] Reading pixel color issue
« on: June 01, 2013, 08:58:35 am »
I'm using SFML 2.0 and the getPixel() fuction of the Image class. The function returns 2,0,1 for what I drew to be 0, 0, 0 in Photoshop. http://stackoverflow.com/questions/16601839/reading-wrong-pixel-color.

Pages: 1 [2]