hrev53754 adds 1 changeset to branch 'master'
old head: 450208975b6a059e645e8c2b4a77c346b9b03b71
new head: f0b6c6a24bd9627a688e74d80f91f9e637052840
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=f0b6c6a24bd9+%5E450208975b6a
----------------------------------------------------------------------------
f0b6c6a24bd9: Game Kit: rewrite DirectWindow, FileGameSound and SimpleGameSound
headers
Change-Id: I45687f8164dbc915a0cb6ca1bf4c0211761cb098
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2108
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Panagiotis Vasilopoulos <hello@xxxxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev53754
Commit: f0b6c6a24bd9627a688e74d80f91f9e637052840
URL: https://git.haiku-os.org/haiku/commit/?id=f0b6c6a24bd9
Author: Panagiotis Vasilopoulos <hello@xxxxxxxxxxxxxxx>
Date: Sat Jan 11 21:49:22 2020 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Wed Jan 22 00:33:44 2020 UTC
----------------------------------------------------------------------------
3 files changed, 93 insertions(+), 91 deletions(-)
headers/os/game/DirectWindow.h | 62 +++++++++++----------
headers/os/game/FileGameSound.h | 22 ++++----
headers/os/game/SimpleGameSound.h | 100 ++++++++++++++++------------------
----------------------------------------------------------------------------
diff --git a/headers/os/game/DirectWindow.h b/headers/os/game/DirectWindow.h
index a704616b94..01ab10a3ce 100644
--- a/headers/os/game/DirectWindow.h
+++ b/headers/os/game/DirectWindow.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2008 Haiku, Inc. All rights reserved.
+ * Copyright 2020 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -14,22 +14,20 @@
enum direct_buffer_state {
- B_DIRECT_MODE_MASK = 15,
-
- B_DIRECT_START = 0,
- B_DIRECT_STOP = 1,
- B_DIRECT_MODIFY = 2,
-
+ B_DIRECT_MODE_MASK = 15,
+ B_DIRECT_START = 0,
+ B_DIRECT_STOP = 1,
+ B_DIRECT_MODIFY = 2,
B_CLIPPING_MODIFIED = 16,
- B_BUFFER_RESIZED = 32,
- B_BUFFER_MOVED = 64,
- B_BUFFER_RESET = 128
+ B_BUFFER_RESIZED = 32,
+ B_BUFFER_MOVED = 64,
+ B_BUFFER_RESET = 128
};
enum direct_driver_state {
- B_DRIVER_CHANGED = 0x0001,
- B_MODE_CHANGED = 0x0002
+ B_DRIVER_CHANGED = 0x0001,
+ B_MODE_CHANGED = 0x0002
};
@@ -58,10 +56,12 @@ public:
BDirectWindow(BRect frame, const char* title,
window_type type, uint32 flags,
uint32
workspace = B_CURRENT_WORKSPACE);
+
BDirectWindow(BRect frame, const char* title,
window_look look, window_feel feel,
uint32
flags,
uint32
workspace = B_CURRENT_WORKSPACE);
+
virtual ~BDirectWindow();
static BArchivable* Instantiate(BMessage* data);
@@ -69,46 +69,57 @@ public:
bool
deep = true) const;
virtual void Quit();
+
virtual void DispatchMessage(BMessage*
message,
BHandler* handler);
+
virtual void MessageReceived(BMessage*
message);
+
virtual void FrameMoved(BPoint newPosition);
+ virtual void FrameResized(float newWidth,
float newHeight);
+
virtual void WorkspacesChanged(uint32
oldWorkspaces,
uint32
newWorkspaces);
+
virtual void WorkspaceActivated(int32
workspaceIndex,
bool
state);
- virtual void FrameResized(float newWidth,
float newHeight);
+
virtual void Minimize(bool minimize);
virtual void Zoom(BPoint recPosition, float
recWidth,
float
recHeight);
+
virtual void ScreenChanged(BRect screenFrame,
color_space depth);
+
virtual void MenusBeginning();
virtual void MenusEnded();
virtual void WindowActivated(bool state);
virtual void Show();
virtual void Hide();
+
virtual BHandler* ResolveSpecifier(BMessage*
message,
int32
index, BMessage* specifier,
int32
what, const char* property);
+
virtual status_t GetSupportedSuites(BMessage*
data);
virtual status_t Perform(perform_code code,
void* arg);
-private:
- virtual void task_looper();
- virtual BMessage* ConvertToMessage(void* raw,
int32 code);
-
- public:
virtual void
DirectConnected(direct_buffer_info* info);
+
status_t
GetClippingRegion(BRegion* region,
BPoint*
origin = NULL) const;
+
status_t SetFullScreen(bool
enable);
bool IsFullScreen() const;
static bool SupportsWindowMode(
screen_id id = B_MAIN_SCREEN_ID);
-
private:
+ BDirectWindow();
+
BDirectWindow(BDirectWindow& other);
+
+ BDirectWindow& operator=(BDirectWindow& other);
+
typedef BWindow inherited;
virtual void _ReservedDirectWindow1();
@@ -116,30 +127,26 @@ private:
virtual void _ReservedDirectWindow3();
virtual void _ReservedDirectWindow4();
- BDirectWindow();
-
BDirectWindow(BDirectWindow& other);
- BDirectWindow& operator=(BDirectWindow& other);
+ virtual void task_looper();
+ virtual BMessage* ConvertToMessage(void* raw,
int32 code);
static int32 _daemon_thread(void* arg);
int32 _DirectDaemon();
bool _LockDirect() const;
void _UnlockDirect() const;
-
void _InitData();
void _DisposeData();
-
+private:
bool fDaemonKiller;
bool fConnectionEnable;
bool fIsFullScreen;
bool _unused;
bool fInDirectConnect;
-
int32 fDirectLock;
sem_id fDirectSem;
uint32 fDirectLockCount;
thread_id fDirectLockOwner;
char* fDirectLockStack;
-
sem_id fDisableSem;
sem_id fDisableSemAck;
@@ -156,5 +163,4 @@ private:
uint32 _more_reserved_[17];
};
-
-#endif // _DIRECT_WINDOW_H
+#endif
diff --git a/headers/os/game/FileGameSound.h b/headers/os/game/FileGameSound.h
index 29fe9656e2..32ff9f0441 100644
--- a/headers/os/game/FileGameSound.h
+++ b/headers/os/game/FileGameSound.h
@@ -1,16 +1,16 @@
/*
- * 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 (zummy@xxxxxxxxxxxx)
*/
+
#ifndef _FILEGAMESOUND_H
#define _FILEGAMESOUND_H
#include <StreamingGameSound.h>
-
#include <DataIO.h>
@@ -21,12 +21,15 @@ struct _gs_ramp;
class BFileGameSound : public BStreamingGameSound {
public:
+
BFileGameSound(const entry_ref* file,
bool
looping = true,
BGameSoundDevice* device = NULL);
+
BFileGameSound(const char* file,
bool
looping = true,
BGameSoundDevice* device = NULL);
+
BFileGameSound(BDataIO* data,
bool
looping = true,
BGameSoundDevice* device = NULL);
@@ -37,8 +40,7 @@ public:
virtual status_t StartPlaying();
virtual status_t StopPlaying();
- status_t Preload();
- // if you have stopped and want to start quickly again
+ status_t Preload();
virtual void FillBuffer(void* buffer, size_t
byteCount);
virtual status_t Perform(int32 selector, void*
data);
@@ -49,13 +51,13 @@ public:
B_PAUSE_IN_PROGRESS,
B_PAUSED
};
- int32 IsPaused();
+ int32 IsPaused();
private:
BFileGameSound();
BFileGameSound(const BFileGameSound& other);
+
BFileGameSound& operator=(const BFileGameSound&
other);
- // not
implemented
status_t Init(BDataIO* data);
@@ -63,7 +65,7 @@ private:
bool Read(void* buffer,
size_t bytes);
status_t
_Reserved_BFileGameSound_0(int32 arg, ...);
- // SetPaused(bool paused, bigtime_t ramp);
+ //
SetPaused(bool paused, bigtime_t ramp);
virtual status_t
_Reserved_BFileGameSound_1(int32 arg, ...);
virtual status_t
_Reserved_BFileGameSound_2(int32 arg, ...);
virtual status_t
_Reserved_BFileGameSound_3(int32 arg, ...);
@@ -87,7 +89,6 @@ private:
virtual status_t
_Reserved_BFileGameSound_21(int32 arg, ...);
virtual status_t
_Reserved_BFileGameSound_22(int32 arg, ...);
virtual status_t
_Reserved_BFileGameSound_23(int32 arg, ...);
-
private:
_gs_media_tracker* fAudioStream;
@@ -104,7 +105,7 @@ private:
bool fPaused;
float fPauseGain;
- BDataIO* fDataSource;
+ BDataIO* fDataSource;
#ifdef B_HAIKU_64_BIT
uint32 _reserved[9];
@@ -113,5 +114,4 @@ private:
#endif
};
-
-#endif // _FILEGAMESOUND_H
+#endif
diff --git a/headers/os/game/SimpleGameSound.h
b/headers/os/game/SimpleGameSound.h
index 9e11dafea3..585fe8c692 100644
--- a/headers/os/game/SimpleGameSound.h
+++ b/headers/os/game/SimpleGameSound.h
@@ -1,76 +1,72 @@
/*
- * Copyright 2001-2010, Haiku Inc. All Rights Reserved.
+ * Copyright 2020, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SIMPLEGAMESOUND_H
#define _SIMPLEGAMESOUND_H
-#include <GameSoundDefs.h>
#include <GameSound.h>
-
+#include <GameSoundDefs.h>
struct entry_ref;
-
class BSimpleGameSound : public BGameSound {
public:
-
BSimpleGameSound(const entry_ref* file,
-
BGameSoundDevice* device = NULL);
-
BSimpleGameSound(const char* file,
-
BGameSoundDevice* device = NULL);
-
BSimpleGameSound(const void* data,
- size_t
frameCount,
- const
gs_audio_format* format,
-
BGameSoundDevice* device = NULL);
-
BSimpleGameSound(const BSimpleGameSound& other);
+ BSimpleGameSound(const
entry_ref* file,
+
BGameSoundDevice* device = NULL);
+
+ BSimpleGameSound(const
char* file,
+
BGameSoundDevice* device = NULL);
- virtual ~BSimpleGameSound();
+ BSimpleGameSound(const
void* data,
+ size_t
frameCount,
+ const
gs_audio_format* format,
+
BGameSoundDevice* device = NULL);
- virtual BGameSound* Clone() const;
+ BSimpleGameSound(const
BSimpleGameSound& other);
- virtual status_t Perform(int32 selector, void*
data);
+ virtual ~BSimpleGameSound();
- status_t SetIsLooping(bool
looping);
- bool IsLooping() const;
-
+ virtual BGameSound* Clone() const;
+ virtual status_t Perform(int32 selector, void* data);
+ status_t SetIsLooping(bool looping);
+ bool IsLooping() const;
private:
-
BSimpleGameSound();
- BSimpleGameSound& operator=(const
BSimpleGameSound& other);
- // not
implemented
+ BSimpleGameSound();
- status_t Init(const entry_ref*
file);
- status_t Init(const void* data,
int64 frameCount,
- const
gs_audio_format* format);
+ BSimpleGameSound& operator=(const BSimpleGameSound&
other);
- virtual status_t
_Reserved_BSimpleGameSound_0(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_1(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_2(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_3(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_4(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_5(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_6(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_7(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_8(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_9(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_10(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_11(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_12(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_13(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_14(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_15(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_16(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_17(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_18(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_19(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_20(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_21(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_22(int32 arg, ...);
- virtual status_t
_Reserved_BSimpleGameSound_23(int32 arg, ...);
+ status_t Init(const entry_ref* file);
+ status_t Init(const void* data, int64
frameCount,
+ const
gs_audio_format* format);
+ virtual status_t _Reserved_BSimpleGameSound_0(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_1(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_2(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_3(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_4(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_5(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_6(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_7(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_8(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_9(int32 arg,
...);
+ virtual status_t _Reserved_BSimpleGameSound_10(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_11(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_12(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_13(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_14(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_15(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_16(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_17(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_18(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_19(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_20(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_21(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_22(int32
arg, ...);
+ virtual status_t _Reserved_BSimpleGameSound_23(int32
arg, ...);
private:
- uint32 _reserved[12];
+ uint32 _reserved[12];
};
-
-#endif // _SIMPLE_GAME_SOUND_H
+#endif