Synchronized with trunk
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1399 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
79c7bf8e02
11 changed files with 93 additions and 49 deletions
|
@ -121,7 +121,8 @@ unsigned int SoundRecorder::GetSampleRate() const
|
|||
////////////////////////////////////////////////////////////
|
||||
bool SoundRecorder::IsAvailable()
|
||||
{
|
||||
return priv::AudioDevice::IsExtensionSupported("ALC_EXT_CAPTURE");
|
||||
return (priv::AudioDevice::IsExtensionSupported("ALC_EXT_CAPTURE") != AL_FALSE) ||
|
||||
(priv::AudioDevice::IsExtensionSupported("ALC_EXT_capture") != AL_FALSE); // "bug" in Mac OS X 10.5 and 10.6
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -251,19 +251,7 @@ void SoundStream::Run()
|
|||
if (!requestStop)
|
||||
{
|
||||
if (FillAndPushBuffer(bufferNum))
|
||||
{
|
||||
// User requested to stop: check if we must loop or really stop
|
||||
if (myLoop)
|
||||
{
|
||||
// Looping: restart the stream source
|
||||
OnSeek(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not looping: request stop
|
||||
requestStop = true;
|
||||
}
|
||||
}
|
||||
requestStop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,11 +281,29 @@ bool SoundStream::FillAndPushBuffer(unsigned int bufferNum)
|
|||
Chunk data = {NULL, 0};
|
||||
if (!OnGetData(data))
|
||||
{
|
||||
// Mark the buffer as the last one (so that we know when to reset the playing position)
|
||||
myEndBuffers[bufferNum] = true;
|
||||
requestStop = true;
|
||||
|
||||
// Check if the stream must loop or stop
|
||||
if (myLoop)
|
||||
{
|
||||
// Return to the beginning of the stream source
|
||||
OnSeek(0);
|
||||
|
||||
// If we previously had no data, try to fill the buffer once again
|
||||
if (!data.Samples || (data.NbSamples == 0))
|
||||
{
|
||||
return FillAndPushBuffer(bufferNum);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not looping: request stop
|
||||
requestStop = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Create and fill the buffer, and push it to the queue
|
||||
// Fill the buffer if some data was returned
|
||||
if (data.Samples && data.NbSamples)
|
||||
{
|
||||
unsigned int buffer = myBuffers[bufferNum];
|
||||
|
@ -322,12 +328,7 @@ bool SoundStream::FillQueue()
|
|||
for (int i = 0; (i < BuffersCount) && !requestStop; ++i)
|
||||
{
|
||||
if (FillAndPushBuffer(i))
|
||||
{
|
||||
if (myLoop)
|
||||
OnSeek(0);
|
||||
else
|
||||
requestStop = true;
|
||||
}
|
||||
requestStop = true;
|
||||
}
|
||||
|
||||
return requestStop;
|
||||
|
|
|
@ -49,7 +49,7 @@ void Joystick::Initialize(unsigned int Index)
|
|||
JoystickState Joystick::UpdateState()
|
||||
{
|
||||
// Fill a JoystickState instance with the current joystick state
|
||||
JoystickState s = {0};
|
||||
JoystickState s;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,16 +90,35 @@ myWheelStatus(0.0f)
|
|||
{
|
||||
if (Handle)
|
||||
{
|
||||
if (![(NSWindow *)Handle isKindOfClass:[NSWindow class]])
|
||||
std::cerr << "Cannot import this Window Handle because it is not a <NSWindow *> object"
|
||||
<< "(or one of its subclasses). You gave a <"
|
||||
<< [[(NSWindow *)Handle className] UTF8String]
|
||||
<< "> object." << std::endl;
|
||||
NSWindow *cocoaWindow = nil;
|
||||
|
||||
// Classical window import
|
||||
if ([(id)Handle isKindOfClass:[NSWindow class]])
|
||||
{
|
||||
cocoaWindow = (NSWindow *)Handle;
|
||||
}
|
||||
// Qt "window" import
|
||||
else if ([(id)Handle isKindOfClass:[NSView class]])
|
||||
{
|
||||
cocoaWindow = [(NSView *)Handle window];
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr
|
||||
<< "Cannot import this Window Handle because it is neither"
|
||||
<< "a <NSWindow *> nor <NSView *> object"
|
||||
<< "(or any of its subclasses). You gave a <"
|
||||
<< [[(id)Handle className] UTF8String]
|
||||
<< "> object."
|
||||
<< std::endl;
|
||||
|
||||
}
|
||||
|
||||
if (cocoaWindow)
|
||||
{
|
||||
|
||||
// We create the window according to the given handle
|
||||
myWrapper = [[WindowWrapper alloc] initWithWindow:(NSWindow *)Handle
|
||||
myWrapper = [[WindowWrapper alloc] initWithWindow:cocoaWindow
|
||||
settings:params
|
||||
delegate:this];
|
||||
|
||||
|
@ -115,6 +134,16 @@ myWheelStatus(0.0f)
|
|||
std::cerr << "Failed to make the public window" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr
|
||||
<< "Could not get a valid NSWindow object from the given handle"
|
||||
<< " (%p <"
|
||||
<< [[(id)Handle className] UTF8String]
|
||||
<< ">"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <fcntl.h>
|
||||
#elif defined(SFML_SYSTEM_FREEBSD)
|
||||
// #include <sys/joystick.h> ?
|
||||
#define ABS_MAX 1
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -364,20 +364,16 @@ void WindowImplWin32::SwitchToFullscreen(const VideoMode& mode)
|
|||
return;
|
||||
}
|
||||
|
||||
// Change window style (no border, no titlebar, ...)
|
||||
SetWindowLong(myHandle, GWL_STYLE, WS_POPUP);
|
||||
SetWindowLong(myHandle, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||
|
||||
// And resize it so that it fits the entire screen
|
||||
// Resize the window so that it fits the entire screen
|
||||
SetWindowPos(myHandle, HWND_TOP, 0, 0, mode.Width, mode.Height, SWP_FRAMECHANGED);
|
||||
ShowWindow(myHandle, SW_SHOW);
|
||||
|
||||
// Make the window flags compatible with fullscreen mode
|
||||
SetWindowLong(myHandle, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
SetWindowLong(myHandle, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||
|
||||
// Set "this" as the current fullscreen window
|
||||
FullscreenWindow = this;
|
||||
|
||||
// SetPixelFormat can fail (really ?) if window style doesn't contain these flags
|
||||
long style = GetWindowLong(myHandle, GWL_STYLE);
|
||||
SetWindowLong(myHandle, GWL_STYLE, style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -426,6 +426,10 @@ void Window::OnEvent(const Event& event)
|
|||
////////////////////////////////////////////////////////////
|
||||
void Window::Initialize()
|
||||
{
|
||||
// Clear the event queue
|
||||
while (!myEvents.empty())
|
||||
myEvents.pop();
|
||||
|
||||
// Listen to events from the new window
|
||||
myWindow->AddListener(this);
|
||||
myWindow->AddListener(&myInput);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue