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

Pages: [1] 2
1
Network / Re: My Issue with TcpListener listen() method
« on: May 01, 2021, 08:23:15 pm »
Ohhhh, I see now! Thank you so much ;D, I hate when i dont know what is happening and I must just leave it. But now I know. Тow my question is settled)

2
Graphics / Re: Viewporting the Viewport?
« on: April 28, 2021, 02:45:26 pm »
Alternatively you can use scissor testing, by grabbing this branch, (rebasing) and building SFML yourself.

Yeah, I readed whole "Added support for clipping masks (Implements #1)" merge request brunch, I hope you guys will add it in some time in future. But I'm pretty newbie, as I understand "rebasing" means mooving  master brunch on top of the branch with future, so that now build will now have that future. Is this right? Anyways I think Im not familiar enough to do that, and I checked sf::RenderTexture's API as kojack wrote

Another way would be use a render texture of the desired size. You can scroll it around using a view, then render it onto the screen where the viewport was. You could then also render it into another render texture that is also scrolling, etc.
(Could also save a bit on rendering by only redrawing into the render textures if something changed)

And I think that'll do. At least I will try to use RenderTexture and if It will work, ill post results here. Thank you very much for ideas guys, you are awesome. ;D

3
Graphics / Viewporting the Viewport?
« on: April 27, 2021, 06:14:05 pm »
Hello! I'm making a user interface for my game(I want to do it by myself so I get more programming expirience). It's going ok but I have a problem that I can not resolve for long time. So as you can see in the video, I made some kind of scrollable window(this particular window will show up information about choosed item), and those black squares(its buttons for testing ;D ) are smoothly disappearing on the edge of the window. For this effect ViewPort was used. Im drawing these buttons to the separate view, than setting viewport so that it matches position of window and its size. And then when wheel is scrolled, or bar is mooved this viewPorted view is mooving up and down like so
windowView.move(0, +- step);
My problem is that I want to put, let's say, such window inside other window. So that Im kind of want to draw viewPort to other view. But as I understand viewPorts are drawn on the only default view of a target window, so its not really possible to put one "inside" another. Can someone help me if Im missing something? Maybe its dumb idea to use ViewPort for such task, and maybe it is other ways to "crop" content like this? Or maybe I actually can draw one ViewPort to other views? I will be happy to hear any advice. Also sorry for my horrible english. :P


4
Network / Re: My Issue with TcpListener listen() method
« on: April 27, 2021, 05:32:54 pm »
I educated myself, thank you guys :D

5
Network / My Issue with TcpListener listen() method
« on: March 24, 2021, 03:07:05 pm »
Hello! I'll be happy if someone will share their thought with me about this
Basically when
listen(unsigned short port);
is called like this
class C
{
        TcpListener l;
public:
        C() { l.listen(53000); };
};

C c;

int main()
{
        return 0;
}      
it prints in console
Failed to create socket

but if it's called like this
class C
{
        TcpListener l;
public:
        C() { l.listen(53000); };
};

int main()
{
        C c;
        return 0;
}
it's all good. Only difference I'm spotting is that in second variant, call is inside the main(). I want to know why is that happening, maybe I'm missing something. And is it connected with location like I noticed?

6
SFML projects / Re: Candle - 2D basic lighting for SFML
« on: March 24, 2021, 02:47:01 pm »
That sounds pretty cool, i should check it out.

7
SFML projects / Re: Tank Island V0.6
« on: March 21, 2021, 03:51:29 pm »
Oke, I'll keep you updated;D

8
SFML wiki / Re: Rectangular Boundary Collision
« on: March 21, 2021, 01:43:53 pm »
That is cool. ;D Did something like that time ago. But i did so that shapes are made of triangles, so that you can check if any point is inside of a triangle using something like that
float sign (fPoint p1, fPoint p2, fPoint p3)
{
    return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
}

bool PointInTriangle (fPoint pt, fPoint v1, fPoint v2, fPoint v3)
{
    float d1, d2, d3;
    bool has_neg, has_pos;

    d1 = sign(pt, v1, v2);
    d2 = sign(pt, v2, v3);
    d3 = sign(pt, v3, v1);

    has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0);
    has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0);

    return !(has_neg && has_pos);
}
And so you can construct any shapes out of these triangles, and make complex hitboxes. Will be sweet if you will add such a feauture. ;)

9
Graphics / Re: Loadimage not working "Failed to load image"
« on: March 21, 2021, 01:06:09 pm »
Man if you think that something is stupid it doesn't mean that it is. Got to be patient.
And to the problem, you need to set dependencies for both Debug and Release configuration. That means that when you go to project properties you need to set paths to SFML/lib and SFML/include for BOTH Debug and Release configurations. Just switch them using dedicated field and set needed paths again.  And don't forget about additional dependencies! They will be different for Debug and Release configuration, how to do this correctly explained here https://www.sfml-dev.org/tutorials/2.5/start-vc.php
As I remember if it's release then you need add "-s" to depensencie, if debug - "-s-d". Just read that article carefully, its all you need.

10
SFML projects / Re: Tank Island V0.6
« on: March 21, 2021, 12:54:08 pm »
Hey by the way, I'm currently writing client-server-client kind of architecture, for fast-pased games using udp sockets. I'm currently have all the mechanics working, server handles endless clients(as much as memory and sockets count will allow), and currently I'm wraping all this system in one class-interface for both client and server. Maybe when I'll be done we can try test my system by bringing multiplayer in your game using my work? I try to make the system easy to embed, so it's should pretty easy to get started. You interested?

11
SFML projects / Re: Tank Island V0.6
« on: March 21, 2021, 10:21:29 am »
Is this a huge worm - eater of worlds?! :o

12
General / Re: How to use SFML with x64
« on: March 20, 2021, 01:07:05 pm »
Go to project properties, choose platform x64 and then link in lib and include folders of x64bit sfml, and don't forget about additional dependencies. Pretty much redo thishttps://www.sfml-dev.org/tutorials/2.5/start-vc.php but for platform x64

13
Network / Re: UdpSocket.receive() sets passed Ip and port to 0.
« on: March 20, 2021, 12:54:23 pm »
Hey, so I finally understand - when I'm receieving something from non-blocking socket, I'm passing temporary Ip and port variables.
IpAddress tempIp = serverIp;
Uint16 tempPort = dataServerPort;
if (dataSocket.receive(rPacket, tempIp, tempPort) == Socket::Status::Done)

Thank you very much for help, cant wait for 2.6.0 ;D

14
SFML projects / Re: Candle - 2D basic lighting for SFML
« on: March 20, 2021, 10:31:25 am »
Hey that looks cool. But can i choose refresh rate of the light? For example make it update 10 per second?

15
Network / Re: UdpSocket.receive() sets passed Ip and port to 0.
« on: March 19, 2021, 11:04:36 pm »
You know, I done my client server architecture using selector, such a usefull thing, and everything worked great, but you see: I wanted my server to receive at any time, as soon as possible(and for this job selector is perfect) but also I wanted my server to send data to every client using some time rate, for example - every 100 milliseconds. So you see, in server's while(true) cycle if I'm using selector to receive - its blocking my sendings. Of course I can set selector wait time something like 10 milliseconds, so that sendings can come through.... But wait, can selector be not blocking? Maybe I'just missed that selector actually can to not block execution?

Pages: [1] 2