ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
asw::lighting::AmbientCycle Class Reference

Ambient colour that changes over a repeating cycle, such as a day. More...

#include <lighting.h>

Public Member Functions

 AmbientCycle (float length=1.0F)
 Create a cycle.
 
void add (float time, const asw::Color &color)
 Add a key colour. Colours between keys are blended.
 
asw::Color at (float time) const
 Get the colour at a time. Times past the length wrap around.
 
float get_length () const
 Get the length of one cycle.
 

Private Attributes

float length
 
std::vector< std::pair< float, asw::Color > > keys
 

Detailed Description

Ambient colour that changes over a repeating cycle, such as a day.

Definition at line 84 of file lighting.h.

Constructor & Destructor Documentation

◆ AmbientCycle()

asw::lighting::AmbientCycle::AmbientCycle ( float length = 1.0F)
explicit

Create a cycle.

Parameters
lengthLength of one cycle, in the same units as at().

Definition at line 125 of file lighting.cpp.

Member Function Documentation

◆ add()

void asw::lighting::AmbientCycle::add ( float time,
const asw::Color & color )

Add a key colour. Colours between keys are blended.

Parameters
timeWhen in the cycle, from 0 to the length.
colorThe ambient colour at that time.

Definition at line 130 of file lighting.cpp.

◆ at()

asw::Color asw::lighting::AmbientCycle::at ( float time) const

Get the colour at a time. Times past the length wrap around.

Parameters
timeThe time.
Returns
The blended colour, or black with no keys.

Definition at line 136 of file lighting.cpp.

◆ get_length()

float asw::lighting::AmbientCycle::get_length ( ) const

Get the length of one cycle.

Definition at line 162 of file lighting.cpp.

Member Data Documentation

◆ keys

std::vector<std::pair<float, asw::Color> > asw::lighting::AmbientCycle::keys
private

Definition at line 112 of file lighting.h.

◆ length

float asw::lighting::AmbientCycle::length
private

Definition at line 111 of file lighting.h.


The documentation for this class was generated from the following files: