Audio API first pass
This commit is contained in:
25
src/dawn/audio/_AudioManager.hpp
Normal file
25
src/dawn/audio/_AudioManager.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "dawnlibs.hpp"
|
||||
#include "assert/assert.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class DawnGame;
|
||||
|
||||
class IAudioManager {
|
||||
public:
|
||||
DawnGame *game;
|
||||
|
||||
IAudioManager(DawnGame *game) {
|
||||
assertNotNull(game);
|
||||
this->game = game;
|
||||
}
|
||||
|
||||
virtual void init() = 0;
|
||||
virtual void update() = 0;
|
||||
};
|
||||
}
|
@ -89,6 +89,7 @@ void Transform::setLocalPosition(glm::vec3 position) {
|
||||
this->localPosition = position;
|
||||
this->updateLocalTransformFromLocalValues();
|
||||
this->updateChildrenTransforms();
|
||||
this->eventTransformUpdated.invoke();
|
||||
}
|
||||
|
||||
glm::vec3 Transform::getLocalScale() {
|
||||
@ -99,6 +100,7 @@ void Transform::setLocalScale(glm::vec3 scale) {
|
||||
this->localScale = scale;
|
||||
this->updateLocalTransformFromLocalValues();
|
||||
this->updateChildrenTransforms();
|
||||
this->eventTransformUpdated.invoke();
|
||||
}
|
||||
|
||||
glm::quat Transform::getLocalRotation() {
|
||||
@ -109,6 +111,7 @@ void Transform::setLocalRotation(glm::quat rotation) {
|
||||
this->localRotation = rotation;
|
||||
this->updateLocalTransformFromLocalValues();
|
||||
this->updateChildrenTransforms();
|
||||
this->eventTransformUpdated.invoke();
|
||||
}
|
||||
|
||||
|
||||
@ -121,6 +124,11 @@ void Transform::setLocalTransform(glm::mat4 transform) {
|
||||
|
||||
this->updateLocalValuesFromLocalTransform();
|
||||
this->updateChildrenTransforms();
|
||||
this->eventTransformUpdated.invoke();
|
||||
}
|
||||
|
||||
glm::vec3 Transform::getWorldPosition() {
|
||||
return glm::vec3(this->transformWorld[3]);
|
||||
}
|
||||
|
||||
glm::mat4 Transform::getWorldTransform() {
|
||||
@ -131,6 +139,7 @@ void Transform::setWorldTransform(glm::mat4 transform) {
|
||||
this->transformWorld = transform;
|
||||
this->updateLocalTransformFromWorldTransform();
|
||||
this->updateChildrenTransforms();
|
||||
this->eventTransformUpdated.invoke();
|
||||
}
|
||||
|
||||
|
||||
@ -156,6 +165,7 @@ void Transform::setParent(Transform *parent) {
|
||||
|
||||
this->updateLocalTransformFromWorldTransform();
|
||||
this->updateChildrenTransforms();
|
||||
this->eventTransformUpdated.invoke();
|
||||
}
|
||||
|
||||
Transform * Transform::getParent() {
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "dawnlibs.hpp"
|
||||
#include "assert/assert.hpp"
|
||||
#include "util/flag.hpp"
|
||||
#include "event/Event.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class SceneItem;
|
||||
@ -38,6 +39,8 @@ namespace Dawn {
|
||||
void updateChildrenTransforms();
|
||||
|
||||
public:
|
||||
// I have no idea if I'm keeping this
|
||||
Event<> eventTransformUpdated;
|
||||
SceneItem *item;
|
||||
|
||||
/**
|
||||
@ -123,6 +126,13 @@ namespace Dawn {
|
||||
*/
|
||||
void setLocalTransform(glm::mat4 transform);
|
||||
|
||||
/**
|
||||
* Returns the position of the origin of this transform in world-space.
|
||||
*
|
||||
* @return Transform origin in world-space.
|
||||
*/
|
||||
glm::vec3 getWorldPosition();
|
||||
|
||||
/**
|
||||
* Returns the transformation matrix for this transform, in world-space.
|
||||
* @return The transform origin in world-space.
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "locale/LocaleManager.hpp"
|
||||
#include "physics/PhysicsManager.hpp"
|
||||
#include "save/SaveManager.hpp"
|
||||
#include "audio/AudioManager.hpp"
|
||||
|
||||
#define DAWN_GAME_INIT_RESULT_SUCCESS 0
|
||||
#define DAWN_GAME_UPDATE_RESULT_SUCCESS 0
|
||||
|
@ -6,12 +6,12 @@
|
||||
#pragma once
|
||||
#include "scene/components/display/AnimationController.hpp"
|
||||
#include "scene/components/display/Camera.hpp"
|
||||
#include "scene/components/display/Material.hpp"
|
||||
#include "scene/components/display/MeshHost.hpp"
|
||||
#include "scene/components/display/MeshRenderer.hpp"
|
||||
#include "scene/components/display/Material.hpp"
|
||||
#include "scene/components/display/PixelPerfectCamera.hpp"
|
||||
#include "scene/components/display/TiledSprite.hpp"
|
||||
#include "scene/components/display/SimpleRenderTargetQuad.hpp"
|
||||
#include "scene/components/display/TiledSprite.hpp"
|
||||
|
||||
#include "scene/components/example/ExampleSpin.hpp"
|
||||
|
||||
|
@ -25,6 +25,7 @@ void SimpleVNScene::stage() {
|
||||
|
||||
// Camera
|
||||
this->camera = Camera::create(this);
|
||||
// this->camera->item->addComponent<AudioListener>();
|
||||
this->camera->transform->lookAtPixelPerfect(
|
||||
glm::vec3(0, 0, 0),
|
||||
glm::vec3(0, 0, 0),
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "game/DawnGame.hpp"
|
||||
#include "util/array.hpp"
|
||||
#include "scene/components/Components.hpp"
|
||||
#include "scene/components/audio/AudioListener.hpp"
|
||||
#include "visualnovel/VisualNovelManager.hpp"
|
||||
#include "visualnovel/events/VisualNovelTextboxEvent.hpp"
|
||||
#include "visualnovel/events/VisualNovelPauseEvent.hpp"
|
||||
|
Reference in New Issue
Block a user