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

Pages: [1] 2 3 4
1
System / Re: System tray program
« on: January 26, 2019, 11:02:22 pm »
[...]as it asks for a window handle, which I do not necessarily have in the process.
Maybe the problem you are having is that you haven't seen how to get the window from SFML:
window.getSystemHandle();
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Window.php#ad2fa6be5104ec0bfe79af7a5f524ea90

No, the program has no windows. However you are right in that a window is NECESSARY to use the windows api, even if that window isn't used for anything else and hidden from view.

2
System / Re: System tray program
« on: January 23, 2019, 06:00:39 pm »
Well I was also wondering if SFML would have support for this?

3
System / System tray program
« on: January 23, 2019, 05:45:09 pm »
Is there a way, for a process (no console) to interact with its system tray icon?

I've looked up information on microsoft docs:
https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-shell_notifyicona
https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/ns-shellapi-_notifyicondataa

But I don't understand how you would get notifications BACK from said API, as it asks for a window handle, which I do not necessarily have in the process.

4
Window / Re: Draw the window on top of other applications
« on: January 23, 2019, 11:46:51 am »
"BringWindowToTop()" does not work.

Instead,
"SetWindowPos(window.getSystemHandle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);"
should be used. I have no clue why setting the positions to 0 works, nor what the flags are. But it works.

5
Window / Re: Draw the window on top of other applications
« on: January 23, 2019, 11:36:20 am »
Because windows.h doesn't define those macros if the NOMINMAX preprocessor symbol is defined :)

#ifndef NOMINMAX
   #define min ...
   #define max ...
#endif

Sure, but how does that fix it? Does SFML define them too?

6
Window / Re: Draw the window on top of other applications
« on: January 23, 2019, 11:30:28 am »
windows.h defines the min and max macros.

The cleanest solution is to define the NOMINMAX preprocessor symbol in your project settings.

Thanks, that worked, tough I have no clue as to why.

7
Window / Re: Draw the window on top of other applications
« on: January 23, 2019, 11:03:17 am »
I'm running into errors:

When including <Windows.h> and <WinUser.h> along with <SFML/Graphics.hpp>, I get error C2589, "'(' illegal token on right side of '::'" in rect.inl.

Other errors that don't show up in output (in visual studio) include "Rect is not a template", "Vector2 is not a template".

I'm assuming this is a name clash due to improper namespace usage, but don't know how to fix it properly:

I've attempted doing "namespace nameShield { #include <SFML/Graphics.hpp> }", but then the compiler will error with ""nameShield::operator new" non-member operator new or delete functions may not be declared static or in a namespace other than the global namespace", and other very similar errors with new[], delete, round...

8
Window / Re: Draw the window on top of other applications
« on: January 23, 2019, 10:25:44 am »
Thanks.

As for it being obnoxious -it's a non-moveable window that is only meant to act as a "hud". It would be even better if I could make the background of the window semi-transparent so that it would cover even less space.

I do get that some apps can choose to make annoying pop-ups or games that will move themselves in front, but the feature is still useful when used properly.

And to be honest, I don't get the "don't add a feature because some people will misuse it", after all, c++'s mentality with the standard is quite the opposite: make hundreds of tools available to anyone, even if they end up misused.

Buuut I don't care about that, thanks again.

9
Window / Draw the window on top of other applications
« on: January 22, 2019, 11:03:14 pm »
Is there a way to draw a RenderWindow in front of all other windows?

So my program is running in the background, and wants to show something in a window -it would create one to do so, but that window will, in many cases, still be hidden behind other applications. Is there a way to make it show on top of all other applications?

10
Feature requests / Re: Add .setSmooth() for text
« on: December 19, 2018, 11:28:32 pm »
If you're using fonts, do what I did above.

If it still doesn't work, try .setSmooth(false) on your RenderTexture, or whatever it is you're drawing onto.

11
You need to do it yourself with custom vertex arrays and shaders.

Look more into 2d shadows



The basic idea is you draw the light (white zone) first, and then draw the black shadows on top.

12
Graphics / Re: Moving sprite using certain path
« on: November 26, 2018, 07:01:07 pm »
Move your sprite from A to B, and then from B to C.

I'd do it by adding a variable "last point reached", with the index in the vector of the point you started at (e.g. you start at A (0), go to B(1), then C(2)...)

The problem is that in "while loop" sprite instantly moves from one point to another. I want it to move smoothly to the next point.

A point (A, B...) is just two coordinates.

Let's say A has coordinates [aX, aY] and B has coordinates [bX, bY]:

The point between A and B (let's call it C) would have for coordinates:
[(aX + bX) / 2, (aY + bY) / 2]

[ A - - - | - - - | - - - | - - - | ]
[ | - - - | - - - C - - - | - - - | ]
[ | - - - | - - - | - - - | - - - B ]

If you want to get the point (let's call it D) between A and B, at 25% (distance between the point D and A is 25% of the length between A and B), D would have for coordinates:
[(aX * 75 + bX * 25) / 100, (aY * 75 + bY * 25) / 100]

[ A - - - | - - - | - - - | - - - | ]
[ | - - - D - - - | - - - | - - - | ]
[ | - - - | - - - | - - - | - - - | ]
[ | - - - | - - - | - - - | - - - B ]

Now if you want ANY point between A and B, at x% (x is a number between 0 and 100, where 0 means exactly over A and 100 means exactly over B), you would use this formula to get those coordinates:
[(aX * {100 - x} + bX * x) / 100, (aY * {100 - x} + bX * x) / 100]

If you use this formula a lot, you can (and should) use x between 0 and 1, replacing every "100" with "1" and remove the "/ 100" so you do less operations.

So if you want to smoothly move from A to B, you'd use this formula at different percentages. You'll always have "teleportation" (instantly moving), but it will be so small that it'll look very smooth:



MORE ADVANCED MATHS WITH SMOOTH CURVES
(click to show/hide)

13
Audio / Re: Streaming a custom format
« on: November 24, 2018, 11:16:05 pm »
There's a mistake in https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1SoundStream.php#details with the example:

You override "void onSeek(sf::Uint32 timeOffset)" instead of "void onSeek(sf::Time timeOffset)".

I got everything working tho

14
Audio / Re: Streaming a custom format
« on: November 24, 2018, 09:59:05 pm »
Ah, I didn't know a specialized stream class already existed, must've missed it on the tutorial. Thanks.

15
Graphics / Re: Only negative coordinates are showing up in the window
« on: November 24, 2018, 08:00:59 pm »
Allow me to steal an image from the only google image I could find:



The origin point for an object does not have to be its center. The object will rotate according to this point, and it (the origin point) may not even be INSIDE the object.

Ironically, you could look at blender tutorials to better understand origin points, as they are very similar in many different programs (photoshop, blender...) and the concept is the same in SFML as well.

Pages: [1] 2 3 4