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

Pages: 1 [2] 3 4 ... 6
16
General discussions / Why does sf::Packet convert to big endian?
« on: March 02, 2016, 07:47:56 pm »
Windows and OS X are little endian. Linux can theoretically be big endian, but today pretty much 100% use little endian.
Converting to big endian seems like waste of cpu. Is there something I'm missing?

17
SFML projects / Re: Slimey Carnage
« on: January 05, 2016, 01:54:56 am »
Amazing.

18
Sweet! Thank you so much!!

19
Hello, will I be able to compile sfeMovie with VS 2015?

20
Network / Re: Packet receives empty string
« on: June 18, 2015, 02:45:50 am »
your code works fine on my computer.

21
Network / Re: Packet receives empty string
« on: June 17, 2015, 09:48:41 pm »
I think the new_building has to be char *

22
Graphics / making a rectangle enclosing a text
« on: May 26, 2015, 06:05:51 am »
float height = m_text.getFont()->getLineSpacing(m_text.getCharacterSize()) / 2.f;
m_rect.setSize({ m_rect.getSize().x, m_text.getLocalBounds().height + height});
window.draw(m_text); window,draw(m_rect);

when the text has letters it looks fine


but when the text is just like "..." the rectangle's height is shorter than it should be


how can i solve this issue?

23
General / Re: Tried making a Exe of my Program/Project
« on: May 15, 2015, 05:20:16 am »
file -new - project - empty project.

add all your files and libraries again then try to compile and run it

24
General / Re: Tried making a Exe of my Program/Project
« on: May 15, 2015, 03:41:37 am »
Try using an empty project

25
Graphics / Re: What is wrong with my code?
« on: May 06, 2015, 08:46:35 pm »
Thanks!

26
SFML projects / Re:creation - a top down action rpg about undeads
« on: May 06, 2015, 05:37:19 pm »

I'm thinking about it and this can be a lot more efficient than what I use now. (Faster iteration, less cache misses, object pools...)
And I'll possibly implement it this way at some point in future and I won't have to change lots of code. (There's no need for it now though, as I don't see any perfomance related issues with the stuff I have now).
The only thing which I can't figure out is how to actually create arrays for each component and then easily get it.
For example, suppose I want to be able to get some component this way:
auto mc = get<MovementComponent>(entityId);
So, I need some kind of type/component array mapping. And while the key can be a std::type_index, what will the value of the map be? I can't store arrays of different types in one std::map.

The way i implemented that is assigning unique ids(starting at 0) to each component at compile time.
Then you store these components in a vector.
Then you can retrieve each component by its id.
If an entity doesn't have that component, it can return nullptr.

template <class C>
C * get(int id)
{
     std::vector<Component*> & v = getComponentsofEntity(id);
     return static_cast<C*>(v[C::getUniqueID()]);
}
 

27
Graphics / What is wrong with my code?
« on: May 06, 2015, 05:13:59 am »
Hello, i'm building my own gui system.

i have a Container class that derives from sf::Transformable and stores children widgets. I also have a Panel class that derives from Container.
When I set a child widget's position, I want it to be relative to the parent's position.

auto panel = ui::Panel::create();
panel->setSize({ 100.f, 100.f });
panel->setPosition({ 50.f, 50.f });
panel->color = sf::Color::Blue;

auto panel2 = ui::Panel::create();
panel2->setSize({ 50.f, 50.f });
panel2->color = sf::Color::Green;

panel->add(panel2);

...
ui.add(panel);
window.draw(ui);
 

Since I never moved Green panel's position, I expect it to be at the same position as the Blue panel. However in my program it appears at 50, 50 relative to the blue panel.

What I get


What I expect


void Panel::draw(sf::RenderTarget & target, sf::RenderStates states) const
{
        states.transform *= getTransform();
        sf::RectangleShape r;
        r.setFillColor(color);
        r.setSize(getSize());
        target.draw(r, states);
        Container::draw(target, states);
}

void Container::draw(sf::RenderTarget & target, sf::RenderStates states) const
{
        states.transform *= getTransform();
        for (auto w : m_widgets)
                target.draw(*w, states);
}

What's wrong?

28
Audio / Re: crash with sf::Music
« on: May 03, 2015, 07:25:15 pm »
now the program crashes with "access violation" error

29
Audio / crash with sf::Music
« on: May 03, 2015, 06:54:36 pm »
I'm using phsfsstream class from here: https://github.com/SFML/SFML/wiki/Source%3A-PhysicsFS-Input-Stream

#include "PhysfsStream.h"
#include <SFML/Audio.hpp>
#include <iostream>

int main(int argc, char* argv[])
{      
        PHYSFS_init(argv[0]);
        PHYSFS_addToSearchPath("musics", 1);

        sf::Music music;
        PhysfsStream stream;
        stream.open("sample.ogg");
        music.openFromStream(stream);
        music.play();
       

        //music.stop(); //adding this line will prevent the program from crashing

        PHYSFS_deinit();
}

this program crashes saying "pure virtual function call", but if I stop the music before it goes out of scope, it won't crash. Is this a bug in SFML?

using visual studio 2013 and sfml 2.2

30
Network / Re: accepting a socket that has already been accepted
« on: April 15, 2015, 08:38:44 pm »
If a socket has been accepted, any request to be re-accepted will be ignored until the original connection is terminated.

As soon as another connection request arrives, the previous one will be disconnected.

I think these are 2 conflicting responses. So does the previous connection get disconnected or not?


Pages: 1 [2] 3 4 ... 6