Я портирую приложение OS X, написанное на C ++ с платформой SDL 1.2, на iOS, используя платформу SDL 1.3.В методы были внесены некоторые изменения, и у меня возникли проблемы с переписыванием нескольких фрагментов кода.Вот комментарии и объявления для метода SDL_PeepEvents от 1.2.14:
/**
* Checks the event queue for messages and optionally returns them.
*
* If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
* the back of the event queue.
* If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
* of the event queue, matching 'mask', will be returned and will not
* be removed from the queue.
* If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
* of the event queue, matching 'mask', will be returned and will be
* removed from the queue.
*
* @return
* This function returns the number of events actually stored, or -1
* if there was an error.
*
* This function is thread-safe.
*/
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
SDL_eventaction action, Uint32 mask);
Вот объявление для того же метода в 1.3:
/**
* Checks the event queue for messages and optionally returns them.
*
* If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to
* the back of the event queue.
*
* If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front
* of the event queue, within the specified minimum and maximum type,
* will be returned and will not be removed from the queue.
*
* If \c action is ::SDL_GETEVENT, up to \c numevents events at the front
* of the event queue, within the specified minimum and maximum type,
* will be returned and will be removed from the queue.
*
* \return The number of events actually stored, or -1 if there was an error.
*
* This function is thread-safe.
*/
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
SDL_eventaction action,
Uint32 minType, Uint32 maxType);
Наконец, вот методЯ пытаюсь переписать:
/**
* Returns true if the queue is empty of events that match 'mask'.
*/
bool EventHandler::timerQueueEmpty() {
SDL_Event event;
if (SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_EVENTMASK(SDL_USEREVENT)))
return false;
else
return true;
}
В настоящее время при компиляции выдается следующая ошибка: 'SDL_EVENTMASK' не было объявлено в этой области.Я полностью понимаю, что ошибка происходит, потому что SDL_EVENTMASK больше не является параметром функции SDL_PeepEvents.Я также понимаю, что Uint32Mask был заменен на Uint32 minType, Uint32 maxType.Мне просто трудно понять, как переписать код с этими новыми параметрами.