Skip to content

Commit

Permalink
EVENTS: Add a request for screen gamma changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Jan 18, 2012
1 parent a775b3b commit c782381
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/events/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const EventsManager::RequestHandler EventsManager::_requestHandler[kITCEventMAX]
&EventsManager::requestResize,
&EventsManager::requestChangeFSAA,
&EventsManager::requestChangeVSync,
&EventsManager::requestChangeGamma,
&EventsManager::requestRebuildGLContainer,
&EventsManager::requestDestroyGLContainer
};
Expand Down Expand Up @@ -352,6 +353,10 @@ void EventsManager::requestChangeVSync(Request &request) {
// TODO
}

void EventsManager::requestChangeGamma(Request &request) {
GfxMan.setGamma(request._gamma.gamma);
}

void EventsManager::requestRebuildGLContainer(Request &request) {
request._glContainer.glContainer->rebuild();
}
Expand Down
1 change: 1 addition & 0 deletions src/events/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class EventsManager : public Common::Singleton<EventsManager> {
void requestResize(Request &request);
void requestChangeFSAA(Request &request);
void requestChangeVSync(Request &request);
void requestChangeGamma(Request &request);
void requestRebuildGLContainer(Request &request);
void requestDestroyGLContainer(Request &request);

Expand Down
8 changes: 8 additions & 0 deletions src/events/requests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ RequestID RequestManager::changeVSync(bool vsync) {
return rID;
}

RequestID RequestManager::changeGamma(float gamma) {
RequestID rID = newRequest(kITCEventChangeGamma);

(*rID)->_gamma.gamma = gamma;

return rID;
}

RequestID RequestManager::rebuild(Graphics::GLContainer &glContainer) {
RequestID rID = newRequest(kITCEventRebuildGLContainer);

Expand Down
2 changes: 2 additions & 0 deletions src/events/requests.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class RequestManager : public Common::Singleton<RequestManager>, public Common::
RequestID changeFSAA(int level);
/** Request that the vsync settings shall be changed. */
RequestID changeVSync(bool vsync);
/** Request that the gamma settings shall be changed. */
RequestID changeGamma(float gamma);

/** Request that a GL container shall be rebuilt. */
RequestID rebuild(Graphics::GLContainer &glContainer);
Expand Down
5 changes: 5 additions & 0 deletions src/events/requesttypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ struct RequestDataChangeVSync {
bool vsync;
};

struct RequestDataChangeGamma {
float gamma;
};

struct RequestDataGLContainer {
Graphics::GLContainer *glContainer;
};
Expand Down Expand Up @@ -85,6 +89,7 @@ class Request {
RequestDataResize _resize;
RequestDataChangeFSAA _fsaa;
RequestDataChangeVSync _vsync;
RequestDataChangeGamma _gamma;
RequestDataGLContainer _glContainer;
};

Expand Down
1 change: 1 addition & 0 deletions src/events/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ enum ITCEvent {
kITCEventResize , ///< Request changing the display size.
kITCEventChangeFSAA , ///< Request changing the FSAA level.
kITCEventChangeVSync , ///< Request changing the vsync settings.
kITCEventChangeGamma , ///< Request changing the gamma settings.
kITCEventRebuildGLContainer , ///< Request the rebuilding of a GL container.
kITCEventDestroyGLContainer , ///< Request the destruction of a GL container.
kITCEventMAX ///< For range checks.
Expand Down

0 comments on commit c782381

Please sign in to comment.