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

Pages: [1]
1
Graphics / Re: Render Texture with a View
« on: July 31, 2020, 09:19:15 am »
I did not post code originally cause I am working with Box2D as a physics engine, and even the code that isn't part of that is pretty much a whole spaghetti
What I m doing is first constructing a convex shape, and on its points i am drawing Quads.
First i draw on the screen a completely brown RenderTexture (that works perfectly fine) then i draw the convex shape onto another RenderTexture, and then everything with the Quads i draw on the RenderWindow.
It is supposed to look like a cave.
My problem is, as it is on the image (i hope i attached it perfectly), that after i move the RenderTextures stay in place. Moving the sprites with the view works for the brown background, but not for the darker background of the cave (image 2 and 3).

What I think my problem is:
The RenderTexture does not move with the view and so the relative position of the convex shape is allways the same

I may missunderstand how RT-s work, but what I think my goal is and how it is supposed to work, that it fills the view, and moves with it.

I hope I could explain it, english is not my first language, sorry if I am not really clear.

2
Graphics / Re: Render Texture with a View
« on: July 30, 2020, 06:23:11 pm »
Yes I am drawing it to the same position everytime, however that is not the problem.

My goal is to "cut" through a black RenderTexture with shapes, for lighting, and currently it works great on the first frame. But when i move my view the RenderTexture does not seem to "move" with it, because it still shows the "cut" on the first fram, even tough i clear redraw and display every frame. So I think my Problem is that the render texture is assigned to the RenderWindow and not my current view. (I set the View)

3
Graphics / Render Texture with a View
« on: July 30, 2020, 03:51:12 pm »
I can not really figure this out on my own so please help me guys.
In my little "game" i draw stuff to my render window, and if I move the view, it just works like it is supposed to.
But if i draw things to a RenderTexture (clear, draw, display), then load the texture into the sprite then draw the sprite on the window, the RenderTexture stays in place like every other object.
Is there a way I can make the RenderTexture to allways cover my view?

thanks in advance

4
Graphics / Re: PixelPicking with sf::Image
« on: May 21, 2020, 11:27:01 am »
Figured it out!

In case someone, a beginner like me does not know, the "==" operator does not set a color in sf::Color, it compares colors, so my attempt, to set the variable "pixelColor" as the color of the current pixel the loop is looking at failed allways.

5
Graphics / PixelPicking with sf::Image
« on: May 21, 2020, 09:28:51 am »
I am pretty sure I am missing something, but I have been Google-ing this for the last week.
My problem is, that the underneath can not find any pixels Blue (0, 0, 255), and I have absolutely no idea why it is not working. :(

Little explanation:
startingCave is the name of the Image
what I am trying to achive, is that with the two for loops, the code should go through the image row by row and everytime it finds a blue pixel it should set the if statement true


        Vector2f globalCurrentPos;
        sf::Color pixelColor;

        for (int y = 0; y < startingCave.getSize().y; y++) {
                for (int x = 0; x < startingCave.getSize().x; x++) {

                        globalCurrentPos.x = originDirt.x + x ;
                        globalCurrentPos.y = originDirt.y + y ;

                        pixelColor == startingCave.getPixel(x, y);
                        if (pixelColor == sf::Color(0, 0, 255)) {
                                //createDirt(world, globalCurrentPos);

                                debugText.setString("found");
                        }
                }
        }

6
Graphics / Sprite under PNG
« on: May 04, 2020, 02:55:22 pm »
I want to check if a sprite is under another sprite's transparent part (textured with a png). I haven't really found a solution, is this even possible in SFML?

7
Graphics / Sprite under Sprite
« on: May 04, 2020, 08:13:01 am »
I want to check if a sprite is under another sprite's transparent part (textured with a png). I haven't really found a solution, is this even possible in SFML?

8
Graphics / Sprite under PNG
« on: May 03, 2020, 03:09:25 pm »
Is there a way to check if a sprite is under the transparent part of another sprite (with a png)?

9
Graphics / Sprite under PNG
« on: May 03, 2020, 03:08:00 pm »
Is there a way to check if a sprite is under the transparent part of another sprite (with a png)?

10
Graphics / Sprite under PNG
« on: May 03, 2020, 03:07:36 pm »
Is there a way to check if a sprite is under the transparent part of another sprite (with a png)?

11
Graphics / Sprite under PNG
« on: May 03, 2020, 03:06:25 pm »
Is there a way to check if a sprite is under the transparent part of another sprite (with a png)?

12
Graphics / Sprite under PNG
« on: May 03, 2020, 03:04:49 pm »
I am having truble findig a solution:
Is there a way to check if a sprite is under the transparent part of a png texture? (I mean if it is visible under it)

Pages: [1]
anything