Loading...
Searching...
No Matches
MouseEvents.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// Created by Dave R. Smith on 3/3/25.
6//
7
8#ifndef MALENA_MOUSEEVENTS_H
9#define MALENA_MOUSEEVENTS_H
10
11#pragma once
12
14#include <SFML/Graphics.hpp>
15
16namespace ml
17{
38 {
39 public:
52 template<typename T>
53 static bool isHovered(const T& obj, const sf::RenderWindow& window)
54 {
55 return isHovered(obj.getGlobalBounds(), window);
56 }
57
68 static bool isHovered(const sf::FloatRect& bounds, const sf::RenderWindow& window);
69
82 template<typename T>
83 static bool isClicked(const T& obj, const sf::RenderWindow& window)
84 {
85 return isClicked(obj.getGlobalBounds(), window);
86 }
87
99 static bool isClicked(const sf::FloatRect& bounds, const sf::RenderWindow& window);
100 };
101
102} // namespace ml
103
104#endif // MALENA_MOUSEEVENTS_H
Static helpers for mouse hit-testing against framework objects.
Definition MouseEvents.h:38
static bool isClicked(const sf::FloatRect &bounds, const sf::RenderWindow &window)
Return true if the left mouse button is held over a rect.
static bool isHovered(const sf::FloatRect &bounds, const sf::RenderWindow &window)
Return true if the mouse is currently over a rect.
static bool isHovered(const T &obj, const sf::RenderWindow &window)
Return true if the mouse is currently over a framework object.
Definition MouseEvents.h:53
static bool isClicked(const T &obj, const sf::RenderWindow &window)
Return true if the left mouse button is held over a framework object.
Definition MouseEvents.h:83
#define MALENA_API
Definition Component.h:22
Rect< float > FloatRect