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

Pages: 1 ... 4 5 [6] 7 8 ... 720
76
Graphics / Re: Drawing Vertex Array with big Texture
« on: January 25, 2024, 11:17:53 am »
The way sf::Text kind of solves this is, that it only loads the used glyphs in the size it needs into a texture from a font size.

77
General / Re: How do I make a rectangle move at the direction of a line
« on: January 23, 2024, 08:20:33 am »
Could this line:
https://github.com/eXpl0it3r/Examples/blob/master/SFML/RotatingTriangle.cpp#L26
auto deltaPosition = sf::Vector2f{ mousePosition.x - triangle.getPosition().x, mousePosition.y - triangle.getPosition().y };
not just be this:
auto deltaPosition = mousePosition - triangle.getPosition();
Yeah, totally! ;D
Will fix that right up, thanks!

78
General / Re: How do I make a rectangle move at the direction of a line
« on: January 22, 2024, 08:35:08 am »
Here's an example of a rotating triangle that will point to the mouse position.
You can adapt it to rotate with keyboard inputs.

https://github.com/eXpl0it3r/Examples/blob/master/SFML/RotatingTriangle.cpp

79
Graphics / Re: Issue with LoadFromFile
« on: January 21, 2024, 09:52:24 pm »
You can't write an if statement in the global scope. It needs to be inside main().

You should also not use global texture and sprite variables.

80
General / Re: How do I make a rectangle move at the direction of a line
« on: January 21, 2024, 09:50:40 pm »
You need to give us a bit more info to help you.

It all depends on how you're currently moving the rectangle and what "at the direction of a line" really means to you.

If you call move() on a RectangleShape, you can change the x and y values to change in what direction you're moving. You could represent the direction as a Vector2f, say moving left would be vec.x = 1 and moving down would be vec.y = -1. Then you set a value for the speed and multiply it with the direction vector before passing it to the move function, e.g. rect.move(vec * speed).

As for the inputs, you can handle events and translate the key presses to setting the direction vector.

81
You can avoid such issues by relying on RAII (Resource Allocation is Initialization) by using smart pointers such as std::unique_ptr and never doing manual memory management (new / delete).
That way you can ensure that once the smart pointers run out of scope, the referenced object is deleted.

In "modern" C++ you should never really call new and delete directly.

As for TGUI, I don't know how it's managed, but it might run into Static Initialization Order Fiasco.

82
Window / Re: simulating mouseClick
« on: January 21, 2024, 09:38:38 pm »
How is the mouse simulated?

sf::Mouse::isButtonPressed does a hardware/system call to poll the mouse state and it will only do the check at the time the function is called, so if you render at 60fps, that's then once every 16ms.
As such there could be two potential failure modes. One the poll of the mouse state doesn't actually work for a simulated click. Or two, the "click" is too short and the window between mouse state fetching and mouse click keep missing each other most of the time.

I recommend to use events instead.

Whether that's the actually issue, I don't know, but we don't exactly have a lot to go on. :D

83
Do you have dual GPUs (e.g. Intel + Nvidia)?

84
General / Re: Changing File Name
« on: January 19, 2024, 09:02:15 pm »
You probably have to delete the cache and regenerate the project. Not sure how CLion handles such a project name change.

85
General / Re: my program does not work on other computers
« on: January 19, 2024, 09:15:12 am »
Have you downloaded the exact matching compiler for the SFML version?

See the green links in the red box on the download page:



https://www.sfml-dev.org/download/sfml/2.6.1/

86
System / Re: Process finished with exit code -1073741515 (0xC0000135)
« on: January 17, 2024, 03:36:33 pm »
could not find git
As mentioned, you'll need to install git, and then make sure it's in PATH (might require a terminal restart).

87
System / Re: Process finished with exit code -1073741515 (0xC0000135)
« on: January 17, 2024, 03:01:30 pm »
Copied and pasted the cmake.
You can't just copy paste without understanding what it does...  ::)

If you don't want to fetch and build SFML automatically, you don't need everything, check the statements at the bottom.
If you do want to use the full template, read the readme that explain some more things and make sure git is installed.

88
System / Re: Process finished with exit code -1073741515 (0xC0000135)
« on: January 17, 2024, 02:29:12 pm »
The SFML CMake Template has some code snippet to copy the OpenAL DLL, which I assume might be missing in your case.

89
System / Re: Process finished with exit code -1073741515 (0xC0000135)
« on: January 17, 2024, 01:45:07 pm »
IIRC 0xC0000135 just means that you're missing some DLL.
If you double click the executable in explorer, it should tell you which DLL exactly is missing.

Most likely, you'll have to copy the SFML DLLs next to your executable.

90
General / Re: Ayuda
« on: January 15, 2024, 02:05:33 pm »
This is an English speaking forum, please stick to it. :)

Pages: 1 ... 4 5 [6] 7 8 ... 720
anything