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

Pages: 1 2 3 [4] 5 6 ... 16
46
Graphics / Re: Fill sf::Sprite with constant color
« on: November 24, 2017, 05:21:27 pm »
I used this one

#define SHADER_WHITE                                          \
        "uniform sampler2D texture;                             " \
        "                                                       " \
        "void main() {                                          " \
        "    vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);" \
        "                                                       " \
        "    pixel.r = 1.0f;                                    " \
        "    pixel.g = 1.0f;                                    " \
        "    pixel.b = 1.0f;                                    " \
        "                                                       " \
        "    gl_FragColor = pixel;                              " \
        "}                                                      "

 

47
Graphics / Re: Mac OS X - High Sierra - RenderTexture::clear
« on: November 22, 2017, 04:09:44 pm »
I tried to reproduce this issue on my laptop but couldn't. Since I haven't upgraded to High Sierra yet, I also tested in a VM but still couldn't reproduce the issue.

Now, using a VM is far from perfect to test such things, but it would be great if this bug could be reproduced by someone else using similar hardware as you do.

BTW, (if there's a bug) I'm not sure it's the same bug as #1132; the symptoms look too different.

Thanks for your time :) Laptop is "Pro Mid 2014" as I know.
Yeah, probably app will work fine on other configurations, but I made drawing black square just for sure  :)

48
Graphics / Re: Trying to create a graphics engine
« on: November 20, 2017, 11:41:42 pm »
Drawables have different sizes, also you making duplicates. try to use pointers.

std::vector<sf::Drawable*> vectorOfDrawableObjects;


int GraphicsEngine::addToVector(sf::Drawable* drawableObject)
{
        vectorOfDrawableObjects.push_back(drawableObject);
        int objectNumber = vectorOfDrawableObjects.size();

        return objectNumber;
}


void GraphicsEngine::callObjectsDraw(sf::RenderWindow& window)
{
        for (int i = 0; i < vectorOfDrawableObjects.size(); i++)
        {
                window.draw(*vectorOfDrawableObjects[i]);
        }
}


 

49
SFML projects / Re: Screenshot Thread
« on: November 19, 2017, 09:22:52 pm »
Made for a couple of hours. Working on next project for Steam  :)
https://github.com/achpile/arcade

(at this moment to launch snake you should create ArcadeSnake() instead of ArcadeArkanoid() in the main.cpp)


50
x = c.x + r*cos(a)
y = c.y + r*sin(a)

(c) is the center of rotation
(r) is radius
(a) in radians

radian = degree * 3.14 / 180

51
SFML projects / Re: AchBall is now available on Steam
« on: November 17, 2017, 01:04:18 pm »

52
Window / Re: Problem with Button pressed
« on: November 17, 2017, 12:09:56 pm »
Quote
Yes, but since the OP really seems to understand very little about what he's doing, I'd avoid suggesting "complicated" custom solutions and focus on the obvious one first.

Oh, yes, sure  :)

Quote
I have the feeling that this code would really look better with events.

That's why I love SFML. You can achieve result by different ways and everyone can choose which one fits better :)

53
Window / Re: Problem with Button pressed
« on: November 17, 2017, 11:19:29 am »
But using events is much better.

Depending on situation :) I use keyboard and gamepad settings for same actions and it looks like this

bool ach::Control::check() {
        bool result = false;

        if (sf::Keyboard::isKeyPressed(keyCode)) {
                result = true;
        }

        if (!useAxis) {
                if (sf::Joystick::isButtonPressed(joyID, joyCode)) {
                        result = true;
                }
        } else {
                if ((movAxis ==  1.0f && sf::Joystick::getAxisPosition(joyID, joyAxis) >  GAMEPAD_SENSETIVITY) ||
                    (movAxis == -1.0f && sf::Joystick::getAxisPosition(joyID, joyAxis) < -GAMEPAD_SENSETIVITY)) {
                        result = true;
                }
        }


        return result;
}
 

void ach::ControlKey::update() {
        if (!ctrl) return;

        bool newState = ctrl->check();

        if ( newState && newState != state) pressed = true;
        else                                pressed = false;

        if (!newState && newState != state) released = true;
        else                                released = false;

        state = newState;
}
 

54
Window / Re: Problem with Button pressed
« on: November 17, 2017, 10:47:49 am »
or you can init it on constructor with current value of isButtonPressed

55
Window / Re: Problem with Button pressed
« on: November 17, 2017, 10:47:21 am »
obviously false

56
SFML projects / Re: AchBall is now available on Steam
« on: November 17, 2017, 10:20:57 am »
Yay! :)

Lukas, could you use this image if you gonna add it to SFMLProjects please?  :)

57
SFML projects / Re: AchBall is now available on Steam
« on: November 17, 2017, 09:06:43 am »
AchBall has been released!

58
Window / Re: Problem with Button pressed
« on: November 17, 2017, 08:27:30 am »
Because button was pressed for multiple "ticks". If you wanna handle event - handle sf::Event. Or implement own class kinda

newState = sf::Joystick::isButtonPressed

if (oldState != newState && newState) isPressed = true;
else isPressed = false;

oldState = newState
 

59
Window / Re: Problem with Joystick Axis
« on: November 16, 2017, 10:31:03 am »
Btw, your attachment name is not cool at all

60
Window / Re: Problem with Joystick Axis
« on: November 16, 2017, 08:37:32 am »
if (sf::Joystick::getAxisPosition(joyID, joyAxis) >  GAMEPAD_THRESHOLD)
What is the value of GAMEPAD_THRESHOLD?

i use 50.0f

Pages: 1 2 3 [4] 5 6 ... 16
anything