Added Pink Pony, from Arch Linux PKGBUILD files (game and dependencies).

parent 8d228952
#ifdef _MSC_VER
#pragma warning(disable : 4786)
#endif
#include <set>
#include <string>
#include <vector>
#include "Commands.h"
#include "DeviceFrame.h"
#include "SoundEffectFrame.h"
#include "StreamFrame.h"
#include "wxPlayer.h"
#if wxCHECK_VERSION(2,5,3)
#include "wx/generic/numdlgg.h"
#endif
template<typename T>
std::string Join(
T cont,
const std::string& joiner,
const std::string& prefix = "")
{
std::string result;
typename T::iterator i = cont.begin();
for (;;) {
result += prefix + *i++;
if (i == cont.end()) {
break;
} else {
result += joiner;
}
}
return result;
}
BEGIN_EVENT_TABLE(DeviceFrame, wxMDIParentFrame)
EVT_MENU(DEVICE_NEW_DEVICE, DeviceFrame::OnDeviceNewDevice)
EVT_MENU(DEVICE_NEW_CDDEVICE, DeviceFrame::OnDeviceNewCDDevice)
EVT_MENU(DEVICE_NEW_MIDIDEVICE, DeviceFrame::OnDeviceNewMIDIDevice)
EVT_MENU(DEVICE_OPEN_STREAM, DeviceFrame::OnDeviceOpenStream)
EVT_MENU(DEVICE_OPEN_SOUND, DeviceFrame::OnDeviceOpenSound)
EVT_MENU(DEVICE_CREATE_TONE, DeviceFrame::OnDeviceCreateTone)
EVT_MENU(DEVICE_CREATE_SQUARE_WAVE, DeviceFrame::OnDeviceCreateSquareWave)
EVT_MENU(DEVICE_CREATE_WHITE_NOISE, DeviceFrame::OnDeviceCreateWhiteNoise)
EVT_MENU(DEVICE_CREATE_PINK_NOISE, DeviceFrame::OnDeviceCreatePinkNoise)
EVT_MENU(DEVICE_OPEN_SINGLE_EFFECT, DeviceFrame::OnDeviceOpenSingleEffect)
EVT_MENU(DEVICE_OPEN_MULTIPLE_EFFECT, DeviceFrame::OnDeviceOpenMultipleEffect)
EVT_MENU(DEVICE_CLOSE_WINDOW, DeviceFrame::OnDeviceCloseCurrentWindow)
EVT_MENU(DEVICE_CLOSE, DeviceFrame::OnDeviceClose)
EVT_MENU(HELP_ABOUT, DeviceFrame::OnHelpAbout)
END_EVENT_TABLE()
DeviceFrame::DeviceFrame(audiere::AudioDevicePtr device)
: wxMDIParentFrame(0, -1, wxT("Audio Device - " + CStr2wxString( device->getName() )),
wxDefaultPosition, wxSize(400, 500))
{
m_device = device;
wxMenu* deviceMenu = new wxMenu();
deviceMenu->Append(DEVICE_NEW_DEVICE, wxT("&New Device..."));
deviceMenu->Append(DEVICE_NEW_CDDEVICE, wxT("New C&D Device..."));
deviceMenu->Append(DEVICE_NEW_MIDIDEVICE, wxT("New &MIDI Device..."));
deviceMenu->AppendSeparator();
deviceMenu->Append(DEVICE_OPEN_STREAM, wxT("&Open Stream..."));
deviceMenu->Append(DEVICE_OPEN_SOUND, wxT("Open &Sound..."));
deviceMenu->AppendSeparator();
deviceMenu->Append(DEVICE_CREATE_TONE, wxT("Create &Tone..."));
deviceMenu->Append(DEVICE_CREATE_SQUARE_WAVE, wxT("Create S&quare Wave..."));
deviceMenu->Append(DEVICE_CREATE_WHITE_NOISE, wxT("Create &White Noise"));
deviceMenu->Append(DEVICE_CREATE_PINK_NOISE, wxT("Create &Pink Noise"));
deviceMenu->AppendSeparator();
deviceMenu->Append(DEVICE_OPEN_SINGLE_EFFECT, wxT("Open &Effect (Single)..."));
deviceMenu->Append(DEVICE_OPEN_MULTIPLE_EFFECT, wxT("Open Effect (&Multiple)..."));
deviceMenu->AppendSeparator();
deviceMenu->Append(DEVICE_CLOSE_WINDOW, wxT("Close C&urrent Window"));
deviceMenu->Append(DEVICE_CLOSE, wxT("&Close Device"));
wxMenu* helpMenu = new wxMenu();
helpMenu->Append(HELP_ABOUT, wxT("&About..."));
wxMenuBar* menuBar = new wxMenuBar();
menuBar->Append(deviceMenu, wxT("&Device"));
menuBar->Append(helpMenu, wxT("&Help"));
SetMenuBar(menuBar);
SetFocus();
}
void DeviceFrame::OnDeviceNewDevice(wxCommandEvent&) {
wxGetApp().OnNewDevice(this);
}
void DeviceFrame::OnDeviceNewCDDevice(wxCommandEvent&) {
wxGetApp().OnNewCDDevice(this);
}
void DeviceFrame::OnDeviceNewMIDIDevice(wxCommandEvent&) {
wxGetApp().OnNewMIDIDevice(this);
}
wxString DeviceFrame::GetSoundFile() {
std::vector<audiere::FileFormatDesc> formats;
audiere::GetSupportedFileFormats(formats);
// combine all of the supported extensions into one collection
std::set<std::string> all_extensions;
{
for (unsigned i = 0; i < formats.size(); ++i) {
for (unsigned j = 0; j < formats[i].extensions.size(); ++j) {
all_extensions.insert("*." + formats[i].extensions[j]);
}
}
}
// build a string of wildcards for wxWindows
std::string wildcards;
wildcards = "Sound Files (" + Join(all_extensions, ",") + ")|";
wildcards += Join(all_extensions, ";") + "|";
{
for (unsigned i = 0; i < formats.size(); ++i) {
audiere::FileFormatDesc& ffd = formats[i];
wildcards += ffd.description + " ";
wildcards += "(" + Join(ffd.extensions, ",", "*.") + ")|";
wildcards += Join(ffd.extensions, ";", "*.") + "|";
}
}
wildcards += "All Files (*.*)|*.*";
return wxFileSelector(
wxT("Select a sound file"), wxT(""), wxT(""), wxT(""),
CStr2wxString(wildcards.c_str()), wxOPEN, this);
}
void DeviceFrame::OnDeviceOpenStream(wxCommandEvent &) {
wxString filename(GetSoundFile());
if (filename.empty()) {
return;
}
#if wxUSE_UNICODE
wxCharBuffer buffFilename = filename.mb_str(wxConvUTF8);
audiere::SampleSourcePtr source = audiere::OpenSampleSource(buffFilename.data());
#else
audiere::SampleSourcePtr source = audiere::OpenSampleSource(filename);
#endif
if (!source) {
wxMessageBox(
wxT("Could not open sample source: ") + filename,
wxT("Open Stream"), wxOK | wxCENTRE, this);
return;
}
audiere::LoopPointSourcePtr loop_source =
audiere::CreateLoopPointSource(source);
if (loop_source) {
source = loop_source.get();
}
audiere::OutputStreamPtr stream = audiere::OpenSound(
m_device,
source,
true);
if (!stream) {
wxMessageBox(
wxT("Could not open output stream: ") + filename,
wxT("Open Stream"), wxOK | wxCENTRE, this);
return;
}
// get the basename of the path for the window title
wxString basename = wxFileNameFromPath(filename);
new StreamFrame(this, wxT("Stream: ") + basename, stream.get(), source.get(), loop_source.get());
}
void DeviceFrame::OnDeviceOpenSound(wxCommandEvent &) {
wxString filename(GetSoundFile());
if (filename.empty()) {
return;
}
audiere::SampleSourcePtr source = audiere::OpenSampleSource(wxString2CStr(filename));
if (!source) {
wxMessageBox(
wxT("Could not open source: ") + filename,
wxT("Open Sound"), wxOK | wxCENTRE, this);
return;
}
audiere::OutputStreamPtr stream = audiere::OpenSound(m_device, source);
if (!stream) {
wxMessageBox(
wxT("Could not open sound: ") + filename,
wxT("Open Sound"), wxOK | wxCENTRE, this);
return;
}
// get the basename of the path for the window title
wxString basename = wxFileNameFromPath(filename);
new StreamFrame(this, wxT("Sound: ") + basename, stream.get(), source.get());
}
void DeviceFrame::OnDeviceCreateTone(wxCommandEvent &) {
int frequency = ::wxGetNumberFromUser(
wxT("Value must be between 1 and 30000."), wxT("Enter frequency in Hz"),
wxT("Create Tone"), 256, 1, 30000, this);
if (frequency != -1) {
audiere::SampleSourcePtr source = audiere::CreateTone(frequency);
if (!source) {
wxMessageBox(
wxT("Could not create tone"),
wxT("Create Tone"), wxOK | wxCENTRE, this);
return;
}
audiere::OutputStreamPtr stream = m_device->openStream(source.get());
if (!stream) {
wxMessageBox(
wxT("Could not open output stream"),
wxT("Create Tone"), wxOK | wxCENTRE, this);
return;
}
wxString title;
title.sprintf(wxT("Tone: %d Hz"), frequency);
new StreamFrame(this, title, stream.get(), source.get());
}
}
void DeviceFrame::OnDeviceCreateSquareWave(wxCommandEvent &) {
int frequency = ::wxGetNumberFromUser(
wxT("Value must be between 1 and 30000."), wxT("Enter frequency in Hz"),
wxT("Create Square Wave"), 256, 1, 30000, this);
if (frequency != -1) {
audiere::SampleSourcePtr source = audiere::CreateSquareWave(frequency);
if (!source) {
wxMessageBox(
wxT("Could not create square wave"),
wxT("Create Square Wave"), wxOK | wxCENTRE, this);
return;
}
audiere::OutputStreamPtr stream = m_device->openStream(source.get());
if (!stream) {
wxMessageBox(
wxT("Could not open output stream"),
wxT("Create Square Wave"), wxOK | wxCENTRE, this);
return;
}
wxString title;
title.sprintf(wxT("Square Wave: %d Hz"), frequency);
new StreamFrame(this, title, stream.get(), source.get());
}
}
void DeviceFrame::OnDeviceCreateWhiteNoise(wxCommandEvent &) {
audiere::SampleSourcePtr source = audiere::CreateWhiteNoise();
if (!source) {
wxMessageBox(
wxT("Could not create white noise"),
wxT("Create White Noise"), wxOK | wxCENTRE, this);
return;
}
audiere::OutputStreamPtr stream = m_device->openStream(source.get());
if (!stream) {
wxMessageBox(
wxT("Could not open output stream"),
wxT("Create White Noise"), wxOK | wxCENTRE, this);
return;
}
new StreamFrame(this, wxT("White Noise"), stream.get(), source.get());
}
void DeviceFrame::OnDeviceCreatePinkNoise(wxCommandEvent &) {
audiere::SampleSourcePtr source = audiere::CreatePinkNoise();
if (!source) {
wxMessageBox(
wxT("Could not create white noise"),
wxT("Create Pink Noise"), wxOK | wxCENTRE, this);
return;
}
audiere::OutputStreamPtr stream = m_device->openStream(source.get());
if (!stream) {
wxMessageBox(
wxT("Could not open output stream"),
wxT("Create Pink Noise"), wxOK | wxCENTRE, this);
return;
}
new StreamFrame(this, wxT("Pink Noise"), stream.get(), source.get());
}
void DeviceFrame::OnDeviceOpenSingleEffect(wxCommandEvent &) {
DoOpenEffect(audiere::SINGLE, wxT("Single"));
}
void DeviceFrame::OnDeviceOpenMultipleEffect(wxCommandEvent &) {
DoOpenEffect(audiere::MULTIPLE, wxT("Multiple"));
}
void DeviceFrame::DoOpenEffect(audiere::SoundEffectType type, wxString typestring) {
wxString filename(GetSoundFile());
if (filename.empty()) {
return;
}
audiere::SoundEffectPtr effect = audiere::OpenSoundEffect(m_device, wxString2CStr(filename), type);
if (effect) {
wxString basename = wxFileNameFromPath(filename);
wxString title;
title.sprintf(wxT("Sound Effect (%s): %s"),
typestring.c_str(), basename.c_str());
new SoundEffectFrame(this, title, effect);
} else {
wxMessageBox(
wxT("Could not open sound effect: ") + filename,
wxT("Open Sound Effect"), wxOK | wxCENTRE, this);
}
}
void DeviceFrame::OnDeviceCloseCurrentWindow(wxCommandEvent&) {
wxMDIChildFrame* frame = GetActiveChild();
if (frame) {
frame->Close();
}
}
void DeviceFrame::OnDeviceClose(wxCommandEvent &) {
Close();
}
void DeviceFrame::OnHelpAbout(wxCommandEvent &) {
wxGetApp().ShowAboutDialog(this);
}
#ifndef ADR_MIDI_DEVICE_DIALOG_H
#define ADR_MIDI_DEVICE_DIALOG_H
#include <string>
#include "wx.h"
class MIDIDeviceDialog : public wxDialog {
public:
MIDIDeviceDialog(wxWindow* parent);
const std::string& getName() const {
return m_name_str;
}
private:
void OnButton(wxCommandEvent& event);
wxTextCtrl* m_name;
wxButton* m_ok;
wxButton* m_cancel;
std::string m_name_str;
DECLARE_EVENT_TABLE()
};
#endif
#
# Games Packages for Chakra, part of chakra-project.org
#
# Maintainer: Adrián Chaves Fernández (Gallaecio) <adriyetichaves gmail.com>
pkgname=audiere
pkgver=1.9.4
pkgrel=1
pkgdesc="High-level audio API."
arch=('i686' 'x86_64')
url="http://audiere.sourceforge.net/"
license=('LGPL')
depends=('speex' 'libvorbis' 'libcdaudio')
makdedepends=('flac') # For flac support.
source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz"
"gcc-4.4.patch"
"TagsDialog.h"
"DeviceFrame.cpp"
"MIDIDeviceDialog.h"
"speexfile.cpp.patch")
md5sums=('b95dfe6f1e69cfd12371747f22772766'
'bd082fa9a258ef6598eefe88a71a4279'
'55c31ad9a68304f49f30ac8ca9fa3288'
'0fe69aeb84a6860ef7a36f75887f4f07'
'a80de799a3b833f0331cf83f7f6a27ab'
'8dd3fd42cb0ff4961ec050fc859bcf63')
build() {
cd $srcdir/$pkgname-$pkgver
msg "Applying patches…"
patch -Np1 < $srcdir/gcc-4.4.patch
patch -Np1 < $srcdir/speexfile.cpp.patch
for _i in TagsDialog.h DeviceFrame.cpp MIDIDeviceDialog.h
do
cp $srcdir/${_i} examples/wxPlayer || return 1
done
msg "Compiling…"
./configure \
--prefix=/usr \
--with-pic \
--without-dumb \
--without-wxgtk
make
}
package() {
cd $srcdir/$pkgname-$pkgver
make DESTDIR=$pkgdir install
}
#ifndef TAGS_DIALOG_H
#define TAGS_DIALOG_H
#include <audiere.h>
#include "wx.h"
class TagsDialog : public wxDialog {
public:
TagsDialog(
wxWindow* parent,
audiere::SampleSourcePtr source);
private:
void OnButton(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
wxListBox* m_tags;
wxButton* m_close;
DECLARE_EVENT_TABLE()
};
#endif
diff -Naur audiere-1.9.4.orig//src/audiere.h audiere-1.9.4.new//src/audiere.h
--- audiere-1.9.4.orig//src/audiere.h 2010-04-02 15:58:56.000000000 +0200
+++ audiere-1.9.4.new//src/audiere.h 2010-04-02 16:00:52.000000000 +0200
@@ -28,6 +28,7 @@
#include <vector>
#include <string>
+#include <cstring>
#ifdef _MSC_VER
#pragma warning(disable : 4786)
diff -Naur audiere-1.9.4.orig//src/debug.h audiere-1.9.4.new//src/debug.h
--- audiere-1.9.4.orig//src/debug.h 2010-04-02 15:58:56.000000000 +0200
+++ audiere-1.9.4.new//src/debug.h 2010-04-02 16:01:39.000000000 +0200
@@ -5,7 +5,7 @@
#include <assert.h>
#include <stdio.h>
#include <string>
-
+#include <cstdlib>
namespace audiere {
diff -Naur audiere-1.9.4.orig//src/utility.cpp audiere-1.9.4.new//src/utility.cpp
--- audiere-1.9.4.orig//src/utility.cpp 2010-04-02 15:58:56.000000000 +0200
+++ audiere-1.9.4.new//src/utility.cpp 2010-04-02 16:00:52.000000000 +0200
@@ -4,6 +4,7 @@
#include <ctype.h>
+#include <cstdio>
#include "utility.h"
#include "internal.h"
--- audiere-1.9.4/src/speexfile/speexfile.cpp 2006-02-14 05:57:01.000000000 +0100
+++ audiere-1.9.4/src/speexfile/speexfile.cpp.new 2007-10-04 14:51:32.000000000 +0200
@@ -889,7 +889,7 @@
modeID = header->mode;
if ( forceMode != -1 )
modeID = forceMode;
- mode = speex_mode_list[modeID];
+ mode = const_cast<SpeexMode*>(speex_mode_list[modeID]);
if ( mode->bitstream_version < header->mode_bitstream_version ) {
strcpy ( speex_last_error, "The file was encoded with a newer version of Speex.\nYou need to upgrade in order to play it." );
#
# Games Packages for Chakra, part of chakra-project.org
#
# Maintainer: Adrián Chaves Fernández (Gallaecio) <adriyetichaves gmail.com>
pkgname=glfw
pkgver=2.7
pkgrel=1
pkgdesc="A free, open source, portable framework for OpenGL application development."
arch=('i686' 'x86_64')
url="http://glfw.sourceforge.net/"
license=('ZLIB')
depends=('mesa' 'xorg-server')
source=(http://sunet.dl.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2 )
md5sums=('cc024566d78279c6af728ba2812c9107')
build() {
cd $srcdir/$pkgname-$pkgver
mkdir -p $pkgdir/usr/lib $pkgdir/usr/include/GL
make x11
}
package() {
cd $srcdir/$pkgname-$pkgver
make PREFIX=$pkgdir/usr x11-install
cp $srcdir/$pkgname-$pkgver/lib/x11/libglfw.so $pkgdir/usr/lib
sed -i 's#'$pkgdir'##g' $pkgdir/usr/lib/pkgconfig/libglfw.pc
}
#
# Games Packages for Chakra, part of chakra-project.org
#
# Maintainer: Adrián Chaves Fernández (Gallaecio) <adriyetichaves gmail.com>
pkgname=pink-pony
pkgver=1.2.1
pkgrel=1
pkgdesc="Tron-like multiplayer racing game with ponies."
arch=(i686 x86_64)
url="http://code.google.com/p/pink-pony/"
license=('GPL3')
depends=('glfw' 'ilmbase' 'devil' 'protobuf' 'audiere' 'ftgl' 'libsigc++2.0')
makedepends=('scons')
source=(http://pink-pony.googlecode.com/files/$pkgname-$pkgver.tar.bz2)
md5sums=('3acdab21d3368e0f0e931abcecb916d5')
build() {
cd $srcdir/$pkgname
scons
}
package() {
cd $srcdir/$pkgname
mkdir -p $pkgdir/usr/share/$pkgname
mkdir -p $pkgdir/usr/bin
cp -R README GLSL fonts levels models music textures pony.options levels.xml Pony $pkgdir/usr/share/$pkgname
install -D -m 755 Pony $pkgdir/usr/share/$pkgname/Pony
install -D -m 644 pony.options $pkgdir/usr/share/$pkgname
install -D -m 755 install/pink-pony $pkgdir/usr/bin/pink-pony
install -D -m 644 install/pink-pony.png $pkgdir/usr/share/pixmaps/pink-pony.png
install -D -m 644 install/pink-pony.desktop $pkgdir/usr/share/applications/pink-pony.desktop
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment