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

Pages: 1 2 [3]
31
Hello guys! Here is my code snippet and the compiler spew out some error which I cannot resolve

    vector<  shared_ptr< SpriteAssets > > _projectiles;
    _projectiles.push_back( new ProjectileObjects() );
 


How can this be an error???
I do not understand ProjectileObjects is a SpriteAsset.
I have tried replacing ProjectileObjects on the shared_ptr and still I got the same error.
I have made the code simpler because this is the only part I got stuck.

here is the error
main.cpp|83|error: no matching function for call to 'std::vector<std::tr1::shared_ptr<SpriteAssets> >::push_back(ProjectileObjects*)'|
 

I need help.

32
General / How to create your own sound for game dev?
« on: June 23, 2013, 11:27:16 am »
Hello! I just want to ask if there is anyway I could make my own sounds without even recording? Do you know any tools that I could use?

Also I found this site called freesound.org. ITs great and it contains sounds that can be downloaded for free but of course it will be great if I am able to create my own sounds.

Thanks!

33
General / Can you help me understand UML Diagrams for OOD?
« on: June 22, 2013, 03:26:56 pm »
Hello everyone! My problem is kinda specific, I don't even know if there are different UML notations available or its just all about me not understanding it well. I understand the arrows for inheritance and diamonds for composition or aggregation.

I am actually reading Object Oriented Design Pattern from Gangs of Four, and I think this is there official and here is the title:
 Design Patterns - Elements of Reusable Object-Oriented Software

I use it most of the time to check out for patterns that I might need. Also I having difficulties in reading the diagrams in there. I don't understand it at most.

Just like in DB we have crow's foot notation to explain the ERM, i don't know if they used different UML notation for their notes?

What is it called? Are there any visual tutorials that I can know what those lines and shapes are for?

Here is an example..

34
General / SFML game with LibRocket?
« on: June 19, 2013, 03:47:19 pm »
Hello! Can I use SFML2 with LibRocket? Actually I will make a game as a college thesis. I clearly need a good looking UI for my game. Are you familiar with the games Like Red Alert 3? The UI interface looks cool! I want to make a similar gui because I am going to make a survival RTS-Route Defense game. I need it to look cheesy. Fortunately I know there is such thing like SFGUI which I could use. But I dunno, I don't think it fits my need. The GUI simply looks like a gui written in win32 API Qt or Swing. I somehow scour the web but all I see is like desktop app on a render window. I don't like that. So I saw LibRocket and saw some pics and videos in action and I am impress.

I also want to know how am I suppose to do that? I scour the web and it seems LibRocket is promising. I know LibRocket has its own way of rendering things but how can I render it using SFML? Like rendering it on sf::RenderWindow?

I also considered CEGUI but I think I will try that next time.

I hope you can enlighten me on how to do this, because up to know it simply looks impossible. I don't know if SFML2 even support it.   

Thanks

35
General / Sprite creation on Mouse Click?
« on: April 07, 2013, 04:12:23 pm »
Hello how to do a sprite creation on mouse click? What I am trying to do is laying out the grid for A* Algorithm so I made a grid and able to snap the walls and the tiles and such to that grid. I am stucked at making sprite on mouse click. How does SFML allow me to do this? I am using SFML 2.
Thanks

36
General / SFML and SFGUI cmake problem
« on: March 19, 2013, 09:58:29 am »
Hello!!! I will try to elaborate the procedures that I undergone to build SFML 2.0 and SFGUI

First I didn't download SFML 2.0 on the official website because it doesnt work for me. I am using C::B ver 12 and MinGW ver 4.7 and yes I download both C::B and MinGW separately. So what I have done to make SDFML to work for me is to build it from source.

I built it using Cmake and I have successfully made it to work.

I have done the same thing with sfgui. I downloaded a version of SFGUI not from the official site but from git-repo again, to my surprise there are many versions of it. I downloaded my copy from brangex because it is the 1st hit on google. When I try to run the examples, strange error appear. I have read the web and found that it is because the version of the DLL mismatches. So what I have done is to build SFGUI the same way I built SFML 2.0.

It throws bunch of errors which I think I have troubleshooted properly, like it cannot find the SFML_ROOT and some errors that say it can't find the FindSFML.cmake on the CMAKE_MODULE_DIR so what I have done is I pasted SFML folder I downloaded from the git repo and pasted along side the built lib folder. It worked. Another error occured is that it cannot find the SFML_INCLUDE_DIR so I reallign the folders, this time I specify the SFML that I pasted inside the SFGUI folder. Then after all that it went to successfully being configured.

Now when I go cmd and build the libraries. There is strange error that occured. It relates to the syntax that says something like there is no function call for m_texture_atlas.bind(); etc etc. A kind of C++ error which says that call doesn't exists.

What I have done is to uncomment that line from the source code and went on on building it again. Now I got it to work.

I went on to the built folder and onto the examples folder and I try to run some of the executables there. It worked!!! Yay!!! But there is something wrong. The font appears to be missing. It is like jumbled boxes.

Any help will be great!


37
General / I need a code review.
« on: March 18, 2013, 02:42:29 pm »
Hello! Can I ask your help? Actually this code works. I have a goal in making this smooth though. Also I wanted some kind of not-so-harsh criticism regarding this, I am starting game programming and I think I need this kind of common game feature. What this does is to pan a map just like in RTS and also to zoom into the map.

I need some suggestions or recommendations for this one.

If I could get the green sign I will be soon draw the layout for this and implementing this mechanic soon.

THank you very much!!!

#include<iostream>
using std::cout;
using std::endl;
using std::cerr;

#include<string>
using std::string;

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


int main()
{
    const int WIDTH  = 1028;
    const int HEIGHT = 768;
    sf::RenderWindow window( sf::VideoMode( WIDTH , HEIGHT , 32 ) , "SFML Window" );

    sf::Texture bg;

    bool isBgLoaded = bg.loadFromFile("background.jpg");

    if( !isBgLoaded )
        exit( 1 );

    sf::Sprite background( bg );

    sf::Vector2f center  ( WIDTH / 2 , HEIGHT / 2 );
    sf::Vector2f halfsize( 800 , 800 );

    sf::View view( center , halfsize );

    float pan_speed = 0.8f;
    const int MAX_SCROLL = 27;
    int scroll_count = 0;

    int actual_width  = view.getSize().x;
    int actual_height = view.getSize().y;
    const int resize_rate   = 20;

    while( window.isOpen() )
    {
        sf::Event event;
        window.setView( view );

        int x = sf::Mouse::getPosition( window ).x;
        int y = sf::Mouse::getPosition( window ).y;

        x = ( x < 0 ) ? 0 : x;
        y = ( y < 0 ) ? 0 : y;

        x = ( x > WIDTH  ) ? WIDTH  : x;
        y = ( y > HEIGHT ) ? HEIGHT : y;

        //cout << "( " << x << " , " << y << " ) " << endl;

        if( view.getViewport().top >= 0 and view.getViewport().left < HEIGHT )
        {
            if( x <= 50  )
            {
                view.move( -pan_speed , 0 );
            }

            if( y <= 50 )
            {
                view.move( 0 , -pan_speed );
            }

            if( x >= WIDTH-50 and x <= WIDTH )
            {
                view.move( pan_speed , 0 );
            }

            if( y >= HEIGHT-50 and y <= HEIGHT )
            {
                view.move( 0 , pan_speed );
            }
        }

        while( window.pollEvent( event ) )
        {
            if( event.type == sf::Event::Closed )
            {
                window.close();
            }
            else if( event.type == sf::Event::KeyPressed )
            {
                if( event.key.code == sf::Keyboard::Key::Escape )
                {
                    window.close();
                }
            }

            if( event.type == sf::Event::MouseWheelMoved )
            {
                if( event.mouseWheel.delta > 0 and scroll_count <= MAX_SCROLL )
                {
                    cout << "Going up!!!" << endl;
                    scroll_count++;
                    //view.zoom( 0.7 );

                    actual_height -= resize_rate;
                    actual_width  -= resize_rate;


                    view.setSize( actual_width , actual_height );
                }

                if( event.mouseWheel.delta < 0 and scroll_count > 0 )
                {
                    cout << "Going down!!!" << endl;
                    scroll_count--;
                    //view.zoom( 1.9 );

                    actual_height += resize_rate;
                    actual_width  += resize_rate;

                    view.setSize( actual_width , actual_height );
                }

                cout << "Scroll Count : " << scroll_count << endl;
                cout << "View size : ( " << view.getSize().x << " x " << view.getSize().y << " ) " << endl;

            }
        }

        /***/

        window.clear( sf::Color( 0 , 0 , 0 ) );
        window.draw( background );

        window.setView( window.getDefaultView() );
        /** Draw some interface here! */

        window.display();

    }

    return 0;
}

 

38
General / Can I SFML 2.0 on CodeBlocks MinGW64 Windows 7 64bit?
« on: January 05, 2013, 05:09:01 pm »
I just got my new computer. I can't seem to find any SFML 2.0 download that is 64 bit for codeblocks. Can this be possible just by downloading the 32 bit version and just building it on CMake? Thank you very much.

39
SFML website / How can I know or at least bookmark my own post?
« on: December 08, 2012, 07:43:38 pm »
I am struggling with this kind of feature, maybe it does exists somewhere in the page but I cant seem to find it.
I need to at least have an access to all my post so that I could check who have answered my post etc.

Is there anyway around it? Thank you very much.

40
General / Move sprite to attack a random target.
« on: December 08, 2012, 07:31:34 pm »
Hello. I have a problem, I am kinda get tired and it kinda late at night so don't get rough on me. Trust me I've researched on this and I am doing my best on studying vector math.

 I am able to make a sprite to move towards a target say, a survivor which I control around the screen and the zombie follow me around. I have done it nice and easy. But I have a problem though, the movement seems to act like limit function, whereas the closer it gets, the slower it becomes. I do not know how to make the speed constant given a vector.

So here is my code I prefer this one over mine:

void Infested_One::update( float elapsed )
{
    sf::Vector2f target_pos( target->getSpritePosition() ); // target position ( survivor)
    sf::Vector2f target_dest( target_pos ); // position to go to target

    sf::Vector2f start( getSprite().getPosition() ); // tells the position of the zomboid
    sf::Vector2f delta = target_dest - start;    // compute for the distance between the survivor and the zomboid

    // normalize the vector
    float dist = sqrt( ( target_dest.x - start.x ) * ( target_dest.x - start.x ) + ( target_dest.y * start.y ) * ( target_dest.y * start.y ) );
    delta /= dist;

    getSprite().setPosition( start + delta * distMoved);

}


I actually implement this code based on a site I just have found here on SFML,
http://en.sfml-dev.org/forums/index.php?topic=6654.0,

 I have my original one which is quite short, and I implemented it just by getting the delta of the distance between 2 objects, then calculating
the displacement by delta * ( elapsedTime / velocity ). I know this is a stupid math formula, please pardon me that. both gave me same result. The zombie gets slower as it approaches its target.


but seems like I don't really know the concept on making the sprite move on a vector with a constant speed.

Thank you very much!

Note: I am using SFML 2.0 and I am implementing this code using the elapsedTime concept
so I used clock.restart().asSeconds() as elapsedTime.


41
General / How to make a sprite face a direction base on Arrow keys?
« on: November 30, 2012, 03:39:34 pm »
Hello, I just want to ask how can a Sprite face a direction base on arrawo keys, like a s w d ,  or up left right down buttons? I don't know the concept of how this is done, I am currently thinking of using 4 .png sprite files that faces 4 directions. I know this cumbersome and wrong and at the same time, a very space consuming. I want to challenge myself by using only 1 sprite and rotating it strictly on left right up and down. Just like Final Fantasy and Zelda.

I don't want movements just yet, I want my character face the direction of the keys I am pressing.

Thank you very much.

Mean while I am playing around sprite.rotate and trying to figure out how can I rotate a sprite to a specific direction.

Pages: 1 2 [3]
anything