Añadido README.md con planteamiento de solución al problema

parent af56ddc9
Showing with 31 additions and 0 deletions
# Primera práctica
## Descripción de solución al segundo problema planteado
Dado a que con GLFW solo se puede registrar como _callback_ funciones C y no métidos de clase, la clase `PAG::Renderer` debe de seguir el patrón **Singleton**.
De esta manera, se pueden poner como *callback* funciones C que obtienen el singleton y llaman al metodo indicado.
Por ejemplo:
```cpp
static void window_refresh_callback(GLFWwindow *window) {
Renderer::getInstance().refrescarVentana(window);
}
void Renderer::initCallbacks() {
glfwSetWindowRefreshCallback(window, window_refresh_callback);
}
```
### Implementación en UML
```mermaid
classDiagram
namespace PAG {
class Renderer {
+ getInstance() : Renderer&
+ initCallbacks()
+ refrescarVentana(window)
}
}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment