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
@ -1,6 +1,6 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFGE - Simple and Fast Game Engine
|
||||
// SFGE - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
|
@ -10,16 +10,16 @@ setup(name='PySFML',
|
||||
author_email='remi.k2620@gmail.com',
|
||||
url='http://www.sfml-dev.org/',
|
||||
license='zlib/png',
|
||||
ext_modules=[ Extension('PySFML.sf', \
|
||||
['src/Clock.cpp', 'src/Color.cpp', 'src/Drawable.cpp', \
|
||||
'src/Event.cpp', 'src/Image.cpp', 'src/Input.cpp', 'src/Key.cpp', 'src/main.cpp', 'src/Music.cpp', \
|
||||
'src/Shader.cpp', 'src/Rect.cpp', 'src/RenderWindow.cpp', 'src/Sleep.cpp', \
|
||||
'src/Sprite.cpp', 'src/Text.cpp', 'src/VideoMode.cpp', 'src/View.cpp', 'src/Window.cpp', \
|
||||
'src/Joy.cpp', 'src/Mouse.cpp', 'src/WindowStyle.cpp', 'src/Blend.cpp', 'src/Sound.cpp', \
|
||||
'src/SoundBuffer.cpp', 'src/Listener.cpp', 'src/SoundRecorder.cpp', 'src/SoundBufferRecorder.cpp', \
|
||||
'src/SoundStream.cpp', 'src/Font.cpp', 'src/Glyph.cpp', 'src/Shape.cpp', 'src/ContextSettings.cpp' ], \
|
||||
libraries=['sfml-graphics', 'sfml-window', 'sfml-audio', 'sfml-system'], \
|
||||
library_dirs=['../lib/mingw'], \
|
||||
ext_modules=[ Extension('PySFML.sf',
|
||||
['src/Clock.cpp', 'src/Color.cpp', 'src/Drawable.cpp',
|
||||
'src/Event.cpp', 'src/Image.cpp', 'src/Input.cpp', 'src/Key.cpp', 'src/main.cpp', 'src/Music.cpp',
|
||||
'src/Shader.cpp', 'src/Rect.cpp', 'src/RenderWindow.cpp', 'src/Sleep.cpp',
|
||||
'src/Sprite.cpp', 'src/Text.cpp', 'src/VideoMode.cpp', 'src/View.cpp', 'src/Window.cpp',
|
||||
'src/Joy.cpp', 'src/Mouse.cpp', 'src/WindowStyle.cpp', 'src/Blend.cpp', 'src/Sound.cpp',
|
||||
'src/SoundBuffer.cpp', 'src/Listener.cpp', 'src/SoundRecorder.cpp', 'src/SoundBufferRecorder.cpp',
|
||||
'src/SoundStream.cpp', 'src/Font.cpp', 'src/Glyph.cpp', 'src/Shape.cpp', 'src/ContextSettings.cpp'],
|
||||
libraries=['sfml-graphics', 'sfml-window', 'sfml-audio', 'sfml-system'],
|
||||
library_dirs=['../lib/mingw'],
|
||||
include_dirs=['../include']
|
||||
)],
|
||||
package_dir = {'PySFML':'PySFML'},
|
||||
|
@ -101,5 +101,14 @@ void PySfJoy_InitConst()
|
||||
obj = PyLong_FromLong(sf::Joy::AxisPOV);
|
||||
PyDict_SetItemString(PySfJoyType.tp_dict, "AxisPOV", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyLong_FromLong(sf::Joy::Count);
|
||||
PyDict_SetItemString(PySfJoyType.tp_dict, "Count", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyLong_FromLong(sf::Joy::AxisCount);
|
||||
PyDict_SetItemString(PySfJoyType.tp_dict, "AxisCount", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyLong_FromLong(sf::Joy::ButtonCount);
|
||||
PyDict_SetItemString(PySfJoyType.tp_dict, "ButtonCount", obj);
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
|
@ -95,5 +95,8 @@ void PySfMouse_InitConst()
|
||||
obj = PyLong_FromLong(sf::Mouse::XButton2);
|
||||
PyDict_SetItemString(PySfMouseType.tp_dict, "XButton2", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyLong_FromLong(sf::Mouse::ButtonCount);
|
||||
PyDict_SetItemString(PySfMouseType.tp_dict, "ButtonCount", obj);
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
|
@ -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…
Reference in New Issue
Block a user