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

Pages: [1]
1
SFML projects / Re: Faster
« on: February 19, 2014, 08:27:20 pm »
Quote
I thought that the sf::Event held a stack of all events processed in the frame. I could be wrong though, I will look back at the tutorials.
No one else mentioned this but you call
Code: [Select]
while( window.pollevent( Event ) ). Each time you call
Code: [Select]
window.pollEvent( Event ) it pops the Event on the top of the queue so by the time the while loop is done you will have only the very last event for
Code: [Select]
ScreenManager::GetInstance().Update(Window, Event);

Quote
bool sf::Window::pollEvent   (   Event &    event   )   
Pop the event on top of the event queue, if any, and return it.

This function is not blocking: if there's no pending event then it will return false and leave event unmodified. Note that more than one event may be present in the event queue, thus you should always call this function in a loop to make sure that you process every pending event.

sf::Event event;
while (window.pollEvent(event))
{
   // process event...
}
Parameters
event   Event to be returned
Returns
True if an event was returned, or false if the event queue was empty
See Also
waitEvent
http://www.sfml-dev.org/documentation/2.1/classsf_1_1Window.php#a338e996585faf82e93069858e3b531b7

2
Graphics / Re: [Beginner] Help with Bouncing Circles
« on: February 15, 2014, 01:34:13 am »
You only need to seed the generator once.

PRNG use the seed as S0. Since a PRNG is just a sequence. I don't know the exact forumas but they are something like: Sn+1 = ( A * Sn + B ) % M; Where A , B , M are given before hand. So for example a generator that looks like:
Sn+1 = ( 10 * Sn + 11 ) % 12 with a seed of 0 it would look like this: ( repeats really fast since I used really small values )

11 , 1 , 9 , 5 , 1 , ...now it is repeating

Most of the PRNG won't repeat for a very long time

3
Graphics / Re: [Beginner] Help with Bouncing Circles
« on: February 14, 2014, 01:20:17 am »
Your link is a bit messed up.

http://sfml-dev.org/documentation/2.1/classsf_1_1Shape.php#a5ad336ad74fc1f567fce3b7e44cf87dc

Quote
void sf::Shape::setOutlineThickness   (   float    thickness   )   
Set the thickness of the shape's outline.

Note that negative values are allowed (so that the outline expands towards the center of the shape), and using zero disables the outline. By default, the outline thickness is 0.

Parameters
thickness   New outline thickness

4
Graphics / Re: [Beginner] Help with Bouncing Circles
« on: February 13, 2014, 08:51:25 pm »
You could also use negative outlines where it goes into the fill.

5
Graphics / Re: [Solved]sf::ConvexShape Problem
« on: February 13, 2014, 08:50:26 pm »
Looks like a pretty cool sfml extension I'll have to give it a try some time.

6
Graphics / Re: sf::ConvexShape Problem
« on: February 13, 2014, 01:58:28 am »
Oh god I was thinking concave was rounded curve in and not anything that goes in major brain fart. Thanks for the help guys and yeah I made a few tetris clones using sf::Rectangle was trying to see if I could try out some other sfml features. I will have to try out the vertex array I haven't used that yet sorry to have wasted time by forgetting what concave was :P

7
Graphics / [Solved]sf::ConvexShape Problem
« on: February 13, 2014, 12:25:51 am »
I am not sure what I am doing wrong.

Here is what I am trying to get:


but I am getting this instead:


The code I have is:

Code: [Select]
    sf::ConvexShape *Temp = new sf::ConvexShape( 6 );
    Temp->setPoint( 0 , sf::Vector2f( 0 , 0 ) );
    Temp->setPoint( 1 , sf::Vector2f( 20 , 0 ) );
    Temp->setPoint( 2 , sf::Vector2f( 20 , 40 ) ); //for some reason its assigning 20 , 30 instead
    Temp->setPoint( 3 , sf::Vector2f( 40 , 40 ) );
    Temp->setPoint( 4 , sf::Vector2f( 40 , 60 ) );
    Temp->setPoint( 5 , sf::Vector2f( 0 , 60 ) );

When I'm saying squares below I'm talking about a 20 x 20 square top right corner
The first point would be 0 squares over and 0 squares down so 0 , 0
The second point would be 1 square over 0 squares down so 20 , 0
The third point would be 1 square over 2 squares down so 20 , 40
The fourth point would be 2 squares over 2 squares down so 40 , 40
The fifth point would be 2 squares over and 3 squares down so 40 , 60
the sixth point would be 0 squares over and 3 squares down so 0 , 60

The point that seems to be getting messed up is the 3rd point it is supposed to be at 20 , 40 but for some reason it looks like it is at 20 , 30. When I output the point though it says it is at 20 , 40 so I am really confused.

Here is complete code:
#include <SFML/Graphics/Shape.hpp>
#include <SFML/Graphics/ConvexShape.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/Event.hpp>
#include <iostream>

class Tetrominio
{
    public:
        Tetrominio( void ){}
        virtual ~Tetrominio( void ){}
        void Draw( sf::RenderWindow &Window ){ Window.draw( *Shape ); }
    protected:
        sf::Shape *Shape;
};

class L : public Tetrominio
{
    public:
        L( void );
        ~L( void );
};

L::L( void )
{

    sf::ConvexShape *Temp = new sf::ConvexShape( 6 );
    Temp->setPoint( 0 , sf::Vector2f( 0 , 0 ) );
    Temp->setPoint( 1 , sf::Vector2f( 20 , 0 ) );
    Temp->setPoint( 2 , sf::Vector2f( 20 , 40 ) );
    Temp->setPoint( 3 , sf::Vector2f( 40 , 40 ) );
    Temp->setPoint( 4 , sf::Vector2f( 40 , 60 ) );
    Temp->setPoint( 5 , sf::Vector2f( 0 , 60 ) );

    std::cout << "Third point: " << Temp->getPoint( 2 ).x << ',' << Temp->getPoint( 2 ).y << std::endl; //testing the point
    Temp->setOrigin( 10 , 50 );

    Temp->setPosition( 320 , 200 );

    Shape = Temp;
}

L::~L( void )
{
    if( Shape )
        delete Shape;
}

int main()
{
    const int Width = 640 , Height = 400 , BPP = 32;
    const std::string Title = "Test";
    sf::RenderWindow Window( sf::VideoMode( Width , Height , BPP ) , Title );
    L test;

    test.Draw( Window );
    Window.display();

    sf::Event Event;
    while( Window.isOpen() )
    {
        while( Window.pollEvent(Event) )
        {
            if( Event.type == sf::Event::Closed )
                Window.close();
        }
    }
}
---
Third point: 20,40

Any suggestions would be greatly appreciated :)

8
General / Re: Problems Trying to use sf::CirlceShape and sf::Sound SFML 2.1
« on: February 11, 2014, 11:11:07 pm »
Hmm well I still can't find any of these libraries you are talking about I searched all the mingw folders and all of sfml folders. I re-installed codeblocks , sfml 2.1 , and re-linked everything and it worked. I am not sure what went wrong last time I have it linked exactly the same and it finds
Code: [Select]
sf::CircleShape and 
Code: [Select]
sf::Sound now. I am almost thinking that when I downloaded sfml last time a few of the files got corrupted somewhere. Thanks for all the help guys and sorry to have wasted your time I should have tried re-installing/linking everything earlier :(

9
General / Re: Problems Trying to use sf::CirlceShape and sf::Sound SFML 2.1
« on: February 11, 2014, 09:53:47 pm »
Thanks for the reply.
Quote
When you link to the static SFML sound library you must also link the following third party libraries to your project: openal32, sndfile
I have included these two dlls.

Quote
Based on your current project you should link to the following libraries in the following order: opengl32, glu32, kernel32, user32, gdi32, winspool, shell32, ole32, oleaut32, comdlg32, advapi32, winmm, sfml-graphics-s, sfml-window-s, sfml-system-s, glew, freetype, jpeg . And define the following GLEW_STATIC if you link to the static Glew library inside SFML extlibs folder.

I couldn't find any of these libraries. Where are they located at? I tried searching my entire computer for them with and without any extensions. The only ones found are dlls are you saying to include all those dlls to a project? because wouldn't that kind of defeat the purpose of statically linking when you have to include a lot more dlls than when you dynamically link it.

One more thing to mention I have them currently linked as:

graphics , sound , window , system instead of as graphics , window , system , sound because sound uses window I read.

10
General / Re: Problems Trying to use sf::CirlceShape and sf::Sound SFML 2.1
« on: February 11, 2014, 09:07:29 pm »
Thanks for the quick reply.
Not sure how I forgot to add the audio to linker. I just did it now but same problems. Also the only .dll you need when statically linking the the sound one which I included (.that I am aware of)
Quote
If you are using the sfml-audio module (either statically or dynamically), you must also copy the DLLs of the external libraries needed by it, which are libsndfile-1.dll and OpenAL32.dll.
http://sfml-dev.org/tutorials/2.1/start-cb.php

11
Hello all,

I am having problems when I try and use
sf::CircleShape
and
sf::Sound
I have tried implicitly including the required headers.
#include <SFML/Graphics.hpp> //sf::CircleShape
#include <SFML/Audio.hpp> //sf::Sound

int main()
{
    sf::CircleShape Circle;
    sf::Sound Sound;
}
---
|6|error: 'CircleShape' is not a member of 'sf'|
|7|error: aggregate 'sf::Sound Sound' has incomplete type and cannot be defined|

and explicitly including them:

#include <SFML/Graphics/CircleShape.hpp> //sf::CircleShape
#include <SFML/Audio/Sound.hpp> //sf::Sound

int main()
{
    sf::CircleShape Circle;
    sf::Sound Sound;
}
---
|6|error: 'sf' has not been declared|
|7|error: 'sf' has not been declared|

The errors when I explicitly include make me wonder if I linked wrong. I statically linked sfml 2.1:





Any suggestions would be greatly appreciated.


*edit sorry forgot to mention earlier I am using Code::Blocks 12.11 with mingw gcc 4.7.1 with windows 7 not sure if any of this will affect the problem though.

**edit added audio link



Pages: [1]
anything