C
Qt Quick Ultralite汽车集群演示
/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/#ifndef LIGHTS_H #define LIGHTS_H #include <stdint.h> namespace Simulation { class Lights { public: enum LightType { ParkingLights, LowBeamHeadlights, TurnLeft, TurnRight, LIGHTS_NUM }; Lights(); void update(uint32_t tick); void setLightState(LightType light, bool enabled, uint32_t duration = 0); bool getLightState(LightType light) const; private: void resetLight(LightType light, bool enabled = false); bool _lightStates[LIGHTS_NUM]; uint32_t _lightTimers[LIGHTS_NUM]; }; } // namespace Simulation #endif // LIGHTS_H