1
General / Re: Edit: SFML works on FreeBSD very good
« on: August 27, 2016, 12:05:51 am »
SFML works better on FreeBSD now. And I wish it supports more BSD OS.
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.
Object Oriented Input System (OIS) is meant to be a cross platform, simple solution for using all kinds of Input Devices (Keyboards, Mice, Joysticks, etc) and feedback devices (e.g. force feedback). Written in C++ using Object Oriented Design pattern
First, we need to find documentation for the joystick API on FreeBSD. It should be close the Linux one, but without a doc we can't do anything.
Then with a doc I think I'll be able to fix the code blindly, and you would test it for me.
So... do you know where I could find the documentation of the FreeBSD joystick API?
# cd /usr/ports/x11-drivers/xf86-input-joystick/
# make install clean
# pkg_info -Ix xf86-input-joystick
xf86-input-joystick-1.5.0_1 X.Org joystick input driver
# pkg_info -L xf86-input-joystick-1.5.0_1
Information for xf86-input-joystick-1.5.0_1:
Files:
/usr/local/man/man4/joystick.4x.gz
/usr/local/include/xorg/joystick-properties.h
/usr/local/lib/xorg/modules/input/joystick_drv.la
/usr/local/lib/xorg/modules/input/joystick_drv.so
/usr/local/libdata/pkgconfig/xorg-joystick.pc
/*
* Copyright 2007-2008 by Sascha Hlusiak. <saschahlusiak@freedesktop.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Sascha Hlusiak not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Sascha Hlusiak makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* SASCHA HLUSIAK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL SASCHA HLUSIAK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifndef _JOYSTICK_PROPERTIES_
#define _JOYSTICK_PROPERTIES_
/**
* Properties exported by the joystick driver. These properties are
* recognized by the driver and will change its behavior when modified.
*/
/** To be used with property JSTK_PROP_AXIS_TYPE **/
typedef enum _JSTK_TYPE {
JSTK_TYPE_NONE=0, /* Axis value is not relevant */
JSTK_TYPE_BYVALUE, /* Speed of cursor is relative to amplitude */
JSTK_TYPE_ACCELERATED, /* Speed is accelerated */
JSTK_TYPE_ABSOLUTE /* The amplitude defines the cursor position */
} JSTK_TYPE;
/** To be used with properties JSTK_PROP_AXIS_MAPPING, JSTK_PROP_BUTTON_MAPPING */
typedef enum _JSTK_MAPPING {
JSTK_MAPPING_NONE=0, /* Nothing */
JSTK_MAPPING_X, /* X-Axis */
JSTK_MAPPING_Y, /* Y-Axis */
JSTK_MAPPING_ZX, /* Horizontal scrolling */
JSTK_MAPPING_ZY, /* Vertical scrolling */
JSTK_MAPPING_BUTTON, /* Mouse button */
JSTK_MAPPING_KEY, /* Keyboard event */
JSTK_MAPPING_SPEED_MULTIPLY, /* Will amplify all axis movement */
JSTK_MAPPING_DISABLE, /* Disable mouse and key events */
JSTK_MAPPING_DISABLE_MOUSE, /* Disable only mouse events */
JSTK_MAPPING_DISABLE_KEYS /* Disable only key events */
} JSTK_MAPPING;
/** Controls the verbosity of the driver */
/* 8 bit (0..20) */
#define JSTK_PROP_DEBUGLEVEL "Debug Level"
/** Number of buttons found on device */
/* 8 bit (0..MAXBUTTONS), read-only */
#define JSTK_PROP_NUMBUTTONS "Buttons"
/** Number of axes found on device */
/* 8 bit (0..MAXAXES), read-only */
#define JSTK_PROP_NUMAXES "Axes"
/** Generate pointer movement or button events */
/* 8 bit (0 or 1) */
#define JSTK_PROP_MOUSE_ENABLED "Generate Mouse Events"
/** Generate key events */
/* 8 bit (0 or 1) */
#define JSTK_PROP_KEYS_ENABLED "Generate Key Events"
/** Set the dead zone of each axis */
/* 32 bit (0..30000), for each axis*/
#define JSTK_PROP_AXIS_DEADZONE "Axis Deadzone"
/** Set axis type to none, byvalue, accelerated, absolute */
/* 8 bit, one of enum _JSTK_TYPE per axis*/
#define JSTK_PROP_AXIS_TYPE "Axis Type"
/** Set mapping of axis to none, x, y, zx, zy, key */
/* 8 bit, one of enum _JSTK_MAPPING per axis */
#define JSTK_PROP_AXIS_MAPPING "Axis Mapping"
/** Set movement factor of axis (default 1.0f) */
/* FLOAT[MAXAXES], movement amplify per axis */
#define JSTK_PROP_AXIS_AMPLIFY "Axis Amplify"
/** Scancodes for axis in low position */
/* 8 bit, 4 per axis */
#define JSTK_PROP_AXIS_KEYS_LOW "Axis Keys (low)"
/** Scancodes for axis in high position */
/* 8 bit, 4 per axis */
#define JSTK_PROP_AXIS_KEYS_HIGH "Axis keys (high)"
/** Set the mapping of each button to
none, x, y, zx, zy, button, key, speed_multiply,
disable, disable_mouse, disable_keys */
/* 8 bit, one of enum _JSTK_MAPPING per button */
#define JSTK_PROP_BUTTON_MAPPING "Button Mapping"
/** Set the logical button to report for this physical button */
/* 8 bit (0..32), logical button number per button */
#define JSTK_PROP_BUTTON_BUTTONNUMBER "Button Number"
/** Set amplify factor of button (default 1.0f) */
/* FLOAT[MAXBUTTONS], amplify value per button */
#define JSTK_PROP_BUTTON_AMPLIFY "Button Amplify"
/** Scancodes for button */
/* 8 bit, 4 per button */
#define JSTK_PROP_BUTTON_KEYS "Button Keys"
#endif /* _JOYSTICK_PROPERTIES_ */
First, we need to find documentation for the joystick API on FreeBSD. It should be close the Linux one, but without a doc we can't do anything.
Then with a doc I think I'll be able to fix the code blindly, and you would test it for me.
So... do you know where I could find the documentation of the FreeBSD joystick API?
Quote...many errors with joystick API...
Ok, here is the interesting stuff
The joystick API on FreeBSD is undocumented and I was waiting for someone to help me for implementation and tests. Would you like to help?
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
# FreeBSD compile path is the same as Linux
set(LINUX 1)
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:55: error: 'O_RDONLY' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:55: error: 'open' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:63: error: 'ioctl' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:64: error: 'JSIOCGAXMAP' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:92: error: 'JSIOCGBUTTONS' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:99: error: 'JSIOCGAXES' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:104: error: 'ABS_X' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:126: error: 'js_event' was not declared in this scope
In fact SFML supports FreeBSD, it's just the CMake file which is incomplete.
SFML 1.6 can't.
SFML 2 can.
CMake Warning at cmake/Config.cmake:20 (message):
Unsupported operating system
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
CMake Error at CMakeLists.txt:190 (install):
install FILES given no DESTINATION!
# detect the OS
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WINDOWS 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LINUX 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX 1)
This function is defined in GL3 or even 4, so you need:
- a 3.x or 4.x context (which SFML can't create -- but you can get one if you're lucky)
- GLEW or GLEE to handle extensions, as you probably don't have GL3/4 headers and therefore the function is not available directly