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

Pages: [1] 2 3
1
Window / Re: Shift + Key creates unknown event in SFML 2.3
« on: October 10, 2015, 11:43:28 am »
I'll try to download 2.3.2, assuming 2.3.2 isn't the first recommended one, otherwise I already have it
EDIT: I do have 2.3.2, I just checked and the file is called "SFML-2.3.2-linux-gcc-64-bit", sorry I wasn't more specific in the first post.

Almost all keys are concerned, the only ones that aren't are Divide, Multiply, Minus and Plus on the numpad, as well as all Return keys and the function keys. But all the alphanumeric keys are affected

2
Window / Shift + Key creates unknown event in SFML 2.3
« on: October 10, 2015, 10:23:42 am »
I recently upgraded from SFML 2.2 to 2.3.2, and at first the upgrade seemed seamless, with no compiler errors. But I discovered I couldn't open my console (Which is opened with 'LControl + LShift + C'). After doing some testing it seems like inputting a key on its own (A, B, C etc.) gives the expected key code, but inputting shift and a key gives an unknown key code. I know this bug was  reported a few years ago but since it worked in the previous version I don't know why it would be broken again. I'm using Ubuntu 14.04 (Linux) and the problem occurs with both my normal keyboard and the on-screen keyboard.

EDIT

Only just saw this, I can try to compile SFML myself but I have no experience with it

3
Graphics / Re: Overlapping "smooth" textures have slight black outlines
« on: August 24, 2015, 04:20:53 pm »
You was perfectly clear with your example, because that was exactly what I did. The reason I added the last part to my reply was in case I didn't understand you correctly.

4
Graphics / Re: Overlapping "smooth" textures have slight black outlines
« on: August 24, 2015, 03:44:51 pm »
No luck, even by expanding the borders and then setting the texture rectangle of the sprite there is no difference in the amount of artifacts. I can try to change the rectangle of the texture instead of the sprites, but that would be more difficult and I (assume) would be less likely to work anyway.

EDIT:

I tried to set the rectangle of the texture itself (by loading the texture, getting the size, then loading again with the sf::IntRect argument), but that also doesn't work

5
Graphics / Re: Overlapping "smooth" textures have slight black outlines
« on: August 24, 2015, 11:11:18 am »
When the textures aren't smooth and when you zoom out, certain black lines disappear and the lines start to look jagged, probably because there aren't enough pixels to display the lines properly. The smooth textures fix this, but the visual artifacts make the game look unpolished to me.

Also, I changed the background from black to white for testing, but there is no change with the artifacts.

6
Graphics / Overlapping "smooth" textures have slight black outlines
« on: August 24, 2015, 10:56:13 am »
I'm making a city building game, so when the view is zoomed out I have to set all the textures to smooth, otherwise the buildings look odd and lines start to disappear. But, when I set the textures to smooth, a blurry black outline appears in all the places where two sprites overlap. I've tried changing the anti-aliasing level of the window, but nothing changes.

SFML Version: 2.2
Ubuntu Version: 14.04
Graphics Card: Nvidia GTX 750 Ti

(It's very hard to see at first, but when you see it once, it's hard to un-see)

7
Graphics / Re: Fullscreen disables second monitor
« on: August 15, 2015, 11:46:51 am »
I've update to the latest version on the website, and (other than breaking my current code) it did nothing. Fullscreen still breaks my resolutions and turns off my monitor unfortunately (I also get this error when linking to the audio .so file: /usr/lib/libsfml-audio.so||undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'|)

8
Graphics / Re: Fullscreen disables second monitor
« on: August 15, 2015, 11:11:41 am »
System Info:
  • My SFML version is 2.1
  • My Ubuntu version is 14.04
  • My window manager is Compiz (according to wmctrl -m)
  • I have a Nvidia GTX 750 Ti graphics card
  • I'm using the NVIDIA binary driver, version 346.82 (proprietary)
  • I'm using Unity (not the engine), version 7.2.5

I'd be happy to give any other relevant information

9
Graphics / Fullscreen disables second monitor
« on: August 15, 2015, 10:37:22 am »
As a gamer myself (with two monitors), I hate when games do this. Basically, when I go into fullscreen mode, all my moinitors go black for a few seconds, but the second monitor never turns on until I quit the game, and then all the windows on my second monitor get moved to my primary one. If the window isn't the correct resolution, my monitor decides to auto-adjust at whatever resolution the game is at, and then don't change back after quitting the game. I'm currently on Linux (Ubuntu specifically), and I haven't tested windows, but since almost all games on Linux use OpenGL (and I'm pretty sure SFML does too) is there any way to fix this?

I'd assume I don't need a minimal example since its obvious how to go into fullscreen in SFML

10
While trying to recreate the sf::Texture and sf::Sprite code I realised that it also needs a pointer argument, so I'm not sure why it worked/seemed like it worked. I do have another question though, would it be a good idea to not use references at all, and replace all functions that pass by reference with a function that passes by pointer. I have a feeling that the other functions that pass an argument by reference aren't actually passing by reference, but are passing by value and only the very strict classes (like sf::Sprite and sf::Text) are actually bringing up an error.

11
Graphics / Re: Segmentation Fault when drawing a sf::Text object in Lua
« on: August 08, 2015, 11:52:52 am »
This topic is a little bit old but I have to apologise to dabbertorres for being too arrogant to test the solution he gave me. So yes, the problem was to do with references and pointers.

I fixed the code by changing:

void setFont(const sf::Font& newFont) {member.setFont(newFont);}

in TextWrapper, to:

void setFont(const sf::Font* newFont) {member.setFont(*newFont);}

Thank you for the help, and sorry for being too big headed (when I have no right to be). Of course that still doesn't explain why the same isn't true for SpriteWrapper, but I assume no one is going to come back to this question and answer it

12
You're using C++ code with lots of references, which C has no concept of. Lua is written in C, so it will only pass things by value or by pointer.
I thought I read that Lua has a weird system where an argument will be either passed by reference or by value depending on what you do with it in the function (but I can easily be wrong)

The problem with this is that, as I've mentioned before, if the issue is that the object isn't being passed properly, why don't I get a segmentation fault when I do the same with Textures and Sprites? (I'm not going to change the source code to include this though, because I want my code to be as minimal as possible)

I'm not sure if you're right though, so I guess I need to see what the difference is between sf::Text and sf::Sprite when I expose them

13
Create a minimal example from scratch or remove all unnecessary code till you end up with a minimal and complete example.
I can't really get any more minimal, since the error is most likely a problem with doing this stuff from lua (unless you mean remove the code to expose sf::Vector2u and such). If I gave any more minimal code (where lua isn't needed) then I wouldn't ever be able to create any sf::Text objects because I'd always get an error.

Then use a debugger to step into the crashed state of the application.
I already have debug output, but I'll assume you mean a debug of the new minimal example (which I can't do)

Also keep in mind that if you uae a stream for the font, the stream must be kept alive as long as you use the font.
I don't know what a stream exactly is, but all objects are alive because I can do almost the exact same code but with sf::Sprite and sf::Texture and I don't get an error.

14
This is a very odd and specific circumstance but, I recently exposed some of the classes from SFML (I hope that's allowed) to Lua with a C++ header-only library called LuaBridge (https://github.com/vinniefalco/LuaBridge). Most of the classes were exposed just fine (but sf::Event because LuaBridge doesn't like Enums or Unions), but after trying to use sf::Text I get an error. My error is that I get a Segmentation Fault after I create a sf::Text object, then set the font with a sf::Font object (and no, the reference isn't destroyed because this doesn't happen with sf::Texture and sf::Sprite).

Here is my C++ code to expose some SFML classes, and run a lua script called script.lua:

#include <string>

#include <SFML/Graphics.hpp>

#include <lua.hpp>
#include <LuaBridge.h>

//Wrapper for sf::Text:
class TextWrap
{
    private:
        sf::Text member;

    public:
        void setCharacterSize(const int& newSize) {member.setCharacterSize(newSize);}
        int getCharacterSize() {return member.getCharacterSize();}

        void setColor(const sf::Color& newColor) {member.setColor(newColor);}
        sf::Color getColor() {return member.getColor();}

        void setFont(const sf::Font& newFont) {member.setFont(newFont);}
        const sf::Font* getFont() {return member.getFont();}

        void setPosition(const sf::Vector2f& newPosition) {member.setPosition(newPosition);}
        sf::Vector2f getPosition() {return member.getPosition();}

        void setRotation(const float& rotation) {member.setRotation(rotation);}
        float getRotation() {return member.getRotation();}

        void setScale(const sf::Vector2f& newScale) {member.setScale(newScale);}
        sf::Vector2f getScale() {return member.getScale();}

        void setString(const std::string& text) {member.setString(text);}
        std::string getString() {return member.getString();}

        void move(const sf::Vector2f& movePos) {member.move(movePos);}
        void rotate(const float& rotation) {member.rotate(rotation);}
        void scale(const sf::Vector2f& scaleAmount) {member.scale(scaleAmount);}

        sf::Text getMember() {return member;}
};

class WindowWrap
{
    private:
        sf::RenderWindow member;

    public:
        void createWindowed(const unsigned int width, const unsigned int height, const std::string& title)
        void close() {member.close();}

        void clear(const sf::Color& clearColour) {member.clear(clearColour);}
        void display() {member.display();}
        void draw(TextWrap& text) {member.draw(text.getMember());}
};

int main()
{
    lua_State* L = luaL_newstate();
    luaL_openlibs(L);
    luabridge::getGlobalNamespace(L)
    .beginClass<sf::Vector2f>("Vector2f")
        .addConstructor<void(*)(float, float)>()
        .addData("x", &sf::Vector2f::x)
        .addData("y", &sf::Vector2f::y)
    .endClass()
    .beginClass<sf::Vector2i>("Vector2i")
        .addConstructor<void(*)(int, int)>()
        .addData("x", &sf::Vector2i::x)
        .addData("y", &sf::Vector2i::y)
    .endClass()

    .beginClass<sf::Color>("Color")
        .addConstructor<void(*)(unsigned int, unsigned int, unsigned int, unsigned int)>()
        .addData("r", &sf::Color::r)
        .addData("g", &sf::Color::g)
        .addData("b", &sf::Color::b)
        .addData("a", &sf::Color::a)
    .endClass()

    .beginClass<sf::Font>("Font")
        .addConstructor<void(*)(void)>()
        .addFunction("loadFromFile", &sf::Font::loadFromFile)
    .endClass()
    .beginClass<TextWrap>("Text")
        .addConstructor<void(*)(void)>()
        .addFunction("setCharacterSize", &TextWrap::setCharacterSize)
        .addFunction("getCharacterSize", &TextWrap::getCharacterSize)
        .addFunction("setColor", &TextWrap::setColor)
        .addFunction("getColor", &TextWrap::getColor)
        .addFunction("setFont", &TextWrap::setFont)
        .addFunction("getFont", &TextWrap::getFont)
        .addFunction("setPosition", &TextWrap::setPosition)
        .addFunction("getPosition", &TextWrap::getPosition)
        .addFunction("setRotation", &TextWrap::setRotation)
        .addFunction("getRotation", &TextWrap::getRotation)
        .addFunction("setScale", &TextWrap::setScale)
        .addFunction("getScale", &TextWrap::getScale)
        .addFunction("setString", &TextWrap::setString)
        .addFunction("getString", &TextWrap::getString)
        .addFunction("move", &TextWrap::move)
        .addFunction("rotate", &TextWrap::rotate)
        .addFunction("scale", &TextWrap::scale)
    .endClass()

    .beginClass<WindowWrap>("Window")
        .addConstructor<void(*)(void)>()
        .addFunction("createWindowed", &WindowWrap::createWindowed)
        .addFunction("close", &WindowWrap::close)
        .addFunction("clear", &WindowWrap::clear)
        .addFunction("display", &WindowWrap::display)
        .addFunction("draw", &WindowWrap::draw)
    .endClass();

    WindowWrap mainWindow; //This is defined here so C++ knows if the main application is open
    mainWindow.createWindowed(800, 600, "Lua Test");
    luabridge::push(L, &mainWindow);
    lua_setglobal(L, "mainWindow");

    luaL_dofile(L, "./script.lua");
}

Here is script.lua:

text = Text();
text:setCharacterSize(16);
text:setPosition(Vector2f(100, 100));
text:setColor(Color(255,255,255,255));
text:setString("Hello World");
font = Font();
font:loadFromFile("./font.ttf");
text:setFont(font); --If I remove this I don't get a Segmentation Fault
mainWindow:drawText(text); --But the Segmentation Fault happens here

The chances of someone being familiar with C++, SFML, LuaBridge and Lua are very low, so I don't expect someone to know exactly why, but just to have an idea or suggestion.

Details I forgot:
  • OS: Ubuntu 14.04
  • Graphics Card: NVIDIA GTX 750 Ti (Not sure if it matters)
  • SFML Version: 2.1

Debugger Callstack:

Code: [Select]
#0 0x7ffff7bb4dcc sf::Font::getTexture(unsigned int) const() (/usr/lib/x86_64-linux-gnu/libsfml-graphics.so.2:??)
#1 0x7ffff7bcdd3e sf::Text::draw(sf::RenderTarget&, sf::RenderStates) const() (/usr/lib/x86_64-linux-gnu/libsfml-graphics.so.2:??)
#2 0x7ffff7bc6b17 sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&) () (/usr/lib/x86_64-linux-gnu/libsfml-graphics.so.2:??)
#3 0x407439 WindowWrap::drawText(this=0x7fffffffe0f0, text=...) (/home/ben/Documents/Programming/C++/Projects/TEST/main.cpp:56)
#4 0x410686 luabridge::FuncTraits<void (WindowWrap::*)(TextWrap&) (../../Resources/External/Cross-Platform/LuaBridge/detail/FuncTraits.h:209)
#5 0x40e774 luabridge::CFunc::CallMember<void (WindowWrap::*)(TextWrap&) (../../Resources/External/Cross-Platform/LuaBridge/detail/CFunctions.h:313)
#6 0x7ffff756561d ??() (/usr/lib/x86_64-linux-gnu/liblua5.2.so.0:??)
#7 0x7ffff75709b4 ??() (/usr/lib/x86_64-linux-gnu/liblua5.2.so.0:??)
#8 0x7ffff7565989 ??() (/usr/lib/x86_64-linux-gnu/liblua5.2.so.0:??)
#9 0x7ffff7564fac ??() (/usr/lib/x86_64-linux-gnu/liblua5.2.so.0:??)
#10 0x7ffff7565bc1 ??() (/usr/lib/x86_64-linux-gnu/liblua5.2.so.0:??)
#11 0x7ffff7561c9d lua_pcallk() (/usr/lib/x86_64-linux-gnu/liblua5.2.so.0:??)
#12 0x404523 main() (/home/ben/Documents/Programming/C++/Projects/TEST/main.cpp:181)

15
Graphics / Re: Scale sf::Texture
« on: June 22, 2015, 07:10:28 pm »
I will try to change the system so there are a lot fewer sprites, but to what Hapax said:
Quote
(320k sprites = 320k draw calls!)
Since when do I need to draw all of the tiles? On a 1600x900 screen with no view zooming I only really need to draw 22 tiles as long as I can work out if the tile is in the area.

Pages: [1] 2 3
anything