Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Observers and deferred implementations #1599

Merged
merged 1 commit into from
Nov 18, 2024
Merged

feat: Observers and deferred implementations #1599

merged 1 commit into from
Nov 18, 2024

Conversation

Wincent01
Copy link
Member

This pull request seeks to add helper classes for observers as well as a way to optionally defer/override an implementation of a method or action.

These classes would in the future help with server-side modding. The observer class is very standard as observers go. Usually you would relay on something like a strategy pattern to switch between implementations — do not think that is quite the right solution here.

In the event of modding through library loading at runtime, they could set their observers and overrides through these classes.

In this pull request are examples of how these classes could be implemented into existing classes. These could be excluded if that would be preferred.

Copy link
Collaborator

@EmosewaMC EmosewaMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nits

dCommon/Observable.h Show resolved Hide resolved
dGame/Entity.h Show resolved Hide resolved
dCommon/Implementation.h Show resolved Hide resolved
@EmosewaMC EmosewaMC changed the title Proposal: Observers and deferred implementations feat: Observers and deferred implementations May 26, 2024
@DarwinAnim8or
Copy link
Member

Nice to see the gameprogrammingpatterns.com influence ;) Big fan of observers so this looks great

@jadebenn jadebenn dismissed aronwk-aaron’s stale review November 18, 2024 00:45

gonna toss this in another PR as per discord chat

@jadebenn jadebenn merged commit fedd039 into main Nov 18, 2024
4 checks passed
@jadebenn jadebenn deleted the observable branch November 18, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants