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

Pages: [1]
1
Window / Re: RenderWindow - Stack Overflow
« on: August 28, 2013, 12:14:03 pm »
The shame of this is that I thought about that, but the debugger has troubled me. :P
Anyway, thanks.

2
Window / [Solved] RenderWindow - Stack Overflow
« on: August 28, 2013, 02:04:07 am »
Hey there,

I just made a little program using the sieve of Eratosthenes to create an image which show if a number is prime or not (just like that).

It works just fine, but if the size of the window is over 498*498. There's a stack overflow, the error is supposed to be on the 16th line (where I'm creating the window).

Using SFML 2.1, and working with Visual Studio 2012.

Here's the source code :
#include <SFML/Window/Event.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Image.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/Sprite.hpp>

#include <cmath>

#define WIDTH 500
#define HEIGHT 500
#define MAX WIDTH*HEIGHT
#define SCALE 1

int WinMain()
{
   sf::RenderWindow window(sf::VideoMode(WIDTH*SCALE, HEIGHT*SCALE), "Primes");
      window.setVerticalSyncEnabled(true);

   sf::Event event;

   sf::Image image;
      image.create(WIDTH, HEIGHT);

   sf::Texture texture;
      texture.create(WIDTH, HEIGHT);

   sf::Sprite sprite;
      sprite.setTexture(texture);
      sprite.setScale(SCALE, SCALE);
     
   unsigned int numbers[MAX], primeBase = 2;
   
   // Initializing the array
   for(size_t i = 0 ; i < MAX ; ++i)
        numbers[i] = i+1;
   
   // Finding primes
   while(primeBase < sqrt(MAX))
   {
      // Replacing non-primes by 0
      for(size_t i = primeBase ; i*primeBase <= MAX ; ++i)
         numbers[i*primeBase-1] = 0;

      // Changing the value of primeBase
      for(size_t i = primeBase ; i < MAX ; ++i)
      {
         if(numbers[i] != 0)
         {
            primeBase = numbers[i];
            break;
         }
      }
   }
   
   // Creating the image
   for(size_t i = 0 ; i < MAX ; ++i)
   {
      if(numbers[i] > 1)
         image.setPixel(i%WIDTH, i/WIDTH, sf::Color::Green);
   }

   texture.update(image);
   
   // Main loop
   while(window.isOpen())
   {
      // Event loop
      while(window.pollEvent(event))
      {
         if(event.type == sf::Event::Closed)
            window.close();
      }

      // Displaying the image
      window.clear();
      window.draw(sprite);
      window.display();
   }
}

Thank you for the help. \o

3
SFML game jam / Re: Welcome to the SFML Game Jam Forums!
« on: August 06, 2013, 10:15:22 pm »
Here's some questions for you. :)

- When will be the next one?
- How often does it take place?
- Have you already thought about the criteria to determine the winner?
- Is there going to be a prize?

4
SFML projects / Re: [SFML Game Jam #1] Horton's Odyssey
« on: August 06, 2013, 06:30:40 pm »
Well I didn't even know that we can use ZQSD. :P
But it's not very well made (can't jump with Z), so I'll change that in the next version.
However you can switch between ZQSD and WASD by pressing shift and alt together.

Personnaly I use the arrow keys and Space to play.

The other controls are P to pause the game and Tab to display the FPS.

Also, I just remember that you can zoom with + (yeah it's useless :P)

5
SFML projects / [SFML Game Jam #1] Horton's Odyssey
« on: August 05, 2013, 08:44:46 pm »
Yo,

Here's the game that piticroissant and me developped during this first SFML Game Jam about "Lights and Shadows". It's a platformer, mostly inspired by Super Meat Boy.

We used SFML 2.1 and Box2D to create the game. And for the moment it's not available on Linux, but Lo-X told me that it works fine with Wine.

We will improve the game, because there are a lot of things we couldn't add or change due to delays. So we'd like to know you remarks/bugs.

Download Horton's Odyssey (.7z - 5.48 Mo)
Source code of the game (.7z - 22.6 Ko)

Some screenshots:



We hope you'll like it. :D

6
General discussions / Re: SFML Game Jam Submissions!
« on: August 05, 2013, 06:39:15 pm »
Grimshaw > Thanks. :)
But there are a lot of things we did not have time to put in the game (levels, gameplay elements...).
Luckily, piticroissant fixed a disturbing bug shortly before the end of the jam.

7
General discussions / Re: SFML Game Jam Submissions!
« on: August 05, 2013, 05:35:57 pm »
What if we started 9min after the beginning? :3

8
General discussions / Re: SFML Game Jam Submissions!
« on: August 05, 2013, 05:09:48 pm »
Hey,

Piticroissant and me made this game called Horton's Odyssey: http://akrotrili.tk/SFMLGJ/Horton.7z (only for Windows at the moment, sorry ^^)
It's a platformer (kind like Meat Boy) which uses SFML 2.1 and Box2D.

Here's some screenshots:



And here's the source code: http://akrotrili.tk/SFMLGJ/src.7z (not recommended)
We hope you'll like it. We'll add some stuff later. ;)

Pro tip: you can play with a controller.
P.-S. : WE'RE NOT LATE! \o

9
General discussions / Re: SFML Game Jam Theme Announcement!
« on: August 04, 2013, 05:58:50 pm »
Could we know how many votes there was on each theme?

Pages: [1]
anything