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
Graphics / How do you bind multiple textures to the same shader?
« on: May 24, 2018, 01:03:44 am »
I am aware of
but what if my shader requires more than 1 texture?

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  ;)

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

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

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


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)

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?

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.

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

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?

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?

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?

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)


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

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?

Graphics / Views
« on: January 27, 2018, 03:26:47 am »
Quick question: on the view topic there is this line:
view.setViewport(sf::FloatRect(0.25f, 0.25, 0.5f, 0.5f));
why didn't the writer use the sufix f in the second parameter and used in the other 3?

SFML projects / Re: Flappy-Bird Clone Attempt
« on: January 27, 2018, 02:29:10 am »
1) To be honest I don't know if I should call the app object (of type RenderWindow) on the function or the constructor. I still didn't learn to handle multiple views (intend to read that tutorial in the future, (it wasn't necessary for this project)), but I imagine that if the same object has to be used on two views, I should call it on the draw function so I can specify on which one right? (If that was a terrible assumption, sorry :P)
2) A Game Class is a good idea, but I thought this project was too small to deserve another class   ;D

Pages: 1 [2] 3