mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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:
@ -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_
|
||||
|
||||
|
Reference in New Issue
Block a user