Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Surface rotozoom Support #62

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
695aa48
Enable SDL_UpdateRects
atomsymbol-notifications Jul 25, 2010
74324fe
Honestly, the Go-SDL package is a really naive wrapper. So, add locki…
atomsymbol-notifications Jul 30, 2010
42617c4
Add a funny "⚛" prefix (this enables to install this package in paral…
atomsymbol-notifications Aug 19, 2010
8a7d373
Update in response to Go release.2010-08-25
atomsymbol-notifications Aug 25, 2010
9f43395
Minor Makefile updates. See also http://groups.google.com/group/golan…
atomsymbol-notifications Aug 26, 2010
30be028
Remove sdl.GetTicks and sdl.Delay
atomsymbol-notifications Aug 31, 2010
6f250b4
Use a Go channel for delivering events.
atomsymbol-notifications Sep 2, 2010
c1cac45
Add support for SDL low-level sound API
atomsymbol-notifications Sep 6, 2010
07d3f06
Allow CloseAudio() to interrupt an ongoing audio-data send
atomsymbol-notifications Sep 7, 2010
a3a579d
Ignore *cgo*.so files
atomsymbol-notifications Sep 10, 2010
47ac343
Add Go-SDL version descriptors
atomsymbol-notifications Sep 10, 2010
2097424
Add SDL_ShowCursor
atomsymbol-notifications Sep 13, 2010
ce3db8d
Merge http://github.com/banthar/Go-SDL into atom_merge
Sep 14, 2010
61e5f0d
Run gofmt
Sep 14, 2010
76fc319
Fix makefiles
Sep 14, 2010
d851d41
Apply fixes to the last merge, remove "sdldraw.go"
atomsymbol-notifications Sep 15, 2010
19e117c
Minor fix when opening audio
atomsymbol-notifications Sep 18, 2010
337b3e3
Update in response to Go release.2010-12-15.1
atomsymbol-notifications Dec 16, 2010
d5b06f9
Fix a race condition when closing SDL audio, add "-lrt" when linking …
atomsymbol-notifications Dec 17, 2010
138094d
Remove a couple of lines obsoleted by Go release.2010-12-15
atomsymbol-notifications Dec 18, 2010
9b938eb
Fix Keysym struct on AMD64
Jan 2, 2011
5d4d273
Minor adjustment to the "Keysym" structure in the x86-64 version
atomsymbol-notifications Jan 8, 2011
9770d33
Update in response to Go release.2011-01-20 (removal of the 'float' t…
atomsymbol-notifications Jan 20, 2011
1a867f6
Add thread-safety to TTF bindings
atomsymbol-notifications Jan 23, 2011
4f11657
Add support for joystick devices
Jan 24, 2011
ad9bf9e
Add BallDelta struct to structs.6.go
Jan 24, 2011
69bdd70
Restore previous structs.*.go files.
Jan 24, 2011
f58ba7d
Merge branch 'master' of github.com:remogatto/Go-SDL
Jan 24, 2011
b97d31d
Remove BallDelta from structs.*.go.
Jan 24, 2011
db06a17
Fix internal comments
atomsymbol-notifications Jan 26, 2011
c5ee047
Merge remote branch 'remogatto/master'
atomsymbol-notifications Jan 26, 2011
58be877
Remove per-joystick locking (the underlying C code does not need it),…
atomsymbol-notifications Jan 26, 2011
aebe60f
If required, lock the main video surface while blitting (this enables…
atomsymbol-notifications Feb 21, 2011
626e801
Update in response to Go release.2011-02-24, run gofmt
atomsymbol-notifications Feb 25, 2011
52520e7
Update in response to Go release r59, add support for some forgotten …
atomsymbol-notifications Aug 2, 2011
d2fdc57
Use atom/sdl instead of ⚛sdl as import path
atomsymbol-notifications Nov 20, 2011
ab77a74
Remove dependency on CLOCK_MONOTONIC in callback.c
atomsymbol-notifications Dec 9, 2011
33ecb96
Use -lpthread instead of -lrt on Windows
atomsymbol-notifications Dec 9, 2011
0a164ce
Use gomake in Makefile, move "pkg-config ..." from Makefiles to Go files
atomsymbol-notifications Dec 12, 2011
8f320be
Add SDL_GL_* constants (patch suggested by https://github.com/cjyar)
atomsymbol-notifications Dec 12, 2011
392a2f1
Remove the "4s" directory
atomsymbol-notifications Dec 12, 2011
9b7741f
Update to meet the requirements of Go1
atomsymbol-notifications Feb 20, 2012
a121788
Add documentation
atomsymbol-notifications Feb 22, 2012
907dcec
Fix installation procedure in README.md
atomsymbol-notifications Mar 7, 2012
22a4451
Unfix installation procedure in README.md
atomsymbol-notifications Mar 13, 2012
77a8d9e
gofmt
nictuku Apr 17, 2012
bff97f1
Add SaveBMP
nictuku Apr 17, 2012
ae18f3c
Merge pull request #4 from nictuku/master
atomsymbol-notifications Apr 18, 2012
e511ba7
Fix compilation with older SDL packages which may be missing some pkg…
atomsymbol-notifications May 7, 2012
21f86f8
Remove dependency on librt on Darwin.
alecthomas May 7, 2012
c2a7126
Merge pull request #5 from alecthomas/master
atomsymbol-notifications May 7, 2012
bc756c5
Better GOPATH handling in SDL test
atomsymbol-notifications May 8, 2012
fda0275
Add more constants
atomsymbol-notifications May 24, 2012
e4605f9
darwin: use SDL_VIDEODRIVER=x11
atomsymbol-notifications May 24, 2012
f8ad297
Use runtime.LockOSThread() in sdl.GL_SwapBuffers()
atomsymbol-notifications Sep 1, 2012
3d24e2a
Use runtime.LockOSThread() in sdl.GL_SwapBuffers()
atomsymbol-notifications Sep 1, 2012
9a610ba
Merge branch 'master' of github.com:0xe2-0x9a-0x9b/Go-SDL
atomsymbol-notifications Sep 1, 2012
be3a1ca
Revert patch "Use runtime.LockOSThread() in sdl.GL_SwapBuffers()"
atomsymbol-notifications Sep 7, 2012
e60f366
Add the DisplayFormatAlpha function.
cespare Sep 10, 2012
d4ded26
Merge pull request #11 from cespare/displayformatalpha
atomsymbol-notifications Sep 10, 2012
c6f47f2
added linux/arm
davecheney Sep 18, 2012
f4b2c0a
Merge pull request #12 from davecheney/master
atomsymbol-notifications Sep 19, 2012
9616c79
Do not force SDL_VIDEODRIVER=x11 on Darwin
atomsymbol-notifications Nov 25, 2012
7180e26
Comment out unused "os" import
jpgneves Dec 23, 2012
e94ed20
Merge pull request #14 from jpgneves/patch-1
atomsymbol-notifications Dec 23, 2012
476ec31
Fix cgo include paths
atomsymbol-notifications Jan 17, 2013
cf243dd
Update cgo pkg-config directives
atomsymbol-notifications Jan 17, 2013
a005db5
Add sdl.Delay function
atomsymbol-notifications Jan 30, 2013
5b0bca9
Add sdl.GetTicks function
atomsymbol-notifications Jan 30, 2013
5cb687c
Add sdl.CreateRGBSurfaceFrom
atomsymbol-notifications Feb 2, 2013
88d907c
introducing callback-based sound mixing
neagix Feb 10, 2013
9926446
formatting & remove old version of callback.c
neagix Feb 10, 2013
ea866ee
reorganizing
neagix Feb 10, 2013
b9ad40f
updated README.md
neagix Feb 10, 2013
cac5cbc
reorganizing
neagix Feb 10, 2013
336d7f9
added buzzer example
neagix Feb 10, 2013
0c18d50
some bugfixes
neagix Feb 10, 2013
e623dcb
added known issues
neagix Feb 10, 2013
8d24ad5
formatting
neagix Feb 10, 2013
7fa9608
Removed reference to now deleted repository (see Go-nuts list), and r…
svip Jun 8, 2013
85fd8d7
Merge pull request #1 from svip/master
neagix Jun 9, 2013
b0c2a68
Removed unnecessary callback package reference
neagix Jun 16, 2013
4e89736
Adds minimal support for SDL's RWops. At the moment, only 2 functions…
asig Jun 22, 2013
6fbb04a
Adds minimal support for SDL's RWops. At the moment, only 2 functions…
asig Jun 22, 2013
be9133e
fixed comment
asig Jun 22, 2013
898801a
removed unused imports
asig Jun 22, 2013
7871f7d
Merge pull request #2 from asig/master
neagix Jun 23, 2013
aa70776
remove references to old git repo
telecoda Jul 16, 2013
f2e4f0a
Merge pull request #4 from telecoda/master
neagix Jul 18, 2013
f567d36
Add bindings for SDL_Sound.
sqweek Jul 16, 2013
5d5912d
Merge pull request #5 from sqweek/SDL_Sound
neagix Aug 4, 2013
3f8ef94
SDL_sound: Various fixes/cleanup.
sqweek Jan 7, 2014
4eb3f9a
Merge pull request #7 from sqweek/sound_fix1401
neagix Mar 28, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
**~
main
**.[o86]
.obj/
**.cgo*.*
**/_obj
**/*.out
test/test
shoot.png
**_cgo*
*.so
sdl-test/sdl-test
sdl-template/sdl-template
42 changes: 0 additions & 42 deletions 4s/4s.go

This file was deleted.

16 changes: 0 additions & 16 deletions 4s/Makefile

This file was deleted.

15 changes: 0 additions & 15 deletions 4s/xs.patch

This file was deleted.

21 changes: 0 additions & 21 deletions Makefile

This file was deleted.

5 changes: 0 additions & 5 deletions README

This file was deleted.

29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Introduction

This is an improved version of 0xe2-0x9a-0x9b's [Go-SDL](https://github.com/0xe2-0x9a-0x9b/Go-SDL)
currently mantained by neagix.

The improvements/differences are:

* audio callback support
* downstreaming support

There is a nice and fully working PC speaker buzzer example in examples/callback.

# Known issues

The re-designed audio system supports only signed 16bit samples, but writing the others is as easy as a copy/paste.

# Installation

Make sure you have SDL, SDL-image, SDL-mixer and SDL-ttf (all in -dev version).

Installing libraries and examples:

go get -v github.com/neagix/Go-SDL/sdl
go get -v github.com/neagix/Go-SDL/sdl/audio


# Credits

Music to test SDL-mixer is by Kevin MacLeod.
26 changes: 0 additions & 26 deletions TODO

This file was deleted.

55 changes: 0 additions & 55 deletions doc/template.go

This file was deleted.

149 changes: 149 additions & 0 deletions examples/callback/buzzer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* Copyright neagix 2013
* This sample is part of langwar project
* https://github.com/neagix/langwar
*
* Licensed under GNU/GPL v2
*/

package main

import "github.com/neagix/Go-SDL/sdl/audio"
import "math"
import "time"

type BeepObject struct {
Freq float64
SamplesLeft int
}

var Play chan BeepObject

const AMPLITUDE = 28000
const FREQUENCY = 44100
const AUDIO_SAMPLES = 2048

func Beep(freq, duration int) {
bo := BeepObject{
Freq: float64(freq),
SamplesLeft: duration * FREQUENCY / 1000}

Play <- bo
}

func Init() bool {

desiredSpec := audio.AudioSpec{
Freq: FREQUENCY,
Format: audio.AUDIO_S16SYS,
Channels: 1,
Samples: AUDIO_SAMPLES,
}
var obtainedSpec audio.AudioSpec

if audio.OpenAudio(&desiredSpec, &obtainedSpec) != 0 {
return false
}

Play = make(chan BeepObject)

// start the playback queue processor
go func() {
for {
// pick next beep object
bo := <-Play

stream := make([]int16, bo.SamplesLeft)

v := float64(0)
for i := 0; i < bo.SamplesLeft; i++ {
stream[i] = int16(AMPLITUDE * math.Sin(v*2*math.Pi/FREQUENCY))
v += bo.Freq
}

audio.SendAudio_int16(stream)
}
}()

return true
}

// to be deferred after corresponding Init()
func Quit() {
defer audio.CloseAudio()
}

// song by niniel1 as found at http://gendou.com/t/20439
func PlaySong1() {
Beep(349, 400)
time.Sleep(time.Millisecond * 33)
Beep(392, 133)
time.Sleep(time.Millisecond * 33)
Beep(440, 267)
time.Sleep(time.Millisecond * 33)
Beep(440, 267)
time.Sleep(time.Millisecond * 33)
Beep(392, 133)
time.Sleep(time.Millisecond * 33)
Beep(349, 133)
time.Sleep(time.Millisecond * 33)
Beep(392, 133)
time.Sleep(time.Millisecond * 33)
Beep(440, 133)
time.Sleep(time.Millisecond * 33)
Beep(349, 267)
time.Sleep(time.Millisecond * 33)
Beep(262, 267)
time.Sleep(time.Millisecond * 33)
Beep(349, 400)
time.Sleep(time.Millisecond * 33)
Beep(392, 133)
time.Sleep(time.Millisecond * 33)
Beep(440, 267)
time.Sleep(time.Millisecond * 33)
Beep(440, 267)
time.Sleep(time.Millisecond * 33)
Beep(392, 133)
time.Sleep(time.Millisecond * 33)
Beep(349, 133)
time.Sleep(time.Millisecond * 33)
Beep(392, 133)
time.Sleep(time.Millisecond * 33)
Beep(440, 133)
time.Sleep(time.Millisecond * 33)
Beep(349, 533)
time.Sleep(time.Millisecond * 33)
}

// find out more songs at https://github.com/binarypearl/beepbeep
func PlaySong3() {
Beep(784, 100)
Beep(784, 100)
Beep(784, 100)
time.Sleep(time.Millisecond * 100)
Beep(784, 600)
Beep(622, 600)
Beep(698, 600)
Beep(784, 200)
time.Sleep(time.Millisecond * 200)
Beep(698, 200)
Beep(784, 800)

}

func main() {
if !Init() {
return
}
defer Quit()

// start playback, yeah!
audio.PauseAudio(false)

PlaySong1()

// it's a silence :)
Beep(0, 400)

PlaySong3()
}
File renamed without changes.
Loading