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 - 93interactive

Pages: 1 [2] 3
16
SFML projects / KreiselBall
« on: October 16, 2009, 05:08:21 pm »

17
SFML projects / KreiselBall
« on: October 15, 2009, 12:44:03 pm »
Hello,

after quite some work, my new game KreiselBall (commercial) is right before release.

I am currently building levels and i guess it will be finished in the next two weeks or so.

The game concept is similar to a few old school games from the SNES times. You play a ball, which just falls down, and you can turn the world around it. It will feature 2 game modes, race and puzzle. On puzzle you have to clear the screen from colored objects by changing your own color and then hitting them.

More information will be available on its homepage





I have made a particle emitter class for the game, which can currently achieve quite a few effects like rain, animated clouds, explosions and more. I currently have a problem with it, which makes it not very usable for other projects, so it would require some work to make it available for others, but if the interest is high enough, i could release it to the public, maybe under BSD license. Please let me know if you are interested.

18
Graphics / Animating Sprites
« on: September 13, 2009, 01:23:41 am »
Quote from: "Nexus"
why are so many people using raw, possessing pointers inside STL containers even if they don't need it? That can be quite dangerous (regarding memory leaks, dangling pointers and those problems).


because there is no law how to code. i code how i want and i explicitly mentioned, that there is a option. pointers are just dangerous if you don't know what your are doing.

Quote

Even for these cases, there are better alternatives like Boost's pointer containers


but thats another library, i dont want to use tons of libraries for things that are already there

Quote

Additionally, your code contains several other mistakes, for example copying noncopyable objects or using sizeof on types without parentheses. By the way: structs are classes.


read my lips: this is untested code, just to show the principle

why next time not try to answer his question instead of trying to force others program your way?

i am not interested in pure oo, as it makes everything slow, and 25 years of experience in game industry are my proof (ok, i admit, the first commercial game was in pure assembler), but i always encourage people to program the way *they* like instead of forcing them my pattern.

19
Graphics / Animating Sprites
« on: September 12, 2009, 06:26:55 am »
well, you'll have to handle it manually, something like:

Code: [Select]

#include <vector>

struct myAnimFrame {
  sf::Sprite sprite;
  float frameTime;
};

class myAnim {
private:
  vector <myAnimFrame *>frames;
  float currentTime;
  int currentFrame;

purblic:
  MyAnim() {
    this->currentTime=0.0f;
    this->currentFrame=0;

    myAnim *frame;

    // set up your animation frame by frame
    frame=(myAnimFrame *)malloc(sizeof myAnimFrame *);
    frame->frameTime=0.1f; // time how long frame is displayed
    frame->sprite=sf::Sprite(frame1Image);
    this->frames->push_back(frame);

    frame=(myAnimFrame *)malloc(sizeof myAnimFrame *);
    frame->frameTime=0.2f;
    frame->sprite=sf::Sprite(frame1Image);
    this->frames->push_back(frame);
  }

  void Draw(sf::Window target) {
    // get current frame, update pos and draw
    myAnimFrame *f=this->frames.at(this->currentFrame);
    myAnimFrame->sprite.SetPosition(x,y);
    target->draw(myAnimFrame->sprite);

    // update time and check if we need to change frame
    this->currentTime+=target->GetFrameTime();
    if (this->currentTime>=f->frameTime) {
      this->currentTime-=f->frameTime;
      this->currentFrame++;
      if (this->currentFrame>this->frames.size()-1) this->currentFrame=0;
    }
  }
};



this is untested code, just to show the principle, ofcourse you would have to hold the images too and clean up on destruction, or use classes instead of malloced structs, then you don't have to clean up, but it would be slightly slower.

20
Window / Temporary disable double buffering (or capture screen)
« on: September 11, 2009, 02:33:46 pm »
yes i could do that, but actually i want the running game to be visible in the background.

21
Window / Temporary disable double buffering (or capture screen)
« on: September 11, 2009, 01:21:08 pm »
Hello,

i am trying to implement some pause to my game, so my game runs in game mode, renders everything and calls Window->Display(), then the user hits escape, and the game changes changes to the pause mode.

so my plan was, just to keep the drawn screen and render my pause menu over it, but calling Window->Display() in the pause mode, does switch between the last 2 frames of the game mode.

is it possible to temporary disable double buffering, so that in menu state, only the last frame is kept, and when back in game mode, double buffering is active again?

some other option would be to somehow capture the last render screen and blit it once in the pause state.

22
Graphics / Bullets in SFML.
« on: September 11, 2009, 06:39:33 am »
*edit* i overlooked a little detail, so forget what i wrote here before

i think why your bullet is not drawn, is because you have a static sprite but no static image. so the sprite loses reference of the image.

in general you draw the bullet only, on mouse down, so it is not visible if the user releases the mouse.

the quickest way to fix your problem would be to add (outside of the while loop) a boolean like

bool shotFired=false;

and then replace:

Code: [Select]

if (Window.GetInput().IsMouseButtonDown(sf::Mouse::Left))  Window.Draw(Projectile::Bullet);


with

Code: [Select]

if (Window.GetInput().IsMouseButtonDown(sf::Mouse::Left))  shotFired=true;

if (shotFired) {
   Window.Draw(Bullet.spriteThatYouNeedToAdd);
}


unless your player is a proffessional hitman - its good to give your player a chance to fire more then one bullet, so it would be better not to have one single Bullet instance, but to manage a list of instances.

Best probably would be to user c++ vector or similar.

23
Graphics / Bug in 2.0 branch
« on: September 10, 2009, 02:37:58 pm »
:oops:  i'm so sorry

it made so much sense that it must be a bug only happening (or showing up) with images < 32 pixels  :wink:

thank you very much!

24
Graphics / Bug in 2.0 branch
« on: September 10, 2009, 01:06:19 pm »


the 1 and the dot are the images < 32 pixel, they are blitted too much to the right, as if SetOrigin() would have been ignored.

here is a stripped down visual c project:

SFMLDebug.zip

25
Graphics / Bug in 2.0 branch
« on: September 10, 2009, 11:45:08 am »
hello,

there is a bug in current revision of the 2.0 branch.

i have two gimp made 32 bit png files with alpha, both are 64 pixels high, one is less than 32 pixel wide, and the other more then 32 pixel.

if i set it up like (untested code ahead):

Code: [Select]

this->smallImage.LoadFromFile("small.png");
this->smallSprite.SetImage(smallImage);
this->smallSprite.SetOrigin(this->smallImage.GetWidth()*0.5f,this->smallImage.GetHeight()*0.5f);


this->bigImage.LoadFromFile("big.png");
this->bigSprite.SetImage(bigImage);
this->bigSprite.SetOrigin(this->bigImage.GetWidth()*0.5f,this->bigImage.GetHeight()*0.5f);


and then draw it with:

Code: [Select]

float x=100.0f;
float y=100.0f;

this->bigSprite.SetPosition(x,y);
this->RenderWindow->Draw(this->bigSprite);

x+=this->bigImage.GetWidth();

this->smallSprite.SetPosition(x,y);
this->RenderWindow->Draw(this->smallSprite);

x+=this->smallSprite.GetWidth();

this->bigSprite.SetPosition(x,y);
this->RenderWindow->Draw(this->bigSprite);


then the small sprite is rendered offsetted to the right, so either the SetOrigin() or the GetWidth() seems to fail on images < 32 pixels.

edit: if i just take the image smaller then 32 pixels in with and scale it in gimp to more then 32 pixels, it works.

26
Audio / crash with audio on vista/visual studio 2008
« on: September 09, 2009, 05:21:16 am »
yes, and openal wants to include atlconv.h and afxres.h which seems to be part of MFC.

but as told i am a windows noob, so maybe i am just missing something.

anyway, am i the only one experiencing a crash as soon as audio comes into play on the 2.0 branch?

27
Audio / crash with audio on vista/visual studio 2008
« on: September 08, 2009, 06:26:48 pm »
well i tried for several hours now, but it seems that you need the commercial visual c++ to compile openal

if someone out there could send me a debug version of openal i could give it a try

it seems btw, that it breaks down on initializing the device

28
Audio / crash with audio on vista/visual studio 2008
« on: September 08, 2009, 11:31:47 am »
using the libs from sfml2\extlibs it still crashes. i can see in the logfile, that it loads the right libraries. one thing that makes me a bit suspicious ist, that i run a 64 bit vista, and it loads a lot of dll's from the 64 bit system directory, including for example dsound.dll

i am not a experienced windows user, but at least under linux mixing 32 bit with 64 bit is a very bad idea, could this be the problem? and if so, is there a way around?

29
Audio / crash with audio on vista/visual studio 2008
« on: September 08, 2009, 10:16:11 am »
Quote from: "Laurent"
Are you mixing debug and release configurations?


i dont know where to get debug versions of openal and libsndfile, so i am currently working only in release configuration.

Quote

Do you use the OpenAL and libsdnfile DLLs provided in the SFML SDK?


tried both, versions provided by sfml and the newest from original homepages

Quote
Does this code work with SFML 1.5 or the SVN trunk?


yes, both work fine, unfortunately i need 2.0 features.

30
Audio / crash with audio on vista/visual studio 2008
« on: September 08, 2009, 09:22:49 am »
Hello,

i have tried to start playing audio samples in my game, but it crashes the application under vista / visual studio 2008 and svn branch of sfml 2.0

i have stripped everything down as much as possible, so i now have a soundfile class, that looks like this:

Code: [Select]

class SoundFile {
private:
sf::SoundBuffer buffer;

public:
sf::Sound sound;

SoundFile() {}

bool Load(const char *name);
};


i do not even have to used it, just the fact to do something like this:

Code: [Select]

class MyApp {
private:
SoundFile sound;
};


does crash the application with the following messagte:

Code: [Select]

First-chance exception at 0x76fb2f3d in MyApp.exe: 0xC0000005: Access violation reading location 0x00000044.
Windows has triggered a breakpoint in MyApp.exe.

This may be due to a corruption of the heap, which indicates a bug in MyApp.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while MyApp.exe has focus.


i have installed newest openal and libsndfile and copied it to the binary folder.

any ideas?

Pages: 1 [2] 3