ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Functions | Variables
Notification.c File Reference
#include <assert.h>
#include <Objectively/Once.h>
#include "Notification.h"

Go to the source code of this file.

Functions

void MVC_PostNotification (const Notification *notification)
 Posts the Notification to all ViewControllers in the current window. More...
 

Variables

Uint32 MVC_NOTIFICATION_EVENT
 

Function Documentation

◆ MVC_PostNotification()

void MVC_PostNotification ( const Notification notification)

Posts the Notification to all ViewControllers in the current window.

Parameters
notificationThe Notification.
See also
ViewController::handleNotification

Definition at line 32 of file Notification.c.

32 {
33 static Once once;
34
35 do_once(&once, {
36 MVC_NOTIFICATION_EVENT = SDL_RegisterEvents(1);
37 assert(MVC_NOTIFICATION_EVENT != (Uint32) -1);
38 });
39
40 assert(notification);
41
42 SDL_PushEvent(&(SDL_Event) {
43 .user.type = MVC_NOTIFICATION_EVENT,
44 .user.code = notification->name,
45 .user.data1 = notification->sender,
46 .user.data2 = notification->data
47 });
48}
Uint32 MVC_NOTIFICATION_EVENT
Definition: Notification.c:30
int name
The notification name.
Definition: Notification.h:39
ident data
The data.
Definition: Notification.h:49
ident sender
The sender.
Definition: Notification.h:44

Variable Documentation

◆ MVC_NOTIFICATION_EVENT

Uint32 MVC_NOTIFICATION_EVENT

Definition at line 30 of file Notification.c.