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 - G.

Pages: [1] 2 3 ... 61
Window / Re: Problem with mouse position
« on: August 26, 2022, 07:28:17 pm »
Your cursor has a position in pixels, relative to the screen or the window. Entities inside your game have coordinates in "world units".
If you want to convert your mouse position in pixels to its corresponding coordinates in the game world, use the mapPixelsToCoords function

General / Re: How do i read keyboard keys for every kind of keyboard?
« on: August 15, 2022, 02:32:12 am »
Text editor? Probably want to use the sf::TextEntered event instead, it is made to read text input.

Graphics / Re: SFML 2.0 Class Text without outline
« on: August 11, 2022, 09:47:42 am »
Text outlines were added (setOutlineThickness & setOutlineColor) in SFML 2.4 exactly 6 years ago, any reason you don't want to use a more recent version of SFML?

Anyway, if you can't update to 2.5, you can make an outline by drawing the same text 8 times around your text with 1 (or more) pixel offset in each direction, or create an outline in a fragment shader if you know some GLSL.

You could have 2 sprites with the same road texture, display them next to each other, then when one disappears from your view, you move it back to the top, and so on.

Alternatively, you could set your road texture as repeated, move the TextureRect of your road sprite the same amount as your view, and draw your road sprite on a different view that doesn't move.

Graphics / Re: TextEntered input repeats
« on: July 06, 2022, 07:34:08 am »
Never use event outside of your pollEvent loop

General / Re: Why it so hard to install and do not works?
« on: June 12, 2022, 04:58:18 pm »
It's C++.

Have you tried following the official tutorial, without skipping any part? It's not that hard  ???

Graphics / Re: Sf::View and How can i fix things on display?
« on: May 22, 2022, 10:03:07 am »
Draw them on another view that doesn't move.
// draw your gameplay here
// draw your user interface here

General / Re: How to set SFML up for VS and not per project
« on: May 21, 2022, 06:39:00 pm »
Don't know about 2022 but in Visual Studio 2019, I created a base SFML project and then I chose "Export template" from "Project" in the main menu.
Afterwards when I create a new project I can chose to use this as a template.

General / Re: String erase problem while using Event::TextEntered
« on: March 20, 2022, 07:36:06 pm »
In your TextEntered event, don't add the character to your string if it is equals to the backspace character ( '\b' ).

In your current code you delete the last char in the KeyPressed event, and then you also add the backspace character in your TextEntered event, it is probably invisible. On further backspace key presses you delete that invisible character then add a new one. That's why it looks like it's not doing anything.

General / Re: Hitbox
« on: March 18, 2022, 07:28:24 am »
If your buttons or menu elements are sf::Sprite or sf::RectangleShape you can get the bounding box of your button with the getGlobalBounds function. Once you have its bounding box you can use it as an hitbox and use its contains function to check if the mouse coordinates are inside of it.
(You can also write your own hitboxes instead of using the bounding boxes if you want a smaller clickable region for example, but I think you'll get the idea)

General / Re: How to use correctly the trigger
« on: March 07, 2022, 06:37:00 pm »
Joysticks and triggers aren't buttons, they are axis, use sf::Joystick::getAxisPosition and you can consider it "pressed" when it crosses a threshold

Window / Re: nothing is moving on screen
« on: January 17, 2022, 09:23:21 pm »
You have an infinite (until there's a Closed event) loop inside your isClosing function.

General / Re: Visual Studio 2019 Cannot find file “SFML/Graphics.hpp”
« on: January 07, 2022, 08:53:52 am »
Eager to see, I really wonder what the official SFML tutorial is missing

General / Re: Visual Studio 2019 Cannot find file “SFML/Graphics.hpp”
« on: January 06, 2022, 07:07:48 pm »
Did you do it for the correct configuration? (debug/release, 32bits/64bits)

General / Re: Code::Blocks - Cannot find libraries?
« on: January 05, 2022, 07:11:40 am »
I'm not sure if that's the only problem, but if you want to link the static version of SFML you need to link
sfml-graphics-s (or sfml-graphics-s-d if debug) and I see -lsfml-graphics in your log without the -s (nor the -d)
On top of that if you're in static, you also have to link every needed dependencies, in the correct order. You can find the list in the table in the 2nd half of the tutorial

Also make sure the sfml package you're using was compiled with the same compiler/version as the one you're using.

BTW when you have everything working, you can create a template project in codeblocks so that you won't have to set up everything again in new projects. I don't remember how but it should be easy

Pages: [1] 2 3 ... 61