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

Pages: [1] 2
1
Ahhh, thank you! That`s the problem!

2
Mh okay. But where do i have to use std::min/max? I thought that this code-example is as simple as it could be xD You are absolutely right, i use Windows Header in my project!

3
Now i tried the following combination of _A and _B:

        bool getIsMouseHover_C(int x, int y)
        {
                sf::FloatRect rect = m_shape.getGlobalBounds();
                return rect.contains(sf::Vector2f((float)x, (float)y));
        }
 

But also here i get errors on ".contains". Strange, eh...?  ;D

4
As of yet i never had problems with my installation of VS and using SFML. But of course it really could be a problem here locally on my pc if no one can reproduce this compiler-errors.

5
Hi FRex,

please see the attachet screenshot of Visual Studio 2017. Please excuse, that it`s german version - but i think you`ll get the point.

Regards,
Mathias

6
Graphics / Re: Text wrong display position
« on: January 24, 2018, 08:22:40 pm »
Hi,

did you tried this with different fonts? I never had this before.

Regards,
Mathias

7
Hi,

please take a look at these 2 functions:

private:
        sf::RectangleShape m_shape;

        bool getIsMouseHover_A(int x, int y)
        {
                sf::FloatRect rect = m_shape.getGlobalBounds();
                return (x >= rect.left && x < rect.left + rect.width && y >= rect.top && y < rect.top + rect.height);
        }

        bool getIsMouseHover_B(int x, int y)
        {
                return (m_shape.getGlobalBounds().contains((float)x, (float)y));
        }
 

While method "_A" works fine the method "_B" does not even compile on my Visual Studio 2017.
The compiler complains about Line #81 in sf::RectInl.
    // Compute the real min and max of the rectangle on both axes
    T minX = std::min(left, static_cast<T>(left + width));
 

What`s the reason for this? Did i miss something?

Regards,
Mathias

8
General / Re: .exe problem
« on: February 02, 2015, 07:15:31 pm »
Try to change your build setting to "Release". The missing exe problem occurs when there are wrong debug settings in VS.
If it works in Release Mode then you should try to make a new, clean project and dont touch the debugger settings then :-)

9
Graphics / Re: Zoom a sf::View to Mouse-Point Center?
« on: January 29, 2015, 08:45:21 am »
Thanks for all answers. And thank you Hapax for the Wiki Tutorial  :)

10
Graphics / Re: sf::Texture load from memory
« on: January 26, 2015, 11:55:46 pm »
Here`s how i load Textures which are stored as Resources in Visual Studio 2013 on Windows:

1. Add the images to resource.rc file:
IDR_TEXTURE0    RCDATA  ".\\..\\Graphics\\Texture0.png"
IDR_TEXTURE1    RCDATA  ".\\..\\Graphics\\Texture1.png"
IDR_TEXTURE2    RCDATA  ".\\..\\Graphics\\Texture2.png"
IDR_TEXTURE3    RCDATA  ".\\..\\Graphics\\Texture3.png"
 

2. Add them to resource.h file:
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#define IDI_ICON1 101
#define IDI_TEXTURE0 102
#define IDI_TEXTURE1 103
#define IDI_TEXTURE2 104
#define IDI_TEXTURE3 105
#define IDI_FONT0 106
#define IDI_FONT1 107
 

3. Load them in code:
        const int TEXTURES_COUNT = 4;
        sf::Texture textures[TEXTURES_COUNT];
        sf::Sprite sprites[TEXTURES_COUNT];
        for (int i = 0; i < TEXTURES_COUNT; i++)
        {
                std::wstring numString = L"IDR_TEXTURE" + std::to_wstring(i);
                HRSRC rsrcData = FindResource(NULL, numString.c_str(), RT_RCDATA);
                LPVOID firstByte = LockResource(LoadResource(NULL, rsrcData));
                textures[i].loadFromMemory(firstByte, SizeofResource(NULL, rsrcData));
                sprites[i].setTexture(textures[i]);
                textures[i].setSmooth(true);
        }
 

11
Graphics / Zoom a sf::View to Mouse-Point Center?
« on: January 26, 2015, 11:40:35 pm »
Hi,

i`m currently working on a synthesizer program where i can place my virtual devices on a virtual desktop, which i can Zoom and Pan:



This works fine now, thanks to the sf::View :D

But... if i Zoom-In with the Mousewheel i also would like to pan the whole virtual desktop to the Device where the Mouse points to.

At first i thought this would be simple, if i would set the View-Center to the current Mouse-Coordinates, but unfortunately this does not seem to work so simple (if i try it this way the whole desktop-panning flickers in all directions).

Please take a look at my attached screenshot and imagine that the user points the mouse over the Device "Grainshifter" and rotates the Mousewheel. In this case the virtual desktop not only should Zoom In - it also should scroll to the device where the mouse points to. I often see this behavior in similar programs but i have no idea how i could implement this (currently the Zoom works only with the Center-Point set to the center of the whole screen).

I also found a similar question in this forum, but it was not answered there.

Does someone have a idea how to implement this?

Please excuse my bad english :)

Regards,
M74

12
Graphics / Re: sf::View on sf::RenderTexture?
« on: January 25, 2015, 07:38:03 pm »
Oh no, i`ve already found what i did wrong. I forgot to set the Target as "Active" ::)
Sorry!

13
Graphics / sf::View on sf::RenderTexture?
« on: January 25, 2015, 07:28:57 pm »
Hi,

i tried the sf::View on a sf::RenderWindow and it works fine.
But when i try to use the View on a sf::RenderTexture it seems to not work.

Is this correct or do i something wrong?

Regards,
M74

14
Graphics / Re: "Cost" of flipping sprites?
« on: January 22, 2015, 11:59:36 pm »
Thank you  :)

15
Graphics / "Cost" of flipping sprites?
« on: January 22, 2015, 11:40:46 pm »
Hi,

i`ve read the topic of how to flip a sprite: http://en.sfml-dev.org/forums/index.php?topic=7572.0

I was wondering if this is some sort of unperformant if i have to flip a greater amount of sprites and better should provide also pre-flipped versions of my sprites in my Spritesheet(s) or is it negligable to flip/scale sprites?

Please excuse my english.

Regards,
M74

Pages: [1] 2
anything