/* native_x.c

This source contains all system specific routines for
Jongl in alphabetical order.

*/

//////////////////////////////////////////////////////////////////////////
/*A*/j1stInit() {

/*
  FUNCTION

  This is the place for the first initialization. Here you
  can open libraries, check the OS version or whatever you want.
  See also jDoPlatformSpecificStuff(), where you can disable
  functions which are not (yet) implemented.

  INPUTS

  none

  RETURNS

  0 if successful
  1 if not

  */
} /*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jAvailMem() {
/*
  FUNCTION

  determine the free memory (RAM) in the system

  INPUTS

  none

  RETURNS

  free RAM in bytes


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jClearRenderScreen() {
/*
  FUNCTION

  clear hidden screen of double buffered display

  INPUTS

  none

  RESULT

  hidden screen is cleared and can be used for the
  next frame

  RETURNS

  nothing

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jDelay(int jiffies) {
/*
  FUNCTION

  wait - usually because the user should get time to read
         something

  INPUTS

  no. of jiffies (1/50 s)

  REMARK

  it is not very important that the delayed time is exactly
  1/50 s per jiffy


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jDoPlatformSpecificStuff() {
/*
  FUNCTION

  There are 2 things you can do with this routine:
  1. fill out jRenderData.Native with your system
     dependant code
  2. deactivate some not (yet) implemented functions

  INPUTS

  none

  RESULT

  none

  RETURNS

  nothing

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jExistsFile(char *filename) {
/*
  FUNCTION

  check if the given file exists

  INPUTS

  filename to check for existance

  RESULT

  RETURNS

  0 if file doesn't exist
  1 if file exists

 */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jFreeAll() {
/*
  FUNCTION

  Free all allocated memory and close all opened libraries.
  The program can exit afterwards.

  INPUTS, RESULT, RETURNS

  none
*/
} /*E*/
/////////////////////////////////////////////////////////////////////////
/*A*/void jFreeMem(void *ptr, int size) {
/*
  FUNCTION

  Free memory block

  INPUTS

  ptr  = pointer to address of memory
  size = size of memory block in bytes

  RESULT

  the memory block is returned to the system

  RETURNS

  none

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/char * jGetFileNode(char *filename) {
/*
  FUNCTION

  scans the complete filename "drive:path/node.ext
  and returns only the "node"

  INPUT

  complete filename, possibly with drive and path,
  e.g. "dh0:programs/jongl/m/5_72727.pat"

  RESULT = RETURNS

  the filename without path and extension ("node"),
  e.g. "5_72727"


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jGetFileSize(char *filename) {
/*
  FUNCTION

  get file size

  INPUTS

  filename

  RESULT / RETURNS

  filesize in bytes



} /*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/unsigned char jGetKey() {
/*
  FUNCTION

  check keyboard, if user pressed a key return the key code

  INPUTS

  none

  RESULT

  none

  RETURNS

  ????????????????? TODO
*/
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jGetJoystick() {
/*
  FUNCTION

  check joystick

  INPUTS

  none

  RESULT

  the global struct jInput is filled with current values
  referring to the joystick
  jInput.joyLeft = 1 if joystick is moved left

  RETURNS

  none

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void * jGetMem(int size) {
/*
  FUNCTION

  get a memory block from the system pool

  INPUTS

  size = size of memory block in bytes

  RESULT

  allocated memory block

  RETURNS

  pointer to allocated memory block

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jGetMouse() {
/*
  FUNCTION

  read mouse position and buttons

  INPUTS

  none

  RESULT

  global struct jInput is filled with current values
  referring to the mouse
  jInput.mouseXrel: relative movement since last check
        .mouseXabs: absolute screen coordinates
        .LMB      : left mouse button

  RETURNS

  nothing

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jGetTime(int *secs, int *micros) {
/*
  FUNCTION

  get system time in seconds and microseconds

  INPUTS

  none

  RESULT

  *secs and *micros set to current system time

  RETURNS

  void

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jGrabScreen(int flag, int counter) {

/*
  FUNCTION

  do a screen grab and save it as "hc-path:pattern-n.ext"

  hc-path = global identifier "hardcopypfad" which is the path
            where the user wants to save the hardcopy

  pattern = the filenode of the shown juggling pattern
            "pattern = jGetFileNode(musterdatei);"

  n       = number of screen grab of this pattern (you have to
            look, if there are screen grabs with from this
            juggling pattern and increase this number accordingly

  ext     = Extension of the bitmap file. You may choose this
            and the type (GIF,IFF,PNG,...) as you like.


  INPUTS

  flag    = HC_SINGLE_FRAME : this is only one hardcopy
          = HC_ANIM         : this is part of an animation to be saved

  counter : can be ignored with HC_SINGLE_FRAME
          : has to be increased by 1 with HC_ANIM


  RETURNS

  counter  (is used to determine, when the animation is complete)


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jInitGraphics() {
/*
  FUNCTION

  initialize graphics - open screens, alloc mem, ...

  INPUTS

  none

  RETURNS

  0 if successful
  1 if not
*/
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jMousePointer(int flag) {
/*
  FUNCTION

  switch mouse pointer on / off

  INPUTS

  flag = 1 : pointer visible
       = 0 : pointer invisible


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jPlayback(void * scrCO) {
/*
  FUNCTION

  Playback the recorded pattern. There is only screen
  drawing involved, no projection or sorting or clipping
  or anything else which could be slowing down.

  INPUTS

  Pointer to list of screen coordinates to plot

  RESULT

  One frame is drawn.


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jPrintMultiLineText(char *text, int lines, int cpl) {
/*
  FUNCTION

  Print a longer text consisting of more than one line.
  The headline is the first text and followed by \n\n

  INPUTS

  char *text: The lines are seperated by newline characters
              ('\n')
  int lines : number of lines in the text (excluding headline)
  int cpl:    max. number of characters per line (excluding
              headline)

  RESULT

  The text is printed to the display. You may choose to
  print in more than one column depending on what you
  think.


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jPrintVersion() {
/*
  FUNCTION

  print version (including OS version or anything else you
  think may be relevant) after the user inputs "jongl ?"


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jRecord() {      // TODO
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jRender3D(void *jRenderData) {
/*
  FUNCTION

  This is the big one. Here the 3D rendering takes place.

  INPUTS

  struct jRenderData: contains complete 3D info about the
                    viewpoint, location of all objects,
                    the light source, and native info
                    which you can provide yourself using
                    jDoPlatformSpecificStuff().
                    See "define.h"

  RESULT

  One frame is being rendered. Possible warnings &
  errors can be returned in jRenderData.DWarning &
  jRenderData.DError.

  RETURNS

  used memory in buffer (TODO)

  -1 buffers are full. no additional objects when user
  presses J


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jRender3D_Error(int jRender3Dresult) {
/*
  FUNCTION

  checks if jRender3D did work properly

  INPUTS

  return value from jRender3D()

  RESULT

  prevent jongl running with errornous rendering routine

  RETURNS

  0 if no error or if only warning
  1 if error

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jResetGraphics() {
/*
  FUNCTION

  reset graphics state to what it was before jongl
  started

  INPUTS

  none, use globals here


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jShowFrequency(int jiffies) {
/*
  FUNCTION

  show current refresh rate

  INPUTS

  jiffies since last pic (1 jiffy = 1/50 s)

  RETURNS

  void

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jShowPlayback(int flag) {
/*
  FUNCTION

  show if playback mode is active

  INPUTS

  flag = 1 : playback mode active
       = 0 : not active

  REMARKS

  if you don't use a double buffered display for this, then
  you might save the last state of "flag" in a static
  identifier and change your gadget only then


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jShowSpeed(DOUBLE factor) {
/*
  FUNCTION

  display current simulation speed

  INPUTS

  -2.0 <= factor <= 2.0
    1.0 if normal speed,
    2.0 if double speed,
   -0.5 if half speed backward,...


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jShowStatusLine(char *text, int color, int flag) {
/*
  FUNCTION

  show a single line output to the user

  INPUTS

  text  : the text to be displayed
  color : the color (see colormap definition)
  flag  = TEXT_FRONT : write on the visible screen
        = TEXT_BACK  : write on the hidden screen

        = TEXT_TOP   : write on top of the screen
        = TEXT_MIDDLE           middle
        = TEXT_BOTTOM           bottom

  REMARK

  If you don't need the flags you may ignore them. On
  the Amiga everything is redisplayed every frame so
  I need to control the output.

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jShowVolume(int volume) {
/*
  FUNCTION

  show sound volume

  INPUTS

  volume (0..63)

  REMARK

  do anything cool here

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/jStdFileReq(char *dir, char *filename) {

/*
  FUNCTION

  Standard file requester. Lets the user select a file.

  INPUTS

  dir: directory with juggling pattern files ("m")

  RESULT

  filename: is filled with the selected filename and path,
            e.g. "m/7_PPS"

  RETURNS

  0 if successful
  1 if not

  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jToggleDisplay() {
/*
  FUNCTION

  swap visible and hidden display

  RESULT

  The rendered screen is completed and can be shown to
  the user. The former visible screen is outdated and
  due to erasing.


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////
/*A*/void jWait4VertBlank() {
/*
  FUNCTION

  wait for vertikal black interrupt

  RESULT

  used to synchronise the display with the video beam to
  avoid flickering


  */
}/*E*/
//////////////////////////////////////////////////////////////////////////

