Movatterモバイル変換


[0]ホーム

URL:


Loading...
Searching...
No Matches
Time.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <chrono>
31
32#include <cstdint>
33
34
35namespacesf
36{
41classTime
42{
43public:
50constexprTime() =default;
51
56template <typename Rep,typename Period>
57constexprTime(const std::chrono::duration<Rep, Period>& duration);
58
67 [[nodiscard]]constexprfloatasSeconds()const;
68
77 [[nodiscard]]constexpr std::int32_tasMilliseconds()const;
78
87 [[nodiscard]]constexpr std::int64_tasMicroseconds()const;
88
95 [[nodiscard]]constexpr std::chrono::microsecondstoDuration()const;
96
103template <typename Rep,typename Period>
104constexproperator std::chrono::duration<Rep, Period>()const;
105
107// Static member data
109// NOLINTNEXTLINE(readability-identifier-naming)
110staticconstTimeZero;
111
112private:
114// Member data
116 std::chrono::microseconds m_microseconds{};
117};
118
130[[nodiscard]]constexprTimeseconds(float amount);
131
143[[nodiscard]]constexprTimemilliseconds(std::int32_t amount);
144
156[[nodiscard]]constexprTimemicroseconds(std::int64_t amount);
157
168[[nodiscard]]constexprbooloperator==(Time left,Time right);
169
180[[nodiscard]]constexprbooloperator!=(Time left,Time right);
181
192[[nodiscard]]constexprbooloperator<(Time left,Time right);
193
204[[nodiscard]]constexprbooloperator>(Time left,Time right);
205
216[[nodiscard]]constexprbooloperator<=(Time left,Time right);
217
228[[nodiscard]]constexprbooloperator>=(Time left,Time right);
229
239[[nodiscard]]constexprTimeoperator-(Time right);
240
251[[nodiscard]]constexprTimeoperator+(Time left,Time right);
252
263constexprTime&operator+=(Time& left,Time right);
264
275[[nodiscard]]constexprTimeoperator-(Time left,Time right);
276
287constexprTime&operator-=(Time& left,Time right);
288
299[[nodiscard]]constexprTimeoperator*(Time left,float right);
300
311[[nodiscard]]constexprTimeoperator*(Time left, std::int64_t right);
312
323[[nodiscard]]constexprTimeoperator*(float left,Time right);
324
335[[nodiscard]]constexprTimeoperator*(std::int64_t left,Time right);
336
347constexprTime&operator*=(Time& left,float right);
348
359constexprTime&operator*=(Time& left, std::int64_t right);
360
371[[nodiscard]]constexprTimeoperator/(Time left,float right);
372
383[[nodiscard]]constexprTimeoperator/(Time left, std::int64_t right);
384
395constexprTime&operator/=(Time& left,float right);
396
407constexprTime&operator/=(Time& left, std::int64_t right);
408
419[[nodiscard]]constexprfloatoperator/(Time left,Time right);
420
431[[nodiscard]]constexprTimeoperator%(Time left,Time right);
432
443constexprTime&operator%=(Time& left,Time right);
444
445}// namespace sf
446
447#include <SFML/System/Time.inl>
448
449
constexpr Time operator-(Time right)
Overload of unary operator- to negate a time value.
constexpr float asSeconds() const
Return the time value as a number of seconds.
constexpr Time operator%(Time left, Time right)
Overload of binary operator% to compute remainder of a time value.
constexpr Time & operator*=(Time &left, std::int64_t right)
Overload of binary operator*= to scale/assign a time value.
constexpr Time microseconds(std::int64_t amount)
Construct a time value from a number of microseconds.
constexpr Time(const std::chrono::duration< Rep, Period > &duration)
Construct from std::chrono::duration
constexpr Time operator-(Time left, Time right)
Overload of binary operator- to subtract two time values.
constexpr Time operator*(Time left, std::int64_t right)
Overload of binary operator* to scale a time value.
constexpr Time & operator%=(Time &left, Time right)
Overload of binary operator%= to compute/assign remainder of a time value.
constexpr Time seconds(float amount)
Construct a time value from a number of seconds.
constexpr Time operator*(std::int64_t left, Time right)
Overload of binary operator* to scale a time value.
constexpr float operator/(Time left, Time right)
Overload of binary operator/ to compute the ratio of two time values.
constexpr bool operator!=(Time left, Time right)
Overload of operator!= to compare two time values.
constexpr std::int64_t asMicroseconds() const
Return the time value as a number of microseconds.
constexpr std::chrono::microseconds toDuration() const
Return the time value as a std::chrono::duration
constexpr Time operator/(Time left, std::int64_t right)
Overload of binary operator/ to scale a time value.
static const Time Zero
Predefined "zero" time value.
DefinitionTime.hpp:110
constexpr bool operator>(Time left, Time right)
Overload of operator> to compare two time values.
constexpr std::int32_t asMilliseconds() const
Return the time value as a number of milliseconds.
constexpr Time operator+(Time left, Time right)
Overload of binary operator+ to add two time values.
constexpr Time operator*(Time left, float right)
Overload of binary operator* to scale a time value.
constexpr bool operator<(Time left, Time right)
Overload of operator< to compare two time values.
constexpr Time & operator-=(Time &left, Time right)
Overload of binary operator-= to subtract/assign two time values.
constexpr bool operator<=(Time left, Time right)
Overload of operator<= to compare two time values.
constexpr Time & operator*=(Time &left, float right)
Overload of binary operator*= to scale/assign a time value.
constexpr Time()=default
Default constructor.
constexpr Time milliseconds(std::int32_t amount)
Construct a time value from a number of milliseconds.
constexpr bool operator==(Time left, Time right)
Overload of operator== to compare two time values.
constexpr Time operator*(float left, Time right)
Overload of binary operator* to scale a time value.
constexpr Time operator/(Time left, float right)
Overload of binary operator/ to scale a time value.
constexpr bool operator>=(Time left, Time right)
Overload of operator>= to compare two time values.
constexpr Time & operator/=(Time &left, std::int64_t right)
Overload of binary operator/= to scale/assign a time value.
constexpr Time & operator/=(Time &left, float right)
Overload of binary operator/= to scale/assign a time value.
constexpr Time & operator+=(Time &left, Time right)
Overload of binary operator+= to add/assign two time values.

[8]ページ先頭

©2009-2025 Movatter.jp