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

Pages: 1 [2] 3
16
General / Strange behavior with isKeyPressed() function
« on: July 11, 2015, 09:21:08 am »
Hi,

I'm using isKeyPressed function for smooth movement.
it works correctly when I'm using up/down/left/right with shift.

But when I use numpad, the problem comes up.
First, if I press shift and then numpad, it doesn't catch shift.
and when I press numpad first and then shift (while pressing numpad),
isKeyPressed(numpad) returns always true after I released the key. (not always but very often)

also in this situation, even if I turn the program off and on, the isKeyPressed function still returns true.
Here's a small example of the code. (I'm using windows 8.1 and vs2013)


        while (window.isOpen())
        {
                bool shift = sf::Keyboard::isKeyPressed(sf::Keyboard::LShift) || sf::Keyboard::isKeyPressed(sf::Keyboard::RShift);

                bool up = sf::Keyboard::isKeyPressed(sf::Keyboard::Up) || sf::Keyboard::isKeyPressed(sf::Keyboard::Numpad8);
                bool down = sf::Keyboard::isKeyPressed(sf::Keyboard::Down) || sf::Keyboard::isKeyPressed(sf::Keyboard::Numpad2);
                bool left = sf::Keyboard::isKeyPressed(sf::Keyboard::Left) || sf::Keyboard::isKeyPressed(sf::Keyboard::Numpad4);
                bool right = sf::Keyboard::isKeyPressed(sf::Keyboard::Right) || sf::Keyboard::isKeyPressed(sf::Keyboard::Numpad6);

                std::string string = "";

                if (shift)
                        string += "shift ";
                if (up)
                        string += "up";
                if (down)
                        string += "down";
                if (left)
                        string += "left";
                if (right)
                        string += "right";

                text.setString(string);

                window.clear();
                window.draw(text);
                window.display();
        }
 

I always very appreciate to SFML team, Thanks :)

Edit: fixed typos

17
SFML wiki / Re: Settings parser
« on: December 15, 2014, 09:30:18 am »
You should handle an exception about a line with only white spaces in the parseLine function.

18
General / Re: Jerky gameplay
« on: December 15, 2014, 03:22:33 am »
I heard that old games like Super Mario Bros stored subpixels in a separate integer.
So you might also use an another variable for the decimal units of the velocity.
But I don't know this is good for modern game dev or not.

as I know on it is also a kind of limit of pure 2D graphics.
You need to use 3D graphics (means directly use OpenGL) to solve this problem completely.

19
General / Re: Jerky gameplay
« on: December 14, 2014, 04:14:59 am »
I think this is because of the floating numbers of the sprite's position.
Try to use an integer value for velocity.

For example


        if (isMovingUp)
                velocity.y = -1.f;
        if (isMovingDown)
                velocity.y = 1.f;
        if (isMovingLeft)
                velocity.x = -1.f;
        if (isMovingRight)
                velocity.x = 1.f;

        rect.move(velocity);
 

20
SFML projects / Re: Arcane, the roguelike
« on: November 19, 2014, 08:21:54 am »
Thanks for your suggestion, Mörkö.
Because I'm not a native speaker nor am I good at English, It's hard to make natural texts.

21
SFML projects / Arcane, the roguelike
« on: November 18, 2014, 12:17:00 pm »
Hi,

Since the beginning of this year, I've been making a simple roguelike game called Arcane.
I'm trying to make a bit traditional roguelike game but has a nice graphical interface.

Here's a link for the demo. I made this demo for ProcJam.
http://underww.itch.io/arcane

It's a just engine demo though, :)
Thanks.



[Screenshots]




22
General / Re: Looking for gamedev resources.
« on: April 07, 2014, 11:08:22 am »
Yeah, I argree with eXpl0it3r.
I was just wondering if there's something similar to the SFML book or whatever.

I like AI books.
Programming Game AI By Example(by Mat Buckland) is one of my favorite gamedev books.
I'll check the AI book. Thank you. :D

23
General / Re: Looking for gamedev resources.
« on: April 07, 2014, 08:52:32 am »
They're mainly focusing on C++ language.
I have already many C++ and C++11 books.
I wanted to know something about more game development techniques like your book.

But, Thanks. I'll check them also. :)

24
General / Looking for gamedev resources.
« on: April 06, 2014, 09:24:07 pm »
I read SFML Game Development book and it was very impressive.
Actually, there are lots of game tutorials / articles, but I've hardly seen something handles the modern techniques and C++11.
Is there any good gamedev resources with C++11 or modern techniques?

I don't know about C++11 much, but I've been using C++ around 10 years.
(and relatively new to gamedev.)

25
Window / Re: Centering the game window.
« on: March 07, 2014, 04:47:11 pm »
ok, thanks for the replies. :)
i don't think everyone put the taskbar on the bottom.
so, i'd better to use some WinAPI functions.

26
Window / Re: Centering the game window.
« on: March 07, 2014, 04:16:32 pm »
unfortunately, they were not useful.
this is the same as the initial position.

sf::Window window(...);
auto desktop = sf::VideoMode::getDesktopMode();
window.setPosition(desktop.width/2 - window.getSize().x/2, desktop.height/2 - window.getSize().y/2);

27
Window / Centering the game window.
« on: March 07, 2014, 04:01:33 pm »
SFML basically centers the window when it is created.
but it doesn't consider Windows taskbar and also the game window's border size.
the border size is negligible but, the taskbar is a bit annoying.
here's some pictures for the explanation.





I want to set the window like the second image.
so, how can I get the taskbar's position, size and a window's border size?
any advice will be appreciated. thank you :)

28
Graphics / Re: Afterimages while fast scrolling screen
« on: January 08, 2014, 02:33:54 pm »
Ok, Thanks for replying everyone.
I thought it can be handled with triple buffering or other techniques.
But as you said, it may the problem with hardware such as a monitor.
I will test it on other systems later.

29
Graphics / Re: Afterimages while fast scrolling screen
« on: January 08, 2014, 01:59:49 pm »
Yes, I use VSync and framerate is 60.
I can say it is not about clear-draw-display cycle problem.

It doesn't happen with low speed scrolling.
Like an example code, 1.0f ~ 2.0f move per frame is very clear.

30
Graphics / Re: Afterimages while fast scrolling screen
« on: January 08, 2014, 01:44:35 pm »
Sorry for my lack of explanation.

I have a Geforce graphics card (GTX 650 Ti Boost) and use Windows 8.1 x64.

And I use SFML 2.1 stable version and latest build.

It is a bit hard to explain. It's similar to screen tearing and flickering issues.

While scrolling the screen quickly, images are a blur.

And I found that it looks because of the image before clear the window.

So I think it is a problem related with double buffering.

It can't be captured in a screenshot, but when it happens I can see.

Pages: 1 [2] 3
anything