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

Pages: 1 2 [3]
31
General / Re: Data storage
« on: April 13, 2013, 11:44:35 pm »
True, but I don't know, I have a thing about using the latest and greatest. Which is why I'm using SFML 2 :)

32
General / Re: Data storage
« on: April 13, 2013, 11:38:33 pm »
Now I don't claim to know much about XML vs YAML vs ini, but from what I see on various  forums, XML is kinda on the way out at least in popularity. I suppose it's all personal preference/needs of the project. I have a lot more research/thinking to do.

33
General / Re: Data storage
« on: April 13, 2013, 11:12:08 pm »
Thanks for the response! It seems that the latest version of Yaml doesn't support Windows currently. Maybe I'll just go with the .ini route (and write my own parser) for now then decide whether it's worth it to go YAML later on.

I appreciate it greatly!

34
General / Data storage
« on: April 13, 2013, 09:17:44 pm »
Hello there guys. I apologize if this is in the wrong section, but it seemed like the appropriate place to post this.

I've been developing a J-styled RPG for a while now, and  I've been loading everything manually in the code.  I decided that it's time to off-load some of this stuff to files, and load them in from said files.

Now, while I'm focusing on Windows development right now, I think I'll eventually want to port my game over to Linux, so I need to keep things portable.

Things I want to store include:

Player/Monster stats
Player/Monster spritesheet locations
Battle backgrounds
Battle monster groups
eventually I'm going to be storing Tile maps/info also.

Now I've done some research and I've narrowed it down to a few options:
YAML
XML
INI (My research lead me to think that this would be the best for windows data files, but it's not portable without third party libraries)

So, what do you guys think would be best to use? Also, I'd eventually like to market this game, so if it's a library (boost comes to mind), It would be necessary for the license of said library to allow for that.

Or maybe I should just suck it up and write my own file format/ parser?

I appreciate all the help these forums are, Thanks in advance guys!

35
General discussions / Re: Code Analysis tools
« on: April 05, 2013, 02:48:01 am »
Once again, I thank you for your input.

36
General discussions / Re: Code Analysis tools
« on: April 05, 2013, 02:07:25 am »
Ah I see what you mean. Maybe I'll attempt to spend the  enormous amount of time to refactor my code to implement RAII  :P.
 I appreciate the input a lot, thank you.

37
General discussions / Re: Code Analysis tools
« on: April 05, 2013, 01:49:13 am »
I mean, I would like to check memory leaks, since I do use pointers. I can't help it, they're helpful. Although I don't often use the new command, and when I do I am sure to delete 'em. My main worry is CPU usage though.

I'll check out that profiler, thanks! I hope it doesn't only apply to managed code though!

38
General discussions / Code Analysis tools
« on: April 05, 2013, 01:12:27 am »
Hey there SFML Community!

I'm developing a J-Styled RPG, and I want to run some Static/Dynamic Analysis on my code.

Now I tried using  pretty much every free tool listed here:
http://stackoverflow.com/questions/413477/is-there-a-good-valgrind-substitute-for-windows

And they all didn't work. They all failed to various extents. Hell AMD Code Analyst screwed up my registry so badly I had to do a system restore! Otherwise It'd tell me my images couldn't load.

Currently I'm using VS 2010 professional C++. I switch between an x64 Win8 machine and an x64 Win7 machine for development. I tried doing a search on the forums, but I turned up pretty much nothing.

I would appreciate any help! Thanks in advance!

39
Graphics / Re: Animation playing an extra frame
« on: August 18, 2012, 06:34:13 pm »
Oh god, do I feel silly, not two seconds after I posted I found the mistake.  I wanted twelve frames so I had it go 0-12 which would be 13 frames. I changed it to 11 and it works. Sorry for the needless post.  :'(

40
Graphics / Animation playing an extra frame
« on: August 18, 2012, 06:31:42 pm »
Hey guys, I'm new to using SFML, and I was trying to get a sprite to animate through some frames. I've done this before in XNA and never had much of a problem with it.  However when I'm doing it now, it plays one extra frame for some reason

I adapted the c# animated sprite class that can be found on the wiki here : https://github.com/SFML/SFML/wiki/SpriteAnimated  into c++ and it seems to me like I'm doing everything correctly, and I just can't see where the problem is.

Here's my AnimatedSprite class:
#include "animatedsprite.h"
#include <iostream>

using namespace std;
AnimatedSprite::AnimatedSprite(Texture text, float frameWidth, float frameHeight, int fps,int firstFrame, int lastFrame,bool isAnimated = false, bool isLooped = true)
{
        _text = text;
        _frameWidth = frameWidth;
        _frameHeight = frameHeight;
        _fps = fps;
        _interval = _fps/250;
        _firstFrame = firstFrame;
        _lastFrame = lastFrame;
        _frameCount = lastFrame - firstFrame;
        _currentFrame = _firstFrame;
        _isAnimated = isAnimated;
        _isLooped = isLooped;
        _clock = 0;
        setTexture(_text);
        setTextureRect(getFramePositon(_currentFrame));
}


IntRect AnimatedSprite::getFramePositon(int frame)
{
        int count = (getTexture()->getSize()).x/ _frameWidth;
        int newX = frame% count;
        int newY = frame/count;
        IntRect pos(_frameWidth*newX,_frameHeight*newY,_frameWidth,_frameHeight);
        return pos;
}

void AnimatedSprite::update(float deltaTime)
{
        _clock += deltaTime;
       
        if(_clock >= _interval && _isAnimated)
        {
                IntRect temp = getFramePositon(_currentFrame);
                setTextureRect(temp);

                if (_currentFrame < _lastFrame)
                {
                        _currentFrame++;
                }
                else
                {
                        _currentFrame = _firstFrame;
                }

                _clock = 0;
        }

        if(!_isLooped && _currentFrame == _lastFrame)
        {
                _isAnimated = false;
        }
}

float AnimatedSprite::getFPS()
{
        return _fps;
}

void AnimatedSprite::setFPS(float value)
{
        _fps = value;
}


and here's my main:

#include <SFML/Graphics.hpp>
#include <iostream>
#include "AnimatedSprite.h"
using namespace sf;

using namespace std;

int main()
{
        RenderWindow window(VideoMode(1280, 720), "Mazian Chronicles");
        window.setFramerateLimit(60);
        Texture text;
        Clock deltaClock;
        Time dt;
        if(!text.loadFromFile("sprite.png"))
        {
                return EXIT_FAILURE;
        }

        AnimatedSprite  crono(text,33,35,60,0,12,true,true);
        while (window.isOpen())
        {
                Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == Event::Closed)
                                window.close();
                }


               
                dt =deltaClock.restart();
                crono.update(dt.asSeconds());
                window.clear();
                window.draw(crono);
                window.display();
        }

        return 0;
}

I would be very appreciative if someone could help me with my (most likely stupid) mistake. Thanks!


Pages: 1 2 [3]
anything