Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Maxheadroom

#31
GLBasic - en / lost in space
2008-May-13
Sorry I am having a maths problem with the x_camera please can you help: I am making a first person space game, I am trying to use the X_camera as the window view and fly around space with planets, meteors and bandits . But I can’t get the camera to move or show in the right way. I am using the list of variables below can you help?

Shipx = ship x position
Shipy = ship y position
Shipz = ship z position

Shipdegxz = axis of xz of ship in space
Shipdegxy = axis of xy of ship in space

motmentum = speed of movement along the axis

The not working code so far:

//setup camera directions
camx= INTEGER(shipx+(motmentum10)+(COS(shipdegxz)))
camz= INTEGER(shipz+(motmentum+10)+(SIN(shipdegxz))+(SIN(shipdegxy)))
camy= INTEGER(shipy+(motmentum+10+(COS(shipdegxy)))
X_CAMERA shipx, shipy, shipz,     camx, camy , camz


Next I need to move the ship along the axis:

shipx=INTEGER(shipx+(motmentum+(COS(shipdegxz))))
shipz=INTEGER(shipz+(motmentum+(SIN(shipdegxz)))+(motmentum+(SIN(shipdegxy))))
shipy=INTEGER(shipy+(motmentum+(COS(shipdegxy))))


Thanks, Max
#32
FAQ / update
2007-Nov-26
installing thanks

:nw:
#33
FAQ / update
2007-Nov-26
Hi, I have been away working on other projects and have not had time to play, on my return I have found that you have moved up the versions! However I can not join in the fun as I am stuck in version 3.283 (full version 3d+net) I have had a look around the forum for any clue's of the updates, but they most be lost in the myths of time. Can you help or point me in the right direction.

Thanks
#34
please can you translate to english :)
#35
this works as well: but the data is still held even after the program has stopped:
Code (glbasic) Select
Start_K8000 ()
SelectI2CprinterPort(1)
ConfigIOchipAsOutput(0)  //*configure channels 1...8 AS outputs*/
ConfigIOchipAsOutput(1)  //*configure channels 9...16 AS outputs*/
ClearIOchip(0)           //*clear channels 1...8*/
ClearIOchip(1)           //*clear channels 9...16*/



SetIOchannel(1)    //data
UpdateIOchip(1)   // send to chip1
UpdateIOchip(0)   // sean to chip0

loop:
IF KEY(57) = 1 THEN GOTO jum
GOTO loop

jum:
Stop_K8000()
PRINT "stopped",120,120
SHOWSCREEN
MOUSEWAIT

END
#36
Gernot,
It’s working!!!!!!!!!!!!!!!!!
Lights are flashing, program below.


The fix was extra files needed to be added to the project dir.
List of files needed: (FOUND ON THE INSTALL CD)


K8D.DLL
K8E.EXE
DLPORTIO.SYS   

Thank you for all your help.
NOW I can unleash the power of GLBASIC. 

Hemlos
Thanks for the help; I can confirm that the output is latched, once set, they hold until a new value is sent.

program
Code (glbasic) Select
Start_K8000 ()
SelectI2CprinterPort(1)
ConfigIOchipAsOutput(0)  //*configure channels 1...8 AS outputs*/
ConfigIOchipAsOutput(1)  //*configure channels 9...16 AS outputs*/
ClearIOchip(0)           //*clear channels 1...8*/
ClearIOchip(1)           //*clear channels 9...16*/
loop:

FOR a = 1 TO 16
PRINT a,100,100
SHOWSCREEN
SetIOchannel(a)
UpdateIOchip(1)
UpdateIOchip(0)
FOR slow= 1 TO 10
PRINT slow,200,100
SHOWSCREEN
NEXT


IF KEY(57) = 1 THEN GOTO jum
NEXT
GOTO loop

jum:
Stop_K8000()
PRINT "stopped",120,120
SHOWSCREEN
MOUSEWAIT

END
#37
Gernot,
Looking at this step by step, hardware working (with there test software). The Start_K8000 () loads ok (if removed it causes an error), after that the SelectI2CprinterPort(X) this is unknown if this works, I am guessing not because of the select LED on the board is not active when our program is running but it is active with there test software. I have sent an email to Velleman to see if they can help us. i am sure is a very small problem we are over looking. Also I have emailed over the ‘c’ part I don’t know if the include file 'I2C.H' (looks like it the same as the DLL but in ‘c’) this might help with different angle of attack.
Hemols I tried the loop idea but it did the same.
i don't have VB to test the program (i like GLBASIC)


Below is the link to all there downloads for VB,C,QBASIC and all the manuals
http://www.velleman.de/ot/en/product/view/?id=9383


Thanks, Max
#38
yes the test software work on lpt1 (k8000.exe) fine: we must be missing somthing. code below
Code (glbasic) Select
// both switches are off and using LPT1
port = 1
chip_no = 1
data = 15


Start_K8000 ()

SelectI2CprinterPort (port)  //*SELECT lpt1 on mainboard

ClearIOchip (chip_no)          //*clear channels 1

ConfigIOchipAsOutput (chip_no) //*configure channels 1 AS outputs

IOoutput (Chip_no, Data) // send data

PRINT "sent data",100,100
SHOWSCREEN
MOUSEWAIT

Stop_K8000() //stop after use
PRINT "stopped",120,120
SHOWSCREEN
MOUSEWAIT

END
thanks, max...
#39
Yes sort of i think it converts it into a serial bit steam and send it to a microcontroller on the board that converts it into code data, the codes unknown. There web site tell you all (almost). there might be extra code on that might help like a old dos bordland C++ code and Qbasic code. If you need help with the electronics I can help with digital however I am not that good at the analog. Nice frogga game by the way, may be adding com port support we could write a controller of our own!

Sorry back to the K8d.gbas the new file now complies and all the commands seem to process ok. However the board is waiting for input, there seems to be no communication with the LPT port there is a program LED the flashes when data is sent to the board from the test program but with k8d.gbas it is still. I have had a look and the Start_8000 function seems to be different to the rest? (I don’t know what I can do to help you with this)
#40
Gernot got the email:
sending one back:

Gernot is close to making this work, if so Glbasic can talk to the outside world in terms of electronics. The Velleman k8000 has sixteen digital input/output channels which can be used as either input or output as desired. In addition, there are eight analogue outputs with 6 bit resolution, one analogue output with 8 bit resolution, and four analogue inputs of 8 bit resolution. I would like to use the easy 3D function of GLBASIC and interface this to some of my robotic equipment I am working on. However there are many usages of this system. If you are interested the web site is below. The work Gernot has done so far is truly inspiring. and thats a big thank you from Me.

http://www.velleman.be/country.php

thanks, Max...
#41
Tonight it WILL work!
#42
it's all gone wrong, so i have striped it. however this will not build. i must be missing somthing: :D
Code (glbasic) Select
// --------------------------------- //
// Project:
// Start: Wednesday, November 01, 2006
// IDE Version: 3.283

up()

END
FUNCTION End_My_Main:
ENDFUNCTION


FUNCTION up:
INLINE
start_8000();
ENDINLINE
ENDFUNCTION



INLINE
extern "C" double (__stdcall* start_8000) = 0;
DLLCALL("K8D.dll", "start_8000", (void**) & start_8000);
ENDINLINE
the error
Code (glbasic) Select
*** Configuration: WIN32 ***
precompiling...

GPC - GLBasic Precompiler V.2006.279 - 3D, NET
compiling...
one.gbas (365 B )
Wordcount:3 commands

compiling:
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp: In function `DGInt __GLBASIC__::up()':
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:24: error: `start_8000' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:24: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp: At global scope:
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:31: error: `double*__GLBASIC__::start_8000' used prior to declaration
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:32: error: expected constructor, destructor, or type conversion before '(' token
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:32: error: expected `,' or `;' before '(' token

linking:
gpc_temp0.o:gpc_temp0.cpp:(.text+0x46): undefined reference to `__GLBASIC__::t'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x88): undefined reference to `__GLBASIC__::t'
gpc_temp0.o:gpc_temp0.cpp:(.text+0xae): undefined reference to `__GLBASIC__::t'
gpc_temp0.o:gpc_temp0.cpp:(.text+0xc8): undefined reference to `__GLBASIC__::t'
gpc_temp0.o:gpc_temp0.cpp:(.text+0xd1): undefined reference to `__GLBASIC__::lt'
gpc_temp0.o:gpc_temp0.cpp:(.text+0xde): undefined reference to `__GLBASIC__::chip'
gpc_temp0.o:gpc_temp0.cpp:(.text+0xe4): undefined reference to `__GLBASIC__::info'
gpc_temp0.o:gpc_temp0.cpp:(.text+0xea): undefined reference to `__GLBASIC__::info'
gpc_temp0.o:gpc_temp0.cpp:(.text+0xf0): undefined reference to `__GLBASIC__::t'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x128): undefined reference to `__GLBASIC__::t'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x158): undefined reference to `__GLBASIC__::t'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x164): undefined reference to `__GLBASIC__::t'
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Time: 0.8 sec
Build: 0 succeeded, 1 failed
#43
gernot
is this bit ok it needs two verables

extern "C" double (__stdcall* IOoutput) (long chip, long info) = 0;
#44
so close but so far.

Code (glbasic) Select
// --------------------------------- //
// Project:
// Start: Monday, October 23, 2006
// IDE Version: 3.283

// LET is dead. Please leave it.
lt=1
chip=1
info=10

// a function must be called with ( )


startup()

setltp(lt)

setoutput(chip)

output(chip, info)

END

INLINE
extern "C" double (__stdcall* start_8000) = 0;
extern "C" double (__stdcall* SelectI2CprinterPort) (long lt) = 0;
extern "C" double (__stdcall* ConfigIOchipAsOutput) (long chip) = 0;
extern "C" double (__stdcall* IOoutput) (long chip, long info) = 0;
DLLCALL("K8D.dll", "start_8000", (void**) &start_8000);
DLLCALL("K8D.dll", "SelectI2CprinterPort", (void**) &SelectI2CprinterPort);
DLLCALL("K8D.dll", "ConfigIOchipAsOutput", (void**) &ConfigIOchipAsOutput);
DLLCALL("K8D.dll", "IOoutput", (void**) &IOoutput);
ENDINLINE

// You must "end" the main game function
// this is done by forcing another function to
// begin and end
FUNCTION dummy:
ENDFUNCTION



FUNCTION startup:
INLINE
// in C++ always call functions with ( )
// and end a command with ';'

// also, check if the function could be loaded first:

IF (start_8000) // function pointer is good
{
   start_8000();
}
ELSE
{
   PRINT("Can't load function", 100, 100);
   SHOWSCREEN();
   MOUSEWAIT();
   END();
}
ENDINLINE
ENDFUNCTION

FUNCTION setltp: it
INLINE
SelectI2CprinterPort (it); // semicolon
ENDINLINE
ENDFUNCTION

FUNCTION setoutput: chip
INLINE
ConfigIOchipAsOutput (chip); // semicolon
ENDINLINE
ENDFUNCTION

FUNCTION output: chip, info
INLINE
IOoutput (chip,info); // semicolon
ENDINLINE
ENDFUNCTION
out put of the complier
Code (glbasic) Select
_______________________________________
*** Configuration: WIN32 ***
precompiling...

GPC - GLBasic Precompiler V.2006.279 - 3D, NET
compiling...
k8000.gbas (1 KB)
Wordcount:10 commands

compiling:
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:22: error: expected primary-expression before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:22: error: expected `;' before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:23: error: expected primary-expression before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:23: error: expected `;' before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:24: error: expected primary-expression before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:24: error: expected `;' before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:25: error: expected primary-expression before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:25: error: expected `;' before "extern"
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:26: error: `start_8000' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:26: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:27: error: `SelectI2CprinterPort' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:28: error: `ConfigIOchipAsOutput' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:29: error: `IOoutput' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp: In function `DGInt __GLBASIC__::startup()':
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:50: error: `start_8000' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:50: error: `IF' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:51: error: expected `;' before '{' token
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:55: error: `ELSE' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:55: error: expected `;' before '{' token
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp: In function `DGInt __GLBASIC__::setltp(DGInt)':
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:70: error: `SelectI2CprinterPort' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp: In function `DGInt __GLBASIC__::setoutput(DGInt)':
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:80: error: `ConfigIOchipAsOutput' undeclared (first use this function)
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp: In function `DGInt __GLBASIC__::output(DGInt, DGInt)':
C:\Program Files\GLBasic\Compiler\platform\gpc_temp0.cpp:90: error: `IOoutput' undeclared (first use this function)

linking:
success
_______________________________________
*** Finished ***
Time: 1.3 sec
Build: 1 succeeded, 0 failed
#45
Thanks that’s starting to make more sense, I will try it tonight, however should the call be  start_8000(); ?

thanks max...