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

Pages: [1]
1
Graphics / Program crashes on Image.LoadFromFile()
« on: September 23, 2009, 10:44:30 pm »
Why people use pointers everywhere? It's like an epidemy :P

2
Graphics / Animating Sprites
« on: September 16, 2009, 04:55:15 am »
Wow, my eyes are burning, I can't believe how ugly are your animation solutions!! Hahaha, just kidding  :lol:. My animation class manage tilesets like Spidyy one does, the tiles must be the same size aswell. But it's a little bit different, I can say to the class "Well, the frames 1,2,5 and 6 are the animation "Shooting"", and then I just say "Play the animation Shooting", and it's that simple. I use a hash_map to store this stuff.
Here is some sample code that actually works and shows an animation:
Code: [Select]

#include <SFML/Graphics.hpp>
#include "AnimatedSprite.hpp"

using namespace Engine;

int main(int argc, char* argv[])
{
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "AnimatedSprite Demo");

std::string file = "avion rojo 66x85 c3 f1.png"; // image file of the sprite
Tile tileSettings; // structure that hold the tile settings
tileSettings.Width = 67;
tileSettings.Height = 85;
tileSettings.Columns = 3;
tileSettings.Rows = 1;
float animationTime = 0.2f; // time between frame-to-frame in the animation

AnimatedSprite aircraft(&App, file, tileSettings, animationTime);
// Sets an animation with name "default", wich frames are 0,1 and 2 (frames start from zero)
aircraft.setAnimation("0,1,2", "default");
aircraft.SetPosition(400.f, 300.f);

sf::Event Event;
while(App.IsOpened())
{
aircraft.getFrameTime(); // to manage internal time stuff
while(App.GetEvent(Event))
{
if(Event.Type == sf::Event::Closed)
App.Close();
}
if(App.GetInput().IsKeyDown(sf::Key::Escape))
App.Close();

aircraft.playAnimation("default"); // plays the animation "default"

App.Clear(sf::Color(192, 192, 192));
aircraft.draw(); // draw the sprite
App.Display();
}

return EXIT_SUCCESS;
}

Of course, I can give you the sources if you want it  8) (comments are in spanish, maybe that can be a trouble hehehe :P)

3
SFML projects / Short n Sweet 2D Space Shooter Action
« on: September 13, 2009, 03:05:45 am »
Awesome game!! The graphics are so beautiful, for a moment I tought you were using 3D models for the aircrafts  :shock:, you artist it's great. The effects are very nice too, I wish I can do something like that!! Congratulations!!  :)
P.S: maybe you can use lua or some parser like tinyxml to avoid hard-code the controls? That would be great for people who doesn't use QWERTY keyboards (not my case) like spidy  :)

4
SFML projects / 2D Shooter
« on: September 10, 2009, 05:41:11 pm »
The way I implemented the animations it's quite easy and straightforward: I did a class that can handle tilesets, that way, you specify the Height and Width of a tile (this maybe can be a limitation, the tiles of the tileset must be the same size, but for now is sufficient :P), and the number of Columns and Rows of the tileset. Then, I do something like this to define an animation:
Code: [Select]

// 0,1,2,3 are the frames of the animation
sprite.setAnimation("0,1,2,3", "default");

// tons of useful code...

// play the animation
sprite.playAnimation("default");

I have no troubles to give you the sources if you want it.
For the globals, I think a nice way will be have a struct "Globals" with all the data you need, and then just add two functions to Engine, "getGlobals()" and "setGlobals()", I think it's a little more elegant than just using quick & dirty globals.

5
SFML projects / 2D Shooter
« on: September 10, 2009, 04:37:06 am »
Nice work man!!  :). Right now I'm looking a bit the source code (you used globals in Engine, you must dieeeeee!!!  :lol:), the design seems nice to me, tough my engine it's far very diferent and uncomplete, I think yours is better  :). I saw that the demo doesn't have any animations (I am correct?), do you will implement it in the final version?.
A simple suggestion: I saw an ugly thing, the half of the ship was outside of the screen when I move right/left/up/down, so I decide to hack a little bit your EntityPlayer.cpp and fix it, I just modify a few lines of code:
Code: [Select]

EntityPlayer.cpp
78: if (GetPosition().x > GetSize().x / 2)
84: if (GetPosition().x < GetEngine().GetRenderWindow().GetWidth() - (GetSize().x / 2))
90: if (GetPosition().y > GetSize().y / 2)
98: if (GetPosition().y < GetEngine().GetRenderWindow().GetHeight() - (GetSize().y / 2))

I hope it helps. Keep up the hard work!!  8)

6
SFML projects / [09.11.09] JeZ+Lee's"The Final Option 100%™"SOURCE
« on: September 08, 2009, 04:13:05 am »
And that's exactly the point. If you don't want to share you hard work, just don't do it open source. But again, opinions are opinions, we don't need to be agree. But yeah, you're right, I behaved like a real asshole, I'm apologize. And what's the difference between "use and improve your hard work" and "rip your game and run"? I don't know what do you think, but I consider my code at least the same hard work as the resources...

7
SFML projects / [09.11.09] JeZ+Lee's"The Final Option 100%™"SOURCE
« on: September 07, 2009, 05:30:10 pm »
Oops, my bad, I ain't know that  :P (I like to write code, I hate licenses, we're programmers, not lawyers :x). But still, I think if you do the game open source, it's stupid to make only the code open source and copyright all the resources, I'd do the resources "free available" too, but it's my opinion :P.  One thing I'll never understand is why someone do this kind of thread, when you have blog hosts for free in where you can show your game-in-progress hahaha :P.
P.S: just for curious, how old are you JeZ?

8
SFML projects / [09.11.09] JeZ+Lee's"The Final Option 100%™"SOURCE
« on: September 07, 2009, 04:37:51 am »
Wow, so many [TM] and © all over the place, you seem like a lawyer rather than a programmer  :lol:. Just for curious , if the game is so open source as you said, why you put all the copyright and trademark sh*t in every screenshot you post? It's just stupid :roll: (I think you're a little bit paranoid about your "work"...)
P.S: you should consider studying marketing, you're really good on it  :lol:
P.S 2: I had the same toy but in different colours when I was a kid  :)

9
General / Weird troubles when doing a loop inside main loop
« on: August 31, 2009, 08:07:29 pm »
So after all the troubles were caused by my ugly endless loop  :oops:  :lol:. I'll try to do what you said Laurent, thx!!
EDIT: I did it!! I did it!! Now I've a nice menu without an ugly and dirty endless loop  8). Thx!

10
General / Weird troubles when doing a loop inside main loop
« on: August 29, 2009, 04:14:29 am »
Hi, I have a problem that it's driving me crazy and I can't figure out how to avoid it. I was trying to this (App is a sf::RenderWindow, like in the tutorial "Using rendering windows")

Code: [Select]

while(App.IsOpened())
{
        for(;;)
        {
             if(App.GetInput().IsKeyDown(sf::Key::Escape) break;
             App.Clear(sf::Color(192, 192, 192));
        }

        // LOTS OF USEFUL CODE...

}

Well, this simple code, just doesn't work. I get no grey window (RGB 192,192,192 is grey), I can't get input so I can't "break" the loop. Worse, my entire machine gets really lag and almost lock up (!!). I just can't understand what I'm doing wrong. Any suggestions? I'm developing under Windows XP SP3 with Visual Studio 2008.
P.S: I was trying to do that because I'm doing a very simple menu for my game, so I need to get the game started when the user click on a button (I've already implemented this stuff and it works ok), but, until that, I have to show a menu or a picture so that is why I'm using a for( ;; ).

11
General / 65+ Warnings
« on: August 14, 2009, 04:42:50 am »
Same trouble over here. The real weird thing it's that it start a few hours ago. Yesterday I've no troubles when compiling with the static debug libraries, but right now, I don't know why, it starts to do this weird thing. My code it's not the problem, if I just compile with the non-debug static libraries, it works fine. Maybe Visual Studio upgrades itself behind-the-scene and cause this kind of troubles (I would not be surprised with such thing coming from a Microsoft product...)? And it's extremely bizarre, I mean, I can't compile even this:
Code: [Select]

#include <SFML/Window.hpp>

int main(int argc, char* argv[])
{
sf::Window App(sf::VideoMode(800, 600, 32), "Testing SFML");
sf::Event Event;

while(App.IsOpened())
{
while(App.GetEvent(Event))
{
if(Event.Type == sf::Event::Closed) App.Close();
}

if(App.GetInput().IsKeyDown(sf::Key::Escape)) App.Close();

App.Display();
}

return EXIT_SUCCESS;
}

without getting the warnings (my additional dependencies are fine, they are: sfml-system-s-d.lib sfml-window-s-d.lib). So, this is very confusing for me, at the beginning I just think that I screw up something in my code, but now, well, I don't know...
P.S: this is my first post  :D

Pages: [1]
anything