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

Pages: [1] 2
1
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: August 06, 2012, 03:27:24 am »
I am not sure what you mean exactly. Do you just want a single image, so no hover and down images?
If this is what you want then you can just use the Picture struct. It will also send a callback when you click on it.

Oh, yes, that's what I want.  I didn't realize it would send a callback, so never mind.  Thanks again!

2
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: August 05, 2012, 05:55:38 pm »
A simple request.  Would it be possible to make the button be able to also just load am Image as the button?  So, whenever anyone clicks the image, the button callback kicks off? 

I'm looking for something simple like that, so i figured you could overload tgui::Button::load() to take an image name (or maybe an sf::Image or sf::Texture).

Thanks for the work!

3
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: August 04, 2012, 04:53:11 pm »
WOW!  I downloaded the latest SFML snapshot two days ago, he updates sfml yesterday, and you update TGUI between now and then too!  Just my bad luck I guess :)

I've made the change to supply a unique ID from getObjectId() and it builds, and I can run Form Builder, but I'm not 100% sure it's right.  BTW, running the executable formbuilder.exe you linked just closes immediately with no errors.

Thanks.

4
SFML projects / Re: TGUI: a c++ GUI for SFML (with Form Builder)
« on: August 04, 2012, 04:33:11 pm »
Hi Texus,

I just DL'd you v 0.5 and am building it for Code::Blocks, but I'm getting errors.  I've fixed most of them, from this:
    const sf::Font* EditBox::getTextFont()
    {
        return m_TextBeforeSelection.getFont();
    }
 
to
    const sf::Font& EditBox::getTextFont()
    {
        return m_TextBeforeSelection.getFont();
    }
 
Changing * to &, as getFont() returns a reference, not a pointer.
(I had to do that for multiple .cpp's, and I modified where it was calling those functions.

But, then I ran into a bigger issue, which I can guess a fix, but I'm not sure.  Calling this:
unsigned int Builder::getClickedObjectID(sf::Event& event)
{
    // Check if the left mouse was pressed
    if (event.mouseButton.button == sf::Mouse::Left)
    {
        float mouseX = event.mouseButton.x / (mainWindow.getSize().x / mainWindow.getView().getSize().x);
        float mouseY = event.mouseButton.y / (mainWindow.getSize().y / mainWindow.getView().getSize().y);

        unsigned int highestID = 0;
        unsigned int objectID = 1;

        #define FindObjectNr(Object, objects) \
        for (unsigned int i=0; i<objects.size(); ++i) \
        { \
            tgui::Object* object = mainWindow.get<tgui::Object>(tgui::to_string(objects[i].id)); \
         \
            if (object->mouseOnObject(mouseX, mouseY)) \
            { \
                if (highestID < object->getObjectID()) \
                { \
                    if (highestID > 0) \
                        object->mouseNotOnObject(); \
                 \
                    highestID = object->getObjectID(); \
                    objectID = objects[i].id; \
                } \
            } \
        }


        FindObjectNr(Picture, pictures)
...
 

Gives me an error because getObjectID() is not defined anywhere.  I searched all through the code, and it's not there.  I can modify Objects.hpp, add the funciton, add an id, and just, in the constructor, increment a global ID and assign it that way, but I'm not sure what it is supposed to be used for.

Any ideas?

Thanks!  Looking forward to using this.

5
SFML projects / Re: SFML Light System - Let There Be Light
« on: August 03, 2012, 01:57:58 pm »
Hi Lolz123,

Thanks for the relpy:
Quote
The fix you implemented will just hide any quad tree reshaping issues, so it is only a temporary solution.

Well, that's not good.  Any idea why, in QuadTreeNode::Update(), m_pQuadTree is NULL, which causes a crash (much worse that hiding quadtree reshaping issues :)

Either way, I'll keep an eye out for your new library.  I'm not dependent on the SFML parts of the code, so I should be fine using the new one.

Thanks!

6
SFML projects / Re: SFML Light System - Let There Be Light
« on: August 03, 2012, 05:31:28 am »
Hi Lolz123,

Just wanted to let you know I had to modify v1.5 to get ti to run on my system properly.

I'm using Code::Blocks, Mingw 4.6 on Win7.  Here's the what happens:

After moving around a bit, I'm constantly calling Light_Point::SetCenter(), and eventually, in QuadTreeOccupant::TreeUpdate(), it calls m_pQuadTreeNode->Update(this);

However, it seems in QuadTreeNode::Update(), m_pQuadTree == NULL, so it crashes at the calls m_pQuadTree->m_outsideRoot.insert(pOc);

So, to fix this, I added this check in QuadTreeOccupant::TreeUpdate() (see past else)
        void QuadTreeOccupant::TreeUpdate()
        {
                if(m_pQuadTree == NULL)
                        return;

                if(m_pQuadTreeNode == NULL)
                {
                        // If fits in the root now, add it
                        QuadTreeNode* pRootNode = m_pQuadTree->m_pRootNode.get();

                        if(pRootNode->m_region.Contains(m_aabb))
                        {
                                // Remove from outside root and add to tree
                                m_pQuadTree->m_outsideRoot.erase(this);

                                pRootNode->Add(this);
                        }
                }
                else
                {
                    if (m_pQuadTreeNode->GetTree() == NULL)
                    {
                        m_pQuadTreeNode->m_pQuadTree = m_pQuadTree;
                    }
                    m_pQuadTreeNode->Update(this);
                }

        }
 

There's probably a more efficient way to do this, but it's what I did to get it working.

Thanks!

7
Network / how does a client find a computer running the server
« on: January 30, 2012, 08:32:00 pm »
Quote from: "JayArby"
Thanks for the reply, but it is nice to actually provide the information asked for rather than simply referencing a wikipedia article.

For the information of others, I understand from the article that the broadcast address for a local network is: 255.255.255.255

(Correct me if I got that wrong.)


I know this is a little late, but I wanted to make a point.

Julen26 was pointing you to a link that describes in detail what a broadcast address is and how it works.  He was getting you to learn about it yourself, since, if you have complete knowledge of a subject, you'll understand the why and how, not just the what, and that will make you a better programmer.

You know, teach a man to fish, and all that jazz.

8
General discussions / have fast moving sprites without distortion?
« on: December 21, 2011, 10:12:29 pm »
FYI, some older flat-screen LCD monitor's do have bad motion-blur, and it would look like a fast-moving object would leave a "trail"

9
Graphics / "Tilting" a 2D view...
« on: December 21, 2011, 09:34:38 pm »
Hi,

I'm wondering if it's possible to "tilt" a 2D view.

What I mean is, consider a top-down view.  Now, I want to be able to "tilt" the camera up, so the view seems wider at base, but elongated at the top, and it stretches further in the game worlds view.

I'm basically trying to make a 2D racing game, where I have a track laid-out on a 2D map.  I could do it with a top-own view, but I'd rather have the player be able to see further in front of him.

Is there a fairly easy way to do with with SFML and 2D graphics?

Thanks!

10
SFML projects / 2d Game Making blog...
« on: October 25, 2011, 03:08:06 pm »
Updated blog to add bullets and point player towards the mouse:
http://2dgamemaking.blogspot.com

Later.

11
SFML projects / 2d Game Making blog...
« on: October 24, 2011, 11:34:30 pm »
Hi again Nexus!
Quote from: "Nexus"

But missing deallocations are a problem. It's not only about memory, but all kind of resources (network connections, file handles, etc.), which the OS is not guaranteed to close correctly.


Yes, it is, and I plan on fixing it ("it" being not deallocating on program end), but I just didn't agree that is was "full of memory leaks."  You made it sound like the game was going to crash if it ran too long.

I don't have much experience with smart pointers as I come from a low-level embedded systems background where we handle our own memory, which I am comfortable with.  I'll take a look at it though.

Thanks again!

12
SFML projects / 2d Game Making blog...
« on: October 24, 2011, 05:37:27 pm »
Hi Nexus,

I appreciate the feedback, but I don't agree with everything you said.  I am certainly looking for things I could do better with SFML or other SDK API's, but I think you're nit-picking with some of the details you offered.

Quote from: "Nexus"
Good idea! :)

But your codes are full of memory leaks. If you use new, you must also use delete. However, the better option is to avoid manual memory management at all, i.e. use automatic objects or smart pointers instead of raw pointers (why not std::map<std::string, sf::Image> instead of std::map<std::string, sf::Image*>?)

I decided to see if you were right that it was "full of memory leaks".  Leak meaning, memory will continually be allocated and not freed, thus the leak will eventually cause out of memory.

Here is a list of all the "new" in the code:
    GameSound.cpp 62 38:                SoundMap
[SoundStr] = new sf::SoundBuffer();
GameSound.cpp 130 18:    pSoundInst = new sf::Sound();
SmashPC.cpp 36 13:    gpMap = new SmashPcMap("", gu32ScreenX, gu32ScreenY, &App);
SmashPC.cpp 39 19:    gpOurPlayer = new SmashPcPlayer(&App, gpMap->GetSpace(), cpv(200, 200));
SmashPcPlayer.cpp 40 16:    mpSprite = new sf::Sprite();
Utiliies.cpp 116 31:        gImageMap[FileName] = new sf::Image();[/list]

The sound buffer is being allocated  once per loading of a sound file.  So, that's not a leak.
The Sound Instance is loaded once per use, and deleted when it's finished playing (or stopped).  not a leak.

The Map and Player are allocated once, and that's it.  Not a Leak.

Sprites are allocated once per SmashPcPlayer instance, which there's one, and deleted when the instance is deconstructed. Not a leak.

And images are allocated once per image file.  Not a leak.

Now, it's true I don't delete all the objects when the game is closed, and that's bad, I know.  I'll be sure to add that (it's a peeve of mine too).  But, it's not a leak, since the OS will clear all the memory allocated in the program.

Quote

And I personally would use fewer global variables, they bring a lot of problems even if seeming comfortable in the first term. And last, you should declare variables like sf::Event as local as possible, and use const instead of #define for constants ;)


I may not need them to be global and might make them local.

You're welcome to use const's  for numeric constants, I'll continue to use defines.  To each their own.

And, again, I think you are kind of nit-picking with the Event declaration.

With all that said, I'll still encourage criticism of the code.  No-one is ever good enough they shouldn't listen to what others have to offer.

Thanks!

13
SFML projects / 2d Game Making blog...
« on: October 24, 2011, 05:21:26 am »
Hey All,

I've started making a 2d game using SFML, and i plan on documenting it to hopefully help others who want to make games:
http://2dgamemaking.blogspot.com/

Anyway, just wanted to share it here.

Thanks!

14
Network / Re: A suggestion...
« on: May 12, 2011, 03:11:23 pm »
Quote from: "Beernutts"
I am having this same issue at home (using 2.0), and I've dealt with PC's with multiple IP address' in the past.  I didn't have time to debug it, but I'll look at it tonight and get back to you here.

I do think the API should be modified since often PC's are on multiple networks.  In fact, the PC I use at work has 3 IP address' to 3 different networks.  For an simple test app I wrote, I included this bit of code (Windows only) to select which IP address to use (see below).

I would love for the GetLocalIpAddress to maybe pass an index, so we can get all the possible local IP addresses, or some other method of getting all the IP addresses the PC has.

Thanks.


So, I tried to create a solution to this in my app by checking if the GetLocalAddress() was LOCALHOST, and, instead creating an sf::IpAddress with my real IP address (using code close to that above).  However, using that code doesn't seem to allow me to send any packets out the ethernet interface I'm trying to use.  Checking Wireshark, there's no data being sent on my ethernet interface (using UdpSocket here).

So, until sf:Network is modified to properly handle this situation (perhaps you need to modify Bind() to include the IP address to Bind the socket to as well as port assuming there will be multiple possible network interfaces), I'm going to implement my solution in good old sockets.

15
Graphics / rotating Screen around central player (sfml 2.0)...
« on: May 11, 2011, 05:32:30 pm »
Quote from: "Laurent"
Views are exactly made for this, what problem did you get?


I'm not sure how to rotate the view without also rotating my character, so I didn't mess with that part.  So, instead, I drew my scene on the normal RenderWindow, copied that to an Image, rotated the image, Draw()'d it on the Render Window, then used the view to zoom in so the clipped corners weren't showing.

I'll mess around with rotating the view when I get home.

Pages: [1] 2
anything