Skip to content

Instantly share code, notes, and snippets.

View mudhairless's full-sized avatar

Ebben Feagan mudhairless

View GitHub Profile
@mudhairless
mudhairless / flyer1
Created November 23, 2013 04:44
Part 1 of flyer.bas containing the utility functions and types.
'Flying Toasters with Toast
'Inspired by the classic After Dark screensaver.
'Consider this code under the terms of the STFUOIWCU license <http://mud.owlbox.net/license/STFUOIWCU>
'
'Compile with:
'fbc -s gui -w all -x flyer.scr flyer.bas flyer.rc
#include "ssk.bas"
#include once "fbgfx.bi"
function RndRange (byval min_ as integer, byval max_ as integer, byval getnew as integer = 1) as integer
@mudhairless
mudhairless / ssk (mod for flyer).bas
Last active December 29, 2015 03:49
FreeBASIC Screensaver Kit by jofers
'modded by sir_mud 11/2013 to run with FB 0.90.1 (differences in ThreadCreate and added extremely minimal ini config)
' tweaked by tinram 6/6/07 to run with FB 0.17b (RETURNs in CASE statements were killing it)
' 0.16 original by jofers
'Option Explicit
#include "windows.bi"
type configuration
@mudhairless
mudhairless / gist:5464638
Created April 26, 2013 01:57
FreeBASIC Average of an Array
function average ( arr() as integer ) as integer
var ret = 0
for n as integer = 0 to ubound(arr)
ret += arr(n)
ret /= 2
next
return ret
end function
<document lang="en_US">
<title>Document title</title>
<author bio="http://site.com/author" email="author@site.com">Joe Author</author>
<summary>This is a sample document.</summary>
</document>
#include once "ext/xml/dom.bi"
var xmldoc = new ext.xml.tree
xmldoc->load("mydocument.xml")
var xmlroot = xmldoc->root
print "Children of document: " & xmlroot->child("document")->children
print "Author: " & xmlroot->child("document")->child("author")->getText
var doc = xmlroot->child("document")
print "Author Bio: " & doc->child("author")->attribute("bio")
#include once "ext/xml/dom.bi"
var xmldoc = new ext.xml.tree
xmldoc->load("mydocument.xml")
var xmlroot = xmldoc->root
'do stuff
xmldoc->unload("mydocument.xml")
delete xmldoc
sub hello_world()
print "Hello, World"
end sub
hello_world()
for i as integer = 1 to 4
delete car(i)
delete logs(i)
delete pads(i)
next
delete pads(5)
imagedestroy background
if temp_cy < 352 and temp_cy > 224 then
'test for collision with car
for i as integer = 1 to 4
if frog.isCollided( *(car(i)) ) then frog_dir = FROG_DEAD
next i
end if
if temp_cy < 192 and temp_cy > 64 then
'test collision with a log
for i as integer = 1 to 4
if frog.isCollided( *(logs(i)) ) then chosenLog = i
if timer > (now + 0.25) then
if multikey(SC_SPACE) then reply = "y"
if multikey(SC_ESCAPE) then reply = "x"
if temp_cy > 63 and frog_dir < FROG_DEAD then'test frog hasn't reached home
if multikey(SC_DOWN) and temp_cy <352 then
frog.update(0, frog_speed)
now = timer
chosenLog=0
frog_dir = direction.south
end if