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

Pages: [1] 2
1
Graphics / Check if line intersects shape
« on: December 13, 2016, 02:37:31 am »
I have a a sf::VertexArray that makes a line, and I have a shape(sf::Shape).

How can I check if the line goes through the shape?

Note though because I am using the sf::Shape class and not a specific shape so I would prefer to only use getPoint() and getPointCount() to do it

This is for lighting so it is very important that I don't use a rectangle. The reason I want to do this is to find where the light needs to stop being drawn(I have it as a mask over the world), which is when the light intersects an object. If you know a better way to do this please tell me!

2
General / Re: How to calculate a field of view?
« on: December 12, 2016, 10:00:17 pm »
After I read it, I still have a question: How would I detect the corners of objects?

3
General / Re: How to calculate a field of view?
« on: December 12, 2016, 09:49:49 pm »
This is exactly what I wanted, thanks!

4
General / How to calculate a field of view?
« on: December 12, 2016, 09:40:19 pm »
This isn't really an SFML question, more of an algorithm/physics one. I'm wondering how I would be able to make a 'field of view' for a top down player. More specifically, This is how I think I would do it:


  • Draw aseries of lines between two angles on each side of the player until it hits a solid object
  • Change the colour of/brighten everything between these lines(like a flashlight)

The problem with the above is:
I don't know how I would get all the pixels between the lines, and I'm not sure how I would draw a lines that are stopped when it hits a pixel which is 'solid'(Or how I would add this property to all the pixels).

A baldy drawn example of the effect I'm trying to achive here:  http://imgur.com/a/9NDBq

Any help

5
General / Re: Tilemap - pixel big gaps
« on: April 30, 2016, 07:19:18 pm »
There is no purpose., it was just to be doubly sure it is a whole number.


the documentation says:
"The object's position, origin and scale have no fractional part
The object's and the view's rotation are a multiple of 90 degrees
The view's center and size have no fractional part"

I have all of these things. It does not mention aligning it to the window size, and I don't understand what that means.

6
General / Re: Tilemap - pixel big gaps
« on: April 30, 2016, 05:58:25 pm »
        //Window
        _settings.antialiasingLevel = 8;
        _window.create(_gameBorder, "Game", sf::Style::None, _settings);
        _window.setVerticalSyncEnabled(true);
        //Set window to be visible
        _window.setPosition(sf::Vector2i(_window.getPosition().x, _window.getPosition().y -_screenBorder.height*0.02));
 

        _view.setSize(sf::Vector2f(std::floor(32*5),std::floor(32*5) ) );
 

void GameEngine::updateView()
{
        _view.move(1, 1);
        _view.setSize(std::floor(_view.getSize().x), std::floor(_view.getSize().y));
        _view.setCenter(std::floor(_view.getCenter().x) , std::floor(_view.getCenter().y) );
        _window.setView(_view);
}

Here is all of the relevant code(I think?). What do you mean by align it to the window?

7
General / Re: Tilemap - pixel big gaps
« on: April 30, 2016, 05:41:47 pm »
Yes, if you look at my gameEngine.cpp at the bottom, you can see that I have made sure to round all values

8
General / Tilemap - pixel big gaps
« on: April 30, 2016, 04:47:41 pm »
Whenever I use a view, I'm getting gaps like this http://imgur.com/v3WZZ0V

I've tried rounding everything - adding 0.375 and taking away 0.075 - Nothing works!

http://pastebin.com/X0926NQx - my gameEngine.cpp(view handling at the bottom)
http://pastebin.com/S9Wt05ZN - my TileMap.cpp(problem possibly at line 100?)

9
General / Re: Need help with tile map
« on: April 27, 2016, 03:03:31 pm »
http://imgur.com/3oXA8l5 - here is my tileset.png - as you can see it has tiles going right, and variation of each tile going downward.

My plan was for each tile(e.g. GRASS) it pick a random one of the variations and use that.

instead for each tile it gets, it prints the tile, and then everything below that tile(including transparency)

10
General / Need help with tile map
« on: April 26, 2016, 10:42:34 pm »
Hello everyone! I made a tile map with the tutorial a while back, I've been trying to make a "CreateVariation()" function, that goes downwards for different versions of the same tile, and randomly picks one.

This doesn't seem to be working, it seems to be printing on the screen the whole thing downwards and not just the one tile.

http://imgur.com/Xl8AHF0 this is the result when compiled

https://github.com/jdm1891/games this is the source code - I believe the problem is the texture rect made

The tilemap function that creates the tile map is line 46 of tileMap.cpp - I believe the problem is there

any help would be lovely thank you!

11
General / Re: Linking staticly
« on: April 18, 2016, 10:52:08 pm »
Nevermind people, I fixed it. I forgot to link dependencies!

12
General / [Solved] Linking staticly
« on: April 18, 2016, 09:46:00 pm »
I have been linking SFML dynamicly, and decided to change it- but I can't.

I have set SFML_STATIC, and I am using the -s version of the libraries

My IDE is visual studio 2015

This is the error I get when I try to compile:

1>sfml-window-s.lib(GlContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__glEnable@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glEnable@4
1>sfml-window-s.lib(GlContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetError@0
1>sfml-graphics-s.lib(GLLoader.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetError@0
1>sfml-graphics-s.lib(Shader.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetIntegerv@8
1>sfml-window-s.lib(GlContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetIntegerv@8
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetIntegerv@8
1>sfml-graphics-s.lib(TextureSaver.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetIntegerv@8
1>sfml-graphics-s.lib(GLLoader.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetIntegerv@8
1>sfml-window-s.lib(GlContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetString@4
1>sfml-graphics-s.lib(GLLoader.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetString@4
1>sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
1>sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
1>sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__wglGetCurrentContext@0
1>sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__wglGetProcAddress@4
1>sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
1>sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__wglShareLists@8
1>sfml-window-s.lib(JoystickImpl.cpp.obj) : error LNK2001: unresolved external symbol __imp__joyGetPosEx@8
1>sfml-window-s.lib(JoystickImpl.cpp.obj) : error LNK2001: unresolved external symbol __imp__joyGetDevCapsW@12
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glFlush@0
1>sfml-graphics-s.lib(Shader.cpp.obj) : error LNK2001: unresolved external symbol __imp__glFlush@0
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGetTexImage@20
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glLoadMatrixf@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glLoadMatrixf@4
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glTexImage2D@36
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glTexParameteri@12
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glBindTexture@8
1>sfml-graphics-s.lib(TextureSaver.cpp.obj) : error LNK2001: unresolved external symbol __imp__glBindTexture@8
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glCopyTexSubImage2D@32
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glDeleteTextures@8
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glGenTextures@8
1>sfml-graphics-s.lib(Texture.cpp.obj) : error LNK2001: unresolved external symbol __imp__glTexSubImage2D@36
1>sfml-graphics-s.lib(RenderWindow.cpp.obj) : error LNK2001: unresolved external symbol __imp__glReadPixels@28
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glBlendFunc@8
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glClear@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glClearColor@16
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glDisable@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glPopAttrib@0
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glPopMatrix@0
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glPushAttrib@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glPushMatrix@0
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glViewport@16
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glColorPointer@16
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glDrawArrays@12
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glEnableClientState@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glPopClientAttrib@0
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glPushClientAttrib@4
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glTexCoordPointer@16
1>sfml-graphics-s.lib(RenderTarget.cpp.obj) : error LNK2001: unresolved external symbol __imp__glVertexPointer@16
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_std_error
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_CreateCompress
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_destroy_compress
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_stdio_dest
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_set_defaults
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_set_quality
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_start_compress
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_write_scanlines
1>sfml-graphics-s.lib(ImageLoader.cpp.obj) : error LNK2001: unresolved external symbol _jpeg_finish_compress
1>sfml-system-s.lib(SleepImpl.cpp.obj) : error LNK2001: unresolved external symbol __imp__timeGetDevCaps@8
1>sfml-system-s.lib(SleepImpl.cpp.obj) : error LNK2001: unresolved external symbol __imp__timeBeginPeriod@4
1>sfml-system-s.lib(SleepImpl.cpp.obj) : error LNK2001: unresolved external symbol __imp__timeEndPeriod@4

13
General / Re: Creating array from image
« on: April 18, 2016, 09:44:10 pm »
Everyone thanks for the help!

I managed to fix the code(I had x&y coords mixed up)

14
General / Re: Creating array from image
« on: April 17, 2016, 04:28:07 pm »
Maybe I am misunderstanding?

I am comparing colours on the line
image.getPixel(i,j) == mapToColor[TileID::GRASS]
where mapToColor[TileID::GRASS] is equal to sf::Color(0, 255, 0, 255]

I am somewhat familiar with what you mentioned, but from what I know you can only declare them in the class? in this case that would be the sf::Color class

15
General / Re: Creating array from image
« on: April 17, 2016, 03:42:52 pm »
So is there anyway to fix that? without editing the sfml code

Pages: [1] 2
anything