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

Pages: [1] 2
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 / Re: Strange behaviour when increasing size of window
« on: January 24, 2017, 06:20:34 pm »
Thanks for tip, I will try to handle events in their own thread, gonna see how it works out.

3
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?

4
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?

5
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.

6
The string needs to be parsed. C++ provides a number of ways to do this.

The tasks you'll need to achieve:
  • split the string into sections (known as tokens) based on the . character,
  • convert those tokens (at this point, they are strings holding the values) into integers,
  • assign the converted tokens (now integer values) to the sf::Color component.

I'm very sorry, but I'm not asking for how to parse advice, I'm asking on advice how to transfer my data from std::string to sf::Uint8 where std::string variable is already carrying proper piece of string. It is described in my "code", hope it's clear and understandable.

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

8
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?

9
Audio / Re: Interpretation of recorded sound
« on: February 14, 2015, 02:53:42 am »
Thanks for answer, didn't see that information in the tutorial, it's good to know that is it amplitude, now I can research further and find useful information about it.

10
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?

11
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

12
General / Re: How to correctly respond to collision detection?
« on: December 20, 2014, 11:47:25 pm »
You better show minimal code and some kind of sketch so we can see what kind of collision detection exactly you wanted to get. Showing every line of code is very convenient, but nobody won't get through it, too much work I think :) So, get your minimal code, sketch and I'm almost certain that somebody will help you.

13
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 :)

14
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!

15
General / Re: Is this a bad programming habit?
« on: December 15, 2014, 10:29:38 pm »
Big thanks for every reply, learned a lot of from it, but I got one question.
When I use static prefix with an example constant or I will put this constant inside anonymous namespace - does it gonna reduce visibility to the file where it was created?

So for example let's have a file named test.cpp and we have code like this:

static constexpr int im_visible_in_this_file;
namespace
{
constexpr int im_visible_only_here_too;
}
 

So this variables would only be visible in this file?

Pages: [1] 2
anything