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

Pages: [1]
1
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


2
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?

3
Network / UdpSocket.receive() sets passed Ip and port to 0.
« on: March 19, 2021, 08:48:54 pm »
Hello! I'm sorry my english can be bad sometimes. I'm having a problem, when
IpAddres ip;
unsigned int port;
objects passed to a
udpSocket.receive(packet, ip, port);
turns out to be == 0
It happens in this part of code(this code lives in while(true) loop)

ClientsVec stores clients with their  ip, UdpSocket and port, so that thay can be used further to send and receive data. All the sockets are
.setBlocking(false)
.
As you can see before hitting the line with
receive()
ip is valid.
Than
.receive()
returns whatever but not
Socket::Status::Done
because nothing was sent, so that body stays not executed. And all above is undertandable by me.
But as soon as
.receive()
gets executed:


Also I understand that receive() takes as parameters adresses of Ip and port variables -
.receive(&packet, &Ip, &port);
so it can do whatever it wants with these var-s.
But I can not understand what conditions makes this method reset these variables, and why it happens. Also source code of a UdpSocket is too hard for my to understand, because I'm not experienced.
I will be really happy if someone will give me some advice :)




Pages: [1]