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

Pages: [1] 2 3 4
1
SFML projects / Atom Zombie Smasher
« on: March 18, 2011, 04:22:21 am »
Just bought this on Steam and played through my first game.  Wanted to come here (since this is where I first saw it) and say its great!  The style, gameplay, concept are all cool. I hope you are doing well sales-wise because you have earned it. :)

2
Graphics / Splash Screen
« on: February 04, 2011, 06:46:52 pm »
As you know already, to show an image you load it and then draw it.  To show a different image, just don't draw the first one anymore and draw the second one instead.  Pseudo-code:
Code: [Select]

sf::Image first, second;
first.LoadFromFile();
second.LoadFromFile();
sf::Sprite firstSprite, secondSprite;
firstSprite.SetImage(first);
secondSprite.SetImage(second);

if (firstNeedsDrawing)
{
    window.Draw(firstSprite);
}
else if (secondNeedsDrawing)
{
   window.Draw(secondSprite);
}


If you want to fade them try changing the color.  sf::Color has 4 values, the last of which controls the transparency.  255 means no transparency, 0 means complete.  So you could just set the fourth argument as a variable and decrease it to make the image more transparent.

Code: [Select]
while(firstNeedsDraw){
firstSprite.SetColor(200, 100, 100, alpha);
window.Draw(first);
alpha -= 10;    //change this to change how quickly it fades.
}


sf::Sprite.SetScale to scale the sprite.

3
General / Make Shapes Dissappear when a object hits it.
« on: January 22, 2011, 01:18:23 am »
There is some collision stuff on the wiki, you could start there.  Like JAssange said it depends on how you structure your program but making something disappear is as simple as not drawing it anymore.  So if you have a list of stuff to draw every frame, take it out.

4
Graphics / Image Destructor -> Crash
« on: January 16, 2011, 08:53:52 pm »
Quote
The rule is the following : if library XXX depends on (uses) library YYY, put XXX first and then YYY.


-lsfml-audio
-lsfml-graphics
-lsfml-window
-lsfml-system

5
Window / Fitting Screen Resolution to In-Game Drawables
« on: January 10, 2011, 06:24:52 am »
Well if the map/graphics don't extend past the current view then they wouldn't need to pan anyway :)

6
General / Is SFML Good for This type game?
« on: January 10, 2011, 06:17:52 am »
Honestly its not really a "feature", any game engine/multimedia library I'm aware of lets you do stuff like that.  Thats the basic model of computer graphics, although I guess if you couldn't control the view it would be a pain.  Either way, good luck and have fun. :)

7
Window / Fitting Screen Resolution to In-Game Drawables
« on: January 10, 2011, 06:11:56 am »
What do you mean by take up the window?  If you just need pan the screen then when the mouse is at the edge of the screen (or some area you specify) just move the view in that direction.

8
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 06:06:53 am »
Well thats what those errors are, linking errors.  Can you show us your linker options?

Also, I know it sounds dumb but the last time I had a similar problem I fixed it by starting a new project and going back through the tutorial step by step.  It can be easy to miss something silly. :)

9
Window / Fitting Screen Resolution to In-Game Drawables
« on: January 10, 2011, 06:02:24 am »
Oh I see what you mean.

You could scale the images based on the size of the window, but odds are your graphics would start to look bad at some point.  You could also just fix the size of the window or give the user a set of pre-selected options that you know you can deal with and let them choose one.  Or you could just use a Clear() color that looks ok with the rest of what you are drawing and let space appear around your drawing if the user insists on make the window a lot bigger.  Kind of depends on what you ultimately want the user to be able to do.  I'm sure other people have some better suggestions.

10
Window / Fitting Screen Resolution to In-Game Drawables
« on: January 10, 2011, 05:34:42 am »
I don't understand what you need help with.  If you are able to draw things in the center then you should also be able to draw them other places :)

11
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 05:31:41 am »
Sounds like you aren't linking to the libs or your IDE doesn't know where to find them.  Check the SFML tutorial for whatever IDE you are using to see what you might have missed.  What are you linking to and in what order?

12
General / Is SFML Good for This type game?
« on: January 10, 2011, 04:50:46 am »
I don't know anything about visual basic so I can't compare but...

what you want is totally possibly in SFML.  OpenGL (which SFML uses) provides infinite space in all directions, so the 'world' (map, whatever) can be as big or as small as you want.  Then you can choose to display some or all of it and can easily change what you are viewing.

Look at sf::View.  You can think of it as a camera which you control and you can point it at certain parts of the world you have created.  So yes, you can have the camera move as the player moves.  Even if there are parts of the world you can't see (because you are pointing the camera somewhere else) everything still has a position in the world.  Does that make sense?

13
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 04:43:57 am »
Quote from: "DarK_DemoN"

Idid what you said (which ive done a million times before) and i get these errors:


If you've done it before you could always look at a previous working version and see what is different.  Did you change your code like we suggested above?  If so, go ahead and post the new code (since its short) so we can see what might be going on.

From looking at your code it looks like you are using the sound.cpp example that comes with SFML 1.6 as a template, correct?  Try building that example to confirm you have everything set up right.  Then try changing it as little as possible in order to make it work for you (in this case, basically just change the file you are feeding it).  Making small changes to a working sample until it breaks is a great way to figure out what might be going wrong.

14
Audio / [SOLVED]: error: expected initializer before'sf'.
« on: January 10, 2011, 03:18:51 am »
You got several problems here.  For one thing, if you are going to use namespaces (in this case std and sf) then you don't need to use sf:: or st:: when making calls.  The point of using a namespace is to avoid that.  For example, if you are using namespace std, you don't need std::cout, just cout.

Ok, for the more serious problems.  Calls in C++ need to end with a semicolon.  None of the ones after sf::Music::Music(); do until you get to Music::Play();

For that matter, what are you trying to do there?

The following...
Code: [Select]
sf::Music Music;

    if (!Music.OpenFromFile("Music\\NLTT.mp3"))
        return EXIT_FAILURE;

    std::cout << "NLTT.mp3: " << std::endl;
    std::cout << " " << Music.GetDuration()      << " sec"           << std::endl;
    std::cout << " " << Music.GetSampleRate()    << " samples / sec" << std::endl;
    std::cout << " " << Music.GetChannelsCount() << " channels"      << std::endl;

...is what you want. All that stuff after is A) not valid c++ and B) does not do anything or act on any object.  Those are just methods of the sf::Music class itself.

Try using this (I took away namespaces since they are not essential here and clearly causing confusion):
Code: [Select]

#include <iostream>
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
#include <sstream>


int main()
{

    sf::Music Music;

    if (!Music.OpenFromFile("Music\\NLTT.mp3"))
        return EXIT_FAILURE;

    std::cout << "NLTT.mp3: " << std::endl;
    std::cout << " " << Music.GetDuration()      << " sec"           << std::endl;
    std::cout << " " << Music.GetSampleRate()    << " samples / sec" << std::endl;
    std::cout << " " << Music.GetChannelsCount() << " channels"      << std::endl;


    Music.Play();
    std::cout << "Playing..." << std::endl;


    while (Music.GetStatus() == sf::Music::Playing)
    {
        sf::Sleep(0.1f);
    }
    std::cout << std::endl;

    std::cin.ignore(10000, '\n');
    return EXIT_SUCCESS;

}


//edit:  downtimes is faster than me :P But the advice is good.  Do some simple c++ tutorials and small program (like Hello World) in order to get the basics of the language.  Also, follow the SFML tutorials as they are extremely helpful when trying to learn SFML  :wink:

15
General / Is SFML Good for This type game?
« on: January 09, 2011, 06:42:14 pm »
Yep, SFML would work fine.

Pages: [1] 2 3 4