NWengine 0.9
Loading...
Searching...
No Matches
AudioEmitter.h
1#pragma once
2#include "GameObject.h"
3#include "Audio.h"
4
8class AudioEmitter : public GameComponent {
9public:
14 static std::string GetType() { return "AudioEmitter"; };
15
20
26
31
36 void SetSound(const std::string& path);
37
42 void SetSound(const Sound* snd);
43
48
52 Sound* sound = nullptr;
53
57 int volume = 100;
58
62 float frequency = 1.0f;
63
67 bool isLooping = false;
68
75 int Serialize(std::fstream* data, int offset) override;
76
83 int Deserialize(std::fstream* data, int offset) override;
84
88 static std::map<GameObject*, AudioEmitter*> componentList;
89};
Contains the declaration of the Audio class and related structures.
Defines the GameObject class and its related components.
The AudioEmitter class represents a component that emits audio in a game object.
Definition AudioEmitter.h:8
float frequency
frequency The frequency of the AudioEmitter.
Definition AudioEmitter.h:62
bool isLooping
isLooping Indicates whether the AudioEmitter is looping or not.
Definition AudioEmitter.h:67
GameObject * attachedObj
attachedObj The game object that the AudioEmitter is attached to.
Definition AudioEmitter.h:47
int Deserialize(std::fstream *data, int offset) override
Deserialize deserializes the AudioEmitter data.
Definition AudioEmitter.cpp:52
AudioEmitter()
AudioEmitter constructor.
Definition AudioEmitter.h:19
int Serialize(std::fstream *data, int offset) override
Serialize serializes the AudioEmitter data.
Definition AudioEmitter.cpp:37
Sound * sound
sound The sound object of the AudioEmitter.
Definition AudioEmitter.h:52
~AudioEmitter()
AudioEmitter destructor.
Definition AudioEmitter.cpp:11
int volume
volume The volume of the AudioEmitter. Should be clamped from 0.0 to 1.0.
Definition AudioEmitter.h:57
static std::map< GameObject *, AudioEmitter * > componentList
componentList A map of game objects and their corresponding AudioEmitter components.
Definition AudioEmitter.h:88
void SetSound(const std::string &path)
SetSound sets the sound path for the AudioEmitter.
Definition AudioEmitter.cpp:18
static std::string GetType()
GetType returns the type of the AudioEmitter component.
Definition AudioEmitter.h:14
Base class for game components.
Definition GameObject.h:29
Class representing a game object.
Definition GameObject.h:68
Represents a sound asset.
Definition Audio.h:54