Game Kit: rewrite PushGameSound and WindowScreen headers
Part of #1576 Change-Id: Iafdc88bcf13e9c07fa148cb7980b54f5ee98be50 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2086 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
ef046e3b14
commit
e8faedae57
@@ -1,9 +1,6 @@
|
||||
/*
|
||||
* Copyright 2001-2002, Haiku Inc. All Rights Reserved.
|
||||
* Copyright 2020, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Author:
|
||||
* Christopher ML Zumwalt May ([email protected])
|
||||
*/
|
||||
#ifndef _PUSHGAMESOUND_H
|
||||
#define _PUSHGAMESOUND_H
|
||||
@@ -11,96 +8,92 @@
|
||||
|
||||
#include <StreamingGameSound.h>
|
||||
|
||||
|
||||
class BList;
|
||||
|
||||
class BPushGameSound : public BStreamingGameSound {
|
||||
public:
|
||||
BPushGameSound(size_t inBufferFrameCount,
|
||||
const gs_audio_format* format,
|
||||
size_t inBufferCount = 2,
|
||||
BGameSoundDevice* device = NULL);
|
||||
BPushGameSound(size_t inBufferFrameCount,
|
||||
const gs_audio_format* format,
|
||||
size_t inBufferCount = 2,
|
||||
BGameSoundDevice* device = NULL);
|
||||
virtual ~BPushGameSound();
|
||||
|
||||
virtual ~BPushGameSound();
|
||||
enum lock_status {
|
||||
lock_failed = -1,
|
||||
lock_ok = 0,
|
||||
lock_ok_frames_dropped
|
||||
};
|
||||
|
||||
enum lock_status {
|
||||
lock_failed = -1, // not yet time to do more
|
||||
lock_ok = 0, // do more
|
||||
lock_ok_frames_dropped // you may have missed some buffers
|
||||
};
|
||||
virtual lock_status LockNextPage(void** _pagePtr, size_t* _pageSize);
|
||||
virtual status_t UnlockPage(void* pagePtr);
|
||||
|
||||
virtual lock_status LockNextPage(void** _pagePtr,
|
||||
size_t* _pageSize);
|
||||
virtual status_t UnlockPage(void* pagePtr);
|
||||
virtual lock_status LockForCyclic(void** _basePtr, size_t* _size);
|
||||
virtual status_t UnlockCyclic();
|
||||
virtual size_t CurrentPosition();
|
||||
|
||||
virtual lock_status LockForCyclic(void** _basePtr, size_t* _size);
|
||||
virtual status_t UnlockCyclic();
|
||||
virtual size_t CurrentPosition();
|
||||
virtual BGameSound* Clone() const;
|
||||
|
||||
virtual BGameSound* Clone() const;
|
||||
|
||||
virtual status_t Perform(int32 selector, void* data);
|
||||
virtual status_t Perform(int32 selector, void* data);
|
||||
|
||||
protected:
|
||||
BPushGameSound(BGameSoundDevice* device);
|
||||
BPushGameSound(BGameSoundDevice* device);
|
||||
|
||||
virtual status_t SetParameters(size_t bufferFrameCount,
|
||||
const gs_audio_format* format,
|
||||
size_t bufferCount);
|
||||
virtual status_t SetParameters(size_t bufferFrameCount,
|
||||
const gs_audio_format* format, size_t bufferCount);
|
||||
|
||||
virtual status_t SetStreamHook(void (*hook)(void* inCookie,
|
||||
void* buffer, size_t byteCount,
|
||||
BStreamingGameSound* me),
|
||||
void* cookie);
|
||||
virtual status_t SetStreamHook(void (*hook)(void* inCookie,
|
||||
void* buffer, size_t byteCount,
|
||||
BStreamingGameSound* me),
|
||||
void* cookie);
|
||||
|
||||
virtual void FillBuffer(void* buffer, size_t byteCount);
|
||||
virtual void FillBuffer(void* buffer, size_t byteCount);
|
||||
|
||||
private:
|
||||
BPushGameSound();
|
||||
BPushGameSound(const BPushGameSound& other);
|
||||
BPushGameSound& operator=(const BPushGameSound& other);
|
||||
// not implemented
|
||||
BPushGameSound();
|
||||
BPushGameSound(const BPushGameSound& other);
|
||||
BPushGameSound& operator=(const BPushGameSound& other);
|
||||
|
||||
bool BytesReady(size_t* bytes);
|
||||
bool BytesReady(size_t* bytes);
|
||||
|
||||
virtual status_t _Reserved_BPushGameSound_0(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_1(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_2(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_3(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_4(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_5(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_6(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_7(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_8(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_9(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_10(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_11(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_12(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_13(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_14(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_15(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_16(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_17(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_18(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_19(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_20(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_21(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_22(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_23(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_0(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_1(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_2(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_3(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_4(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_5(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_6(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_7(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_8(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_9(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_10(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_11(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_12(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_13(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_14(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_15(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_16(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_17(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_18(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_19(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_20(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_21(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_22(int32 arg, ...);
|
||||
virtual status_t _Reserved_BPushGameSound_23(int32 arg, ...);
|
||||
|
||||
private:
|
||||
sem_id fLock;
|
||||
BList* fPageLocked;
|
||||
|
||||
size_t fLockPos;
|
||||
size_t fPlayPos;
|
||||
|
||||
char* fBuffer;
|
||||
size_t fPageSize;
|
||||
int32 fPageCount;
|
||||
size_t fBufferSize;
|
||||
sem_id fLock;
|
||||
BList* fPageLocked;
|
||||
size_t fLockPos;
|
||||
|
||||
uint32 _reserved[12];
|
||||
size_t fPlayPos;
|
||||
char* fBuffer;
|
||||
|
||||
size_t fPageSize;
|
||||
int32 fPageCount;
|
||||
size_t fBufferSize;
|
||||
|
||||
uint32 _reserved[12];
|
||||
};
|
||||
|
||||
|
||||
#endif // _PUSH_GAME_SOUND_H
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
* Copyright 2020, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _WINDOW_SCREEN_H
|
||||
#define _WINDOW_SCREEN_H
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
|
||||
void set_mouse_position(int32 x, int32 y);
|
||||
// Controls the mouse cursor position on screen
|
||||
|
||||
|
||||
enum {
|
||||
B_ENABLE_VIEW_DRAWING = 0x0001,
|
||||
@@ -24,109 +22,92 @@ enum {
|
||||
};
|
||||
|
||||
class BWindowScreen : public BWindow {
|
||||
public:
|
||||
BWindowScreen(const char* title, uint32 space,
|
||||
status_t* _error, bool debugMode = false);
|
||||
BWindowScreen(const char* title, uint32 space,
|
||||
uint32 attributes, status_t* _error);
|
||||
virtual ~BWindowScreen();
|
||||
public:
|
||||
BWindowScreen(const char* title, uint32 space,
|
||||
status_t* _error, bool debugMode = false);
|
||||
BWindowScreen(const char* title, uint32 space,
|
||||
uint32 attributes, status_t* _error);
|
||||
virtual ~BWindowScreen();
|
||||
|
||||
virtual void Quit();
|
||||
virtual void ScreenConnected(bool active);
|
||||
void Disconnect();
|
||||
virtual void Quit();
|
||||
virtual void ScreenConnected(bool active);
|
||||
void Disconnect();
|
||||
|
||||
virtual void WindowActivated(bool active);
|
||||
virtual void WorkspaceActivated(int32 workspace, bool active);
|
||||
virtual void ScreenChanged(BRect screenSize, color_space depth);
|
||||
virtual void WindowActivated(bool active);
|
||||
virtual void WorkspaceActivated(int32 workspace, bool active);
|
||||
virtual void ScreenChanged(BRect screenSize, color_space depth);
|
||||
|
||||
virtual void Hide();
|
||||
virtual void Show();
|
||||
virtual void Hide();
|
||||
virtual void Show();
|
||||
|
||||
void SetColorList(rgb_color* list, int32 firstIndex = 0,
|
||||
int32 lastIndex = 255);
|
||||
status_t SetSpace(uint32 space);
|
||||
void SetColorList(rgb_color* list, int32 firstIndex = 0,
|
||||
int32 lastIndex = 255);
|
||||
status_t SetSpace(uint32 space);
|
||||
|
||||
bool CanControlFrameBuffer();
|
||||
status_t SetFrameBuffer(int32 width, int32 height);
|
||||
status_t MoveDisplayArea(int32 x, int32 y);
|
||||
bool CanControlFrameBuffer();
|
||||
status_t SetFrameBuffer(int32 width, int32 height);
|
||||
status_t MoveDisplayArea(int32 x, int32 y);
|
||||
rgb_color* ColorList();
|
||||
frame_buffer_info* FrameBufferInfo();
|
||||
graphics_card_hook CardHookAt(int32 index);
|
||||
graphics_card_info* CardInfo();
|
||||
void RegisterThread(thread_id thread);
|
||||
virtual void SuspensionHook(bool active);
|
||||
void Suspend(char* label);
|
||||
|
||||
rgb_color* ColorList();
|
||||
frame_buffer_info* FrameBufferInfo();
|
||||
graphics_card_hook CardHookAt(int32 index);
|
||||
graphics_card_info* CardInfo();
|
||||
private:
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
virtual void _ReservedWindowScreen1();
|
||||
virtual void _ReservedWindowScreen2();
|
||||
virtual void _ReservedWindowScreen3();
|
||||
virtual void _ReservedWindowScreen4();
|
||||
status_t _InitData(uint32 space, uint32 attributes);
|
||||
void _DisposeData();
|
||||
status_t _LockScreen(bool lock);
|
||||
status_t _Activate();
|
||||
status_t _Deactivate();
|
||||
status_t _SetupAccelerantHooks();
|
||||
void _ResetAccelerantHooks();
|
||||
status_t _GetCardInfo();
|
||||
void _Suspend();
|
||||
void _Resume();
|
||||
status_t _GetModeFromSpace(uint32 space, display_mode* mode);
|
||||
status_t _InitClone();
|
||||
status_t _AssertDisplayMode(display_mode* mode);
|
||||
|
||||
void RegisterThread(thread_id thread);
|
||||
virtual void SuspensionHook(bool active);
|
||||
void Suspend(char* label);
|
||||
private:
|
||||
uint16 _reserved0;
|
||||
bool _reserved1;
|
||||
bool fWorkState;
|
||||
bool fWindowState;
|
||||
bool fActivateState;
|
||||
int32 fLockState;
|
||||
int32 fWorkspaceIndex;
|
||||
|
||||
private:
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
display_mode* fOriginalDisplayMode;
|
||||
display_mode* fDisplayMode;
|
||||
sem_id fDebugSem;
|
||||
image_id fAddonImage;
|
||||
uint32 fAttributes;
|
||||
|
||||
#if 0
|
||||
void* IOBase();
|
||||
// deprecated API, always returns NULL
|
||||
#endif
|
||||
rgb_color fPalette[256];
|
||||
|
||||
virtual void _ReservedWindowScreen1();
|
||||
virtual void _ReservedWindowScreen2();
|
||||
virtual void _ReservedWindowScreen3();
|
||||
virtual void _ReservedWindowScreen4();
|
||||
graphics_card_info fCardInfo;
|
||||
frame_buffer_info fFrameBufferInfo;
|
||||
|
||||
// not implemented:
|
||||
BWindowScreen();
|
||||
BWindowScreen(BWindowScreen& other);
|
||||
BWindowScreen &operator=(BWindowScreen& other);
|
||||
char* fDebugFrameBuffer;
|
||||
bool fDebugState;
|
||||
bool fDebugFirst;
|
||||
int32 fDebugWorkspace;
|
||||
int32 fDebugThreadCount;
|
||||
thread_id* fDebugThreads;
|
||||
uint32 fModeCount;
|
||||
display_mode* fModeList;
|
||||
|
||||
status_t _InitData(uint32 space, uint32 attributes);
|
||||
void _DisposeData();
|
||||
GetAccelerantHook fGetAccelerantHook;
|
||||
wait_engine_idle fWaitEngineIdle;
|
||||
|
||||
status_t _LockScreen(bool lock);
|
||||
status_t _Activate();
|
||||
status_t _Deactivate();
|
||||
|
||||
status_t _SetupAccelerantHooks();
|
||||
void _ResetAccelerantHooks();
|
||||
|
||||
status_t _GetCardInfo();
|
||||
void _Suspend();
|
||||
void _Resume();
|
||||
status_t _GetModeFromSpace(uint32 space, display_mode* mode);
|
||||
status_t _InitClone();
|
||||
status_t _AssertDisplayMode(display_mode* mode);
|
||||
|
||||
uint16 _reserved0;
|
||||
bool _reserved1;
|
||||
bool fWorkState;
|
||||
bool fWindowState;
|
||||
bool fActivateState;
|
||||
int32 fLockState;
|
||||
int32 fWorkspaceIndex;
|
||||
|
||||
display_mode* fOriginalDisplayMode;
|
||||
display_mode* fDisplayMode;
|
||||
sem_id fDebugSem;
|
||||
image_id fAddonImage;
|
||||
uint32 fAttributes;
|
||||
|
||||
rgb_color fPalette[256];
|
||||
|
||||
graphics_card_info fCardInfo;
|
||||
frame_buffer_info fFrameBufferInfo;
|
||||
|
||||
char* fDebugFrameBuffer;
|
||||
bool fDebugState;
|
||||
bool fDebugFirst;
|
||||
int32 fDebugWorkspace;
|
||||
int32 fDebugThreadCount;
|
||||
thread_id* fDebugThreads;
|
||||
|
||||
uint32 fModeCount;
|
||||
display_mode* fModeList;
|
||||
|
||||
GetAccelerantHook fGetAccelerantHook;
|
||||
wait_engine_idle fWaitEngineIdle;
|
||||
|
||||
uint32 _reserved[163];
|
||||
uint32 _reserved[163];
|
||||
};
|
||||
|
||||
#endif // _WINDOW_SCREEN_H
|
||||
#endif
|
||||
Reference in New Issue
Block a user