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

Pages: [1] 2
1
Window / Re: Question About Changing Window Size
« on: April 19, 2016, 06:29:49 am »
Ahh, thank you. My mistake. I was looking through http://www.sfml-dev.org/documentation/2.0/classsf_1_1Window.php and the RectangleShape page as well.

2
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!

3
General discussions / Re: Question In Regards to Crediting SFML
« on: April 16, 2016, 04:55:02 am »
Okay, I want to give credit; I just don't want to run into any trouble later down the road  ;)

Thanks. People will see that my project was made with SFML ;)

4
General discussions / Re: Question In Regards to Crediting SFML
« on: April 16, 2016, 01:05:39 am »
So if it is not the source code, simply saying in the opening credits or something "Made with SFML and corresponding dependencies" works? Won't run into any trouble?

Thanks for the responses by the way guys.

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

6
General / Re: SFML Linking
« on: October 28, 2015, 04:53:41 pm »
If you had read the tutorial, you would have seen that it explicitly states that you need to link all of the dependencies that you are using... And it gives you a list of which dependencies go with which module...

7
@gambit
I know but I think that's what the OP was trying to say..

@SeriousITGuy
I'm aware of that but as I said above, that could be what the OP was trying to say.

8
The SFML static libraries on the download were compiled with dynamic CRT libraries so they DO NOT work with /MT or /MTd ... In order to get the SFML static libs working with static CRT, you need to recompile SFML on your own. :P

Let me correct myself... the SFML 2.3.2 static libraries for VS2015 do not work with static CRT. If you want static SFML and static CRT, you need to recompile SFML on your own.

9
General / Re: Waiting for a Key
« on: October 07, 2015, 03:37:00 am »
Yeah, so when a button is hit it essentially clears the variable and then when a battle starts, it creates a variable saying that a battle took place and if that variable isn't 0 then it won't run the battle sequence again

10
General / Re: Waiting for a Key
« on: October 07, 2015, 01:20:26 am »
I understand the first part but what I'm saying is that like... I don't want a battle to occur again on that tile again immediately after that battle. So if the character moves left and then back right, that tile can generate another battle. I'm just having trouble thinking about how to mark that tile for that single turn if that makes sense?

11
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?

12
Graphics / Re: Moving Map Centered Around Player
« on: October 06, 2015, 08:22:02 pm »
I see where my error is but I'm struggling to fix it. My error is drawing my actual player block. How can I set it in relation to the screen to always be in the middle? Set it to be a constant position in the middle?


Scratch that. Solved my issue. I merely set the player block to a set position in the center of my screen. :)

13
Graphics / Re: Moving Map Centered Around Player
« on: October 06, 2015, 08:15:18 pm »
Okay, I have a set tilemap that's like [13][21] (it's a vector so subject to change).

Screen size is 240,240 pixels.

Each tile is 20x20 . Thus allowing me to draw 5 blocks to the left and the right of my player.

What I'm trying to do is have the screen ONLY draw the 5 blocks to the left,right,above, and below my player block.

I have it drawing the map to the specifications I want, but the problem I'm having is my player block isn't moving 1 tile over at a time.

I can post a link to the code if you wish to see exactly what I'm doing and run it.

As I said, the sole problem i'm having right now is having the character block move only 1 tile at a time.

Link to the code:
http://hostcode.sourceforge.net/view/3499

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

15
General / Re: Need Help From Someone Experienced with SFML
« on: October 04, 2015, 02:45:47 am »
In all honesty, I'm going to keep my original text game, start a new project, copy over the classes and other things and then simply see if I can build a 2D map using SFML.. I'm fairly new to C++ but I understand a lot of the concepts already. This is the first actual thing I've made that's interesting so. :P Thanks for the help once again!

Pages: [1] 2