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

Pages: [1] 2 3
1
Graphics / Is there a way to improve sf::Text fullscreen scaling?
« on: November 28, 2015, 02:31:11 am »
My pxel art game is 1280x720 and when I launch it in fullscreen mode (1920x1080) everything scales nicely, except my sf::Texts that become noticably blurry.

I've used dozens of different font files but the blurriness is always there.

The thing is that when I use sprites that have the fons as a texture they scale perfectly and are sharp but copying all letters and numbers from the font file would be a lot of work...

2
Window / How to "unfreeze" a window while dragging it
« on: November 22, 2015, 06:44:46 pm »
When clicking the window's title bar and holding down the mouse button (for example to drag the window around), it "freezes". Is there a fix/workaround for that?

I know that a lot of applications freeze too, but only for a fraction of a second, and then unfreeze even if the mouse button is still held down.

3
General / How to determine system requirements for my game?
« on: November 16, 2015, 07:43:49 pm »
Hard drive space is easy to determine. For RAM usage I use the task manager which in my experience has good enough accuracy.

But what about CPU requirements? And GPU? Is the graphics card even used by my game? What about the sound card etc.?

Obviously I could let other people test the game or use different machines, but is there another way that I can use myself to get a rough estimate on what is required for the game to run?

So basically I need info about this stuff (minimum requirements):

OS, processor, drive space, RAM, sound card, directx/opengl version, graphics

4
General / Maximum size of VertexArray
« on: September 15, 2015, 02:53:57 pm »
I'm working on a game where I use the tilemap class from SFML's tutorial, and I was wondering if it's a bad idea to make the map really huge.

By huge I mean dimensions of 80,000x800 (40,000 quads at 40x40 each). Willl that be a problem?

Here's the thing: Due to how my game works, I have to have one big tilemap and can't split it up into smaller parts, or even use e.g. a vector of tiles to make rendering easier.

So if I draw the big tilemap, only whatever can be displayed in the window's size will be rendered, and the rest automatically culled anyway, right? I'm afraid the answer is going to be no...

Yeah.. this is giving me a headache

5
General / Change hardware cursor?
« on: July 19, 2015, 10:16:40 am »
I want to have a custom mouse cursor in my game, and instead of hiding the cursor and drawing a sprite at its position I want to change the hardware cursor.

Something like this: https://love2d.org/wiki/Cursor

Is that possible?

6
I upgraded from 2.2 to 2.3 and now I'm getting this console output:

OpenGL extension SGIS_texture_edge_clamp unavailable
Artifacts may occur along texture edges
Ensure that hardware acceleration is enabled if available

What does it mean?

Should I be concerned, and how do I fix it? Thanks!

7
General / Can't build my project. I'm getting these linker errors:
« on: April 20, 2015, 02:25:55 pm »
Code: [Select]
1>------ Build started: Project: game, Configuration: Debug Win32 ------
1>sfml-audio-s-d.lib(SoundBuffer.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGenBuffers referenced in function "public: __thiscall sf::SoundBuffer::SoundBuffer(void)" (??0SoundBuffer@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2001: unresolved external symbol __imp__alGenBuffers
1>sfml-audio-s-d.lib(SoundBuffer.cpp.obj) : error LNK2019: unresolved external symbol __imp__alDeleteBuffers referenced in function "public: __thiscall sf::SoundBuffer::~SoundBuffer(void)" (??1SoundBuffer@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2001: unresolved external symbol __imp__alDeleteBuffers
1>sfml-audio-s-d.lib(SoundBuffer.cpp.obj) : error LNK2019: unresolved external symbol __imp__alBufferData referenced in function "private: bool __thiscall sf::SoundBuffer::update(unsigned int,unsigned int)" (?update@SoundBuffer@sf@@AAE_NII@Z)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2001: unresolved external symbol __imp__alBufferData
1>sfml-audio-s-d.lib(SoundBuffer.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGetBufferi referenced in function "public: unsigned int __thiscall sf::SoundBuffer::getSampleRate(void)const " (?getSampleRate@SoundBuffer@sf@@QBEIXZ)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2001: unresolved external symbol __imp__alGetBufferi
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function "public: __thiscall sf::SoundSource::SoundSource(class sf::SoundSource const &)" (??0SoundSource@sf@@QAE@ABV01@@Z)
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alDeleteSources referenced in function "public: virtual __thiscall sf::SoundSource::~SoundSource(void)" (??1SoundSource@sf@@UAE@XZ)
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourcef referenced in function "public: void __thiscall sf::SoundSource::setPitch(float)" (?setPitch@SoundSource@sf@@QAEXM@Z)
1>sfml-audio-s-d.lib(Sound.cpp.obj) : error LNK2001: unresolved external symbol __imp__alSourcef
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSource3f referenced in function "public: void __thiscall sf::SoundSource::setPosition(float,float,float)" (?setPosition@SoundSource@sf@@QAEXMMM@Z)
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function "public: __thiscall sf::SoundSource::SoundSource(class sf::SoundSource const &)" (??0SoundSource@sf@@QAE@ABV01@@Z)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2001: unresolved external symbol __imp__alSourcei
1>sfml-audio-s-d.lib(Sound.cpp.obj) : error LNK2001: unresolved external symbol __imp__alSourcei
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGetSourcef referenced in function "public: float __thiscall sf::SoundSource::getPitch(void)const " (?getPitch@SoundSource@sf@@QBEMXZ)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2001: unresolved external symbol __imp__alGetSourcef
1>sfml-audio-s-d.lib(Sound.cpp.obj) : error LNK2001: unresolved external symbol __imp__alGetSourcef
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGetSource3f referenced in function "public: class sf::Vector3<float> __thiscall sf::SoundSource::getPosition(void)const " (?getPosition@SoundSource@sf@@QBE?AV?$Vector3@M@2@XZ)
1>sfml-audio-s-d.lib(SoundSource.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGetSourcei referenced in function "public: bool __thiscall sf::SoundSource::isRelativeToListener(void)const " (?isRelativeToListener@SoundSource@sf@@QBE_NXZ)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2001: unresolved external symbol __imp__alGetSourcei
1>sfml-audio-s-d.lib(Sound.cpp.obj) : error LNK2001: unresolved external symbol __imp__alGetSourcei
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourcePlay referenced in function "public: void __thiscall sf::SoundStream::play(void)" (?play@SoundStream@sf@@QAEXXZ)
1>sfml-audio-s-d.lib(Sound.cpp.obj) : error LNK2001: unresolved external symbol __imp__alSourcePlay
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourceStop referenced in function "private: void __thiscall sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AAEXXZ)
1>sfml-audio-s-d.lib(Sound.cpp.obj) : error LNK2001: unresolved external symbol __imp__alSourceStop
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourcePause referenced in function "public: void __thiscall sf::SoundStream::pause(void)" (?pause@SoundStream@sf@@QAEXXZ)
1>sfml-audio-s-d.lib(Sound.cpp.obj) : error LNK2001: unresolved external symbol __imp__alSourcePause
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourceQueueBuffers referenced in function "private: bool __thiscall sf::SoundStream::fillAndPushBuffer(unsigned int)" (?fillAndPushBuffer@SoundStream@sf@@AAE_NI@Z)
1>sfml-audio-s-d.lib(SoundStream.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourceUnqueueBuffers referenced in function "private: void __thiscall sf::SoundStream::streamData(void)" (?streamData@SoundStream@sf@@AAEXXZ)
1>sfml-audio-s-d.lib(SoundFile.cpp.obj) : error LNK2019: unresolved external symbol _sf_open referenced in function "public: bool __thiscall sf::priv::SoundFile::openRead(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?openRead@SoundFile@priv@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>sfml-audio-s-d.lib(SoundFile.cpp.obj) : error LNK2019: unresolved external symbol _sf_open_virtual referenced in function "public: bool __thiscall sf::priv::SoundFile::openRead(void const *,unsigned int)" (?openRead@SoundFile@priv@sf@@QAE_NPBXI@Z)
1>sfml-audio-s-d.lib(SoundFile.cpp.obj) : error LNK2019: unresolved external symbol _sf_strerror referenced in function "public: bool __thiscall sf::priv::SoundFile::openRead(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?openRead@SoundFile@priv@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>sfml-audio-s-d.lib(SoundFile.cpp.obj) : error LNK2019: unresolved external symbol _sf_seek referenced in function "public: void __thiscall sf::priv::SoundFile::seek(class sf::Time)" (?seek@SoundFile@priv@sf@@QAEXVTime@3@@Z)
1>sfml-audio-s-d.lib(SoundFile.cpp.obj) : error LNK2019: unresolved external symbol _sf_read_short referenced in function "public: unsigned int __thiscall sf::priv::SoundFile::read(short *,unsigned int)" (?read@SoundFile@priv@sf@@QAEIPAFI@Z)
1>sfml-audio-s-d.lib(SoundFile.cpp.obj) : error LNK2019: unresolved external symbol _sf_write_short referenced in function "public: void __thiscall sf::priv::SoundFile::write(short const *,unsigned int)" (?write@SoundFile@priv@sf@@QAEXPBFI@Z)
1>sfml-audio-s-d.lib(SoundFile.cpp.obj) : error LNK2019: unresolved external symbol _sf_close referenced in function "public: __thiscall sf::priv::SoundFile::~SoundFile(void)" (??1SoundFile@priv@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alIsExtensionPresent referenced in function "public: static bool __cdecl sf::priv::AudioDevice::isExtensionSupported(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?isExtensionSupported@AudioDevice@priv@sf@@SA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGetEnumValue referenced in function "public: static int __cdecl sf::priv::AudioDevice::getFormatFromChannelCount(unsigned int)" (?getFormatFromChannelCount@AudioDevice@priv@sf@@SAHI@Z)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcCreateContext referenced in function "public: __thiscall sf::priv::AudioDevice::AudioDevice(void)" (??0AudioDevice@priv@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcMakeContextCurrent referenced in function "public: __thiscall sf::priv::AudioDevice::AudioDevice(void)" (??0AudioDevice@priv@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcDestroyContext referenced in function "public: __thiscall sf::priv::AudioDevice::~AudioDevice(void)" (??1AudioDevice@priv@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcOpenDevice referenced in function "public: __thiscall sf::priv::AudioDevice::AudioDevice(void)" (??0AudioDevice@priv@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcCloseDevice referenced in function "public: __thiscall sf::priv::AudioDevice::~AudioDevice(void)" (??1AudioDevice@priv@sf@@QAE@XZ)
1>sfml-audio-s-d.lib(AudioDevice.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcIsExtensionPresent referenced in function "public: static bool __cdecl sf::priv::AudioDevice::isExtensionSupported(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?isExtensionSupported@AudioDevice@priv@sf@@SA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>sfml-audio-s-d.lib(ALCheck.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGetError referenced in function "void __cdecl sf::priv::alCheckError(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int)" (?alCheckError@priv@sf@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z)
1>C:\Users\admin\Documents\Visual Studio 2012\Projects\game\Debug\game.exe : fatal error LNK1120: 33 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I get the same error for the release version. I don't understand what's wrong. I use the same settings I used in previous completed projects...

Linker dependencies are

Code: [Select]
sfml-audio-s-d.lib
sfml-graphics-s-d.lib
sfml-main-d.lib
sfml-system-s-d.lib
sfml-window-s-d.lib
freetype.lib
gdi32.lib
glew.lib
jpeg.lib
opengl32.lib
winmm.lib

for debug and

Code: [Select]
sfml-audio-s.lib
sfml-graphics-s.lib
sfml-main.lib
sfml-system-s.lib
sfml-window-s.lib
freetype.lib
gdi32.lib
glew.lib
jpeg.lib
opengl32.lib
winmm.lib

for release.

Can someone help me please?

8
Graphics / How to draw a trail? sf::VertexArray?
« on: January 19, 2015, 04:11:24 pm »
Say I have an object and whenever it moves I want a continuous trail to appear behind it. The trail should never disappear but rather be persistent.

How would I draw such a trail? I thought about using sf::VertexArray and use lines and always append points or lines based on the distance moved...

Then I read the documentation and it says points and lines can only be 1 pixel thick, but I need the trail thickness to be bigger than 1 pixel (customizable).

What sf::PrimitiveType should I use, and is a vertex array even the right choice to solve this problem?

I also thought about using a vector and add rectangles but that doesn't seem as good, plus the trail generation should be smooth.

Edit:

sf::VertexArray vertices;
vertices.setPrimitiveType(sf::PrimitiveType::LinesStrip);
// dynamically append...
vertices.append(sf::Vertex(sf::Vector2f(10.0f, 10.0f)));
vertices.append(sf::Vertex(sf::Vector2f(20.0f, 20.0f)));
vertices.append(sf::Vertex(sf::Vector2f(30.0f, 20.0f)));
vertices.append(sf::Vertex(sf::Vector2f(40.0f, 30.0f)));
// ...
window->draw(vertices);

seems to be pretty good, except the line's thickness is only 1 pixel

9
Graphics / Anti-aliasing
« on: January 18, 2015, 04:55:55 pm »
Hi,

what is the upper bound for sf::ContextSettings::antialiasingLevel?

I want my game to support anti-aliasing but I'm not sure which maximum level I should offer as an option. 0 to 8? 0 to 16? Even higher?

And what should the steps be? Single steps or steps of 2 / 4? For example 0, 1, 2, 3, 4, ... or 0, 2, 4, ...?

Thanks

10
I have a RectangleShape

sf::RectangleShape rect;

and I want it to continuously rotate around its own center.

When I use this code in the loop:

float rotation = rect.getRotation() + 1.0f;
if (rotation >= 360.0f) {
  rotation = 0.0f;
}

rect.setRotation(rotation);

it rotates around its top left corner.

So I tried to alter its origin:

rect.setOrigin(rect.getSize().x * 0.5f, rect.getSize().y * 0.5f);

and now it does rotate around its center, but the center is now where its original top left corner was.

What am I doing wrong, please?

11
General / Can't use SFML 2.2?
« on: December 19, 2014, 12:40:19 am »
I wanted to switch from 2.1 to 2.2 but now I'm getting a lot of linker errors?

Edit: Okay, I'm so dumb, sorry. I forgot to add all the new dependencies when statically linking...

12
For my game, I have a resources class that holds all the textures, fonts, etc. and I can access them like so:
resources->getTexture("player")
which would return a reference to the player texture.

The function is
sf::Texture &getTexture(const std::string &name)

This all works fine. Now I'd like to also add all my shaders to the resources class.

Naturally I created this function
sf::Shader &getShader(const std::string &name)
which would return a reference to the shader, but the compile time error is

Code: [Select]
error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'
I really want to have all my resources in one place, so if I could somehow make this work and put all the shaders in my resources class it'd be really great.

I don't know what to do

13
Graphics / How to use this blur shader?
« on: December 15, 2014, 01:25:06 am »
I want to create a "blur rect" that blurs everything underneath it. I have a rectangle (sf::RectangleShape) that's black and half transparent and I want to apply an additional blur effect to it by using a pixel shader.

The blur.frag is from the shader example (can't find the URL right now):

uniform sampler2D texture;
uniform float blur_radius;

void main()
{
        vec2 offx = vec2(blur_radius, 0.0);
        vec2 offy = vec2(0.0, blur_radius);

        vec4 pixel = texture2D(texture, gl_TexCoord[0].xy)               * 4.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offx)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offx)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offy)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offy)        * 2.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 +
                 texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 +
                 texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0;

        gl_FragColor =  gl_Color * (pixel / 16.0);
}

And this is the code:

sf::Shader shader_blur_;
shader_blur_.loadFromFile("./data/blur.frag", sf::Shader::Type::Fragment);
shader_blur_.setParameter("blur_radius", 0.05);

and the draw code:

...
renderTarget.draw(someText);
renderTarget.draw(someButton);
renderTarget.draw(blurRect, &shader_blur_); // has no effect
...

It has no effect. When I apply the shader to the other stuff, for example the someText, it properly blurs the text, but that's not what I want. I want to apply it to the blurRect so everything underneath it (in this case: someText and someButton) gets blurred!

I also tried

renderStates.shader = &shader_blur_;
renderTarget.draw(blurRect, renderStates);

but it doesn't work either.

Could you please help me?

14
Graphics / Why can't I use sf::RenderTexture as a class's member?
« on: November 10, 2014, 11:33:36 am »
I have a resource class that holds textures and fonts etc. and I access those for example with

sf::Texture &getTexture(const std::string &nameOfTexture);

This works.

Now I need an sf::RenderTexture as a class member too, but it won't let me do it. The compilation error is

1>C:\Users\admin\Documents\SFML\SFML-2.1-vc11\include\SFML/Graphics/RenderTarget.hpp(419): error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'
1>          C:\Users\admin\Documents\SFML\SFML-2.1-vc11\include\SFML/System/NonCopyable.hpp(67) : see declaration of 'sf::NonCopyable::NonCopyable'
1>          C:\Users\admin\Documents\SFML\SFML-2.1-vc11\include\SFML/System/NonCopyable.hpp(42) : see declaration of 'sf::NonCopyable'
1>          This diagnostic occurred in the compiler generated function 'sf::RenderTarget::RenderTarget(const sf::RenderTarget &)'

I Googled but couldn't find a solution. How am I supposed to do it?

15
Graphics / Is there a better way to make a minimap?
« on: November 10, 2014, 09:48:04 am »
I'm making a 2d platformer and I'd like to have a minimap. I saw this tutorial (see the bottom of the linked anchor) where the world is drawn to a view, and then it's drawn again but to a smaller view, the minimap.

Is there a better way to do it? It seems like it's not very efficient to draw the world twice? Or am I overthinking it

Pages: [1] 2 3