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

Pages: [1]
1
General / Problem with TMXloader
« on: June 08, 2016, 10:31:52 pm »
Hi, How can i use https://github.com/fallahn/sfml-tmxloader if i got class header file.

For example in Level.H i can't use

tmx::MapLoader map;
cause it's got default constructor which is string/address... (Error   'tmx::MapLoader': no appropriate default constructor available)

if
        tmx::MapLoader map("../GraSFML/Maps");
I got( syntax error: 'string'   GraSFML   e:\dokumenty\visual studio 2015\projects\grasfml\grasfml\level.h   62)   

I only know how to use it in main function, but i don't want to.

How can i read map from .tmx file with this loader properly ?

Thanks :*

2
Graphics / Re: Problem with efficiency and collision when drawing map
« on: June 04, 2016, 06:11:25 pm »
Sorry for stupid questions, can you give me some examples, some links cause i'm really new and idk 80% of things. I'm trying to do sth with RenderTexture, Alpha and even VertexArrays alone but my implementation is awful.

3
Graphics / Re: Problem with efficiency and collision when drawing map
« on: June 04, 2016, 04:16:52 pm »
You can reconstruct collision information from transparent parts of the texture.

How can I do it? It's quite interesting, how can i check if my player sprite intersects with transparent part of texture?

4
Graphics / Re: Problem with efficiency and collision when drawing map
« on: June 04, 2016, 12:16:06 pm »
And which solution is better on your opinion ? Because i think second is way better.

Basically i have to draw this map with my mouse it doesn't matter which shape will it be i read about VertexArrays but i don't know if it's good idea. I have to destroy map with bullets so i choose circles

I've got only 4 days so Good Luck to me :D

I change this part of code
gamewindow.draw(a.circle);
and i can now draw about 1000 circles so it's better ;) but it's still not enough.


I can send all of Source Code, or even project in a VS.

5
Graphics / Problem with efficiency and collision when drawing map
« on: June 04, 2016, 11:57:25 am »
Hello, First of all sorry for my english.


So I've got gaming project to do for my university. I'm studying Computer Science and i chose SFML library.
Here's my topic. I have to write something like Worms (Simple ofc, it don't have to be AAA game ^^) but in real time with simple map editor. It's hot-seat game, map has got size of screen resolution, each of players has 30 seconds to draw his half of map and then they're shooting to each other.  Map is destructible.
I've got some problems. I've got 2 versions of drawing map but both sucks.

First version and problem: efficiency

void Level::Render(sf::RenderWindow &gamewindow)
{
        for (int i = 0; i < mapelements.size(); i++)
        {
                mapElement a = mapelements[i];
                gamewindow.draw(a.circle);
        }
        p1.Render(gamewindow);
}

void Level::handleInput(sf::RenderWindow& gamewindow) {

        if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
        {
                mapElement circle;
                circle.setPosition(mouse.getPosition(gamewindow).x, mouse.getPosition(gamewindow).y);
                mapelements.push_back(circle);
        }
...
 
mapElement is a circle with some methods. This version really sucks in efficiency. If there are 500+ circles there's huge fps drop. If collision is off i can draw about 700+ circles

Second version
I've got transparent RenderTexture (Screen Resolution size, e.g 1366x768) on which i draw circles and then i remove circles from vector so there's no efficiency problems but i can't handle with collision cause it's one big texture...



I don't have other ideas, i'm new in SFML but i tried. Maybe you can help me with ideas of mine or you've got other ideas.

Thanks ;)

Pages: [1]