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

Pages: 1 [2] 3
16
SFML projects / Re: SFML Light System - Let There Be Light
« on: June 04, 2013, 08:22:35 pm »
You need to add the source as a library directory as well. Go to VC++ Directories and add the Source folder under Library Directories.

I did it but i get the same error

17
SFML projects / Re: SFML Light System - Let There Be Light
« on: June 04, 2013, 07:57:48 pm »
It looks like you are copying the light system. Try initializing it like this:

ltbl::LightSystem ls(AABB(Vec2f(0.0f, 0.0f), Vec2f(static_cast<float>(WIN_WIDTH), static_cast<float>(WIN_HEIGHT))), window.get(), "data/lightFin.png", "data/shaders/lightAttenuationShader.frag");

that did work somehow but now I get this:

1>------ Build started: Project: Testing, Configuration: Release Win32 ------
1>  main.cpp
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall Vec2f::Vec2f(float,float)" (??0Vec2f@@QAE@MM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall AABB::AABB(class Vec2f const &,class Vec2f const &)" (??0AABB@@QAE@ABVVec2f@@0@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall ltbl::LightSystem::RenderLightTexture(void)" (?RenderLightTexture@LightSystem@ltbl@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall ltbl::LightSystem::RenderLights(void)" (?RenderLights@LightSystem@ltbl@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall ltbl::LightSystem::~LightSystem(void)" (??1LightSystem@ltbl@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall ltbl::LightSystem::LightSystem(class AABB const &,class sf::RenderWindow *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0LightSystem@ltbl@@QAE@ABVAABB@@PAVRenderWindow@sf@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall ltbl::Light::SetCenter(class Vec2f)" (?SetCenter@Light@ltbl@@QAEXVVec2f@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall ltbl::Light::SetRadius(float)" (?SetRadius@Light@ltbl@@QAEXM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall ltbl::Light_Point::SetSpreadAngle(float)" (?SetSpreadAngle@Light_Point@ltbl@@QAEXM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall ltbl::Light_Point::Light_Point(void)" (??0Light_Point@ltbl@@QAE@XZ)
1>F:\Bibliotecas\Documentos\Visual Studio 2012\Projects\SlimeWorld\Release\Testing.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I've include the headers to my MSVS IDE. How should I do this to also compile LTLB? Because
I believe those errors are because when compiling, since LTBL has no libraries it's looking for them.

18
Graphics / Re: Sprite and Shader
« on: June 04, 2013, 07:41:03 pm »
I already fixed the 2 misspell attributes (Thanks i didnt notice) and changed the path to normal /.

Yet the drawing is exactly the same.

Edit: I should add that what I want to do is to make mi sprite to get the lighting and blend over it
some degradation of transparent-black + shadowing. Not sure if I'm doing it correctly

19
Graphics / Sprite and Shader
« on: June 04, 2013, 06:33:30 pm »
Hi there,

I've got one Sprite which loads an spritesheet and a shader, and it's texture changes on animation
by seting an intrect.

So when rendering, I calculate the new intrect for the animation and then draw it to rendertarget (which is renderwindow by now) like this:

window->draw(*this, &shader);

This is the code to my shader:

uniform vec2 lightpos;
uniform vec3 lightColor;
uniform float screenHeight;
uniform vec3 lightAttenuation;
uniform float radius;

uniform sampler2D tex;

void main()
{              
        vec2 pixel=gl_FragCoord.xy;            
        pixel.y=screenHeight-pixel.y;  
        vec2 aux=lightpos-pixel;
        float distance=length(aux);
        float attenuation=1.0/(lightAttenuation.x+lightAttenuation.y*distance+lightAttenuation.z*distance*distance);   
        vec4 color=vec4(attenuation,attenuation,attenuation,1.0)*vec4(lightColor,1.0); 
        gl_FragColor = color * texture2D(tex,gl_TexCoord[0].st);
}

and how I load it to sf::Shader:

sf::Shader shader; // member of my sprite holding class.
        shader.loadFromFile("assets/shaders/lightfx.frag", sf::Shader::Fragment);
        shader.setParameter("lightpos", sf::Vector2f(150.f, 50.f));
        shader.setParameter("lightColor", sf::Vector3f(255.f, 255.f, 255.f));
        shader.setParameter("screenHeight", static_cast<float>(window->getSize().y));
        shader.setParameter("lightAttenuation", sf::Vector3f(50.f, 25.f, 15.f));
        shader.setParameter("radius", 500.f);
        shader.setParameter("texture", sf::Shader::CurrentTexture);

The lighting is fixed by now cause I'm still developing lighting system but this should work.

I want to know why it doesn't seem to abe applied the shader to my sprite.
Am I doing something wrong?

EDIT: Forgot to comment that the output from this is just sprite being as black color square. and If i change the attenuation to 0, it shows the lightColor square, but I want it to "diffuminate" over the sprite.

Thanks!

20
SFML projects / Re: SFML Light System - Let There Be Light
« on: June 04, 2013, 05:18:03 pm »
Hi There,

I tried this code:

        // LTBL
        ls = ltbl::LightSystem(AABB(Vec2f(0.0f, 0.0f), Vec2f(static_cast<float>(WIN_WIDTH), static_cast<float>(WIN_HEIGHT))), window.get(), "data/lightFin.png", "data/shaders/lightAttenuationShader.frag");

        ltbl::Light_Point* dLight = new ltbl::Light_Point();
        dLight->SetCenter(Vec2f(0.0f, 0.0f));
        dLight->SetRadius(750.f);
        dLight->m_size = 30.f;
        dLight->SetSpreadAngle(2.0f * static_cast<float>(M_PI));
        dLight->m_softSpreadAngle = 0.0f;
        dLight->CalculateAABB();

        ls.AddLight(dLight);

And i get this when compiling:

1>------ Build started: Project: Testing, Configuration: Release Win32 ------
1>  main.cpp
1>F:\SFML-2.0-x64\include\SFML/Graphics/Shader.hpp(521): error C2248: 'sf::NonCopyable::operator =' : cannot access private member declared in class 'sf::NonCopyable'
1>          F:\SFML-2.0-x64\include\SFML/System/NonCopyable.hpp(79) : see declaration of 'sf::NonCopyable::operator ='
1>          F:\SFML-2.0-x64\include\SFML/System/NonCopyable.hpp(42) : see declaration of 'sf::NonCopyable'
1>          This diagnostic occurred in the compiler generated function 'sf::Shader &sf::Shader::operator =(const sf::Shader &)'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Am i doing something wrong?

I'm using LTBL 5.1 + SFML 2.0

21
Graphics / Re: Drawing object with origin
« on: June 04, 2013, 02:01:42 pm »
Quote
so I set his origin to his position
Don't forget that the origin is relative to your sprite. If your image is 50x50 and you want the origin in the center of it then set it to (25, 25), even if the sprite has e.g. position (100, 100).

Is that what you were doing wrong?
If not then you should provide a small example code so that it is clear what you are doing.

Yes, i guess thats exactly what I'm doing.

Thank you, knowing that origin is taken from the top left corner of sprite and not from the window I changed
my origin to the correct position and now works as intended.

22
Graphics / Re: Drawing object with origin
« on: June 04, 2013, 01:12:13 pm »
I don't change it. I CREATE the sprite with a position and a origin, and then resize it.

I've read the tutorial in here:
http://www.sfml-dev.org/tutorials/2.0/graphics-transform.php

But I'm sure I didn't understand how origin and scale work :/

23
Graphics / Re: Drawing object with origin
« on: June 04, 2013, 01:02:48 pm »
I've got a Sprite which on resizing move's his origin.

I want to set its center in order to don't make it move when resizing, so I set his origin to his position
and then resize it.

Am I doing it wrong?

24
Graphics / [Solved]Drawing object with origin
« on: June 04, 2013, 02:35:24 am »
Hello,

I've got a sf::Sprite which I initialise with setOrigin instead of setPosition.

When I try to draw it to renderwindow, despite everything (origin and pos) are the correct,
the texture is drawn in top left corner (0, 0).

Is there something I'd to know when drawing sprites with setOrigin?

thanks!

25
General / Re: MSVS2012 and SFML After compiled problem
« on: May 26, 2013, 12:39:42 am »
Dude, you are my salvator, that was everything!!

Thank you very much. when i become rich with my game, ill build a golden statue in your honor.!!

26
General / [Solved] MSVS2012 and SFML After compiled problem
« on: May 26, 2013, 12:03:55 am »
Hello everyone,

I've just compiled my SFMl program using MSVS2012 and SFML.

As for MSVS, i used release configuration, turning down any debug options,
using the SFMl x86 include and lib folders, including all the libs into the linker
and including the dlls to the folder where the exe is.

Once I click th executable, I open it and play it perfectly, but when a friend
tries to open it in his computer, the SFML window opens but it keeps as a blank
window minimized into the window taskbar.

Since this friend has already installed every dependencie from MSVS (c++ redistributable and net framework)
I believe its something about how I compiled SFML or how I programmed SFML.

EDIT: IT was resolution

If there is something wrong there which is not allowing other people to run it
or if you have this matter before please tell me so I can solve it.

Thank you!

27
Graphics / Re: font.loadFromFile fails
« on: May 25, 2013, 08:39:29 pm »
Damn i forgot to add the -d to the lib includes.

Thanks, it was such an stupid error.

28
Graphics / [Solved] font.loadFromFile fails
« on: May 25, 2013, 08:20:13 pm »
Hello,

This is the snippet of code im using to load font:

sf::Font        font;
font.loadFromFile("arcade.ttf");

I have put the font in the same folder of the executable.

When I compile the program i get this output: http://screencloud.net/v/b2xj

I execute the exe through explorer, double clicking the executable.

I've ensure both are in the same directory, the cwd of the program when executed is the same
as the font. Everything is fine but I still get that.

Any way to solve this problem?

Thanks!

29
Graphics / Re: Split image in multiple sprites
« on: May 24, 2013, 11:52:52 pm »
Okay, thank you very much for help :)

Lets change the topic to solved

30
Graphics / Re: Split image in multiple sprites
« on: May 24, 2013, 10:15:22 pm »
Well, I just read this tutorial:

http://www.sfml-dev.org/tutorials/2.0/graphics-sprite.php

So what i basically have to do, is in these steps:

load texture from file.
to my sprite call sprite.settexture(texture)
and then call setTextureRect to cut the texture to only what i want to show.

Is this right?

Pages: 1 [2] 3
anything