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

Pages: [1]
1
General / SFML for Visual Studio 2013?
« on: November 30, 2014, 05:36:23 pm »
Hey, I tried to include SFML in VS 2013 Professional but I got a lot of errors there.

Am I just too stupid to configure SFML correctly there or is VS 2013 really incompatible with SFML (I use the SFML version for VS 2012 because I couldn't find a version for VS 2013)

In VS 2012 I do the same steps and there it works.

Thanks

2
Graphics / Circular segment
« on: July 08, 2014, 09:30:15 pm »
Hey,

I wanna create a replay button with the functions of the SFML. I think, everyone knows how it looks like. (Round arrow)

So I've created a CircleShape, made the FillColor transparent and the OutLine colored.
But then I got a problem, the circle is still a full circle and not a segment (On the end of the segment I create the triangle of the arrow).

Is there any function which can help me?

Thanks - and sorry for my bad English :D
5gum

PS: What's your bet for Brasil vs Germany today? I think 2:1 for GER after extra time  ;D

3
Graphics / Paths and automatically driving cars (GTA style)
« on: May 12, 2014, 02:37:26 pm »
Hey guys,

I don't know, how I should phrase this but I try it  ;D
I develop a copy of GTA I, so with 2D graphics. Well, now I want to create the feature that there are automatically spawned cars on the map and they drive on the street. I've already a 2D map with some streets and the vehicle sprites.

What's the best way to do this? Unfortunately, there isn't anything such as paths in SFML, isn't it?

Thanks for answers,
5gum

4
General / sf::Event -> mouse wheel?!
« on: January 16, 2014, 10:45:15 pm »
Hey guys, it's me again ;D

In the SFML, there is stuff I unterstand really good.
In the SFML, there is stuff I understand a little bit.
But in the SFML, there is also stuff I really don't unterstand. And this stuff is called sf::Event...

I've got a map and sf::view. If I scroll up the mouse wheel the map should zoom in and vice versa (Sry, my English could be bad ::)). I tried it with:

while(window.pollEvent(event))
{
  if(event.mouseWheel.delta == 1)
  {
    view.zoom(0.9f);
  }
}

Yeah, it works!
But what unfortunately also works is if I click right mouse button and if I release right mouse button the view also zooms in.

I tried it with:

 if(event.mouseWheel.delta == 1 && !sf::Mouse::isButtonPressed(sf::Mouse::Button::Right))
  {
    view.zoom(0.9f);
  }


Now it "just" zoom in if I release the right mouse button.
But I don't want that the view zooms after right relase, only after wheel...
What I have to do?

Thanks a lot,

5gum

PS: I try your ideas only tomorrow afternoon cause I'm tired of programming today ;)

5
General / Set fixed sprite position when sf::View is active?
« on: January 16, 2014, 03:23:21 pm »
Hey guys,

I prog a game and use sf::view for the map. But now I want something like a header for general information (money...) which is always on the top of the screen. With setPoistion(10,10) the sprite is just on the top of the map, not of the screen...

So what I have to do?

Thanks a lot,
5gum

6
General / Change a Sprite in a function?
« on: December 07, 2013, 11:48:27 pm »
Hey,

I wrote a function similar like:

int more(sf::Sprite rect)
{
  if(sf::Keyboard::isKeyPresed(sf::Keyboard::Up))
  {
    rect.scale(1.1,1.1)
    return 1;
  }
return 0;
}

(...)

int return = more(rect);
 

But now my rectangle doesn't change.  I think this is because you can return only 1 value (here it is the int). Is there any simple solution for my problem? Sry, I'm a beginner ;)
Don't say "Why you need a function for that", the real function is much bigger...

Thanks,
5gum

7
Graphics / Moving a sprite to a clicked point?
« on: December 04, 2013, 05:16:03 pm »
Hey,
Is it possible to move a sprite to a clicked position?
So not only set a new position of the sprite but really move it with "animation".
Currently I've just a line from the center of the sprite to the clicked point. Maybe it can help, maybe not...
Or is there already a simple command in SFML and I just don't know it?

I'm beginner in SFML so please don't be too strict and if it's possible tell me a simple solution ;)

Thanks,
5gum

8
General / Variable Sprite? Maybe an Array?
« on: November 26, 2013, 06:43:25 pm »
Hey guys,
I'm beginner in SFML so please don't be too strict ;)

If I press the right Key for example, a sprite moves.

vehicle.move(speed,0);
 

Nothing special.
But now I want to create a new Sprite and according to which sprite I choose (by mouse click), I want that the correct sprite moves. To see which sprite was taken I've got a simple variable (int choose=0 if sprite 1 was taken and choose=1 if sprite 2 was taken).

The easiest way to find out which sprite should be moved is

if(choose==0)
{
...
}

if(choose==1)
{
...
}
 


But in that codes would stand exactly the same. That's not really effective. So can I create a sprite like

sf::Sprite vehicle[2](vehicle1,vehicle2)
...
vehicle[choose].move(speed,0)
 

Sorry, I know the code is wrong, I'm not really good at using arrays.
Or is there any other simple solution?

Thanks,
5gum

9
Graphics / setTextureRect - other direction
« on: November 19, 2013, 12:40:18 pm »
Hey,
I'm a beginner in SFML so please don't be too strict.

I painted a simple rect (Size:20*60px) and included it in my program.
Now I want that the y-position of the rect gets smaller every frame (Like a loading bar).

I tried it with

rect_timer = 0;

while(window.isOpen())
{
rect_timer += 0.1;
rect.setTextureRect(sf::IntRect(0,rect_timer,20,60-rect_timer));
}
 

But the result was, that my rect moves in the wrong direction, so the lowest part dissapeared at first but I want that the toppest part dissapeares at first.

How can I do that?

Thanks, 5gum

10
General / Acceleration of a Sprite?
« on: November 11, 2013, 10:21:40 pm »
Hello, it's me again,

at first: Sorry for my bad English, I usually speak German so please answer in "Simple English" if it's possible ;)
Second: I began SFML yesterday so... yeah I'm a beginner ;D

Here I show you a code of a little program from me:

#include <iostream>
#include <SFML\Graphics.hpp>

int main()
{
        sf::RenderWindow mMainWindow(sf::VideoMode(800,600,32),"Test",sf::Style::Titlebar);
        sf::Event mMainEvent;

        sf::Image car;
        car.loadFromFile("car.png");
        car.createMaskFromColor(sf::Color::White);

        sf::Texture tCar;
        tCar.loadFromImage(car);

        sf::Sprite sCar(tCar);

        while(mMainWindow.isOpen())
        {

                while(mMainWindow.pollEvent(mMainEvent))
                {
                        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                                mMainWindow.close();
                }

                if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
                {
                        sCar.move(1,0);
                }

                mMainWindow.clear();
                mMainWindow.draw(sCar);
                mMainWindow.display();
        }

        system("pause");
}

I've got a sprite and if I press the Right-Key it moves to the right 1 pixel every frame. Nothing special.
But now I want that when I pressed the Key e.g. 0.5 seconds, my Sprite moves faster.
sCar.move(3,0);
for example...
So I want something like an acceleration for the sprite. I tried it with
sf::Clock timer;
but if I write that out from the "Keypress-Loop" the timer works always and if I write it in the loop the timer reset every frame.

Is there any solution for that problem or am I just a little bit dumb?
Please don't be too strict because of my English and my knowledge about SFML.

Thanks,

5gum

[edit]If I've got big missktakes in English grammar, please tell that :)[/edit]


11
General / SFML 2.1 Randomizer?
« on: November 11, 2013, 03:16:09 pm »
Hello guys,
at first: Sorry for my bad English, I usally speak German but I hope you will understand me. (My question is for your luck very short ;D)

I've got 2.1 and I'm looking for something like the Randomizer in 1.6. but I can't find any similar function. Is there any random function in SFML available?

Thanks for answers

5gum

Pages: [1]