culturered_client/PlaySound/SDLWindow.h

33 lines
743 B
C
Raw Normal View History

2024-09-07 03:34:44 +00:00
#pragma once
#include <Windows.h>
#include <SDL.h>
#define TRAY_ICON_ID 1001
#define WM_TRAYICON (WM_USER + 1)
// 窗口类
class SDLWindow {
public:
SDLWindow();
~SDLWindow();
int32_t Run();
protected:
void CreateTrayIcon();
void QuitApplication();
LRESULT WindowProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK StaticWindowProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static DWORD WINAPI SerialListenerThread(LPVOID lpParam);
static void AudioCallback(void* userdata, Uint8* stream, int len);
private:
HWND hWnd;
NOTIFYICONDATA trayIconData;
SDL_AudioSpec audioSpec;
SDL_AudioDeviceID audioDeviceID;
SDL_atomic_t Quit;
};