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.


Topics - DuvnjakA

Pages: [1]
1
Window / Question About Changing Window Size
« on: April 19, 2016, 06:04:59 am »
So, essentially, I'm creating a window that is (800,450) in size. Based on a boolean, I set the window equal to the desktop's resolution or keep it its current size. Afterwards, I create a rectangle that is (450,225) in size (1/4 of the window) and place it in the top left corner. However, when I use window.setSize(xxx,yyy), the rectangle shape I create gets resized with the window (even though I resize the window before creating the rectangle shape).

I can provide an example, but I've been looking through the documentation but I can't seem to figure out why resizing the window before the shape is created and/or drawn would resize the shape to still be 1/4 of the window. I've tried it with at least 10 different variations of screen sizes by simply inputting window sizes to the window.setSize() function and each time it results in the rectangleshape being resized with the window.

Any explanations? Or am I missing something that these functions do? The only explanation I can come up with is that setSize() doesn't change the actual number of pixels in the window; rather, it simply enlarges the window to a set size. I tried this with the window created as (0,0) then resized it to (800,450), and the window appeared with no shape at all.

Thanks in advance!

2
General discussions / Question In Regards to Crediting SFML
« on: April 15, 2016, 08:40:03 pm »
The gist of the question is basically:
I see SFML doesn't require credit given but I'll give it nonetheless (for making life easier), but how do SFML's dependencies work with this? Do they require me to cite the project in a specific way or?

Thanks in advance. I looked through a few of the licenses for some of the projects but I couldn't seem to find the clear cut answer as to how they specifically require citation if they require it at all.

3
General / Waiting for a Key
« on: October 06, 2015, 08:30:32 pm »
I've done some research through the forums and google and I've been unable to find much about the topic.

Essentially, the type of thing I'm trying to do is draw a tilemap of x,y. Some tiles will be basic grass, others will be walls, and the third type of tile will be a "battle tile". I'm going to use a
int battle = rand () % 100;
and take if (battle >=90)
DrawBattleSequence();

the one problem i'm finding with this, and with the constant frame refresh of SFML windows is that if I do this type of method, as soon as the battle is over, the window will begin refreshing and realize the character is on a battle tile and start calculating whether to go to the battle sequence or not. How could I set this to essentially force the program to wait for a move after the battle sequence? If you're having trouble imagining what I'm trying to do, think Pokemon. You get into a battle and regardless of how long you stand in that tilespot after the battle, you WILL NOT get into another battle.

As I said, I've been trying to research this but I can't seem to come up with anything. Anybody have any ideas or things I could do to achieve my desired outcome of the window waiting for a move after the battle sequence?

4
Graphics / Moving Map Centered Around Player [Solved]
« on: October 06, 2015, 07:58:43 pm »
int y = playerPosition.y;
         int x = playerPosition.x;

         for (int i = y - 5; i < y + 5; i++)
            for (int j = y - 5; j < y + 5; j++)
            {
               switch (MainMap[j])
               {
               case 0:
                  zeros.setPosition({ j * 20.f, i * 20.f });
                  window.draw(zeros);
                  break;
               case 1:
                  ones.setPosition({ j * 20.f, i * 20.f });
                  window.draw(ones);
                  break;
               case 2:
                  twos.setPosition({ j * 20.f, i * 20.f });
                  window.draw(twos);
                  break;
               }
            }
         player.setPosition({ playerPosition.x * 20.f, playerPosition.y * 20.f });
         window.draw(player);

Would this be a correct way to approach this? My "Map" has 5 "walls" on each side (top, bottom, left, right) so that there will always be a drawing on the left,right,top,bottom regardless of where the player should be.
However, when I run this with the rest of my code, I get a small map that isn't centered around the player. I'm trying to figure out how to get the player centered all the time so that the map essentially follows the player. Does that make sense?
As I was saying, I get a strange map that has some pieces appearing and disappearing at different points where the player ball just moves around wherever with some strange limitations.

5
General / Need Help From Someone Experienced with SFML
« on: October 04, 2015, 02:02:44 am »
Basically, my situation is this. I have created a small game (an image of the screen is down at the bottom). It's entirely text-based; I used a 2D array to create the map and I created the boundaries and everything using simply cin && cout options. By the way, it runs on C++. I was wondering if there is anyone who could help me, rather than create an entire new game, merely replace the map I have created with actual images (let's say brown for a wall, green for grass, etc.). I'm not trying to build an entirely new game, I merely want to replace my text-drawn map with an actual 2D image.

Pages: [1]
anything