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

Pages: 1 2 [3] 4 5 ... 7
31
SFML projects / Re: Just another Tower Defense
« on: June 07, 2013, 02:12:24 pm »
Very nice, i like to kill Pokemon's 8)

32
SFML projects / Re: My proyect: ImageRunner
« on: May 30, 2013, 07:29:05 pm »
Just one word, Amazing.

33
Graphics / Re: Convert coords, how?
« on: March 31, 2013, 11:52:23 am »
The rotated view is active at this moment and it seams that my sprite will go to the correct position but with a offset.

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



using namespace std;

sf::RenderWindow window;
sf::RenderTexture _RenderTexture;
sf::RenderTexture   SecRender;

sf::RectangleShape _BACKG;

sf::Event event;
sf::Mouse _Mouse;
sf::Sprite _Image;
sf::Sprite SecImage;
sf::View View;
sf::View StdView;

sf::Texture Wall;
sf::Sprite SWall;

void CreatField();
void DrawField(sf::RenderTexture &render, sf::RenderWindow &window);
void Input();

vector<sf::RectangleShape> Fields;

int main()
{
    Wall.loadFromFile("Images/muster.png");
    SWall.setTexture(Wall);
    //SWall.setRotation(45);

    _BACKG.setFillColor(sf::Color(0,0,0,0));
    _BACKG.setSize(sf::Vector2f(1280,800));
    View.setSize(1280,800);
    View.setRotation(45);


    window.create(sf::VideoMode(1280, 800 ,32), "Mengo", sf::Style::Default);
        window.setKeyRepeatEnabled(true);
        window.setFramerateLimit(30);




        _RenderTexture.create(1280,800, true);
        _RenderTexture.setSmooth(true);

        SecRender.create(1280,800,true);
        SecRender.setSmooth(true);

    _Image.setTexture(_RenderTexture.getTexture());
    SecImage.setTexture(SecRender.getTexture());

    CreatField();

        while(window.isOpen())
        {
        while(window.pollEvent(event))
                {
                        switch(event.type)
                        {
                        case sf::Event::Closed:
                                window.close();

                        default: break;
            }
                }



    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
        window.close();

    window.clear(sf::Color(sf::Color(0,0,0,0)));
    _RenderTexture.clear(sf::Color(0,0,0,0));
    _RenderTexture.display();
    SecRender.clear(sf::Color(0,0,0,0));
    SecRender.display();

    window.setView(StdView);///Standard View
    window.draw(_BACKG);

    window.setView(View);///Rotated View
    DrawField(_RenderTexture, window);

    SecRender.draw(SWall);

    Input();
    window.draw(_Image);
    window.setView(StdView);///Standard View
    window.draw(SecImage);



    window.display();
        }
    return 0;
}



void Input()
{
///Moving the view
}



void DrawField(sf::RenderTexture &render, sf::RenderWindow &window)
{
    for(unsigned int i = 0; i < Fields.size(); i++)
    {
        render.draw(Fields[i]);

        if(window.mapPixelToCoords(sf::Mouse::getPosition(window)).x > Fields[i].getPosition().x && window.mapPixelToCoords(sf::Mouse::getPosition(window)).x < Fields[i].getPosition().x + 80.f &&
           window.mapPixelToCoords(sf::Mouse::getPosition(window)).y > Fields[i].getPosition().y && window.mapPixelToCoords(sf::Mouse::getPosition(window)).y < Fields[i].getPosition().y + 80.f)
        {
            Fields[i].setFillColor(sf::Color::Cyan);

///HERE I SET THE POSITION FOR THE STANDARD VIEW

            SWall.setPosition(static_cast<sf::Vector2f>(window.mapCoordsToPixel(Fields[i].getPosition())));
        }
        else
        Fields[i].setFillColor(sf::Color::White);
    }


}


void CreatField()
{
    ///Create the field
}
 

Maybe you can see the error?

Please remember, its just a experiment, so please don't rate the code.

34
Graphics / Re: Convert coords, how?
« on: March 31, 2013, 10:49:36 am »
 SWall.setPosition(static_cast<sf::Vector2f>(window.mapCoordsToPixel(Fields[i].getPosition())));
 

@Laurent
Thanks for the hint but i also try this. Maybe i'am using it wrong? 

35
Graphics / Re: Convert coords, how?
« on: March 31, 2013, 10:24:49 am »
2.

I also uses mapPixleToCoords, but in this case I can not solve my problem whit this function.

36
Graphics / Convert coords, how?
« on: March 31, 2013, 01:01:58 am »
How can i convert the coordinates of an object from an rotated view to the standard view? I make some experiments, at this moment i try to create a isometric look.

37
General / Re: Is it possible to erase a vector element while push_back
« on: March 18, 2013, 11:04:41 pm »
No, did not work

Here i at the elements:

    if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        sf::Vector2f temp;
        temp.x = window.mapPixelToCoords(sf::Mouse::getPosition(window)).x;
        temp.y = window.mapPixelToCoords(sf::Mouse::getPosition(window)).y;

        _PAR._ADDPARTICLE("SPARK", 10, 20, 0, "Images/SPARK.png", temp, 20, 0);
    }


if(_Data._Type == "SPARK")
{
    for(unsigned int i = 0; i < counter; i++)
    {
        unsigned int _Direction = rand()%360;
        _Data._Direction = _Direction;
        _Data._Sprite.setRotation(_Direction);


        _AllParticle.insert(_AllParticle.begin(),_Data);
    }
}

at the same time this funktion checks the lifetime:

    if(_Timer.getElapsedTime().asMilliseconds() >= 100)
        {
            _Timer.restart();

            for(unsigned int o = 0; o < _AllParticle.size(); ++o)
            {
                static float value = _AllParticle[o]._LifeTime/2.f;

                _AllParticle[o]._LifeTime -= 0.1f;

                if(_AllParticle[o]._LifeTime  <= value)
                {


                    _AllParticle[o]._Alpha -= _AllParticle[o]._Alpha / _AllParticle[o]._LifeTime;
                    _AllParticle[o]._Sprite.setColor(sf::Color(255,255,255, _AllParticle[o]._Alpha));

                }
            }

        }


But booth things does not work at the same time, if i add something the check function is waiting until i release the mousebutton.

38
General / Is it possible to erase a vector element while push_back
« on: March 18, 2013, 09:01:09 pm »
Hy Guys,

while pressing the left mousebutton i push back a few elements in  a vector<struck>. Every element has a lifetime, if the lifetime is over
a function delete the element with erase(), but only when i release the mousebutton, so if no new objects are added.

So, how can i push_back and erase at same time?

39
General / Re: SFML app crash at run
« on: March 10, 2013, 06:18:32 pm »
Didn't help, can it be possible that the reason my Windows 8 64 bit is?

40
General / Re: SFML app crash at run
« on: March 08, 2013, 10:28:36 pm »
omg, i have no idea how, is there no final version that i dont need to?

41
General / SFML app crash at run
« on: March 08, 2013, 10:07:19 pm »
Hey, after re install windows 8 and setting up codeblocks my programs wont run, it just open the console and crash. The compiler dont show any errors.

any idea?

i use sfml2rc

42
SFML projects / Re: Memory
« on: March 08, 2013, 01:16:47 pm »
I reworked the Options menu and kick the function for fullscreen and change resolution. It don't really fits.
I replaced it with the option to turn off sound and music.

Maybe i make the window fits    automatically to the desktop size(But i think in this function of sf::Window is a bug).

I also removed the blue theme color, for my taste it's too ugly.


Memory 1.0.2

http://www70.zippyshare.com/v/71454205/file.html

43
SFML projects / Re: Memory
« on: March 07, 2013, 11:38:03 pm »
Thanks for your reply, her is a small bugfix.

http://www16.zippyshare.com/v/31073252/file.html

Just replace, by the way, the "Joker" Gamemode is still developing and coming soon as possible.

44
SFML projects / Memory
« on: March 07, 2013, 09:03:59 pm »
Here is my little Memory Game.
Not much to say about it, just play and have fun.

http://www.share-online.biz/dl/PV9L3BJMI981
http://www53.zippyshare.com/v/19855545/file.html

If you have an OpenAl.dll error please instal OpenAl

http://connect.creativelabs.com/openal/Downloads/oalinst.zip

Credits:

Sound @                             http://soundbible.com
ThemeMusic @ Geemee     http://geemee.jimdo.com/

45
System / Re: SFML 2.0 and Windows 8 Touchscreen
« on: February 28, 2013, 05:38:48 pm »
actually, it already works.But i have to wipe for left click.

Pages: 1 2 [3] 4 5 ... 7
anything