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

Pages: [1] 2
1
Network / Re: How to stop the socket blocking while it's being used?
« on: April 02, 2015, 06:01:33 pm »
I see. I might try to do it with the SocketSelector then. Well, I'll see. I get that it's potentially better, but I'd rather focus on other aspects for now. I'll note this down somewhere near this portion of the code and maybe change it up once I get a prototype of my server running.

Thank you for your time

2
Network / Re: How to stop the socket blocking while it's being used?
« on: April 02, 2015, 05:38:19 pm »
I'd rather have it blocking, since the non-blocking mode uses 6-7% of cpu during polling. (with an infinite while( true ) loop + no sleep)
Blocking stays at nice 0% and since I'm planning a rather resource intensive program, I don't want it to use any more resources than I absolutely need to.

I'll go with the hacky solution, just implemented it and works pretty much flawlessly. Thank you.

3
Network / How to stop the socket blocking while it's being used?
« on: April 02, 2015, 04:16:46 pm »
As the title says, I want to use the sf::UdpSocket in blocking mode, but I need to be able to register signals for exit, and as such I also need a way to set the socket to non-blocking mode, so I can return to the function that it's using it.

if( listenerSocket.receive(packet,clientAddress,port) != sf::Socket::Done || exitSignal )

This is the line that's stopping the program. Well, obivously, it's supposed to, since the socket is set to blocking.
So, everything here is fine and dandy.
Now, I'm trying to get another thread to change the socket's blocking mode, so I can close this function.

I tried just calling
listenerSocket.setBlocking(false);
from a different thread, but it doesn't seem to register it until it gets at least 1 packet while still in the blocking mode.
My question is, is there any other way to unblock this socket than just completely killing the thread it's running in?

4
Graphics / Re: sf::Font::getTexture(unsigned int) const() ?
« on: May 19, 2013, 12:14:48 pm »
Thanks, that did the trick ^^
Thanks for all the help guys

5
Graphics / Re: sf::Font::getTexture(unsigned int) const() ?
« on: May 18, 2013, 11:37:59 pm »
Woot, it's working, after sooooome rewriting and changing only 2 lines of code
But, I managed to find an extra bug in the algorithm, so that's something!
Question, how do I get a space in SFML? I want it to be properly sized, and for now I can only do stuff with pixels themselves...

6
Graphics / Re: sf::Font::getTexture(unsigned int) const() ?
« on: May 16, 2013, 08:29:16 pm »
Okay, thanks guys, I guess I'll just have to redo some code then

/edit:
So, I managed to change it around, now it's...
well, it's not crashing, that's for sure.
I need to check around to see what isn't working properly though

7
Graphics / Re: sf::Font::getTexture(unsigned int) const() ?
« on: May 16, 2013, 07:16:08 pm »
I did actually read that thread, the thing is, I don't think I could provide an example without changing about 200 lines of code.
I just commented out few lines, ran a debugger again, and had a crash with sf::Font::cleanup()
Uh, I could change it a little and give someone a link to the files from dropbox, if anyone is willing to take it for a test drive, in the meantime I'm going to change the font

8
Graphics / Re: sf::Font::getTexture(unsigned int) const() ?
« on: May 16, 2013, 08:19:05 am »
Any idea how could I check which one is wrong?
I'm already using a if( !loadingfont ) code to check if the font was actually loaded, and create sf::Text instances with default constructor and then setting string and character size...

9
Graphics / sf::Font::getTexture(unsigned int) const() ?
« on: May 15, 2013, 07:36:27 pm »
So, I'm working on a little project, the thing is, I have to auto-format sf::Text objects in a really simple matter
You're given a sf::FloatRect, all data needed is counted out, then each object depending from it's width and height is moved to it's position and so on

The problem I have is, when I'm done toying around with a vector of sf::Text * (objects created by new, all have the same font), and then trying to draw them to a sf::RenderWindow it throws out an error in the debugger as following

#0 669830B1   sf::Font::getTexture(unsigned int) const() (dir\sfml-graphics-2.dll:??)
#1 046305C8   ?? () (??:??)
#2 00000001   ?? () (??:??)
#3 04699FE8   ?? () (??:??)


Using one of the 'nightly' SFML 2.0 for MinGW32
Any ideas what could I do wrong? I'm kinda stuck...
The line causing all this crash is just a simple Window->draw( something ), so it's not really that worth showing, unless you think it is

10
Graphics / Re: One does not simply scale an object
« on: April 21, 2013, 10:08:45 pm »
I just want to scale an image to X/Y size, that's all.
Still, clearly SFML doesn't scale it properly, that's the problem

11
Graphics / Re: One does not simply scale an object
« on: April 19, 2013, 09:04:50 am »
Still, I don't want to use sf::View, it just won't do, I have to repeat this with too many objects at the same time, it just simply won't work
I just need a way to fix the scaling of the objects on the window without affecting the view/resetting it

12
Graphics / Re: One does not simply scale an object
« on: April 19, 2013, 07:10:46 am »
Won't sf::View affect the whole screen though? I only want to manipulate a set images of sprites by setting their position and size, the thing is that they don't show up correctly
If you'd look in the link I posted, you could see there are 2 rectangles, their size, as they give me the output, is 26something x 399
The window is 800 h, so it's not exactly working as it should, since the second object should fit in there too

13
Graphics / One does not simply scale an object
« on: April 18, 2013, 10:22:15 pm »
Let's get straight to the problem, I'm writing my simple project thingie, I came up with an idea to split the screen in more separate containers, it kinda works, except of vertical, wanna help me out here?
http://i.imgur.com/1pC9XeI.png is the graphical way to show you what it looks like
Counting out areas for 1
Area data - l = 533 t = 1 h = 599 w = 799
Vertical split = 399
Pushing L = 533 T = 1 W = 799 H = 400
Pushing L = 533 T = 400 W = 799 H = 799
0 L = 533 T = 1 W = 799 H = 400
1 L = 533 T = 400 W = 799 H = 799
Area L = 533 T = 1 W = 799 H = 400
Setting size at 266x399
Area L = 533 T = 400 W = 799 H = 799
Setting size at 266x399
Size = 1.70513x2.8913
Size = 1.70513x2.8913
 
The data it's using, the image is 156x138
The X scale = 1.70513, as you can read it, Y scale is = 2.8913
So... what's wrong?
Well, technically, nothing
Except that window that's on the image has 800 pixels
If the height of each image is 400, how is the second one coming out of the window?

sprite->setPosition( this->Area.left, this->Area.top );
                const sf::Texture *vectemp = sprite->getTexture();
                sf::Vector2u vec = vectemp->getSize();
                sprite->setScale(( ( this->Area.width - this->Area.left)  / vec.x ), ( ( this->Area.height - this->Area.top ) / vec.y ));
                std::cout << "Setting size at " << this->Area.width - this->Area.left << "x"
                << this->Area.height - this->Area.top << std::endl;

Ideas?

14
General / Re: Help needed, crashing problem SFML 2.0 + C::B
« on: December 30, 2012, 08:02:07 pm »
No, I didn't recompile it, I had no idea it had to be recompiled for newer versions...

I'll grab your compilled one, I only compilled libraries once...

Edit: It works perfectly, thanks a lot~
It really should be mentioned by the download section that RC is incompatible with 4.7.x gcc though...

15
General / Help needed, crashing problem SFML 2.0 + C::B [Solved]
« on: December 30, 2012, 07:34:04 pm »
Hello, and sorry for having to bother you with my problems, it's just that I really want to do something creative and the time SFML-2 actually wanted to work with me without problems passed
I'd really could use some help

I tried to compile a simple hello-world from the tutorial for 2.0, everything worked flawlessly (after I figured out my linking problem) and when it's starting it's instantly crashing with the window showed in attachments and
Quote
Process terminated with status -1073741510
Please, help me somehow...

Windows 7-32bit Code::Blocks 12.11 MinGW-TDM-GCC-4.7.1-32bit



[attachment deleted by admin]

Pages: [1] 2
anything