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

Pages: [1]
1
General discussions / Re: SFML on Android - proof of concept
« on: April 23, 2012, 11:05:07 am »
Just downloaded and tested it:

Awesome! Keep up the good work, I would be really interested in working with sfml on android!

Looking forward for 2.0  ;)

2
General discussions / have fast moving sprites without distortion?
« on: October 26, 2011, 11:58:13 am »
Quote from: "crgimenes"


Code: [Select]


[...]
//mainRenderWindow.UseVerticalSync(true);
//mainRenderWindow.SetFramerateLimit(60);

[...]
//mainRenderWindow.Clear();




Any suggestions?


Put away the comment slashes?

3
General discussions / How to create a build menu with the SFML view
« on: May 09, 2011, 06:38:18 pm »
Quote from: "Nexus"
First draw the scene and then the menu on top of it?


This!

I do it this way:



Code: [Select]
App->SetView(GameCam); (GameCam is a sf::view which can be moved by the user to look over the "battlefield")

App->Clear();  (Clear the window...)

Game->DrawAllTheThingsHappeningInTheGame();

App->SetView(App.GetDefaultView()); (The DefaultView does not move and so it allways "lays" over your GameCam and can draw all Hud elements)

Game->DrawTheHud();

App->Display();




Pseudocode btw. :P

4
General / Space Invaders - enemies. Best way to create them?
« on: November 17, 2010, 05:59:10 pm »
Quote
sf::Sprite enemy1(enemy);

and then...

list1.push_back (enemy);
list1.push_back (enemy);
list1.push_back (enemy);
list1.push_back (enemy);


Copy many of such lines and then just

App.Draw(enemy1);
App.Display();
or something else should be added? I think, there should, but I've no idea what.



I don't know, how far you are at programming...
but you should take a look at, classes, templates, loops etc.



At first, you have to define a Template for the List. That means, you have to define, what "type of element" it can hold.

For Example:
Code: [Select]

std::list<sf::Sprite> EnemyList; //Create a std::list, that can store sf::Sprites

sf::Sprite EnemySprite(enemyimage); //Create a Sprite

/* Now you have to fill the list, therefor you can use a for loop, instead of copying your code againd and again */


int enemy_rows = 3; //How many rows should there be?
int enemys_per_row = 15; //How many Enemys should be in one row?

for(int i = 0; i < enemy_rows; i++)
{

     for(int j = 0; j < enemys_per_row; j++)
     {
        EnemySprite.SetPosition(j*64, i*64); //For example, if you want 64 pixels space between every sprite
        EnemyList.push_back(EnemySprite);
     }
}



App.Clear();

for(std::list<sf::Sprite>::iterator it = EnemyList.begin(); it!=EnemyList.end(); it++)
{
  App.Draw(*it);
}

App.Display();







It's not perfect and totally correct, but it should get you in the right way.
If you don't understand, what I did there, you should first learn more C++

Pages: [1]