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

Pages: 1 [2] 3 4 ... 14
16
Graphics / Re: Question about drawing tilemaps off-screen
« on: May 01, 2018, 08:23:01 am »
Why do you want to draw anything off-screen? This just consumes unnecessary resources. Imagine drawing an infinite map, it would take you an infinite amount of time to do that.

Try to draw only those tiles (and other objects), which are visible to your view. For small games this is not so important, because your computer can probably handle it, but for your scale this doesn't apply anymore.

For that you want to calculate which tiles are visible and recreate the vertex array with them every frame.
You also don't want to store every tile, just the ones nearby. (take a look at chunks)

As for how to generate your map: it depends on what type of map you want to make. There are many examples for various types of maps online. Perlin Noise is often used for that. Simplex Noise, Voronoi Map, etc...

To draw your infinite map: you load (or generate) only nearby tiles (chunks) and draw just the visible ones from those on screen.

17
Oh I get it now, good points.
Thank you for clarifying and sorry for bringing this up again  ::)

18
Hey,
So I found this old post and asked OP's question myself as I was working on an interface.

From an even older post:
The two functions exist only for convenience and not all of the transformable would need those functions.

@eXpl0it3r: I assume you meant user-defined transformables by that?
Because all derived classes from SFML implement both of them, as far as I can see.

Sure, not every new class would need those, but isn't that also true for scaling, rotating, etc...?
Just because something may not be used does not mean it is useless, especially in this case and be it only for convenience.

I don't see the reason in not providing them in sf::Transformable with returning a FloatRect() by default and letting them override in derived classes if desired.
Yes it has no size -> so it has a zero area rect, right? At least it should not matter.

That being said, it is not really a problem, you can always implement them yourself ofc, I just asked out of curiousity as I only agree partly with the already provided explanations.

19
General / Re: SFML Pixel Perfect Collision limited to a view?
« on: April 27, 2018, 08:30:31 am »
How can I make the collision detection independent of the view?
Collision detection is independent of the view, because the transformations of your objects don't change, you just view them from different perspectives. (So you are still technically colliding in your second example, but you don't see it)

To quote the tutorials: (which you should read and understand)
Quote
The world itself remains unchanged, what changes is just the way it is seen.

What are you trying to achieve anyways? If you just want the wall to be twice as big, why don't you scale it by that factor then?

20
General / Re: Views setcenter vs rotation problem
« on: April 26, 2018, 11:59:16 am »
I am not sure if you intent to make a split-screen, in which case following the great tutorial will give you something like this:
(click to show/hide)

Otherwise there is also the option to draw your stuff onto a RenderTexture, rotating and drawing the resulting sprite onto your window, which will lead to something like this:
(click to show/hide)

Maybe that helps.

21
Graphics / Re: Add vertices to a vector
« on: April 24, 2018, 04:29:26 am »
A good place to start would be the tutorials.
You should also read a good book for improving your C++ knowledge.

22
General / Re: Fire Bullet At Angle
« on: April 23, 2018, 01:35:49 pm »
Just for your info: you can calculate pi with
const double pi = atan(1) * 4;

23
General / Re: Fire Bullet At Angle
« on: April 22, 2018, 11:29:28 pm »
rotation = atan2(dy, dx) * 180 / PI;
should just be:
rotation = atan2(dy, dx);
atan2 already gives you radians.  ;)

24
Graphics / Re: sf::text and vectors help
« on: April 20, 2018, 04:47:22 pm »
Well, as Arcade already said, you can just add (push_back) your new texts later on.
Or you could re-create your vector once you know how many elements you need.

Just follow the recommendation, read up on std::vector and you will find everything you need to know.

25
Graphics / Re: sf::text and vectors help
« on: April 20, 2018, 04:02:38 pm »
Welcome to the forums!

So what do you mean by "get the vector to work"?

You already construct a vector with vector_no many elements and this vector can grow/shrink dynamically.
I don't see a problem there...

26
General / Re: Why will some sprites not been drawed?
« on: April 19, 2018, 12:07:20 am »
Because you copy your sprites inside both for loops, use auto& instead.

27
Graphics / Re: Blinking screen when using massive view.move ?
« on: August 13, 2015, 11:35:09 am »
Despite the code being far from minimal, it is also incomplete. In BackgroundTileMap::WriteToFile you forgot the return statement and tileset_castle.png is missing.

However I took a quick look and could find the problem for your blinking:
Line 133 in main.cpp -> wheelPos = window.mapPixelToCoords(sf::Mouse::getPosition(window));

That should be removed, because you should only set the reference position once you press the middle mouse button, otherwise the program uses the destination position as the new reference position, going back and forth everytime you move, which results in your blinking.

You also have a ton of C type casts, even on things that are already the desired type (like in line 131, main.cpp). Use static_cast instead where needed. I am not here to judge the code, but that was an eye catcher.

28
General discussions / Re: Building SFML for Visual Studio 2015
« on: August 12, 2015, 04:21:44 pm »
Hmm, that's odd, the code works for me. Not sure what the problem is tbh.

29
General discussions / Re: Building SFML for Visual Studio 2015
« on: August 12, 2015, 02:28:32 pm »
If you did not change anything from VS and did not build anything yourself (also not the extlibs) it should work just fine, as I tried it with a fresh installation of VS2015 and the 32 bit nightly builds for VS2015RC. Just added the paths for the include and lib folders, plus the linker dependecies as explained in the tutorials, and it worked perfectly.

30
Graphics / Re: Blinking screen when using massive view.move ?
« on: August 11, 2015, 09:19:50 am »
If you followed the link in Hapax' post, you would see that complete and minimal means others can copy/paste at best one single main file, without other dependencies (if not related to the problem), to test it themselves. So the code in your 1st post is not very helpful. Read the link.

Pages: 1 [2] 3 4 ... 14
anything