Refactor VideoCommon/OnScreenDisplay.

Use strings internally, use a multimap and std::function for callbacks (instead
of a flat vector + loop over the vector to find the right callback type), fix
coding style issues. Simplify MainAndroid code a bit.
This commit is contained in:
Pierre Bourdon
2013-08-24 02:13:54 +02:00
parent 9deb63a312
commit 9303b57db1
3 changed files with 47 additions and 106 deletions

View File

@ -5,13 +5,12 @@
#ifndef _OSD_H_
#define _OSD_H_
#include <functional>
#include <string>
namespace OSD
{
// On-screen message display
void AddMessage(const char* str, u32 ms = 2000);
void AddMessage(const std::string& str, u32 ms = 2000);
void DrawMessages(); // draw the current messages on the screen. Only call once per frame.
void ClearMessages();
@ -23,12 +22,10 @@ enum CallbackType
OSD_ONFRAME,
OSD_SHUTDOWN
};
typedef void(*CallbackPtr)(u32);
typedef std::function<void()> Callback;
void AddCallback(CallbackType OnType, CallbackPtr FuncPtr, u32 UserData);
void DoCallbacks(CallbackType OnType);
} // namespace
void AddCallback(CallbackType type, Callback cb);
void DoCallbacks(CallbackType type);
} // namespace OSD
#endif // _OSD_H_