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

Pages: 1 [2] 3
16
For example, I have 2 sampler2D and mix() them in the shader. How do I solve this? ( in sfml standard functions obviously )

17
I was aware of that setUniform stuff too. I used them before entering my game loop to set the sampler2Ds.
But when mixing with my custom OpenGL code, the doc says:
sf::Texture t1, t2;
...
sf::Texture::bind(&t1);
// draw OpenGL stuff that use t1...
sf::Texture::bind(&t2);
// draw OpenGL stuff that use t2...
sf::Texture::bind(NULL);
// draw OpenGL stuff that use no texture...
 But what if my OpenGL stuff uses t1 and t2? It seems that t1 is unbinded if I bind t2.

18
Graphics / How do you bind multiple textures to the same shader?
« on: May 24, 2018, 01:03:44 am »
I am aware of
sf::Texture::bind(&texture_here);
but what if my shader requires more than 1 texture?

19
SFML projects / Re: Random game
« on: February 16, 2018, 09:52:11 pm »
When I did this I made it 1000 by 800 for no reason. It’s possible to retrieve for example the monitor’s width and height and make all other parameters in function of them, or just the width and multiply by 0.75 to get a good height and get the proportion you want (800/600). It may be confusing for someone who didn’t write the code to adapt all the parameters that would need to be adapted, but you can try if you want  ;)

20
SFML projects / Re: Flappy-Bird Clone Attempt
« on: February 11, 2018, 02:40:52 am »
Since then I downloaded Visual Studio Community 2015 (for free, easy to find online) and I managed to set it up. Then I downloaded this sfml one: Visual C++ 14 (2015) - 32-bit on https://www.sfml-dev.org/download/sfml/2.4.2/, then do this on the project properties:
1) in C/C++ >> General (All Configurations) >> Additional Include Directories, copy and paste where your sfml include folder is, in my case, E:\SFML-2.4.2\include
2) then on Linker >> General >> Additional Library Directories, put your sfml lib folder, in my case E:\SFML-2.4.2\lib
3) then select Debug (save what you just did), go to Linker >> Input >> Additional Dependencies >> Edit  and copy and paste those  (1 in each line, or add ; between them if you use 1 line):
sfml-graphics-d.lib
sfml-audio-d.lib
sfml-network-d.lib
sfml-window-d.lib
sfml-system-d.lib
4) then select Release (save what you just did), go to Linker >> Input >> Additional Dependencies >> Edit
and copy and paste those (1 in each line, or add ; between them  if you use 1 line):
sfml-graphics.lib
sfml-audio.lib
sfml-network.lib
sfml-window.lib
sfml-system.lib

Now to link dynamically,
5) Go to where you downloaded SFML and copy everything inside the bin folder (all the dlls files) and paste them inside your project debug folder. Let me explain this: if your project is called NAME, inside your folder NAME you have a Debug folder and another NAME folder (that's standard, you can change that if you want). Paste them inside the Debug folder. (You can paste them inside the NAME folder, but I don't suggest that, because that way you will have to compile and run it every time, instead of just using the .exe file located inside the Debug folder.)
6) Test if it works with the code given in SFML tutorials. (Please tell me if it works).

21
SFML projects / Random game
« on: February 01, 2018, 09:52:49 pm »
Messing up with angles in SFML. Inspired in Arkanoid.

https://github.com/Powereleven/Bounce-game

22
SFML projects / Re: Flappy-Bird Clone Attempt
« on: January 31, 2018, 06:47:03 pm »
Did you do this? Or used SFML_STATIC like Zinidane said
(Screenshot attached)

23
SFML projects / Re: Flappy-Bird Clone Attempt
« on: January 31, 2018, 06:33:00 pm »
On the same folder where you have all the files (Bird.h, Bird.cpp for example) you have to create another folder called fonts and put there arial.ttf (that's because I called sf::Font font; font.loadFromFile("fonts/arial.ttf") . You can download this font from GitHub where you got the other files. Same thing for the images. I call t.loadFromFile("images/bird.png"); for example, so you have to have a folder "images" with all the 4 images in there. I also used a folder sounds, with all sounds in there, but I don't know how you download sounds from GitHub, so if you can't manage to download them, it should be fine, because they are not a must to run the program. If you don't have the sounds folder with the sounds in there, it should just pop up 3 error messages in the console"Failed to ... ". I attach the screenshots. Do you have all the .dll sfml files in the same folder as in the screenshot below?

24
General / When to use {} () in constructors
« on: January 29, 2018, 06:18:23 am »
I have in Game.h a class Game. In private: sf::RenderWindow app;
Then in Game.cpp I use:
Game::Game() : app({1000,800},"NAME")
{
}
The syntax
Game::Game() : app(sf::VideoMode(1000,800),"NAME")
{
}
also works.
My question is: why can you omit sf::VideoMode in the first case, and if you do so, why do you HAVE to use {} for the videomode parameters? Using () In the first case results in an error.

25
SFML projects / Re: Flappy-Bird Clone Attempt
« on: January 29, 2018, 06:11:34 am »
I use CodeBlocks because it's free. I followed this video to set it up:

But if you use the codeblocks link he put in the description you will get errors because codeblocks is now in version 17.12 and for some reason the loadFromFile didn't work for me (that was a few weeks ago). So you have to download the 16.01 version:
https://sourceforge.net/projects/codeblocks/files/Binaries/16.01/Windows/
Using codeblocks 16.01, SFML 2.4.2 and following this tutorial it worked for me. Good luck, make sure to download the correct codeblocks (as I recall, the codeblocks-16.01mingw-setup.exe one)
PS: I am a newbie at settings up IDEs and libraries and there are definitely other ways, I am just saying how I got it working for me.


26
General / Re: Should you call events by reference?
« on: January 28, 2018, 08:13:40 pm »
Is it common to have parameters sf::Event &e or people use a different technique?

27
General / Re: Should you call events by reference?
« on: January 28, 2018, 07:55:18 pm »
So in the event object, in practice, it makes to no difference because the event is called inside the function and dies there (for example I tested with a mouse click triggering app.close). But which one should I use?

28
General / Re: Should you call events by reference?
« on: January 28, 2018, 07:51:58 pm »
I believe render window needs a reference so that when the function scope ends the alterations don't die there, because the & was used so the modifications were done to the object itself instead of a copy right?

29
General / Should you call events by reference?
« on: January 28, 2018, 07:32:39 pm »
I was testing a button function that its implementations are not the subject of this post. It basically just calls the pollEvent and does something. the RenderWindow parameter must have the & to work, but the event parameter works with both (by reference and by value). Which one is preferable and why?

void button(sf::RenderWindow &app, sf::Event &e)
{
}

or

void button(sf::RenderWindow &app, sf::Event e)
{
}

30
Graphics / Re: Views
« on: January 27, 2018, 09:06:49 pm »
I know that without the sufix f the float is converted to a double. But is there a good reason to add the f sufix besides insignificant performance improvement? Also, why does C++ converts automatically floats to doubles if you don't add the f sufix, but does not convert int to floats, for example?

Pages: 1 [2] 3
anything