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.


Topics - lafoniz

Pages: [1]
1
DotNet / Error installing DotNet binding through NuGet
« on: September 23, 2017, 11:20:10 am »
Hey, is it possible to install DotNet SFML binding through NuGet packages or maybe only manual install is working?

I tried to install every available binding version through NuGet on Windows 10 with Visual Studio 2017, however every time it finished with this kind of message:
Quote
Error Could not install package 'sfml-system.redist 2.4.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Error isn't very mysterious, however I'm unaware of reasons why this package does not contain any assembly references or might be incompatible. I'm only guessing that maybe this binding is a little but outdated and there is no support for Windows 10 or Visual Studio 2017?

2
Graphics / Strange behaviour when increasing size of window
« on: January 24, 2017, 05:39:38 pm »
Hello everyone. I have noticed weird behavior of sf::RenderWindow instance when user is trying to increase size of it manually (at run-time).

If you hold a mouse button on border to increase size of window you will see something like this: http://imgur.com/a/wxy3G
Those graphical "artifacts" will vanish after you release mouse button, however I'm not aware of any way to prevent them in the first place, is there any?

3
General / Transferring data between states
« on: June 16, 2016, 08:33:26 pm »
Hello folks. Many people here are aware that using finite state machine is a good way to handle switching between different stages in game like title screen, menu screen and so on.

I have used this idea few times successfully implementing this kind of functionality to my games, however I'm still not 100% sure how to solve one particular problem.

Till now my game projects used to be very simple, so I didn't have much information to send between different stages, but now I'm working on a game which is much more heavily depending on information transfer.

For example I have stage which is responsible for character creation and another one which is using that information from creator. This isn't the only thing I need to exchange, that's why I'm wondering, how should stages communicate in case I would have more complicated cases?

I was thinking about something similar in a way to a TCP socket. So I could safely exchange packets of important information from one stage to another, should I follow this idea?

4
Audio / Capturing audio from headphones
« on: June 09, 2016, 05:46:56 pm »
Hello, I was wondering whether there is a way to capture audio directly from my headphones rather than from my microphone? That way I can save it as samples and use it later for some purpose. Thanks for any advice on that matter.

5
Hello, I need to perform a task which will look similar to this:

std::string colorInfo = "255.255.255.255";
std::vector<std::string> RGBA = splitStringByCharacter(colorInfo, '.');
sf::Color color;
color.r ?= RGBA[0];
color.g ?= RGBA[1];
color.b ?= RGBA[2];
color.a ?= RGBA[3];

?=
This sign was written intentionally, because this is the thing I want to ask about. RGBA is a vector of std::string, however any member variable of color is of sf::Uint8 type. How should I proceed with that kind of conversion to make sure data won't be lost or corrupted?

6
General / System for writing text
« on: June 19, 2015, 11:27:17 am »
Hey guys, I'm wondering what would be the best way to implement system for writing text (so you can enter information directly using keyboard, same like in Microsoft Office Excel or any database typed programs), how to implement this kind of interaction with the program?

7
Audio / Interpretation of recorded sound
« on: February 13, 2015, 10:58:35 am »
I have been tinkering with SFML example program which main purpose is to record sound. I did notice a very interesting thing. It is possible to get some kind of nice data from SoundBufferRecorderinstance using getBuffer() member function. This data called samples is then saved in sf::Int16 array.
I was wondering if I can in someway visualize this data and I did:

After that I realized that I have no clue about this data interpretation. I know that sound is converted from analog to digital by sampling process and it isn't continuous. However I have no idea of this data meaning. Sample number is equal to what? Amplitude, frequency or?

8
General / A little help regarding Thor library
« on: January 29, 2015, 07:16:03 pm »
Hey guys, I have successfully installed the newest Thor library with 2.2 SFML and I wanted to test some particle examples as it is the most interesting thing for me, but I have had hit a wall and need little help.

In Thor there is class called "UniversalEmitter" and in this class we have public member called "setParticlePosition". Last time if you wanted to create a randomize position around a circle you would have to type
emitter.setParticlePosition( thor::Distributions::circle(center, radius) );
but today "thor::Distributions" doesn't exist anymore and there is only "thor::Distributions". Documentation about the latter is a bit enigmatic for me and I cannot guess proper syntax to have the same effect. Is anybody familiar with it?

I would be grateful for any kind of help this, Lafoniz

9
General / Angle between two vectors
« on: December 20, 2014, 11:29:51 pm »
I was reading a book and there was described a formula to calculate angle between two vectors, I tried to use it on paper but it didn't work for me (maybe I don't understand this correctly). Here is a brief description of it:

Quote
Let's say you have point A and point B,
which represent two characters in an action game. When the enemy at point A wants
to shoot our player at point B, it needs to know the direction in which to shoot the
projectile. Why waste your brains thinking on how to solve this problem if this field
of math defines this operation as one of its most basic rules? All you need is to find
the direction vector C, which is obtained by calculating B minus A. The difference
between two positions gives us the direction between the two

I need help with computing it, if this formula is okay, because I'm using this http://www.wikihow.com/Find-the-Angle-Between-Two-Vectors formula which seems to be worse for performance. Thanks for any kind of help :)

10
General / Multiple entities on map and sf::Texture
« on: December 17, 2014, 11:46:00 pm »
Hello back again, I got a little problem that I wanted to discuss with many clever and experienced users from this forum.

Let's say that I have class like this for an enemy:

class Enemy
{
sf::Texture texture;
sf::Sprite sprite;

void setProperSpriteRect();

};

I have seen in many little productions classes like this, but I have found an very anxious problem with them.
Let's see another short code:

std::vector<Enemy> enemies;
for(unsigned i{0}; i < enemies.size(); ++i)
{
enemies.push_back(Enemy(x,y,z));
}

This code may look okay, but it's not. Every time I create enemy or I delete it, I have to create or delete one texture! Which for example in my game is like 3000x128 size (I'm using setSpriteRect function to get proper frame of animation). It's not okay, when I need only 1 texture for every entity on the map.

There I need your expertise guys! What is the best way to implement a shared texture for every kind of entity? Personally, I was thinking of:

a) making separate class only for texture loading and returning pointer to texture to every class which needs this texture
b) trying to do something with 'static'?

However, I'm not sure which will be the best to improve performance and reduce memory requisition. Thanks for every reply and helpful tip, good luck!

11
General / Is this a bad programming habit?
« on: December 15, 2014, 07:25:21 pm »
Hello, I would like to ask whether this habit is good or bad, I have read FAQ about using global variables, but I'm not sure does this situation is exactly the same bad as this described in wiki.

Let's assume I'm trying to write a player class, so i have a cpp and hpp file. In cpp file I write something like this:

#include "Player.hpp"

constexpr sf::Vector2f playerPos{100.0,300.0};

void Player::Player()
{
        player.setPosition(playerPos);
        ...
        ...
}

Someone may ask, why I'm doing something like this. Well when I have 6-7 parameters it's very nice to have them in one place, so configuration takes 3 seconds instead of 30, because I don't need to look for them. What should I do if this is not the best solution? I was thinking of static variable, but I'm not sure about this.

12
Network / Network Chat Example - strange issue
« on: December 15, 2014, 04:00:41 pm »
Hello folks, I wanted to test network library from SFML, so I thought it would the best to use some kind of example. I have chosen code from this wiki site: https://github.com/SFML/SFML/wiki/Source:-Network-Chat-Example
It was working perfectly for my desktop computer and I didn't have any problems with it. After that I have taken code from the same website and tried to run the app on my laptop, but a very strange issue appeared.
Almost instantaneously I had 40% CPU usage, just from it and nothing showed up.

I did some test which showed that is it some kind of problem with compiling or linking, because I used this bugged exe app  on my desktop computer and it still didn't work.

The huge problem is:
1. I'm using the same IDE on both computers, it's Code::Blocks with MinGW compilator.
2. Computers have the same SFML files and the same operating systems.
3. Compiling process on my laptop doesn't return any errors or warnings.

Link to this bugged application: http://www.speedyshare.com/Ftye2/Network-app.rar

Have anybody seen something like this?

PS. I know my description may be a little chaotic, if you need anything more, please just tell me.

Pages: [1]