Check out Amazon.com!

BlitzCoder Code Archives PageMain Codes Page
Listing: User Input and Interfaces (34 Entries)
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: Comma separated value Code Submitted By:
- thechange

Add a comma every 3 characters to increase readability: 123,456,789.
 
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: Doubleclick and other mouseinput detection Code Submitted By:
- eelco

this function detects mousestates, such as doubleclicks and releasing for both buttons, in addition to mousehit and mousedown. simply put the mouse() function in your mainloop and the included globals will be updated.

 
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: Extremely Simple mouselook Code Submitted By:
- slenkar
To provide a bare bones mouselook without anything else to confuse newbies.
 
Title: Faster Mouse Speed Code Submitted By:
- agent4125
Increase the speed of the mouse pointer
 
Title: First person shooter camera control source code Code Submitted By:
- edzup

This code allows the user to run/walk/fly, jump, and look around. The variable player gravity can also be used for fall damage, each cycle the player isnt touching anything it is deducted the gravity# value.

To do fall damage check PlayerGravity to see if its gone below the safe limits and if so when the player hits something damage them accordingly.

*** The only requirement I ask is if you use this code can you put my name in the credits, Thank you ***
 
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: 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: Input function Code Submitted By:
- cloudnine

As recommended by Cheify ;), this function will allow you to input on both buffers, unlike the Input function that comes with Blitz
 
Title: Key change example: Let's you change keys on the fly Code Submitted By:
- grim_1_2_3
This code basically let's the user change the controls for moving the stick man around the screen while the program is running. It will automatically detect the new key when you go to change it. This code is uncommented right now, But it is pretty easy to understand. No images are required to run this code either :)

Note: This entry is now complete -- Before the bottom half kept getting chopped off every time I tried to post it. It is now all here though :) I will add comments to this entry soon.

 
Title: KeyUp function Code Submitted By:
- thechange

Works similar to KeyDown except it returns True when the key was released.
 
Title: Keyboard Scancodes and Strings Code Submitted By:
- thechange

Includes a listing of constants for all commonly used keys. With variations using arrays for easy iteration. And finally a list of strings containing the actual names of the keys. Usage example function included.
 
Title: Keycodes Library Code Submitted By:
- krylar
Just a bunch of Constants that let you use a human-readable name for keys instead of trying to remember a bunch of numbers.
 
Title: Mouse lag simulation Code Submitted By:
- thechange

A relatively simple way of simulating delayed and indirect mouse movement.
 
Title: Mouse pointer demo Code Submitted By:
- thechange

Easily create custom mouse pointers in a snap with small code.
 
Title: MouseUp function Code Submitted By:
- thechange

Works similar to MouseDown except it returns True when the mousebutton was released.
 
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: Panels have borders Code Submitted By:
- cyberseth
BlitzPlus undocumented "style" property for panels. Allows the addition of borders to panels.
 
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: 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: 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: Retrieving the scancode of the currently pressed key Code Submitted By:
- sopisoft
This code simply retrieves the key-scancode of the key currently being pressed.
 
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: Simple GUI Button Interface Code Submitted By:
- steve-ancell
Allows the activation of functions or commands at the click of a mouse
 
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 start menu Code Submitted By:
- boywonder

Start menu with image links.
 
Title: Universal mouse speed Code Submitted By:
- thechange

Makes the mouse move with the same speed on all display resolutions.
 
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
 
Add Your Code!
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.

Code software created by Krylar's Kreations