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 - The Terminator

Pages: 1 2 3 [4] 5 6 ... 15
46
General / Re: Simple program high CPU usage
« on: March 02, 2014, 03:56:48 pm »

47
Thanks guys, I resolved the issue.

48
Hi there,

I'm doing a little test for my GUI system, where I have a sf::RectangleShape that is acting as an edit box. I'm trying to center the text directly on that rectangle shape, but whenever I call my centerText() method for the first time (whenever a person inputs a character for the first time) it changes the rectangle's position a little bit to the left and up, then works perfectly. Sorry if this is a little confusing but here's my code:

sf::RectangleShape m_box;
sf::Text m_text_drawn;

void EditBox::handleTextEvent(sf::Uint32 character)
    {
        if (!getInWidget() || !getVisible())
            return;

        if (character == 8)
        {
            if (!m_user_text.isEmpty())
                m_user_text.erase(m_user_text.getSize() - 1);

            return;
        }

        if (character < 127)
            m_user_text += character;

        centerText();
    }

void EditBox::centerText()
    {
        m_box.setOrigin(m_box.getGlobalBounds().width / 2, m_box.getGlobalBounds().height / 2);

        m_text_drawn.setOrigin(m_text_drawn.getGlobalBounds().width / 2, m_text_drawn.getGlobalBounds().height / 2);
        m_text_drawn.setPosition(m_box.getPosition());
    }

Thanks!

49
SFML game jam / 2 quick questions
« on: February 28, 2014, 12:46:33 am »
Ok thanks. Yeah it uses SFML don't worry :P

50
SFML game jam / 2 quick questions
« on: February 27, 2014, 08:00:56 pm »
Until now? Meaning we can't anymore?

51
SFML game jam / 2 quick questions
« on: February 27, 2014, 04:01:08 pm »
Hi there,

I had two quick questions about the game jam:

1. When is the next one? ;D

2. Are we allowed to use a pre-written engine during the jam?

Thanks

52
I honestly don't think anyone is going to go for this library due to its over complication. We all came to SFML for its simplistic, clean, and modern design that is useful and beautiful. It seems to me that you're programming a lot of things just to be able to say that you did it, when you're actually reinventing a much more complicated wheel. I advise you to take a step back and actually design before you program. It will help a lot too if you listen to the more experienced members of the community too. *cough* Nexus and Grimshaw *cough*

53
General / Optimizing CPU usuage
« on: February 26, 2014, 01:42:23 am »
Recycling frames is never a good idea. The system your seeking will be a lot more work for little extra reward. Your code will be far more error prone and hard to maintain. Furthermore, for your code, 20% CPU usage isn't really that much. You say that you're on an older computer, but you can safely bet people that play your game will have newer GPUs and CPUs which will handle it a lot better. Don't fix what isn't broken. ;)

54
Graphics / in SFML
« on: February 24, 2014, 01:55:33 pm »
You will have to build a renderer yourself. SFML does not support those sorts of features.

55
SFML projects / Countdown-Alert release
« on: February 17, 2014, 02:17:32 pm »
It's pretty obvious that you're coming from a C background. I think you should read a good, modern C++ book to learn about the new, wonderful features of the language. There's a list of recommended books here: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

It'll be a strange transition if you're really used to defines, macros, malloc etc, but features such as templates and smart pointers more than make up for it. :)

56
Window / Moving Borderless Windows
« on: February 13, 2014, 01:31:16 am »
You could see if a user has their mouse in the window plus holding the left mouse button using events. If they do, simply use sf::RenderWindow::setPosition with the new coordinates.

57
SFML projects / Re: RPG Style Simple Text Menu
« on: February 09, 2014, 02:15:16 am »
I've got some more suggestions:

In your constructor, use initialization lists: http://www.cprogramming.com/tutorial/initialization-lists-c++.html

When looping through your STL containers, use iterators versus array indices: http://stackoverflow.com/questions/131241/why-use-iterators-instead-of-array-indices

I think it's good that you're providing sufficient documentation, but there is such a thing as too much ;). On lines like this:

// Update the menu.
updateMenu();

It's good that you provide relevant names to your methods, so such comments aren't necessary because you can tell exactly what it's going to do.

Also, prefer smart pointers to raw pointers as they utilize RAII: http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization

std::deque is not the appropriate container to use, especially since you are searching through them using array indices which is a slow operation. Prefer std::vector because it is inexpensive and efficient to search through.

VisibleOption[v] = NULL;

NULL is a deprecated C-style way of declaring a null pointer constant, and could sometimes yield undefined behavior. Prefer nullptr, which is the C++ way of doing the same thing without the risk.

I sorta searched quickly through your code, but I hope you find this useful!

58
SFML projects / Re: RPG Style Simple Text Menu
« on: February 08, 2014, 08:21:42 pm »
Instead of pasting all of the code into one thread, have a look at creating a repository at websites such as https://github.com/
Just out of curiosity, did you use the code? If you did, did it work okay for you?

I didn't, mainly because I already have a similar system in my engine but it's good work regardless.

59
SFML projects / Re: RPG Style Simple Text Menu
« on: February 07, 2014, 10:16:56 pm »
Instead of pasting all of the code into one thread, have a look at creating a repository at websites such as https://github.com/

60
General discussions / Current situation of SFML
« on: February 04, 2014, 02:29:24 am »
Good luck!  Good on you Nexus to take over.

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