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

Pages: 1 ... 4 5 [6]
76
General discussions / have fast moving sprites without distortion?
« on: October 27, 2011, 09:09:40 pm »
Quote from: "Disch"

Code: [Select]

      x += force_x * mainRenderWindow.GetFrameTime();
      y += force_y * mainRenderWindow.GetFrameTime();



This technique is something like Euler's Integration. If you try to implement Runge-Kutta4 (RK4) technique, maybe it can be solved.

Personally I think that it does not have at all that see. It's only a different idea.

77
Graphics / problem with map -> matrix size
« on: October 19, 2011, 11:26:41 pm »
Sorry but I can't understand what are you trying to solve. If you load an image, it'll be drawn with its original size.
Anyway you can change the image size, using resizing or scaling functions.

Code: [Select]
no code for this..


Note that there are very good programmers here, and be sure that all of them easily would be able to develop any kind of game. So don't be afraid of showing a piece of code if you want some useful help.

We all want to help everybody.  :wink:

78
Graphics / [SOLVED] Static sf::Image and sf::Sprite?
« on: October 18, 2011, 11:35:59 pm »
You also should declare the static members outside the class.

Foo.cpp
Code: [Select]
sf::Image Foo::image;
sf::Sprite Foo::sprite;

79
Window / What's wrong with frame time in SFML 2?
« on: October 16, 2011, 11:44:18 pm »
Yes, you're right. Thats why I ported it from SFML 1.6, where the result is in seconds. That was what I didn't know.

Thanks anyway ;)

80
Window / What's wrong with frame time in SFML 2?
« on: October 16, 2011, 02:00:06 pm »
Thanks all of you, all my doubts solved :)

81
Window / What's wrong with frame time in SFML 2?
« on: October 15, 2011, 12:02:35 pm »
Quote from: "OniLink10"
Frametime is measured in milliseconds, so that's correct. Also, which way are the rectangles rotating when given a positive angle? Clockwise or counterclockwise?

Clockwise, I mean, when I set the orientation positive it turns clockwisse. Otherwise when I set it negative, it turns counterclockwise.
Quote from: "bananu7"

The screen should flash red every second, when running 60 fps. If it's at lower rate, your code is running slower, so it may not be the case with sf::Timer - rather than that, something makes renderer to go too slow.

If @up is right and it's in fact in miliseconds, it's ok : 1/0.016 = 60.

I've done it again, and yes, screen flashes every second (more or less). But, with GetFrameTime() method I get the same thing.

To be sure I've simulated a body's movement with euler integration, I activated the vsync and simulated the body with 0.016 of delta-time and it goes well. It means that the game is running at 60 fps. But again, I get those strange values.

Edit: Okay, I've solved FPS issue. But still remains the orientation problem. Does SFML2 manage the orientation differently according to SFML1.6?

82
Window / What's wrong with frame time in SFML 2?
« on: October 15, 2011, 01:23:41 am »
I get a the color change at a low rate. Anyway I realized that not all goes well using SFML 2.
For example, when I rorate a rectangle shape it rotates in the opposite direction givin the correct angle.

So I'm thinking that maybe I have not built it correctly.

83
Window / What's wrong with frame time in SFML 2?
« on: October 15, 2011, 12:34:59 am »
Here I am again.

This time I'm trying to manage de framerate and frametime as well. I used the code pasted in the documentation of SFML 2, but something is wrong.

Code: [Select]
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <stdio.h>

 int main()
 {
     // Create the main window
     sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

    window.EnableVerticalSync(true);
    //window.SetFramerateLimit(60);

     // Start the game loop
     while (window.IsOpened())
     {
         // Process events
         sf::Event event;
         while (window.PollEvent(event))
         {
             // Close window : exit
             if (event.Type == sf::Event::Closed)
                 window.Close();
         }

         // Clear screen
         window.Clear();

         // Update the window
         window.Display();
         printf("FPS: %f FRAMETIME: %f\n", (float)(1.f / window.GetFrameTime()), (float)(window.GetFrameTime()));
     }

     return EXIT_SUCCESS;
}


I use this simple program, but I get this in the output:

Code: [Select]
FPS: 0.58824 FRAMETIME: 17.000000
FPS: 0.62500 FRAMETIME: 16.000000
FPS: 0.58824 FRAMETIME: 17.000000
FPS: 0.58824 FRAMETIME: 17.000000
FPS: 0.62500 FRAMETIME: 16.000000
...


I get strange values instead of a framerate around 60 and its respective frametime. Using SFML 1.6 all goes well.

Hope that there is a reason. Thanks.

84
Window / SFML 2 Events
« on: October 14, 2011, 04:14:25 pm »
I've always used SFML 1.6, but I recently started with SFML2. After compiling and building it, I'm trying to port my project to SFML2 but I have problems with events.

I would like to know wich is the equivalent of sf::Input class on SFML2, I want to check if a certain key is pressed at any time in the game.

Thanks.

85
General / Operator overloading
« on: September 23, 2011, 04:54:02 pm »
Thank you about all this information and advices, I've solved all my problems.

86
General / Operator overloading
« on: September 23, 2011, 03:13:38 pm »
Hi, i'm trying to design a small physics-engine. I've been coding a Vector and a Entity class, but I get always the same error in the Entity class. Vector class compiles without any error.

Code: [Select]
/home/julen/Proyectos/soccer/physic/Entity.cpp||In member function ‘void Entity::applyForce(Vector2D&, Vector2D&)’:|
/home/julen/Proyectos/soccer/physic/Entity.cpp|32|error: no matching function for call to ‘Vector2D::Vector2D(Vector2D)’|
/home/julen/Proyectos/soccer/physic/Vector2D.h|20|note: candidates are: Vector2D::Vector2D(float, float)|
/home/julen/Proyectos/soccer/physic/Vector2D.h|19|note:                 Vector2D::Vector2D(Vector2D&)|
/home/julen/Proyectos/soccer/physic/Vector2D.h|18|note:                 Vector2D::Vector2D()|


And here is my code:

Vector2D class:
Code: [Select]

/* Constructors */
Vector2D::Vector2D()
{
    reset();
}
Vector2D::Vector2D(Vector2D & vector)
{
    m_elements[0] = vector[0];
    m_elements[1] = vector[1];
}
Vector2D::Vector2D(float x, float y)
{
    m_elements[0] = x;
    m_elements[1] = y;
}
Vector2D::~Vector2D()
{
    reset();
}
...
Vector2D & Vector2D::operator = (Vector2D & vector)
{
    setVector(vector);
    return *this;
}
...
Vector2D & Vector2D::operator += (Vector2D & vector)
{
    m_elements[0] += vector[0];
    m_elements[1] += vector[1];
    return *this;
}
...
Vector2D Vector2D::operator + (Vector2D & vector)
{
    Vector2D v(m_elements[0] + vector[0], m_elements[1] + vector[1]);
    return v;
}
Vector2D Vector2D::operator - (Vector2D & vector)
{
    Vector2D v(m_elements[0] - vector[0], m_elements[1] - vector[1]);
    return v;
}
...


Entity class:

Code: [Select]
...
void Entity::applyForce(Vector2D & force, Vector2D & pointOfContact)
{
    m_totalForce += force;
    Vector2D arm = pointOfContact - m_centerOfMass; //HERE I GET THE ERROR
    m_totalTorque += arm.perpDotProduct(force);
}
...


Hope someone can help me.
Thanks.

87
Graphics / Rendertarget - sf::text
« on: February 01, 2011, 06:36:15 pm »
Default color of a Drawable is White(255, 255, 255).
Try to change it with
Code: [Select]
text.SetColor( sf::Color(0, 0, 0) );

88
Window / Fullscreen Stopped Stretching?
« on: September 04, 2009, 10:35:06 pm »
It depends of your graphic card configuration. With an ATI for example you can change that on the control panel.  :wink:

89
General discussions / SFML 2.0
« on: August 14, 2009, 11:59:31 am »
Soldat is a free 2D shooter game online. The maps are done with textured polygons.
Its a good idea if you want to use polygon collisions.

Pages: 1 ... 4 5 [6]