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

Pages: [1]
1
General / checking collisions with array of objects takes too much
« on: May 28, 2024, 09:28:52 am »
Hi everyone. I have this button script:
Button.cpp
(click to show/hide)
in short it just creates rectangleshape and text, chekcs its collision with mouse and returns it in "isPressed". My problem here is that when i try to create a vector with buttons it starts to freeze in some moments also taking up a lot of memory at these, i do it like this:
in game start function:
(click to show/hide)
in game update function:
(click to show/hide)
at start i initialize buttons right to vector and in update check if button is pressed, the updateEvented checks collision and changes button states and buttonBoxfunc changes button color also helping to check collision creating box to collide with mouse
help me please to fix these freezes

2
Graphics / Re: text output by character
« on: January 11, 2021, 12:02:42 am »
nwm i did it myself lol

3
Graphics / text output by character
« on: January 04, 2021, 02:57:36 pm »
this is how it must look, in console application:
(click to show/hide)
i also think it should look something like this in sfml:
(click to show/hide)
but it doesn't work how i need, any hints please?

4
Graphics / Re: text doesnt show up in app
« on: December 02, 2020, 07:38:25 pm »
the 'e' variable (Text) is destroyed when the function ends, so there is no text at all to draw.
also, you don't have a font attached to the Text. and the text itself is not being drawn to any window.
thanks, that helpd. Now function looks like this
Text loadClass::buttonColor(Text e, int a, int b, int c, int d, RenderWindow& window )
{
        if (IntRect(a, b, c, d).contains(Mouse::getPosition(window)))
        {
                e.setFillColor(Color::Yellow);
        }
        else
        {
                e.setFillColor(Color::White);
        }
        return e;
}
also it needs to be in rendering function ;D

5
Graphics / text doesnt show up in app
« on: December 02, 2020, 12:57:45 pm »
void loadClass::buttonColor(RenderWindow& window, int a, int b, int c, int d, Text e)
{
    if (IntRect(a, b, c, d).contains(Mouse::getPosition(window)))
    {
        e.setFillColor(Color::Yellow);
    }
    else
    {
        e.setFillColor(Color::White);
    }
}
this fuctrion somewhy didnt work, help please! whats wrong?

Pages: [1]
anything