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

Pages: [1]
1
General / Re: Compiling SFML Project on Windows and Bash
« on: September 06, 2022, 11:52:35 pm »
I actually know the problem, I just don’t know how to solve it. I used apt-get to install SFML, but it installed into the folder that normal GCC uses, not x86_64-w64-mingw32-gcc. I don’t know how to install it to a different folder.

2
General / Re: Compiling SFML Project on Windows and Bash
« on: September 06, 2022, 06:58:00 pm »
WSL2 :)

3
General / Re: Collision detection, makes sprite move in opposite direction.
« on: September 05, 2022, 06:36:22 pm »
A way I found to fix this: rather than detecting whether it's currently colliding, before a movement, check if after the movement the object will be colliding, and only do the move if it wont be colliding. e.g. if the move is 50, 50 do a collision check on position + movement and only move if it wont collide.

4
General / Compiling for Windows on Linux
« on: September 04, 2022, 05:16:30 pm »
How would I go about doing this? Using x86_64-w54-mingw32-g++ produces errors. Please ask for more info.

5
General / Compiling SFML Project on Windows and Bash
« on: September 03, 2022, 12:42:20 am »
Hey! I recently set up the Debian terminal (bash) from the Windows store, and I've been trying to compile SFML apps into .exe files using x86_64-w64-mingw32-g++, but it hasn't been working. Is there any good way to compile SFML apps in the Debian terminal of Windows? (Effectively compile as EXE on Linux)

6
General / Re: Visual Studio 2019 Cannot find file “SFML/Graphics.hpp”
« on: January 07, 2022, 02:47:59 am »
UPDATE: I fixed it. I’ll soon be posting a Google Docs link to a tutorial for Visual Studio 2019.

7
General / Re: Visual Studio 2019 Cannot find file “SFML/Graphics.hpp”
« on: January 06, 2022, 07:39:03 pm »
I tried changing to release as I had linked the release .lib files. I also tried x86, x64 and Win32. Still nothing.

8
General / Visual Studio 2019 Cannot find file “SFML/Graphics.hpp”
« on: January 06, 2022, 06:55:44 pm »
I followed the tutorial on setting up SFML for Visual Studio, as well as some other tutorials, but when I add:
#include <SFML/Graphics.hpp>
Visual Studio gives me an error saying, “Cannot open header file ‘SFML/Graphics.hpp’”.
In Properties->C/C++->General, I added C:\Users\zeffb\Documents\C++\SFML-2.5.1\include
That folder contains a folder called “SFML” which has in it files such as “Graphics.hpp”.
I also linked all the .lib files.
What am I doing wrong?

9
General / Re: Switching 'scenes'
« on: September 03, 2021, 06:31:59 pm »
How do you switch 'scenes' in SFML? Example: From the menu to the game.
This is something that I have not seen anywhere :/
This is pretty simple, as long as the game/app isn't too insanely complex. Essentially the state of a program is stored in variables. So use a few to keep track of the scene:
int scene = 1; //Scene 1 is menu, 2 is game, etc. Only render certain things or run certain code/inputs if the scene is a certain integer. Example: only check for clicks on menu buttons if scene = 1.
bool running = false; //Only run the code for the primary game functions when running = true. This allows you to freeze the program.
bool reset = false; //You will see this later
 
In your main loop, on the game end, set running to false.
When the game starts, set running to true and scene to 2.
When you want to reset the game, set reset to true. Then you'll need an if statement, IN THE MAIN LOOP, like this:
if(reset == true)
{
    //Reset the game variables to their original values
    reset = false; //Make sure it doesn't reset every frame
}
 
Sorry if it's hard to understand, if you need help, just DM me and I can set up a tutorial.

10
Graphics / Re: How to optimize multiple draws
« on: July 18, 2021, 06:32:04 pm »
Hey! Here's a simple way of doing this that nobody has mentioned. Say you have a 50 by 50 grid of gray squares. When a square is clicked, it turns white. Here's a simple way of cutting down render calls a TON:
  • Create an image (PNG or JPG) of your 50 by 50 grid.
  • Render this image as a Sprite instead of 2500 separate squares.
  • When you click, use an algorithm to detect which cell you clicked.
  • Draw a WHITE RECTANGLESHAPE on top of the grid with the width and height of one cell at the position of the cell clicked.

the problem doing it is that you kill exactly the purpose of tiles: repetition of small parts (tilesets) to avoid large textures. also, many videocards can't handle textures bigger than 8192x8192, so for 50x50 tiles you max tile size will be 163,84x163,84. for 100x100 maps, it will be 81,92x81,92  :P
Fine point, but you can easily break the single grey grid texture into four 25x25 textures.

11
Graphics / Re: How to optimize multiple draws
« on: July 18, 2021, 06:30:21 pm »
Uhmm so what about when there are many white cells... Isn't it the same
One workaround (don’t recommend) is to swap once half the tiles are white. By then, you can have the image be a WHITE grid image and just render individual grey tiles which you REMOVE when clicked.

12
Graphics / Re: How to optimize multiple draws
« on: July 12, 2021, 06:26:05 pm »
Hey! Here's a simple way of doing this that nobody has mentioned. Say you have a 50 by 50 grid of gray squares. When a square is clicked, it turns white. Here's a simple way of cutting down render calls a TON:
  • Create an image (PNG or JPG) of your 50 by 50 grid.
  • Render this image as a Sprite instead of 2500 separate squares.
  • When you click, use an algorithm to detect which cell you clicked.
  • Draw a WHITE RECTANGLESHAPE on top of the grid with the width and height of one cell at the position of the cell clicked.

13
Thanks! These forums are very helpful :). I think I may just go with the installer idea, because that way thhe app will be set up with the version of SFML that is suitable for that system.

14
Thanks!  :) Just one more question:
How do I statically link SFML libraries? I Googled it, but nothing was very useful. Also, does "usually in managers like apt-get, this is done automatically" mean I don't need to statically link them?
I'm considering having an installer shell script that will just install SFML on to the user device and set up the executable, so that's a fine backup plan :)

15
I have a Chromebook on which I'm running Linux. I installed SFML via apt-get, and no new files appeared (as is normal with apt-get?) I compile my app, and it runs. But if I distribute the executable, will it run on other devices without having to install SFML on that device?
I'm using GCC to compile.

Pages: [1]
anything