User projects written in or related to FreeBASIC.
12 posts • Page 1 of 1
This networked program lets everyone who is using the program draw on the same screen.
It is named Nodepad because the programs connect to each other through Freenode (at channel #nodepad).
If you go to that channel, you can see the programs communicate to each other in hexadecimal.
Since this uses Freenode, I added some primitive chat functionality.
I hope to use this form of networking for other programs, too.
This was something of an experiment, so I don't think I'll update the program much.
The people in #freebasic had fun testing this the last few days. ^_^
The program and source are here:
http://freefile.kristopherw.us/uploads/ ... odepad.zip
If no one else is using it, you can test by running two instances of the application simultaneously, or by running it on two different computers.
You theoretically could compile it for Linux, but I have set it up to compile with the .a (Windows) versions of Chisock and iGUI.
ThePuppetMaster modified the program or made a new one for Linux that would draw text for you (because I had not implemented the chat at that point).
Hopefully he can post his program here. ;-)
Last edited by KristopherWindsor on May 25, 2008 4:21, edited 1 time in total.
I was messing around and made something so you can send a bunch of crap using a ulongint. lol
Code: Select all
const as ubyte COMMAND_1 = 1
const as ubyte COMMAND_2 = 2
const as ubyte COMMAND_3 = 4
const as ubyte COMMAND_4 = 8
const as ubyte COMMAND_5 = 16
const as ubyte COMMAND_6 = 32
const as ubyte COMMAND_7 = 64
const as ubyte COMMAND_8 = 128
#define packulong(m,x,y,c,u)( (culngint(m) shl 56) or (culngint(x) shl 46) or (culngint(y) shl 37) or (culngint(c) shl 5) or (culngint(u)) )
#define unpack_mflags(m)( m shr 56 and 255 )
#define unpack_xcoord(x)( x shr 46 and 1023 )
#define unpack_ycoord(y)( y shr 37 and 511 )
#define unpack_rgba(c)( c shr 5 and 4294967295 )
#define unpack_userid(u)( u and 31 )
'commands = m shr 56 and 255 '8 bit
'x = m shr 46 and 1023 '10 bit
'y = m shr 37 and 511 '9 bit
'c = m shr 5 and 4294967295 '32 bit lol
'u = m and 31' 5 bit... allows up to 32 users.
dim as ulongint package = packulong( COMMAND_1 or COMMAND_2 or COMMAND_8, 640, 480, RGBA(64,128,96,255), 13 )
dim as ubyte flags = unpack_mflags( package )
dim as short x = unpack_xcoord( package )
dim as short y = unpack_ycoord( package )
dim as uinteger c = unpack_rgba( package )
dim as ubyte u = unpack_userid( package )
print "x = " & x
print "y = " & y
print "r = " & (c shr 16 and 255)
print "g = " & (c shr 8 and 255)
print "b = " & (c and 255)
print "a = " & (c shr 24 and 255)
print "userid = " & u
if flags and COMMAND_1 then
print "COMMAND_1 = sent!"
if flags and COMMAND_2 then
print "COMMAND_2 = sent!"
if flags and COMMAND_3 then
print "COMMAND_3 = sent!"
if flags and COMMAND_4 then
print "COMMAND_4 = sent!"
if flags and COMMAND_5 then
print "COMMAND_5 = sent!"
if flags and COMMAND_6 then
print "COMMAND_6 = sent!"
if flags and COMMAND_7 then
print "COMMAND_7 = sent!"
if flags and COMMAND_8 then
print "COMMAND_8 = sent!"
Who is online
Users browsing this forum: No registered users and 6 guests