Check out Amazon.com!

BlitzCoder Code Archives PageMain Codes Page
Listing: Miscellaneous (93 Entries)
Title: Curved Text or Curved Images using RLE vector routines (not sine scroll - part 1) Code Submitted By:
- andy_a
Curved text and other image manipulation via RLE vector routines. Simple demo of function usage included.

(added support for 16 bit color cards)

(updated: new storage format uses memory more efficiently, needed for use with new functions in part 2)
 
Title: 2 line FPS code Code Submitted By:
- andreas_blixt

This code has now been updated to be much more accurate and it still uses 2 lines! To get the current FPS, just use CurFPS#.
 
Title: 2D Sim City roads (Auto connecting road system) Code Submitted By:
- nebula
When editing your map you can have the problem where you need to constantly select tiles and place them. This system reads the map and automatically places the correct tile.
I first noticed this system in that old game Sim City. Where you build your road and it would magically connect to other roads nearby. This example does just that.
This example can be used for multiple purposes. Lets say for Coast tiles and other tiles that need to connect to one and another.
 
Title: 2d scale/rotate Code Submitted By:
- obviousdisaster

Scaling and rotating routine that works by mapping the image onto a quad. I think it's the fastest you can do in Blitz 2d but this version only works for 256*256 images (although it could easily be modified to work with any size image).
 
Title: 3D Vector and matrix library Code Submitted By:
- paranoidpete
Library that deals with vectors and matrices in an OO kind of way. Only really useful for demo coders working in Blitz 2D I guess.
 
Title: Alternating Tiles Code Submitted By:
- radiumgames

Changes the style of the tile designated when creating a map every time the game is loaded to change the scenery a bit. Also changes locations of trees
 
Title: Analogue clock Code Submitted By:
- metalman

Simple commented code that shows how to create an analogue clock in Blitz. Was about to delete it when I thought it perhaps could be usefull to someone...
 
Title: Angle finder Code Submitted By:
- abraham
A function that finds the angle between two co-ordinates in 2D
 
Title: Asteroids Physics Library Code Submitted By:
- darkeagle
this is an EXTREMELY nice lib for lots of things... space games, hovercraft games, etc. basically anything that you want to have asteroids type ship control in :) just remember who gave it to ya ;)
 
Title: Banking method of rounding Code Submitted By:
- vic-e-babes

Some people think that the way that Blitz rounds floats of exactly
n.5 when assigning them to integers is a bug. I don't think it is.
 
Title: Base 64 encoding and decoding functions Code Submitted By:
- andy_a
Best use for these functions are for encoding binary files into text which is then included as an e-mail attachment. Could also be used to create a "Post-It" like program in Blitz. Thanks go to Mangus for allowing me to post his encoding function here on Blitz Coder web site.
 
Title: Benchmark Collection Code Submitted By:
- thechange

An elaborate collection of benchmarks purely to demonstrate Blitz' strong and weak sides as well as generic behavior.
 
Title: Binary Time (Horizontal version). Code Submitted By:
- kuklisj
OS-time (in Your PC) in binary & graphix form.
U have 2 read it from from up 2 down & from right 2 left.
1 row represents 2 digits (HH:MM:SS).
Have a fun.
sar.com
 
Title: Binary Time (Vertical version). Code Submitted By:
- kuklisj
OS-time (in Your PC) in binary & graphix form.
U have 2 read it from left 2 right & from bottom 2 up.
1 column represents 1 digit.
Have a fun.
sar.com
 
Title: Bit Fields Code Submitted By:
- poedboy
BitFields allow you to store multiple on/off values within a single byte.
2 Functions : GetBit() and SetBit()
 
Title: Bitmap Font on-the-fly Code Submitted By:
- thechange
Demonstrates the creation (and usage) of a bitmap font completely at run-time using specified font.
 
Title: Blitz StringList Code Submitted By:
- thechange
As an example of a linked list, a collection of text lines, like a text file and similar to the StringList in the Windows environment, manually maintained using a set of example functions.
 
Title: Clipping using maths Code Submitted By:
- thechange
Demonstrating clipping values using maths only.
 
Title: Color Field Code Submitted By:
- desalvionjr
 
Title: Coloured TEXT with OUTLINE Code Submitted By:
- da_hobo_hen
This function displays your text, in the current drawing colour, then writes it (in your current font), with a 1 pixel thick black background.

I found this code usefull, and hope you do too.

Just call txt(xpos,ypos,txt$,centeredx,centeredy)
xpos is x posisiton (pixels)
ypos is y position (pixels)
txt$ is the text
centeredx is TRUE/FALSE/1/0 - to center horrizontally
centeredy is TRUE/FALSE/1/0 - to center verticallay
 
Title: Cool 3D Intro Sequence -- Version 2 Code Submitted By:
- g8w4y
This builds a logo out of coloured cubes, the image of which is loaded from an image up to 32 x 32 pixels. This is excellent for splash screens etc, and a simple (and bad) example bmp image can be found at http://www.angelfire.com/musicals/yaar/blitz.bmp for those too lazy to make their own :-). You don't need to put my name anywhere, but the credit would be nice.

New version adds saving support and images don't have to be exactly 32 x 32...
 
Title: Create Directory View In Blitz+ Code Submitted By:
- lattyware

Here is some code I was working on to create a Directory View - please use as much as you want, and adapt it likewise, but I do request some sort of small credit (You don't have to, but it would be nice) and If you use the code, do tell me, as I am interested in how it could be used. It could be set to read a cirtain are only and get a level selector, there are many possiblities.

Lattyware (info@lattyware.co.uk)
 
Title: CreateSquare (plane but not infinite) Code Submitted By:
- abraham

Like create plane like createplane() but not infinte. You can define the size and vertices in the plane and if handle is central or leave it at bottom left hand corner.
 
Title: Cyclical Redundancy Check - Two versions of CRC16 Code Submitted By:
- andy_a
CRC's ensure that data is not corrupted during transmission. Whether loading a file from disk or transferring via modem CRC's ensure data integrity.

Found a QBasic listing (author unknown) here:
www.fys.ruu.nl/
bergmann/crc.bas

Converted to Blitz 2005.1.6

Disclaimer: I program as a hobby. DON'T use this on *ANYTHING* important. User assumes ALL responsibility. Use at your own risk!
 
Title: Destructable outlined terrain Code Submitted By:
- darkeagle

destroy the terrain, and it gets outlined :)

numbers 1-4 choose size of the hole to create.

*DEFINATELY* not optimised... anyone gonna help me speed it up?? :)

enjoy!
 
Title: Detecting Windows' framerate Code Submitted By:
- thechange

Measures the time it takes for a vertical blank using multiple readings. Useful for finding out if vertical sync is disabled.
 
Title: Digital Timer Code Submitted By:
- rhyswynne
Convert any time integer into digital timer format. Requires the digitimer Global mentioned at the top of the file (the other's are simply in the demo).
 
Title: Directory Server Code Submitted By:
- orion pax

This is a directory server program! For those of you who wish to create games/software that has standalone server support and need a way for the clients to download a list of ONLINE games. Use this code! It reports the servers name and the DNS name. Read the comments to learn how to use it with your server software!
 
Title: Dragging windows Code Submitted By:
- thechange

Two very simple examples of dragging a single window (or rectangles) across the screen by using the mouse.
 
Title: Dynamic, accurate, and smart frame limiting Code Submitted By:
- second chance

This code will delay main loop execution to provide accurate frame limiting "on the fly" based on how long the main loop takes to execute each cycle. Use any "frame per second" code to verify correct frame speed. Frame speed variance is usually within 1 fps. Not bad, eh? :)
 
Title: Fat Functions Code Submitted By:
- andy_a

Add line thickness to Lines, Rects, Ovals, Stars, & Circles.
Rects & Ovals can be rotated in near real time (depending on thickness).
All without artifacts (holes) in the thick lines. Commented and has usage examples.

Updated. Now includes fatSuperEllipse() function. Check it out!
 
Title: File Name Functions Code Submitted By:
- poedboy

3 Functions to extract the: pathname, extension, and actual name of a given filename string. Returns a string.
 
Title: Frames Per Second code Code Submitted By:
- spaceface
A small piece of code to show the Frames Per Second. You may want to add an Cls() if there isn't one already in the 'If MilliSecs() ...' statement.
 
Title: Freeing allocated objects and resources Code Submitted By:
- thechange

Normally one has to remove what he has left behind, but with Blitz this is ancient history.
 
Title: Google Search Bar for BlitzPlus Interface Code Submitted By:
- tails

This code demonstates how to add a Google Search Bar feature into a BlitzPlus application.
 
Title: Gradiator Code Submitted By:
- thechange

Create vertical gradients at runtime.
 
Title: Graphics Mode Input Code Submitted By:
- jamesf1
Basically identical to the Input$ command, but for graphics mode. You will have to fiddle around with it to get it to suit your needs. Its basic, but its all I needed for my proggy :) Just bear in mind 'foobar' is a useless var and is just there for the While/Wend loop :)
 
Title: Guessing game Code Submitted By:
- cabledue
this is a little somthing that you can do if your bored. I hope you like it. I need to know if you can make fullscreen.
 
Title: How to change the Window and Taskbar Icon Code Submitted By:
- grisu
Simple demo to demonstrate how to change the Window and Taskbar Icon in Blitz. Originally written by Binary Moon.

To run it needs a "user32.decls" placed in your userlib folder consisting of the following lines:

.lib "user32.dll"
User32_GetActiveWindow%():"GetActiveWindow"
User32_SetClassLong%( hWnd, nIndex, dwNewLong ):"SetClassLongA"

.lib "Shell32.dll"
LoadIcon%(hWND%,File$,Index%) : "ExtractIconA"

You also need an icon named "demo.ico" placed in the program folder!
 
Title: Including external files in sourcecode as Data Code Submitted By:
- thechange
Featuring:
* Custom Print Library
* Custom Print Documentation
* Binary Data Tutorial
* Binary Data Library
* Binary Data Documentation

The Custom Print Library is a flexible replacement for Print, Write and Locate commands. In other words a wrapper for the Text command.
The Binary Data Library can be used to include your external files, such as graphics and sounds, inside your BlitzBasic sourcecode.
 
Title: Join and Split Banks Code Submitted By:
- poedboy
Two functions for merging two banks into a single Bank, or splitting a single bank into two seperate banks.
 
Title: LSystem Fractals Code Submitted By:
- kortai

Simple implementation of LSystem fractals
 
Title: Laptop Screen Down! - Did you press CTRL+ALT+DEL? Code Submitted By:
- pro-x
Checks the state of YOUR laptop screen!
Also checks if the CTRL-ALT-DEL box (you know the one with "Log out") is visible!

Gimmie creds if you want. =P
 
Title: Mantra: quotes.bb function module Code Submitted By:
- alias jargon
publisher: 666 Network
program: Mantra
module: quotes.bb
purpose: realtime .wav .mp3 .m3u .pls demonic distortion
 
Title: Mappy and Nsprite at same time Code Submitted By:
- gustav

You can make a tilemap and work with fast sprites with some coding problems. I prefer to use pre-made libs and tools like Mappy an Nsprite, after all they're COMPATIBLE xD
 
Title: Media storage space Code Submitted By:
- thechange

Determining the total amount of memory available for media by creating an excessive amount of images.
 
Title: Movement Pegs Code Submitted By:
- dillpickle79

These are commonly used in 3d modelling tools to move objects about. It is drawn in 2D, but for 3D stuff.
If you have any questions, feel free to email me.
 
Title: One way to make an object revolve around another one in circles with the mouse(Turret aiming?) Code Submitted By:
- grim_1_2_3
This code will move the object (The word "hello" in this case) around another object (The word "Ship" in this case) in a perfect circle whenever you move the mouse up or down. It revolves either left or right depending on which direction you move the mouse. Anyway, One good use for this code would be for say, Aiming a gun turret in a shoot-em-up style game such as R-type. Anyway, If this doesn't make much sense, Just run the code and you will see how it works.

No images are required.

Please note: The sin/cos tables haven't been pre-calculated in this code, So it might run a 'tiny' bit slow if you have a slow computer. Anyway, I will eventually add that to the code, with comments.
 
Title: Parse Code Submitted By:
- poedboy

Let's you parse strings with a chosen delimiter(defaults to comma(,)). Allows multiple strings to be parsed at the same time.
 
Title: Pass Array to Function Code Submitted By:
- turtle1776
Want to pass arrays to a generic function that deals with arrays? (like a generic sorting function?). Here's how.
 
Title: PeekString$(bank,offset,count) Code Submitted By:
- alias jargon
returns a string read from a memory bank.
---
'bank' is the id handle of a memory bank to read from.
'offset' is the offset to begin reading from.
'count' is the length in characters of the string to be read.
 
Title: Picture to bank function Code Submitted By:
- paranoidpete
Loads a picture into a bank contained in a type which also holds the width and height of the given image. Also included is a similar function that does the same thing but stretches the picture to 256*256 for use with my texture mapper.
 
Title: PokeString(bank,offset,value$) Code Submitted By:
- alias jargon
writes a string into a memory bank.
---
'bank' is the id handle of a memory bank.
'offset' is the position in the memory bank to begin writing at.
'value$' is a string with which to write to the memory bank.
 
Title: Polygon Clipping code for my texture mapper Code Submitted By:
- paranoidpete
Use this in conjunction with my texture mapper to clip to the screen boundaries. (Warning - this is pretty slow)
 
Title: Portable Lightmapper Code Submitted By:
- starfox

Here is the lightmapper that I planned to release sooner or later. It isn't perfect, but good enough for my needs since it was only a test, to see I was capable of creating a lightmapper. The only requirement for using this lightmapper is to give me credit in any of the used programs.
 
Title: Powerbar Example Code Submitted By:
- nacho daddy

This an example of a powerbar that I came up with for some mini-games I will be making. One example would be to let the user choose how hard they want to kick a ball. It just goes up and down, and when you click the mouse button(which can be changed to fit your programming needs), the power level is recorded and you can proceed with the game.
 
Title: Preferences (revised) Code Submitted By:
- poedboy

Basic include for loading and retrieving values from a file to be used as settings in your blitz apps.
 
Title: RGB Colour library Code Submitted By:
- paranoidpete
Deals with RGB hex values. Lets you do quick colour multiplication, addition, alpha, half alpha in Blitz 2d. You could easily write a routine to fade in a picture or make a smooth transition between 2 pictures with these functions.
 
Title: Random Name Generator Code Submitted By:
- krylar
I created a really cheezy little name generator to come up with ship names. It mostly puts up a bunch of garble, but every now and then it puts up something decent or something you can derive something decent from ;).
 
Title: Random number functions Code Submitted By:
- badjim
The Blitz random number functions are bugged, since numbers produced by a given seed can be different from one machine to the next. These replacement functions are consistent across machines.
 
Title: RangeValue function Code Submitted By:
- thechange

Returns capped/warped/shifted value between a minimum and maximum range.
 
Title: Really fast tokens function Code Submitted By:
- kris_a
Tokenise a string in 10 lines!
 
Title: Realtime transparency using dithered blending Code Submitted By:
- thechange

An alternative way to use fast transparency in 2D is to apply a mask of transparent pixels to an image.
 
Title: Replacement Upper & Lower (UpperCyr & LowerCyr) to working also with CYRYLLIC Code Submitted By:
- 4rester

This function to working also with cyryllic's symbols (russian & ukrainian). Using -- same as Upper & Lower.
 
Title: Replaying user input using a collection of Types Code Submitted By:
- matt_sephton
23/24 June 2002, version 0.10, tracks user controlled element
26/27 June 2002, version 0.20, tracks multiple computer controlled elements

to do: enable early quit of replay to go back to game

*** feel free to use this method as long as you give me credit

this method can be used to replay user input. this simple demo records the player control of a dot. we choose to do the correct branch of the main loop (moving or drawing) depending on if we are recording (game) or replaying (watching). this could be extended to keep track of multiple items, such as computer/AI controlled characters.

:) matt
 
Title: Res-changing code -- Can be added to any program easily Code Submitted By:
- grim_1_2_3
This piece of code basically allows you to change between resolutions easily, at any time during the program. More resolutions can be added by simply adding a few lines of code. Right now it has 3: 640 by 480, 800 by 600, and 1024 by 768. Fully commented.

Note: You must use you're own images, Since none are included with the code.

Also, Please don't be put off by all of the text in the code -- Most of it is comments, LOL -- I guess I over-did it a little :) I wanted it to be easy for everyone to understand though. Anyway -- If you delete the commented lines, You will find that the code is a LOT smaller.
 
Title: Sample 'Drag and Drop' mouse code. Code Submitted By:
- grim_1_2_3
This piece of code will let you drag items around and drop them into a box using the mouse. It's fully commented, And is fairly easy to understand. Also, You don't need any images to use this code :)

 
Title: Scariest routine Code Submitted By:
- grim_1_2_3

This is just something I'm posting for fun. It is the routine which checks for a check status in a chess game I started writing a long time ago. It is 5,502 lines...!! This is one single function.
 
Title: Simple Menu system Code Submitted By:
- oscar
This is a simple text based menu i made... it's kinda bloated & ineficient, but it does the job & is fairly easy for noobs to understand.
also you can add gfx instead of the text! handy (go blitz, go!)

it's fairly simple to see how to add options so i won't put in an explanation unless someone needs one ;)

I also added a cool little loop around thing so when you get to the bottom just push down to get to the top ;) & vice versa

Oscar Enterprises
http://oscarent.host-dot.com
 
Title: Simple color tester / finder Code Submitted By:
- alucard

Big colored rectangle in the center of the screen reflects the RGB value(s) you give it... just a way to find a specific color you want. Instructions right on the screen. Change graphics mode for your computer if necessary (I set it to 3D so that it flickers less). Happy coding!

-Alucard
 
Title: Simple scroller Code Submitted By:
- thechange

Pixel-precise vertical scroller using the Text command.
 
Title: Spline Handle Look a like Code Submitted By:
- trashman

Rough code to create Spline Handles, works out the vector length, angle and handle dragging of the handles.
 
Title: Star Wars Name Generator Code Submitted By:
- krylar

This code will help you get your very own Star Wars name!
 
Title: Starfield simulation Code Submitted By:
- thechange

Using Rect and color variation.
 
Title: String Manipulation Library Code Submitted By:
- coderlaureate

I use this library in many of my Blitz programs that require intense parsing of string information.
 
Title: TGA's Code Submitted By:
- poedboy
Allows you to Create, Modify, Save, and Load tga's with alpha information. Works in blitz 2d, 3d, and plus.
 
Title: TextMatrix Code Submitted By:
- oopsy

If you have seen The Matrix, you probably noticed how Neo recieves the messages to his computer, like someone's typing it directly to him (Trinity)
This function takes X&Y parameters, STRING, SPEED, and LOOP parameter, if you set speed to higher numbers it will go slower, I recommend 350, and if you set LOOP to 1 it will loop the text.

TextMatrix(50,60,"Knock, knock",350,1)
 
Title: Texture mapper Code Submitted By:
- paranoidpete
Affine texture mapped for Blitz 2D that handles only 256*256 textures. You'll need my Pic to bank function to make this work. This function doesnt clip as is but there is clipping code for it in the code database.
 
Title: Tile Map Engine Code Submitted By:
- phoenix

This is a code for a basic tilemap editor. It΄s nothig big. It will ask for a filename to save as if you press delete. And don΄t write "mylevel.dat" write instead "mylevel".
 
Title: Tree of Pythagoras Code Submitted By:
- matt_sephton

;Tree of Pythagoras
;
;Blitz rewrite by Matt Sephton (matt@ewtoo.org)
;
;based on Wouter van Oortmerssen's (http://wouter.fov120.com)
;SHEEP example (http://www.osnews.com/story.php?news_id=169)
;based on an old E example by Raymond Hoving
 
Title: Types within Types Code Submitted By:
- skn3_acoders

You can do types within types with a little bit of pre work making some functions.

Check it out !
 
Title: Updating mouse coordinates when mouse leaves window Code Submitted By:
- cyberseth
With the help of a userlib, shows how to continue checking for mouse position even when mouse has gone outside of the window area. Important for windowed games!
 
Title: Using Locate Code Submitted By:
- luke_skyscraper

Locate simply locates the cursor to an (x,y) position on a graphics context. Very useful for making text input boxes. Of course for printing text you could (and probably should) just use
Text(x,y,"text")
but its still good to know I think
 
Title: Using The Microsoft .NET Framework with Blitz Code Submitted By:
- jimteeuwen
This is a relativly easy HowTo on using the Microsoft .NET framework with Blitz3D and BlitzPlus. It uses userlibs the same way you would normally use them to reference a dll
 
Title: VRAM Saver Code Submitted By:
- turtle1776
Got too many images for your game, and not enough video memory (VRAM)? This program includes two functions that (1) load an image into RAM, rather than VRAM; and (2) load the image from RAM to VRAM when needed during runtime, which is usually 2-3 times faster than loading from your hard drive.
 
Title: Vector Graphics Lib With Collisions Code Submitted By:
- darkeagle
use vector graphics easily, and check collisions. useful for if you are doing 2d in 3d and are having trouble with collisions - just set up a basic shape for each sprite you are using, then use VectorsCollide() to check for collisions! even includes scaling and rotation :)
 
Title: Vector Matrix Conversion - 2D Angle <-> Coords Code Submitted By:
- thechange

Basically 4 functions to convert from X/Y coordinates to Length/Angle and vise versa. A must for 2D space shooters and related mathematics. The major part of the code contains fun games/examples on how to use the functions, including 2D space physics.
 
Title: Win NT/XP/2000 Restarter Code Submitted By:
- blitzgod
This code will restart a Windows NT, Windows XP and Windows 2000 based system.
 
Title: WordWrap Function Code Submitted By:
- scienthsine
Takes a string, and a Max line length, and returns a string with carrage returns and new lines places in te appropraite places. It breaks on the space right before the max line length. If the entire line is taken up by one word, it breaks on the character that falls on the max line length, and places a "-" dash there.
 
Title: compText Code Submitted By:
- adam eavy

A Small Piece Of Code That Enables Any Text Within The Message Section To Be Printed To The Screen One Letter At A Time WIth A Small Delay Between Each Letter. Remember The Film Matrix? Its Kinda Like That!
 
Title: real 3d bouncing Code Submitted By:
- darkeagle
really really cool... just enable collisions with the world and any objects you want the ball to bounce with, and let this code do its stuff :) bouncy bouncy!
 
Title: rgba separation/recombination etc Code Submitted By:
- alias jargon
you must use lockbuffer before using and unlockbuffer when having completed using these commands.
dont hold me accountable for if you crash blitz, lose your source, or crash your os.
 
Title: safe maskcolor Code Submitted By:
- hyena
client's colour depth may be different to yours, and the classic mask 255,0,255 may acquire a different value. This function avoids that pitfall.
 
• Add Your Code!
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.

Code software created by Krylar's Kreations