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

Pages: [1] 2 3
1
General / Re: Unresolved GLEW references when building SFGUI
« on: August 01, 2014, 01:12:56 pm »
FIXED. Thanks, Nexus. Nowhere on the sfgui instructions does it say this though, or maybe I'm blind, they seem outdated anyway, initially nothing worked based on the instructions, but I figured it out eventually.

For those who find this via google, there should only be 1 project called "sfgui", just add:

SFMLDIR/extlibs/libsmcsv/x86 or x64, then add this to additional libs: glew.lib.

Thanks again!

2
General / Re: Unresolved GLEW references when building SFGUI
« on: August 01, 2014, 12:54:17 pm »
You have to make sure that your Visual Studio solution links to GLEW, maybe the SFGUI configuration scripts don't do this automatically... And there have been recent changes in SFML concerning the linking of static libraries, now this has to be done on user side.

Can you check whether GLEW appears in the list of linked libraries (Project Properties -> Linker -> Additional Dependencies or similar)? If not, add glew32.lib.

There's no project properties -> linker :/
Am I missing something out?

EDIT: The other projects (there's about 20 projects) have the linker settings, my bad! But it seems they are changed, so glew might be included in them. See bellow
EDIT2: Geheim tried it and it works for him, I'll also try what he did and post again if I have any problems, thanks for the suggestion, Nexus. I gotta say this is really annoying and strange, but it's all fine, awesome projects.


3
General / Unresolved GLEW references when building SFGUI
« on: August 01, 2014, 07:18:52 am »
Hey, I downloaded glew, built SFML myself, tested it, and now tried to install SFGUI but I've been struggling a lot. After building with cmake, it generated the proper files, see here:



And I opened up SFGUI.sln and tried ALL_BUILD. Everything works fine, however I'm getting errors, and all of them are glew related.



What can I do? Here's my cmake configuration:




Any help would be appreciated. I'm on windows 8.1 x64, built SFML myself, nothing is precompiled

4
Graphics / What is faster: using a sprite or some shapes?
« on: September 26, 2013, 07:40:45 am »
I'm working on a GUI system, and I want to add a button for example, and the button looks like a rectangle with 3 lines on it. It can be either made as a sprite or some shapes. Which one would be optimal to use?

5
General / Re: SFML inheritance and sf::Drawable
« on: September 14, 2013, 09:29:30 pm »
You will need to implement the draw function for Element.
Can you elaborate? Because I can't really make the element draw() function do anything, since element is just an interface.

6
General / SFML inheritance and sf::Drawable
« on: September 14, 2013, 09:08:24 pm »
I have 3 simple classes.

class Element : public sf::Drawable
{
     private:
                ....

    public:
         virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const {}
};

class Button : public gui::Button
{
    public:
        virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
        {
              switch(type)
                {
                        case ButtonType::TextOnly:
                                if(displayBody)
                                        target.draw(body);

                                target.draw(text);
                                break;

                        case ButtonType::IconOnly:
                                if(displayBody)
                                        target.draw(body);

                                target.draw(icon);
                                break;

                        case ButtonType::IconText:
                                if(displayBody)
                                        target.draw(body);

                                target.draw(text);
                                target.draw(icon);
                                break;
                }
        }
};

class UserInterface : public sf::Drawable
        {
                private:
                        std::map<std::string, Element> components;

                public:
                        UserInterface();

                        virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
                        void add(std::string name, Element element);

                        std::map<std::string, Element> getList() { return components; }
                        std::vector<Element> etc;
        };

and this is the draw function in UserInterface:
void gui::UserInterface::draw(sf::RenderTarget& target, sf::RenderStates states) const
        {
                for (auto && iter : components)
                {
                        target.draw(iter.second);
                }
        }

What this should do is simple, it creates a container class called UserInterface, to which you can add any class that inherits from Element. Every class that inherits from the base class Element has a different overriden draw() function.

The problem is, this doesn't work. It successfully adds new classes to the container, however the draw() function doesn't work. It should be as simple as:

Button button(etc);
UserInterface UI;

UI.add(button);

...

window.draw(UI);

7
Frex's sollution seems to have worked, even though the map seems a bit more shaggy when walking around, at least there are no more lines.

8
The question was if the orange pixels are pixels of next tile in your tilesheet or do they appear out of nowhere(which would be entirely different bug).

Also, try this:
                // Set their texture bounding box
                up_l_point.texCoords =   sf::Vector2f((j%tiles_per_row) * tile_size +0.5f, (j/tiles_per_row) * tile_siz +0.5f);
                up_r_point.texCoords =   sf::Vector2f((j%tiles_per_row * tile_size) + tile_size-0.5f, (j/tiles_per_row) * tile_size+0.5f);
                down_r_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size + tile_size-0.5f, (j/tiles_per_row * tile_size) + tile_size-0.5f);
                down_l_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size +0.5f, (j/tiles_per_row * tile_size) + tile_size-0.5f);

Yes the tile is before the grass tile, and the lines are always like that.

9
Is the orange color part of the texture? Or is it coming from nowhere?

It looks like it's part of the texture, because if it wasn't, I doubt I'd see random darkened pixels, that's my artistic style.

10
Are your tiles located at decimal coordinates?
Nope. Here's the code without the cast to int (Casting them to int was also a possibility, but failed)

// Set their positions
                                up_l_point.position =   sf::Vector2f((int)(index*tile_size),                            (int)(index_y*tile_size));
                                up_r_point.position =   sf::Vector2f((int)(index*tile_size + tile_size),        (int)(index_y*tile_size));
                                down_r_point.position = sf::Vector2f((int)(index*tile_size + tile_size),        (int)(index_y*tile_size + tile_size));
                                down_l_point.position = sf::Vector2f((int)(index*tile_size),                            (int)(index_y*tile_size + tile_size));

                                // Set their texture bounding box
                                up_l_point.texCoords =   sf::Vector2f((j%tiles_per_row) * tile_size, (j/tiles_per_row) * tile_size);
                                up_r_point.texCoords =   sf::Vector2f((j%tiles_per_row * tile_size) + tile_size, (j/tiles_per_row) * tile_size);
                                down_r_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size + tile_size, (j/tiles_per_row * tile_size) + tile_size);
                                down_l_point.texCoords = sf::Vector2f((j%tiles_per_row) * tile_size, (j/tiles_per_row * tile_size) + tile_size);

11
It's probably caused by decimal coordinates. Round your view's position and everything should be ok.
I tried this, but it didn't work:

void camera::update()
{
        const int halfDistanceX = view -> getCenter().x/2;
        const int halfDistnaceY = view -> getCenter().y/2;

        if(getCornerPoint().x <= 0 && getCornerPoint().y <= 0)
                view -> setCenter((int)Player -> pos.x, (int)Player -> pos.y);
}

I could also try with roof() or floor()

12
General / Getting random lines rendered in VertexArray - SFML bug?
« on: June 24, 2013, 05:40:07 pm »
I'm making a game in SFML 2.0 (I built the source myself) with Visual Studio 2012. I made a map system with vertexArrays, and it works nicely, everything is perfect in the game except a detail.

When walking around the map, I see some lines being displayed randomly for a very short amount of time, in random places, like a stuttering graphical bug. My friend said he also experienced this with his game so it made me think it's a SFML bug rather than a coding bug. Here's a screenshot bellow, you can see the line, it randomly appeared when I took the picture. Also in this picture I zoomed in the in-game camera.

14
I have a big game written in SFML, and a problem that has been occuring is that the game takes a while to show up on the windows taskbar, and if I do the following steps, I can't switch windows anymore, it's like a constant window lag, even though the game runs at 65 FPS:
step1: Open the game, icon shows up after 8 seconds
step2: click on another windows icon on the start bar
step 3: click on the game icon again
step4: Now I can't click another icon again, I can alt+tab out of the game, though it will sometimes crash and call abort()

I'm not sure what code to show because I'm not sure what can cause this. It's been happening for a while but I thought it was just my computer (it isn't)

Additional details

  • I built SFML myself, I didn't mix up debug and release.
  • I'm using Windows 7 32-bit, AMD Athlon 64 processor 3000+
  • I'm using Visual Studio 2012 as the IDE
  • It could possibly be an operating system error, a friend of mine that is using windows 8 has said that the game has no problem with switching windows, but a friend that uses the exact same version of windows like me has reported this issue.
  • I am using a thread.
  • The sf::RenderWindow is not global

Again, I'm sorry about no code, it's a general question, and I don't really know which part of the code to show, I have about 20 files of game engine, and no idea what could be causing this. However, my speculations are that the thread is causing this. I am using a sf::Thread to load resources during a loading screen, and I don't terminate it.

15
You don't understand the purpose of a complete and minimal code. We don't care about your initial project, so don't try to keep parts of it, just write a new code sample that focus on the actual problem (in your case: a compiler error with a thread taking one argument). That's what I did.

Your code is not minimal, we don't care at all about the title or icon of your window, it won't change anything to the problem.

And of course it needs to be complete so that I can test it quickly. We don't want to spend hours to try to fix it, just to be able to run it.

But all these points are explained in the link I gave you previously, have you read it?

Anyway, does my minimal code reproduce the error or not?

I've read it but didn't quite understand, after all if there's an error I can't supply code that runs. Anyhow, I get what you meant now. I tried running your minimal code and it all works fine, here is a sample code that doesn't work at all, but is supposed to.

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

void f(sf::RenderWindow &winMain) {}

int main()
{
    sf::RenderWindow winMain();
    std::thread t(f, winMain);
    return 0;
}

All I want to do is create a thread based on a function that has a reference to my renderwindow. I never used std::Thread so I have no idea how to use it. I really don't know how to supply more minimal code because I don't know how to make it work.

Also I should mention that this code shows a different error:

void (sf::RenderWindow &)' : cannot convert parameter 1 from 'sf::RenderWindow (__cdecl *)(void)' to 'sf::RenderWindow &

Pages: [1] 2 3
anything