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

Pages: [1]
1
General / Re: Overlapping windows/menus
« on: November 13, 2015, 11:52:08 am »
Thanks for all the input, I had a busy week last week, but today I found some time to implent it. I did it as follows, if you ahve any tips/advice on my code, please share :) Tho it is not done yet and there is some debug stuff in there aswell, the colors that are filled from id and stuff. Later I will try to use a nice texture for the borders/titlebar aswell.

The basic idea is, every ui is on a panel. The panels are in a ui_manager, which handles all the events.

ui_manager, so the game_state has nothing to do with ui stuff, it just has a instance of the manager:
(click to show/hide)

This is the panel class, every ui is basically on a panel

(click to show/hide)

And this is how I call/init it, not this is just a copy paste of usefull code

(click to show/hide)

Note that the classes are not yet done, I acn think of some optimaztions and stuff, but the general idae is there.

2
General / Overlapping windows/menus
« on: November 07, 2015, 10:48:02 am »
Hi,

I am creating a 2d platformers and it is possible for the user that there are 2 or even more menus on top of each other. I do have a ui_manager class, that handles cthe mouse and keyboard input. Though what would be the best strategy if I the user clicks on a menu that has a menu behind it. Since I do get a click event with x,y. In my current code it will be the first menu in the container that does get the event passed to.

Maybe I am missing a relative 'simple' idea, since I can only come up with nasty code.

Gr

3
Network / sf::SocketSelector threadsafe
« on: September 28, 2015, 11:54:25 am »
Hi,

I was wondering if it would be thread safe to call sf::SocketSelector.add(). Since it does not really store objects, but just has a ref to them. I have to do this, cause an extern lib calls a callback function in my server from its own thread, kinda annoying but ye. If this call would be safe, no need for mutexes and stuff

Gr

4
Graphics / Re: sf::texture questions
« on: November 19, 2014, 04:26:28 pm »
A texture "lives" on the GPU memory, thus its size is limited by your availalbe size, you can query the maximum size with the specific member function.

Since switching between textures has a small overhead, it's best to keep as much as possible on one texture, but keep in mind, that while your GPU might be able to handle big sizes, some older hardware might not.
If you have tons and tons of textures, it's better to load them when needed. Depending on how much RAM you want to use, you can pre-cache some of the images in memory with sf:Image instances, otherwise you can always read directly from the disc.

What do you mean with "non static sf::Textures"?

So if the maximum texture size is 1024x014, I can't have 2 sf::textures which bold hold a images from 1024x1024? What will happen when this occur?

My current game has this, a map with a character in it and monster are walking on the platforms. There could be a second player which has different armor than you. So the map tiles and the character items from yourself are static, but what the other guy has might be completly new.

So it could be that I eventually get more and more textures, would it be worth adding the multiple pictures to a texture, so make new images on runtime or would it be better to have more texture?

5
Graphics / sf::texture questions
« on: November 19, 2014, 03:25:26 pm »
hi,

I am not sure about how a sf::Texture is saved. I read about the max size of a sf::texture, I could image this. but would it possible to have like 10000 sf::textures (just example) or would it better to safe them to a sf::image and then load them to a texture when you need them to draw.

Also for non static sf::textures, would it be usefull to load parts of images to a sf::texture you acutally use so the size becomes 1024x1024 ?


6
General / Re: Drawing a (big) non tiled map
« on: November 15, 2014, 01:27:54 pm »
Either render all the objects individually (not to a render texture), and cull the ones that are outside the screen. This should not be a performance problem if there are not millions of objects to draw; especially not when you can use vertex arrays.

Or, draw the background to multiple render textures, and draw the (probably 4) render textures that are in the player's view to the window.

But if you make the curent view of the player in lets say 4 render textures, you will have to make 1xx render textures for a big map right?

Also when would you use a render texture then if this is not the ebst scenario?

Also a vertex array works only with 1 texture right?

7
General / Drawing a (big) non tiled map
« on: November 15, 2014, 12:27:22 pm »
Hello,

I am currently working on a new game where I would like to make a map, which is not tiled. It is going to be a side scroller with platforms. For a example, something like this : http://www.gamerjargon.net/wp-content/uploads/2012/10/newsupermariobrosu_600x334.png

Anyways, my design at this moment is:
- I have seperate layers, background, first layer, second etc.
- I draw all these layers to a sf::RenderTexture, since the map is static anyways.
- Every time the player moves, I use sf::View to make sure the right part of the RenderTexture is shown

Besides that, if a monster walks or something else non static happen, I draw this after the RenderTexture to my window.

Now I wonder about this design, since I read some things about that aRenderTexture can't be to big? Maybe some of my maps are going to be 3000x3000, would this be a problem? And if so, how could I solve it?

Gr

Pages: [1]