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

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

3
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?

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

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

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

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

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

9
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 :)

10
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]