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

Pages: [1] 2 3 ... 15
1
General / Re: Drawing Too Many Sprites Slows Down Game
« on: January 20, 2021, 02:32:55 am »
when posting code, put it in the post (with [ code ] tags), not as separated source files.
are you letting the cpu sleep between frames? there is a specific function for that, sf::sleep:
https://www.sfml-dev.org/documentation/2.5.1/group__system.php#gab8c0d1f966b4e5110fd370b662d8c11b

2
General / Re: [SOLVED] ImGui + SFML - Linker Errors (I need some advice)
« on: January 16, 2021, 11:38:33 pm »
glad I could help somehow  ;D

3
General / Re: ImGui + SFML - Linker Errors (I need some advice)
« on: January 15, 2021, 10:53:29 pm »
i don't know if it's the solution, but from the site you linked there's a comment:

Quote from: Remisto
Just came here to say that you should also add imgui-widgets.cpp to your file. Otherwise you will stuck with LNK2019 errors.

4
SFML projects / Re: Jin Conception 2D Pixel Art JRPG
« on: January 14, 2021, 01:07:45 pm »
wow, its amazing!

5
General / Re: KeyReleased is repeating
« on: December 28, 2020, 06:26:42 pm »
you are forgetting to poll the events with "while (window.pollEvent(event))". working example:

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

int main(){
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML");

    while (window.isOpen()){
            sf::Event event;
            while (window.pollEvent(event)){
                if (event.type == sf::Event::Closed){
                        window.close();
                }
                if (event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::Up){
                    std::cout << "UP! ";
                }
            }
            window.clear(sf::Color::Black);
            window.display();
    }

    return 0;
}
 

7
Window / Re: Opening windows hidden
« on: December 25, 2020, 04:42:51 pm »
hello
how exactly would be a hidden window? a window that can't be seen, but yet you can draw and use events from it? should it appear in the OS' taskbar (since if it does, may not be hidden enough for what you are planning)?

I believe there is no such thing built in SFML, but if you explain better what you are trying to do maybe we can help.

8
General discussions / Re: Why would I choose SFML over SDL2?
« on: December 24, 2020, 12:59:54 pm »
Do you think that SFML is less popular because it is newer?
yes, and because SDL has a compatibility layer to lots of plataforms, and many times it is the only thing used from the library at all.

but SFML performs greatly in most plataforms also: Linux, Windows, MAC... not forgetting Android, of course.
SFML just seems built in a more modern way, mainly in the memory management point.

10
SFML website / Re: a "beginners" board in forum?
« on: December 18, 2020, 01:19:59 pm »
but the idea is not to make a board unrelated to SFML, but something more open to receive questions from new programmers that many times aren't even sure if the problem is based on the language or the library. like they have in Irrlicht forums:
Quote
Beginners Help
If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.

i'd just change the part about general programming
Quote
If you are new to SFML or programming in general, and have a newbie question, this is the forum for you.

but well, it doesn't make sense to have it if other members, include beginners themselves, don't endorse the idea

11
Graphics / Re: Textures and Sprites inside a class(beginner)
« on: December 18, 2020, 12:09:47 am »
for setting a sprite's texture, use
s_wizard.setTexture(wizard);
these specific functions can be found in the API documentation: https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Sprite.php

ps: I'd advise you to give better names to your variables. I usually start with 'm_' when the variable is a member of a class. just 'wizard' also doesn't mean much. so maybe 'm_wizard_spr' and 'm_wizard_tex'?

12
SFML website / a "beginners" board in forum?
« on: December 17, 2020, 10:40:40 pm »
hi
I'd like to know what other members think of having a beginners' board in the 'Help' forum. i've seen lately some questions related mostly to C++, but still pertinet to SFML. which is nice, because it shows that some people are really trying to get the hang of programming, instead of just going for ready game engines like Unity.
  • there are so many experienced developers here, and it would be a shame if thet didn't share their knowledge with the new programmers. unfortunately, it seems that not having such board discourages beginner questions, since even 'General' board expects you to have a good knowledge of C++, and then ask only SFML questions.
  • altough there are specific forums for plain C++ with beginners' sections, you can't expect people there to know SFML. however, we can expect people in SFML forums to know C++.
  • I know that some people would say "first you learn C++, and only then SFML". that's partially right. you can't use SFML if you don't know how to operate a variable. but why not learn both at the same time after the basics? people want to learn how they can make their games, not how to make boring command-line programs that simulate airplanes landing and taking off.
  • the questions, as I said, are being made anyway. and will continue to, we having a beginners board or not.  ;D

so please, opinions.

13
Graphics / Re: Textures and Sprites inside a class(beginner)
« on: December 17, 2020, 10:00:22 pm »
hi. this isn't really related to SFML, but to C++. i'm going to help you, but I suggest you to have a look on the topic around in google later.
you need to pass arguments to your function drawHero(). these arguments are references OR copies of other variables. in this case, you want to pass a reference of your original window, because if you pass a copy you'll end up having one game window for each Hero (what would be weird in a game). to pass by reference you use the '&' signal. so, basically it becomes like this:

class Hero
{

         Texture wizard;
        Sprite s_wizard;

        Hero();
public: //notice that the drawHero function needs to be public to be accessed from outside; in this case, it is called from main()
        void drawHero(sf::RenderWindow&);
};

and this:
Hero::Hero()
{
        wizard.loadFromFile("files/magician.png");  // I want to load the texture inside contstructor
        s_wizard(wizard);
       
       
}

void Hero::drawHero(sf::RenderWindow& window_ref)
{
        window_ref.draw(s_wizard);
}

and in your main code:
main(){
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML"));
    Hero hero;
    //[your code]
    hero.drawHero(window); //here we pass the window to be accessed from inside the Hero
    //[more code]
    return 0;
}
 

14
General / Re: Fps drop to half when change to lower resolution
« on: December 15, 2020, 12:22:06 pm »
does this happens only in SFML? whats about other applications, made with and without OpenGL?
1280x720 may be not optimized for your hardware, did you try 1024x768?

15
Audio / Re: SoundBuffer error "Incomplete type not allowed"
« on: December 10, 2020, 04:50:27 am »
what is soundOff?

Pages: [1] 2 3 ... 15
anything