Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: MouseWheel ..  (Read 7297 times)

0 Members and 1 Guest are viewing this topic.

HeinzK

  • Newbie
  • *
  • Posts: 41
    • View Profile
    • ZwiAner
    • Email
MouseWheel ..
« on: September 09, 2014, 11:15:08 am »
deleted
« Last Edit: December 04, 2019, 08:31:36 am by HeinzK »
The trees, that obstruct the view on the forest, can be allowed to fall! (Die Bäume, die die Sicht auf einen Wald versperren, dürfen gefällt werden!)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: MousWheel ..
« Reply #1 on: September 09, 2014, 11:31:02 am »
can we see how you get the event (basically, the event switch)?
SFML / OS X developer

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: MousWheel ..
« Reply #2 on: September 09, 2014, 01:16:35 pm »
You should read the tutorial again and learn how to use an union type.
SFML / OS X developer

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: MouseWheel ..
« Reply #3 on: September 09, 2014, 04:16:53 pm »
a) what do you mean? I see no mouse move here. You get the position of the mouse when the wheel was actioned as well as the 'ticks'.

b) because it wouldn't make sense.
SFML / OS X developer

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: MouseWheel ..
« Reply #4 on: September 09, 2014, 04:56:58 pm »
a) .. 180 172 160 140 107 65 11 .. are mousemove in 'delta' (the wheel is not in use!) .. look at IMG.

Because....

You should read the tutorial again and learn how to use an union type.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: MouseWheel ..
« Reply #5 on: September 09, 2014, 04:59:36 pm »
event.mouseWheel.delta is the number of click the mouse wheel has scrolled. It's expressed in delta because the wheel has no state. It's basically "the mouse wheel has scrolled 2 times in the positive direction" if you get 2 or "the mouse wheel has scrolled 1 time in the negative position" if you get -1.
It is supposed to be used inside the event loop, only when the current event type is a MouseWheelMoved event. If you're reading these values outside of this, it's wrong.
It is in no way related to the mouse position or mouse movement. However there are x and y in MouseWheelMoved event, to know where the mouse was when this mouse wheel event was triggered.

The code you posted is not real code and is weird, what's the point?
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "...");
    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed) {
                window.close();
            }
            if (event.type == sf::Event::MouseWheelMoved) {
                std::cout << "wheel movement: " << event.mouseWheel.delta << std::endl;
                std::cout << "mouse x: " << event.mouseWheel.x << std::endl;
                std::cout << "mouse y: " << event.mouseWheel.y << std::endl;
            }
        }

        window.clear();
        window.display();
    }
    return 0;
}
It's hard to believe that with more than 80 posts and 2 years here you don't know how to properly use events, are you trolling?

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: MouseWheel ..
« Reply #6 on: September 09, 2014, 07:11:05 pm »
It's hard to understand you. :p
Make SURE you only read mouse wheel event values inside the event loop when the event type is a mouse wheel event.

 

anything