blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
5
146
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
7
license_type
stringclasses
2 values
repo_name
stringlengths
6
79
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
4 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.07k
426M
star_events_count
int64
0
27
fork_events_count
int64
0
12
gha_license_id
stringclasses
3 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
6 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
1 class
length_bytes
int64
20
6.28M
extension
stringclasses
20 values
content
stringlengths
20
6.28M
authors
sequencelengths
1
16
author_lines
sequencelengths
1
16
bf18e84269d183d5dbd41fe0f3ddd81603a2ee25
021e8c48a44a56571c07dd9830d8bf86d68507cb
/build/vtk/vtkQtChartStyleBoolean.h
80701b2aad3b0523998b575768313e5460edc55c
[ "BSD-3-Clause" ]
permissive
Electrofire/QdevelopVset
c67ae1b30b0115d5c2045e3ca82199394081b733
f88344d0d89beeec46f5dc72c20c0fdd9ef4c0b5
refs/heads/master
2021-01-18T10:44:01.451029
2011-05-01T23:52:15
2011-05-01T23:52:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,920
h
/*========================================================================= Program: Visualization Toolkit Module: vtkQtChartStyleBoolean.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /*------------------------------------------------------------------------- Copyright 2008 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. -------------------------------------------------------------------------*/ /// \file vtkQtChartStyleBoolean.h /// \date March 19, 2009 #ifndef _vtkQtChartStyleBoolean_h #define _vtkQtChartStyleBoolean_h #include "vtkQtChartExport.h" #include <QObject> /// \class vtkQtChartStyleBoolean /// \brief /// The vtkQtChartStyleBoolean class is the interface for series /// boolean options. class VTKQTCHART_EXPORT vtkQtChartStyleBoolean : public QObject { Q_OBJECT public: /// \brief /// Creates a chart style boolean. /// \param parent The parent object. vtkQtChartStyleBoolean(QObject *parent=0); virtual ~vtkQtChartStyleBoolean() {} /// \brief /// Gets the boolean for the given style index. /// \param index The style index. /// \return /// The boolean for the given style index. virtual bool getStyleBoolean(int index) const = 0; private: vtkQtChartStyleBoolean(const vtkQtChartStyleBoolean &); vtkQtChartStyleBoolean &operator=(const vtkQtChartStyleBoolean &); }; #endif
[ "ganondorf@ganondorf-VirtualBox.(none)" ]
[ [ [ 1, 59 ] ] ]
ae2b769b8446c5c9d544ffce8f50d1e3e7e1a8e8
4aadb120c23f44519fbd5254e56fc91c0eb3772c
/Source/src/EduNetConnect/SerializablePlayer.h
0c1cba8cc714e19a07158d7e691308ff19fa8aed
[]
no_license
janfietz/edunetgames
d06cfb021d8f24cdcf3848a59cab694fbfd9c0ba
04d787b0afca7c99b0f4c0692002b4abb8eea410
refs/heads/master
2016-09-10T19:24:04.051842
2011-04-17T11:00:09
2011-04-17T11:00:09
33,568,741
0
0
null
null
null
null
UTF-8
C++
false
false
4,597
h
#ifndef __SerilizablePlayer_H__ #define __SerilizablePlayer_H__ //----------------------------------------------------------------------------- // Copyright (c) 2009, Jan Fietz, Cyrus Preuss // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of EduNetGames nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //----------------------------------------------------------------------------- #include "AbstractNetSerializable.h" #include "OpenSteer/SimplePlayer.h" #include "OpenSteerUT/AbstractEntityFactory.h" //------------------------------------------------------------------------- template <class Super> class SerializablePlayerMixin : public Super, public OpenSteer::AbstractNetSerializable { ET_DECLARE_BASE( Super ) public: // constructor SerializablePlayerMixin (); // destructor virtual ~SerializablePlayerMixin (); // AbstractNetSerializable interface virtual void querySendParameters( RakNet::PRO& kPro ) const; private: }; //---------------------------------------------------------------------------- // Constructor and destructor template<class Super> SerializablePlayerMixin<Super>::SerializablePlayerMixin(void) { } template<class Super> SerializablePlayerMixin<Super>::~SerializablePlayerMixin(void) { } //----------------------------------------------------------------------------- template<class Super> void SerializablePlayerMixin<Super>::querySendParameters( RakNet::PRO& kPro ) const { } //---------------------------------------------------------------------------- // interface //--------------------------------------------------------------------------- class ClientSerializablePlayer : public SerializablePlayerMixin<OpenSteer::SimplePlayer> { ET_DECLARE_BASE( SerializablePlayerMixin<OpenSteer::SimplePlayer> ) public: ClientSerializablePlayer(); virtual ~ClientSerializablePlayer(); OS_IMPLEMENT_CLASSNAME( ClientSerializablePlayer ) //--------------------------------------------------------------------------- // AbstractNetSerializable interface virtual int serialize( RakNet::SerializeParameters *serializeParameters ) const; virtual void deserialize( RakNet::DeserializeParameters *deserializeParameters ); virtual void serializeConstruction( RakNet::BitStream *constructionBitstream ); virtual bool deserializeConstruction( RakNet::BitStream *constructionBitstream ); virtual OpenSteer::EntityClassId getClassId( void ) const { return OS_CID_CLIENT_PLAYER; } virtual OpenSteer::AbstractEntity* cloneEntity( void ) const; private: int serializeController(RakNet::SerializeParameters *serializeParameters)const; void deserializeController(RakNet::DeserializeParameters *deserializeParameters); }; //----------------------------------------------------------------------------- class ClientSerializablePlayerFactory : public OpenSteer::TEntityFactory<ClientSerializablePlayer> { ET_DECLARE_BASE( OpenSteer::TEntityFactory<ClientSerializablePlayer> ); public: ClientSerializablePlayerFactory(){}; virtual ~ClientSerializablePlayerFactory(){}; }; #endif // __SerilizablePlayer_H__
[ "janfietz@localhost" ]
[ [ [ 1, 120 ] ] ]
2cd352dd543c496a82bca512f0c011094a426de4
39f755afd5f4f3abe91a24342746774781704fa7
/cob_sdh/common/include/cob_sdh/sdh.h
37a21d4cf2ec1e8909274240548602c6b0a3cb98
[]
no_license
attilaachenbach/cob_driver
b1e280259521a47a07838a13fd35f218ae0c0f24
46acb2fe8114f04ce9909ef9488b6302d2530f9e
refs/heads/master
2021-01-15T20:48:35.405544
2011-04-29T17:28:25
2011-04-29T17:28:25
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
153,522
h
//====================================================================== /*! \file \section sdhlibrary_cpp_sdh_h_general General file information \author Dirk Osswald \date 2007-02-20 \brief This file contains the interface to class #SDH::cSDH, the end user class to access the %SDH from a PC. \section sdhlibrary_cpp_sdh_h_copyright Copyright Copyright (c) 2007 SCHUNK GmbH & Co. KG <HR> \internal \subsection sdhlibrary_cpp_sdh_h_details SVN related, detailed file specific information: $LastChangedBy: Osswald2 $ $LastChangedDate: 2009-12-04 17:05:53 +0100 (Fr, 04 Dez 2009) $ \par SVN file revision: $Id: sdh.h 5022 2009-12-04 16:05:53Z Osswald2 $ \subsection sdhlibrary_cpp_sdh_h_changelog Changelog of this file: \include sdh.h.log */ //====================================================================== #ifndef SDH_h_ #define SDH_h_ #include "sdhlibrary_settings.h" #include "basisdef.h" #if SDH_USE_VCC # pragma warning(disable : 4996) #endif //---------------------------------------------------------------------- // System Includes - include with <> //---------------------------------------------------------------------- #include <vector> #include <string> //---------------------------------------------------------------------- // Project Includes - include with "" //---------------------------------------------------------------------- #include "sdhbase.h" #include "sdhserial.h" #include "unit_converter.h" #include "serialbase.h" #if WITH_ESD_CAN # include "canserial-esd.h" #endif #if WITH_PEAK_CAN # include "canserial-peak.h" #endif //---------------------------------------------------------------------- // Defines, enums, unions, structs //---------------------------------------------------------------------- #if SDH_USE_NAMESPACE /*! * \namespace SDH * A namespace for all classes and functions in the SDHLibrary. * * The use of the namespace can be disabled at compile time of the * library by setting #SDH_USE_NAMESPACE to 0. */ #endif NAMESPACE_SDH_START #if ! WITH_ESD_CAN typedef void* NTCAN_HANDLE; //!< dummy definition in case ntcan.h is not available #endif #if ! WITH_PEAK_CAN // Linux libpcan uses HANDLE where Windows Pcan_usb.h uses no handle at all: typedef void* PCAN_HANDLE; //!< dummy definition in case Pcan_usb.h is not available #endif //---------------------------------------------------------------------- // Global variables (declarations) //---------------------------------------------------------------------- //---------------------------------------------------------------------- // External functions and classes (declarations) //---------------------------------------------------------------------- //---------------------------------------------------------------------- // Function prototypes (function declarations) //---------------------------------------------------------------------- //---------------------------------------------------------------------- // Class declarations //---------------------------------------------------------------------- //====================================================================== /*! \brief #SDH::cSDH is the end user interface class to control a %SDH (SCHUNK Dexterous Hand). A general overview of the structure and architecture used is given \ref sdhlibrary_cpp_architecture_dox_sdhpackage_overview "here". \remark \anchor sdhlibrary_cpp_sdh_h_csdh_axis_vs_fingers - The cSDH class provides methods to access the 7 axes of the %SDH individually as well as on a finger level. - When accessing the axes individually then the following axis indices must be used to address an axis / some axes: - 0 : common base axis of finger 0 and 2 - 1 : proximal axis of finger 0 - 2 : distal axis of finger 0 - 3 : proximal axis of finger 1 - 4 : distal axis of finger 1 - 5 : proximal axis of finger 2 - 6 : distal axis of finger 2 - When accessing the axes on finger level then every finger has 3 axes for a uniform interface of the access methods. Her the following finger axis indices must be used: - 0 : base axis of finger (for finger 1 this is a "virtual" axis with min angle = max angle = 0.0) - 1 : proximal axis of finger - 2 : distal axis of finger \anchor sdhlibrary_cpp_sdh_h_csdh_vector - Vector-like parmeters: The interface functions defined here make full use of the flexibility provided by the STL vector<T> type. I.E. for parameters of functions like axis indices or axis angles not only single numerical values can be given, but also vectors of \c int or \c double values. This way the same (overloaded) interface function can address a single axis individually or multiple axes in a call, as required by the application. Such parameters are herein refered to as "vectors". - Parameters for methods are checked for validity. In case an invalid parameter is given the method throws a cSDHErrorInvalidParameter exception. \anchor sdhlibrary_cpp_sdh_h_csdh_unit - The underlying physical unit system of parameters that do have a unit (like angles, velocities or temperatures) can be adapted to the users or the applications need. See also \ref sdhlibrary_cpp_sdh_h_unit_conversion_objects "unit conversion objects". The default converter objects are set as the uc_* member variables (#uc_angle, #uc_angular_velocity, #uc_angular_acceleration, #uc_time, #uc_temperature, #uc_position). The units are changed in the communication between user application and cSDH object instance only (USERAPP and SDHLibrary-CPP in the \ref sdhlibrary_cpp_architecture_dox_sdhpackage_overview "overview figure"). For now the %SDH firmware knows only about its internal unit system. <hr> */ class cSDH : public cSDHBase { public: //! the motor current can be set specifically for these modes: enum eMotorCurrentMode { eMCM_MOVE=0, //!< The motor currents used while "moving" with a MoveHand() or MoveFinger() command eMCM_GRIP=1, //!< The motor currents used while "gripping" with a GripHand() command eMCM_HOLD=2, //!< The motor currents used after "gripping" with a GripHand() command (i.e. "holding") eMCM_DIMENSION //!< Endmarker and Dimension }; //! The state of an axis (see TPOSCON_STATE in global.h of the %SDH firmware) enum eAxisState { eAS_IDLE = 0, //!< axis is idle eAS_POSITIONING, //!< the goal position has not been reached yet eAS_SPEED_MODE, //!< axis is in speed mode eAS_NOT_INITIALIZED, //!< axis is not initialized or doesn't exist eAS_CW_BLOCKED, //!< axis is blocked in counterwise direction eAS_CCW_BLOCKED, //!< axis is blocked is blocked in against counterwise direction eAS_DISABLED, //!< axis is disabled eAS_LIMITS_REACHED, //!< position limits reached and axis stopped eAS_DIMENSION //!< Endmarker and Dimension }; //####################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_unit_conversion_objects \name Predefined unit conversion objecs Some predefined cUnitConverter unit conversion objects to convert values between different unit systems. These are static members since the converter objects do not depend on the individiual cSDH object. For every physical unit used in the cSDH class there is at least one (most of the time more than one) predefined unit converter. For example for angles there are \e radians and \e degrees. @{ */ //! Default converter for angles (internal unit == external unit): degrees static cUnitConverter const uc_angle_degrees; //! Converter for angles: external unit = radians static cUnitConverter const uc_angle_radians; //! Default converter for times (internal unit == external unit): seconds static cUnitConverter const uc_time_seconds; //! Converter for times: external unit = milliseconds static cUnitConverter const uc_time_milliseconds; //! Default converter for temparatures (internal unit == external unit): degrees celsius static cUnitConverter const uc_temperature_celsius; //! Converter for temperatures: external unit = degrees fahrenheit static cUnitConverter const uc_temperature_fahrenheit; //! Default converter for angular velocities (internal unit == external unit): degrees / second static cUnitConverter const uc_angular_velocity_degrees_per_second; //! Converter for angular velocieties: external unit = radians/second static cUnitConverter const uc_angular_velocity_radians_per_second; //! Default converter for angular accelerations (internal unit == external unit): degrees / second static cUnitConverter const uc_angular_acceleration_degrees_per_second_squared; //! Converter for angular velocieties: external unit = radians/second static cUnitConverter const uc_angular_acceleration_radians_per_second_squared; //! Default converter for motor current (internal unit == external unit): Ampere static cUnitConverter const uc_motor_current_ampere; //! Converter for motor current: external unit = milli Ampere static cUnitConverter const uc_motor_current_milliampere; //! Default converter for position (internal unit == external unit): millimeter static cUnitConverter const uc_position_millimeter; //! Converter for position: external unit = meter static cUnitConverter const uc_position_meter; // end of doxygen name group sdhlibrary_cpp_sdh_h_unit_conversion_objects //! @} protected: //--------------------- // Misc member variables //! The number of axis per finger (for finger 1 this includes the "virtual" base axis) int NUMBER_OF_AXES_PER_FINGER; //! The number of virtual axes int NUMBER_OF_VIRTUAL_AXES; //! The number of all axes including virtual axes int nb_all_axes; //! Mapping of finger index to number of real axes of fingers: std::vector<int> finger_number_of_axes; //! Mapping of finger index, finger axis index to axis index: std::vector<std::vector<int> > finger_axis_index; //! Vector of 3 epsilon values //f_eps_v; //! Vector of 3 0.0 values std::vector<double> f_zeros_v; //! Vector of 3 1.0 values std::vector<double> f_ones_v; //! Vector of nb_all_axes 0.0 values std::vector<double> zeros_v; //! Vector of nb_all_axes 1.0 values std::vector<double> ones_v; //! Minimum allowed motor currents (in internal units (Ampere)), including the virtual axis std::vector<double> f_min_motor_current_v; //! Maximum allowed motor currents (in internal units (Ampere)), including the virtual axis std::vector<double> f_max_motor_current_v; //! Minimum allowed axis angles (in internal units (degrees)), including the virtual axis std::vector<double> f_min_angle_v; //! Maximum allowed axis angles (in internal units (degrees)), including the virtual axis std::vector<double> f_max_angle_v; //! Minimum allowed axis velocity (in internal units (degrees/second)), including the virtual axis std::vector<double> f_min_velocity_v; //! Maximum allowed axis velocity (in internal units (degrees/second)), including the virtual axis std::vector<double> f_max_velocity_v; //! Minimum allowed axis acceleration (in internal units (degrees/(second * second))), including the virtual axis std::vector<double> f_min_acceleration_v; //! Maximum allowed axis acceleration (in internal units (degrees/(second * second))), including the virtual axis std::vector<double> f_max_acceleration_v; //! Maximum allowed grip velocity (in internal units (degrees/second)) double grip_max_velocity; /*! \anchor sdhlibrary_cpp_sdh_h_kinematic_vars \name Kinematic parameters of the Hand @{ */ //! length of limb 1 (proximal joint to distal joint) in mm double l1; //! length of limb 2 (distal joint to fingertip) in mm double l2; // distance between center points of base joints f0<->f1, f1<->f2, f0<->f2 double d; // height of center of base joints above finger base plate double h; /*! list of xyz-vectors for all fingers with offset from (0,0,0) of proximal joint in mm */ std::vector<std::vector<double> > offset; cSerialBase* com; // !!! make this public for now (to access comm_interface->ref() / comm_interface->pos_save() for hands with missing absolute encoders) public: //! The object to interface with the %SDH attached via serial RS232 or CAN. cSDHSerial comm_interface; //! change the stream to use for debug messages virtual void SetDebugOutput( std::ostream* debuglog ) { cSDHBase::SetDebugOutput( debuglog ); comm_interface.SetDebugOutput( debuglog ); } protected: //###################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_csdh_internal \name Internal helper methods @{ */ //---------------------------------------------------------------------- /*! Generic set function: set some given axes to given values \param axes - a vector of axis indices \param values - a vector of values \param ll_set - a pointer to the low level set function to use \param ll_get - a pointer to the low level get function to use (for those axes where the given value is NaN) \param uc - a pointer to the unit converter object to use before sending values to \a ll_set \param min_values - a vector with the minimum allowed values \param max_values - a vector with the maximum allowed values \param name - a string with the name of the values (for constructing error message) \remark - The length of the \a axis and \a values vector must match. - The indices can be given in any order, but the order of the elements of \a axes and \a values must match too. I.e. \c values[i] will be applied to axis \c axes[i] (not axis \c i) - The indices are checked if they are valid axis indices. - The values are checked if they are in the allowed range [\a min_values .. \a f_max_values], i.e. it is checked that \c value[i], converted to the internal unit system by \a uc->ToInternal(), is in [\a min_values[axes[i]] .. \a max_values[axes[i]]]. - If \b any index or value is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. */ void SetAxisValueVector( std::vector<int> const& axes, std::vector<double> const& values, pSetFunction ll_set, pGetFunction ll_get, cUnitConverter const* uc, std::vector<double> const& min_values, std::vector<double> const& max_values, char const* name ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Generic get function: get some given axes values \param axes - a vector of axis indices \param ll_get - a pointer to the low level get function to use \param uc - a pointer to the unit converter object to apply before returning values \param name - a string with the name of the values (for constructing error message) - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the addressed values for the selected axes. - The values are converted to external unit system using the \a uc unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). */ std::vector<double> GetAxisValueVector( std::vector<int> const& axes, pGetFunction ll_get, cUnitConverter const* uc, char const* name ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Internal helper function: return a vector of checked indices according to index. \param index - The index to vectorize or #All \param all_replacement - a vector to return if \a index is #All \param maxindex - the \a index is checked if in [0..\ maxindex[ (i.e. not including \a maxindex) \param name - A name for the things index, used to report out of bounds errors \return - If \a index is #All then \a all_replacement is returned. - If \a index is a single number >= 0 then it is checked if in [0..\ maxindex[ and a vector of length 1 is returned containing only \a index. - In case \a index exceeds \a maxindex a (cSDHErrorInvalidParameter*) exception is thrown. */ std::vector<int> ToIndexVector( int index, std::vector<int>& all_replacement, int maxindex, char const* name ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Internal helper function: return the get/set function of the comm_interface object that is responsible for setting/getting motor currents in \a mode. */ pSetFunction GetMotorCurrentModeFunction( eMotorCurrentMode mode ) throw(cSDHLibraryException*); //----------------------------------------------------------------- /*! return cartesian [x,y,z] position in mm of fingertip for finger fi at angles r_angles (rad) */ std::vector<double> _GetFingerXYZ( int fi, std::vector<double> r_angles ) throw(cSDHLibraryException*); // end of doxygen name group sdhlibrary_cpp_sdh_h_csdh_internal //! @} //##################################################################### public: //---------------------------------------------------------------------- /*! \anchor sdhlibrary_cpp_sdh_h_index_vectors \name Predefined index vector objects @{ */ //! A vector with indices of all axes (in natural order), including the virtual axis. std::vector<int> all_axes; //! A vector with indices of all real axes (in natural order), excluding the virtual axis. std::vector<int> all_real_axes; //! A vector with indices of all fingers (in natural order) std::vector<int> all_fingers; //! A vector with indices of all temperature sensors std::vector<int> all_temperature_sensors; // end of sdhlibrary_cpp_sdh_h_index_vectors //! @} //---------------------------------------------------------------------- //---------------------------------------------------------------------- /*! \anchor sdhlibrary_cpp_sdh_h_unit_conversion_ptrs \name Predefined unit conversion objects Pointers to the unit converter objects used by this cSDH object. The refered objects convert values between different unit systems. Example: convert angle values between \e degrees and \e radians, temperatures between \e degrees \e celsius and \e degrees \e fahrenheit or the like. A cSDH object uses these converter objects to convert between external (user) and internal (%SDH) units. The user can easily change the converter object that is used for a certain kind of unit. This way a cSDH object can easily report and accept parameters in the user or application specific unit system. Additionally, users can easily add conversion objects for their own, even more user- or application-specific unit systems. @{ */ //! unit convert for (axis) angles: default = #SDH::cSDH::uc_angle_degrees const cUnitConverter* uc_angle; //! unit convert for (axis) angular velocities: default = #SDH::cSDH::uc_angular_velocity_degrees_per_second const cUnitConverter* uc_angular_velocity; //! unit convert for (axis) angular accelerations: default = #SDH::cSDH::uc_angular_acceleration_degrees_per_second_squared const cUnitConverter* uc_angular_acceleration; //! unit convert for times: default = uc_time_seconds const cUnitConverter* uc_time; //! unit convert for temperatures: default = #SDH::cSDH::uc_temperature_celsius const cUnitConverter* uc_temperature; //! unit converter for motor curent: default = #SDH::cSDH::uc_motor_current_ampere const cUnitConverter* uc_motor_current; //! unit converter for position: default = #SDH::cSDH::uc_position_millimeter const cUnitConverter* uc_position; //--------------------- // end of sdhlibrary_cpp_sdh_h_unit_conversion_ptrs //! @} //---------------------------------------------------------------------- //----------------------------------------------------------------- /*! \brief Constructor of cSDH class. Creates an new object of type cSDH. One such object is needed for each %SDH that you want to control. The constructor initializes internal data structures. A connection the %SDH is \b not yet established, see #OpenRS232() on how to do that. After an object is created the user can adjust the unit systems used to set/report parameters to/from %SDH. This is shown in the example code below. The default units used (if not overwritten by constructor parameters) are: - \c degrees [°] for (axis) angles - \c degrees \c per \c second [°/s] for (axis) angular velocities - \c seconds [s] for times - \c degrees \c celsius [°C] for temperatures \param _use_radians : Flag, if true then use radians and radians/second to set/report (axis) angles and angular velocities instead of default degrees and degrees/s. \param _use_fahrenheit : Flag, if true then use degrees fahrenheit to report temperatures instead of default degrees celsius. \param _debug_level : The level of debug messages to print - 0: (default) no messages - 1: messages of this cSDH instance - 2: like 1 plus messages of the inner cSDHSerial instance \par Examples: Common use: \code // Include the cSDH interface #include <sdh.h> // Create a cSDH object 'hand'. cSDH hand(); \endcode The mentioned change of a unit system can be done like this: \code // Assuming 'hand' is a cSDH object ... // override default unit converter for (axis) angles: hand.uc_angle = &cSDH::uc_angle_radians; // override default unit converter for (axis) angular velocities: hand.uc_angular_velocity = &cSDH::uc_angular_velocity_radians_per_second; // override default unit converter for (axis) angular accelerations: hand.uc_angular_acceleration = &cSDH::uc_angular_acceleration_radians_per_second_squared; // instead of the last 3 calls the following shortcut could be used: hand.UseRadians(); // override default unit converter for times: hand.uc_time = &cSDH::uc_time_milliseconds; // override default unit converter for temperatures: hand.uc_temperature = &cSDH::uc_temperature_fahrenheit; // override default unit converter for positions: hand.uc_position = &cSDH::uc_position_meter; \endcode For convenience the most common settings can be specified as bool parameters for the constructor, like in: \code // Include the cSDH interface #include <sdh.h> // Create a cSDH object 'hand' that uses // - the non default radians and radians/s units, // - the default temperature in degrees celsius, // - A debug level of 2 cSDH hand( true, false, 2 ); \endcode <hr> */ cSDH( bool _use_radians=false, bool _use_fahrenheit=false, int _debug_level=0 ); //---------------------------------------------------------------------- /*! Virtual destructor to make compiler happy If the connection to the %SDH hardware/firmware is still open then the connection is closed, which will stop the axis controllers (and thus prevent overheating). */ virtual ~cSDH(); //###################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_csdh_misc \name Miscellaneous methods @{ */ //---------------------------------------------------------------------- //! Return \c true if index \a iAxis refers to a virtual axis bool IsVirtualAxis( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Shortcut to set the unit system to radians. After calling this axis angles are set/reported in radians and angular velocities are set/reported in radians/second \par Examples: \code // Assuming 'hand' is a cSDH object ... // make hand object use radians and radians/second for angles and angular velocities hand.UseRadians(); \endcode <hr> */ void UseRadians( void ); //----------------------------------------------------------------- /*! Shortcut to set the unit system to degrees. After calling this (axis) angles are set/reported in degrees and angular velocities are set/reported in degrees/second \par Examples: \code // Assuming 'hand' is a cSDH object ... // make hand object use degrees and degrees/second for angles and angular velocities hand.UseDegrees(); // as degrees, degrees/second are the default this is needed only if the // unit system was changed before \endcode <hr> */ void UseDegrees( void ); //----------------------------------------------------------------- /*! Return the number of real axes of finger with index \a iFinger. \param iFinger - index of finger in range [0..NUMBER_OF_FINGERS-1] \return - Number of real axes of finger with index \a iFinger - If \a iFinger is invalid a (cSDHErrorInvalidParameter*) exception is thrown. \par Examples: \code // Assuming 'hand' is a cSDH object ... cout << "The finger 0 has " << hand.GetFingerNumberOfAxes( 0 ) << " real axes\n"; \endcode <hr> */ int GetFingerNumberOfAxes( int iFinger ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Return axis index of \a iFingerAxis axis of finger with index iFinger For \a iFinger=2, iFingerAxis=0 this will return the index of the virtual base axis of the finger \param iFinger - index of finger in range [0..NUMBER_OF_FINGERS-1] \param iFingerAxis - index of finger axis in range [0..NUMBER_OF_AXES_PER_FINGER-1] \return - Axis index of \a iFingerAxis-th axis of finger with index \a iFinger - If \a iFinger or \a iFingerAxis is invalid a (cSDHErrorInvalidParameter*) exception is thrown. \par Examples: \code // Assuming 'hand' is a cSDH object ... cout << "The 1st axis of finger 2 has real axis index " << hand.GetFingerNumberOfAxes( 2, 0 ) << "\n"; \endcode <hr> */ int GetFingerAxisIndex( int iFinger, int iFingerAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Return the release name of the library (not the firmware of the %SDH) as string. \par Examples: \code // static member functon, so no cSDH object is needed for access: cout << "The SDHLibrary reports release name " << cSDH::GetReleaseLibrary() << "\n"; \endcode <hr> */ static char const* GetLibraryRelease( void ); //----------------------------------------------------------------- /*! Return the name of the library as string. \par Examples: \code // static member functon, so no cSDH object is needed for access: cout << "The SDHLibrary reports name " << cSDH::GetLibraryName() << "\n"; \endcode <hr> */ static char const* GetLibraryName( void ); //----------------------------------------------------------------- /*! Return the release name of the firmware of the %SDH (not the library) as string. This will throw a (cSDHErrorCommunication*) exception if the connection to the %SDH is not yet opened. \par Examples: \code // Assuming 'hand' is a cSDH object ... cout << "The SDH firmware reports release " << hand.GetFirmwareRelease() << "\n"; \endcode <hr> */ char const* GetFirmwareRelease( void ) throw (cSDHLibraryException*); /*! Return info according to \a what # # The following values are valid for \a what: # - "date-library" : date of the SDHLibrary-python release # - "release-library" : release name of the sdh.py python module # - "release-firmware" : release name of the %SDH firmware (requires # an opened communication to the %SDH) # - "date-firmware" : date of the %SDH firmware (requires # an opened communication to the %SDH) # - "release-soc" : release name of the %SDH SoC (requires # an opened communication to the %SDH) # - "date-soc" : date of the %SDH SoC (requires # an opened communication to the %SDH) # - "id-sdh" : ID of %SDH # - "sn-sdh" : Serial number of %SDH # # \par Examples: # \code # # Assuming 'hand' is a sdh.cSDH object ... # # print "The SDH firmware reports release %s" % ( hand.GetInfo( "release-firmware" ) ) # # \endcode # # <hr> */ char const* GetInfo( char const* what ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Return temperature(s) measured within the %SDH. \param sensors - A vector of indices of temperature sensors to access. - index 0 is sensor near motor of axis 0 (root) - index 1 is sensor near motor of axis 1 (proximal finger 1) - index 2 is sensor near motor of axis 2 (distal finger 1) - index 3 is sensor near motor of axis 3 (proximal finger 2) - index 4 is sensor near motor of axis 4 (distal finger 2) - index 5 is sensor near motor of axis 5 (proximal finger 3) - index 6 is sensor near motor of axis 6 (distal finger 3) - index 7 is FPGA temperature (controller chip) - index 8 is PCB temperature (Printed Circuit Board) \remark - The indices in \a sensors are checked if they are valid sensor indices. - If \b any sensor index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. To access a single temperature sensor use #GetTemperature(int), see there. \return The temperatures of the selected sensors are returned as std::vector<double> in the configured temperature unit system #uc_temperature. \par Examples: \code // Assuming 'hand' is a cSDH object ... // Get measured values of all sensors std::vector<double> temps = hand.GetTemperature( hand.all_temperature_sensors ); // Now temps is something like { 38.500,37.250,35.750,37.250,33.500,36.500,32.250,59.625,52.500 } // Get controller temperature only: double temp_controller = hand.GetTemperature( 0 ); // Now temp_controller is something like 40.5 // If we - for some obscure islandish reason - would want // temperatures reported in degrees fahrenheit, the unit // converter can be changed: hand.uc_temperature = &cSDH::uc_temperature_fahrenheit; // Get all temperaturs again: temps = hand.GetTemperature( hand.all_temperature_sensors ); // Now temps is something like {100.0, 96.8, 92.3, 97.7, 91.8, 96.8, 90.1, 137.5, 125.2} \endcode <hr> */ std::vector<double> GetTemperature( std::vector<int> const& sensors ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetTemperature(std::vector<int>const&), just for one sensor \a iSensor and returning a single temperature as double. */ double GetTemperature( int iSensor ) throw (cSDHLibraryException*); // end of doxygen name group sdhlibrary_cpp_sdh_h_csdh_common //! @} //##################################################################### //###################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_csdh_communication \name Communication methods @{ */ //----------------------------------------------------------------- /*! Open connection to %SDH via RS232. \param _port : The number of the serial port to use. The default value port=0 refers to 'COM1' in Windows and to the corresponding '/dev/ttyS0' in Linux. \param _baudrate: the baudrate in bit/s, the default is 115200 which happens to be the default for the %SDH too \param _timeout : The timeout to use: - -1 : wait forever - T : wait for T seconds \param _device_format_string : a format string (C string) for generating the device name, like "/dev/ttyS%d" (default) or "/dev/ttyUSB%d". Must contain a %d where the port number should be inserted. This char array is duplicated on construction When compiled with VCC (MS-Visual C++) then this is not used. \par Examples: \code // Assuming 'hand' is a cSDH object ... // Open connection to SDH via default port: hand.OpenRS232(); // Use a different port 2 == COM3 == /dev/ttyS2 for a second hand "hand2": cSDH hand2(); hand2.OpenRS232( 2 ); // Linux only: Use a different USB to RS232 device on port 3 /dev/ttyUSB3 for a third hand "hand3": cSDH hand3(); hand2.OpenRS232( 3, 115200, -1, "/dev/ttyUSB%d" ); \endcode <hr> */ void OpenRS232( int _port=0, unsigned long _baudrate = 115200, double _timeout=-1, char const* _device_format_string="/dev/ttyS%d" ) throw (cSDHLibraryException*); /*! Open connection to %SDH via CAN using an ESD CAN card. If the library was compiled without ESD CAN support then this will just throw an exception. See setting for WITH_ESD_CAN in the top level makefile. \param _net : The ESD CAN net number of the CAN port to use. (default: 0) \param _baudrate : the CAN baudrate in bit/s. Only some bitrates are valid: (1000000 (default),800000,500000,250000,125000,100000,50000,20000,10000) \param _timeout : The timeout to use: - <= 0 : wait forever (default) - T : wait for T seconds \param _id_read - the CAN ID to use for reading (The %SDH sends data on this ID, default=43=0x02b) \param _id_write - the CAN ID to use for writing (The %SDH receives data on this ID, default=42=0x02a) \par Examples: \code // Assuming 'hand' is a cSDH object ... // use default parameters for net, baudrate, timeout and IDs hand.OpenCAN_ESD( ); // use non default settings: // net=1, baudrate=500000, timeout=1.0, id_read=0x143, id_write=0x142 hand.OpenCAN_ESD( 1, 500000, 1.0, 0x143, 0x142 ); \endcode <hr> */ void OpenCAN_ESD( int _net=0, unsigned long _baudrate=1000000, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42 ) throw (cSDHLibraryException*); /*! Open connection to %SDH via CAN using an ESD CAN card using an existing handle. If the library was compiled without ESD CAN support then this will just throw an exception. See setting for WITH_ESD_CAN in the top level makefile. \param _ntcan_handle : The ESD CAN handle to reuse to connect to the ESD CAN driver \param _timeout : The timeout to use: - <= 0 : wait forever (default) - T : wait for T seconds \param _id_read - the CAN ID to use for reading (The %SDH sends data on this ID, default=43=0x2a) \param _id_write - the CAN ID to use for writing (The %SDH receives data on this ID, default=42=0x2a) \par Examples: \code // Assuming 'hand' is a cSDH object ... // and 'handle' is a valid ESD NTCAN_HANDLE // use default parameters for timeout and IDs hand.OpenCAN_ESD( handle ); // or use non default settings: // timeout=1.0, id_read=0x143, id_write=0x142 hand.OpenCAN_ESD( handle, 1.0, 0x143, 0x142 ); \endcode <hr> */ void OpenCAN_ESD( NTCAN_HANDLE _ntcan_handle, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42 ) throw (cSDHLibraryException*); /*! Open connection to %SDH via CAN using an PEAK CAN card. If the library was compiled without PEAK CAN support then this will just throw an exception. See setting for WITH_PEAK_CAN in the top level makefile. \param _baudrate : the CAN baudrate in bit/s. Only some bitrates are valid: (1000000 (default),800000,500000,250000,125000,100000,50000,20000,10000) \param _timeout : The timeout to use: - <= 0 : wait forever (default) - T : wait for T seconds \param _id_read - the CAN ID to use for reading (The %SDH sends data on this ID, default=43=0x02b) \param _id_write - the CAN ID to use for writing (The %SDH receives data on this ID, default=42=0x02a) \param _device - the PEAK device name. Used for the Linux char dev driver only. default="/dev/pcanusb0" \par Examples: \code // Assuming 'hand' is a cSDH object ... // use default parameters for baudrate, timeout, IDs and device hand.OpenCAN_PEAK( ); // use non default settings: // baudrate=500000, timeout=1.0, id_read=0x143, id_write=0x142, , const char *device="/dev/pcanusb1" hand.OpenCAN_PEAK( 500000, 1.0, 0x143, 0x142, "/dev/pcanusb1" ); \endcode <hr> */ void OpenCAN_PEAK( unsigned long _baudrate=1000000, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42, const char *device="/dev/pcanusb0" ) throw (cSDHLibraryException*); /*! Open connection to %SDH via CAN using an PEAK CAN card using an existing handle. If the library was compiled without PEAK CAN support then this will just throw an exception. See setting for WITH_PEAK_CAN in the top level makefile. \param _handle : The PEAK CAN handle to reuse to connect to the PEAK CAN driver \param _timeout : The timeout to use: - <= 0 : wait forever (default) - T : wait for T seconds \param _id_read - the CAN ID to use for reading (The %SDH sends data on this ID, default=43=0x2a) \param _id_write - the CAN ID to use for writing (The %SDH receives data on this ID, default=42=0x2a) \param _device - the PEAK device name. Used for the Linux char dev driver only. default="/dev/pcanusb0" \par Examples: \code // Assuming 'hand' is a cSDH object ... // and 'handle' is a valid PEAK NTCAN_HANDLE // use default parameters for timeout and IDs hand.OpenCAN_PEAK( handle ); // or use non default settings: // timeout=1.0, id_read=0x143, id_write=0x142 hand.OpenCAN_PEAK( handle, 1.0, 0x143, 0x142 ); \endcode <hr> */ void OpenCAN_PEAK( PCAN_HANDLE _handle, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42 ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Close connection to %SDH. The default behaviour is to \b not leave the controllers of the %SDH enabled (to prevent overheating). To keep the controllers enabled (e.g. to keep the finger axes actively in position) set \a leave_enabled to \c true. Only already enabled axes will be left enabled. \param leave_enabled - Flag: true to leave the controllers on, false (default) to disable the controllers (switch powerless) This throws a (cSDHErrorCommunication*) exception if the connection was not opened before. \par Examples: \code // Assuming 'hand' is a cSDH object ... // Close connection to SDH, power off controllers: hand.Close(); // To leave the already enabled controllers enabled: hand.Close( true ); \endcode <hr> */ void Close( bool leave_enabled=false ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Return true if connection to %SDH firmware/hardware is open. */ virtual bool IsOpen( void ) throw (); // end of doxygen name group sdhlibrary_cpp_sdh_h_csdh_communication //! @} //##################################################################### //###################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_csdh_auxilliary \name Auxiliary movement methods @{ */ //----------------------------------------------------------------- /*! Stop movement of all axes of the %SDH and switch off the controllers This command will always be executed sequentially: it will return only after the %SDH has confirmed the emergency stop. \bug For now this will \b NOT work while a GripHand() command is executing, even if that was initiated non-sequentially! \par Examples: \code // Assuming 'hand' is a cSDH object ... // Perform an emergency stop: hand.EmergencyStop(); \endcode <hr> */ void EmergencyStop( void ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Stop movement of all axes but keep controllers on This command will always be executed sequentially: it will return only after the %SDH has confirmed the stop \bug For now this will \b NOT work while a GripHand() command is executing, even if that was initiated non-sequentially! \bug With %SDH firmware < 0.0.2.7 this made the axis jerk in eCT_POSE controller type. This is resolved in %SDH firmware 0.0.2.7 for the eCT_POSE controller type with velocity profile eVP_RAMP. For the eCT_POSE controller type with velocity profile eVP_SIN_SQUARE changing target points/ velocities while moving will still make the axes jerk. <br><b>=> Partly resolved in %SDH firmware 0.0.2.7</b> \par Examples: \code // Assuming 'hand' is a cSDH object ... // Perform a stop: hand.Stop(); \endcode <hr> */ void Stop( void ) throw (cSDHLibraryException*); //----------------------------------------------------------------- //----------------------------------------------------------------- // unimplemented from SAH: // def GetEmergencyStop( int* piBrakeState) //----------------------------------------------------------------- /*! Set the type of axis controller to be used in the %SDH With %SDH firmware >= 0.0.2.7 this will automatically set valid default values for all target velocities, accelerations and positions in the %SDH firmware, according to the \a controller type: - eCT_POSE: - target velocities will be set to default (40 deg/s) - target accelerations will be set to default (100 deg/(s*s)) - target positions will be set to default (0.0 deg) - eCT_VELOCITY: - target velocities will be set to default (0 deg/s) - eCT_VELOCITY_ACCELERATION: - target velocities will be set to default (0 deg/s) - target accelerations will be set to default (100 deg/(s*s)) This will also adjust the lower limits of the allowed velocities here in the SDHLibrary, since the eCT_POSE controller allows only positive velocities while the eCT_VELOCITY and eCT_VELOCITY_ACCELERATION controllers require also negative velocities. \attention The availability of a controller type depends on the %SDH firmware of the attached %SDH and is checked here. - firmware <= 0.0.2.5: only eCT_POSE - firmware >= 0.0.2.6: eCT_POSE, eCT_VELOCITY, eCT_VELOCITY_ACCELERATION \param controller - identifier of controller to set. Valid values are defined in eControllerType \par Examples: \code // Assuming 'hand' is a cSDH object ... // Set the pose controller in the SDH // (see e.g. demo-simple.cpp, demo-simple2.cpp, demo-simple3.cpp for further examples) hand.SetController( hand.eCT_POSE ); // Set the simple velocity controller in the SDH: hand.SetController( hand.eCT_VELOCITY ); // Set the velocity with acceleration ramp controller in the SDH: // (see e.g. demo-velocity-acceleration.cpp for further examples) hand.SetController( hand.eCT_VELOCITY_ACCELERATION ); \endcode <hr> */ void SetController( cSDHBase::eControllerType controller ) throw( cSDHLibraryException* ); //----------------------------------------------------------------- /*! Get the type of axis controller used in the %SDH The currently set controller type will be queried and returned (One of eControllerType) \par Examples: \code // Assuming 'hand' is a sdh.cSDH object ... // Get the controller type of the attached SDH: ct = hand.GetController(); // Print result, numerically and symbolically std::cout << "Currently the axis controller type is set to " << ct; std::cout << "(" << GetStringFromControllerType(ct) << ")\n"; \endcode <hr> */ eControllerType GetController( void ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Set the type of velocity profile to be used in the %SDH \param velocity_profile - Name or number of velocity profile to set. Valid values are defined in eVelocityProfileType \par Examples: \code // Assuming 'hand' is a cSDH object ... // Set the sin square velocity profile in the SDH: hand.SetVelocityProfile( hand.eVP_SIN_SQUARE ); // Or else set the ramp velocity profile in the SDH: hand.SetVelocityProfile( hand.eVP_RAMP ) \endcode <hr> */ void SetVelocityProfile( eVelocityProfile velocity_profile ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the type of velocity profile used in the %SDH \return the currently set velocity profile as integer, see eVelocityProfileType \par Examples: \code // Assuming 'hand' is a cSDH object ... // Get the velocity profile from the SDH: velocity_profile = hand.GetVelocityProfile(); // now velocity_profile is something like eVP_SIN_SQUARE or eVP_RAMP \endcode <hr> */ eVelocityProfile GetVelocityProfile( void ) throw (cSDHLibraryException*); // end of doxygen name group sdhlibrary_cpp_sdh_h_csdh_auxilliary //! @} //##################################################################### //###################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_csdh_axis \name Methods to access %SDH on axis-level @{ */ //----------------------------------------------------------------- /*! Set the maximum allowed motor current(s) for axes. The maximum allowed motor currents are sent to the %SDH. The motor currents can be stored: - axis specific - mode specific (see #eMotorCurrentMode) \param axes - A vector of axis indices to access. \param motor_currents - A vector of motor currents to set. If any of the numbers in the vector is \c NaN (Not a Number) then the currently set axis motor current will be kept for the corresponding axis. The value(s) are expected in the configured motor current unit system #uc_motor_current. \param mode - the mode to set the maximum motor current for. One of the #eMotorCurrentMode modes. \remark - The lengths of the \a axes and \a motor_currents vector must match. - The indices can be given in any order, but the order of their elements must match, i.e. \c motor_currents[i] will be applied to axis \c axes[i] (not axis \c i). - The indices are checked if they are valid axis indices. - The motor currents are checked if they are in the allowed range [0 .. #f_max_motor_current_v], i.e. it is checked that \c motor_currents[i], converted to internal units, is in \c [0 .. \c f_max_motor_currents_v[axes[i]]]. - If \b any index or value is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. See also #SetAxisMotorCurrent(int,double,eMotorCurrentMode) for an overloaded variant to set a single axis motor current or to set the same motor current for all axes. \par Examples: \code // Assuming "hand" is a cSDH object ... // Set maximum allowed motor current of all axes to the given values in mode "eMCM_MOVE":: std::vector<double> all_motor_currents; all_motor_currents.push_back( 0.0 ); all_motor_currents.push_back( 0.1 ); all_motor_currents.push_back( 0.2 ); all_motor_currents.push_back( 0.3 ); all_motor_currents.push_back( 0.4 ); all_motor_currents.push_back( 0.5 ); all_motor_currents.push_back( 0.6 ); hand.SetAxisMotorCurrent( hand.all_axes, all_motor_currents ); // Set maximum allowed motor current of all axes to 0.1 A in mode "eMCM_HOLD": hand.SetAxisMotorCurrent( hand.All, 1.0, eMCM_HOLD ); // Set maximum allowed motor current of axis 3 to 0.75 A in mode "eMCM_MOVE": hand.SetAxisMotorCurrent( 3, 0.75, eMCM_MOVE ); // Set maximum allowed motor current of for axis 0, 4 and 2 to 0.0 A, // 0.4 A and 0.2 A respectively in mode "eMCM_GRIP" std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> motor_currents042; motor_currents042.push_back( 0.0 ); motor_currents042.push_back( 0.4 ); motor_currents042.push_back( 0.2 ); hand.SetAxisMotorCurrent( axes042, states042, eMCM_GRIP ); \endcode <hr> */ void SetAxisMotorCurrent( std::vector<int> const& axes, std::vector<double> const& motor_currents, eMotorCurrentMode mode=eMCM_MOVE ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetAxisMotorCurrent(std::vector<int>const&,std::vector<double>const&,eMotorCurrentMode), just for a single axis \a iAxis and a single motor current \a motor_current, see there. If \a iAxis is #All then \a motor_current is set for all axes. */ void SetAxisMotorCurrent( int iAxis, double motor_current, eMotorCurrentMode mode=eMCM_MOVE ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the maximum allowed motor current(s) of axis(axes). The maximum allowed motor currents are read from the %SDH. The motor currents are stored: - axis specific - mode specific (see eMotorCurrentMode) \param axes - A vector of axis indices to access. \param mode - the mode to set the maximum motor current for. One of the #eMotorCurrentMode modes. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the motor currents of the selected axes. - The values are converted to the selected external unit system using the configured #uc_motor_current unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisMotorCurrent(int,eMotorCurrentMode) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get maximum allowed motor currents of all axes std::vector<double> v = hand.GetAxisMotorCurrent( hand.all_axes ); // now v is something like {0.1, 0.2, 0.3, 0.4, 0.5, 0,6, 0.7} // Get maximum allowed motor current of axis 3 in mode "eMCM_MOVE" double mc3 = hand.GetAxisMotorCurrent( 3, eMCM_MOVE ); // mc3 is now something like 0.75 // Get maximum allowed motor current of axis 3 and 5 in mode "eMCM_GRIP" std::vector<int> axes35; axes35.push_back( 3 ); axes35.push_back( 5 ); v = hand.GetAxisMotorCurrent( axes35, eMCM_GRIP ); // now v is something like {0.5,0.5}; \endcode <hr> */ std::vector<double> GetAxisMotorCurrent( std::vector<int> const& axes, eMotorCurrentMode mode=eMCM_MOVE ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisMotorCurrent(std::vector<int>const&,eMotorCurrentMode), just for a single axis, see there for details and examples. */ double GetAxisMotorCurrent( int iAxis, eMotorCurrentMode mode=eMCM_MOVE ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Set enabled/disabled state of axis controller(s). The controllers of the selected axes are enabled/disabled in the %SDH. Disabled axes are not powered and thus might not remain in their current pose due to gravity, inertia or other external influences. But to prevent overheating the axis controllers should be switched of when not needed. \param axes - A vector of axis indices to access. \param states - A vector of enabled states (0 = disabled, !=0 = enabled) to set. If any of the numbers in the vector is \c NaN (Not a Number) then the currently set enabled state will be kept for the corresponding axis. \remark - The lengths of the \a axes and \a states vector must match. - The indices can be given in any order, but the order of their elements must match, i.e. \c state[i] will be applied to axis \c axes[i] (not axis \c i). - The indices are checked if they are valid axis indices. - If \b any index is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. See also #SetAxisEnable(int,double), #SetAxisEnable(int,bool) for overloaded variants to set a single axis enabled/disabled or to set the same state for all axes. See further #SetAxisEnable(std::vector<int>const&,std::vector<bool>const&) for a variant that accepts a \c bool vector for the states to set. \par Examples: \code // Assuming 'hand' is a cSDH object ... // Enable all axes: hand.SetAxisEnable( hand.all_axes, hand.ones_v ); // Disable all axes: hand.SetAxisEnable( All, 0 ); // Enable axis 0 and 2 while disabling axis 4: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> states042; states042.push_back( 1.0 ); states042.push_back( 0.0 ); states042.push_back( 1.0 ); hand.SetAxisEnable( axes042, states042 ); // Disable axis 2 hand.SetAxisEnable( 2, false ); \endcode <hr> */ void SetAxisEnable( std::vector<int> const& axes, std::vector<double> const& states ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetAxisEnable(std::vector<int>const&,std::vector<double>const&), just for a single axis \a iAxis and a single axis state \a state, see there. If \a iAxis is #All then \a state is applied to all axes. */ void SetAxisEnable( int iAxis=All, double state=1.0 ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetAxisEnable(std::vector<int>const&,std::vector<double>const&), just accepting a vector of \c bool values as states, see there. */ void SetAxisEnable( std::vector<int> const& axes, std::vector<bool> const& states ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetAxisEnable(std::vector<int>const&,std::vector<double>const&), just for a single axis \a iAxis and a single axis state \a state, see there. If \a iAxis is #All then \a state is applied to all axes. */ void SetAxisEnable( int iAxis=All, bool state=true ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get enabled/disabled state of axis controller(s). The enabled/disabled state of the controllers of the selected axes is read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of enabled/disabled states as doubles (0=disabled, 1.0=enabled) of the selected axes. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisEnable(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming 'hand' is a cSDH object ... // Get enabled state of all axes: std::vector<double> v = hand.GetAxisEnable( hand.all_axes ); // now v is something like {0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0} // Get enabled state of axis 3 and 5 std::vector<int> axes35; axes35.push_back( 3 ); axes35.push_back( 5 ); v = hand.GetAxisEnable( axes35 ); // now v is something like {1.0, 0.0} // Get enabled state of axis 3 double v3 = hand.GetAxisEnable( 3 ); // now v3 is something like 1.0 \endcode <hr> */ std::vector<double> GetAxisEnable( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisEnable(std::vector<int>const&), just for a single axis \a iAxis, see there for details and examples. */ double GetAxisEnable( int iAxis ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Get the current actual state(s) of axis(axes). The actual axis states are read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the actual states of the selected axes. - The values are given as #eAxisState enum values - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisActualState(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get actual axis state of all axes std::vector<eAxisState> v = hand.GetAxisActualState( hand.all_axes ) // now v is something like {eAS_IDLE, eAS_POSITIONING, eAS_IDLE, eAS_IDLE, eAS_IDLE, eAS_DISABLED, eAS_IDLE} // Get actual axis state of axis 3 eAxisState v3 = hand.GetAxisActualState( 3 ); // v3 is now something like eAS_IDLE // Get actual state of axis 2 and 5 std::vector<int> axes25; axes25.push_back( 2 ); axes25.push_back( 5 ); v = hand.GetAxisActualState( axes25 ); // now v is something like {eAS_IDLE, eAS_DISABLED} \endcode <hr> */ std::vector<eAxisState> GetAxisActualState( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisActualState(std::vector<int>const&), just for a single axis \a iAxis, see there for details and examples. */ eAxisState GetAxisActualState( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Wait until the movement(s) of of axis(axes) has finished The state of the given axis(axes) is(are) queried until all axes are no longer moving. \param axes - A vector of axis indices to access. \param timeout - a timeout in seconds or -1.0 (default) to wait indefinetly. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. - If \a timeout < 0 then this function will wait arbitrarily long - If a \a timeout is given then this function will throw a cSDHErrorCommunication exception if the given axes are still moving after \a timeout many seconds See also #WaitAxis(int,double) for an overloaded variant to wait for a single axis or all axes. \bug Due to a bug in %SDH firmwares prior to 0.0.2.6 the WaitAxis() command was somewhat unreliable there. When called immediately after a movement command like MoveHand(), then the WaitAxis() command returned immediately without waiting for the end of the movement. With %SDH firmwares 0.0.2.6 and newer this is no longer problematic and WaitAxis() works as expected. <br><b>=> Resolved in %SDH firmware 0.0.2.6</b> \bug With %SDH firmware 0.0.2.6 WaitAxis() did not work if one of the new velocity based controllers (eCT_VELOCITY, eCT_VELOCITY_ACCELERATION) was used. With %SDH firmwares 0.0.2.7 and newer this now works. Here the WaitAxis() waits until the selected axes come to velocity 0.0 <br><b>=> Resolved in %SDH firmware 0.0.2.7</b> \par Examples: Example 1, WaitAxis and eCT_POSE controller, see also the demo program demo-simple3: \code // Assuming "hand" is a cSDH object ... hand.SetController( eCT_POSE ); // Set a new target pose for axis 1,2 and 3 std::vector<int> axes123; axes123.push_back( 1 ); axes123.push_back( 2 ); axes123.push_back( 3 ); std::vector<double> angles123; angles123.push_back( -20.0 ); angles123.push_back( -30.0 ); angles123.push_back( -40.0 ); hand.SetAxisTargetAngle( axes123, angles123 ); // Move axes there non sequentially: hand.MoveAxis( axes123, false ); // The last call returned immediately so we now have time to // do something else while the hand is moving: // ... insert any calculation here ... // Before doing something else with the hand make shure the // selected axes have finished the last movement: hand.WaitAxis( axes123 ); // go back home (all angles to 0.0): hand.SetAxisTargetAngle( hand.All, 0.0 ); // Move all axes there non sequentially: hand.MoveAxis( hand.All, False ); // ... insert any other calculation here ... // Wait until all axes are there, with a timeout of 10s: hand.WaitAxis( hand.All, 10.0 ); // now we are at the desired position. \endcode Example 2, WaitAxis and eCT_VELOCITY_ACCELERATION controller, see also the demo program demo-velocity-acceleration \code // Assuming "hand" is a cSDH object ... hand.SetController( eCT_VELOCITY_ACCELERATION); // Set a new target velocity for axis 1,2 and 3 std::vector<int> axes123; axes123.push_back( 1 ); axes123.push_back( 2 ); axes123.push_back( 3 ); std::vector<double> velocities123; velocities123.push_back( -20.0 ); velocities123.push_back( -30.0 ); velocities123.push_back( -40.0 ); hand.SetAxisTargetVelocity( axes123, velocities123 ); // this will make the axes move! // The last call returned immediately so we now have time to // do something else while the hand is moving: // ... insert any calculation here ... // to break and stop the movement just set the target velocities to 0.0 velocities123[0] = 0.0; velocities123[1] = 0.0; velocities123[2] = 0.0; hand.SetAxisTargetVelocity( axes123, velocities123 ); // this will make the axes break with the default (de)acceleration // The previous command returned immediately, so // before doing something else with the hand make shure the // selected axes have stopped: hand.WaitAxis( axes123 ); // now the axes have stopped \endcode <hr> */ void WaitAxis( std::vector<int> const& axes, double timeout = -1.0 ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #WaitAxis(std::vector<int>const&,double), just for a single axis \a iAxis, see there for details and examples. If \a iAxis is #All then wait for all axes axes. */ void WaitAxis( int iAxis, double timeout = -1.0 ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Set the target angle(s) for axis(axes). The target angles are stored in the %SDH, the movement is not executed until an additional move command is sent. \param axes - A vector of axis indices to access. \param angles - A vector of axis target angles to set. If any of the numbers in the vector is \c NaN (Not a Number) then the currently set axis target angle will be kept for the corresponding axis. The value(s) are expected in the configured angle unit system #uc_angle. \remark - Setting the target angle will \b not make the axis/axes move. - The lengths of the \a axes and \a angles vector must match. - The indices can be given in any order, but the order of their elements must match, i.e. \c angles[i] will be applied to axis \c axes[i] (not axis \c i). - The indices are checked if they are valid axis indices. - The angles are checked if they are in the allowed range [0 .. #f_max_angle_v], i.e. it is checked that \c angles[i], converted to internal units, is in \c [0 .. \c f_max_angle_v[axes[i]]]. - If \b any index or value is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. See also #SetAxisTargetAngle(int,double) for an overloaded variant to set a single axis target angle or to set the same target angle for all axes. \par Examples: \code // Assuming "hand" is a cSDH object ... // Set target axis angle of all axes to the given values: std::vector<double> all_angles; all_angles.push_back( 0.0 ); all_angles.push_back( -11.0 ); all_angles.push_back( -22.0 ); all_angles.push_back( -33.0 ); all_angles.push_back( -44.0 ); all_angles.push_back( -55.0 ); all_angles.push_back( -66.0 ); hand.SetAxisTargetAngle( hand.all_axes, all_angles ); // Set target axis angle of axis 3 to -42°: hand.SetAxisTargetAngle( 3, -42.0 ); // Set target angle of for axis 0, 4 and 2 to 0.0°, -44.4° and -2.22° respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> angles042; angles042.push_back( 0.0 ); angles042.push_back( -44.4 ); angles042.push_back( -2.22 ); hand.SetAxisTargetAngle( axes042, angles042 ); // Set target axis angle of all axes to 0° (home-position) hand.SetAxisTargetAngle( hand.All, 0.0 ); \endcode <hr> */ void SetAxisTargetAngle( std::vector<int> const& axes, std::vector<double> const& angles ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetAxisTargetAngle(std::vector<int>const&,std::vector<double>const&), just for a single axis \a iAxis and a single angle \a angle, see there for details and examples. If \a iAxis is #All then \a motor_current is set for all axes. */ void SetAxisTargetAngle( int iAxis, double angle ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the target angle(s) of axis(axes). The currently set target angles are read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the target angles of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angle unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisTargetAngle(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get target axis angle of all axes std::vector<double> v = hand.GetAxisTargetAngle( hand.all_axes ); // now v is something like {0.0, 0.0, 42.0, 0.0, 47.11, 0,0, 0.0} // Get target axis angle of axis 2 double v2 = hand.GetAxisTargetAngle( 2 ); // v2 is now something like 42.0 // Get target axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisTargetAngle( axes24 ); // now v is something like {42.0, 47.11} \endcode <hr> */ std::vector<double> GetAxisTargetAngle( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisTargetAngle(std::vector<int>const&), just for a single axis \a iAxis and returning a single angle, see there for details and examples. */ double GetAxisTargetAngle( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the current actual angle(s) of axis(axes). The actual angles are read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the actual angles of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angle unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisActualAngle(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get actual axis angle of all axes std::vector<double> v = hand.GetAxisActualAngle( hand.all_axes ); // now v is something like {0.0, 0.0, 42.0, 0.0, 47.11, 0,0, 0.0} // Get actual axis angle of axis 2 double v2 = hand.GetAxisActualAngle( 2 ); // 2 is now something like 42.0 // Get actual axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisActualAngle( axes24 ); // now v is something like {42.0, 47.11} \endcode <hr> */ std::vector<double> GetAxisActualAngle( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisActualAngle(std::vector<int>const&), just for a single axis \a iAxis and returning a single angle, see there for details and examples. */ double GetAxisActualAngle( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Set the target velocity(s) for axis(axes). The target velocities are stored in the %SDH. The time at which a new target velocities will take effect depends on the current axis controller type: - in eCT_POSE controller type the new target velocities will not take effect until an additional move command is sent: MoveAxis(), MoveFinger(), MoveHand() - in eCT_VELOCITY and eCT_VELOCITY_ACCELERATION controller type the new target velocity will take effect immediately. This means that in eCT_VELOCITY_ACCELERATION controller type the accelerations must be set with SetAxisTargetAcceleration() \b before calling SetAxisTargetVelocity(). \param axes - A vector of axis indices to access. \param velocities - A vector of axis target angles to set. If any of the numbers in the vector is \c NaN (Not a Number) then the currently set axis target velocity will be kept for the corresponding axis. The value(s) are expected in the configured angular velocity unit system #uc_angular_velocity. \remark - The lengths of the \a axes and \a velocities vector must match. - The indices can be given in any order, but the order of their elements must match, i.e. \c velocities[i] will be applied to axis \c axes[i] (not axis \c i). - The indices are checked if they are valid axis indices. - The velocities are checked if they are in the allowed range [0 .. #f_max_velocity_v], i.e. it is checked that \c velocities[i], converted to internal units, is in \c [0 .. \c f_max_velocity_v[axes[i]]]. - If \b any index or value is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. See also #SetAxisTargetVelocity(int,double) for an overloaded variant to set a single axis target velocity or to set the same target velocity for all axes. \par Examples: \code // Assuming "hand" is a cSDH object ... // Set target axis velocity of all axes to the given values: std::vector<double> all_velocities; all_velocities.push_back( 0.0 ); all_velocities.push_back( 11.0 ); all_velocities.push_back( 22.0 ); all_velocities.push_back( 33.0 ); all_velocities.push_back( 44.0 ); all_velocities.push_back( 55.0 ); all_velocities.push_back( 66.0 ); hand.SetAxisTargetVelocity( hand.all_axes, all_velocities ); // Set target axis velocity of axis 3 to 42°/s: hand.SetAxisTargetVelocity( 3, 42.0 ); // Set target velocity of for axis 0,4 and 2 to 0.0°/s, 44.4°/s and 2.22°/s respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> velocities042; velocities042.push_back( 0.0 ); velocities042.push_back( 44.4 ); velocities042.push_back( 2.22 ); hand.SetAxisTargetVelocity( axes042, velocities042 ); // Set target axis velocity of all axes to 47.11°/s hand.SetAxisTargetVelocity( hand.All, 47.11 ); \endcode <hr> */ void SetAxisTargetVelocity( std::vector<int> const& axes, std::vector<double> const& velocities ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetAxisTargetVelocity(std::vector<int>const&,std::vector<double>const&), just for a single axis \a iAxis and a single velocity \a velocity, see there for details and examples. */ void SetAxisTargetVelocity( int iAxis, double velocity ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the target velocity(s) of axis(axes). The currently set target velocities are read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the target velocities of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_velocity unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisTargetVelocity(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get target axis velocity of all axes std::vector<double> v = hand.GetAxisTargetVelocity( hand.all_axes ); // now v is something like {0.0, 0.0, 42.0, 0.0, 47.11, 0,0, 0.0} // Get target axis velocity of axis 2 double v2 = hand.GetAxisTargetVelocity( 2 ); // v2 is now something like 42.0 // Get target axis velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisTargetVelocity( axes24 ); // now v is something like {42.0, 47.11} \endcode <hr> */ std::vector<double> GetAxisTargetVelocity( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisTargetVelocity(std::vector<int>const&), just for a single axis \a iAxis and returning a single velocity, see there for details and examples. */ double GetAxisTargetVelocity( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the velocity limit(s) of axis(axes). The velocity limit(s) are read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the velocity limits of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_velocity unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisLimitVelocity(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get axis velocity limits of all axes std::vector<double> v = hand.GetAxisLimitVelocity( hand.all_axes ); // now v is something like {81.0, 140.0, 120.0, 140.0, 120.0, 140.0, 120.0} // Get axis velocity limit of axis 2 double v2 = hand.GetAxisLimitVelocity( 2 ); // v2 is now something like 120.0 // Get axis velocity limits of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisLimitVelocity( axes24 ); // now v is something like {120.0,120.0} \endcode <hr> */ std::vector<double> GetAxisLimitVelocity( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisLimitVelocity(std::vector<int>const&), just for a single axis \a iAxis and returning a single velocity limit, see there for details and examples. */ double GetAxisLimitVelocity( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the acceleration limit(s) of axis(axes). The acceleration limit(s) are read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the acceleration limits of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_acceleration unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisLimitAcceleration(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get axis acceleration limits of all axes std::vector<double> v = hand.GetAxisLimitAcceleration( hand.all_axes ); // now v is something like {81.0, 140.0, 120.0, 140.0, 120.0, 140.0, 120.0} // Get axis acceleration limit of axis 2 double v2 = hand.GetAxisLimitAcceleration( 2 ); // v2 is now something like 120.0 // Get axis acceleration limits of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisLimitAcceleration( axes24 ); // now v is something like {120.0,120.0} \endcode <hr> */ std::vector<double> GetAxisLimitAcceleration( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisLimitAcceleration(std::vector<int>const&), just for a single axis \a iAxis and returning a single acceleration limit, see there for details and examples. */ double GetAxisLimitAcceleration( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the actual velocity(s) of axis(axes). \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the actual velocities of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_velocity unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisActualVelocity(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get actual axis velocity of all axes std::vector<double> v = hand.GetAxisActualVelocity( hand.all_axes ); // now v is something like {0.1, 0.2, 0.3, 13.2, 0.5, 0.0, 0.7} // Get actual axis velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisActualVelocity( axes24 ); // now v is something like {13.2, 0.0} // Get actual axis velocity of axis 2 double v3 = hand.GetAxisActualVelocity( 2 ); // v3 is now something like 13.2 \endcode <hr> */ std::vector<double> GetAxisActualVelocity( std::vector<int>const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisActualVelocity(std::vector<int>const&), just for a single axis \a iAxis and returning a single velocity, see there for details and examples. */ double GetAxisActualVelocity( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the current reference velocity(s) of axis(axes). (This velocity is used internally by the %SDH in eCT_VELOCITY_ACCELERATION mode). \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the reference velocities of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_velocity unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisReferenceVelocity(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Switch to "velocity control with acceleration ramp" controller mode first. // (When in another controller mode like the default eCT_POSE, // then the reference velocities will not be valid): hand.SetController( eCT_VELOCITY_ACCELERATION ); // Get reference axis velocity of all axes std::vector<double> v = hand.GetAxisReferenceVelocity( hand.all_axes ); // now v is something like {0.1, 0.2, 0.3, 13.2, 0.5, 0.0, 0.7} // Get reference axis velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisReferenceVelocity( axes24 ); // now v is something like {13.2, 0.0} // Get reference axis velocity of axis 2 double v3 = hand.GetAxisReferenceVelocity( 2 ); // v3 is now something like 13.2 \endcode \remark - the underlying rvel command of the %SDH firmware is not available in firmwares prior to 0.0.2.6. For such hands calling rvel will fail miserably. - The availability of an appropriate %SDH firmware is \b not checked here due to performance losses when this function is used often. <hr> */ std::vector<double> GetAxisReferenceVelocity( std::vector<int>const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisReferenceVelocity(std::vector<int>const&), just for a single axis \a iAxis and returning a single velocity, see there for details and examples. */ double GetAxisReferenceVelocity( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Set the target acceleration(s) for axis(axes). The target accelerations are stored in the %SDH and are used only for: - the eCT_POSE controller type with eVP_RAMP velocity profile - the eCT_VELOCITY_ACCELERATION controller type Setting the target acceleration will not affect an ongoing movement, nor will it start a new movement. To take effect an additional command must be sent: - in eCT_POSE controller type a move command: MoveAxis() MoveFinger() MoveHand() - in eCT_VELOCITY_ACCELERATION controller type the velocity must be set: SetAxisTargetVelocity() \param axes - A vector of axis indices to access. \param accelerations - A vector of axis target accelerations to set. If any of the numbers in the vector is \c NaN (Not a Number) then the currently set axis target angle will be kept for the corresponding axis. The value(s) are expected in the configured angular acceleration unit system #uc_angular_acceleration. \remark - The lengths of the \a axes and \a accelerations vector must match. - The indices can be given in any order, but the order of their elements must match, i.e. \c accelerations[i] will be applied to axis \c axes[i] (not axis \c i). - The indices are checked if they are valid axis indices. - The accelerations are checked if they are in the allowed range [0 .. #f_max_velocity_v], i.e. it is checked that \c accelerations[i], converted to internal units, is in \c [0 .. \c f_max_velocity_v[axes[i]]]. - If \b any index or value is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. See also #SetAxisTargetAcceleration(int,double) for an overloaded variant to set a single axis target acceleration or to set the same target acceleration for all axes. \par Examples: \code // Assuming "hand" is a cSDH object ... // Set target axis acceleration of all axes to the given values: std::vector<double> all_accelerations; all_accelerations.push_back( 100.0 ); all_accelerations.push_back( 101.0 ); all_accelerations.push_back( 102.0 ); all_accelerations.push_back( 103.0 ); all_accelerations.push_back( 104.0 ); all_accelerations.push_back( 105.0 ); all_accelerations.push_back( 106.0 ); hand.SetAxisTargetAcceleration( hand.all_axes, all_accelerations ); // Set target axis acceleration of axis 3 to 420°/s²: hand.SetAxisTargetAcceleration( 3, 420.0 ); // Set target acceleration of for axis 0,4 and 2 to 0.0°/s², 444.0°/s² and 222°/s² respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> accelerations042; accelerations042.push_back( 100.0 ); accelerations042.push_back( 104.0 ); accelerations042.push_back( 102.0 ); hand.SetAxisTargetAcceleration( axes042, accelerations042 ); // Set target axis acceleration of all axes to 142.1°/s hand.SetAxisTargetAcceleration( hand.All, 142.1 ); \endcode <hr> */ void SetAxisTargetAcceleration( std::vector<int>const& axes, std::vector<double>const& accelerations ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetAxisTargetAcceleration(std::vector<int>const&,std::vector<double>const&), just for a single axis \a iAxis and a single acceleration \a acceleration, see there for details and examples. */ void SetAxisTargetAcceleration( int iAxis, double acceleration ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the target acceleration(s) of axis(axes). The currently set target accelerations are read from the %SDH. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the target accelerations of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_acceleration unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisTargetAcceleration(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get target axis acceleration of all axes std::vector<double> v = hand.GetAxisTargetAcceleration( hand.all_axes ); // now v is something like {100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0} // Get target axis acceleration of axis 2 double v2 = hand.GetAxisTargetAcceleration( 2 ); // v2 is now something like 100.0 // Get target axis acceleration of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisTargetAcceleration( axes24 ); // now v is something like {100.0, 100.0} \endcode <hr> */ std::vector<double> GetAxisTargetAcceleration( std::vector<int>const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisTargetAcceleration(std::vector<int>const&), just for a single axis \a iAxis and returning a single acceleration, see there for details and examples. */ double GetAxisTargetAcceleration( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the minimum angle(s) of axis(axes). The minimum angles are currently not read from the %SDH, but are stored in the library. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the min angles of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angle unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisMinAngle(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get minimum axis angles of all axes std::vector<double> v = hand.GetAxisMinAngle( hand.all_axes ); // now v is something like {0.0, -90.0, -90.0, -90.0, -90.0, -90.0, -90.0} // Get minimum axis angle of axis 3 double v3 = hand.GetAxisMinAngle( 3 ); // v3 is now something like -90.0 // Get minimum axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMinAngle( axes24 ); // now v is something like {-90.0, -90.0} // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetAxisMinAngle( hand.all_axes ); // now v is something like {0.0, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966} \endcode <hr> */ std::vector<double> GetAxisMinAngle( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisMinAngle(std::vector<int>const&), just for a single axis \a iAxis and returning a single minimum angle, see there for details and examples. */ double GetAxisMinAngle( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the maximum angle(s) of axis(axes). The maximum angles are currently not read from the %SDH, but are stored in the library. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the max angles of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angle unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisMaxAngle(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get maximum axis angles of all axes std::vector<double> v = hand.GetAxisMaxAngle( hand.all_axes ); // now v is something like {90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0} // Get maximum axis angle of axis 3 double v3 = hand.GetAxisMaxAngle( 3 ); // v3 is now something like 90.0 // Get maximum axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMaxAngle( axes24 ); // now v is something like {90.0, 90.0} // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetAxisMaxAngle( hand.all_axes ); // now v is something like { 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966} \endcode <hr> */ std::vector<double> GetAxisMaxAngle( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisMaxAngle(std::vector<int>const&), just for a single axis \a iAxis and returning a single maximum angle, see there for details and examples. */ double GetAxisMaxAngle( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the maximum velocity(s) of axis(axes). These are the (theoretical) maximum velocities as determined by the maximum motor velocity and gear box ratio. The values do not take things like friction or inertia into account. So it is likely that these maximum velocities cannot be reached by the real hardware in reality. The maximum velocities are currently read once from the %SDH when the communication to the %SDH is opened. Later queries of this maximum velocities will use the values stored in the library. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the max angular velocities of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_velocity unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisMaxVelocity(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get maximum axis angular velocities of all axes std::vector<double> v = hand.GetAxisMaxVelocity( hand.all_axes ); // now v is something like {83.857,200.000,157.895,200.000,157.895,200.000,157.895} // Get maximum axis angular velocity of axis 3 double v3 = hand.GetAxisMaxVelocity( 3 ); // v3 is now something like 200.0 // Get maximum axis angular velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMaxVelocity( axes24 ); // now v is something like {157.895, 157.895} // Or if you change the angular velocity unit system: hand.UseRadians(); v = hand.GetAxisMaxVelocity( hand.all_axes ); // now v is something like {1.46358075084, 3.49065850399, 2.75578762244, 3.49065850399, 2.75578762244, 3.49065850399, 2.75578762244} \endcode <hr> */ std::vector<double> GetAxisMaxVelocity( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisMaxVelocity(std::vector<int>const&), just for a single axis \a iAxis and returning a single minimum angle, see there for details and examples. */ double GetAxisMaxVelocity( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the maximum acceleration(s) of axis(axes). The maximum accelerations are currently not read from the %SDH, but are stored in the library. \param axes - A vector of axis indices to access. - The indices in \a axes are checked if they are valid axis indices. - If \b any axis index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the max angular accelerations of the selected axes. - The values are converted to the selected external unit system using the configured #uc_angular_acceleration unit converter object. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisMaxAcceleration(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get maximum axis angular accelerations of all axes std::vector<double> v = hand.GetAxisMaxAcceleration( hand.all_axes ); // now v is something like {1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0} // Get maximum axis angular acceleration of axis 3 double v3 = hand.GetAxisMaxAcceleration( 3 ); // v3 is now something like 1000.0 // Get maximum axis angular acceleration of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMaxAcceleration( axes24 ); // now v is something like {1000.0, 1000.0} // Or if you change the angular acceleration unit system: hand.UseRadians(); v = hand.GetAxisMaxAcceleration( hand.all_axes ); // now v is something like {17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293} \endcode <hr> */ std::vector<double> GetAxisMaxAcceleration( std::vector<int> const& axes ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetAxisMaxAcceleration(std::vector<int>const&), just for a single axis \a iAxis and returning a single minimum angle, see there for details and examples. */ double GetAxisMaxAcceleration( int iAxis ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Move selected axis/axes to the previously set target pose with the previously set velocity profile, (maximum) target velocities and target accelerations \param axes - A vector of axis indices to access. \param sequ - flag: if true (default) then the function executes sequentially and returns not until after the %SDH has finished the movement. If false then the function returns immediately after the movement command has been sent to the %SDH (the currently set target axis angles for other axes will then be \b overwritten with their current actual axis angles). - The indices in \a axes are checked if they are valid axis indices. - If any index is invalid then no movement is performed, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return The expected/elapsed execution time for the movement in the configured time unit system #uc_time \remark - The axes will be enabled automatically. - Currently the actual movement velocity of an axis is determined by the %SDH firmware to make the movements of all involved axes start and end synchronously at the same time. Therefore the axis that needs the longest time for its movement at its given maximum velocity determines the velocities of all the other axes. - Other axes than those selected by \a axes will \b NOT move, even if target axis angles for the axes have been set. (Remember: as axis 0 is used by finger 0 and 2 these two fingers cannot be moved completely idependent of each other.) - If \a sequ is true then the currently set target axis angles for other fingers will be restored upon return of the function. - If \a sequ is false then the currently set target axis angles for other fingers will be \b overwritten with their current actual axis angles See also #MoveAxis(int,bool) for an overloaded variant to move a single axis. \par Examples: \code // Assuming 'hand' is a cSDH object ... // create an index vector for adressing axes 0, 4 and 2 (in that order) std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); // Set a new target pose for axes 0, 4 and 2: std::vector<double> angles042; angles042.push_back( 0.0 ); angles042.push_back( -44.4 ); angles042.push_back( -22.2 ); hand.SetFingerTargetAngle( axes042, angles042 ); // First move Axis 0 only to its new target position: hand.MoveAxis( 0 ); // The axis 0 has now reached its target position 0.0°. The // target poses for axes 4 and 2 are still set since the // last MoveAxes() call was sequentially (und thus it could // restore the previously set target axis angles of not // selected axes after the movement finished) // So move axes 4 and 2 now, this time non-sequentially: std::vector<int> axes42; axes42.push_back( 4 ); axes42.push_back( 2 ); double t = hand.MoveAxes( axis42, false ); // The two axes 4 and 2 are now moving to their target position. // We have to wait until the non-sequential call has finished: SleepSec( t ); // The axes 4 and 2 have now moved to -44.4 and -22.2. // The target angles for other axes have by now been // overwritten since the last MoveAxis() call was // non-sequentially (und thus it could \b NOT restore the // previously set target axis angles of not selected axes // after the movement finished) // Set new target angles for all axes ("home pose"); hand.SetAxisTargetAngle( hand.All, 0.0 ); // Now move all axes back to home pose: hand.MoveAxes( hand.All ); \endcode \bug With %SDH firmware < 0.0.2.7 calling MoveAxis() while some axes are moving in eCT_POSE controller type will make the joints jerk. This is resolved in %SDH firmware 0.0.2.7 for the eCT_POSE controller type with velocity profile eVP_RAMP. For the eCT_POSE controller type with velocity profile eVP_SIN_SQUARE changing target points/ velocities while moving will still make the axes jerk. <br><b>=> Partly resolved in %SDH firmware 0.0.2.7</b> <hr> */ double MoveAxis( std::vector<int>const& axes, bool sequ=true ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #MoveAxis(std::vector<int>const&,bool), just for a single axis \a iAxis (or all axes if #All is given). */ double MoveAxis( int iAxis, bool sequ=true ) throw (cSDHLibraryException*); // unimplemented from SAH: // def GetJointAngle( int iFinger,double* pafAngle); // def GetJointSpeed( int iFinger,double* pafSpeed); // def GetJointTorque( int iFinger,double* pafTorque); // end of doxygen name group sdhlibrary_cpp_sdh_h_csdh_axis //! @} //##################################################################### //###################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_csdh_finger \name Methods to access %SDH on finger-level @{ */ //----------------------------------------------------------------- /*! Set enabled/disabled state of axis controllers of finger(s). The controllers of the axes of the selected fingers are enabled/disabled in the %SDH. Disabled axes are not powered and thus might not remain in their current pose due to gravity, inertia or other external influences. But to prevent overheating the axis controllers should be switched of when not needed. \param fingers - A vector of finger indices to access. \param states - A vector of enabled states (0 = disabled, !=0 = enabled) to set. If any of the numbers in the vector is \c NaN (Not a Number) then the currently set enabled state will be kept for the corresponding axis. \remark - The lengths of the \a fingers and \a states vector must match. - The indices can be given in any order, but the order of their elements must match, i.e. \c state[i] will be applied to finger \c fingers[i] (not finger \c i). - The indices are checked if they are valid finger indices. - If \b any index is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. - As axis 0 is used for finger 0 and 2, axis 0 is disabled only if both finger 0 and 1 are disabled. See also #SetFingerEnable(int,double), #SetFingerEnable(int,bool) for overloaded variants to set a single finger enabled/disabled or to set the same state for all fingers. See further #SetFingerEnable(std::vector<int>const&,std::vector<bool>const&) for a variant that accepts a \c bool vector for the states to set. \par Examples: \code // Assuming "hand" is a cSDH object ... // Enable finger 1 and 2 while disabling finger 0 : std::vector<double> states012; states012.push_back( 0.0 ); states012.push_back( 1.0 ); states012.push_back( 1.0 ); hand.SetFingerEnable( hand.all_axes, states012 ); // (this will keep axis 0 (used by the disabled finger 0) enabled, // since axis 0 is needed by the enabled finger 2 too); // Enable all fingers: hand.SetFingerEnable( hand.All,true ); // Disable all fingers: hand.SetFingerEnable( hand.All, 0.0 ); // Disable finger 2: hand.SetFingerEnable( 2, false ); \endcode <hr> */ void SetFingerEnable( std::vector<int> const& fingers, std::vector<double> const& states ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetFingerEnable(std::vector<int>const&,std::vector<double>const&), just for a single finger \a iAxis and a single angle \a angle, see there for details and examples. */ void SetFingerEnable( int iFinger, double state=1.0 ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetFingerEnable(std::vector<int>const&,std::vector<double>const&), just with states as vector of \c bool values, see there for details and examples. */ void SetFingerEnable( std::vector<int> const& fingers, std::vector<bool> const& states ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #SetFingerEnable(std::vector<int>const&,std::vector<double>const&), just for a single finger \a iAxis and a single angle \a angle, see there for details and examples. */ void SetFingerEnable( int iFinger, bool state ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get enabled/disabled state of axis controllers of finger(s). The enabled/disabled state of the controllers of the selected fingers is read from the %SDH. A finger is reported disabled if any of its axes is disabled and reported enabled if all its axes are enabled. \param fingers - A vector of finger indices to access. - The indices in \a fingers are checked if they are valid finger indices. - If \b any finger index is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of enabled/disabled states as doubles (0=disabled, 1.0=enabled) of the selected axes. - The order of the elements of the \a axes vector and the returned values vector \a rv matches. I.e. \c rv[i] will be the value of axis \c axes[i] (not axis \c i). See also #GetAxisEnable(int) for an overloaded variant to access a single axis. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get enabled state of all fingers: std::vector<double> v = hand.GetFingerEnable( hand.all_fingers ); // now v is something like {0.0, 1.0, 0.0} // Get enabled state of finger 0 and 2 std::vector<int> fingers02; fingers02.push_back( 0 ); fingers02.push_back( 2 ); v = hand.GetFingerEnable( fingers02 ); // now v is something like {0.0, 0.0} // Get enabled state of finger 1 double v1 = hand.GetFingerEnable( 1 ); // now v1 is something like 1.0 \endcode <hr> */ std::vector<double> GetFingerEnable( std::vector<int> const& fingers ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #GetFingerEnable(std::vector<int>const&), just for a single finger \a iFinger and returning a single double value */ double GetFingerEnable( int iFinger ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Set the target angle(s) for a single finger. The target axis angles \a angle of finger \a iFinger are stored in the %SDH. The movement is not executed until an additional move command is sent. \param iFinger - index of finger to access. This must be a single index. \param angles - the angle(s) to set or \c None to set the current actual axis angles of the finger as target angle. This can be a single number or a \ref sdhlibrary_cpp_sdh_h_csdh_vector "vector" of numbers. The value(s) are expected in the configured angle unit system #uc_angle. \remark - Setting the target angles will \b not make the finger move. - The \a iFinger index is checked if it is a valid finger index. - The angles are checked if they are in the allowed range [0 .. #f_max_angle_v], i.e. it is checked that \c angles[i], converted to internal units, is in \c [0 .. \c f_max_angle_v[finger_axis_index[iFinger][i]]]. - If \b any index or value is invalid then \b none of the specified values is sent to the %SDH, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. See also #SetFingerTargetAngle(int,double,double,double) for an overloaded variant to set finger axis target angles from single \c double values. \par Examples: \code // Assuming "hand" is a cSDH object ... // Set target axis angles of finger 0 to { 10.0°, -08.15°, 47.11° } std::vector<double> angles; angles.push_back( 10.0 ); angles.push_back( -08.15 ); angles.push_back( 47.11 ); hand.SetFingerTargetAngle( 0, angles ); // Set target axis angles of finger 1 to { 0.0°, 24.7°, 17.4° } angles[0] = 0.0; // "virtual" base axis of finger 1 angles[1] = 24.7; angles[2] = 17.4; hand.SetFingerTargetAngle( 1, { 0.0, 24.7, 17.4 } ); // Set target axis angles of all axes of finger 0 to 12.34° hand.SetFingerTargetAngle( 0, 12.34, 12.34, 12.34 ); // REMARK: the last command changed the previously set target axis // angle for axis 0, since axis 0 is used as base axis for both // finger 0 and 2! \endcode <hr> */ void SetFingerTargetAngle( int iFinger, std::vector<double> const& angles ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Like #SetFingerTargetAngle(int,std::vector<double>const&), just with individual finger axis angles \a a0, \a a1 and \a a2. */ void SetFingerTargetAngle( int iFinger, double a0, double a1, double a2 ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the target axis angles of a single finger. The target axis angles of finger \a iFinger are read from the %SDH. \param iFinger - index of finger to access. This must be a single index \remark - The \a iFinger index is checked if it is a valid finger index. - If \a iFinger is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A list of the selected fingers target axis angles - The values are returned in the configured angle unit system #uc_angle. See also #GetFingerTargetAngle(int,double&,double&,double&) for an overloaded variant to get finger axis target angles into single \c double values. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get target axis angles of finger 0 std::vector<double> v = hand.GetFingerTargetAngle( 0 ); // now v is something like {42.0, -10.0, 47.11} // Get target axis angles of finger 1 double a0, a1, a2; hand.GetFingerTargetAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 0.0, 24.7 and -5.5 respectively. \endcode <hr> */ std::vector<double> GetFingerTargetAngle( int iFinger ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Like #GetFingerTargetAngle(int), just returning the target axis angles in the \a a0, \a a1 and \a a2 parameters which are given by reference. */ void GetFingerTargetAngle( int iFinger, double& a0, double& a1, double& a2 ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the current actual axis angles of a single finger. The current actual axis angles of finger \a iFinger are read from the %SDH. \param iFinger - index of finger to access. This must be a single index. \remark - The \a iFinger index is checked if it is a valid finger index. - If \a iFinger is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A list of the current actual axis angles of the selected finger - The values are returned in the configured angle unit system #uc_angle. See also #GetFingerActualAngle(int,double&,double&,double&) for an overloaded variant to get finger axis actual angles into single \c double values. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get actual axis angles of finger 0 std::vector<double> v = hand.GetFingerActualAngle( 0 ); // v is now something like {42.0, -10.0, 47.11} // Get actual axis angles of finger 1 double a0, a1, a2; hand.GetFingerTargetAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 0.0, 24.7 and -5.5 respectively. \endcode <hr> */ std::vector<double> GetFingerActualAngle( int iFinger ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Like #GetFingerActualAngle(int), just returning the actual axis angles in the \a a0, \a a1 and \a a2 parameters which are given by reference. */ void GetFingerActualAngle( int iFinger, double& a0, double& a1, double& a2 ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the minimum axis angles of a single finger. The minimum axis angles of finger \a iFingers axes, stored in the library, are returned. \param iFinger - index of finger to access. This must be a single index \remark - The \a iFinger index is checked if it is a valid finger index. - If \a iFinger is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A list of the selected fingers minimum axis angles - The values are returned in the configured angle unit system #uc_angle. See also #GetFingerMinAngle(int,double&,double&,double&) for an overloaded variant to get finger axis min angles into single \c double values. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get minimum axis angles of finger 0 std::vector<double> v = hand.GetFingerMinAngle( 0 ); // now v is something like {0.0, -90.0, -90.0} // Get target axis angles of finger 1 double a0, a1, a2; hand.GetFingerMinAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 0.0, -90.0, -90.0 respectively. // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetFingerMinAngle( 0 ); // now v is something like {0.0, -1.5707963267948966, -1.5707963267948966} \endcode <hr> */ std::vector<double> GetFingerMinAngle( int iFinger ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Like #GetFingerMinAngle(int), just returning the finger axis min angles in the \a a0, \a a1 and \a a2 parameters which are given by reference. */ void GetFingerMinAngle( int iFinger, double& a0, double& a1, double& a2 ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the maximum axis angles of a single finger. The maximum axis angles of finger \a iFingers axes, stored in the library, are returned. \param iFinger - index of finger to access. This must be a single index \remark - The \a iFinger index is checked if it is a valid finger index. - If \a iFinger is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A list of the selected fingers maximum axis angles - The values are returned in the configured angle unit system #uc_angle. See also #GetFingerMaxAngle(int,double&,double&,double&) for an overloaded variant to get finger axis max angles into single \c double values. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get maximum axis angles of finger 0 std::vector<double> v = hand.GetFingerMaxAngle( 0 ); // now v is something like {90.0, 90.0, 90.0} // Get target axis angles of finger 1 double a0, a1, a2; hand.GetFingerMaxAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 90.0, 90.0, 90.0 respectively. // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetFingerMaxAngle( 0 ); // now v is something like {1.5707963267948966, 1.5707963267948966, 1.5707963267948966} \endcode <hr> */ std::vector<double> GetFingerMaxAngle( int iFinger ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Like #GetFingerMaxAngle(int), just returning the finger axis max angles in the \a a0, \a a1 and \a a2 parameters which are given by reference. */ void GetFingerMaxAngle( int iFinger, double& a0, double& a1, double& a2 ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Get the cartesian xyz finger tip position of a single finger from the given axis angles (forward kinematics). \param iFinger - index of finger to access. This must be a single index \param angles - a vector of NUMBER_OF_AXES_PER_FINGER angles. The values are expected in the configured angle unit system #uc_angle. \remark - The \a iFinger index is checked if it is a valid finger index. - The angles are checked if they are in the allowed range [0 .. #f_max_angle_v], i.e. it is checked that \c angles[i], converted to internal units, is in \c [0 .. \c f_max_angle_v[finger_axis_index[iFinger][i]]]. - If any index or value is invalid then a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return - A vector of the x,y,z values of the finger tip position - The values are returned in the configured position unit system #uc_position. See also #GetFingerXYZ(int,double,double,double) for an overloaded variant to get finger tip position from single \c double values. \par Examples: \code // Assuming "hand" is a cSDH object ... // Get actual finger angles of finger 0: std::vector<double> angles = hand.GetFingerActualAngle( 0 ); // Get actual finger tip position of finger 0: std::vector<double> position = hand.GetFingerXYZ( 0, angles ); // now position is something like {18.821618775581801, 32.600000000000001, 174.0} // (assuming that finger 0 is at axis angles {0,0,0}) // Get finger tip position of finger 2 at axis angles {90,-90,-90}: position = hand.GetFingerXYZ( 2, 90, -90, -90 ); // now position is something like {18.821618775581804, 119.60000000000002, -53.0} // Or if you change the angle unit system: hand.UseRadians(); position = hand.GetFingerXYZ( 0, 1.5707963267948966, -1.5707963267948966, -1.5707963267948966 ); // now position is still something like {18.821618775581804, 119.60000000000002, -53.0} // Or if you change the position unit system too: hand.uc_position = &cSDH::uc_position_meter position = hand.GetFingerXYZ( 0, 1.5707963267948966, -1.5707963267948966, -1.5707963267948966 ); // now position is still something like {0.018821618775581, 0.119.60000000000002, -0.052999999999} \endcode <hr> */ std::vector<double> GetFingerXYZ( int iFinger, std::vector<double> const& angles ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Like #SetFingerTargetAngle(int,std::vector<double>const&), just with individual finger axis angles \a a0, \a a1 and \a a2. */ std::vector<double> GetFingerXYZ( int iFinger, double a0, double a1, double a2 ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Move selected finger(s) to the previously set target pose with the previously set velocity profile, (maximum) target velocities and target accelerations. \param fingers - A vector of finger indices to access. \param sequ - flag: if true (default) then the function executes sequentially and returns not until after the %SDH has finished the movement. If false then the function returns immediately after the movement command has been sent to the %SDH (the currently set target axis angles for other fingers will then be \b overwritten with their current actual axis angles). - The indices in \a fingers are checked if they are valid finger indices. - If any index is invalid then no movement is performed, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return The expected/elapsed execution time for the movement in the configured time unit system #uc_time \remark - The axes will be enabled automatically. - Currently the actual movement velocity of an axis is determined by the %SDH firmware to make the movements of all involved axes start and end synchronously at the same time. Therefore the axis that needs the longest time for its movement at its given maximum velocity determines the velocities of all the other axes. - Other fingers than \a iFinger will \b NOT move, even if target axis angles for their axes have been set. (Exception: as axis 0 is used by finger 0 and 2 these two fingers cannot be moved completely idependent of each other.) - If \a sequ is true then the currently set target axis angles for other fingers will be restored upon return of the function. - If \a sequ is false then the currently set target axis angles for other fingers will be \b overwritten with their current actual axis angles See also #MoveFinger(int,bool) for an overloaded variant to move a single finger. \par Examples: \code // Assuming 'hand' is a cSDH object ... // Set a new target pose for finger 0: hand.SetFingerTargetAngle( 0, 0.0, 0.0, 0.0 ); // Set a new target pose for finger 1 hand.SetFingerTargetAngle( 1, 0.0, -10.0, -10.0 ); // Set a new target pose for finger 2 hand.SetFingerTargetAngle( 2, 20.0, -20.0, -20.0 ); // Move finger 0 only (and finger 2 partly as axis 0 also belongs to finger 2); hand.MoveFinger( 0, true ); // The finger 0 has been moved to {20,0,0} // (axis 0 is 'wrong' since the target angle for axis 0 has been overwritten // while setting the target angles for finger 2); // The target poses for finger 1 and 2 are still set since the // last MoveFinger() call was sequentially. // So move finger 1 now: double t = hand.MoveFinger( 1, false ); // wait until the non-sequential call has finished: SleepSec( t ); // The finger 1 has been moved to {0,-10,-10}. // The target angles for finger 2 have been overwritten since the // last MoveFinger() call was non-sequentially. // Therefore this next call will just keep the fingers in their // current positions: hand.MoveFinger( hand.All, true ); // Set new target angles for all axes ("home pose"); hand.SetAxisTargetAngle( hand.All, 0.0 ); // Now move all axes back to home pose: hand.MoveHand(); \endcode \bug With %SDH firmware < 0.0.2.7 calling MoveFinger() while some axes are moving in eCT_POSE controller type will make the joints jerk. This is resolved in %SDH firmware 0.0.2.7 for the eCT_POSE controller type with velocity profile eVP_RAMP. For the eCT_POSE controller type with velocity profile eVP_SIN_SQUARE changing target points/ velocities while moving will still make the axes jerk. <br><b>=> Partly resolved in %SDH firmware 0.0.2.7</b> <hr> */ double MoveFinger( std::vector<int>const& fingers, bool sequ=true ) throw (cSDHLibraryException*); //---------------------------------------------------------------------- /*! Like #MoveFinger(std::vector<int>const&,bool), just for a single finger \a iFinger (or all fingers if #All is given). */ double MoveFinger( int iFinger, bool sequ=true ) throw (cSDHLibraryException*); //----------------------------------------------------------------- /*! Move all fingers to the previously set target pose with the previously set (maximum) velocities. This is just a shortcut to #MoveFinger(int,bool) with \a iFinger set to \c hand.All and \a sequ as indicated, so see there for details and examples. \bug With %SDH firmware < 0.0.2.7 calling MoveHand() while some axes are moving in eCT_POSE controller type will make the joints jerk. This is resolved in %SDH firmware 0.0.2.7 for the eCT_POSE controller type with velocity profile eVP_RAMP. For the eCT_POSE controller type with velocity profile eVP_SIN_SQUARE changing target points/ velocities while moving will still make the axes jerk. <br><b>=> Parltly resolved in %SDH firmware 0.0.2.7</b> */ double MoveHand( bool sequ=true ) throw (cSDHLibraryException*); // end of doxygen name group sdhlibrary_cpp_sdh_h_csdh_finger //! @} //##################################################################### //###################################################################### /*! \anchor sdhlibrary_cpp_sdh_h_csdh_grip \name Methods to access %%SDH grip skills @{ */ //----------------------------------------------------------------- /*! Get the maximum velocity of grip skills The maximum velocity is currently not read from the %SDH, but is stored in the library. \return - a single double value is returned representing the velocity in the #uc_angular_velocity unit system \par Examples: \code // Assuming "hand" is a cSDH object ... // Get maximum grip skill velocity double v = hand.GetGripMaxVelocity(); // v is now something like 100.0 // Or if you change the velocity unit system: hand.UseRadians(); v = hand.GetGripMaxVelocity(); // now v is something like 1.7453292519943295 \endcode <hr> */ double GetGripMaxVelocity( void ); //----------------------------------------------------------------- /*! Perform one of the internal #eGraspId "grips" or "grasps" \warning THIS DOES NOT WORK WITH %SDH FIRMWARE PRIOR TO 0.0.2.6 AND SDHLIBRARY-CPP PRIOR to 0.0.1.12 This was a feature in the ancient times of the SDH1 and now does work again for %SDH firmware 0.0.2.6 and newer and SDHLIBRARY-CPP 0.0.1.12 and newer. We intend to further improve this feature (e.g. store user defined grips within the %SDH) in the future, but a particular deadline a has not been determined yet. \bug With %SDH firmware > 0.0.2.6 and SDHLibrary < 0.0.1.12 GripHand() does not work (<a href="https://192.168.101.101/mechatronik/show_bug.cgi?id=575">Bug 575</a>) <br><b>=> Resolved in SDHLibrary 0.0.1.12</b> \bug With %SDH firmware < 0.0.2.6 GripHand() does not work and might yield undefined behaviour there <br><b>=> Resolved in %SDH firmware 0.0.2.6</b> \bug Currently the performing of a skill or grip with GripHand() can \b NOT be interrupted!!! Even if the command is sent with \a sequ=false it \b cannot be stoped or emergency stopped. \param grip - The index of the grip to perform [0..eGID_DIMENSION-1] (s.a. eGraspId) \param close - close-ratio: [0.0 .. 1.0] where 0.0 is 'fully opened' and 1.0 is 'fully closed' \param velocity - maximum allowed angular axis velocity in the chosen external unit system #uc_angular_velocity \param sequ - flag: if true (default) then the function executes sequentially and returns not until after the %SDH has finished the movement. If false then the function returns immediately after the movement command has been sent to the %SDH. - The \a close and \a velocity values are checked if they are in their allowed range. - If \b any value is invalid then \b no grip is perfomed, instead a #SDH::cSDHErrorInvalidParameter* exception is thrown. \return The expected/elapsed execution time for the movement in the configured time unit system #uc_time. \remark - Currently the actual movement velocity of an axis is determined by the %SDH firmware to make the movements of all involved axes start and end synchronously at the same time. Therefore the axis that needs the longest time for its movement at its given maximum velocity determines the velocities of all the other axes. - The currently set target axis angles are not changed by this command - The movement uses the eMotorCurrentMode motor current modes "eMCM_GRIP" while gripping and then changes the motor current mode to "eMCM_HOLD". After the movement previously set motor currents set for mode "eMCM_MOVE" are \b overwritten! \par Examples: \code // Assuming 'hand' is a cSDH object ... // Perform a fully opened centrical grip at 50°/s: hand.GripHand( hand.eGID_CENTRICAL, 0.0, 50.0, true ); // Now close it 50% with 30°/s: hand.GripHand( hand.eGID_CENTRICAL, 0.5, 30.0, true ); // Then close it completely with 20°/s: hand.GripHand( hand.eGID_CENTRICAL, 1.0, 20.0, true ); \endcode <hr> */ double GripHand( eGraspId grip, double close, double velocity, bool sequ=true ) throw (cSDHLibraryException*); // end of doxygen name group sdhlibrary_cpp_sdh_h_csdh_grip //! @} //##################################################################### private: /*! * Update settings like min/max velocities and accelerations from the connected %SDH */ void UpdateSettingsFromSDH(); /*! * Adjust the limits for the velocity and acceleration according to the controller type. * * - in pose controller the velocities and accelerations are always positive and thus the minimum is 0.0 * - in velocity based controllers the velocities and accelerations can be positive or negative and thus the minimum is -maximum */ void AdjustLimits( cSDHBase::eControllerType controller ); //! string containing the %SDH firmware release of the attaced %SDH (something like "0.0.2.7") std::string release_firmware; //! cached value of the axis controller type eControllerType controller_type; // unimplemented from SAH: // def GetFingerTipFT( int iFinger,double* pafFTData); // def GetFingerEnableState( int iFinger, int* piEnableState); // def GetCommandedValues( int iFinger, double* pafAngle,double* pafVelocity); // def GetHandConfig( int* piConfig); // def GetFingerLimitsStatus( int iPort,int iFinger,int* paiLimitStatus); // def ClearTorqueSensorOffset( int iPort,int iFinger); // def SetStiffnessFactor( int iFinger, double* pafStiffnessFactor); }; // end of class cSDH //##################################################################### NAMESPACE_SDH_END #endif //====================================================================== /* Here are some settings for the emacs/xemacs editor (and can be safely ignored) (e.g. to explicitely set C++ mode for *.h header files) Local Variables: mode:C++ mode:ELSE End: */ //======================================================================]
[ "[email protected]", "wmb@cob3-2-pc1.(none)" ]
[ [ [ 1, 10 ], [ 12, 22 ], [ 24, 24 ], [ 26, 34 ], [ 37, 46 ], [ 48, 52 ], [ 64, 80 ], [ 83, 84 ], [ 88, 113 ], [ 115, 120 ], [ 122, 160 ], [ 162, 180 ], [ 182, 354 ], [ 356, 399 ], [ 401, 494 ], [ 498, 521 ], [ 523, 570 ], [ 573, 575 ], [ 577, 656 ], [ 658, 774 ], [ 776, 810 ], [ 812, 813 ], [ 815, 833 ], [ 844, 859 ], [ 861, 862 ], [ 872, 891 ], [ 893, 904 ], [ 906, 938 ], [ 940, 944 ], [ 946, 948 ], [ 953, 963 ], [ 968, 971 ], [ 973, 976 ], [ 978, 985 ], [ 988, 1002 ], [ 1004, 1007 ], [ 1009, 1015 ], [ 1018, 1034 ], [ 1067, 1068 ], [ 1103, 1104 ], [ 1106, 1107 ], [ 1109, 1138 ], [ 1140, 1159 ], [ 1161, 1162 ], [ 1164, 1165 ], [ 1167, 1188 ], [ 1190, 1191 ], [ 1193, 1194 ], [ 1204, 1225 ], [ 1251, 1258 ], [ 1261, 1262 ], [ 1270, 1273 ], [ 1275, 1278 ], [ 1287, 1287 ], [ 1297, 1298 ], [ 1301, 1303 ], [ 1305, 1328 ], [ 1330, 1357 ], [ 1359, 1366 ], [ 1368, 1387 ], [ 1389, 1454 ], [ 1456, 1496 ], [ 1498, 1520 ], [ 1522, 1538 ], [ 1540, 1618 ], [ 1620, 1679 ], [ 1681, 1755 ], [ 1767, 1768 ], [ 1770, 1772 ], [ 1775, 1785 ], [ 1787, 1811 ], [ 1854, 1877 ], [ 1879, 1899 ], [ 1901, 1966 ], [ 1968, 2029 ], [ 2031, 2092 ], [ 2104, 2124 ], [ 2126, 2189 ], [ 2191, 2252 ], [ 2254, 2311 ], [ 2375, 2385 ], [ 2387, 2392 ], [ 2394, 2409 ], [ 2411, 2433 ], [ 2505, 2508 ], [ 2518, 2538 ], [ 2540, 2552 ], [ 2560, 2572 ], [ 2576, 2579 ], [ 2582, 2603 ], [ 2605, 2629 ], [ 2631, 2633 ], [ 2635, 2642 ], [ 2644, 2666 ], [ 2668, 2735 ], [ 2737, 2802 ], [ 2808, 2808 ], [ 2812, 2835 ], [ 2838, 2839 ], [ 2842, 2847 ], [ 2850, 2854 ], [ 2857, 2878 ], [ 2880, 2904 ], [ 2906, 2908 ], [ 2910, 2916 ], [ 2918, 2923 ], [ 2926, 2951 ], [ 2953, 2954 ], [ 2956, 2969 ], [ 2971, 3043 ], [ 3053, 3054 ], [ 3056, 3063 ], [ 3065, 3080 ], [ 3082, 3090 ], [ 3092, 3108 ], [ 3110, 3186 ], [ 3188, 3250 ], [ 3252, 3266 ], [ 3268, 3322 ], [ 3324, 3374 ], [ 3376, 3625 ], [ 3627, 3628 ], [ 3630, 3643 ], [ 3645, 3705 ], [ 3714, 3736 ], [ 3746, 3758 ], [ 3760, 3767 ], [ 3769, 3797 ], [ 3817, 3820 ], [ 3822, 3823 ], [ 3825, 3836 ], [ 3838, 3871 ], [ 3889, 3889 ], [ 3892, 3925 ] ], [ [ 11, 11 ], [ 23, 23 ], [ 25, 25 ], [ 35, 36 ], [ 47, 47 ], [ 53, 63 ], [ 81, 82 ], [ 85, 87 ], [ 114, 114 ], [ 121, 121 ], [ 161, 161 ], [ 181, 181 ], [ 355, 355 ], [ 400, 400 ], [ 495, 497 ], [ 522, 522 ], [ 571, 572 ], [ 576, 576 ], [ 657, 657 ], [ 775, 775 ], [ 811, 811 ], [ 814, 814 ], [ 834, 843 ], [ 860, 860 ], [ 863, 871 ], [ 892, 892 ], [ 905, 905 ], [ 939, 939 ], [ 945, 945 ], [ 949, 952 ], [ 964, 967 ], [ 972, 972 ], [ 977, 977 ], [ 986, 987 ], [ 1003, 1003 ], [ 1008, 1008 ], [ 1016, 1017 ], [ 1035, 1066 ], [ 1069, 1102 ], [ 1105, 1105 ], [ 1108, 1108 ], [ 1139, 1139 ], [ 1160, 1160 ], [ 1163, 1163 ], [ 1166, 1166 ], [ 1189, 1189 ], [ 1192, 1192 ], [ 1195, 1203 ], [ 1226, 1250 ], [ 1259, 1260 ], [ 1263, 1269 ], [ 1274, 1274 ], [ 1279, 1286 ], [ 1288, 1296 ], [ 1299, 1300 ], [ 1304, 1304 ], [ 1329, 1329 ], [ 1358, 1358 ], [ 1367, 1367 ], [ 1388, 1388 ], [ 1455, 1455 ], [ 1497, 1497 ], [ 1521, 1521 ], [ 1539, 1539 ], [ 1619, 1619 ], [ 1680, 1680 ], [ 1756, 1766 ], [ 1769, 1769 ], [ 1773, 1774 ], [ 1786, 1786 ], [ 1812, 1853 ], [ 1878, 1878 ], [ 1900, 1900 ], [ 1967, 1967 ], [ 2030, 2030 ], [ 2093, 2103 ], [ 2125, 2125 ], [ 2190, 2190 ], [ 2253, 2253 ], [ 2312, 2374 ], [ 2386, 2386 ], [ 2393, 2393 ], [ 2410, 2410 ], [ 2434, 2504 ], [ 2509, 2517 ], [ 2539, 2539 ], [ 2553, 2559 ], [ 2573, 2575 ], [ 2580, 2581 ], [ 2604, 2604 ], [ 2630, 2630 ], [ 2634, 2634 ], [ 2643, 2643 ], [ 2667, 2667 ], [ 2736, 2736 ], [ 2803, 2807 ], [ 2809, 2811 ], [ 2836, 2837 ], [ 2840, 2841 ], [ 2848, 2849 ], [ 2855, 2856 ], [ 2879, 2879 ], [ 2905, 2905 ], [ 2909, 2909 ], [ 2917, 2917 ], [ 2924, 2925 ], [ 2952, 2952 ], [ 2955, 2955 ], [ 2970, 2970 ], [ 3044, 3052 ], [ 3055, 3055 ], [ 3064, 3064 ], [ 3081, 3081 ], [ 3091, 3091 ], [ 3109, 3109 ], [ 3187, 3187 ], [ 3251, 3251 ], [ 3267, 3267 ], [ 3323, 3323 ], [ 3375, 3375 ], [ 3626, 3626 ], [ 3629, 3629 ], [ 3644, 3644 ], [ 3706, 3713 ], [ 3737, 3745 ], [ 3759, 3759 ], [ 3768, 3768 ], [ 3798, 3816 ], [ 3821, 3821 ], [ 3824, 3824 ], [ 3837, 3837 ], [ 3872, 3888 ], [ 3890, 3891 ] ] ]
5fd966846d1e1f5d82026adba5941a11fb25044e
b1c7510cfc5d90397bf9aef111cf9906dc278251
/src/XmlParser.hpp
e1b381d015a7e92c03eb395be872e855d6b1ca1e
[]
no_license
mkb218/fs1rgen
f50482b5938a08ec7e8a2ad835d333ad069ae4cb
0747041b967b8807bbdc11e4d4846ad85162df33
refs/heads/master
2020-04-01T13:19:56.509972
2010-01-24T04:48:28
2010-01-24T04:48:28
210,589
2
0
null
null
null
null
UTF-8
C++
false
false
487
hpp
#ifndef FS1RGEN_XMLPARSE #define FS1RGEN_XMLPARSE #include <string> #include <memory> #include "params.h" using namespace std; namespace fs1rgen { class XmlParser { public: virtual void parse(const char *rawData, size_t bufSize) throw (exception) = 0; virtual void parse(const std::string & rawData) throw (exception) = 0; virtual auto_ptr<Model> getModel(); // constructs copy of model, caller owns private: Model m_model; }; } #endif
[ [ [ 1, 6 ], [ 8, 22 ] ], [ [ 7, 7 ] ] ]
ba5248cea80671aa80b392012d9be401a9b6322d
b8ac0bb1d1731d074b7a3cbebccc283529b750d4
/Code/controllers/Tcleaner/behaviours/FocusGarbage.h
b3bd5547fb4893901b56fe97d4fbf6e94191ad20
[]
no_license
dh-04/tpf-robotica
5efbac38d59fda0271ac4639ea7b3b4129c28d82
10a7f4113d5a38dc0568996edebba91f672786e9
refs/heads/master
2022-12-10T18:19:22.428435
2010-11-05T02:42:29
2010-11-05T02:42:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
602
h
#ifndef behaviours_FocusGarbage_h #define behaviours_FocusGarbage_h #include "AbstractBehaviour.h" #include <utils/GarbageRecognition.h> namespace behaviours { class FocusGarbage : public AbstractBehaviour { public: FocusGarbage(utils::GarbageRecognition * gr, robotapi::IDifferentialWheels * wheels ); ~FocusGarbage(); void sense(); void action(); private: utils::GarbageRecognition * gr; robotapi::IDifferentialWheels * wheels; utils::Garbage * currentGarbage; }; } /* End of namespace behaviours */ #endif // behaviours_FocusGarbage_h
[ "guicamest@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a" ]
[ [ [ 1, 28 ] ] ]
c7e33349707f04e37e9bdc3a792e448eb486a29f
dd342b8ce610320c3e67030452a555fe0b020257
/csc3406/camera.cpp
f6ac9b77745579571e2fcf84b258cbdbf6903a0d
[]
no_license
Reiload/sweepandprunedemo
c92388a496cb65d0e4c5926fe2c035723f87c0c5
33601bd8a0e72698d894e8ca039433835e379dad
refs/heads/master
2021-01-15T13:44:43.330393
2008-01-07T02:56:59
2008-01-07T02:56:59
37,261,515
0
0
null
null
null
null
MacCentralEurope
C++
false
false
3,003
cpp
/* Camera.cpp Camera class implementation file Provided by Penny de Byl */ #include "camera.h" #include "glu.h" void Camera :: setShape(float vAngle, float asp, float nr, float fr) { viewAngle = vAngle; aspect = asp; nearDist = nr; farDist = fr; glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(viewAngle, aspect, nearDist, farDist); glMatrixMode(GL_MODELVIEW); } void Camera :: setModelViewMatrix(void) { // load modelview matrix with existing camera values float m[16]; Vector3 eVec(eye.GetX(), eye.GetY(), eye.GetZ()); // a vector version of eye m[0] = u.GetX(); m[4] = u.GetY(); m[8] = u.GetZ(); m[12] = -eVec.dot(u); m[1] = v.GetX(); m[5] = v.GetY(); m[9] = v.GetZ(); m[13] = -eVec.dot(v); m[2] = n.GetX(); m[6] = n.GetY(); m[10] = n.GetZ(); m[14] = -eVec.dot(n); m[3] = 0; m[7] = 0; m[11] = 0; m[15] = 1.0; glMatrixMode(GL_MODELVIEW); glLoadMatrixf(m); // load OpenGLís modelview matrix } void Camera:: set(Vector3 Eye, Vector3 look, Vector3 up) { // create a modelview matrix and send it to OpenGL eye.set(Eye); // store the given eye position n.set(eye.GetX() - look.GetX(), eye.GetY() - look.GetY(), eye.GetZ() - look.GetZ()); // make n u.set(up.cross(n).GetX(), up.cross(n).GetY(), up.cross(n).GetZ()); // make u = up X n n.normalize(); u.normalize(); // make them unit length v.set(n.cross(u).GetX(), n.cross(u).GetY(), n.cross(u).GetZ()); // make v = n X u setModelViewMatrix(); // tell OpenGL } void Camera:: slide(float delU, float delV, float delN) { eye.SetX( eye.GetX() + delU * u.GetX() + delV * v.GetX() + delN * n.GetX()); eye.SetY( eye.GetY() + delU * u.GetY() + delV * v.GetY() + delN * n.GetY()); eye.SetZ( eye.GetZ() + delU * u.GetZ() + delV * v.GetZ() + delN * n.GetZ()); setModelViewMatrix(); } void Camera:: roll(float angle) { float cs=cos(PI/180.0 * angle); float sn=sin(PI/180.0 * angle); Vector3 t = u; u.set(cs*t.GetX() - sn*v.GetX(), cs*t.GetY() - sn*v.GetY(), cs*t.GetZ() - sn*v.GetZ()); v.set(sn*t.GetX() + cs*v.GetX(), sn*t.GetY() + cs*v.GetY(), sn*t.GetZ() + cs*v.GetZ()); setModelViewMatrix(); } void Camera :: pitch (float angle) { // pitch the camera through angle degrees around U float cs = cos(3.14159265/180 * angle); float sn = sin(3.14159265/180 * angle); Vector3 t(v); // remember old v v.set(cs*t.GetX() - sn*n.GetX(), cs*t.GetY() - sn*n.GetY(), cs*t.GetZ() - sn*n.GetZ()); n.set(sn*t.GetX() + cs*n.GetX(), sn*t.GetY() + cs*n.GetY(), sn*t.GetZ() + cs*n.GetZ()); setModelViewMatrix(); } void Camera :: yaw (float angle) { // yaw the camera through angle degrees around V float cs = cos(3.14159265/180 * angle); float sn = sin(3.14159265/180 * angle); Vector3 t(n); // remember old v n.set(cs*t.GetX() - sn*u.GetX(), cs*t.GetY() - sn*u.GetY(), cs*t.GetZ() - sn*u.GetZ()); u.set(sn*t.GetX() + cs*u.GetX(), sn*t.GetY() + cs*u.GetY(), sn*t.GetZ() + cs*u.GetZ()); setModelViewMatrix(); }
[ "bengilbert6000@428ec822-853d-0410-babd-6388d199fcd1" ]
[ [ [ 1, 79 ] ] ]
ec7fb0641a94a8cf841e0c8b80c45bb0f434b903
5095bbe94f3af8dc3b14a331519cfee887f4c07e
/apsim/Plant/source/Root/RootBase.h
7ad425018d141342635e04c00907223b849091a8
[]
no_license
sativa/apsim_development
efc2b584459b43c89e841abf93830db8d523b07a
a90ffef3b4ed8a7d0cce1c169c65364be6e93797
refs/heads/master
2020-12-24T06:53:59.364336
2008-09-17T05:31:07
2008-09-17T05:31:07
64,154,433
0
0
null
null
null
null
UTF-8
C++
false
false
3,270
h
#ifndef RootBaseH #define RootBaseH #include "../SimplePart.h" class RootBase : public SimplePart { public: RootBase(ScienceAPI& scienceAPI, plantInterface *p, const string &name); ~RootBase(){}; virtual void zeroAllGlobals(void){}; virtual void zeroDeltas(void){}; virtual void onInit1(protocol::Component *system){}; virtual void read(){}; virtual void onSowing(void){}; virtual void onGermination(void){}; virtual void onEmergence(void){}; virtual void onFlowering(void){}; virtual void onStartGrainFill(void){}; virtual void onHarvest(float height, float remove_fr, vector<string> &dm_type, vector<float> &dlt_crop_dm, vector<float> &dlt_dm_n, vector<float> &dlt_dm_p, vector<float> &fraction_to_residue){}; virtual void onEndCrop(vector<string> &dm_type, vector<float> &dlt_crop_dm, vector<float> &dlt_dm_n, vector<float> &dlt_dm_p, vector<float> &fraction_to_residue){}; virtual void onKillStem(void){}; virtual void update(){}; virtual void updateOthers(){}; virtual void checkBounds(void){}; virtual void removeBiomass2(float chop_fr){}; virtual void sen_length(void){}; virtual void root_length_growth (void){}; virtual void plant_root_depth (void){}; virtual void collectDetachedForResidue(vector<string> &part_name , vector<float> &dm_residue , vector<float> &dm_n , vector<float> &dm_p , vector<float> &fract){}; virtual void doNConccentrationLimits(float){}; virtual void redistribute(const vector<float> &, const vector<float> &, float){}; // virtual int find_layer_no(float) {}; // virtual int find_layer_no(float,const vector<float>&){}; // virtual int find_layer_no(float, float *, int){}; virtual float sw_avail_ratio(int layer) {return 0;}; virtual void doPlantWaterStress (float sw_demand, SWStress *swStress) {}; virtual void doWaterUptakeInternal(float sw_demand){}; virtual float waterUptake(void){return 0;}; virtual void getOtherVariables(){}; virtual void UpdateOtherVariables(){}; virtual float wet_root_fr (void){return 0;}; virtual void onNewProfile(protocol::NewProfileType &v){}; virtual void write(){}; virtual void plant_nit_supply(){}; virtual void doNUptake(float sumNMax, float sumSoilNDemand, float NDemand, float n_fix_pot){}; virtual void doWaterUptake (int option, float SWDemand){}; virtual float peswTotal(){return 0;}; virtual float pesw(int depth){return 0;}; virtual float swSupply(){return 0.0;}; virtual float swAvailable(){return 0.0;}; virtual float swAvailablePotential(){return 0.0;}; virtual float nUptake(){return 0;}; virtual float fasw(int depth){return 0;}; }; #endif /* RootBaseH */
[ "hut104@8bb03f63-af10-0410-889a-a89e84ef1bc8", "har297@8bb03f63-af10-0410-889a-a89e84ef1bc8", "devoilp@8bb03f63-af10-0410-889a-a89e84ef1bc8", "hol353@8bb03f63-af10-0410-889a-a89e84ef1bc8" ]
[ [ [ 1, 2 ], [ 4, 4 ], [ 6, 49 ], [ 51, 51 ], [ 53, 54 ], [ 57, 59 ], [ 62, 63 ], [ 65, 65 ], [ 74, 79 ] ], [ [ 3, 3 ], [ 5, 5 ], [ 50, 50 ], [ 52, 52 ], [ 55, 56 ], [ 60, 60 ], [ 66, 73 ] ], [ [ 61, 61 ] ], [ [ 64, 64 ] ] ]
aadd73ef298a9a647719e17668458e8ab7ba62fe
b505ef7eb1a6c58ebcb73267eaa1bad60efb1cb2
/source/sound/soundobjectpcmstream.cpp
771f11305f167c45917ba7b76cdcf889d3681a87
[]
no_license
roxygen/maid2
230319e05d6d6e2f345eda4c4d9d430fae574422
455b6b57c4e08f3678948827d074385dbc6c3f58
refs/heads/master
2021-01-23T17:19:44.876818
2010-07-02T02:43:45
2010-07-02T02:43:45
38,671,921
0
0
null
null
null
null
UTF-8
C++
false
false
6,264
cpp
 #include"soundobjectpcmstream.h" #include"../auxiliary/debug/assert.h" #include"../auxiliary/debug/warning.h" #include"../auxiliary/mathematics.h" namespace Maid { /*! @class SoundObjectPCMStream soundobjectpcmstream.h @brief ストリーム書き込みで再生するクラス */ void SoundObjectPCMStream::Initialize( const Sound::SPBUFFER& pBuffer, const SPCUSTOMPCMREADER& pDecoder, const SPMEMORYBUFFER& pData ) { m_pBuffer = pBuffer; m_pDecoder= pDecoder; m_pData = pData; m_IsLoopPlay = false; m_NowPlayPosition = 0; m_PrevBufferPosition = 0; m_WrittedBufferPosition = 0; m_DecodedSize = 0; UpdateBuffer(); } void SoundObjectPCMStream::Update() { const size_t bufferpos = m_pBuffer->GetPlayPosition(); const size_t decoderpos= m_pDecoder->GetPosition(); const size_t decoderlen= m_pDecoder->GetLength(); m_NowPlayPosition += CalcLength( m_PrevBufferPosition, bufferpos ); m_PrevBufferPosition = bufferpos; // 再生した量がデコーダーより長かったら、全部再生されたことになる if( decoderlen <= m_NowPlayPosition ) { if( m_IsLoopPlay ) { m_NowPlayPosition -= decoderlen; m_DecodedSize -= decoderlen; }else { if( m_pBuffer->IsPlay() ) { m_pBuffer->Stop(); } } } else { // そうでないならバッファの更新 if( m_NowPlayPosition <= decoderpos ) { //なんだけど、ある程度まとめてやる const size_t sa = m_DecodedSize - m_NowPlayPosition; const size_t space = CalcUpdateScape(); if( sa < space ) { UpdateBuffer(); } } /* else { // デコードした位置より先を再生していたら、その時点から再開 // ・・・したいんだけど、ここに書くと末端まで再生されたときにとまってしまう。 どうやろう? const bool play = m_pBuffer->IsPlay(); const size_t pos = m_NowPlayPosition; if( play ) { m_pBuffer->Stop(); } SetPositionByte( pos ); if( play ) { m_pBuffer->Play(true); } } */ } } void SoundObjectPCMStream::Play() { if( m_pDecoder->GetLength() <= m_NowPlayPosition ) { return; } UpdateBuffer(); m_pBuffer->Play(true); } void SoundObjectPCMStream::Stop() { m_pBuffer->Stop(); } void SoundObjectPCMStream::SetPosition( double time ) { const size_t pos = m_pBuffer->GetParam().Format.CalcLength(time); SetPositionByte( pos ); } void SoundObjectPCMStream::SetPositionByte( size_t pos ) { const size_t writeok = m_pBuffer->GetWritePosition(); m_pDecoder->SetPosition( pos ); m_DecodedSize = pos; m_WrittedBufferPosition = writeok; UpdateBuffer(); m_pBuffer->SetPosition( writeok ); m_PrevBufferPosition = writeok; m_NowPlayPosition = pos; } void SoundObjectPCMStream::SetVolume( double volume ) { // 強さから デシベルに変換する // http://e-words.jp/w/E38387E382B7E38399E383AB.html const double db = 20.0 * Math<double>::log10(volume); m_pBuffer->SetVolume(db); } void SoundObjectPCMStream::SetLoopState( bool IsLoop ) { m_IsLoopPlay = IsLoop; } bool SoundObjectPCMStream::IsPlay()const { return m_pBuffer->IsPlay(); } double SoundObjectPCMStream::GetPosition() const { /* // 末端にいる場合、カーソルは最初にあるようにしたほうがいいかな? const size_t pos = m_NowPlayPosition + CalcLength( m_PrevBufferPosition, m_pBuffer->GetPlayPosition() ); if( m_pDecoder->GetLength() <= m_NowPlayPosition ) { return 0; } */ const size_t pos = std::min( m_NowPlayPosition + CalcLength( m_PrevBufferPosition, m_pBuffer->GetPlayPosition()), m_pDecoder->GetLength() ); return m_pBuffer->GetParam().Format.CalcTime(pos); } double SoundObjectPCMStream::GetVolume() const { // デシベルから 強さに変換する // http://e-words.jp/w/E38387E382B7E38399E383AB.html const double db = m_pBuffer->GetVolume(); if( db < -100.0f ) { return 0; } // db = 20.0f * Math<float>::log10(ret); // db/20.0f = Math<float>::log10(ret); // 10 の db/20.0f 乗が ret return Math<double>::pow(10,db/20.0f); } void SoundObjectPCMStream::UpdateBuffer() { const size_t writepos = m_WrittedBufferPosition; const size_t DecodeLen = CalcUpdateScape(); { // まだ初期化してなくて、長さがない(判明してない)ときもあるので // そのときはなにもしない if( m_pDecoder->GetLength()==0 ) { return ; } } // リングバッファにデータを流すのはしんどいので // いったん作ってからやる std::vector<unt08> tmp(DecodeLen); { const size_t len = m_pDecoder->Read( &(tmp[0]), DecodeLen ); if( len<DecodeLen ) { // デコードが末端までいったら // ループ再生か否かで、バッファの接続を決める if( m_IsLoopPlay ) { m_pDecoder->SetPosition(0); m_pDecoder->Read( &(tmp[len]), DecodeLen-len ); } else { ZERO( &(tmp[len]), DecodeLen-len ); } } } // そんでもってながしこむ~ { Sound::IBuffer::LOCKDATA dat; m_pBuffer->Lock( writepos, DecodeLen, dat ); memcpy( dat.pData1, &(tmp[0]), dat.Data1Length ); if( dat.pData2!=NULL ) { memcpy( dat.pData2, &(tmp[dat.Data1Length]), dat.Data2Length ); } m_pBuffer->Unlock( dat ); } m_DecodedSize += DecodeLen; m_WrittedBufferPosition += DecodeLen; m_WrittedBufferPosition %= m_pBuffer->GetParam().Length; } size_t SoundObjectPCMStream::CalcLength( size_t prev, size_t now )const { size_t ret; if( prev<=now ) { ret = now-prev; } else { ret = m_pBuffer->GetParam().Length - (prev-now); } return ret; } size_t SoundObjectPCMStream::CalcUpdateScape()const { // 更新間隔を求める MAID_ASSERT( m_pBuffer.get()==NULL, "初期化されていません" ); return m_pBuffer->GetParam().Length / 4; } }
[ [ [ 1, 233 ] ] ]
987076b225545556c643a06f209adba581bde871
a36d7a42310a8351aa0d427fe38b4c6eece305ea
/core_billiard/SceneImp.h
46a29108fd5ca1b280f67832e55de237e374daa3
[]
no_license
newpolaris/mybilliard01
ca92888373c97606033c16c84a423de54146386a
dc3b21c63b5bfc762d6b1741b550021b347432e8
refs/heads/master
2020-04-21T06:08:04.412207
2009-09-21T15:18:27
2009-09-21T15:18:27
39,947,400
0
0
null
null
null
null
UTF-8
C++
false
false
3,212
h
#pragma once namespace my_render_imp { class SceneImp : IMPLEMENTS_INTERFACE( Scene ) { public: // from Scene virtual void setColladaFactoryBeforeLoad( ColladaFactory * factory ) OVERRIDE; virtual void setRenderFactory( RenderBufferFactory * renderFactory ) OVERRIDE; virtual bool load( wstring filename ) OVERRIDE; virtual void unload() OVERRIDE; virtual size_t getNumberOfVisualScene() OVERRIDE; virtual Node * getVisualSceneByIndex( size_t index ) OVERRIDE; virtual Node * getVisualSceneByID( wstring id ) OVERRIDE; virtual Node * getDefaultVisualScene() OVERRIDE; virtual Node * getCurrentVisualScene() OVERRIDE; virtual bool setCurrentVisualScene( Node * ) OVERRIDE; virtual size_t getNumberOfNode() OVERRIDE; virtual Node * getNodeByIndex( size_t index ) OVERRIDE; virtual Node * getNodeByID( wstring nodeID ) OVERRIDE; virtual size_t getNumberOfGeometry() OVERRIDE; virtual Geometry * getGeometryByIndex( size_t index ) OVERRIDE; virtual Geometry * getGeometryByID( wstring id ) OVERRIDE; virtual Geometry * getGeometryByName( wstring name ) OVERRIDE; virtual size_t getNumberOfCamera() OVERRIDE; virtual Camera * getCameraByIndex( size_t index ) OVERRIDE; virtual Camera * getCameraByID( wstring id ) OVERRIDE; virtual Camera * getCameraByName( wstring name ) OVERRIDE; virtual bool isUpAxisX() OVERRIDE; virtual bool isUpAxisY() OVERRIDE; virtual bool isUpAxisZ() OVERRIDE; public: SceneImp(); ~SceneImp(); private: // load bool loadUpAxis( domCOLLADARef collada ); void loadLibraryAnimations(); void loadLibraryAnimationClips(); void loadLibraryCameras(); void loadLibraryControllers(); void loadLibraryLights(); void loadLibraryGeometries(); void loadLibraryVisualScenes(); void loadLibraryScene(); void loadNodesFromVisualScene( Node * node ); private: // default void setDefaultsAfterLoad(); void addDefaultCameraWhenThereIsNoCamera(); private: // update void updateDevice(); void updateDevice_GeometryMesh( GeometryMesh * mesh ); daeElementRef idLookup( wstring id ); private: // dae file void storeFilename( wstring filename ); static wstring getFilenameOnly( wstring fullFilename ); static wstring getPathnameOnly( wstring fullFilename ); wstring filename_, pathname_; private: ColladaFactory * colladaFactory_; RenderBufferFactory * renderFactory_; DAEPtr dae_; domCOLLADARef collada_; ColladaFactoryImp defaultFactory_; RenderBufferFactoryNull nullRenderFactory_; NodeNull nullNode_; private: // runtime database typedef vector< Node * > VisualScenes; VisualScenes visualScenes_; typedef vector< Node * > Nodes; Nodes nodes_; typedef vector< Geometry * > Geometries; Geometries geometries_; typedef vector< Camera * > Cameras; Cameras cameras_; // effect // material // animation domUpAxisType upAxis_; private: Node * currentScene_; Camera * currentCamera_; MY_UNIT_TEST_BACKDOOR; }; }
[ "wrice127@af801a76-7f76-11de-8b9f-9be6f49bd635" ]
[ [ [ 1, 111 ] ] ]
d64d6ab5a88f27c29ba8ccc6c352c81fd8d1908e
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Depend/Foundation/Intersection/Wm4IntrLine2Box2.h
43bde8a0e5ecceb42083cd607ae1c88e1dbc6677
[]
no_license
daleaddink/flagship3d
4835c223fe1b6429c12e325770c14679c42ae3c6
6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a
refs/heads/master
2021-01-15T16:29:12.196094
2009-11-01T10:18:11
2009-11-01T10:18:11
37,734,654
1
0
null
null
null
null
UTF-8
C++
false
false
2,047
h
// Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // The Wild Magic Version 4 Foundation Library source code is supplied // under the terms of the license agreement // http://www.geometrictools.com/License/Wm4FoundationLicense.pdf // and may not be copied or disclosed except in accordance with the terms // of that agreement. #ifndef WM4INTRLINE2BOX2_H #define WM4INTRLINE2BOX2_H #include "Wm4FoundationLIB.h" #include "Wm4Intersector.h" #include "Wm4Line2.h" #include "Wm4Box2.h" namespace Wm4 { template <class Real> class WM4_FOUNDATION_ITEM IntrLine2Box2 : public Intersector<Real,Vector2<Real> > { public: IntrLine2Box2 (const Line2<Real>& rkLine, const Box2<Real>& rkBox); // object access const Line2<Real>& GetLine () const; const Box2<Real>& GetBox () const; // static intersection queries virtual bool Test (); virtual bool Find (); // the intersection set int GetQuantity () const; const Vector2<Real>& GetPoint (int i) const; private: using Intersector<Real,Vector2<Real> >::IT_EMPTY; using Intersector<Real,Vector2<Real> >::IT_POINT; using Intersector<Real,Vector2<Real> >::IT_SEGMENT; using Intersector<Real,Vector2<Real> >::m_iIntersectionType; static bool Clip (Real fDenom, Real fNumer, Real& rfT0, Real& rfT1); // the objects to intersect const Line2<Real>& m_rkLine; const Box2<Real>& m_rkBox; // information about the intersection set int m_iQuantity; Vector2<Real> m_akPoint[2]; // internal use (shared by IntrRay2Box2 and IntrSegment2Box2) public: static bool DoClipping (Real fT0, Real fT1, const Vector2<Real>& rkOrigin, const Vector2<Real>& rkDirection, const Box2<Real>& rkBox, bool bSolid, int& riQuantity, Vector2<Real> akPoint[2], int& riIntrType); }; typedef IntrLine2Box2<float> IntrLine2Box2f; typedef IntrLine2Box2<double> IntrLine2Box2d; } #endif
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 70 ] ] ]
2d750916cfbae9b7af39a18d904b327f2ac3cb20
d54d8b1bbc9575f3c96853e0c67f17c1ad7ab546
/hlsdk-2.3-p3/multiplayer/ricochet/dlls/animation.cpp
91998d043cb30eb0065046af5ab7e63c2a88f33c
[]
no_license
joropito/amxxgroup
637ee71e250ffd6a7e628f77893caef4c4b1af0a
f948042ee63ebac6ad0332f8a77393322157fa8f
refs/heads/master
2021-01-10T09:21:31.449489
2010-04-11T21:34:27
2010-04-11T21:34:27
47,087,485
1
0
null
null
null
null
UTF-8
C++
false
false
13,291
cpp
/*** * * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting * object code is restricted to non-commercial enhancements to products from * Valve LLC. All other use, distribution, or modification is prohibited * without written permission from Valve LLC. * ****/ #include <stdio.h> #include <stdlib.h> #include <string.h> typedef bool BOOL; // hack into header files that we can ship typedef int qboolean; typedef unsigned char byte; #include "../utils/common/mathlib.h" #include "const.h" #include "progdefs.h" #include "edict.h" #include "eiface.h" #include "studio.h" #include "../engine/studio.h" #ifndef ACTIVITY_H #include "activity.h" #endif #include "activitymap.h" #ifndef ANIMATION_H #include "animation.h" #endif #ifndef SCRIPTEVENT_H #include "scriptevent.h" #endif #ifndef ENGINECALLBACK_H #include "enginecallback.h" #endif extern globalvars_t *gpGlobals; #pragma warning( disable : 4244 ) int ExtractBbox( void *pmodel, int sequence, float *mins, float *maxs ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return 0; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex); mins[0] = pseqdesc[ sequence ].bbmin[0]; mins[1] = pseqdesc[ sequence ].bbmin[1]; mins[2] = pseqdesc[ sequence ].bbmin[2]; maxs[0] = pseqdesc[ sequence ].bbmax[0]; maxs[1] = pseqdesc[ sequence ].bbmax[1]; maxs[2] = pseqdesc[ sequence ].bbmax[2]; return 1; } int LookupActivity( void *pmodel, entvars_t *pev, int activity ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return 0; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex); int weighttotal = 0; int seq = ACTIVITY_NOT_AVAILABLE; for (int i = 0; i < pstudiohdr->numseq; i++) { if (pseqdesc[i].activity == activity) { weighttotal += pseqdesc[i].actweight; if (!weighttotal || RANDOM_LONG(0,weighttotal-1) < pseqdesc[i].actweight) seq = i; } } return seq; } int LookupActivityHeaviest( void *pmodel, entvars_t *pev, int activity ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if ( !pstudiohdr ) return 0; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex); int weight = 0; int seq = ACTIVITY_NOT_AVAILABLE; for (int i = 0; i < pstudiohdr->numseq; i++) { if (pseqdesc[i].activity == activity) { if ( pseqdesc[i].actweight > weight ) { weight = pseqdesc[i].actweight; seq = i; } } } return seq; } void GetEyePosition ( void *pmodel, float *vecEyePosition ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if ( !pstudiohdr ) { ALERT ( at_console, "GetEyePosition() Can't get pstudiohdr ptr!\n" ); return; } VectorCopy ( pstudiohdr->eyeposition, vecEyePosition ); } int LookupSequence( void *pmodel, const char *label ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return 0; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex); for (int i = 0; i < pstudiohdr->numseq; i++) { if (stricmp( pseqdesc[i].label, label ) == 0) return i; } return -1; } int IsSoundEvent( int eventNumber ) { if ( eventNumber == SCRIPT_EVENT_SOUND || eventNumber == SCRIPT_EVENT_SOUND_VOICE ) return 1; return 0; } void SequencePrecache( void *pmodel, const char *pSequenceName ) { int index = LookupSequence( pmodel, pSequenceName ); if ( index >= 0 ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if ( !pstudiohdr || index >= pstudiohdr->numseq ) return; mstudioseqdesc_t *pseqdesc; mstudioevent_t *pevent; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + index; pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex); for (int i = 0; i < pseqdesc->numevents; i++) { // Don't send client-side events to the server AI if ( pevent[i].event >= EVENT_CLIENT ) continue; // UNDONE: Add a callback to check to see if a sound is precached yet and don't allocate a copy // of it's name if it is. if ( IsSoundEvent( pevent[i].event ) ) { if ( !strlen(pevent[i].options) ) { ALERT( at_error, "Bad sound event %d in sequence %s :: %s (sound is \"%s\")\n", pevent[i].event, pstudiohdr->name, pSequenceName, pevent[i].options ); } PRECACHE_SOUND( (char *)(gpGlobals->pStringBase + ALLOC_STRING(pevent[i].options) ) ); } } } } void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *pflGroundSpeed ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return; mstudioseqdesc_t *pseqdesc; if (pev->sequence >= pstudiohdr->numseq) { *pflFrameRate = 0.0; *pflGroundSpeed = 0.0; return; } pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; if (pseqdesc->numframes > 1) { *pflFrameRate = 256 * pseqdesc->fps / (pseqdesc->numframes - 1); *pflGroundSpeed = sqrt( pseqdesc->linearmovement[0]*pseqdesc->linearmovement[0]+ pseqdesc->linearmovement[1]*pseqdesc->linearmovement[1]+ pseqdesc->linearmovement[2]*pseqdesc->linearmovement[2] ); *pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1); } else { *pflFrameRate = 256.0; *pflGroundSpeed = 0.0; } } int GetSequenceFlags( void *pmodel, entvars_t *pev ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if ( !pstudiohdr || pev->sequence >= pstudiohdr->numseq ) return 0; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; return pseqdesc->flags; } int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEvent, float flStart, float flEnd, int index ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if ( !pstudiohdr || pev->sequence >= pstudiohdr->numseq || !pMonsterEvent ) return 0; int events = 0; mstudioseqdesc_t *pseqdesc; mstudioevent_t *pevent; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex); if (pseqdesc->numevents == 0 || index > pseqdesc->numevents ) return 0; if (pseqdesc->numframes > 1) { flStart *= (pseqdesc->numframes - 1) / 256.0; flEnd *= (pseqdesc->numframes - 1) / 256.0; } else { flStart = 0; flEnd = 1.0; } for (; index < pseqdesc->numevents; index++) { // Don't send client-side events to the server AI if ( pevent[index].event >= EVENT_CLIENT ) continue; if ( (pevent[index].frame >= flStart && pevent[index].frame < flEnd) || ((pseqdesc->flags & STUDIO_LOOPING) && flEnd >= pseqdesc->numframes - 1 && pevent[index].frame < flEnd - pseqdesc->numframes + 1) ) { pMonsterEvent->event = pevent[index].event; pMonsterEvent->options = pevent[index].options; return index + 1; } } return 0; } float SetController( void *pmodel, entvars_t *pev, int iController, float flValue ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return flValue; mstudiobonecontroller_t *pbonecontroller = (mstudiobonecontroller_t *)((byte *)pstudiohdr + pstudiohdr->bonecontrollerindex); // find first controller that matches the index for (int i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++) { if (pbonecontroller->index == iController) break; } if (i >= pstudiohdr->numbonecontrollers) return flValue; // wrap 0..360 if it's a rotational controller if (pbonecontroller->type & (STUDIO_XR | STUDIO_YR | STUDIO_ZR)) { // ugly hack, invert value if end < start if (pbonecontroller->end < pbonecontroller->start) flValue = -flValue; // does the controller not wrap? if (pbonecontroller->start + 359.0 >= pbonecontroller->end) { if (flValue > ((pbonecontroller->start + pbonecontroller->end) / 2.0) + 180) flValue = flValue - 360; if (flValue < ((pbonecontroller->start + pbonecontroller->end) / 2.0) - 180) flValue = flValue + 360; } else { if (flValue > 360) flValue = flValue - (int)(flValue / 360.0) * 360.0; else if (flValue < 0) flValue = flValue + (int)((flValue / -360.0) + 1) * 360.0; } } int setting = 255 * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start); if (setting < 0) setting = 0; if (setting > 255) setting = 255; pev->controller[iController] = setting; return setting * (1.0 / 255.0) * (pbonecontroller->end - pbonecontroller->start) + pbonecontroller->start; } float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return flValue; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence; if (pseqdesc->blendtype[iBlender] == 0) return flValue; if (pseqdesc->blendtype[iBlender] & (STUDIO_XR | STUDIO_YR | STUDIO_ZR)) { // ugly hack, invert value if end < start if (pseqdesc->blendend[iBlender] < pseqdesc->blendstart[iBlender]) flValue = -flValue; // does the controller not wrap? if (pseqdesc->blendstart[iBlender] + 359.0 >= pseqdesc->blendend[iBlender]) { if (flValue > ((pseqdesc->blendstart[iBlender] + pseqdesc->blendend[iBlender]) / 2.0) + 180) flValue = flValue - 360; if (flValue < ((pseqdesc->blendstart[iBlender] + pseqdesc->blendend[iBlender]) / 2.0) - 180) flValue = flValue + 360; } } int setting = 255 * (flValue - pseqdesc->blendstart[iBlender]) / (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender]); if (setting < 0) setting = 0; if (setting > 255) setting = 255; pev->blending[iBlender] = setting; return setting * (1.0 / 255.0) * (pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender]) + pseqdesc->blendstart[iBlender]; } int FindTransition( void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return iGoalAnim; mstudioseqdesc_t *pseqdesc; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex); // bail if we're going to or from a node 0 if (pseqdesc[iEndingAnim].entrynode == 0 || pseqdesc[iGoalAnim].entrynode == 0) { return iGoalAnim; } int iEndNode; // ALERT( at_console, "from %d to %d: ", pEndNode->iEndNode, pGoalNode->iStartNode ); if (*piDir > 0) { iEndNode = pseqdesc[iEndingAnim].exitnode; } else { iEndNode = pseqdesc[iEndingAnim].entrynode; } if (iEndNode == pseqdesc[iGoalAnim].entrynode) { *piDir = 1; return iGoalAnim; } byte *pTransition = ((byte *)pstudiohdr + pstudiohdr->transitionindex); int iInternNode = pTransition[(iEndNode-1)*pstudiohdr->numtransitions + (pseqdesc[iGoalAnim].entrynode-1)]; if (iInternNode == 0) return iGoalAnim; int i; // look for someone going for (i = 0; i < pstudiohdr->numseq; i++) { if (pseqdesc[i].entrynode == iEndNode && pseqdesc[i].exitnode == iInternNode) { *piDir = 1; return i; } if (pseqdesc[i].nodeflags) { if (pseqdesc[i].exitnode == iEndNode && pseqdesc[i].entrynode == iInternNode) { *piDir = -1; return i; } } } ALERT( at_console, "error in transition graph" ); return iGoalAnim; } void SetBodygroup( void *pmodel, entvars_t *pev, int iGroup, int iValue ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return; if (iGroup > pstudiohdr->numbodyparts) return; mstudiobodyparts_t *pbodypart = (mstudiobodyparts_t *)((byte *)pstudiohdr + pstudiohdr->bodypartindex) + iGroup; if (iValue >= pbodypart->nummodels) return; int iCurrent = (pev->body / pbodypart->base) % pbodypart->nummodels; pev->body = (pev->body - (iCurrent * pbodypart->base) + (iValue * pbodypart->base)); } int GetBodygroup( void *pmodel, entvars_t *pev, int iGroup ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if (! pstudiohdr) return 0; if (iGroup > pstudiohdr->numbodyparts) return 0; mstudiobodyparts_t *pbodypart = (mstudiobodyparts_t *)((byte *)pstudiohdr + pstudiohdr->bodypartindex) + iGroup; if (pbodypart->nummodels <= 1) return 0; int iCurrent = (pev->body / pbodypart->base) % pbodypart->nummodels; return iCurrent; }
[ "joropito@23c7d628-c96c-11de-a380-73d83ba7c083" ]
[ [ [ 1, 525 ] ] ]
755154a7fed4c8553f2fea6a83bb8558a0e12870
dbe1ad8c1ae77e80c1f0d613c70334bf911d2f5f
/apps/workshop/Binnedflocking/src/Particle.h
5d68d220601728efb726e905b8ac34a311b2ddd7
[]
no_license
levky/OF
b239f2337ecdadc2ef72058f7cc6e206167e78f2
49acda22ecb8ff2e4e2cf198d7f494c562ab2e89
refs/heads/master
2020-05-15T18:28:12.238925
2011-09-15T10:15:57
2011-09-15T10:16:01
1,170,485
2
1
null
null
null
null
UTF-8
C++
false
false
1,086
h
#pragma once #include "ofGraphics.h" class Particle { public: float x, y; float xv, yv; float xf, yf; Particle(float _x = 0, float _y = 0, float _xv = 0, float _yv = 0) : x(_x), y(_y), xv(_xv), yv(_yv) { } void updatePosition(float timeStep) { // f = ma, m = 1, f = a, v = int(a) xv += xf; yv += yf; x += xv * timeStep; y += yv * timeStep; } void resetForce() { xf = 0; yf = 0; } void bounceOffWalls(float left, float top, float right, float bottom, float damping = .3) { bool collision = false; if (x > right){ x = right; xv *= -1; collision = true; } else if (x < left){ x = left; xv *= -1; collision = true; } if (y > bottom){ y = bottom; yv *= -1; collision = true; } else if (y < top){ y = top; yv *= -1; collision = true; } if (collision == true){ xv *= damping; yv *= damping; } } void addDampingForce(float damping = .01) { xf = xf - xv * damping; yf = yf - yv * damping; } void draw() { glVertex2f(x, y); } };
[ [ [ 1, 61 ] ] ]
afe1c9ad7dc54b17ad6ec0344f4577789c8950cc
f77f105963cd6447d0f392b9ee7d923315a82ac6
/Box2DandOgre/source/HoltStateInAir.cpp
19ac8236965d16cface25aab4032e4e583b70fde
[]
no_license
GKimGames/parkerandholt
8bb2b481aff14cf70a7a769974bc2bb683d74783
544f7afa462c5a25c044445ca9ead49244c95d3c
refs/heads/master
2016-08-07T21:03:32.167272
2010-08-26T03:01:35
2010-08-26T03:01:35
32,834,451
0
0
null
null
null
null
UTF-8
C++
false
false
5,707
cpp
/*============================================================================= HoltStateInAir.cpp State for Holt on the ground. =============================================================================*/ #include "HoltStateInAir.h" #include "HoltStateOnGround.h" #include "Holt.h" #include "Message.h" #include "TinyXMLHelper.h" #include "XMLQuickVars.h" //============================================================================= // Constructor // HoltStateInAir::HoltStateInAir( CharacterHolt* holt, FSMStateMachine<CharacterHolt>* stateMachine): HoltState(holt,stateMachine) { direction_ = Ogre::Vector3(0,0,1); } //============================================================================= // Enter // void HoltStateInAir::Enter() { if(driver_->onGroundState_->isJumping_) { jumpTimer_ = 0.0; } if(driver_->onGroundState_->isJumping_) { driver_->animationBlender_->Blend("jump_idle", AnimationBlender::BlendThenAnimate, 1.0, true); } else { driver_->animationBlender_->Blend("jump_idle", AnimationBlender::BlendWhileAnimating, 0.3, true); } wallJumpedLeft_ = false; justWallJumped_ = false; wallJumpTimer_ = -1.0; wallJumpBetweenTimer_ = -1.0; mySwitch = true; } //============================================================================= // Update // bool HoltStateInAir::Update() { double timeSinceLastFrame = GAMEFRAMEWORK->GetTimeSinceLastFrame(); if(driver_->moveLeft_) { MoveLeft(); } if(driver_->moveRight_) { MoveRight(); } if(driver_->jump_) { Jump(); } if(jumpTimer_ != -1.0) { jumpTimer_ += timeSinceLastFrame; } if(driver_->feetSensorHit_ == true) { stateMachine_->ChangeState(driver_->onGroundState_); } else { UpdateAnimation(); if(driver_->debugDrawOn_) { driver_->UpdateDebugDraw(); } } // We've successfully updated. return true; } //============================================================================= // HandleMessage // bool HoltStateInAir::HandleMessage(const KGBMessage message) { if(driver_->active_) { switch(message.messageType) { case CHARACTER_MOVE_LEFT_PLUS: { driver_->moveLeft_ = true; return true; } case CHARACTER_MOVE_RIGHT_PLUS: { driver_->moveRight_ = true; return true; } case CHARACTER_JUMP_PLUS: { driver_->jump_ = true; return true; } case CHARACTER_MOVE_LEFT_MINUS: { driver_->moveLeft_ = false; return true; } case CHARACTER_MOVE_RIGHT_MINUS: { driver_->moveRight_ = false; return true; } case CHARACTER_JUMP_MINUS: { driver_->jump_ = false; return true; } } } return false; } //============================================================================= // Exit // void HoltStateInAir::Exit() { } //============================================================================= // BeginContact // /// Called when two fixtures begin to touch. void HoltStateInAir::BeginContact(ContactPoint* contact, b2Fixture* contactFixture, b2Fixture* collidedFixture) { if(!collidedFixture->IsSensor()) { if(contactFixture == driver_->feetSensor_) { stateMachine_->ChangeState(driver_->onGroundState_); driver_->BeginContact(contact,contactFixture,collidedFixture); } } } //============================================================================= // EndContact // /// Called when two fixtures cease to touch. void HoltStateInAir::EndContact(ContactPoint* contact, b2Fixture* contactFixture, b2Fixture* collidedFixture) { } //============================================================================= // MoveLeft // /// void HoltStateInAir::MoveLeft() { double timeSinceLastFrame = GameFramework::getSingletonPtr()->GetTimeSinceLastFrame(); if(driver_->body_->GetLinearVelocity().x > -driver_->maximumAirVelocity_) { driver_->body_->ApplyForce(b2Vec2(-driver_->airForce_ * timeSinceLastFrame,0), driver_->body_->GetPosition()); } } //============================================================================= // MoveRight // /// void HoltStateInAir::MoveRight() { double timeSinceLastFrame = GameFramework::getSingletonPtr()->GetTimeSinceLastFrame(); if(driver_->body_->GetLinearVelocity().x < driver_->maximumAirVelocity_) { driver_->body_->ApplyForce(b2Vec2(driver_->airForce_ * timeSinceLastFrame,0), driver_->body_->GetPosition()); } } //============================================================================= // Jump /// /// Calling jump while the character is in the air will add slightly more /// height to the jump. void HoltStateInAir::Jump() { if(jumpTimer_ > 0.5) { jumpTimer_ = -1.0; } else if(jumpTimer_ != -1.0) { b2Vec2 force(b2Vec2(0, (driver_->jumpingAfterForce_ * ((0.5*2) - jumpTimer_)) * GAMEFRAMEWORK->GetTimeSinceLastFrame())); driver_->body_->ApplyImpulse(force, driver_->body_->GetPosition()); } double timeLeft = (driver_->animationState_->getLength() - driver_->animationState_->getTimePosition()) / driver_->animationState_->getLength(); //driver_->body_->ApplyForce(b2Vec2(0,driver_->jumpingAfterForce_ * timeLeft), driver_->body_->GetPosition()); } //============================================================================= // UpdateAnimation void HoltStateInAir::UpdateAnimation() { double timeSinceLastFrame = GAMEFRAMEWORK->GetTimeSinceLastFrame(); driver_->animationBlender_->AddTime(timeSinceLastFrame); }
[ "Kaziks@34afb35a-be5b-11de-bb5c-85734917f5ce" ]
[ [ [ 1, 256 ] ] ]
7f4ba3c8be3be9e0d72238f475071cdf9e22111e
59ce53af7ad5a1f9b12a69aadbfc7abc4c4bfc02
/publish/skinxmlobject.h
d9412afea8ec7ab821c65b2a1a81b4ea6d915515
[]
no_license
fingomajom/skinengine
444a89955046a6f2c7be49012ff501dc465f019e
6bb26a46a7edac88b613ea9a124abeb8a1694868
refs/heads/master
2021-01-10T11:30:51.541442
2008-07-30T07:13:11
2008-07-30T07:13:11
47,892,418
0
0
null
null
null
null
UTF-8
C++
false
false
2,024
h
/******************************************************************** * CreatedOn: 2007-12-17 17:08 * FileName: skinxmlobject.h * CreatedBy: lidengwang <[email protected]> * $LastChangedDate$ * $LastChangedRevision$ * $LastChangedBy$ * $HeadURL: $ * Purpose: *********************************************************************/ #pragma once #include <skintinyxml.h> namespace KSGUI{ class skinxmlobject { public: skinxmlobject(const SkinXmlElement& xmlElement = SkinXmlElement()) { m_xmlResElement = xmlElement; } const skinxmlobject& operator = (const SkinXmlElement& xmlElement) { m_xmlResElement = xmlElement; return *this; } operator SkinXmlElement () { return m_xmlResElement; } virtual BOOL AttachXmlElement(const SkinXmlElement& xmlElement) { m_xmlResElement = xmlElement; return TRUE; } virtual BOOL GetObject( LPCTSTR Name, KSGUI::CString& strOjbect ) { if (!m_xmlResElement.IsValid()) return FALSE; return m_xmlResElement.GetValue(Name, strOjbect); } virtual BOOL GetObject( LPCTSTR Name, DWORD& uOjbect ) { KSGUI::CString strObject; if (!GetObject(Name, strObject)) return FALSE; if (strObject.GetLength() > 2 && strObject[0] == '0' && (strObject[1] == 'x' || strObject[1] == 'X')) { _stscanf_s(strObject, _T("0x%x"), &uOjbect); } else { uOjbect = (DWORD)_ttoi64(strObject); } return TRUE; } virtual BOOL GetObject( LPCTSTR Name, int & nOjbect ) { KSGUI::CString strObject; if (!GetObject(Name, strObject)) return FALSE; nOjbect = _ttoi(strObject); return TRUE; } public: SkinXmlElement m_xmlResElement; }; } // amespace KSGUI{
[ [ [ 1, 99 ] ] ]
602cad230522b3e682edd2e77fadf6f54e3c3cbc
c95a83e1a741b8c0eb810dd018d91060e5872dd8
/Engine/sdk/inc/ilttexinterface.h
614eedbb4fd3badb17a7b3a53c0b0a2bc4c972fe
[]
no_license
rickyharis39/nolf2
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
refs/heads/master
2021-01-01T17:21:00.678517
2011-07-23T12:11:19
2011-07-23T12:11:19
38,495,312
1
0
null
null
null
null
UTF-8
C++
false
false
7,122
h
/*! The ILTTexture interface allows the game to modify textures. */ #ifndef __ILTTEXINTERFACE_H__ #define __ILTTEXINTERFACE_H__ #ifndef __LTBASETYPES_H__ #include "ltbasetypes.h" #endif #ifndef __LTMODULE_H__ #include "ltmodule.h" #endif #ifndef __LTBASETYPES_H__ #include "ltbasetypes.h" #endif /*! Some of these types are not supported on all platforms. For the PS2, the \b A value represents a value between 0.0 and 2.0 where 128 = 1.0 and 255 = 2.0 */ enum ETextureType { TEXTURETYPE_INVALID = 0, // an error TEXTURETYPE_ARGB8888 = 1, // PC Only TEXTURETYPE_ARGB4444 = 2, // PC Only TEXTURETYPE_ARGB1555 = 3, // PC Only TEXTURETYPE_RGB565 = 4, // PC Only TEXTURETYPE_DXT1 = 5, // PC Only TEXTURETYPE_DXT3 = 6, // PC Only TEXTURETYPE_DXT5 = 7, // PC Only }; enum ETextureMod { TEXTURE_DATACHANGED = 0, TEXTURE_PALETTECHANGED = 1, TEXTURE_DATAANDPALETTECHANGED = 2, }; const uint32 TEXTUREFLAG_FULLBRIGHT = (1<<0); const uint32 TEXTUREFLAG_PREFER16BIT = (1<<1); const uint32 TEXTUREFLAG_NOSYSCACHE = (1<<6); // Tells the engine to not keep a system memory copy of the texture. const uint32 TEXTUREFLAG_PREFER4444 = (1<<7); // If in 16-bit mode, use a 4444 texture for this. const uint32 TEXTUREFLAG_PREFER5551 = (1<<8); // Use 5551 if 16-bit. const uint32 TEXTUREFLAG_32BITSYSCOPY = (1<<9); // If there is a sys copy - don't convert it to device specific format (keep it 32 bit). class SharedTexture; typedef SharedTexture* HTEXTURE; /*! The ILTTexInterface interface exposes texture manipulation functionality to the game code. It enables direct access to texture data. This direct access means that the texture won't be converted to a new format, and will therefore result in faster texture rendering. Define a holder to get this interface like this: \code define_holder(ILTTexInterface, your_var); \endcode */ class ILTTexInterface : public IBase { public: //set the interface version number interface_version(ILTTexInterface, 0); /*! \param hTexture (return) Texture handle. \param pFilename Texture filename. \result \b LT_ERROR - Texture not found. \result \b LT_OK - Texture found. Retrieves a handle to an existing texture given a filename. Used for: Special FX. */ virtual LTRESULT FindTextureFromName(HTEXTURE &hTexture, const char *pFilename) = 0; /*! \param hTexture The address of the converted texture. \param pFilename Points to a char array containing the relative path to the resource directory in which the .DTX file is located. \return \b LT_MISSINGFILE - \em pFilename is invalid (can't find file). \return \b LT_ERROR - Internal error. \return \b LT_OK - Successful. Creates a texture from a .DTX file. A .DTX file is created using the DEdit tool (see the Game Content Creation Guide). If the .DTX file was created with the DTX_32BITSYSCOPY bit set, the texture will not be converted (the system memory copy will remain RGBA_8888). To determine the format type of the new texture, use ILTTexInterface::GetTextureType. Used for: Special FX. */ virtual LTRESULT CreateTextureFromName(HTEXTURE &hTexture, const char *pFilename) = 0; /*! \param hTexture (return) Texture handle. \param eTextureType Type (see TEXTURETYPE_ enum, above). \param TextureFlags Flags (see TEXTUREFLAG_ values, above). \param pData Pointer to the texture data. \param nWidth Width. \param nHeight Height. \param nAutoGenMipMaps Request auto creation of nAutoGenMipMaps number of mip maps. They will be down sampled. Set this param to 0 to autogen all the way down to 1x1. \return \b LT_ERROR - Texture could not be created. \return \b LT_OK - Successful. Creates a texture from the passed in data. Used for: Special FX. */ virtual LTRESULT CreateTextureFromData(HTEXTURE &hTexture, ETextureType eTextureType, uint32 TextureFlags, uint8 *pData, uint32 nWidth, uint32 nHeight, uint32 nAutoGenMipMaps = 1) = 0; /*! \param hTexture Texture handle. \param pData (return) Texture pixel data pointer \param nWidth (return) The width of the surface that is locked in pixels. \param nHeight (return) The height of the surface that is locked in pixels. \param nPitch (return) Size (in bytes) of a row of pixel data. \param eType (return) Format of the texture data \return \b LT_OK - Successful. Fetch a pointer to the texture RGB raw data. This data cannot be modified and the pointer should only be used immediately after obtaining it without any other texture calls since the engine is free to unload the texture if it rebinds it Used for: Special FX. */ virtual LTRESULT GetTextureData(const HTEXTURE hTexture, const uint8* &pData, uint32& nWidth, uint32& nHeight, uint32& nPitch, ETextureType& eType) = 0; /*! \param hTexture Texture handle. \param eChanged Indicate is the texture pixel data and/or palette has changed. \param nMipMap Mipmap to unlock. \return \b LT_OK - Successful. Let the engine know that we are finished modifing the texture Used for: Special FX. */ virtual LTRESULT FlushTextureData (const HTEXTURE hTexture, ETextureMod eChanged = TEXTURE_DATAANDPALETTECHANGED, uint32 nMipMap = 0) = 0; /*! \param hTexture Texture handle. \param nWidth (return) Texture width. \param nHeight (return) Texture height. \return \b LT_OK - Successful. Get information about the texture. Used for: Special FX. */ virtual LTRESULT GetTextureDims(const HTEXTURE hTexture, uint32 &nWidth, uint32 &nHeight) = 0; /*! \param hTexture Texture handle. \param eTextureType (return) The texture type. \return \b LT_OK - Successful. Get information about the texture. Used for: Special FX. */ virtual LTRESULT GetTextureType(const HTEXTURE hTexture, ETextureType &eTextureType) = 0; /*! \param hTexture Texture handle. \return \b LT_OK - Successful. You should call ReleaseTextureHandle after you are done with your texture so that it can be freed. If it is not also being used by the engine, it will be freed. Used for: Special FX. */ virtual bool ReleaseTextureHandle(const HTEXTURE hTexture) = 0; /*! \param hTexture Texture handle \return \b Reference count of texture Call AddRefTextureHandle to artificially increment the reference count of a texture. Used for: Special FX. */ virtual uint32 AddRefTextureHandle(const HTEXTURE hTexture) = 0; }; #endif //! __ILTTEXINTERFACE_H__
[ [ [ 1, 219 ] ] ]
92fdbfa79721aa72931b70506e39275bc92eafa4
8fb9ccf49a324a586256bb08c22edc92e23affcf
/src/Engine/Lfo.h
29903bbcf14d27dc350d4aaee597a073455f1677
[]
no_license
eriser/tal-noisemak3r
76468c98db61dfa28315284b4a5b1acfeb9c1ff6
1043c8f237741ea7beb89b5bd26243f8891cb037
refs/heads/master
2021-01-18T18:29:56.446225
2010-08-05T20:51:35
2010-08-05T20:51:35
62,891,642
1
0
null
null
null
null
UTF-8
C++
false
false
1,964
h
#ifndef LFO_H #define LFO_H #include <string> #include "OscNoise.h" //============================================================================== /** This class implements a LUT-based LFO with various waveforms and linear interpolation. It uses 32-bit fixed-point phase and increment, where the 8 MSB represent the integer part of the number and the 24 LSB the fractionnal part @author Remy Muller @date 20030822 */ //============================================================================== class Lfo { public: /** phase type */ float phase; float result; float resultSmooth; /** @param samplerate the samplerate in Hz */ Lfo(float samplerate); virtual ~Lfo() {} /** increments the phase and outputs the new LFO value. @return the new LFO value between [-1;+1] */ float tick(int waveform); void resetPhase(); /** change the current rate @param rate new rate in Hz */ void setRate(const float rate); /** change the current samplerate @param samplerate new samplerate in Hz */ void setSampleRate(float samplerate_) {samplerate = (samplerate_>0.0) ? samplerate : 44100.0f;} /** select the desired waveform for the LFO @param index tag of the waveform */ // void setWaveform(waveform_t index); void setWaveform(int index); float inc; float samplerate; float randomValue; float randomValueOld; private: OscNoise *noiseOsc; bool freqWrap; /** table length is 256+1, with table[0] = table[256] that way we can perform linear interpolation: \f[ val = (1-frac)*u[n] + frac*u[n+1] \f] even with n = 255. For n higher than 255, n is automatically wrapped to 0-255*/ float tableSin[257]; float tableTri[257]; float tableSaw[257]; float tableRec[257]; float tableExp[257]; int i; float frac; }; #endif // #ifndef LFO_H
[ "patrickkunzch@1672e8fc-9579-4a43-9460-95afed9bdb0b" ]
[ [ [ 1, 80 ] ] ]
45424d1a223eeaa2295a37bbae922d9e0cd952a2
81e051c660949ac0e89d1e9cf286e1ade3eed16a
/quake3ce/code/q3_ui/ui_startserver.cpp
771c7e2f02e51ed13b0704f2d0210843d1f023f5
[]
no_license
crioux/q3ce
e89c3b60279ea187a2ebcf78dbe1e9f747a31d73
5e724f55940ac43cb25440a65f9e9e12220c9ada
refs/heads/master
2020-06-04T10:29:48.281238
2008-11-16T15:00:38
2008-11-16T15:00:38
32,103,416
5
0
null
null
null
null
UTF-8
C++
false
false
62,478
cpp
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Quake III Arena source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ // /* ============================================================================= START SERVER MENU ***** ============================================================================= */ #include"ui_pch.h" #define GAMESERVER_BACK0 "menu/art/back_0" #define GAMESERVER_BACK1 "menu/art/back_1" #define GAMESERVER_NEXT0 "menu/art/next_0" #define GAMESERVER_NEXT1 "menu/art/next_1" #define GAMESERVER_FRAMEL "menu/art/frame2_l" #define GAMESERVER_FRAMER "menu/art/frame1_r" #define GAMESERVER_SELECT "menu/art/maps_select" #define GAMESERVER_SELECTED "menu/art/maps_selected" #define GAMESERVER_FIGHT0 "menu/art/fight_0" #define GAMESERVER_FIGHT1 "menu/art/fight_1" #define GAMESERVER_UNKNOWNMAP "menu/art/unknownmap" #define GAMESERVER_ARROWS "menu/art/gs_arrows_0" #define GAMESERVER_ARROWSL "menu/art/gs_arrows_l" #define GAMESERVER_ARROWSR "menu/art/gs_arrows_r" #define MAX_MAPROWS 2 #define MAX_MAPCOLS 2 #define MAX_MAPSPERPAGE 4 #define MAX_SERVERSTEXT 8192 #define MAX_SERVERMAPS 64 #define MAX_NAMELENGTH 16 #define ID_GAMETYPE 10 #define ID_PICTURES 11 // 12, 13, 14 #define ID_PREVPAGE 15 #define ID_NEXTPAGE 16 #define ID_STARTSERVERBACK 17 #define ID_STARTSERVERNEXT 18 typedef struct { menuframework_s menu; menutext_s banner; menubitmap_s framel; menubitmap_s framer; menulist_s gametype; menubitmap_s mappics[MAX_MAPSPERPAGE]; menubitmap_s mapbuttons[MAX_MAPSPERPAGE]; menubitmap_s arrows; menubitmap_s prevpage; menubitmap_s nextpage; menubitmap_s back; menubitmap_s next; menutext_s mapname; menubitmap_s item_null; qboolean multiplayer; int currentmap; int nummaps; int page; int maxpages; char maplist[MAX_SERVERMAPS][MAX_NAMELENGTH]; int mapGamebits[MAX_SERVERMAPS]; } startserver_t; static startserver_t s_startserver; static const char *gametype_items[] = { "Free For All", "Team Deathmatch", "Tournament", "Capture the Flag", 0 }; static int gametype_remap[] = {GT_FFA, GT_TEAM, GT_TOURNAMENT, GT_CTF}; static int gametype_remap2[] = {0, 2, 0, 1, 3}; // use ui_servers2.c definition extern const char* punkbuster_items[]; static void UI_ServerOptionsMenu( qboolean multiplayer ); /* ================= GametypeBits ================= */ static int GametypeBits( const char *string ) { int bits; const char *p; const char *token; bits = 0; p = string; while( 1 ) { token = COM_ParseExt( &p, qfalse ); if( token[0] == 0 ) { break; } if( Q_stricmp( token, "ffa" ) == 0 ) { bits |= 1 << GT_FFA; continue; } if( Q_stricmp( token, "tourney" ) == 0 ) { bits |= 1 << GT_TOURNAMENT; continue; } if( Q_stricmp( token, "single" ) == 0 ) { bits |= 1 << GT_SINGLE_PLAYER; continue; } if( Q_stricmp( token, "team" ) == 0 ) { bits |= 1 << GT_TEAM; continue; } if( Q_stricmp( token, "ctf" ) == 0 ) { bits |= 1 << GT_CTF; continue; } } return bits; } /* ================= StartServer_Update ================= */ static void StartServer_Update( void ) { int i; int top; static char picname[MAX_MAPSPERPAGE][64]; top = s_startserver.page*MAX_MAPSPERPAGE; for (i=0; i<MAX_MAPSPERPAGE; i++) { if (top+i >= s_startserver.nummaps) break; Com_sprintf( picname[i], sizeof(picname[i]), "levelshots/%s", s_startserver.maplist[top+i] ); s_startserver.mappics[i].generic.flags &= ~QMF_HIGHLIGHT; s_startserver.mappics[i].generic.name = picname[i]; s_startserver.mappics[i].shader = 0; // reset s_startserver.mapbuttons[i].generic.flags |= QMF_PULSEIFFOCUS; s_startserver.mapbuttons[i].generic.flags &= ~QMF_INACTIVE; } for (; i<MAX_MAPSPERPAGE; i++) { s_startserver.mappics[i].generic.flags &= ~QMF_HIGHLIGHT; s_startserver.mappics[i].generic.name = NULL; s_startserver.mappics[i].shader = 0; // disable s_startserver.mapbuttons[i].generic.flags &= ~QMF_PULSEIFFOCUS; s_startserver.mapbuttons[i].generic.flags |= QMF_INACTIVE; } // no servers to start if( !s_startserver.nummaps ) { s_startserver.next.generic.flags |= QMF_INACTIVE; // set the map name strcpy( s_startserver.mapname.string, "NO MAPS FOUND" ); } else { // set the highlight s_startserver.next.generic.flags &= ~QMF_INACTIVE; i = s_startserver.currentmap - top; if ( i >=0 && i < MAX_MAPSPERPAGE ) { s_startserver.mappics[i].generic.flags |= QMF_HIGHLIGHT; s_startserver.mapbuttons[i].generic.flags &= ~QMF_PULSEIFFOCUS; } // set the map name strcpy( s_startserver.mapname.string, s_startserver.maplist[s_startserver.currentmap] ); } Q_strupr( s_startserver.mapname.string ); } /* ================= StartServer_MapEvent ================= */ static void StartServer_MapEvent( void* ptr, int event ) { if( event != QM_ACTIVATED) { return; } s_startserver.currentmap = (s_startserver.page*MAX_MAPSPERPAGE) + (((menucommon_s*)ptr)->id - ID_PICTURES); StartServer_Update(); } /* ================= StartServer_GametypeEvent ================= */ static void StartServer_GametypeEvent( void* ptr, int event ) { int i; int count; int gamebits; int matchbits; const char *info; if( event != QM_ACTIVATED) { return; } count = UI_GetNumArenas(); s_startserver.nummaps = 0; matchbits = 1 << gametype_remap[s_startserver.gametype.curvalue]; if( gametype_remap[s_startserver.gametype.curvalue] == GT_FFA ) { matchbits |= ( 1 << GT_SINGLE_PLAYER ); } for( i = 0; i < count; i++ ) { info = UI_GetArenaInfoByNumber( i ); gamebits = GametypeBits( Info_ValueForKey( info, "type") ); if( !( gamebits & matchbits ) ) { continue; } Q_strncpyz( s_startserver.maplist[s_startserver.nummaps], Info_ValueForKey( info, "map"), MAX_NAMELENGTH ); Q_strupr( s_startserver.maplist[s_startserver.nummaps] ); s_startserver.mapGamebits[s_startserver.nummaps] = gamebits; s_startserver.nummaps++; } s_startserver.maxpages = (s_startserver.nummaps + MAX_MAPSPERPAGE-1)/MAX_MAPSPERPAGE; s_startserver.page = 0; s_startserver.currentmap = 0; StartServer_Update(); } /* ================= StartServer_MenuEvent ================= */ static void StartServer_MenuEvent( void* ptr, int event ) { if( event != QM_ACTIVATED ) { return; } switch( ((menucommon_s*)ptr)->id ) { case ID_PREVPAGE: if( s_startserver.page > 0 ) { s_startserver.page--; StartServer_Update(); } break; case ID_NEXTPAGE: if( s_startserver.page < s_startserver.maxpages - 1 ) { s_startserver.page++; StartServer_Update(); } break; case ID_STARTSERVERNEXT: _UI_trap_Cvar_SetValue( "g_gameType",MAKE_LFIXED(gametype_remap[s_startserver.gametype.curvalue]) ); UI_ServerOptionsMenu( s_startserver.multiplayer ); break; case ID_STARTSERVERBACK: UI_PopMenu(); break; } } /* =============== StartServer_LevelshotDraw =============== */ static void StartServer_LevelshotDraw( void *self ) { menubitmap_s *b; int x; int y; int w; int h; int n; b = (menubitmap_s *)self; if( !b->generic.name ) { return; } if( b->generic.name && !b->shader ) { b->shader = _UI_trap_R_RegisterShaderNoMip( b->generic.name ); if( !b->shader && b->errorpic ) { b->shader = _UI_trap_R_RegisterShaderNoMip( b->errorpic ); } } if( b->focuspic && !b->focusshader ) { b->focusshader = _UI_trap_R_RegisterShaderNoMip( b->focuspic ); } x = b->generic.x; y = b->generic.y; w = b->width; h = b->height; if( b->shader ) { UI_DrawHandlePic( MAKE_GFIXED(x), MAKE_GFIXED(y), MAKE_GFIXED(w), MAKE_GFIXED(h), b->shader ); } x = b->generic.x; y = b->generic.y + b->height; UI_FillRect( MAKE_GFIXED(x), MAKE_GFIXED(y), MAKE_GFIXED(b->width), GFIXED(28,0), colorBlack ); x += b->width / 2; y += 4; n = s_startserver.page * MAX_MAPSPERPAGE + b->generic.id - ID_PICTURES; UI_DrawString( x, y, s_startserver.maplist[n], UI_CENTER|UI_SMALLFONT, color_orange ); x = b->generic.x; y = b->generic.y; w = b->width; h = b->height + 28; if( b->generic.flags & QMF_HIGHLIGHT ) { UI_DrawHandlePic( MAKE_GFIXED(x), MAKE_GFIXED(y), MAKE_GFIXED(w), MAKE_GFIXED(h), b->focusshader ); } } /* ================= StartServer_MenuInit ================= */ static void StartServer_MenuInit( void ) { int i; int x; int y; static char mapnamebuffer[64]; // zero set all our globals memset( &s_startserver, 0 ,sizeof(startserver_t) ); StartServer_Cache(); s_startserver.menu.wrapAround = qtrue; s_startserver.menu.fullscreen = qtrue; s_startserver.banner.generic.type = MTYPE_BTEXT; s_startserver.banner.generic.x = 320; s_startserver.banner.generic.y = 16; s_startserver.banner.string = strdup("GAME SERVER"); s_startserver.banner.color = color_white; s_startserver.banner.style = UI_CENTER; s_startserver.framel.generic.type = MTYPE_BITMAP; s_startserver.framel.generic.name = GAMESERVER_FRAMEL; s_startserver.framel.generic.flags = QMF_INACTIVE; s_startserver.framel.generic.x = 0; s_startserver.framel.generic.y = 78; s_startserver.framel.width = 256; s_startserver.framel.height = 329; s_startserver.framer.generic.type = MTYPE_BITMAP; s_startserver.framer.generic.name = GAMESERVER_FRAMER; s_startserver.framer.generic.flags = QMF_INACTIVE; s_startserver.framer.generic.x = 376; s_startserver.framer.generic.y = 76; s_startserver.framer.width = 256; s_startserver.framer.height = 334; s_startserver.gametype.generic.type = MTYPE_SPINCONTROL; s_startserver.gametype.generic.name = "Game Type:"; s_startserver.gametype.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_startserver.gametype.generic.callback = StartServer_GametypeEvent; s_startserver.gametype.generic.id = ID_GAMETYPE; s_startserver.gametype.generic.x = 320 - 24; s_startserver.gametype.generic.y = 368; s_startserver.gametype.itemnames = gametype_items; for (i=0; i<MAX_MAPSPERPAGE; i++) { x = (i % MAX_MAPCOLS) * (128+8) + 188; y = (i / MAX_MAPROWS) * (128+8) + 96; s_startserver.mappics[i].generic.type = MTYPE_BITMAP; s_startserver.mappics[i].generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE; s_startserver.mappics[i].generic.x = x; s_startserver.mappics[i].generic.y = y; s_startserver.mappics[i].generic.id = ID_PICTURES+i; s_startserver.mappics[i].width = 128; s_startserver.mappics[i].height = 96; s_startserver.mappics[i].focuspic = GAMESERVER_SELECTED; s_startserver.mappics[i].errorpic = GAMESERVER_UNKNOWNMAP; s_startserver.mappics[i].generic.ownerdraw = StartServer_LevelshotDraw; s_startserver.mapbuttons[i].generic.type = MTYPE_BITMAP; s_startserver.mapbuttons[i].generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_NODEFAULTINIT; s_startserver.mapbuttons[i].generic.id = ID_PICTURES+i; s_startserver.mapbuttons[i].generic.callback = StartServer_MapEvent; s_startserver.mapbuttons[i].generic.x = x - 30; s_startserver.mapbuttons[i].generic.y = y - 32; s_startserver.mapbuttons[i].width = 256; s_startserver.mapbuttons[i].height = 248; s_startserver.mapbuttons[i].generic.left = x; s_startserver.mapbuttons[i].generic.top = y; s_startserver.mapbuttons[i].generic.right = x + 128; s_startserver.mapbuttons[i].generic.bottom = y + 128; s_startserver.mapbuttons[i].focuspic = GAMESERVER_SELECT; } s_startserver.arrows.generic.type = MTYPE_BITMAP; s_startserver.arrows.generic.name = GAMESERVER_ARROWS; s_startserver.arrows.generic.flags = QMF_INACTIVE; s_startserver.arrows.generic.x = 260; s_startserver.arrows.generic.y = 400; s_startserver.arrows.width = 128; s_startserver.arrows.height = 32; s_startserver.prevpage.generic.type = MTYPE_BITMAP; s_startserver.prevpage.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_startserver.prevpage.generic.callback = StartServer_MenuEvent; s_startserver.prevpage.generic.id = ID_PREVPAGE; s_startserver.prevpage.generic.x = 260; s_startserver.prevpage.generic.y = 400; s_startserver.prevpage.width = 64; s_startserver.prevpage.height = 32; s_startserver.prevpage.focuspic = GAMESERVER_ARROWSL; s_startserver.nextpage.generic.type = MTYPE_BITMAP; s_startserver.nextpage.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_startserver.nextpage.generic.callback = StartServer_MenuEvent; s_startserver.nextpage.generic.id = ID_NEXTPAGE; s_startserver.nextpage.generic.x = 321; s_startserver.nextpage.generic.y = 400; s_startserver.nextpage.width = 64; s_startserver.nextpage.height = 32; s_startserver.nextpage.focuspic = GAMESERVER_ARROWSR; s_startserver.mapname.generic.type = MTYPE_PTEXT; s_startserver.mapname.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE; s_startserver.mapname.generic.x = 320; s_startserver.mapname.generic.y = 440; s_startserver.mapname.string = mapnamebuffer; s_startserver.mapname.style = UI_CENTER|UI_BIGFONT; s_startserver.mapname.color = text_color_normal; s_startserver.back.generic.type = MTYPE_BITMAP; s_startserver.back.generic.name = GAMESERVER_BACK0; s_startserver.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_startserver.back.generic.callback = StartServer_MenuEvent; s_startserver.back.generic.id = ID_STARTSERVERBACK; s_startserver.back.generic.x = 0; s_startserver.back.generic.y = 480-64; s_startserver.back.width = 128; s_startserver.back.height = 64; s_startserver.back.focuspic = GAMESERVER_BACK1; s_startserver.next.generic.type = MTYPE_BITMAP; s_startserver.next.generic.name = GAMESERVER_NEXT0; s_startserver.next.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; s_startserver.next.generic.callback = StartServer_MenuEvent; s_startserver.next.generic.id = ID_STARTSERVERNEXT; s_startserver.next.generic.x = 640; s_startserver.next.generic.y = 480-64; s_startserver.next.width = 128; s_startserver.next.height = 64; s_startserver.next.focuspic = GAMESERVER_NEXT1; s_startserver.item_null.generic.type = MTYPE_BITMAP; s_startserver.item_null.generic.flags = QMF_LEFT_JUSTIFY|QMF_MOUSEONLY|QMF_SILENT; s_startserver.item_null.generic.x = 0; s_startserver.item_null.generic.y = 0; s_startserver.item_null.width = 640; s_startserver.item_null.height = 480; Menu_AddItem( &s_startserver.menu, &s_startserver.banner ); Menu_AddItem( &s_startserver.menu, &s_startserver.framel ); Menu_AddItem( &s_startserver.menu, &s_startserver.framer ); Menu_AddItem( &s_startserver.menu, &s_startserver.gametype ); for (i=0; i<MAX_MAPSPERPAGE; i++) { Menu_AddItem( &s_startserver.menu, &s_startserver.mappics[i] ); Menu_AddItem( &s_startserver.menu, &s_startserver.mapbuttons[i] ); } Menu_AddItem( &s_startserver.menu, &s_startserver.arrows ); Menu_AddItem( &s_startserver.menu, &s_startserver.prevpage ); Menu_AddItem( &s_startserver.menu, &s_startserver.nextpage ); Menu_AddItem( &s_startserver.menu, &s_startserver.back ); Menu_AddItem( &s_startserver.menu, &s_startserver.next ); Menu_AddItem( &s_startserver.menu, &s_startserver.mapname ); Menu_AddItem( &s_startserver.menu, &s_startserver.item_null ); StartServer_GametypeEvent( NULL, QM_ACTIVATED ); } /* ================= StartServer_Cache ================= */ void StartServer_Cache( void ) { int i; const char *info; qboolean precache; char picname[64]; _UI_trap_R_RegisterShaderNoMip( GAMESERVER_BACK0 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_BACK1 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_NEXT0 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_NEXT1 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_FRAMEL ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_FRAMER ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_SELECT ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_SELECTED ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_UNKNOWNMAP ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_ARROWS ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_ARROWSL ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_ARROWSR ); precache = FIXED_TO_INT(_UI_trap_Cvar_VariableValue("com_buildscript")); s_startserver.nummaps = UI_GetNumArenas(); for( i = 0; i < s_startserver.nummaps; i++ ) { info = UI_GetArenaInfoByNumber( i ); Q_strncpyz( s_startserver.maplist[i], Info_ValueForKey( info, "map"), MAX_NAMELENGTH ); Q_strupr( s_startserver.maplist[i] ); s_startserver.mapGamebits[i] = GametypeBits( Info_ValueForKey( info, "type") ); if( precache ) { Com_sprintf( picname, sizeof(picname), "levelshots/%s", s_startserver.maplist[i] ); _UI_trap_R_RegisterShaderNoMip(picname); } } s_startserver.maxpages = (s_startserver.nummaps + MAX_MAPSPERPAGE-1)/MAX_MAPSPERPAGE; } /* ================= UI_StartServerMenu ================= */ void UI_StartServerMenu( qboolean multiplayer ) { StartServer_MenuInit(); s_startserver.multiplayer = multiplayer; UI_PushMenu( &s_startserver.menu ); } /* ============================================================================= SERVER OPTIONS MENU ***** ============================================================================= */ #define ID_PLAYER_TYPE 20 #define ID_MAXCLIENTS 21 #define ID_DEDICATED 22 #define ID_GO 23 #define ID_BACK 24 #define PLAYER_SLOTS 12 typedef struct { menuframework_s menu; menutext_s banner; menubitmap_s mappic; menubitmap_s picframe; menulist_s dedicated; menufield_s timelimit; menufield_s fraglimit; menufield_s flaglimit; menuradiobutton_s friendlyfire; menufield_s hostname; menuradiobutton_s pure; menulist_s botSkill; menutext_s player0; menulist_s playerType[PLAYER_SLOTS]; menutext_s playerName[PLAYER_SLOTS]; menulist_s playerTeam[PLAYER_SLOTS]; menubitmap_s go; menubitmap_s next; menubitmap_s back; qboolean multiplayer; int gametype; char mapnamebuffer[32]; char playerNameBuffers[PLAYER_SLOTS][16]; qboolean newBot; int newBotIndex; char newBotName[16]; menulist_s punkbuster; } serveroptions_t; static serveroptions_t s_serveroptions; static const char *dedicated_list[] = { "No", "LAN", "Internet", 0 }; static const char *playerType_list[] = { "Open", "Bot", "----", 0 }; static const char *playerTeam_list[] = { "Blue", "Red", 0 }; static const char *botSkill_list[] = { "I Can Win", "Bring It On", "Hurt Me Plenty", "Hardcore", "Nightmare!", 0 }; /* ================= BotAlreadySelected ================= */ static qboolean BotAlreadySelected( const char *checkName ) { int n; for( n = 1; n < PLAYER_SLOTS; n++ ) { if( s_serveroptions.playerType[n].curvalue != 1 ) { continue; } if( (s_serveroptions.gametype >= GT_TEAM) && (s_serveroptions.playerTeam[n].curvalue != s_serveroptions.playerTeam[s_serveroptions.newBotIndex].curvalue ) ) { continue; } if( Q_stricmp( checkName, s_serveroptions.playerNameBuffers[n] ) == 0 ) { return qtrue; } } return qfalse; } /* ================= ServerOptions_Start ================= */ static void ServerOptions_Start( void ) { int timelimit; int fraglimit; int maxclients; int dedicated; int friendlyfire; int flaglimit; int pure; int skill; int n; char buf[64]; timelimit = atoi( s_serveroptions.timelimit.field.buffer ); fraglimit = atoi( s_serveroptions.fraglimit.field.buffer ); flaglimit = atoi( s_serveroptions.flaglimit.field.buffer ); dedicated = s_serveroptions.dedicated.curvalue; friendlyfire = s_serveroptions.friendlyfire.curvalue; pure = s_serveroptions.pure.curvalue; skill = s_serveroptions.botSkill.curvalue + 1; //set maxclients for( n = 0, maxclients = 0; n < PLAYER_SLOTS; n++ ) { if( s_serveroptions.playerType[n].curvalue == 2 ) { continue; } if( (s_serveroptions.playerType[n].curvalue == 1) && (s_serveroptions.playerNameBuffers[n][0] == 0) ) { continue; } maxclients++; } switch( s_serveroptions.gametype ) { case GT_FFA: default: _UI_trap_Cvar_SetValue( "ui_ffa_fraglimit", MAKE_LFIXED(fraglimit) ); _UI_trap_Cvar_SetValue( "ui_ffa_timelimit", MAKE_LFIXED(timelimit) ); break; case GT_TOURNAMENT: _UI_trap_Cvar_SetValue( "ui_tourney_fraglimit", MAKE_LFIXED(fraglimit) ); _UI_trap_Cvar_SetValue( "ui_tourney_timelimit", MAKE_LFIXED(timelimit) ); break; case GT_TEAM: _UI_trap_Cvar_SetValue( "ui_team_fraglimit", MAKE_LFIXED(fraglimit) ); _UI_trap_Cvar_SetValue( "ui_team_timelimit", MAKE_LFIXED(timelimit) ); _UI_trap_Cvar_SetValue( "ui_team_friendlt", MAKE_LFIXED(friendlyfire) ); break; case GT_CTF: _UI_trap_Cvar_SetValue( "ui_ctf_fraglimit", MAKE_LFIXED(fraglimit) ); _UI_trap_Cvar_SetValue( "ui_ctf_timelimit", MAKE_LFIXED(timelimit) ); _UI_trap_Cvar_SetValue( "ui_ctf_friendlt", MAKE_LFIXED(friendlyfire) ); break; } _UI_trap_Cvar_SetValue( "sv_maxclients", MAKE_LFIXED(Com_Clamp( GFIXED_0, GFIXED(12,0), MAKE_GFIXED(maxclients)) ) ); _UI_trap_Cvar_SetValue( "dedicated", MAKE_LFIXED(Com_Clamp( GFIXED_0, GFIXED(2,0), MAKE_GFIXED(dedicated)) ) ); _UI_trap_Cvar_SetValue ("timelimit", MAKE_LFIXED(Com_Clamp( GFIXED_0, MAKE_GFIXED(timelimit), MAKE_GFIXED(timelimit)) ) ); _UI_trap_Cvar_SetValue ("fraglimit", MAKE_LFIXED(Com_Clamp( GFIXED_0, MAKE_GFIXED(fraglimit), MAKE_GFIXED(fraglimit)) ) ); _UI_trap_Cvar_SetValue ("capturelimit", MAKE_LFIXED(Com_Clamp( GFIXED_0, MAKE_GFIXED(flaglimit), MAKE_GFIXED(flaglimit)) ) ); _UI_trap_Cvar_SetValue( "g_friendlyfire", MAKE_LFIXED(friendlyfire) ); _UI_trap_Cvar_SetValue( "sv_pure", MAKE_LFIXED(pure) ); _UI_trap_Cvar_Set("sv_hostname", s_serveroptions.hostname.field.buffer ); _UI_trap_Cvar_SetValue( "sv_punkbuster", MAKE_LFIXED(s_serveroptions.punkbuster.curvalue) ); // the wait commands will allow the dedicated to take effect _UI_trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait ; wait ; map %s\n", s_startserver.maplist[s_startserver.currentmap] ) ); // add bots _UI_trap_Cmd_ExecuteText( EXEC_APPEND, "wait 3\n" ); for( n = 1; n < PLAYER_SLOTS; n++ ) { if( s_serveroptions.playerType[n].curvalue != 1 ) { continue; } if( s_serveroptions.playerNameBuffers[n][0] == 0 ) { continue; } if( s_serveroptions.playerNameBuffers[n][0] == '-' ) { continue; } if( s_serveroptions.gametype >= GT_TEAM ) { Com_sprintf( buf, sizeof(buf), "addbot %s %i %s\n", s_serveroptions.playerNameBuffers[n], skill, playerTeam_list[s_serveroptions.playerTeam[n].curvalue] ); } else { Com_sprintf( buf, sizeof(buf), "addbot %s %i\n", s_serveroptions.playerNameBuffers[n], skill ); } _UI_trap_Cmd_ExecuteText( EXEC_APPEND, buf ); } // set player's team if( dedicated == 0 && s_serveroptions.gametype >= GT_TEAM ) { _UI_trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait 5; team %s\n", playerTeam_list[s_serveroptions.playerTeam[0].curvalue] ) ); } } /* ================= ServerOptions_InitPlayerItems ================= */ static void ServerOptions_InitPlayerItems( void ) { int n; int v; // init types if( s_serveroptions.multiplayer ) { v = 0; // open } else { v = 1; // bot } for( n = 0; n < PLAYER_SLOTS; n++ ) { s_serveroptions.playerType[n].curvalue = v; } if( s_serveroptions.multiplayer && (s_serveroptions.gametype < GT_TEAM) ) { for( n = 8; n < PLAYER_SLOTS; n++ ) { s_serveroptions.playerType[n].curvalue = 2; } } // if not a dedicated server, first slot is reserved for the human on the server if( s_serveroptions.dedicated.curvalue == 0 ) { // human s_serveroptions.playerType[0].generic.flags |= QMF_INACTIVE; s_serveroptions.playerType[0].curvalue = 0; _UI_trap_Cvar_VariableStringBuffer( "name", s_serveroptions.playerNameBuffers[0], sizeof(s_serveroptions.playerNameBuffers[0]) ); Q_CleanStr( s_serveroptions.playerNameBuffers[0] ); } // init teams if( s_serveroptions.gametype >= GT_TEAM ) { for( n = 0; n < (PLAYER_SLOTS / 2); n++ ) { s_serveroptions.playerTeam[n].curvalue = 0; } for( ; n < PLAYER_SLOTS; n++ ) { s_serveroptions.playerTeam[n].curvalue = 1; } } else { for( n = 0; n < PLAYER_SLOTS; n++ ) { s_serveroptions.playerTeam[n].generic.flags |= (QMF_INACTIVE|QMF_HIDDEN); } } } /* ================= ServerOptions_SetPlayerItems ================= */ static void ServerOptions_SetPlayerItems( void ) { int start; int n; // types // for( n = 0; n < PLAYER_SLOTS; n++ ) { // if( (!s_serveroptions.multiplayer) && (n > 0) && (s_serveroptions.playerType[n].curvalue == 0) ) { // s_serveroptions.playerType[n].curvalue = 1; // } // } // names if( s_serveroptions.dedicated.curvalue == 0 ) { s_serveroptions.player0.string = strdup("Human"); s_serveroptions.playerName[0].generic.flags &= ~QMF_HIDDEN; start = 1; } else { s_serveroptions.player0.string = strdup("Open"); start = 0; } for( n = start; n < PLAYER_SLOTS; n++ ) { if( s_serveroptions.playerType[n].curvalue == 1 ) { s_serveroptions.playerName[n].generic.flags &= ~(QMF_INACTIVE|QMF_HIDDEN); } else { s_serveroptions.playerName[n].generic.flags |= (QMF_INACTIVE|QMF_HIDDEN); } } // teams if( s_serveroptions.gametype < GT_TEAM ) { return; } for( n = start; n < PLAYER_SLOTS; n++ ) { if( s_serveroptions.playerType[n].curvalue == 2 ) { s_serveroptions.playerTeam[n].generic.flags |= (QMF_INACTIVE|QMF_HIDDEN); } else { s_serveroptions.playerTeam[n].generic.flags &= ~(QMF_INACTIVE|QMF_HIDDEN); } } } /* ================= ServerOptions_Event ================= */ static void ServerOptions_Event( void* ptr, int event ) { switch( ((menucommon_s*)ptr)->id ) { //if( event != QM_ACTIVATED && event != QM_LOSTFOCUS) { // return; //} case ID_PLAYER_TYPE: if( event != QM_ACTIVATED ) { break; } ServerOptions_SetPlayerItems(); break; case ID_MAXCLIENTS: case ID_DEDICATED: ServerOptions_SetPlayerItems(); break; case ID_GO: if( event != QM_ACTIVATED ) { break; } ServerOptions_Start(); break; case ID_STARTSERVERNEXT: if( event != QM_ACTIVATED ) { break; } break; case ID_BACK: if( event != QM_ACTIVATED ) { break; } UI_PopMenu(); break; } } static void ServerOptions_PlayerNameEvent( void* ptr, int event ) { int n; if( event != QM_ACTIVATED ) { return; } n = ((menutext_s*)ptr)->generic.id; s_serveroptions.newBotIndex = n; UI_BotSelectMenu( s_serveroptions.playerNameBuffers[n] ); } /* ================= ServerOptions_StatusBar ================= */ static void ServerOptions_StatusBar( void* ptr ) { UI_DrawString( 320, 440, "0 = NO LIMIT", UI_CENTER|UI_SMALLFONT, colorWhite ); } /* =============== ServerOptions_LevelshotDraw =============== */ static void ServerOptions_LevelshotDraw( void *self ) { menubitmap_s *b; int x; int y; // strange place for this, but it works if( s_serveroptions.newBot ) { Q_strncpyz( s_serveroptions.playerNameBuffers[s_serveroptions.newBotIndex], s_serveroptions.newBotName, 16 ); s_serveroptions.newBot = qfalse; } b = (menubitmap_s *)self; Bitmap_Draw( b ); x = b->generic.x; y = b->generic.y + b->height; UI_FillRect( MAKE_GFIXED(x), MAKE_GFIXED(y), MAKE_GFIXED(b->width), GFIXED(40,0), colorBlack ); x += b->width / 2; y += 4; UI_DrawString( x, y, s_serveroptions.mapnamebuffer, UI_CENTER|UI_SMALLFONT, color_orange ); y += SMALLCHAR_HEIGHT; UI_DrawString( x, y, gametype_items[gametype_remap2[s_serveroptions.gametype]], UI_CENTER|UI_SMALLFONT, color_orange ); } static void ServerOptions_InitBotNames( void ) { int count; int n; const char *arenaInfo; const char *botInfo; char *p; const char *bot; char bots[MAX_INFO_STRING]; if( s_serveroptions.gametype >= GT_TEAM ) { Q_strncpyz( s_serveroptions.playerNameBuffers[1], "grunt", 16 ); Q_strncpyz( s_serveroptions.playerNameBuffers[2], "major", 16 ); if( s_serveroptions.gametype == GT_TEAM ) { Q_strncpyz( s_serveroptions.playerNameBuffers[3], "visor", 16 ); } else { s_serveroptions.playerType[3].curvalue = 2; } s_serveroptions.playerType[4].curvalue = 2; s_serveroptions.playerType[5].curvalue = 2; Q_strncpyz( s_serveroptions.playerNameBuffers[6], "sarge", 16 ); Q_strncpyz( s_serveroptions.playerNameBuffers[7], "grunt", 16 ); Q_strncpyz( s_serveroptions.playerNameBuffers[8], "major", 16 ); if( s_serveroptions.gametype == GT_TEAM ) { Q_strncpyz( s_serveroptions.playerNameBuffers[9], "visor", 16 ); } else { s_serveroptions.playerType[9].curvalue = 2; } s_serveroptions.playerType[10].curvalue = 2; s_serveroptions.playerType[11].curvalue = 2; return; } count = 1; // skip the first slot, reserved for a human // get info for this map arenaInfo = UI_GetArenaInfoByMap( s_serveroptions.mapnamebuffer ); // get the bot info - we'll seed with them if any are listed Q_strncpyz( bots, Info_ValueForKey( arenaInfo, "bots" ), sizeof(bots) ); p = &bots[0]; while( *p && count < PLAYER_SLOTS ) { //skip spaces while( *p && *p == ' ' ) { p++; } if( !p ) { break; } // mark start of bot name bot = p; // skip until space of null while( *p && *p != ' ' ) { p++; } if( *p ) { *p++ = 0; } botInfo = UI_GetBotInfoByName( bot ); bot = Info_ValueForKey( botInfo, "name" ); Q_strncpyz( s_serveroptions.playerNameBuffers[count], bot, sizeof(s_serveroptions.playerNameBuffers[count]) ); count++; } // set the rest of the bot slots to "---" for( n = count; n < PLAYER_SLOTS; n++ ) { strcpy( s_serveroptions.playerNameBuffers[n], "--------" ); } // pad up to #8 as open slots for( ;count < 8; count++ ) { s_serveroptions.playerType[count].curvalue = 0; } // close off the rest by default for( ;count < PLAYER_SLOTS; count++ ) { if( s_serveroptions.playerType[count].curvalue == 1 ) { s_serveroptions.playerType[count].curvalue = 2; } } } /* ================= ServerOptions_SetMenuItems ================= */ static void ServerOptions_SetMenuItems( void ) { static char picname[64]; switch( s_serveroptions.gametype ) { case GT_FFA: default: Com_sprintf( s_serveroptions.fraglimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(999,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_ffa_fraglimit" )) )) ); Com_sprintf( s_serveroptions.timelimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(999,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_ffa_timelimit" )) )) ); break; case GT_TOURNAMENT: Com_sprintf( s_serveroptions.fraglimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(999,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_tourney_fraglimit" )) )) ); Com_sprintf( s_serveroptions.timelimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(999,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_tourney_timelimit" )) )) ); break; case GT_TEAM: Com_sprintf( s_serveroptions.fraglimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(999,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_team_fraglimit" )) )) ); Com_sprintf( s_serveroptions.timelimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(999,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_team_timelimit" )) ) )); s_serveroptions.friendlyfire.curvalue = FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED_1, MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_team_friendly" )) )); break; case GT_CTF: Com_sprintf( s_serveroptions.flaglimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(100,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_ctf_capturelimit" ))) ) ); Com_sprintf( s_serveroptions.timelimit.field.buffer, 4, "%i", FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(999,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_ctf_timelimit" )) )) ); s_serveroptions.friendlyfire.curvalue = FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED_1, MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "ui_ctf_friendly" )) )); break; } Q_strncpyz( s_serveroptions.hostname.field.buffer, UI_Cvar_VariableString( "sv_hostname" ), sizeof( s_serveroptions.hostname.field.buffer ) ); s_serveroptions.pure.curvalue = FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED_1, MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "sv_pure" )) )); // set the map pic Com_sprintf( picname, 64, "levelshots/%s", s_startserver.maplist[s_startserver.currentmap] ); s_serveroptions.mappic.generic.name = picname; // set the map name strcpy( s_serveroptions.mapnamebuffer, s_startserver.mapname.string ); Q_strupr( s_serveroptions.mapnamebuffer ); // get the player selections initialized ServerOptions_InitPlayerItems(); ServerOptions_SetPlayerItems(); // seed bot names ServerOptions_InitBotNames(); ServerOptions_SetPlayerItems(); } /* ================= PlayerName_Draw ================= */ static void PlayerName_Draw( void *item ) { menutext_s *s; gfixed *color; int x, y; int style; qboolean focus; s = (menutext_s *)item; x = s->generic.x; y = s->generic.y; style = UI_SMALLFONT; focus = (s->generic.parent->cursor == s->generic.menuPosition); if ( s->generic.flags & QMF_GRAYED ) color = text_color_disabled; else if ( focus ) { color = text_color_highlight; style |= UI_PULSE; } else if ( s->generic.flags & QMF_BLINK ) { color = text_color_highlight; style |= UI_BLINK; } else color = text_color_normal; if ( focus ) { // draw cursor UI_FillRect( MAKE_GFIXED(s->generic.left), MAKE_GFIXED(s->generic.top), MAKE_GFIXED(s->generic.right-s->generic.left+1), MAKE_GFIXED(s->generic.bottom-s->generic.top+1), listbar_color ); UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, color); } UI_DrawString( x - SMALLCHAR_WIDTH, y, s->generic.name, style|UI_RIGHT, color ); UI_DrawString( x + SMALLCHAR_WIDTH, y, s->string, style|UI_LEFT, color ); } /* ================= ServerOptions_MenuInit ================= */ #define OPTIONS_X 456 static void ServerOptions_MenuInit( qboolean multiplayer ) { int y; int n; memset( &s_serveroptions, 0 ,sizeof(serveroptions_t) ); s_serveroptions.multiplayer = multiplayer; s_serveroptions.gametype = FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED(5,0), MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "g_gameType" )) )); s_serveroptions.punkbuster.curvalue = FIXED_TO_INT(Com_Clamp( GFIXED_0, GFIXED_1, MAKE_GFIXED(_UI_trap_Cvar_VariableValue( "sv_punkbuster" )) )); ServerOptions_Cache(); s_serveroptions.menu.wrapAround = qtrue; s_serveroptions.menu.fullscreen = qtrue; s_serveroptions.banner.generic.type = MTYPE_BTEXT; s_serveroptions.banner.generic.x = 320; s_serveroptions.banner.generic.y = 16; s_serveroptions.banner.string = strdup("GAME SERVER"); s_serveroptions.banner.color = color_white; s_serveroptions.banner.style = UI_CENTER; s_serveroptions.mappic.generic.type = MTYPE_BITMAP; s_serveroptions.mappic.generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE; s_serveroptions.mappic.generic.x = 352; s_serveroptions.mappic.generic.y = 80; s_serveroptions.mappic.width = 160; s_serveroptions.mappic.height = 120; s_serveroptions.mappic.errorpic = GAMESERVER_UNKNOWNMAP; s_serveroptions.mappic.generic.ownerdraw = ServerOptions_LevelshotDraw; s_serveroptions.picframe.generic.type = MTYPE_BITMAP; s_serveroptions.picframe.generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE|QMF_HIGHLIGHT; s_serveroptions.picframe.generic.x = 352 - 38; s_serveroptions.picframe.generic.y = 80 - 40; s_serveroptions.picframe.width = 320; s_serveroptions.picframe.height = 320; s_serveroptions.picframe.focuspic = GAMESERVER_SELECT; y = 272; if( s_serveroptions.gametype != GT_CTF ) { s_serveroptions.fraglimit.generic.type = MTYPE_FIELD; s_serveroptions.fraglimit.generic.name = "Frag Limit:"; s_serveroptions.fraglimit.generic.flags = QMF_NUMBERSONLY|QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.fraglimit.generic.x = OPTIONS_X; s_serveroptions.fraglimit.generic.y = y; s_serveroptions.fraglimit.generic.statusbar = ServerOptions_StatusBar; s_serveroptions.fraglimit.field.widthInChars = 3; s_serveroptions.fraglimit.field.maxchars = 3; } else { s_serveroptions.flaglimit.generic.type = MTYPE_FIELD; s_serveroptions.flaglimit.generic.name = "Capture Limit:"; s_serveroptions.flaglimit.generic.flags = QMF_NUMBERSONLY|QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.flaglimit.generic.x = OPTIONS_X; s_serveroptions.flaglimit.generic.y = y; s_serveroptions.flaglimit.generic.statusbar = ServerOptions_StatusBar; s_serveroptions.flaglimit.field.widthInChars = 3; s_serveroptions.flaglimit.field.maxchars = 3; } y += BIGCHAR_HEIGHT+2; s_serveroptions.timelimit.generic.type = MTYPE_FIELD; s_serveroptions.timelimit.generic.name = "Time Limit:"; s_serveroptions.timelimit.generic.flags = QMF_NUMBERSONLY|QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.timelimit.generic.x = OPTIONS_X; s_serveroptions.timelimit.generic.y = y; s_serveroptions.timelimit.generic.statusbar = ServerOptions_StatusBar; s_serveroptions.timelimit.field.widthInChars = 3; s_serveroptions.timelimit.field.maxchars = 3; if( s_serveroptions.gametype >= GT_TEAM ) { y += BIGCHAR_HEIGHT+2; s_serveroptions.friendlyfire.generic.type = MTYPE_RADIOBUTTON; s_serveroptions.friendlyfire.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.friendlyfire.generic.x = OPTIONS_X; s_serveroptions.friendlyfire.generic.y = y; s_serveroptions.friendlyfire.generic.name = "Friendly Fire:"; } y += BIGCHAR_HEIGHT+2; s_serveroptions.pure.generic.type = MTYPE_RADIOBUTTON; s_serveroptions.pure.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.pure.generic.x = OPTIONS_X; s_serveroptions.pure.generic.y = y; s_serveroptions.pure.generic.name = "Pure Server:"; if( s_serveroptions.multiplayer ) { y += BIGCHAR_HEIGHT+2; s_serveroptions.dedicated.generic.type = MTYPE_SPINCONTROL; s_serveroptions.dedicated.generic.id = ID_DEDICATED; s_serveroptions.dedicated.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.dedicated.generic.callback = ServerOptions_Event; s_serveroptions.dedicated.generic.x = OPTIONS_X; s_serveroptions.dedicated.generic.y = y; s_serveroptions.dedicated.generic.name = "Dedicated:"; s_serveroptions.dedicated.itemnames = dedicated_list; } if( s_serveroptions.multiplayer ) { y += BIGCHAR_HEIGHT+2; s_serveroptions.hostname.generic.type = MTYPE_FIELD; s_serveroptions.hostname.generic.name = "Hostname:"; s_serveroptions.hostname.generic.flags = QMF_SMALLFONT; s_serveroptions.hostname.generic.x = OPTIONS_X; s_serveroptions.hostname.generic.y = y; s_serveroptions.hostname.field.widthInChars = 18; s_serveroptions.hostname.field.maxchars = 64; } y += BIGCHAR_HEIGHT+2; s_serveroptions.punkbuster.generic.type = MTYPE_SPINCONTROL; s_serveroptions.punkbuster.generic.name = "Punkbuster:"; s_serveroptions.punkbuster.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.punkbuster.generic.id = 0; s_serveroptions.punkbuster.generic.x = OPTIONS_X; s_serveroptions.punkbuster.generic.y = y; s_serveroptions.punkbuster.itemnames = punkbuster_items; y = 80; s_serveroptions.botSkill.generic.type = MTYPE_SPINCONTROL; s_serveroptions.botSkill.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; s_serveroptions.botSkill.generic.name = "Bot Skill: "; s_serveroptions.botSkill.generic.x = 32 + (strlen(s_serveroptions.botSkill.generic.name) + 2 ) * SMALLCHAR_WIDTH; s_serveroptions.botSkill.generic.y = y; s_serveroptions.botSkill.itemnames = botSkill_list; s_serveroptions.botSkill.curvalue = 1; y += ( 2 * SMALLCHAR_HEIGHT ); s_serveroptions.player0.generic.type = MTYPE_TEXT; s_serveroptions.player0.generic.flags = QMF_SMALLFONT; s_serveroptions.player0.generic.x = 32 + SMALLCHAR_WIDTH; s_serveroptions.player0.generic.y = y; s_serveroptions.player0.color = color_orange; s_serveroptions.player0.style = UI_LEFT|UI_SMALLFONT; for( n = 0; n < PLAYER_SLOTS; n++ ) { s_serveroptions.playerType[n].generic.type = MTYPE_SPINCONTROL; s_serveroptions.playerType[n].generic.flags = QMF_SMALLFONT; s_serveroptions.playerType[n].generic.id = ID_PLAYER_TYPE; s_serveroptions.playerType[n].generic.callback = ServerOptions_Event; s_serveroptions.playerType[n].generic.x = 32; s_serveroptions.playerType[n].generic.y = y; s_serveroptions.playerType[n].itemnames = playerType_list; s_serveroptions.playerName[n].generic.type = MTYPE_TEXT; s_serveroptions.playerName[n].generic.flags = QMF_SMALLFONT; s_serveroptions.playerName[n].generic.x = 96; s_serveroptions.playerName[n].generic.y = y; s_serveroptions.playerName[n].generic.callback = ServerOptions_PlayerNameEvent; s_serveroptions.playerName[n].generic.id = n; s_serveroptions.playerName[n].generic.ownerdraw = PlayerName_Draw; s_serveroptions.playerName[n].color = color_orange; s_serveroptions.playerName[n].style = UI_SMALLFONT; s_serveroptions.playerName[n].string = s_serveroptions.playerNameBuffers[n]; s_serveroptions.playerName[n].generic.top = s_serveroptions.playerName[n].generic.y; s_serveroptions.playerName[n].generic.bottom = s_serveroptions.playerName[n].generic.y + SMALLCHAR_HEIGHT; s_serveroptions.playerName[n].generic.left = s_serveroptions.playerName[n].generic.x - SMALLCHAR_HEIGHT/ 2; s_serveroptions.playerName[n].generic.right = s_serveroptions.playerName[n].generic.x + 16 * SMALLCHAR_WIDTH; s_serveroptions.playerTeam[n].generic.type = MTYPE_SPINCONTROL; s_serveroptions.playerTeam[n].generic.flags = QMF_SMALLFONT; s_serveroptions.playerTeam[n].generic.x = 240; s_serveroptions.playerTeam[n].generic.y = y; s_serveroptions.playerTeam[n].itemnames = playerTeam_list; y += ( SMALLCHAR_HEIGHT + 4 ); } s_serveroptions.back.generic.type = MTYPE_BITMAP; s_serveroptions.back.generic.name = GAMESERVER_BACK0; s_serveroptions.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_serveroptions.back.generic.callback = ServerOptions_Event; s_serveroptions.back.generic.id = ID_BACK; s_serveroptions.back.generic.x = 0; s_serveroptions.back.generic.y = 480-64; s_serveroptions.back.width = 128; s_serveroptions.back.height = 64; s_serveroptions.back.focuspic = GAMESERVER_BACK1; s_serveroptions.next.generic.type = MTYPE_BITMAP; s_serveroptions.next.generic.name = GAMESERVER_NEXT0; s_serveroptions.next.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_INACTIVE|QMF_GRAYED|QMF_HIDDEN; s_serveroptions.next.generic.callback = ServerOptions_Event; s_serveroptions.next.generic.id = ID_STARTSERVERNEXT; s_serveroptions.next.generic.x = 640; s_serveroptions.next.generic.y = 480-64-72; s_serveroptions.next.generic.statusbar = ServerOptions_StatusBar; s_serveroptions.next.width = 128; s_serveroptions.next.height = 64; s_serveroptions.next.focuspic = GAMESERVER_NEXT1; s_serveroptions.go.generic.type = MTYPE_BITMAP; s_serveroptions.go.generic.name = GAMESERVER_FIGHT0; s_serveroptions.go.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; s_serveroptions.go.generic.callback = ServerOptions_Event; s_serveroptions.go.generic.id = ID_GO; s_serveroptions.go.generic.x = 640; s_serveroptions.go.generic.y = 480-64; s_serveroptions.go.width = 128; s_serveroptions.go.height = 64; s_serveroptions.go.focuspic = GAMESERVER_FIGHT1; Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.banner ); Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.mappic ); Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.picframe ); Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.botSkill ); Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.player0 ); for( n = 0; n < PLAYER_SLOTS; n++ ) { if( n != 0 ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerType[n] ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerName[n] ); if( s_serveroptions.gametype >= GT_TEAM ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerTeam[n] ); } } if( s_serveroptions.gametype != GT_CTF ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.fraglimit ); } else { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.flaglimit ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit ); if( s_serveroptions.gametype >= GT_TEAM ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.pure ); if( s_serveroptions.multiplayer ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.dedicated ); } if( s_serveroptions.multiplayer ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.hostname ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.back ); Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.next ); Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.go ); Menu_AddItem( &s_serveroptions.menu, (void*) &s_serveroptions.punkbuster ); ServerOptions_SetMenuItems(); } /* ================= ServerOptions_Cache ================= */ void ServerOptions_Cache( void ) { _UI_trap_R_RegisterShaderNoMip( GAMESERVER_BACK0 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_BACK1 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_FIGHT0 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_FIGHT1 ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_SELECT ); _UI_trap_R_RegisterShaderNoMip( GAMESERVER_UNKNOWNMAP ); } /* ================= UI_ServerOptionsMenu ================= */ static void UI_ServerOptionsMenu( qboolean multiplayer ) { ServerOptions_MenuInit( multiplayer ); UI_PushMenu( &s_serveroptions.menu ); } /* ============================================================================= BOT SELECT MENU ***** ============================================================================= */ #define BOTSELECT_BACK0 "menu/art/back_0" #define BOTSELECT_BACK1 "menu/art/back_1" #define BOTSELECT_ACCEPT0 "menu/art/accept_0" #define BOTSELECT_ACCEPT1 "menu/art/accept_1" #define BOTSELECT_SELECT "menu/art/opponents_select" #define BOTSELECT_SELECTED "menu/art/opponents_selected" #define BOTSELECT_ARROWS "menu/art/gs_arrows_0" #define BOTSELECT_ARROWSL "menu/art/gs_arrows_l" #define BOTSELECT_ARROWSR "menu/art/gs_arrows_r" #define PLAYERGRID_COLS 4 #define PLAYERGRID_ROWS 4 #define MAX_MODELSPERPAGE (PLAYERGRID_ROWS * PLAYERGRID_COLS) typedef struct { menuframework_s menu; menutext_s banner; menubitmap_s pics[MAX_MODELSPERPAGE]; menubitmap_s picbuttons[MAX_MODELSPERPAGE]; menutext_s picnames[MAX_MODELSPERPAGE]; menubitmap_s arrows; menubitmap_s left; menubitmap_s right; menubitmap_s go; menubitmap_s back; int numBots; int modelpage; int numpages; int selectedmodel; int sortedBotNums[MAX_BOTS]; char boticons[MAX_MODELSPERPAGE][MAX_QPATH]; char botnames[MAX_MODELSPERPAGE][16]; } botSelectInfo_t; static botSelectInfo_t botSelectInfo; /* ================= UI_BotSelectMenu_SortCompare ================= */ static int QDECL UI_BotSelectMenu_SortCompare( const void *arg1, const void *arg2 ) { int num1, num2; const char *info1, *info2; const char *name1, *name2; num1 = *(int *)arg1; num2 = *(int *)arg2; info1 = UI_GetBotInfoByNumber( num1 ); info2 = UI_GetBotInfoByNumber( num2 ); name1 = Info_ValueForKey( info1, "name" ); name2 = Info_ValueForKey( info2, "name" ); return Q_stricmp( name1, name2 ); } /* ================= UI_BotSelectMenu_BuildList ================= */ static void UI_BotSelectMenu_BuildList( void ) { int n; botSelectInfo.modelpage = 0; botSelectInfo.numBots = UI_GetNumBots(); botSelectInfo.numpages = botSelectInfo.numBots / MAX_MODELSPERPAGE; if( botSelectInfo.numBots % MAX_MODELSPERPAGE ) { botSelectInfo.numpages++; } // initialize the array for( n = 0; n < botSelectInfo.numBots; n++ ) { botSelectInfo.sortedBotNums[n] = n; } // now sort it qsort( botSelectInfo.sortedBotNums, botSelectInfo.numBots, sizeof(botSelectInfo.sortedBotNums[0]), UI_BotSelectMenu_SortCompare ); } /* ================= ServerPlayerIcon ================= */ static void ServerPlayerIcon( const char *modelAndSkin, char *iconName, int iconNameMaxSize ) { const char *skin; char *pskin; char model[MAX_QPATH]; Q_strncpyz( model, modelAndSkin, sizeof(model)); pskin = Q_strrchr( model, '/' ); if ( pskin ) { *pskin++ = '\0'; skin=pskin; } else { skin = "default"; } Com_sprintf(iconName, iconNameMaxSize, "models/players/%s/icon_%s.tga", model, skin ); if( !_UI_trap_R_RegisterShaderNoMip( iconName ) && Q_stricmp( skin, "default" ) != 0 ) { Com_sprintf(iconName, iconNameMaxSize, "models/players/%s/icon_default.tga", model ); } } /* ================= UI_BotSelectMenu_UpdateGrid ================= */ static void UI_BotSelectMenu_UpdateGrid( void ) { const char *info; int i; int j; j = botSelectInfo.modelpage * MAX_MODELSPERPAGE; for( i = 0; i < (PLAYERGRID_ROWS * PLAYERGRID_COLS); i++, j++) { if( j < botSelectInfo.numBots ) { info = UI_GetBotInfoByNumber( botSelectInfo.sortedBotNums[j] ); ServerPlayerIcon( Info_ValueForKey( info, "model" ), botSelectInfo.boticons[i], MAX_QPATH ); Q_strncpyz( botSelectInfo.botnames[i], Info_ValueForKey( info, "name" ), 16 ); Q_CleanStr( botSelectInfo.botnames[i] ); botSelectInfo.pics[i].generic.name = botSelectInfo.boticons[i]; if( BotAlreadySelected( botSelectInfo.botnames[i] ) ) { botSelectInfo.picnames[i].color = color_red; } else { botSelectInfo.picnames[i].color = color_orange; } botSelectInfo.picbuttons[i].generic.flags &= ~QMF_INACTIVE; } else { // dead slot botSelectInfo.pics[i].generic.name = NULL; botSelectInfo.picbuttons[i].generic.flags |= QMF_INACTIVE; botSelectInfo.botnames[i][0] = 0; } botSelectInfo.pics[i].generic.flags &= ~QMF_HIGHLIGHT; botSelectInfo.pics[i].shader = 0; botSelectInfo.picbuttons[i].generic.flags |= QMF_PULSEIFFOCUS; } // set selected model i = botSelectInfo.selectedmodel % MAX_MODELSPERPAGE; botSelectInfo.pics[i].generic.flags |= QMF_HIGHLIGHT; botSelectInfo.picbuttons[i].generic.flags &= ~QMF_PULSEIFFOCUS; if( botSelectInfo.numpages > 1 ) { if( botSelectInfo.modelpage > 0 ) { botSelectInfo.left.generic.flags &= ~QMF_INACTIVE; } else { botSelectInfo.left.generic.flags |= QMF_INACTIVE; } if( botSelectInfo.modelpage < (botSelectInfo.numpages - 1) ) { botSelectInfo.right.generic.flags &= ~QMF_INACTIVE; } else { botSelectInfo.right.generic.flags |= QMF_INACTIVE; } } else { // hide left/right markers botSelectInfo.left.generic.flags |= QMF_INACTIVE; botSelectInfo.right.generic.flags |= QMF_INACTIVE; } } /* ================= UI_BotSelectMenu_Default ================= */ static void UI_BotSelectMenu_Default( char *bot ) { const char *botInfo; const char *test; int n; int i; for( n = 0; n < botSelectInfo.numBots; n++ ) { botInfo = UI_GetBotInfoByNumber( n ); test = Info_ValueForKey( botInfo, "name" ); if( Q_stricmp( bot, test ) == 0 ) { break; } } if( n == botSelectInfo.numBots ) { botSelectInfo.selectedmodel = 0; return; } for( i = 0; i < botSelectInfo.numBots; i++ ) { if( botSelectInfo.sortedBotNums[i] == n ) { break; } } if( i == botSelectInfo.numBots ) { botSelectInfo.selectedmodel = 0; return; } botSelectInfo.selectedmodel = i; } /* ================= UI_BotSelectMenu_LeftEvent ================= */ static void UI_BotSelectMenu_LeftEvent( void* ptr, int event ) { if( event != QM_ACTIVATED ) { return; } if( botSelectInfo.modelpage > 0 ) { botSelectInfo.modelpage--; botSelectInfo.selectedmodel = botSelectInfo.modelpage * MAX_MODELSPERPAGE; UI_BotSelectMenu_UpdateGrid(); } } /* ================= UI_BotSelectMenu_RightEvent ================= */ static void UI_BotSelectMenu_RightEvent( void* ptr, int event ) { if( event != QM_ACTIVATED ) { return; } if( botSelectInfo.modelpage < botSelectInfo.numpages - 1 ) { botSelectInfo.modelpage++; botSelectInfo.selectedmodel = botSelectInfo.modelpage * MAX_MODELSPERPAGE; UI_BotSelectMenu_UpdateGrid(); } } /* ================= UI_BotSelectMenu_BotEvent ================= */ static void UI_BotSelectMenu_BotEvent( void* ptr, int event ) { int i; if( event != QM_ACTIVATED ) { return; } for( i = 0; i < (PLAYERGRID_ROWS * PLAYERGRID_COLS); i++ ) { botSelectInfo.pics[i].generic.flags &= ~QMF_HIGHLIGHT; botSelectInfo.picbuttons[i].generic.flags |= QMF_PULSEIFFOCUS; } // set selected i = ((menucommon_s*)ptr)->id; botSelectInfo.pics[i].generic.flags |= QMF_HIGHLIGHT; botSelectInfo.picbuttons[i].generic.flags &= ~QMF_PULSEIFFOCUS; botSelectInfo.selectedmodel = botSelectInfo.modelpage * MAX_MODELSPERPAGE + i; } /* ================= UI_BotSelectMenu_BackEvent ================= */ static void UI_BotSelectMenu_BackEvent( void* ptr, int event ) { if( event != QM_ACTIVATED ) { return; } UI_PopMenu(); } /* ================= UI_BotSelectMenu_SelectEvent ================= */ static void UI_BotSelectMenu_SelectEvent( void* ptr, int event ) { if( event != QM_ACTIVATED ) { return; } UI_PopMenu(); s_serveroptions.newBot = qtrue; Q_strncpyz( s_serveroptions.newBotName, botSelectInfo.botnames[botSelectInfo.selectedmodel % MAX_MODELSPERPAGE], 16 ); } /* ================= UI_BotSelectMenu_Cache ================= */ void UI_BotSelectMenu_Cache( void ) { _UI_trap_R_RegisterShaderNoMip( BOTSELECT_BACK0 ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_BACK1 ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_ACCEPT0 ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_ACCEPT1 ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_SELECT ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_SELECTED ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_ARROWS ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_ARROWSL ); _UI_trap_R_RegisterShaderNoMip( BOTSELECT_ARROWSR ); } static void UI_BotSelectMenu_Init( char *bot ) { int i, j, k; int x, y; memset( &botSelectInfo, 0 ,sizeof(botSelectInfo) ); botSelectInfo.menu.wrapAround = qtrue; botSelectInfo.menu.fullscreen = qtrue; UI_BotSelectMenu_Cache(); botSelectInfo.banner.generic.type = MTYPE_BTEXT; botSelectInfo.banner.generic.x = 320; botSelectInfo.banner.generic.y = 16; botSelectInfo.banner.string = strdup("SELECT BOT"); botSelectInfo.banner.color = color_white; botSelectInfo.banner.style = UI_CENTER; y = 80; for( i = 0, k = 0; i < PLAYERGRID_ROWS; i++) { x = 180; for( j = 0; j < PLAYERGRID_COLS; j++, k++ ) { botSelectInfo.pics[k].generic.type = MTYPE_BITMAP; botSelectInfo.pics[k].generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE; botSelectInfo.pics[k].generic.x = x; botSelectInfo.pics[k].generic.y = y; botSelectInfo.pics[k].generic.name = botSelectInfo.boticons[k]; botSelectInfo.pics[k].width = 64; botSelectInfo.pics[k].height = 64; botSelectInfo.pics[k].focuspic = BOTSELECT_SELECTED; botSelectInfo.pics[k].focuscolor = colorRed; botSelectInfo.picbuttons[k].generic.type = MTYPE_BITMAP; botSelectInfo.picbuttons[k].generic.flags = QMF_LEFT_JUSTIFY|QMF_NODEFAULTINIT|QMF_PULSEIFFOCUS; botSelectInfo.picbuttons[k].generic.callback = UI_BotSelectMenu_BotEvent; botSelectInfo.picbuttons[k].generic.id = k; botSelectInfo.picbuttons[k].generic.x = x - 16; botSelectInfo.picbuttons[k].generic.y = y - 16; botSelectInfo.picbuttons[k].generic.left = x; botSelectInfo.picbuttons[k].generic.top = y; botSelectInfo.picbuttons[k].generic.right = x + 64; botSelectInfo.picbuttons[k].generic.bottom = y + 64; botSelectInfo.picbuttons[k].width = 128; botSelectInfo.picbuttons[k].height = 128; botSelectInfo.picbuttons[k].focuspic = BOTSELECT_SELECT; botSelectInfo.picbuttons[k].focuscolor = colorRed; botSelectInfo.picnames[k].generic.type = MTYPE_TEXT; botSelectInfo.picnames[k].generic.flags = QMF_SMALLFONT; botSelectInfo.picnames[k].generic.x = x + 32; botSelectInfo.picnames[k].generic.y = y + 64; botSelectInfo.picnames[k].string = botSelectInfo.botnames[k]; botSelectInfo.picnames[k].color = color_orange; botSelectInfo.picnames[k].style = UI_CENTER|UI_SMALLFONT; x += (64 + 6); } y += (64 + SMALLCHAR_HEIGHT + 6); } botSelectInfo.arrows.generic.type = MTYPE_BITMAP; botSelectInfo.arrows.generic.name = BOTSELECT_ARROWS; botSelectInfo.arrows.generic.flags = QMF_INACTIVE; botSelectInfo.arrows.generic.x = 260; botSelectInfo.arrows.generic.y = 440; botSelectInfo.arrows.width = 128; botSelectInfo.arrows.height = 32; botSelectInfo.left.generic.type = MTYPE_BITMAP; botSelectInfo.left.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; botSelectInfo.left.generic.callback = UI_BotSelectMenu_LeftEvent; botSelectInfo.left.generic.x = 260; botSelectInfo.left.generic.y = 440; botSelectInfo.left.width = 64; botSelectInfo.left.height = 32; botSelectInfo.left.focuspic = BOTSELECT_ARROWSL; botSelectInfo.right.generic.type = MTYPE_BITMAP; botSelectInfo.right.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; botSelectInfo.right.generic.callback = UI_BotSelectMenu_RightEvent; botSelectInfo.right.generic.x = 321; botSelectInfo.right.generic.y = 440; botSelectInfo.right.width = 64; botSelectInfo.right.height = 32; botSelectInfo.right.focuspic = BOTSELECT_ARROWSR; botSelectInfo.back.generic.type = MTYPE_BITMAP; botSelectInfo.back.generic.name = BOTSELECT_BACK0; botSelectInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; botSelectInfo.back.generic.callback = UI_BotSelectMenu_BackEvent; botSelectInfo.back.generic.x = 0; botSelectInfo.back.generic.y = 480-64; botSelectInfo.back.width = 128; botSelectInfo.back.height = 64; botSelectInfo.back.focuspic = BOTSELECT_BACK1; botSelectInfo.go.generic.type = MTYPE_BITMAP; botSelectInfo.go.generic.name = BOTSELECT_ACCEPT0; botSelectInfo.go.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; botSelectInfo.go.generic.callback = UI_BotSelectMenu_SelectEvent; botSelectInfo.go.generic.x = 640; botSelectInfo.go.generic.y = 480-64; botSelectInfo.go.width = 128; botSelectInfo.go.height = 64; botSelectInfo.go.focuspic = BOTSELECT_ACCEPT1; Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.banner ); for( i = 0; i < MAX_MODELSPERPAGE; i++ ) { Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.pics[i] ); Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.picbuttons[i] ); Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.picnames[i] ); } Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.arrows ); Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.left ); Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.right ); Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.back ); Menu_AddItem( &botSelectInfo.menu, &botSelectInfo.go ); UI_BotSelectMenu_BuildList(); UI_BotSelectMenu_Default( bot ); botSelectInfo.modelpage = botSelectInfo.selectedmodel / MAX_MODELSPERPAGE; UI_BotSelectMenu_UpdateGrid(); } /* ================= UI_BotSelectMenu ================= */ void UI_BotSelectMenu( char *bot ) { UI_BotSelectMenu_Init( bot ); UI_PushMenu( &botSelectInfo.menu ); }
[ "jack.palevich@684fc592-8442-0410-8ea1-df6b371289ac", "crioux@684fc592-8442-0410-8ea1-df6b371289ac" ]
[ [ [ 1, 117 ], [ 119, 119 ], [ 122, 399 ], [ 401, 894 ], [ 896, 900 ], [ 902, 1033 ], [ 1035, 1241 ], [ 1243, 1603 ], [ 1606, 1608 ], [ 1613, 1847 ], [ 1849, 1967 ] ], [ [ 118, 118 ], [ 120, 121 ], [ 400, 400 ], [ 895, 895 ], [ 901, 901 ], [ 1034, 1034 ], [ 1242, 1242 ], [ 1604, 1605 ], [ 1609, 1612 ], [ 1848, 1848 ] ] ]
72e3d5b2e288f5e8295168ce56031eabe9c318d0
c70941413b8f7bf90173533115c148411c868bad
/plugins/OpenGLPlugin/src/vtxopenglMovableMovie.cpp
5ab892952488928cece15f438cd69dcd68609580
[]
no_license
cnsuhao/vektrix
ac6e028dca066aad4f942b8d9eb73665853fbbbe
9b8c5fa7119ff7f3dc80fb05b7cdba335cf02c1a
refs/heads/master
2021-06-23T11:28:34.907098
2011-03-27T17:39:37
2011-03-27T17:39:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,838
cpp
/* ----------------------------------------------------------------------------- This source file is part of "vektrix" (the rich media and vector graphics rendering library) For the latest info, see http://www.fuse-software.com/ Copyright (c) 2009-2010 Fuse-Software (tm) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- */ #include "vtxopenglMovableMovie.h" __n(vtx)__n(opengl) //----------------------------------------------------------------------- MovableMovie::MovableMovie(const String& name, MovieFactory* creator) : Movie(name, creator) { } //----------------------------------------------------------------------- MovableMovie::~MovableMovie() { } //----------------------------------------------------------------------- }}
[ "stonecold_@9773a11d-1121-4470-82d2-da89bd4a628a" ]
[ [ [ 1, 44 ] ] ]
74ffa0b363a896ee29fb3d86048f21c5b0ddd9a5
23017336d25e6ec49c4a51f11c1b3a3aa10acf22
/csc3750/prog6/Node.cpp
8a7be5dc64bae413bf7aac71b3db0451734e882b
[]
no_license
tjshaffer21/School
5e7681c96e0c10966fc7362931412c4244507911
4aa5fc3a8bbbbb8d46d045244e8a7f84e71c768f
refs/heads/master
2020-05-27T19:05:06.422314
2011-05-17T19:55:40
2011-05-17T19:55:40
1,681,224
1
1
null
2017-07-29T13:35:54
2011-04-29T15:36:55
C++
UTF-8
C++
false
false
149
cpp
#include "Node.h" Node::Node() : DeleteObject() { transform = Matrix::getIdentityMatrix(4); } Node::~Node() { delete transform; }
[ [ [ 1, 11 ] ] ]
1fb1de9cd42cd65c7ede299d1260809eb42fb535
aefc3d630a28e054a438d13ab16d32f2d39ccb1e
/FontList.cpp
035dbc80e24536e7bc8442f7e9c40e5275074066
[]
no_license
imcooder/publicwince
e64305d86496b550116c312d2e9a67e7fb33c6f8
58a337768161e1a10664b4d5edc2aadfb2ab1328
refs/heads/master
2021-05-28T10:40:35.786601
2010-06-27T06:25:09
2010-06-27T06:25:09
32,301,144
1
0
null
null
null
null
UTF-8
C++
false
false
2,651
cpp
#include "stdafx.h" #include "FontList.h" #include <algorithm> BOOL LogfontCmp (LPLOGFONT pFontA, LPLOGFONT pFontB ) { if (!pFontA || !pFontB) { return FALSE; } return 0 >= _tcsicmp(pFontA->lfFaceName, pFontB->lfFaceName); } CXUE_FontList::CXUE_FontList() { } CXUE_FontList::~CXUE_FontList() { FreeFonts(); } BOOL CALLBACK CXUE_FontList::EnumFontFamExProc(ENUMLOGFONTEX* pelf,NEWTEXTMETRICEX* lpntm, DWORD dwFontType, LPARAM lParam) { CXUE_FontList* pFontEnum = (CXUE_FontList*)lParam; if (pFontEnum) { if (pFontEnum->AddFont(&pelf->elfLogFont, dwFontType)) { } } return TRUE; } void CXUE_FontList::Create(BYTE nCharSet) { FreeFonts(); LOGFONT logfont; logfont.lfFaceName[0] = 0; logfont.lfCharSet = nCharSet; HDC hDC = GetDC(NULL); ::EnumFontFamiliesEx(hDC, &logfont, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)this, 0); ReleaseDC(NULL, hDC); hDC = NULL; m_listpFonts.sort(LogfontCmp); //std::sort(m_listpFonts.begin(), m_listpFonts.end()/*, LogfontCmp*/); } BOOL CXUE_FontList::AddFont(const LOGFONT* pLF, DWORD dwType) { if (!pLF) { return FALSE; } if (DoesFontExist(pLF->lfFaceName)) { return FALSE; } LPLOGFONT pLogfont = new LOGFONT; if (pLogfont) { memcpy(pLogfont, pLF, sizeof(*pLF)); } m_listpFonts.push_back(pLogfont); return TRUE; } BOOL CXUE_FontList::DoesFontExist(LPCTSTR pszFaceName) { if (!pszFaceName) { return FALSE; } LPLOGFONT pLogfont = GetLogFont(pszFaceName); return !!pLogfont; } LPLOGFONT CXUE_FontList::GetLogFont(LPCTSTR pszFaceName) { std::list<LPLOGFONT>::iterator itlstTravel = m_listpFonts.begin(); while(itlstTravel != m_listpFonts.end()) { if (0 == _tcsicmp(pszFaceName, (*itlstTravel)->lfFaceName)) { break; } itlstTravel ++; } if (itlstTravel != m_listpFonts.end()) { return *itlstTravel; } return NULL; } void CXUE_FontList::FreeFonts() { std::list<LPLOGFONT>::iterator itlstTravel = m_listpFonts.begin(); while (itlstTravel != m_listpFonts.end()) { SAFE_DELETE(*itlstTravel); itlstTravel ++; } m_listpFonts.clear(); } UINT CXUE_FontList::GetCount() const { return m_listpFonts.size(); } LPLOGFONT CXUE_FontList::GetFontByIndex( UINT nIdx) { std::list<LPLOGFONT>::iterator itlstTravel = m_listpFonts.begin(); while (itlstTravel != m_listpFonts.end()) { if (nIdx <= 0) { break; } itlstTravel ++; nIdx --; } if (itlstTravel != m_listpFonts.end()) { return *itlstTravel; } return NULL; }
[ "[email protected]@a9ac5a9c-960a-11de-b8e1-0bcae535652c" ]
[ [ [ 1, 138 ] ] ]
46d8ecc6f23fbf73d305bcc0028cf793abc84032
a21de044e9c5b4ed3777817cabb728c62f7315fc
/ocean_domination/Helper.h
f7490b5f95b9bbf31f04408ace908f0dd3ba1970
[]
no_license
alyshamsy/oceandomination
9470889b9f051086b047f7dbc7e6de4f289d2da9
3580c399537045c8ad0817bc7a9d81d24c85a925
refs/heads/master
2020-03-30T05:30:08.981859
2011-05-12T15:47:06
2011-05-12T15:47:06
32,115,468
0
0
null
null
null
null
UTF-8
C++
false
false
503
h
#ifndef Helper_H #define Helper_H #include <GL/glfw.h> #include <string> #include <math.h> #include <vector> #include <sstream> using namespace std; GLfloat** generate_vector(int rows, int cols); void delete_vector(GLfloat** my_vector, int row); GLfloat random_number_generator(int low_bound, int high_bound, float seed); float getHypotenuse(float a, float b); float getSmallestValue(vector<float> arr, int& index); string intToString(int a); string floatToString(float a); #endif
[ "aly.shamsy@b23e3eda-3cbb-b783-0003-8fc1c118d970" ]
[ [ [ 1, 20 ] ] ]
eec63ff2f0de4667c799cdfeb2e87cce67fcc729
a2ba072a87ab830f5343022ed11b4ac365f58ef0
/ urt-bumpy-q3map2 --username [email protected]/libs/generic/arrayrange.cpp
58f717dcf16fc741924d84a5136dfe4e4c41bfa4
[]
no_license
Garey27/urt-bumpy-q3map2
7d0849fc8eb333d9007213b641138e8517aa092a
fcc567a04facada74f60306c01e68f410cb5a111
refs/heads/master
2021-01-10T17:24:51.991794
2010-06-22T13:19:24
2010-06-22T13:19:24
43,057,943
0
0
null
null
null
null
UTF-8
C++
false
false
29
cpp
#include "arrayrange.h"
[ [ [ 1, 3 ] ] ]
83573b4dabad33e1e4076e8dda5e40894599d511
38763b01d06c87ff1164877f57fc22d0da2927e4
/src/imageb_player/imgproc/frmProcSinal.h
e31e76de2623d60cda0ba0f9d11df65fb019b2e5
[]
no_license
JPSGoncalves/ImageB
48b31b83bb1c032394c14e1df5ed90e2a285a521
135ccb9847f9e3394f2391417885d753a5b3a930
refs/heads/master
2023-03-17T03:57:10.299812
2011-07-20T16:59:41
2011-07-20T16:59:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,354
h
#ifndef FRMPROCSINAL_H #define FRMPROCSINAL_H #include "ui_frmProcSinal.h" #include "imageproc.h" #include "imageb.h" #include "setupsinal.h" #include <qwt_plot.h> #include <qwt_plot_curve.h> //! global variable extern SetupSinal signal_setup; using namespace std; class frmProcSinal : public QWidget, private Ui::frmProcSinal { Q_OBJECT public: frmProcSinal(QWidget *parent = 0); void loadData(); void configPlots(); void writeMatrixData(Matrix, string); void copyData(SetupSinal, SetupSinal&); private: //! class for image processing ImageProc imgproc; //! class for process ultrasound images ImageB imageB; //! matrix data from RF signal Matrix rfdata; //! envelope data from RF signal Matrix env; //! envelope and gain data from RF signal Matrix env_gain; //! gain vector to be applied to RF signal Matrix gain; //! threshold vector Matrix limiar; //! processed matrix data from RF signal Matrix proc_data; //! buffer matrix data from RF signal Matrix mat; //! Signal configuration setup SetupSinal ssetup; bool setDefault; signals: void setupChanged(); private slots: void chgData(); void botApplyClicked(); void botResetClicked(); }; #endif
[ [ [ 1, 64 ] ] ]
d8de448e3079f929c2ae69d5ce8b17e4c813547f
0c5fd443401312fafae18ea6a9d17bac9ee61474
/code/engine/Core/Archiver.h
e7c71cf22d44225512ef0fe32d38aa9c89a9c140
[]
no_license
nurF/Brute-Force-Game-Engine
fcfebc997d6ab487508a5706b849e9d7bc66792d
b930472429ec6d6f691230e36076cd2c868d853d
refs/heads/master
2021-01-18T09:29:44.038036
2011-12-02T17:31:59
2011-12-02T17:31:59
2,877,061
1
0
null
null
null
null
UTF-8
C++
false
false
7,593
h
/* ___ _________ ____ __ / _ )/ __/ ___/____/ __/___ ___ _/_/___ ___ / _ / _// (_ //___/ _/ / _ | _ `/ // _ | -_) /____/_/ \___/ /___//_//_|_, /_//_//_|__/ /___/ This file is part of the Brute-Force Game Engine, BFG-Engine For the latest info, see http://www.brute-force-games.com Copyright (c) 2011 Brute-Force Games GbR The BFG-Engine is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The BFG-Engine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the BFG-Engine. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _BFGARCHIVER_H #define _BFGARCHIVER_H #ifdef _MSC_VER #pragma warning( disable: 4996 ) // This will stop all nasty unsafe POSIX methods warnings #endif #include <map> #include <vector> #include <string> #include <boost/iostreams/stream.hpp> namespace io = boost::iostreams; #define STD_SIMULTAN_OPEN 50 #define MAX_MERGE_FRAGSIZE 2048 #define MAX_FILENAME 1024 // #define CACHE_RESIZE_DELTA 4096 typedef std::vector<char> char_vec; typedef unsigned long long uint64; // GCC doesn't know __int64! typedef uint64 size_tbig; // Device - A shell to access virtual file through boost streams ///////////////////////////////////////// class ArchivContainer; class VirtualFile; class VirtualFileDevice { public: typedef char char_type; typedef io::seekable_device_tag category; VirtualFileDevice( ArchivContainer * aCont, VirtualFile * aFile ) : cont( aCont ), file( aFile ) { } virtual ~VirtualFileDevice() { } inline std::streamsize read(char_type* s, std::streamsize n); inline std::streamsize write(const char_type* s, std::streamsize n); inline io::stream_offset seek(io::stream_offset off, std::ios_base::seekdir way); private: ArchivContainer * cont; VirtualFile * file; }; // Virtual file - stream implementation and openable by archive frontend interface ///////////////////////////////////////// class VirtualFile : public io::stream<VirtualFileDevice> { friend class ArchivContainer; friend class VirtualFileDevice; protected: VirtualFile( ArchivContainer * aCont ); virtual ~VirtualFile(); public: void fileClose(); inline bool isModified() { return bModified; } private: // Shadow chunks for caching write access differences struct ShadowChunk { // TODO: Allow temporary file chunks for very huge sizes ShadowChunk * next; ShadowChunk * prev; char_vec memory; size_t localStartPos; size_t localEndPos; }; ShadowChunk * injectChunk(); void deleteChunk( ShadowChunk * p ); ShadowChunk * createChunkAt( ShadowChunk * before = NULL ); void mergeBack(); // merges ShadowChunk fragments with backend content into a single ShadowChunk void deleteCache(); // Backend access std::streamsize readBackend(VirtualFileDevice::char_type* s, std::streamsize n); std::streamsize writeBackend(const VirtualFileDevice::char_type* s, std::streamsize n); // File access. (Both cache and backend) std::streamsize readFile(char_type* s, std::streamsize n); io::stream_offset seekFile(io::stream_offset off, std::ios_base::seekdir way); // Cache access std::streamsize readCache(char_type* s, std::streamsize n); std::streamsize writeCache(const char_type* s, std::streamsize n); private: ArchivContainer * cont; size_t hndIdx; size_t dirIdx; bool bModified; // cache ShadowChunk * firstChunk; ShadowChunk * lastChunk; // position & size size_t localPos; size_t fileSize; ShadowChunk * curNextChunk; // backend stream entry io::stream_offset backendPos; size_t backendSize; // if 0 then backend isn't existing // .... }; typedef std::vector<VirtualFile *> VirtualFile_ptrVec; ///// //// //// inline std::streamsize VirtualFileDevice::read(VirtualFileDevice::char_type* s, std::streamsize n) { std::streamsize sz = file->readFile( s, n ); // EOF if( sz == 0 && file->localPos == file->fileSize ) return -1; return sz; } inline std::streamsize VirtualFileDevice::write(const VirtualFileDevice::char_type* s, std::streamsize n) { return file->writeCache( s, n ); } inline io::stream_offset VirtualFileDevice::seek(io::stream_offset off, std::ios_base::seekdir way) { return file->seekFile( off, way ); } // Archiv itself - splits a backend stream into virtual files at frontend ///////////////////////////////////////// class ArchivContainer { friend class VirtualFile; public: ArchivContainer(); virtual ~ArchivContainer(); // backend methods template<class T> bool assignBackend( T& newBackend ) { if( bModified || openFileHandles.size() > 0 ) return false; // invalid operation if( backend != NULL ) delete backend; backend = new BackendInterface_Impl<T>( newBackend ); clearContent(); scanCatalogue(); return true; } void flushBuffer(); // frontend methods VirtualFile * fileOpen( std::string fileName ); bool deleteFile( std::string fileName ); size_t getFileCount() const; const char * getFileName( size_t atIndex ) const; public: struct Directory { size_t index; std::string fileName; // if 0, then file is new size_t lumpSize; size_t fileSize; // fileSize <= lumpSize - headerSize with padding io::stream_offset dataPos; VirtualFile * ref; bool bIsDeleted; }; private: void scanCatalogue(); void cleanupSlots(); void clearContent(); // Backend access struct BackendInterface { virtual std::streamsize read(VirtualFileDevice::char_type* s, std::streamsize n) = 0; virtual std::streamsize write(const VirtualFileDevice::char_type* s, std::streamsize n) = 0; virtual io::stream_offset seekg(io::stream_offset off, std::ios::seekdir way) = 0; virtual io::stream_offset tellg() = 0; virtual size_tbig truncate( size_tbig fileSize ) = 0; }; template<class T> struct BackendInterface_Impl : public BackendInterface { BackendInterface_Impl( T& aStrm ) : strm_( &aStrm ) {} std::streamsize read(VirtualFileDevice::char_type* s, std::streamsize n) { /* io::stream_offset oldPos = strm_->tellg(); strm_->read( s, n ); return strm_->tellg() - oldPos;*/ return strm_->readsome( s, n ); } std::streamsize write(const VirtualFileDevice::char_type* s, std::streamsize n) { io::stream_offset oldPos = strm_->tellg(); strm_->write( s, n ); return strm_->tellg() - oldPos; } io::stream_offset seekg(io::stream_offset off, std::ios::seekdir way) { strm_->seekg( off, way ); return strm_->tellg(); } io::stream_offset tellg() { return strm_->tellg(); } size_tbig truncate( size_tbig fileSize ) { // TODO: ... return 0; } T * strm_; }; private: typedef std::vector<Directory *> Directory_ptrVec; typedef std::map<std::string, size_t> strIdx_map; strIdx_map fileMap; Directory_ptrVec catalogue; VirtualFile_ptrVec openFileHandles; BackendInterface * backend; bool bModified; }; #endif
[ [ [ 1, 277 ] ] ]
70551e9a9ca1ecc532a9fe1cab907a2647fed6ca
741b36f4ddf392c4459d777930bc55b966c2111a
/incubator/deeppurple/lwplugins/lwwrapper/PluginTemplates/HandlerItemRend.h
7e43bd7c6837e343a260d266e9a5a069d6a4089c
[]
no_license
BackupTheBerlios/lwpp-svn
d2e905641f60a7c9ca296d29169c70762f5a9281
fd6f80cbba14209d4ca639f291b1a28a0ed5404d
refs/heads/master
2021-01-17T17:01:31.802187
2005-10-16T22:12:52
2005-10-16T22:12:52
40,805,554
0
0
null
null
null
null
UTF-8
C++
false
false
2,052
h
// HandlerItemRend.h: interface for the HandlerItemRend class. // ////////////////////////////////////////////////////////////////////// #ifndef HANDLERITEMREND_INCLUDED #define HANDLERITEMREND_INCLUDED #include "HandlerItem.h" /** * Base Template for all Lightwave Pluigns using Handler and Item and Render functions. * @author David Forstenlechner * @date 2002-2003 */ template <class T> class HandlerItemRend : public HandlerItem<T> { public: HandlerItemRend(const char *classname, const char *name, ActivateFunc *Starter, ServerTagInfo *srvinfo); virtual ~HandlerItemRend(); static LWError Init_Callback ( LWInstance inst, int Mode ); static void Cleanup_Callback ( LWInstance inst ); static LWError NewTime_Callback ( LWInstance inst, LWFrame Frame, LWTime Time ); static int HandlerItemRend_Callback ( GlobalFunc *global, LWInstanceFuncs *inst, LWItemFuncs *item, LWRenderFuncs *rend ); }; template <class T> HandlerItemRend<T>::HandlerItemRend(const char *classname, const char *name, ActivateFunc *Starter, ServerTagInfo *srvinfo) : HandlerItem<T>(classname, name, Starter, srvinfo) {} template <class T> HandlerItemRend<T>::~HandlerItemRend() {} template <class T> LWError HandlerItemRend<T>::Init_Callback ( LWInstance inst, int Mode ) { ((T*)inst)->Init(Mode); return NULL; } template <class T> void HandlerItemRend<T>::Cleanup_Callback ( LWInstance inst ) { ((T*)inst)->Cleanup(); } template <class T> LWError HandlerItemRend<T>::NewTime_Callback ( LWInstance inst, LWFrame Frame, LWTime Time ) { ((T*)inst)->NewTime( Frame, Time ); return NULL; } template <class T> int HandlerItemRend<T>::HandlerItemRend_Callback ( GlobalFunc *global, LWInstanceFuncs *inst, LWItemFuncs *item, LWRenderFuncs *rend ) { if (rend) { rend->init=Init_Callback; rend->cleanup=Cleanup_Callback; rend->newTime=NewTime_Callback; } return HandlerItem_Callback( global, inst, item ); } #endif // HANDLERITEMREND_INCLUDED
[ "deeppurple@dac1304f-7ce9-0310-a59f-f2d444f72a61" ]
[ [ [ 1, 63 ] ] ]
325aadd530ea1e3a3762b88bb619bf693823ac7e
64f1bedba44187266c515a293664dd30300061a9
/src/vmobjects/VMInvokable.cpp
1dcd2e65ad5bc027aa3d6f5ba6d58a8257dce942
[]
no_license
SOM-st/ActorSOMpp
ad6721df1dd2c80928fef59f0c88e531a3c80d50
a985469633ca5c7293ca621a99a22143ab4bca3f
refs/heads/master
2021-01-20T01:27:51.212730
2009-11-11T14:16:29
2009-11-11T14:16:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,805
cpp
/* * * Copyright (c) 2007 Michael Haupt, Tobias Pape, Arne Bergmann Software Architecture Group, Hasso Plattner Institute, Potsdam, Germany http://www.hpi.uni-potsdam.de/swa/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "VMInvokable.h" #include "VMSymbol.h" #include "VMClass.h" VMInvokable::VMInvokable(int nof) : VMObject(nof + 2), signature(nilObject), holder(nilObject) { } bool VMInvokable::IsPrimitive() const { return false; } pVMSymbol VMInvokable::GetSignature() const { return signature; } void VMInvokable::SetSignature(pVMSymbol sig) { signature = sig; } pVMClass VMInvokable::GetHolder() const { return holder; } void VMInvokable::SetHolder(pVMClass hld) { holder = hld; }
[ "" ]
[ [ [ 1, 58 ] ] ]
21d47d1ed7771064c35007bb3f328617492d32e2
b2152621ad4ace91bcf18f22c3196819e0d3a48a
/src/cam_capture.cpp
ce5fbfe8ed8df3525ca970e85584b6f954cb24fd
[]
no_license
skorfmann/camellia
e1335c06dae5b951e6b4d6c32dffcc485d2848ea
2c44f7bb07c23a1c63383cf9fd2922ee565de154
refs/heads/master
2020-02-26T17:44:34.471955
2011-10-04T08:20:46
2011-10-04T08:20:46
3,002,672
0
0
null
null
null
null
UTF-8
C++
false
false
31,591
cpp
#include "camellia.h" #include "camellia_internals.h" #ifdef HAVE_CONFIG_H #include "config.h" #endif // Can't compile DirectShow code with VC++ 6.0 #ifdef CAM_DIRECTSHOW #include "cam_capture.h" #include <winbase.h> CamCaptureGraph::CamCaptureGraph() { // Put the pointers to NULL to indicate no initialization yet m_pCaptureGraphBuilder2 = NULL; m_pGraphBuilder = NULL; m_pMediaControl = NULL; m_pVideoWindow = NULL; m_pFilterGraph = NULL; m_pMediaSeeking = NULL; m_pSrcFilter = NULL; // Default setup for the render methods m_pRenderCWnd = NULL; // show video in new window m_fIsCapturing = false; // no preview live capture m_fIsScaling = false; // no scaling m_showVideoFlag = false; // never display the video content by default // Do we want the filter graph to be viewable to GraphEdit m_fRegisterFilterGraph = true; m_dwGraphRegister = 0; // init it to indicate if it is registered. // Desired default video format: 320x240 * 15 fps m_desiredFrameRate = 15; m_desiredHeight = 240; m_desiredWidth = 320; } CamCaptureGraph::~CamCaptureGraph() { // Release resouses destroyFilterGraph(); } bool CamCaptureGraph::buildRenderFileGraph() { HRESULT hr; addExtraFilters(); hr = m_pGraphBuilder->RenderFile( m_aVName , NULL ); if (FAILED(hr)) return false; hr = m_pGraphBuilder->QueryInterface(IID_IMediaSeeking,(void**)&m_pMediaSeeking); if (FAILED(hr)) { m_pMediaSeeking = NULL; return false;} m_pMediaSeeking->SetTimeFormat(&TIME_FORMAT_FRAME); return true; } bool CamCaptureGraph::buildCaptureGraph(IBaseFilter * pSrcFilter ) { HRESULT hr = CoCreateInstance (CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC, IID_ICaptureGraphBuilder2, (void **) &m_pCaptureGraphBuilder2); if (FAILED(hr)) return false; // unable to build graph // Attach the filter graph to the capture graph hr = m_pCaptureGraphBuilder2->SetFiltergraph(m_pGraphBuilder); if (FAILED(hr)) return false; // unable to build graph if (pSrcFilter == 0) { // Use the system device enumerator and class enumerator to find // a video capture/preview device, such as a desktop USB video camera. hr = findCaptureDevice(&pSrcFilter); if (FAILED(hr)) return false; // unable to build graph } m_pSrcFilter = pSrcFilter; // Add Capture filter to our graph. hr = m_pGraphBuilder->AddFilter(pSrcFilter, L"Video Capture"); addExtraFilters(); if (FAILED(hr)) return false; // unable to build graph // Connect the extra filters into the graph IPin* pSourceOut = get_pin( pSrcFilter, PINDIR_OUTPUT ); hr = m_pGraphBuilder->Render( pSourceOut ); if (FAILED(hr)) return false; // unable to build graph // Now that the filter has been added to the graph and we have // rendered its stream, we can release this reference to the filter. SafeRelease( pSourceOut ); // Don't release the source filter, it will be released in the destructor //SafeRelease( pSrcFilter ); return true; } bool CamCaptureGraph::createFilterGraph() { IPin* pGrabIn = NULL, *pGrabOut = NULL; HRESULT hr; hr = CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&m_pGraphBuilder ); if (FAILED(hr)) return false; // unable to build graph else { m_pGraphBuilder->QueryInterface(IID_IMediaControl,(void**)&m_pMediaControl); m_pGraphBuilder->QueryInterface(IID_IVideoWindow, (void**)&m_pVideoWindow ); m_pGraphBuilder->QueryInterface(IID_IFilterGraph, (void**)&m_pFilterGraph); if (m_fIsCapturing) // Create the capture graph builder { if (!buildCaptureGraph()) return false; } else // Render a video file { if (!buildRenderFileGraph()) return false; } } // Do some initialization of the extra filters initExtraFilters(); // release the Pin SafeRelease( pGrabIn ); SafeRelease( pGrabOut ); return true; // success build the graph } void CamCaptureGraph::destroyFilterGraph() { this->m_fstartGraph= false; stopGraph(); // release the DirectShow Objects SafeRelease( m_pVideoWindow ); SafeRelease( m_pGraphBuilder ); SafeRelease( m_pCaptureGraphBuilder2 ); SafeRelease( m_pMediaControl ); SafeRelease( m_pFilterGraph ); SafeRelease( m_pMediaSeeking ); SafeRelease( m_pSrcFilter ); // release the extra filters resource releaseExtraFilters(); } void CamCaptureGraph::startGraph() { HRESULT hr; long w, h; RECT rc; if( m_pMediaControl ) { if (m_pRenderCWnd) { // has render window m_pVideoWindow->put_Owner((OAHWND)m_pRenderCWnd); //m_pVideoWindow->put_Owner(NULL); // use NULL to display in a seperate window m_pVideoWindow->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN); m_pVideoWindow->put_MessageDrain((OAHWND)m_pRenderCWnd ); //m_pVideoWindow->put_MessageDrain(0); // Get the dimension of the video source through the IBasicVideo interface. IBasicVideo *pBasicVideo; // used to get the video source's dimension m_pGraphBuilder->QueryInterface(IID_IBasicVideo, (void **)&pBasicVideo); pBasicVideo->get_SourceWidth(&w); pBasicVideo->get_SourceHeight(&h); SafeRelease(pBasicVideo); // The window's client area GetClientRect(m_pRenderCWnd, &rc ); if (!m_fIsScaling) // display at original size m_pVideoWindow->SetWindowPosition( 0, 0, w, h ); else // if want the video to take full window m_pVideoWindow->SetWindowPosition( rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top ); } // Add the graph to Rot so that the graphedit can view it if (m_dwGraphRegister) { hr = addGraphToRot(m_pGraphBuilder, &m_dwGraphRegister); if (FAILED(hr)) { // Msg(TEXT("Failed to register filter graph with ROT! hr=0x%x"), hr); m_dwGraphRegister = 0; } } //hr = m_pMediaControl->Run(); } } void CamCaptureGraph::stopGraph() { if( m_pMediaControl ) { m_pMediaControl->Stop(); m_pVideoWindow->put_Visible(OAFALSE); m_pVideoWindow->put_Owner(NULL); m_pVideoWindow->put_MessageDrain(0); } if (m_dwGraphRegister) removeGraphFromRot(m_dwGraphRegister); } HRESULT CamCaptureGraph::findCaptureDevice(IBaseFilter ** ppSrcFilter) { HRESULT hr; IBaseFilter * pSrc = NULL; CComPtr <IMoniker> pMoniker =NULL; ULONG cFetched; // Create the system device enumerator CComPtr <ICreateDevEnum> pDevEnum =NULL; hr = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, IID_ICreateDevEnum, (void ** ) &pDevEnum); // Create an enumerator for the video capture devices CComPtr <IEnumMoniker> pClassEnum = NULL; hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &pClassEnum, 0); if (pClassEnum == NULL) return E_FAIL; // Use the first video capture device on the device list. // Note that if the Next() call succeeds but there are no monikers, // it will return S_FALSE (which is not a failure). Therefore, we // check that the return code is S_OK instead of using SUCCEEDED() macro. if (S_OK == (pClassEnum->Next (1, &pMoniker, &cFetched))) { // Bind Moniker to a filter object hr = pMoniker->BindToObject(0,0,IID_IBaseFilter, (void**)&pSrc); if (FAILED(hr)) { // Msg(TEXT("Couldn't bind moniker to filter object! hr=0x%x"), hr); return hr; } } else { // Msg(TEXT("Unable to access video capture device!")); return E_FAIL; } // Copy the found filter pointer to the output parameter. // Do NOT Release() the reference, since it will still be used // by the calling function. *ppSrcFilter = pSrc; return hr; } IPin* CamCaptureGraph::get_pin( IBaseFilter* pFilter, PIN_DIRECTION dir ) { IEnumPins* pEnumPins = 0; IPin* pPin = 0; if( pFilter ) { pFilter->EnumPins( &pEnumPins ); if( pEnumPins != 0 ) { for(;;) { ULONG cFetched = 0; PIN_DIRECTION pinDir = PIN_DIRECTION(-1); pPin = 0; pEnumPins->Next( 1, &pPin, &cFetched ); if( cFetched == 1 && pPin != 0 ) { pPin->QueryDirection( &pinDir ); if( pinDir == dir ) break; pPin->Release(); } } pEnumPins->Release(); } } return pPin; } HRESULT CamCaptureGraph::addGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister) { IMoniker * pMoniker; IRunningObjectTable *pROT; WCHAR wsz[128]; HRESULT hr; if (FAILED(GetRunningObjectTable(0, &pROT))) { return E_FAIL; } wsprintfW(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph, GetCurrentProcessId()); hr = CreateItemMoniker(L"!", wsz, &pMoniker); if (SUCCEEDED(hr)) { hr = pROT->Register(0, pUnkGraph, pMoniker, pdwRegister); pMoniker->Release(); } pROT->Release(); return hr; } void CamCaptureGraph::removeGraphFromRot(DWORD pdwRegister) { IRunningObjectTable *pROT; if (SUCCEEDED(GetRunningObjectTable(0, &pROT))) { pROT->Revoke(pdwRegister); pROT->Release(); } } void CamCaptureGraph::RenderFile(char * vname) { destroyFilterGraph(); m_fIsCapturing = false; if( vname && strlen(vname) > 0 ) // change to wide character MultiByteToWideChar( CP_ACP, 0, vname, -1, m_aVName, sizeof(m_aVName)/2 ); else // did not specify the file name, will be asked in createFilterGraph() *m_aVName = '\0'; if (createFilterGraph()) startGraph(); else { destroyFilterGraph(); MessageBox(NULL, "Unable to build Filter Graph", NULL, MB_OK|MB_ICONEXCLAMATION|MB_TASKMODAL); } } bool CamCaptureGraph::CaptureLive(bool fSetup) { destroyFilterGraph(); m_fIsCapturing = true; m_fShowCaptureProperties = fSetup; if (createFilterGraph()) { startGraph(); return true; } else { destroyFilterGraph(); return false; } } LONGLONG CamCaptureGraph::Seek(int offset) { LONGLONG cur_pos = 0; if (m_pMediaSeeking) { m_pMediaControl->Pause(); m_pMediaSeeking->GetCurrentPosition(&cur_pos); cur_pos += offset; m_pMediaSeeking->SetPositions(&cur_pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); m_pMediaControl->StopWhenReady(); } return cur_pos; }; bool CamCaptureGraph::createFilterGraph(IMoniker *videoDevice) { IPin* pGrabIn = NULL, *pGrabOut = NULL; HRESULT hr; IBaseFilter *psrcFilter = 0; hr = CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&m_pGraphBuilder ); if (FAILED(hr)) return false; // unable to build graph else { m_pGraphBuilder->QueryInterface(IID_IMediaControl,(void**)&m_pMediaControl); m_pGraphBuilder->QueryInterface(IID_IVideoWindow, (void**)&m_pVideoWindow ); m_pGraphBuilder->QueryInterface(IID_IFilterGraph, (void**)&m_pFilterGraph); if (m_fIsCapturing) { // Create the capture graph builder if(videoDevice != 0) { IPropertyBag *pBag; hr = videoDevice->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag); if(SUCCEEDED(hr)) { VARIANT var; var.vt = VT_BSTR; hr = pBag->Read(L"FriendlyName", &var, NULL); if (hr == NOERROR) { lstrcpyW(m_aVName, var.bstrVal); SysFreeString(var.bstrVal); } pBag->Release(); } hr = videoDevice->BindToObject(0, 0, IID_IBaseFilter, (void**)&psrcFilter); } buildCaptureGraph(psrcFilter); } else // Render a video file buildRenderFileGraph(); } // Do some initialization of the extra filters initExtraFilters(); // release the Pin SafeRelease( pGrabIn ); SafeRelease( pGrabOut ); this->m_fstartGraph = false; return true; // success build the graph } bool CamCaptureGraph::initCaptureLive (IMoniker * videoDevice, bool fSetup) { destroyFilterGraph(); m_fIsCapturing = true; m_fShowCaptureProperties = fSetup; if (!createFilterGraph(videoDevice)) { destroyFilterGraph(); MessageBox(NULL, "Unable to build Filter Graph", NULL, MB_OK|MB_ICONEXCLAMATION|MB_TASKMODAL); return false; } return true; } void CamCaptureGraph::Play(){ if (!this->m_fstartGraph) this->startGraph(); this->m_fstartGraph = true; m_pMediaControl->Run(); } void CamCaptureGraph::showPropPage() { if (m_pSrcFilter) { ISpecifyPropertyPages *pSpec; CAUUID cauuid; HRESULT hr; hr = m_pSrcFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpec); if (hr == S_OK) { // show dialog hr = pSpec->GetPages(&cauuid); hr = OleCreatePropertyFrame(m_pRenderCWnd, 30, 30, m_aVName, 1, (IUnknown **)& m_pSrcFilter, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL); // Release the memory CoTaskMemFree(cauuid.pElems); pSpec->Release(); } } } HRESULT CamCaptureGraph::selectVideoFormat() { IAMStreamConfig *pSC; // Get the Media Stream config interface HRESULT hr = m_pCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_pSrcFilter, IID_IAMStreamConfig, (void **)&pSC); if (!m_fShowCaptureProperties) { // get format being used NOW AM_MEDIA_TYPE *pmt; hr = pSC->GetFormat(&pmt); BITMAPINFOHEADER bih; bih.biBitCount = 16; bih.biClrImportant = 0; bih.biClrUsed = 0; bih.biCompression = 0; bih.biHeight = m_desiredHeight; bih.biPlanes = 1; bih.biSize = sizeof(BITMAPINFOHEADER); bih.biSizeImage = m_desiredHeight * m_desiredWidth * 16/ 8; bih.biWidth = m_desiredWidth; bih.biXPelsPerMeter = 0; bih.biYPelsPerMeter = 0; VIDEOINFOHEADER vih; vih.rcSource.top = 0; vih.rcSource.left = 0; vih.rcSource.bottom = 0; vih.rcSource.right = 0; vih.rcTarget.top = 0; vih.rcTarget.left = 0; vih.rcTarget.bottom = 0; vih.rcTarget.right = 0; vih.dwBitRate = m_desiredFrameRate* m_desiredHeight * m_desiredWidth*2; //15 * 640* 480* 24/ 8; vih.dwBitErrorRate = 0; vih.AvgTimePerFrame = 10000000 / m_desiredFrameRate; vih.bmiHeader = bih; pmt->bFixedSizeSamples = TRUE; pmt->bTemporalCompression = FALSE; pmt->cbFormat = sizeof(VIDEOINFOHEADER); pmt->formattype = FORMAT_VideoInfo; pmt->lSampleSize = m_desiredHeight * m_desiredWidth*2; //UYVY format //640* 480* 24 / 8; pmt->majortype = MEDIATYPE_Video; pmt->pbFormat = (unsigned char *)&vih; pmt->pUnk = 0; //pmt->subtype = MEDIASUBTYPE_UYVY; //MEDIASUBTYPE_RGB24; hr = pSC->SetFormat(pmt); } else { // set capture config by property page ISpecifyPropertyPages *pSpec; CAUUID cauuid; hr = pSC->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpec); if (hr == S_OK) { // show dialog hr = pSpec->GetPages(&cauuid); hr = OleCreatePropertyFrame(m_pRenderCWnd, 30, 30, NULL, 1, (IUnknown **)&pSC, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL); // Release the memory CoTaskMemFree(cauuid.pElems); pSpec->Release(); } } pSC->Release(); return hr; } void CamCaptureGraph::setDesiredVideoFormat(int w, int h, int fps) { m_desiredFrameRate = fps; m_desiredWidth = w; m_desiredHeight = h; } void CamCaptureGraph::setVideoFlag(bool flag) { m_showVideoFlag = flag; } static const GUID CLSID_ColorSpaceConverter = {0x1643E180,0x90F5,0x11CE, {0x97, 0xD5, 0x00, 0xAA, 0x00, 0x55, 0x59, 0x5A }}; CamCaptureGrabberCB::CamCaptureGrabberCB() { m_dFrameRate = 0; m_image = 0; InitializeCriticalSection(&m_cs); m_imageReady = CreateEvent(NULL, false, false, "ImageReady"); } CamCaptureGrabberCB::~CamCaptureGrabberCB() { DeleteCriticalSection(&m_cs); CloseHandle(m_imageReady); } // This callback function is called every time the new image frame is obtained STDMETHODIMP CamCaptureGrabberCB::SampleCB(double SampleTime, IMediaSample *pSample) { VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *) m_mediaType.pbFormat; BYTE *pData; // Pointer to the actual image buffer pSample->GetPointer(&pData); // Get the image properties from the BITMAPINFOHEADER m_imgWidth = pvi->bmiHeader.biWidth; m_imgHeight = pvi->bmiHeader.biHeight; EnterCriticalSection(&m_cs); // Successfully locked the resources if (m_image != 0) { if (m_image->imageData == NULL) { camAllocateImageEx(m_image, m_imgWidth, m_imgHeight, CAM_DEPTH_8U, CAM_CHANNELSEQ_BGR); } int size = pSample->GetSize(); // Image is reversed. for (int y=0;y<m_imgHeight;y++) { memcpy(m_image->imageData+y*m_image->widthStep, pData+m_imgWidth*3*(m_imgHeight-1-y), m_imgWidth*3); } SetEvent(m_imageReady); } LeaveCriticalSection(&m_cs); m_dFrameRate = 0.8 * m_dFrameRate + 0.2 / (SampleTime - m_dPrevTime); m_dPrevTime = SampleTime; return S_OK; } ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CamCaptureDirectShow::CamCaptureDirectShow() { // Set zero for the extra filter (ISampleGrabber) here m_pColorConv = NULL; m_pGrabFilter = NULL; m_pSampleGrabber = NULL; m_pTrackingCB = NULL; } CamCaptureDirectShow::~CamCaptureDirectShow() { destroyFilterGraph(); if (m_pTrackingCB) delete m_pTrackingCB; } void CamCaptureDirectShow::addExtraFilters() { // Instanciate the ISampleGrabber filter HRESULT hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (LPVOID *)&m_pGrabFilter); m_pGrabFilter->QueryInterface(IID_ISampleGrabber, (void **)&m_pSampleGrabber); if (FAILED(hr)) { MessageBox(NULL, "Fail to init ISampleGrabber", NULL, MB_OK|MB_ICONEXCLAMATION|MB_TASKMODAL); return; } // Specify what media type to process, to make sure it is connected correctly // We now process full decompressed RGB24 image data AM_MEDIA_TYPE mt; ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE)); mt.majortype = MEDIATYPE_Video; mt.subtype = MEDIASUBTYPE_RGB24; mt.formattype = FORMAT_VideoInfo; hr = m_pSampleGrabber->SetMediaType(&mt); // Set working mode as continuous with no buffer m_pSampleGrabber->SetOneShot(FALSE); m_pSampleGrabber->SetBufferSamples(FALSE); // add the grabber into the graph hr = m_pFilterGraph->AddFilter(m_pGrabFilter, L"Grabber"); // Sometimes, we may need the color converter to add in the SampleGrabber // Filter. So just add one into the graph. If it is needed, it will be used // Otherwise, it will be idle. hr = CoCreateInstance( CLSID_ColorSpaceConverter, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&m_pColorConv ); m_pFilterGraph->AddFilter(m_pColorConv, L"ColorChange"); // Normally, we dont need to connect the PIN by ourselves. // it will be correctly connected when using Render(). // So we do not connect these two filters together. if (m_showVideoFlag == false) { IBaseFilter * pNull; hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (LPVOID*) &pNull); m_pFilterGraph->AddFilter(pNull, L"NullRender"); // Null rendered is not automatically connect // Do the manual connection IPin* InPin; // renderer input IPin* OutPin; // decoder or other filter output; IEnumPins* EnumPins; ULONG fetched; pNull->EnumPins(&EnumPins); EnumPins->Reset(); EnumPins->Next(1, &InPin, &fetched); EnumPins->Release(); m_pColorConv->EnumPins(&EnumPins); EnumPins->Reset(); EnumPins->Next(1, &OutPin, &fetched); EnumPins->Release(); m_pGraphBuilder->Connect(OutPin, InPin); // we could release the reference to the null render // after it has been added to the video graph. //SafeRelease(pNull); } } void CamCaptureDirectShow::releaseExtraFilters() { // Stop the tracking // Release the resourse SafeRelease(m_pSampleGrabber); SafeRelease(m_pColorConv); SafeRelease(m_pGrabFilter); } bool CamCaptureDirectShow::initExtraFilters() { if (m_pSampleGrabber) { // Init the grabber filter AM_MEDIA_TYPE mt; // Set the CallBack Interface if (!m_pTrackingCB) m_pTrackingCB = new CamCaptureGrabberCB(); m_pSampleGrabber->SetCallback(m_pTrackingCB, 0); // Set the media type (needed to get the bmp header info m_pSampleGrabber->GetConnectedMediaType(&mt); m_pTrackingCB->SetGrabMediaType(mt); return true; } else return false; } // controlled access to the images CamImage *CamCaptureDirectShow::lockImage() { return m_pTrackingCB->lockImage(); } void CamCaptureDirectShow::unlockImage() { m_pTrackingCB->unlockImage(); } CamImage *CamCaptureGrabberCB::lockImage() { EnterCriticalSection(&m_cs); return m_image; } void CamCaptureGrabberCB::unlockImage() { LeaveCriticalSection(&m_cs); } CamImage *CamCaptureDirectShow::waitForImage(int timeout) { DWORD ret = WaitForSingleObject(m_pTrackingCB->m_imageReady, timeout); if (ret != WAIT_OBJECT_0) { throw "Timeout"; } return m_pTrackingCB->m_image; } void CamCaptureDirectShow::setImage(CamImage &image) { m_pTrackingCB->lockImage(); m_pTrackingCB->m_image=&image; m_pTrackingCB->unlockImage(); } bool CamCaptureDirectShow::buildCaptureGraph(IBaseFilter * pSrcFilter) { HRESULT hr = CoCreateInstance (CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC, IID_ICaptureGraphBuilder2, (void **) &m_pCaptureGraphBuilder2); if (FAILED(hr)) return false; // unable to build graph // Attach the filter graph to the capture graph hr = m_pCaptureGraphBuilder2->SetFiltergraph(m_pGraphBuilder); if (FAILED(hr)) return false; // unable to build graph if (pSrcFilter == 0) { // Use the system device enumerator and class enumerator to find // a video capture/preview device, such as a desktop USB video camera. hr = findCaptureDevice(&pSrcFilter); if (FAILED(hr)) return false; // unable to build graph } m_pSrcFilter = pSrcFilter; // Add Capture filter to our graph. hr = m_pGraphBuilder->AddFilter(pSrcFilter, L"Video Capture"); addExtraFilters(); if (FAILED(selectVideoFormat())) return false; // unable to build graph // Connect the extra filters into the graph IPin* pOut = get_pin( pSrcFilter, PINDIR_OUTPUT ); IPin * pIn = get_pin( m_pGrabFilter, PINDIR_INPUT); hr = m_pGraphBuilder->Connect(pOut, pIn); SafeRelease(pOut); SafeRelease(pIn); if (FAILED(hr)) return false; // unable to build graph pOut = get_pin(m_pGrabFilter, PINDIR_OUTPUT); hr = m_pGraphBuilder->Render( pOut ); SafeRelease(pOut); if (FAILED(hr)) return false; // unable to build graph // Now that the filter has been added to the graph and we have // rendered its stream, we can release this reference to the filter. // Don't release the source filter, it will be released in the destructor //SafeRelease( pSrcFilter ); return true; } CamCapture::CamCapture(int options) { CoInitialize(NULL); // First thing first, we must initalize the COM interface CamCaptureDirectShow *h=new CamCaptureDirectShow; handle=(void*)h; h->setVideoFlag((bool)(options & CAM_CAPTURE_DISPLAY)); if (!h->CaptureLive(!(options & CAM_CAPTURE_AUTO_SOURCE))) { delete h; handle=NULL; } else h->Play(); } CamCapture::~CamCapture() { delete (CamCaptureDirectShow*)handle; } bool CamCapture::capture(CamImage &image) { CamCaptureDirectShow *h=(CamCaptureDirectShow *)handle; if (h==NULL) return false; h->setImage(image); h->waitForImage(1000); return true; } #else #ifdef HAVE_LINUX_VIDEODEV_H #include <stdlib.h> #include <stdio.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <linux/videodev.h> typedef enum { IO_METHOD_READ, IO_METHOD_MMAP, } io_method; typedef struct _CamCaptureV4L { struct video_capability vid_cap; struct video_mbuf vid_buf; struct video_mmap vid_mmap; struct video_window vid_win; struct video_channel vid_chan; struct video_picture vid_pic; struct video_tuner vid_tuner; unsigned char *map; int fd; io_method io; } CamCaptureV4L; CamCapture::CamCapture(int options) { CamCaptureV4L *ptr=new CamCaptureV4L; handle=(void*)ptr; const char *sdevice = "/dev/video0"; ptr->fd = open(sdevice, O_RDWR /* required */ | O_NONBLOCK, 0); if (ptr->fd == -1) { char s[256]; sprintf(s, "Couldn't open %s", sdevice); camSetErrorStr(s); delete ptr; handle = NULL; return; } if (ioctl(ptr->fd, VIDIOCGCAP, &ptr->vid_cap) == -1) { delete ptr; handle = NULL; camError("CamCapture","VIDIOCGCAP"); return; } if (!(ptr->vid_cap.type & VID_TYPE_CAPTURE)) { delete ptr; handle = NULL; char s[256]; sprintf(s,"%s is not a video capture device",sdevice); camError("CamCapture",s); return; } ptr->map = (unsigned char *)-1; if ((options & CAM_CAPTURE_USE_READ) || (ioctl(ptr->fd, VIDIOCGMBUF, &ptr->vid_buf) == -1)) { ptr->io = IO_METHOD_READ; } else { ptr->io = IO_METHOD_MMAP; ptr->map = (unsigned char *)mmap(0, ptr->vid_buf.size, PROT_READ|PROT_WRITE, MAP_SHARED, ptr->fd, 0); if ((unsigned char *)-1 == (unsigned char *)ptr->map) { // fprintf(stderr,"mmap() failed: falling back to read() method"); ptr->io = IO_METHOD_READ; } } if (ioctl(ptr->fd, VIDIOCGWIN, &ptr->vid_win) == -1) { delete ptr; handle = NULL; camError("CamCapture","VIDIOCGWIN"); return; } if (ioctl(ptr->fd, VIDIOCGCHAN, &(ptr->vid_chan)) == -1) { delete ptr; handle = NULL; camError("CamCapture","VIDIOCGCHAN"); return; } ptr->vid_chan.channel = 0; ptr->vid_chan.norm = VIDEO_MODE_PAL; if (ioctl(ptr->fd, VIDIOCSCHAN, &(ptr->vid_chan)) == -1) { delete ptr; handle = NULL; camError("CamCapture","VIDIOCSCHAN"); return; } ptr->vid_mmap.format = VIDEO_PALETTE_RGB24; if (ioctl(ptr->fd, VIDIOCGPICT, &(ptr->vid_pic)) == -1) { delete ptr; handle = NULL; camError("CamCapture","VIDIOCGPICT"); return; } ptr->vid_pic.palette = VIDEO_PALETTE_RGB24; if (ioctl(ptr->fd, VIDIOCSPICT, &(ptr->vid_pic)) == -1) { delete ptr; handle = NULL; camError("CamCapture","VIDIOCSPICT"); return; } } CamCapture::~CamCapture() { CamCaptureV4L *ptr=(CamCaptureV4L*)handle; if (!ptr) return; if (ptr->io == IO_METHOD_MMAP) munmap(ptr->map, ptr->vid_buf.size); close(ptr->fd); delete ptr; } bool CamCapture::capture(CamImage &image) { CamCaptureV4L *ptr=(CamCaptureV4L*)handle; if (!ptr) return false; // Check image allocation if (image.imageData == NULL) { camAllocateRGBImage(&image,ptr->vid_win.width,ptr->vid_win.height); } if ((image.width != (int)ptr->vid_win.width)||(image.height != (int)ptr->vid_win.height)) { camDeallocateImage(&image); camAllocateRGBImage(&image,ptr->vid_win.width,ptr->vid_win.height); } // Video devices generally don't care about padding and lines alignement if ((int)ptr->vid_win.width*3 != image.widthStep) { return false; } unsigned long i, imgsz = ptr->vid_win.width * ptr->vid_win.height * 3; unsigned char buf, *p = image.imageData; switch(ptr->io) { case IO_METHOD_MMAP: ptr->vid_mmap.frame = 0; ptr->vid_mmap.width = ptr->vid_win.width; ptr->vid_mmap.height = ptr->vid_win.height; if(ioctl(ptr->fd, VIDIOCMCAPTURE, &ptr->vid_mmap) == -1) { camError("CamCapture","VIDIOCMCAPTURE"); return false; } if(ioctl(ptr->fd, VIDIOCSYNC, &ptr->vid_mmap.frame) == -1) { camError("CamCapture","VIDIOCSYNC"); return false; } memcpy(image.imageData,ptr->map,imgsz); break; case IO_METHOD_READ: while(read(ptr->fd, image.imageData, imgsz) <= 0); break; } // Converts from BGR to RGB i = ptr->vid_win.width * ptr->vid_win.height; while(0 < i) { buf = p[2]; p[2] = p[0]; p[0] = buf; p += 3; i--; } return true; } #else CamCapture::CamCapture(int options) { handle=NULL; } CamCapture::~CamCapture() { } bool CamCapture::capture(CamImage &image) { return false; } #endif #endif void* camCaptureInit(int options) { CamCapture *h=new CamCapture(options); if (!h->ready()) { delete h; return NULL; } return h; } int camCapture(void *handle, CamImage *image) { if (handle==NULL) return NULL; CamCapture *h=(CamCapture*)handle; return (h->capture(*image))?1:0; } int camCaptureOver(void *handle) { if (handle==NULL) return 1; CamCapture *h=(CamCapture*)handle; delete h; return 1; }
[ "steux@5540e480-7b0e-0410-ab5f-af3975b33bda" ]
[ [ [ 1, 1024 ] ] ]
396b166b9e2b3273c3d554911095521d6c1b17e6
611fc0940b78862ca89de79a8bbeab991f5f471a
/src/Event/ResetMobEvt.cpp
d2ccb43cd6837b312bdd9187484fddebf71653a9
[]
no_license
LakeIshikawa/splstage2
df1d8f59319a4e8d9375b9d3379c3548bc520f44
b4bf7caadf940773a977edd0de8edc610cd2f736
refs/heads/master
2021-01-10T21:16:45.430981
2010-01-29T08:57:34
2010-01-29T08:57:34
37,068,575
0
0
null
null
null
null
UTF-8
C++
false
false
180
cpp
#include "ResetMobEvt.h" ResetMobEvt::ResetMobEvt() {} ResetMobEvt::~ResetMobEvt() {} void ResetMobEvt::Trigger() { GAMECONTROL->GetMobManager()->InstantReset(); }
[ "lakeishikawa@c9935178-01ba-11df-8f7b-bfe16de6f99b" ]
[ [ [ 1, 12 ] ] ]
cf5da220db95f947b4ddf6b199c4012bb54e7dfa
508bfb3220be28811600a2cbf0aabae382f78775
/AcademicCrawler-sdk/Qt/Qt-4.6.2/include/QtCore/qdatetime.h
ab64862cdf313e87df0a408cd4fee3f5d0ff7a44
[]
no_license
darkbtf/academic-crawler
295f3bd74b18e700402bc2be59f15694d6195471
5dfcb0f1b88b93aa7545ef233344a41570011532
refs/heads/master
2021-01-01T19:21:00.162442
2011-03-10T16:29:25
2011-03-10T16:29:25
42,468,175
0
0
null
null
null
null
UTF-8
C++
false
false
11,696
h
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation ([email protected]) ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at [email protected]. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QDATETIME_H #define QDATETIME_H #include <QtCore/qstring.h> #include <QtCore/qnamespace.h> #include <QtCore/qsharedpointer.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Core) class Q_CORE_EXPORT QDate { public: enum MonthNameType { DateFormat = 0, StandaloneFormat }; public: QDate() { jd = 0; } QDate(int y, int m, int d); bool isNull() const { return jd == 0; } bool isValid() const; int year() const; int month() const; int day() const; int dayOfWeek() const; int dayOfYear() const; int daysInMonth() const; int daysInYear() const; int weekNumber(int *yearNum = 0) const; #ifndef QT_NO_TEXTDATE #ifdef QT3_SUPPORT static QT3_SUPPORT QString monthName(int month) { return shortMonthName(month); } static QT3_SUPPORT QString dayName(int weekday) { return shortDayName(weekday); } #endif // ### Qt 5: merge these functions. static QString shortMonthName(int month); static QString shortMonthName(int month, MonthNameType type); static QString shortDayName(int weekday); static QString shortDayName(int weekday, MonthNameType type); static QString longMonthName(int month); static QString longMonthName(int month, MonthNameType type); static QString longDayName(int weekday); static QString longDayName(int weekday, MonthNameType type); #endif // QT_NO_TEXTDATE #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; QString toString(const QString &format) const; #endif bool setYMD(int y, int m, int d); bool setDate(int year, int month, int day); void getDate(int *year, int *month, int *day); QDate addDays(int days) const; QDate addMonths(int months) const; QDate addYears(int years) const; int daysTo(const QDate &) const; bool operator==(const QDate &other) const { return jd == other.jd; } bool operator!=(const QDate &other) const { return jd != other.jd; } bool operator<(const QDate &other) const { return jd < other.jd; } bool operator<=(const QDate &other) const { return jd <= other.jd; } bool operator>(const QDate &other) const { return jd > other.jd; } bool operator>=(const QDate &other) const { return jd >= other.jd; } static QDate currentDate(); #ifndef QT_NO_DATESTRING static QDate fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QDate fromString(const QString &s, const QString &format); #endif static bool isValid(int y, int m, int d); static bool isLeapYear(int year); #ifdef QT3_SUPPORT inline static QT3_SUPPORT bool leapYear(int year) { return isLeapYear(year); } #endif // ### Qt 5: remove these two functions static uint gregorianToJulian(int y, int m, int d); static void julianToGregorian(uint jd, int &y, int &m, int &d); #ifdef QT3_SUPPORT static QT3_SUPPORT QDate currentDate(Qt::TimeSpec spec); #endif static inline QDate fromJulianDay(int jd) { QDate d; d.jd = jd; return d; } inline int toJulianDay() const { return jd; } private: uint jd; friend class QDateTime; friend class QDateTimePrivate; #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDate &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &); #endif }; Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE); class Q_CORE_EXPORT QTime { public: QTime(): mds(NullTime) #if defined(Q_OS_WINCE) , startTick(NullTime) #endif {} QTime(int h, int m, int s = 0, int ms = 0); bool isNull() const { return mds == NullTime; } bool isValid() const; int hour() const; int minute() const; int second() const; int msec() const; #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; QString toString(const QString &format) const; #endif bool setHMS(int h, int m, int s, int ms = 0); QTime addSecs(int secs) const; int secsTo(const QTime &) const; QTime addMSecs(int ms) const; int msecsTo(const QTime &) const; bool operator==(const QTime &other) const { return mds == other.mds; } bool operator!=(const QTime &other) const { return mds != other.mds; } bool operator<(const QTime &other) const { return mds < other.mds; } bool operator<=(const QTime &other) const { return mds <= other.mds; } bool operator>(const QTime &other) const { return mds > other.mds; } bool operator>=(const QTime &other) const { return mds >= other.mds; } static QTime currentTime(); #ifndef QT_NO_DATESTRING static QTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QTime fromString(const QString &s, const QString &format); #endif static bool isValid(int h, int m, int s, int ms = 0); #ifdef QT3_SUPPORT static QT3_SUPPORT QTime currentTime(Qt::TimeSpec spec); #endif void start(); int restart(); int elapsed() const; private: enum TimeFlag { NullTime = -1 }; inline int ds() const { return mds == -1 ? 0 : mds; } int mds; #if defined(Q_OS_WINCE) int startTick; #endif friend class QDateTime; friend class QDateTimePrivate; #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); #endif }; Q_DECLARE_TYPEINFO(QTime, Q_MOVABLE_TYPE); class QDateTimePrivate; class Q_CORE_EXPORT QDateTime { public: QDateTime(); explicit QDateTime(const QDate &); QDateTime(const QDate &, const QTime &, Qt::TimeSpec spec = Qt::LocalTime); QDateTime(const QDateTime &other); ~QDateTime(); QDateTime &operator=(const QDateTime &other); bool isNull() const; bool isValid() const; QDate date() const; QTime time() const; Qt::TimeSpec timeSpec() const; uint toTime_t() const; void setDate(const QDate &date); void setTime(const QTime &time); void setTimeSpec(Qt::TimeSpec spec); void setTime_t(uint secsSince1Jan1970UTC); #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; QString toString(const QString &format) const; #endif QDateTime addDays(int days) const; QDateTime addMonths(int months) const; QDateTime addYears(int years) const; QDateTime addSecs(int secs) const; QDateTime addMSecs(qint64 msecs) const; QDateTime toTimeSpec(Qt::TimeSpec spec) const; inline QDateTime toLocalTime() const { return toTimeSpec(Qt::LocalTime); } inline QDateTime toUTC() const { return toTimeSpec(Qt::UTC); } int daysTo(const QDateTime &) const; int secsTo(const QDateTime &) const; bool operator==(const QDateTime &other) const; inline bool operator!=(const QDateTime &other) const { return !(*this == other); } bool operator<(const QDateTime &other) const; inline bool operator<=(const QDateTime &other) const { return !(other < *this); } inline bool operator>(const QDateTime &other) const { return other < *this; } inline bool operator>=(const QDateTime &other) const { return !(*this < other); } void setUtcOffset(int seconds); int utcOffset() const; static QDateTime currentDateTime(); #ifndef QT_NO_DATESTRING static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QDateTime fromString(const QString &s, const QString &format); #endif static QDateTime fromTime_t(uint secsSince1Jan1970UTC); #ifdef QT3_SUPPORT inline QT3_SUPPORT void setTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec) { setTime_t(secsSince1Jan1970UTC); if (spec == Qt::UTC) *this = toUTC(); } static inline QT3_SUPPORT QDateTime currentDateTime(Qt::TimeSpec spec) { if (spec == Qt::LocalTime) return currentDateTime(); else return currentDateTime().toUTC(); } #endif private: friend class QDateTimePrivate; void detach(); QExplicitlySharedDataPointer<QDateTimePrivate> d; #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); #endif }; Q_DECLARE_TYPEINFO(QDateTime, Q_MOVABLE_TYPE); #ifdef QT3_SUPPORT inline QDate QDate::currentDate(Qt::TimeSpec spec) { if (spec == Qt::LocalTime) return currentDate(); else return QDateTime::currentDateTime().toUTC().date(); } inline QTime QTime::currentTime(Qt::TimeSpec spec) { if (spec == Qt::LocalTime) return currentTime(); else return QDateTime::currentDateTime().toUTC().time(); } #endif #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDate &); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &); Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDateTime &); #endif // QT_NO_DATASTREAM #if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING) Q_CORE_EXPORT QDebug operator<<(QDebug, const QDate &); Q_CORE_EXPORT QDebug operator<<(QDebug, const QTime &); Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); #endif QT_END_NAMESPACE QT_END_HEADER #endif // QDATETIME_H
[ "ulmonkey1987@7c5ce3f8-edad-37de-be84-b98c484540b5" ]
[ [ [ 1, 334 ] ] ]
a5e436989bfc89f770e5912fd0a6873b83f5749d
105cc69f4207a288be06fd7af7633787c3f3efb5
/HovercraftUniverse/HovercraftUniverse/CheckPointRepresentation.cpp
fe2d5dd2c6d38408307427021775cd0a421b0675
[]
no_license
allenjacksonmaxplayio/uhasseltaacgua
330a6f2751e1d6675d1cf484ea2db0a923c9cdd0
ad54e9aa3ad841b8fc30682bd281c790a997478d
refs/heads/master
2020-12-24T21:21:28.075897
2010-06-09T18:05:23
2010-06-09T18:05:23
56,725,792
0
0
null
null
null
null
UTF-8
C++
false
false
641
cpp
#include "CheckPointRepresentation.h" #include "CheckPoint.h" namespace HovUni { CheckPointRepresentation::CheckPointRepresentation(CheckPoint * entity, Ogre::SceneManager * sceneMgr, Ogre::String meshFile, Ogre::String resourceGroupName, bool visible, bool castShadows, Ogre::Real renderingDistance, Ogre::String materialFile, std::vector<Ogre::String> subMaterials) : EntityRepresentation(entity, meshFile, sceneMgr, resourceGroupName, visible, castShadows, renderingDistance, materialFile, subMaterials) { // Empty } CheckPointRepresentation::~CheckPointRepresentation() { // Empty } }
[ "kristof.overdulve@2d55a33c-0a8f-11df-aac0-2d4c26e34a4c", "pintens.pieterjan@2d55a33c-0a8f-11df-aac0-2d4c26e34a4c" ]
[ [ [ 1, 1 ], [ 3, 16 ] ], [ [ 2, 2 ] ] ]
c70b3bdd32ccd5add10062b0eccc681f9937c64b
c4001da8f012dfbc46fef0d9c11f8412f4ad9c6f
/allegro/examples/ex_synth.cpp
ce4ec9b267fb6f543504e92a71b68b12fc067d9b
[ "Zlib", "BSD-3-Clause" ]
permissive
sesc4mt/mvcdecoder
4602fdfe42ab39706cfa3c749282782ca9da73c9
742a5c0d9cad43f0b01aa6e9169d96a286458e72
refs/heads/master
2021-01-01T17:56:47.666505
2010-11-02T12:36:52
2010-11-02T12:36:52
40,896,775
1
0
null
null
null
null
UTF-8
C++
false
false
11,836
cpp
/* * Example program for the Allegro library, by Peter Wang. * * Something like the start of a synthesizer. */ #include <stdio.h> #include <math.h> #include "allegro5/allegro5.h" #include "allegro5/allegro_audio.h" #include "allegro5/allegro_font.h" #include "allegro5/allegro_ttf.h" #include "nihgui.hpp" #include "common.c" #define PI (ALLEGRO_PI) #define TWOPI (2.0 * PI) #define SAMPLES_PER_BUFFER (1024) #define STREAM_FREQUENCY (44100) const double dt = 1.0 / STREAM_FREQUENCY; enum Waveform { WAVEFORM_NONE, WAVEFORM_SINE, WAVEFORM_SQUARE, WAVEFORM_TRIANGLE, WAVEFORM_SAWTOOTH }; /* forward declarations */ static void generate_wave(Waveform type, float *buf, size_t samples, double t, float frequency, float phase); static void sine(float *buf, size_t samples, double t, float frequency, float phase); static void square(float *buf, size_t samples, double t, float frequency, float phase); static void triangle(float *buf, size_t samples, double t, float frequency, float phase); static void sawtooth(float *buf, size_t samples, double t, float frequency, float phase); /* globals */ ALLEGRO_FONT *font_gui; ALLEGRO_AUDIO_STREAM *stream1; ALLEGRO_AUDIO_STREAM *stream2; ALLEGRO_AUDIO_STREAM *stream3; ALLEGRO_AUDIO_STREAM *stream4; ALLEGRO_AUDIO_STREAM *stream5; static void generate_wave(Waveform type, float *buf, size_t samples, double t, float frequency, float phase) { switch (type) { case WAVEFORM_NONE: for (unsigned i = 0; i < samples; i++) { buf[i] = 0.0; } break; case WAVEFORM_SINE: sine(buf, samples, t, frequency, phase); break; case WAVEFORM_SQUARE: square(buf, samples, t, frequency, phase); break; case WAVEFORM_TRIANGLE: triangle(buf, samples, t, frequency, phase); break; case WAVEFORM_SAWTOOTH: sawtooth(buf, samples, t, frequency, phase); break; } } static void sine(float *buf, size_t samples, double t, float frequency, float phase) { const double w = TWOPI * frequency; unsigned i; for (i = 0; i < samples; i++) { double ti = t + i * dt; buf[i] = sin(w * ti + phase); } } static void square(float *buf, size_t samples, double t, float frequency, float phase) { const double w = TWOPI * frequency; unsigned i; for (i = 0; i < samples; i++) { double ti = t + i * dt; double x = sin(w * ti + phase); buf[i] = (x >= 0.0) ? 1.0 : -1.0; } } static void triangle(float *buf, size_t samples, double t, float frequency, float phase) { const double w = TWOPI * frequency; unsigned i; for (i = 0; i < samples; i++) { double tx = w * (t + i * dt) + PI/2.0 + phase; double tu = fmod(tx/PI, 2.0); if (tu <= 1.0) buf[i] = (1.0 - 2.0 * tu); else buf[i] = (-1.0 + 2.0 * (tu - 1.0)); } } void sawtooth(float *buf, size_t samples, double t, float frequency, float phase) { const double w = TWOPI * frequency; unsigned i; for (i = 0; i < samples; i++) { double tx = w * (t + i * dt) + PI + phase; double tu = fmod(tx/PI, 2.0); buf[i] = (-1.0 + tu); } } class Group { private: List list; Label freq_label; HSlider freq_slider; Label freq_val_label; Label phase_label; HSlider phase_slider; Label phase_val_label; Label gain_label; HSlider gain_slider; Label pan_label; HSlider pan_slider; double t; float last_gain; float last_pan; public: Group(); void add_to_dialog(Dialog & d, int x, int y); void update_labels(); void generate(float *buf, size_t samples); bool get_gain_if_changed(float *gain); bool get_pan_if_changed(float *pan); private: float get_frequency() const; float get_phase() const; }; Group::Group() : freq_label(Label("f")), freq_slider(220, 1000), phase_label(Label("φ")), phase_slider((int)(100 * PI), (int)(2 * 100 * PI)), /* -π .. π */ gain_label(Label("Gain")), gain_slider(33, 100), /* 0.0 .. 1.0 */ pan_label(Label("Pan")), pan_slider(100, 200), /* -1.0 .. 1.0 */ t(0.0), last_gain(-10000), last_pan(-10000) { /* Order must correspond with Waveform. */ list.append_item("Off"); list.append_item("Sine"); list.append_item("Square"); list.append_item("Triangle"); list.append_item("Sawtooth"); } void Group::add_to_dialog(Dialog & d, int x, int y) { d.add(list, x, y, 4, 4); d.add(freq_label, x+4, y, 2, 1); d.add(freq_slider, x+6, y, 20, 1); d.add(freq_val_label, x+26, y, 4, 1); d.add(phase_label, x+4, y+1, 2, 1); d.add(phase_slider, x+6, y+1, 20, 1); d.add(phase_val_label, x+26, y+1, 4, 1); d.add(gain_label, x+4, y+2, 2, 1); d.add(gain_slider, x+6, y+2, 20, 1); d.add(pan_label, x+4, y+3, 2, 1); d.add(pan_slider, x+6, y+3, 20, 1); } void Group::update_labels() { char buf[32]; float frequency = get_frequency(); float phase = get_phase(); sprintf(buf, "%4.0f Hz", frequency); freq_val_label.set_text(buf); sprintf(buf, "%.2f π", phase/PI); phase_val_label.set_text(buf); } void Group::generate(float *buf, size_t samples) { Waveform type = (Waveform) list.get_cur_value(); float frequency = get_frequency(); float phase = get_phase(); generate_wave(type, buf, samples, t, frequency, phase); t += dt * samples; } float Group::get_frequency() const { return freq_slider.get_cur_value(); } float Group::get_phase() const { return phase_slider.get_cur_value() / 100.0 - PI; } bool Group::get_gain_if_changed(float *gain) { *gain = gain_slider.get_cur_value() / 100.0; bool changed = (last_gain != *gain); last_gain = *gain; return changed; } bool Group::get_pan_if_changed(float *pan) { *pan = pan_slider.get_cur_value() / 100.0 - 1.0; bool changed = (last_pan != *pan); last_pan = *pan; return changed; } class Prog : public EventHandler { private: Dialog d; Group group1; Group group2; Group group3; Group group4; Group group5; double t; public: Prog(const Theme & theme); virtual ~Prog() {} void run(); void handle_event(const ALLEGRO_EVENT & event); }; Prog::Prog(const Theme & theme) : d(Dialog(theme, al_get_current_display(), 30, 26)), t(0.0) { group1.add_to_dialog(d, 1, 1); group2.add_to_dialog(d, 1, 6); group3.add_to_dialog(d, 1, 11); group4.add_to_dialog(d, 1, 16); group5.add_to_dialog(d, 1, 21); } void Prog::run() { d.prepare(); d.register_event_source(al_get_audio_stream_event_source(stream1)); d.register_event_source(al_get_audio_stream_event_source(stream2)); d.register_event_source(al_get_audio_stream_event_source(stream3)); d.register_event_source(al_get_audio_stream_event_source(stream4)); d.register_event_source(al_get_audio_stream_event_source(stream5)); d.set_event_handler(this); while (!d.is_quit_requested()) { if (d.is_draw_requested()) { group1.update_labels(); group2.update_labels(); group3.update_labels(); group4.update_labels(); group5.update_labels(); al_clear_to_color(al_map_rgb(128, 128, 128)); d.draw(); al_flip_display(); } d.run_step(true); } } void Prog::handle_event(const ALLEGRO_EVENT & event) { if (event.type == ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT) { ALLEGRO_AUDIO_STREAM *stream; Group *group; void *buf; float gain; float pan; stream = (ALLEGRO_AUDIO_STREAM *) event.any.source; buf = al_get_audio_stream_fragment(stream); if (!buf) { /* This is a normal condition that you must deal with. */ return; } if (stream == stream1) group = &group1; else if (stream == stream2) group = &group2; else if (stream == stream3) group = &group3; else if (stream == stream4) group = &group4; else if (stream == stream5) group = &group5; else group = NULL; ALLEGRO_ASSERT(group); if (group) { group->generate((float *) buf, SAMPLES_PER_BUFFER); if (group->get_gain_if_changed(&gain)) { al_set_audio_stream_gain(stream, gain); } if (group->get_pan_if_changed(&pan)) { al_set_audio_stream_pan(stream, pan); } } if (!al_set_audio_stream_fragment(stream, buf)) { fprintf(stderr, "Error setting stream fragment.\n"); } } } int main(int argc, char *argv[]) { (void)argc; (void)argv; if (!al_init()) { fprintf(stderr, "Could not init Allegro.\n"); return 1; } al_install_keyboard(); al_install_mouse(); al_init_font_addon(); al_init_ttf_addon(); al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); if (!al_create_display(800, 600)) { abort_example("Unable to create display\n"); return 1; } al_set_window_title("Synthesiser of sorts"); font_gui = al_load_ttf_font("data/DejaVuSans.ttf", 12, 0); if (!font_gui) { abort_example("Failed to load data/fixed_font.tga\n"); return 1; } if (!al_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT)) { abort_example("Could not init sound!\n"); return 1; } if (!al_reserve_samples(0)) { abort_example("Could not set up voice and mixer.\n"); return 1; } size_t buffers = 8; unsigned samples = SAMPLES_PER_BUFFER; unsigned freq = STREAM_FREQUENCY; ALLEGRO_AUDIO_DEPTH depth = ALLEGRO_AUDIO_DEPTH_FLOAT32; ALLEGRO_CHANNEL_CONF ch = ALLEGRO_CHANNEL_CONF_1; stream1 = al_create_audio_stream(buffers, samples, freq, depth, ch); stream2 = al_create_audio_stream(buffers, samples, freq, depth, ch); stream3 = al_create_audio_stream(buffers, samples, freq, depth, ch); stream4 = al_create_audio_stream(buffers, samples, freq, depth, ch); stream5 = al_create_audio_stream(buffers, samples, freq, depth, ch); if (!stream1 || !stream2 || !stream3 || !stream4 || !stream5) { abort_example("Could not create stream.\n"); return 1; } ALLEGRO_MIXER *mixer = al_get_default_mixer(); if ( !al_attach_audio_stream_to_mixer(stream1, mixer) || !al_attach_audio_stream_to_mixer(stream2, mixer) || !al_attach_audio_stream_to_mixer(stream3, mixer) || !al_attach_audio_stream_to_mixer(stream4, mixer) || !al_attach_audio_stream_to_mixer(stream5, mixer) ) { abort_example("Could not attach stream to mixer.\n"); return 1; } al_show_mouse_cursor(); /* Prog is destroyed at the end of this scope. */ { Theme theme(font_gui); Prog prog(theme); prog.run(); } al_destroy_audio_stream(stream1); al_destroy_audio_stream(stream2); al_destroy_audio_stream(stream3); al_destroy_audio_stream(stream4); al_destroy_audio_stream(stream5); al_uninstall_audio(); al_destroy_font(font_gui); return 0; } /* vim: set sts=3 sw=3 et: */
[ "edwardtoday@34199c9c-95aa-5eba-f35a-9ba8a8a04cd7" ]
[ [ [ 1, 466 ] ] ]
e1c1cb93c12c14e3ea32457bb6fc673106641a50
77d70985fc66e39a7f5c518bdb0a5ebe0edf13dd
/fenetreluminosite.cpp
fb5e58027f6e7423a635cf12f9aeee0bf71b0b7c
[]
no_license
lefebvreariane/projet-image-imag
9b51c09563c8388147c75e1c4196e40f4f91af85
673618ffb9b074e826a322029ec78c6f51a5cdc3
refs/heads/master
2020-06-04T23:52:48.322289
2011-01-28T10:01:13
2011-01-28T10:01:13
33,365,133
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
2,092
cpp
#include "fenetreluminosite.h" FenetreLuminosite::FenetreLuminosite(QWidget *parent) : QWidget(parent) { // Creation des boutons QPushButton *boutonOk = new QPushButton("Ok"); connect(boutonOk, SIGNAL(clicked()),this, SLOT(clic_ok())); QPushButton *boutonAnnuler = new QPushButton("Annuler"); connect(boutonAnnuler, SIGNAL(clicked()),this, SLOT(clic_annuler())); QLabel *label_lum = new QLabel("Luminosité: "); QLabel *label_cont = new QLabel("Contraste: "); label_val_lum = new QLabel("0"); label_val_cont = new QLabel("0"); slider_lum = new QSlider(Qt::Horizontal); slider_lum->setMinimum(-100); slider_lum->setMaximum(100); connect(slider_lum,SIGNAL(valueChanged(int)),this, SLOT(changement_lum(int))); slider_cont = new QSlider(Qt::Horizontal); slider_cont->setMinimum(-100); slider_cont->setMaximum(100); connect(slider_cont,SIGNAL(valueChanged(int)),this, SLOT(changement_cont(int))); //Creation du layout principal QGridLayout *layout = new QGridLayout; layout->setColumnMinimumWidth(2,20); layout->addWidget(label_lum, 0, 0); layout->addWidget(slider_lum, 0, 1); layout->addWidget(label_val_lum, 0, 2); layout->addWidget(label_cont, 1, 0); layout->addWidget(slider_cont, 1, 1); layout->addWidget(label_val_cont, 1, 2); layout->addWidget(boutonOk, 2, 0); layout->addWidget(boutonAnnuler, 2, 1,1,2); setLayout(layout); this->setMaximumWidth(TAILLEH); } void FenetreLuminosite::changement_lum(int i){ label_val_lum->setText(QString::number(i)); } void FenetreLuminosite::changement_cont(int i){ label_val_cont->setText(QString::number(i)); } void FenetreLuminosite::clic_ok(){ emit appliquer_luminosite_contraste((slider_lum->value()+100)/200.0,(slider_cont->value()+100)/200.0); this->hide(); } void FenetreLuminosite::clic_annuler(){ this->hide(); } void FenetreLuminosite::init_lum_cont(){ slider_lum->setValue(0); slider_cont->setValue(0); }
[ "sauretq@2187a008-b734-0937-d5d4-3b54df4e424a" ]
[ [ [ 1, 68 ] ] ]
6d1f429562797e8d32f82b87fa1bbd1329bde53d
29c5bc6757634a26ac5103f87ed068292e418d74
/src/tlclasses/CGame.h
e90444c681377da7626cbdc4f9dee011d2a890e5
[]
no_license
drivehappy/tlapi
d10bb75f47773e381e3ba59206ff50889de7e66a
56607a0243bd9d2f0d6fb853cddc4fce3e7e0eb9
refs/heads/master
2021-03-19T07:10:57.343889
2011-04-18T22:58:29
2011-04-18T22:58:29
32,191,364
5
0
null
null
null
null
UTF-8
C++
false
false
1,222
h
#pragma once #include "_CString.h" #include "CRunicCore.h" #include "CCameraControl.h" #include "CSoundManager.h" #include "CSettings.h" namespace TLAPI { #pragma pack(1) // Forward decls //struct CGame; //TLFUNC(Game_CreateUI, void, __thiscall, (CGame*)); struct CGame : CRunicCore { PVOID unk0; PVOID vtable_OgreFrameListener; PVOID vtable_OgreWindowEventListener; PVOID vtable_iEditorResourceManager; PVOID vtable_OgreRenderQueue; PVOID vtable_RenderTargetListener; CCameraControl *pCCameraControl; PVOID unk2; PVOID *pOctreeSM[6]; // Ogre -- why 6 SceneManagers? PVOID *pViewportOgre; // Ogre PVOID *pString; // Points to (-8) of a CString struct non-wide u32 unk3; CString UnkString; u32 unk4[6]; CSettings *pCSettings; CSoundManager *pCSoundManager; u32 unk5[2]; CString UnkString2; // // Function hooks EVENT_DECL(CGame, void, GameCtor, (CGame*), ((CGame*)e->_this)); EVENT_DECL(CGame, void, Game_CreateUI, (CGame*), ((CGame*)e->_this)); }; #pragma pack() };
[ "drivehappy@53ea644a-42e2-1498-a4e7-6aa81ae25522" ]
[ [ [ 1, 63 ] ] ]
a1d6bedd72ebc97aeaf9045ec9a5e9a430ce2e3c
ec593cdbcb75afa0e1d49a9d5f992d929f5b131b
/UiSwitchOption.h
e4a75a7e92257dbde6883e5792664afcf8b44d39
[]
no_license
jemyzhang/MzCommon_deprecated
10873a31b4c240bcdb8d31f7cf7d546c193b59a7
99f44847355882edf40329bc17420a5414a59389
refs/heads/master
2016-09-01T17:09:08.785822
2010-01-18T02:09:09
2010-01-18T02:09:09
null
0
0
null
null
null
null
GB18030
C++
false
false
926
h
#pragma once /* * @filename UiSwitchOption.h * @note 开关选择, ID: 本体 ID+0x100: 开关 * @author JEMYZHANG * @date 2009.10.16 * @ver. 1.0 * @changelog * ver.1.0 初始化程序 */ // include the MZFC library header file #include <mzfc_inc.h> #include <list> class UiSwitchOption : public UiButtonEx { MZ_DECLARE_DYNAMIC(UiSwitchOption); public: UiSwitchOption(void); ~UiSwitchOption(void); public: UiButtonEx m_Switch; void SetPos(int x, int y, int w, int h, UINT flags=0){ m_Switch.SetPos(w-120,0,120,h,flags); UiButtonEx::SetPos(x,y,w,h,flags); } void SetID(int nID){ m_Switch.SetID(nID + 0x100); UiButtonEx::SetID(nID); } public: BOOL GetSwitchStatus(){ //true: switch on return (m_Switch.GetState() == MZCS_BUTTON_PRESSED); } void SetSwitchStatus(BOOL s){ m_Switch.SetState(s ? MZCS_BUTTON_PRESSED : MZCS_BUTTON_NORMAL); } protected: };
[ "jemyzhang@53aff7d1-dc1e-0346-9cbd-63131b65f07d" ]
[ [ [ 1, 41 ] ] ]
72e790e09edc763a979167c5d33ad9ddf03838e9
222bc22cb0330b694d2c3b0f4b866d726fd29c72
/src/brookbox/wm2/WmlTRVector.inl
2daaa28b3fabc87660a9be619443947675b3f951
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference" ]
permissive
darwin/inferno
02acd3d05ca4c092aa4006b028a843ac04b551b1
e87017763abae0cfe09d47987f5f6ac37c4f073d
refs/heads/master
2021-03-12T22:15:47.889580
2009-04-17T13:29:39
2009-04-17T13:29:39
178,477
2
0
null
null
null
null
UTF-8
C++
false
false
7,655
inl
// Magic Software, Inc. // http://www.magic-software.com // http://www.wild-magic.com // Copyright (c) 2003. All Rights Reserved // // The Wild Magic Library (WML) source code is supplied under the terms of // the license agreement http://www.wild-magic.com/License/WildMagic.pdf and // may not be copied or disclosed except in accordance with the terms of that // agreement. //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>::TRVector () { // For efficiency in construction of large arrays of vectors, the // default constructor does not initialize the vector. } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>::TRVector (const TRVector& rkV) { memcpy(m_akTuple,rkV.m_akTuple,VSIZE*sizeof(TRational<ISIZE>)); } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>::operator const TRational<ISIZE>* () const { return m_akTuple; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>::operator TRational<ISIZE>* () { return m_akTuple; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRational<ISIZE> TRVector<VSIZE,ISIZE>::operator[] (int i) const { assert( 0 <= i && i < VSIZE ); return m_akTuple[i]; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRational<ISIZE>& TRVector<VSIZE,ISIZE>::operator[] (int i) { assert( 0 <= i && i < VSIZE ); return m_akTuple[i]; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>& TRVector<VSIZE,ISIZE>::operator= (const TRVector& rkV) { memcpy(m_akTuple,rkV.m_akTuple,VSIZE*sizeof(TRational<ISIZE>)); return *this; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> bool TRVector<VSIZE,ISIZE>::operator== (const TRVector& rkV) const { for (int i = 0; i < VSIZE; i++) { if ( m_akTuple[i] != rkV.m_akTuple[i] ) return false; } return true; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> bool TRVector<VSIZE,ISIZE>::operator!= (const TRVector& rkV) const { return !operator==(rkV); } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> int TRVector<VSIZE,ISIZE>::CompareArrays (const TRVector& rkV) const { for (int i = 0; i < VSIZE; i++) { if ( m_akTuple[i] < rkV.m_akTuple[i] ) return -1; if ( m_akTuple[i] > rkV.m_akTuple[i] ) return +1; } return 0; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> bool TRVector<VSIZE,ISIZE>::operator< (const TRVector& rkV) const { return CompareArrays(rkV) < 0; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> bool TRVector<VSIZE,ISIZE>::operator<= (const TRVector& rkV) const { return CompareArrays(rkV) <= 0; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> bool TRVector<VSIZE,ISIZE>::operator> (const TRVector& rkV) const { return CompareArrays(rkV) > 0; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> bool TRVector<VSIZE,ISIZE>::operator>= (const TRVector& rkV) const { return CompareArrays(rkV) >= 0; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE> TRVector<VSIZE,ISIZE>::operator+ (const TRVector& rkV) const { TRVector<VSIZE,ISIZE> kSum; for (int i = 0; i < VSIZE; i++) kSum.m_akTuple[i] = m_akTuple[i] + rkV.m_akTuple[i]; return kSum; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE> TRVector<VSIZE,ISIZE>::operator- (const TRVector& rkV) const { TRVector<VSIZE,ISIZE> kDiff; for (int i = 0; i < VSIZE; i++) kDiff.m_akTuple[i] = m_akTuple[i] - rkV.m_akTuple[i]; return kDiff; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE> TRVector<VSIZE,ISIZE>::operator* (const TRational<ISIZE>& rkR) const { TRVector<VSIZE,ISIZE> kProd; for (int i = 0; i < VSIZE; i++) kProd.m_akTuple[i] = rkR*m_akTuple[i]; return kProd; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE> TRVector<VSIZE,ISIZE>::operator/ (const TRational<ISIZE>& rkR) const { assert( rkR != 0 ); TRVector<VSIZE,ISIZE> kProd; for (int i = 0; i < VSIZE; i++) kProd.m_akTuple[i] = m_akTuple[i]/rkR; return kProd; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE> TRVector<VSIZE,ISIZE>::operator- () const { TRVector<VSIZE,ISIZE> kNeg; for (int i = 0; i < VSIZE; i++) kNeg.m_akTuple[i] = -m_akTuple[i]; return kNeg; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>& TRVector<VSIZE,ISIZE>::operator+= (const TRVector& rkV) { for (int i = 0; i < VSIZE; i++) m_akTuple[i] += rkV.m_akTuple[i]; return *this; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>& TRVector<VSIZE,ISIZE>::operator-= (const TRVector& rkV) { for (int i = 0; i < VSIZE; i++) m_akTuple[i] -= rkV.m_akTuple[i]; return *this; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>& TRVector<VSIZE,ISIZE>::operator*= (const TRational<ISIZE>& rkR) { for (int i = 0; i < VSIZE; i++) m_akTuple[i] *= rkR; return *this; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRVector<VSIZE,ISIZE>& TRVector<VSIZE,ISIZE>::operator/= (const TRational<ISIZE>& rkR) { assert( rkR != 0 ); for (int i = 0; i < VSIZE; i++) m_akTuple[i] /= rkR; return *this; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRational<ISIZE> TRVector<VSIZE,ISIZE>::SquaredLength () const { TRational<ISIZE> kSqrLen = 0; for (int i = 0; i < VSIZE; i++) kSqrLen += m_akTuple[i]*m_akTuple[i]; return kSqrLen; } //---------------------------------------------------------------------------- template <int VSIZE, int ISIZE> TRational<ISIZE> TRVector<VSIZE,ISIZE>::Dot (const TRVector& rkV) const { TRational<ISIZE> kDot = 0; for (int i = 0; i < VSIZE; i++) kDot += m_akTuple[i]*rkV.m_akTuple[i]; return kDot; } //----------------------------------------------------------------------------
[ [ [ 1, 216 ] ] ]
40d37da31efc5e5380afb716b97bcf17eebc3b42
e192bb584e8051905fc9822e152792e9f0620034
/tags/sources_0_1/univers/univers.h
c146b2b2f78b4e4c7cf300307812d8160b963413
[]
no_license
BackupTheBerlios/projet-univers-svn
708ffadce21f1b6c83e3b20eb68903439cf71d0f
c9488d7566db51505adca2bc858dab5604b3c866
refs/heads/master
2020-05-27T00:07:41.261961
2011-07-31T20:55:09
2011-07-31T20:55:09
40,817,685
0
0
null
null
null
null
ISO-8859-2
C++
false
false
1,968
h
/*************************************************************************** * Copyright (C) 2004 by Equipe Projet Univers * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _PU_UNIVERS_UNIVERS_H_ #define _PU_UNIVERS_UNIVERS_H_ namespace ProjetUnivers { namespace Univers { /* CLASS Univers Représente l'univers physique naturel d'un monde. TYPE_DE_CLASSE Objet Concret */ class Univers { public: //////////////////// // Constructeur. Univers() ; private: }; } } #endif
[ "rogma@fb75c231-3be1-0310-9bb4-c95e2f850c73" ]
[ [ [ 1, 59 ] ] ]
10627211143066c467da7a5824a1ece9e6c47b35
14298a990afb4c8619eea10988f9c0854ec49d29
/PowerBill四川电信专用版本/ibill_source/OpeningFileFrm.h
b719bb64bb7891666f3ea09ecd513e93ebccb7c5
[]
no_license
sridhar19091986/xmlconvertsql
066344074e932e919a69b818d0038f3d612e6f17
bbb5bbaecbb011420d701005e13efcd2265aa80e
refs/heads/master
2021-01-21T17:45:45.658884
2011-05-30T12:53:29
2011-05-30T12:53:29
42,693,560
0
0
null
null
null
null
UTF-8
C++
false
false
2,262
h
//--------------------------------------------------------------------------- #ifndef OpeningFileFrmH #define OpeningFileFrmH //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include "RzPrgres.hpp" #include "RzButton.hpp" #include <ExtCtrls.hpp> #include "BillFile.h" #include "OpenFileThread.h" #include "RzPanel.hpp" #include <Graphics.hpp> //--------------------------------------------------------------------------- class TfrmOpeningFile : public TForm { __published: // IDE-managed Components TRzPanel *RzPanel1; TRzProgressBar *RzProgressBar1; TImage *Image1; TLabel *labInformation; TLabel *Label1; TRzBitBtn *btnCancel; void __fastcall FormKeyPress(TObject *Sender, char &Key); void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall FormShow(TObject *Sender); private: // User declarations bool CloseByUser; public: // User declarations TBillFile * BillFile; AnsiString ErrorMessage; AnsiString FileName; AnsiString BillName; HANDLE hOldBillOwnerWnd; TOpenFileThread * OpenFileThread; __fastcall TfrmOpeningFile(TComponent* Owner); //void __fastcall CloseWindow(TModalResult Result); void __fastcall OnFileThreadTerminate(TMessage Message); void __fastcall OnFTPWorkBegin(TMessage Message); void __fastcall OnFTPWork(TMessage Message); void __fastcall OnSetProcessMaxCount(TMessage Message); void __fastcall OnSetProcessPos(TMessage Message); //void __fastcall OnThreadCompleted(TMessage Message); BEGIN_MESSAGE_MAP MESSAGE_HANDLER(MSG_FTP_WORK_BEGIN,TMessage,OnFTPWorkBegin) MESSAGE_HANDLER(MSG_FTP_WORK,TMessage,OnFTPWork) MESSAGE_HANDLER(MSG_SET_PROCESS_MAX_COUNT,TMessage,OnSetProcessMaxCount) MESSAGE_HANDLER(MSG_SET_PROCESS_POS,TMessage,OnSetProcessPos) MESSAGE_HANDLER(MSG_THREAD_COMPLETED,TMessage,OnFileThreadTerminate) END_MESSAGE_MAP(TForm) }; //--------------------------------------------------------------------------- extern PACKAGE TfrmOpeningFile *frmOpeningFile; //--------------------------------------------------------------------------- #endif
[ "cn.wei.hp@e7bd78f4-57e5-8052-e4e7-673d445fef99" ]
[ [ [ 1, 59 ] ] ]
968e5a25c581474d6a1ba1d1151f274a59f7b3f0
47f2ee8c2ec135b02b960387a0cb42126e5028ec
/PlasmaGL/src/plglGame.cpp
26e47993b43d7cdb7c900156bb1d704a38b9a96c
[]
no_license
nsundin/PlasmaViewer
010beca29ac98fdea73b9741973403cfa764d301
b482c0481b28d4506be72e5f8da4aa23b98d5489
refs/heads/master
2020-06-04T05:25:54.050496
2010-03-07T08:34:37
2010-03-07T08:34:37
12,849,019
1
0
null
null
null
null
UTF-8
C++
false
false
112
cpp
#include "plglGame.h" plglGame::plglGame(plResManager* rm) { this->rm = rm; spawnmgr.init(rm); }
[ "lontahv@46d49313-71c2-4fea-ab98-6c881a270271" ]
[ [ [ 1, 6 ] ] ]
2399ea4945d487c6cfdb00eba6725e2ef5faabc0
dc74c703265aa159cef253ad50531e5e69655056
/src/shb_dll/gm.cpp
8f1ef673af5b144108e93569e36e263a106fd490
[ "ISC" ]
permissive
Medo42/GM-shared-buffers
9c180a008d922195d58c956f20bba9ab030d225a
72b520f43444ea6a7704027e9b204f4e2fa236b8
refs/heads/master
2021-01-13T02:27:27.940514
2011-06-05T19:25:45
2011-06-05T19:25:45
1,678,012
2
0
null
null
null
null
UTF-8
C++
false
false
130
cpp
#include "gm.h" #include "core/core.hpp" std::vector<char> gm_returnstring; shb_CoreApi* shbCoreApi = shb_getCoreApiV1();
[ [ [ 1, 6 ] ] ]
a9c29b407425dff97ff669e3c829dfddc25e12fd
6581dacb25182f7f5d7afb39975dc622914defc7
/WinsockLab/SO_TYPE/SO_TYPEsrc.cpp
170d79f491d70b95a91b4ba9d7bb71fc77749290
[]
no_license
dice2019/alexlabonline
caeccad28bf803afb9f30b9e3cc663bb2909cc4f
4c433839965ed0cff99dad82f0ba1757366be671
refs/heads/master
2021-01-16T19:37:24.002905
2011-09-21T15:20:16
2011-09-21T15:20:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,206
cpp
// Description: // This sample creates a socket and then calls the SO_TYPE option // to retrieve the socket type (SOCK_STREAM, SOCK_DGRAM, etc) for // that socket. // // Command line arguments // // Link to ws2_32.lib #include <winsock2.h> #include <ws2tcpip.h> #include <stdio.h> // Function: main // Description: // Load Winsock, create a socket, and then call the SO_TYPE // option and print the results. int main(int argc, char **argv) { WSADATA wsd; SOCKET s; int ret, iVal, iSize; // Load Winsock if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) { printf("WSAStartup() failed with error code %d\n", WSAGetLastError()); return -1; } else printf("WSAStartup() should be fine!\n"); // In this case create a UDP SOCK_DGRAM socket s = WSASocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, 0, WSA_FLAG_OVERLAPPED); if (s == INVALID_SOCKET) { printf("WSASocket() failed with error code %d\n", WSAGetLastError()); return -1; } else printf("WSASocket() is OK!\n"); // Retrieve the type and print its value iSize = sizeof(iVal); ret = getsockopt(s, SOL_SOCKET, SO_TYPE, (char *)&iVal, &iSize); if (ret == SOCKET_ERROR) { printf("getsockopt(SO_TYPE) failed with error code %d\n", iVal); return -1; } else printf("getsockopt(SO_TYPE) is pretty fine!\n"); printf("Protocol type: "); if (iVal == SOCK_STREAM) printf("SOCK_STREAM\n"); else if (iVal == SOCK_DGRAM) printf("SOCK_DGRAM\n"); else if (iVal == SOCK_RDM) printf("SOCK_RDM\n"); else if (iVal == SOCK_SEQPACKET) printf("SOCK_SEQPKACKET\n"); else if (iVal == SOCK_RAW) printf("SOCK_RAW\n"); else printf("Unknown\n"); // Clean-up if(closesocket(s) == 0) printf("closesocket() should be fine!\n"); else printf("closesocket() failed with error code %d\n", WSAGetLastError()); if(WSACleanup() == 0) printf("WSACleanup() is OK!\n"); else printf("WSACleanup() failed with error code %d\n", WSAGetLastError()); return 0; }
[ "damoguyan8844@3a4e9f68-f5c2-36dc-e45a-441593085838" ]
[ [ [ 1, 80 ] ] ]
cfd7b6edc2b3459e8c9aa1fb4fe96a79f0049428
85cb4316ad809bca086cc3221946090443c0424c
/Piehelper/PIEHelper.h
a6f6b734010d681c9b809a63655359eaad92af7c
[ "MIT" ]
permissive
AurangZ/windrider
7f2a5d3ffd1d9e293ab4d1ea093f6d788227adeb
01f9f7d2361cd8b039e7370b730fb9e17c206c06
refs/heads/master
2020-05-18T18:10:44.542729
2010-03-11T01:26:24
2010-03-11T01:26:24
42,451,552
0
0
null
null
null
null
UTF-8
C++
false
false
3,807
h
#pragma warning( disable: 4049 ) /* more than 64k source lines */ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 5.03.0286 */ /* at Mon Mar 08 18:40:13 2010 */ /* Compiler settings for .\PIEHelper.idl: Oicf (OptLev=i2), W1, Zp8, env=Win32 (32b run), ms_ext, c_ext error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ //@@MIDL_FILE_HEADING( ) /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 440 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __PIEHelper_h__ #define __PIEHelper_h__ /* Forward Declarations */ #ifndef __IIEHlprObj_FWD_DEFINED__ #define __IIEHlprObj_FWD_DEFINED__ typedef interface IIEHlprObj IIEHlprObj; #endif /* __IIEHlprObj_FWD_DEFINED__ */ #ifndef __IEHlprObj_FWD_DEFINED__ #define __IEHlprObj_FWD_DEFINED__ #ifdef __cplusplus typedef class IEHlprObj IEHlprObj; #else typedef struct IEHlprObj IEHlprObj; #endif /* __cplusplus */ #endif /* __IEHlprObj_FWD_DEFINED__ */ /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" #ifdef __cplusplus extern "C"{ #endif void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); void __RPC_USER MIDL_user_free( void __RPC_FAR * ); #ifndef __IIEHlprObj_INTERFACE_DEFINED__ #define __IIEHlprObj_INTERFACE_DEFINED__ /* interface IIEHlprObj */ /* [unique][helpstring][uuid][object] */ EXTERN_C const IID IID_IIEHlprObj; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("C1B27B94-DBAF-48F3-A3E0-C87035131E9D") IIEHlprObj : public IUnknown { public: }; #else /* C style interface */ typedef struct IIEHlprObjVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IIEHlprObj __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IIEHlprObj __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IIEHlprObj __RPC_FAR * This); END_INTERFACE } IIEHlprObjVtbl; interface IIEHlprObj { CONST_VTBL struct IIEHlprObjVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IIEHlprObj_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IIEHlprObj_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IIEHlprObj_Release(This) \ (This)->lpVtbl -> Release(This) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IIEHlprObj_INTERFACE_DEFINED__ */ #ifndef __IEHELPERLib_LIBRARY_DEFINED__ #define __IEHELPERLib_LIBRARY_DEFINED__ /* library IEHELPERLib */ /* [helpstring][version][uuid] */ EXTERN_C const IID LIBID_IEHELPERLib; EXTERN_C const CLSID CLSID_IEHlprObj; #ifdef __cplusplus class DECLSPEC_UUID("93AFDD66-D450-42F5-9997-1E58C5582292") IEHlprObj; #endif #endif /* __IEHELPERLib_LIBRARY_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
[ "ionut.trestian@ee5ef0fc-2c67-11df-b580-1f2e1e9a714e" ]
[ [ [ 1, 168 ] ] ]
f84b39336e19e319a3d863c1130794bf770f7ae3
dae6bffaedec0537790623c28d1dec934752e2be
/source/ragnarok_008/game_overlord.hpp
bb9ada4a43fbc0b0397bad1abbac0047ff99f60e
[]
no_license
a711960/ragnarok-tbrpg
d86d8aa280063b8d2bc0eead9efbaade86f0d0e6
10956a6e48527545688ced6f816fa9f916842d78
refs/heads/master
2021-01-10T14:46:10.930083
2010-08-15T21:20:30
2010-08-15T21:20:30
51,717,541
0
0
null
null
null
null
UTF-8
C++
false
false
1,249
hpp
#ifndef GAME_OVERLORD_HPP_INCLUDED #define GAME_OVERLORD_HPP_INCLUDED #include "game_entities.h" #include "game_saves.hpp" #include <iostream> class overlord { public: enum options {location=0, equipt=1, consecutive=2, chance2hit, karma, broken, health, defense, attack, value, name}; public:; overlord(); ~overlord(); std::vector <entity> entity_list; //working with entites void new_entity(entity*); //pushes entity into vector void give_entity_item(int x, short ID); //gives entity tiem void entity_attack(short, short); //test function. void display_entites(); bool get_input(); void trade(short entity1, short entity2, short item_id); //working with inventory more specifically void new_item(short ID, const std::string namex, const unsigned short locationx, bool equipt=true, const unsigned char consecutivex=0, const unsigned char chance2hitx=0, const float karmax=0, const bool brokenx=false, const short healthx=0, const short defensex=0, const short attackx=0, const short valuex=0); std::string return_item_name(const short, enum options); short return_item_value(const short, enum options); private: short entity_ammount; }; #endif // GAME_OVERLORD_HPP_INCLUDED
[ "rpg.ragnarok.game@b9f03f81-d838-4a7b-86f3-b03b787f155d" ]
[ [ [ 1, 35 ] ] ]
8b7c2fa3b6f0d2638fdf8200fa9fcb92885aa10d
3bfc30f7a07ce0f6eabcd526e39ba1030d84c1f3
/BlobbyWarriors/Source/BlobbyWarriors/Model/Entity/Flamethrower.h
c456f5fb88bba0acc46322317081852ec8f7a96b
[]
no_license
visusnet/Blobby-Warriors
b0b70a0b4769b60d96424b55ad7c47b256e60061
adec63056786e4e8dfcb1ed7f7fe8b09ce05399d
refs/heads/master
2021-01-19T14:09:32.522480
2011-11-29T21:53:25
2011-11-29T21:53:25
2,850,563
0
0
null
null
null
null
UTF-8
C++
false
false
339
h
#ifndef FLAMETHROWER_H #define FLAMETHROWER_H class Flamethrower; #include "AbstractWeapon.h" #include "Factory\FlamethrowerBulletFactory.h" #include "../../Debug.h" class Flamethrower : public AbstractWeapon { public: Flamethrower(); void onFire(b2Vec2 direction, bool constantFire, bool isPlayer = false); }; #endif
[ [ [ 1, 17 ] ] ]
b7f10643d75709349d44f6c23fee78ac6506ae6e
21dcab8a06b80b13f2536f4932e23eccae1dd13d
/src/BlackJack/FormRanking.cpp
52c7dab157fe96ad64f3991a0a5a7a9f7917fc96
[]
no_license
demontiejr/blackjackpoker
2cff7e07d5f52144f44d95137f0ff57b99a75d53
7ff5e4b1fb4966d6d6ad30cffe1f29d053bfa34b
refs/heads/master
2016-08-11T12:13:11.927157
2011-10-25T13:23:36
2011-10-25T13:23:36
46,422,688
0
0
null
null
null
null
UTF-8
C++
false
false
3,575
cpp
/* * FormRanking.cpp * Created on: 21/09/2011 * Author: Catharine */ #include "BlackJack/FormRanking.h" #include "BlackJack/FormMgr.h" using namespace Osp::App; using namespace Osp::Base; using namespace Osp::Ui; using namespace Osp::Ui::Controls; using namespace Osp::Media; using namespace Osp::Graphics; FormRanking::FormRanking() { } FormRanking::~FormRanking() { } bool FormRanking::Initialize() { // Construct an XML form Construct(L"IDF_FORM_RANKING"); return true; } result FormRanking::OnInitializing(void) { result r = E_SUCCESS; ranking.Construct(); __pButtonLimpar = static_cast<Button *>(GetControl(L"IDC_BUTTON_LIMPAR")); if (__pButtonLimpar != null) { __pButtonLimpar->SetActionId(ID_BUTTON_LIMPAR); __pButtonLimpar->AddActionEventListener(*this); } __pButtonVoltar = static_cast<Button *>(GetControl(L"IDC_BUTTON_VOLTAR")); if (__pButtonVoltar != null) { __pButtonVoltar->SetActionId(ID_BUTTON_VOLTAR); __pButtonVoltar->AddActionEventListener(*this); } __pLabelRanking = static_cast<Label *>(GetControl(L"IDC_LABEL_RANKING")); __pLabelNomes = static_cast<Label *>(GetControl(L"IDC_LABEL_NOMES")); //Criando lista do ranking __pLabelPosicao1 = static_cast<Label *>(GetControl(L"IDC_LABEL_POSICAO1")); __pLabelPosicao2 = static_cast<Label *>(GetControl(L"IDC_LABEL_POSICAO2")); __pLabelPosicao3 = static_cast<Label *>(GetControl(L"IDC_LABEL_POSICAO3")); __pLabelPosicao4 = static_cast<Label *>(GetControl(L"IDC_LABEL_POSICAO4")); __pLabelPosicao5 = static_cast<Label *>(GetControl(L"IDC_LABEL_POSICAO5")); RetrieveData(); return r; } result FormRanking::OnTerminating(void) { result r = E_SUCCESS; //todo return r; } void FormRanking::RetrieveData() { InfoRanking* info = ranking.GetInfoPorPosicaoInserir(1); __pLabelPosicao1->SetText(info->ToString()); info = ranking.GetInfoPorPosicaoInserir(2); __pLabelPosicao2->SetText(info->ToString()); info = ranking.GetInfoPorPosicaoInserir(3); __pLabelPosicao3->SetText(info->ToString()); info = ranking.GetInfoPorPosicaoInserir(4); __pLabelPosicao4->SetText(info->ToString()); info = ranking.GetInfoPorPosicaoInserir(5); __pLabelPosicao5->SetText(info->ToString()); } void FormRanking::OnActionPerformed(const Osp::Ui::Control& source, int actionId) { Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); switch (actionId) { case ID_BUTTON_LIMPAR: { AppLog("LIMPAR Button is clicked! \n"); ranking.Limpar(); RetrieveData(); RedesenhaLabels(); } break; case ID_BUTTON_VOLTAR: { AppLog("VOLTAR Button is clicked! \n"); FormMgr *pFormMgr = static_cast<FormMgr *> (pFrame->GetControl( "FormMgr")); if (pFormMgr != null) pFormMgr->SendUserEvent(FormMgr::REQUEST_FORM_MENU, null); } break; default: break; } } result FormRanking::OnDraw(void) { Image *pImage = new Image(); result r = pImage->Construct(); if (IsFailed(r)) return r; Bitmap *pBitmap = pImage->DecodeN("/Home/background.jpg", BITMAP_PIXEL_FORMAT_ARGB8888); Canvas* pCanvas = GetCanvasN(); if(pCanvas != null){ pCanvas->DrawBitmap(Point(0, 0), *pBitmap); delete pCanvas; } delete pImage; delete pBitmap; return r; } void FormRanking::RedesenhaLabels() { __pLabelPosicao1->RequestRedraw(true); __pLabelPosicao2->RequestRedraw(true); __pLabelPosicao3->RequestRedraw(true); __pLabelPosicao4->RequestRedraw(true); __pLabelPosicao5->RequestRedraw(true); }
[ [ [ 1, 146 ] ] ]
62238ff6e9afba287f773b012f2bad8f7dad5d89
7b2db9b789308b341b57626b9e40d717f03ee13c
/mint/avl.hpp
d300772d70dd7428c0c24d2d79e5904aa17fc5d3
[]
no_license
kinaba/mint
93be7356f06ceb6ac82fdfb1c1a13221f546a041
e9d5bfc52818b4eb157a86474cd498b27e6393e0
refs/heads/master
2016-09-06T16:43:18.702005
2009-12-18T02:21:59
2009-12-18T02:21:59
410,891
1
0
null
null
null
null
SHIFT_JIS
C++
false
false
1,905
hpp
#ifndef KMONOS_NET_MINT_AVL_HPP #define KMONOS_NET_MINT_AVL_HPP #include "common.hpp" #include "node.hpp" #include "avl_index.hpp" #include <functional> #include <boost/intrusive/avl_set_hook.hpp> //--------------------------------------------------------------------------- // MultiIndex 用"インデックス指定子"の実装例 //--------------------------------------------------------------------------- namespace mint { template< typename Compare, // とりあえず手抜き。本当はKeyExtractor使えるようにしたい。あとコンストラクタ引数… typename TagList=boost::multi_index::tag<> > struct avl { // multi_index_container を使うときのインデックス指定 // // multi_index_container<T, indexed_by<ここ, ここ, ここ>> // // には "インデックス指定子 (index specifier)" と // 呼ばれる種類のクラスを渡します。 // ちなみに、indexed_by はBoost.MPLで使えるシーケンスならなんでもいいです。 // multi_index_container<T, mpl::list<ここ, ここ, ここ>> // とか。 // // // インデックス指定子を自作するには // - 自作ノードの実装を返す node_class (詳細は node.hpp で) // - 自作インデックスの実装を返す index_class (詳細は list_index.hpp で) // の二つのメタ関数(メンバクラステンプレート)を定義すればよいです。 // ↓こんな感じ。 template<typename Super> struct node_class { typedef detail::intrusive_hook_node< boost::intrusive::avl_set_member_hook<>, Super > type; }; template<typename SuperMeta> struct index_class { typedef detail::avl_index< Compare, SuperMeta, typename TagList::type > type; }; }; } // end of namespace #endif // include guard
[ [ [ 1, 55 ] ] ]
0ba3e47a358e550bf04b0393b125828b4f758a4d
138a353006eb1376668037fcdfbafc05450aa413
/source/StartBoxEntity.cpp
7d4e236a441b4f26affc7ce571bb39ceee55803a
[]
no_license
sonicma7/choreopower
107ed0a5f2eb5fa9e47378702469b77554e44746
1480a8f9512531665695b46dcfdde3f689888053
refs/heads/master
2020-05-16T20:53:11.590126
2009-11-18T03:10:12
2009-11-18T03:10:12
32,246,184
0
0
null
null
null
null
UTF-8
C++
false
false
586
cpp
#include "StartBoxEntity.h" StartBoxEntity::StartBoxEntity(GameServices *gs, OgreNewt::World *collisionWorld, Ogre::SceneNode *parentNode, const Ogre::Vector3 &pos, const Ogre::Vector3 &size, const Ogre::String &name, const Ogre::String &modelFile) :RigidModelEntity(gs, collisionWorld, parentNode, pos, size, name, modelFile) { mStart = false; } StartBoxEntity::~StartBoxEntity() { } void StartBoxEntity::update() { } bool StartBoxEntity::start() { return mStart; } void StartBoxEntity::onCollisionEntered(RigidModelEntity *colEntity) { mStart = true; }
[ "Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e" ]
[ [ [ 1, 22 ] ] ]
1b37cd4848977a88947755277a3798f2ed856fa8
205069c97095da8f15e45cede1525f384ba6efd2
/Casino/Code/Server/ServerModule/GameFrameModule/ServerList.h
df261bd579c4dd8b4f6cce276035b9f2df22d568
[]
no_license
m0o0m/01technology
1a3a5a48a88bec57f6a2d2b5a54a3ce2508de5ea
5e04cbfa79b7e3cf6d07121273b3272f441c2a99
refs/heads/master
2021-01-17T22:12:26.467196
2010-01-05T06:39:11
2010-01-05T06:39:11
null
0
0
null
null
null
null
GB18030
C++
false
false
3,707
h
#ifndef SERVER_LIST_HEAD_FILE #define SERVER_LIST_HEAD_FILE #pragma once #include "GameServiceExport.h" ////////////////////////////////////////////////////////////////////////// //数组定义 typedef CArrayTemplate<tagGameType *> CGameTypePtrArray; typedef CArrayTemplate<tagGameKind *> CGameKindPtrArray; typedef CArrayTemplate<tagGameServer *> CGameServerPtrArray; typedef CArrayTemplate<tagGameStation *> CGameStationPtrArray; ////////////////////////////////////////////////////////////////////////// //列表信息 class CServerListInfo { //变量定义 public: CGameTypePtrArray m_GameTypePtrArrayActive; //类型数组 CGameTypePtrArray m_GameTypePtrArrayBuffer; //类型数组 CGameKindPtrArray m_GameKindPtrArrayActive; //种类数组 CGameKindPtrArray m_GameKindPtrArrayBuffer; //种类数组 CGameServerPtrArray m_GameServerPtrArrayActive; //房间数组 CGameServerPtrArray m_GameServerPtrArrayBuffer; //房间数组 CGameStationPtrArray m_GameStationPtrArrayActive; //站点数组 CGameStationPtrArray m_GameStationPtrArrayBuffer; //站点数组 //函数定义 public: //构造函数 CServerListInfo(); //析构函数 virtual ~CServerListInfo(); //维护函数 public: //重置信息 bool ResetInfo(); //插入类型 bool InsertGameType(tagGameType * pGameType); //插入种类 bool InsertGameKind(tagGameKind * pGameKind); //插入站点 bool InsertGameStation(tagGameStation * pGameStation); //插入房间 bool InsertGameServer(tagGameServer * pGameServer); //拷贝信息 bool CopyServerListInfo(CServerListInfo & ServerListInfoScr); }; ////////////////////////////////////////////////////////////////////////// //列表管理 class CServerList { //变量定义 protected: CServerListInfo m_ServerListInfoBuffer; //列表信息 CServerListInfo m_ServerListInfoActive; //列表信息 BYTE m_cbSendBuffer[SOCKET_PACKAGE]; //发送缓冲 //接口指针 protected: IEventService * m_pIEventService; //事件接口 ITCPSocketEngine * m_pITCPSocketEngine; //网络引擎 public: //构造函数 CServerList(); //析构函数 virtual ~CServerList(); //配置接口 public: //设置事件 virtual bool __cdecl SetEventService(IUnknownEx * pIUnknownEx); //设置接口 virtual bool __cdecl SetSocketEngine(IUnknownEx * pIUnknownEx); //发送接口 public: //发送类型 virtual bool __cdecl SendGameTypeList(WORD wIndex, WORD wRountID); //发送种类 virtual bool __cdecl SendGameKindList(WORD wIndex, WORD wRountID); //发送站点 virtual bool __cdecl SendGameStationList(WORD wIndex, WORD wRountID); //发送站点 virtual bool __cdecl SendGameStationList(WORD wIndex, WORD wRountID, WORD wKindID); //发送房间 virtual bool __cdecl SendGameServerList(WORD wIndex, WORD wRountID); //发送房间 virtual bool __cdecl SendGameServerList(WORD wIndex, WORD wRountID, WORD wKindID); //更新接口 public: //更新准备 virtual bool __cdecl ResetServerListBuffer(); //激活缓冲 virtual bool __cdecl ActiveServerListBuffer(); //追加类型 virtual bool __cdecl AppendGameTypeBuffer(tagGameType * pGameType, DWORD dwCount); //追加种类 virtual bool __cdecl AppendGameKindBuffer(tagGameKind * pGameKind, DWORD dwCount); //追加站点 virtual bool __cdecl AppendGameStationBuffer(tagGameStation * pGameStation, DWORD dwCount); //追加房间 virtual bool __cdecl AppendGameServerBuffer(tagGameServer * pGameServer, DWORD dwCount); }; ////////////////////////////////////////////////////////////////////////// #endif
[ [ [ 1, 118 ] ] ]
93bf2f82e66cc23c1f57265c09ac3a396a42872d
d9f1cc8e697ae4d1c74261ae6377063edd1c53f8
/src/objects/Vehicle.cpp
854185f13fd54a52ca0b673d582165832d696396
[]
no_license
commel/opencombat2005
344b3c00aaa7d1ec4af817e5ef9b5b036f2e4022
d72fc2b0be12367af34d13c47064f31d55b7a8e0
refs/heads/master
2023-05-19T05:18:54.728752
2005-12-01T05:11:44
2005-12-01T05:11:44
375,630,282
0
0
null
null
null
null
UTF-8
C++
false
false
13,456
cpp
#include ".\vehicle.h" #include <Misc\Color.h> #include <Graphics\Screen.h> #include <Misc\Utilities.h> #include <World\World.h> #include <Objects\Soldier.h> #include <Objects\Squad.h> #include <Objects\Weapon.h> #include <Graphics\Effect.h> #include <Graphics\Widget.h> #include <Application\Globals.h> #include <assert.h> #include <math.h> #define NORMALIZE_ANGLE(a) (float)(((a) < 0) ? ((a)+2.0f*M_PI) : (((a)>2.0f*M_PI) ? (a)-2.0f*M_PI : (a))) #define DA (M_PI/180.0f) Vehicle::Vehicle(void) : Object() { _currentHullAngle = 0.0; _currentTurretAngle = 0.0; _turretRotating = false; _hullRotating = false; _numWeapons = 0; _numCrew = 0; } Vehicle::~Vehicle(void) { } // Render this object to the screen void Vehicle::Render(Screen *screen, Rect *clip) { UNREFERENCED_PARAMETER(clip); Color white(255,255,255); screen->Blit(_hullGraphics->GetData(), Position.x - screen->Origin.x - _hullGraphics->GetOriginX(), Position.y - screen->Origin.y - _hullGraphics->GetOriginY(), _hullGraphics->GetWidth(), _hullGraphics->GetHeight(), _hullGraphics->GetWidth(), _hullGraphics->GetHeight(), _hullGraphics->GetDepth(), &white, _hullGraphics->GetOriginX(), _hullGraphics->GetOriginY(), _currentHullAngle); screen->Blit(_turretGraphics->GetData(), Position.x - screen->Origin.x - _hullGraphics->GetOriginX() + _turretPosition.x - _turretGraphics->GetOriginX(), Position.y - screen->Origin.y - _hullGraphics->GetOriginY() + _turretPosition.y - _turretGraphics->GetOriginY(), _turretGraphics->GetWidth(), _turretGraphics->GetHeight(), _turretGraphics->GetWidth(), _turretGraphics->GetHeight(), _turretGraphics->GetDepth(), &white, _turretGraphics->GetOriginX(), _turretGraphics->GetOriginY(), _currentTurretAngle); // Render any effects for(int i = 0; i < _effects.Count; ++i) { Effect *e = _effects.Items[i]; if(e->IsDynamic()) { // Set the positions if(e->IsPlaceOnTurret()) { // Find out my turret position Point p; Utilities::Rotate(&p, &_muzzlePosition, _currentTurretAngle); e->SetPosition(Position.x-screen->Origin.x-p.x, Position.y- screen->Origin.x-p.y); } else { e->SetPosition(Position.x, Position.y); } } _effects.Items[i]->Render(screen); } if(IsHighlighted()) { Color black(0,0,0); Widget *w = g_Globals->World.Icons->GetWidget("Unit Highlighted Bracket"); w->Render(screen, Position.x - screen->Origin.x, Position.y-screen->Origin.y, &black); delete w; } else if(IsSelected()) { Color white(255,255,255); Widget *w = g_Globals->World.Icons->GetWidget("Unit Selected Bracket"); w->Render(screen, Position.x - screen->Origin.x, Position.y-screen->Origin.y, &white); delete w; } } // Simulate this object for dt milliseconds void Vehicle::Simulate(long dt, World *world) { UNREFERENCED_PARAMETER(world); // Check our current orders Order *order = _orders.Peek(); if(order != NULL) { bool handled = false; switch(order->GetType()) { case Orders::Move: // This is a move order, let's head in that direction _currentAction = Unit::Moving; handled = HandleMoveOrder(dt, (MoveOrder *) order, Moving); break; case Orders::Fire: handled = HandleFireOrder((FireOrder *)order); break; case Orders::Destination: handled = HandleDestinationOrder((MoveOrder *)order); break; case Orders::Stop: handled = HandleStopOrder(); break; default: handled = true; break; } if(handled) { _orders.Dequeue(); order->Release(); } } if(_turretRotating) { _currentTurretAngle +=(float)( _turretRotationDirection*((float)dt)*2.0f*M_PI / (16.0f*_turretRotationRate)); _currentTurretAngle = (float)NORMALIZE_ANGLE(_currentTurretAngle); if(_currentTurretAngle<=(_turretTargetAngle+DA) && _currentTurretAngle>=(_turretTargetAngle-DA)) { _turretRotating = false; _currentTurretAngle = _turretTargetAngle; } } assert(_currentTurretAngle <= 2.0f*M_PI && _currentTurretAngle >= 0.0f); if(_hullRotating) { _currentHullAngle += (float)(_hullRotationDirection*((float)dt)*2.0f*M_PI / (16.0f*_hullRotationRate)); _currentHullAngle = (float)NORMALIZE_ANGLE(_currentHullAngle); if(_currentHullAngle<=(_hullTargetAngle+DA) && _currentHullAngle>=(_hullTargetAngle-DA)) { _hullRotating = false; _currentHullAngle = _hullTargetAngle; } } assert(_currentHullAngle <= 2.0f*M_PI && _currentHullAngle >= 0.0f); // Let's do our movement PlanMovement(dt); // Update any effects for(int i = 0; i < _effects.Count; ++i) { _effects.Items[i]->Simulate(dt); if(_effects.Items[i]->IsCompleted()) { delete _effects.RemoveAt(i); --i; } } // Update my weapons if I can for(int i = 0; i < _numWeapons; ++i) { _weapons[i]->Simulate(dt); if(_currentState == State::Firing) { if(_weapons[i]->CanFire()) { if(_weaponIsOnHull[i]) { if(!_hullRotating) { Shoot(_weapons[i], _currentTarget, _currentTargetType, _currentTargetX, _currentTargetY); } } else { if(!_turretRotating) { Shoot(_weapons[i], _currentTarget, _currentTargetType, _currentTargetX, _currentTargetY); } } } else if(_weapons[i]->IsEmpty()) { if(_weaponsNumClips[i] > 0) { _weapons[i]->Reload(); --_weaponsNumClips[i]; } } } } } void Vehicle::PlanMovement(long dt) { if(_moving && !_hullRotating) { // Go ahead and head towards our destination float secs = ((float)dt)/1000.0f; _velocity.x += -_acceleration*secs*sin(_currentHullAngle); _velocity.y += -_acceleration*secs*cos(_currentHullAngle); if(_velocity.Magnitude() > _maxRoadSpeed) { _velocity.Normalize(); _velocity.Multiply(_maxRoadSpeed); } // Now we need to try moving this object to its new position _position.x += _velocity.x*secs*(float)(g_Globals->World.Constants.PixelsPerMeter); _position.y += _velocity.y*secs*(float)(g_Globals->World.Constants.PixelsPerMeter); Position.x = (int)_position.x; Position.y = (int)_position.y; } } bool Vehicle::HandleMoveOrder(long dt, MoveOrder *order, State newState) { UNREFERENCED_PARAMETER(dt); // Head to the destination MoveOrder *o = new MoveOrder(order->X, order->Y, Orders::Destination); AddOrder(o); _moving = true; _currentState = newState; _destination.x = order->X; _destination.y = order->Y; _velocity.x = 0; // Stop moving! _velocity.y = 0; // Set the desired turret angle and hull angle to get us pointed there AimTurret(order->X, order->Y); return true; } bool Vehicle::HandleFireOrder(FireOrder *order) { // Stop moving //HandleStopOrder(NULL); // Set my state _currentState = State::Firing; _currentAction = Unit::Firing; // Set the current target and stuff _currentTarget = order->Target; _currentTargetType = order->TargetType; _currentTargetX = order->X; _currentTargetY = order->Y; // We need to line the damn turret up! AimTurret(order->X, order->Y); return true; } bool Vehicle::HandleDestinationOrder(MoveOrder *order) { Vector2 dist; dist.x = (float)(Position.x - order->X); dist.y = (float)(Position.y - order->Y); if(dist.Magnitude() <= 10.0f) { AddOrder(new StopOrder()); return true; } return false; } bool Vehicle::HandleStopOrder() { _moving = false; _currentState = Stopped; _currentAction = Unit::Defending; _velocity.x = 0; // Stop moving! _velocity.y = 0; return true; } Vehicle * Vehicle::Clone() { Vehicle *v = new Vehicle(); strcpy(v->_name, _name); v->_hullGraphics = _hullGraphics; v->_turretGraphics = _turretGraphics; v->_wreckGraphics = _wreckGraphics; v->_turretPosition.x = _turretPosition.x; v->_turretPosition.y = _turretPosition.y; v->_hullRotationRate = _hullRotationRate; v->_turretRotationRate = _turretRotationRate; return v; } void Vehicle::SetPosition(int x, int y) { Object::SetPosition(x,y); _position.x = (float) x; _position.y = (float) y; } bool Vehicle::Select(int x, int y) { if(Contains(x,y)) { Object::Select(true); return true; } return false; } bool Vehicle::Contains(int x, int y) { Region r; r.points[0].x = Position.x - _hullGraphics->GetWidth()/2; r.points[0].y = Position.y - _hullGraphics->GetWidth()/2; r.points[1].x = Position.x + _hullGraphics->GetWidth()/2; r.points[1].y = Position.y - _hullGraphics->GetWidth()/2; r.points[2].x = Position.x + _hullGraphics->GetWidth()/2; r.points[2].y = Position.y + _hullGraphics->GetWidth()/2; r.points[3].x = Position.x - _hullGraphics->GetWidth()/2; r.points[3].y = Position.y + _hullGraphics->GetWidth()/2; return Screen::PointInRegion(x, y, &r); } void Vehicle::UpdateInterfaceState(InterfaceState *state, int teamIdx, int unitIdx) { UNREFERENCED_PARAMETER(unitIdx); for(int i = 0; i < _numCrew; ++i) { Soldier *s = _crew[i].soldier; s->UpdateInterfaceState(state, teamIdx, i); state->SquadStates[teamIdx].UnitStates[i].NumRounds = _weapons[_crew[i].weaponSlot]->GetCurrentRounds() + _weapons[_crew[i].weaponSlot]->GetRoundsPerClip()*_weaponsNumClips[_crew[i].weaponSlot]; state->SquadStates[teamIdx].NumUnits++; } #if 0 strcpy(state->SquadStates[teamIdx].UnitStates[unitIdx].Name, GetPersonalName()); state->SquadStates[teamIdx].UnitStates[unitIdx].CurrentAction = GetCurrentAction(); state->SquadStates[teamIdx].UnitStates[unitIdx].CurrentStatus = GetCurrentStatus(); strcpy(state->SquadStates[teamIdx].UnitStates[unitIdx].WeaponIcon, _primaryWeapon->GetIconName()); state->SquadStates[teamIdx].UnitStates[unitIdx].NumRounds = _primaryWeapon->GetCurrentRounds() + _primaryWeapon->GetRoundsPerClip()*_primaryWeaponNumClips; strcpy(state->SquadStates[teamIdx].UnitStates[unitIdx].Title, _title); strcpy(state->SquadStates[teamIdx].UnitStates[unitIdx].Rank, _rank); #endif } void Vehicle::AddWeapon(Weapon *weapon, int slot, int numClips, bool hull) { if(slot < 0) { // Add to the end slot = _numWeapons; } assert(slot >= 0 && slot < MAX_WEAPONS_PER_VEHICLE); _weapons[slot] = weapon; _weaponIsOnHull[slot] = hull; _weaponsNumClips[slot] = numClips; _numWeapons++; } void Vehicle::Shoot(Weapon *weapon, Object *target, Target::Type targetType, int targetX, int targetY) { Direction effectHeading=North; switch(targetType) { case Target::Soldier: if(target != NULL) { // Make sure my target is not already dead or dying! Soldier *s = (Soldier *) target; if(s->IsDead()) { _currentTarget = s->GetSquad(); _currentTargetType = Target::Squad; return; } effectHeading = Utilities::FindHeading(Position.x, Position.y, _currentTarget->Position.x, _currentTarget->Position.y); #if 0 if(g_World->CalculateShot(this, _currentTarget, weapon)) { // We killed the guy, so find another target next time _currentTarget = ((Soldier *)_currentTarget)->GetSquad(); _currentTargetType = Target::Squad; } #endif } break; case Target::Squad: // Find a target in the squad _currentTarget = FindTarget((Squad *) target); _currentTargetType = Target::Soldier; if(_currentTarget == NULL) { _currentAction = Unit::NoTarget; _currentState = State::Stopped; } return; case Target::Area: // Set my heading effectHeading = Utilities::FindHeading(Position.x, Position.y, targetX, targetY); break; } weapon->Fire(); _currentState = State::Firing; _currentAction = Unit::Firing; _effects.Add(g_Globals->World.Effects->GetEffect(weapon->GetEffect(effectHeading))); if(weapon->IsGroundShaker()) { Effect *e = g_Globals->World.Effects->GetEffect("Dust Cloud"); e->SetPosition(Position.x, Position.y); _effects.Add(e); } } Soldier * Vehicle::FindTarget(Squad *squad) { if(NULL == squad) { return NULL; } bool anyAlive = false; Array<Soldier> *soldiers = squad->GetSoldiers(); for(int i = soldiers->Count-1; i >= 0 ; --i) { if(!soldiers->Items[i]->IsDead()) { anyAlive = true; break; } } if(anyAlive) { Soldier *o; for(;;) { if(!((o = soldiers->Items[rand()%soldiers->Count])->IsDead())) { return o; } } } return NULL; } void Vehicle::AddCrew(Soldier *soldier, int slot) { if(slot < 0) { slot = _numWeapons-1; } soldier->InsertWeapon(GetWeapon(slot), GetWeaponNumClips(slot)); // Add this soldier _crew[_numCrew].soldier = soldier; _crew[_numCrew].weaponSlot = slot; _numCrew++; } void Vehicle::AimTurret(int x, int y) { _hullRotating = true; _turretRotating = true; float angle = Utilities::FindAngle(Position.x, Position.y, x, y); if(angle < M_PI/2.0f) { angle += (float)(3.0f*M_PI/2.0f); } else { angle -= (float)(M_PI/2.0f); } _turretTargetAngle = angle; _hullTargetAngle = _turretTargetAngle; // Set the direction of rotation float ta1 = _currentTurretAngle - _turretTargetAngle; float ta2 = -ta1; ta1 = NORMALIZE_ANGLE(ta1); ta2 = NORMALIZE_ANGLE(ta2); _turretRotationDirection = (ta1 < ta2) ? -1.0f : 1.0f; ta1 = _currentHullAngle - _hullTargetAngle; ta2 = -ta1; ta1 = NORMALIZE_ANGLE(ta1); ta2 = NORMALIZE_ANGLE(ta2); _hullRotationDirection = (ta1 < ta2) ? -1.0f : 1.0f; }
[ "opencombat" ]
[ [ [ 1, 478 ] ] ]
62e2a3151be4d02910071bf6ad8331be2a3c9da4
58ef4939342d5253f6fcb372c56513055d589eb8
/LemonPlayer_2nd/src/LemonPlayerApp.cpp
5172ace45bdf59615269842046ca5c0ecc61f875
[]
no_license
flaithbheartaigh/lemonplayer
2d77869e4cf787acb0aef51341dc784b3cf626ba
ea22bc8679d4431460f714cd3476a32927c7080e
refs/heads/master
2021-01-10T11:29:49.953139
2011-04-25T03:15:18
2011-04-25T03:15:18
50,263,327
0
0
null
null
null
null
UTF-8
C++
false
false
1,873
cpp
/* ============================================================================ * Name : CLemonPlayerApp from LemonPlayerApp.cpp * Part of : LemonPlayer * Created : 17.09.2008 by zengcity * * Implementation notes: * * Initial content was generated by Series 60 Application Wizard. * Version : * Copyright: * ============================================================================ */ // INCLUDE FILES #include "LemonPlayerApp.h" #include "LemonPlayerDocument.h" // ================= MEMBER FUNCTIONS ======================= // --------------------------------------------------------- // CLemonPlayerApp::AppDllUid() // Returns application UID // --------------------------------------------------------- // TUid CLemonPlayerApp::AppDllUid() const { return KUidLemonPlayer; } // --------------------------------------------------------- // CLemonPlayerApp::CreateDocumentL() // Creates CLemonPlayerDocument object // --------------------------------------------------------- // CApaDocument* CLemonPlayerApp::CreateDocumentL() { return CLemonPlayerDocument::NewL( *this ); } // ================= OTHER EXPORTED FUNCTIONS ============== // // --------------------------------------------------------- // NewApplication() // Constructs CLemonPlayerApp // Returns: created application object // --------------------------------------------------------- // EXPORT_C CApaApplication* NewApplication() { return new CLemonPlayerApp; } // --------------------------------------------------------- // E32Dll(TDllReason) // Entry point function for EPOC Apps // Returns: KErrNone: No error // --------------------------------------------------------- // GLDEF_C TInt E32Dll( TDllReason ) { return KErrNone; } // End of File
[ "zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494" ]
[ [ [ 1, 66 ] ] ]
f0e4c73b6b052b8df8deb288846f909e31c53cc6
77aa13a51685597585abf89b5ad30f9ef4011bde
/dep/src/boost/boost/fusion/support/detail/is_mpl_sequence.hpp
1713abac113f475183ee6d873eb46295ae3aa0c7
[ "BSL-1.0" ]
permissive
Zic/Xeon-MMORPG-Emulator
2f195d04bfd0988a9165a52b7a3756c04b3f146c
4473a22e6dd4ec3c9b867d60915841731869a050
refs/heads/master
2021-01-01T16:19:35.213330
2009-05-13T18:12:36
2009-05-14T03:10:17
200,849
8
10
null
null
null
null
UTF-8
C++
false
false
966
hpp
/*============================================================================= Copyright (c) 2001-2006 Joel de Guzman Copyright (c) 2005-2006 Dan Marsden Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_DETAIL_IS_MPL_SEQUENCE_29122006_1105) #define FUSION_DETAIL_IS_MPL_SEQUENCE_29122006_1105 #include <boost/fusion/support/sequence_base.hpp> #include <boost/type_traits/is_base_of.hpp> #include <boost/mpl/is_sequence.hpp> #include <boost/mpl/and.hpp> #include <boost/mpl/not.hpp> namespace boost { namespace fusion { namespace detail { template <typename T> struct is_mpl_sequence : mpl::and_< mpl::not_<is_base_of<sequence_root, T> > , mpl::is_sequence<T> > {}; }}} #endif
[ "pepsi1x1@a6a5f009-272a-4b40-a74d-5f9816a51f88" ]
[ [ [ 1, 27 ] ] ]
f1d8dd2962b0afe74008ba46cc549f68a2d59862
30562d1d5f179ba095ef60a772369337b1a6c2a9
/VideoInputSharp/VideoInputFormat.h
36705925ff61d5320008a298c9f74ab624ab44e7
[ "BSD-2-Clause-Views" ]
permissive
solvivivi/videoinputsharp
527db20afb0cb20410077738d2db25a0ea94101c
b73dcce4da52652847996d7a8e84cbc0273e788e
refs/heads/master
2021-01-10T03:35:41.984956
2009-10-14T16:32:20
2009-10-14T16:32:20
55,378,469
0
0
null
null
null
null
UTF-8
C++
false
false
633
h
#pragma once using namespace System; namespace VideoInputSharp { /// <summary> /// Camera resolution /// </summary> public enum class VideoInputFormat : Int32 { NTSC_M = VI_NTSC_M, PAL_B = VI_PAL_B, PAL_D = VI_PAL_D, PAL_G = VI_PAL_G, PAL_H = VI_PAL_H, PAL_I = VI_PAL_I, PAL_M = VI_PAL_M, PAL_N = VI_PAL_N, PAL_NC = VI_PAL_NC, SECAM_B = VI_SECAM_B, SECAM_D = VI_SECAM_D, SECAM_G = VI_SECAM_G, SECAM_H = VI_SECAM_H, SECAM_K = VI_SECAM_K, SECAM_K1 = VI_SECAM_K1, SECAM_L = VI_SECAM_L, NTSC_M_J = VI_NTSC_M_J, NTSC_433 = VI_NTSC_433, }; }
[ "schimatk@eaff96c4-b8d5-11de-ba48-051263943efc" ]
[ [ [ 1, 31 ] ] ]
885e1cde0122ea29a8f88bf5bb2631a652b1b4bb
21dcab8a06b80b13f2536f4932e23eccae1dd13d
/src/BlackJack/SmartTimer.cpp
e5cd1f5fb6ab6811647c63e67c64d4e37b46eed4
[]
no_license
demontiejr/blackjackpoker
2cff7e07d5f52144f44d95137f0ff57b99a75d53
7ff5e4b1fb4966d6d6ad30cffe1f29d053bfa34b
refs/heads/master
2016-08-11T12:13:11.927157
2011-10-25T13:23:36
2011-10-25T13:23:36
46,422,688
0
0
null
null
null
null
UTF-8
C++
false
false
593
cpp
/* * SmartTimer.cpp * * Created on: 06/10/2011 * Author: Arthur Holanda */ #include "BlackJack/SmartTimer.h" SmartTimer::SmartTimer() { } SmartTimer::~SmartTimer() { } void SmartTimer::Iniciar(int acionId, int milisegundos) { this->actionId = acionId; result r = E_SUCCESS; r = this->Start(milisegundos); if (IsFailed(r)) { goto CATCH; } return; CATCH: return; } void SmartTimer::Construir(Osp::Base::Runtime::ITimerEventListener & listener) { this->Construct(listener); } void SmartTimer::Cancelar() { this->Cancel(); }
[ [ [ 1, 39 ] ] ]
7846dddfe1f81928f45b12134499f7eec2cd05ce
3856c39683bdecc34190b30c6ad7d93f50dce728
/LastProject/Source/GameEventTutorial.h
413670228ab3085690bd423af7bc7119f83167d6
[]
no_license
yoonhada/nlinelast
7ddcc28f0b60897271e4d869f92368b22a80dd48
5df3b6cec296ce09e35ff0ccd166a6937ddb2157
refs/heads/master
2021-01-20T09:07:11.577111
2011-12-21T22:12:36
2011-12-21T22:12:36
34,231,967
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
529
h
#pragma once #ifndef _GAMEEVENTTUTORIAL_H_ #define _GAMEEVENTTUTORIAL_H_ class GameEventTutorial { public: // ¾À »óŰª enum TUTORIAL_STATE { TUTORIAL_COMBO = 0, TUTORIAL_FIRSTAID, TUTORIAL_SIGNALLIGHT, TUTORIAL_RUNNING, TUTORIAL_END }; public: GameEventTutorial() {} virtual ~GameEventTutorial() {} virtual VOID Create() = 0; virtual VOID Update() = 0; virtual VOID Render() = 0; virtual DWORD GetState() = 0; virtual VOID SetState( DWORD _dState ) = 0; }; #endif
[ "[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0" ]
[ [ [ 1, 31 ] ] ]
3a634fedc17722163a732d9490a4140388f6df3b
2112057af069a78e75adfd244a3f5b224fbab321
/branches/ref1/src-root/include/common/Ogre/paging_landscape/OgrePagingLandScapeTexture_Image.h
32cbc192cf821a30f160f7ee788ace8190680f15
[]
no_license
blockspacer/ireon
120bde79e39fb107c961697985a1fe4cb309bd81
a89fa30b369a0b21661c992da2c4ec1087aac312
refs/heads/master
2023-04-15T00:22:02.905112
2010-01-07T20:31:07
2010-01-07T20:31:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,671
h
/*************************************************************************** OgrePagingLandScapeTexture_Image.h - description ------------------- begin : Fri Apr 16 2004 copyright : (C) 2002-2005 by Jose A Milan & Tuan Kuranes email : [email protected] & [email protected] ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * ***************************************************************************/ #ifndef PAGINGLANDSCAPETEXTURE_IMAGE_H #define PAGINGLANDSCAPETEXTURE_IMAGE_H #include "OgrePagingLandScapePrerequisites.h" namespace Ogre { class PagingLandScapeTexture_Image : public PagingLandScapeTexture { public: PagingLandScapeTexture_Image( void ); virtual String getName(){return String("Image");} virtual ~PagingLandScapeTexture_Image( void ); virtual PagingLandScapeTexture* newTexture( ); virtual bool TextureRenderCapabilitesFullfilled(); protected: virtual void _loadMaterial( void ); }; } #endif
[ [ [ 1, 42 ] ] ]
2ee713eb1172948a1e38b8714431d05d02b61b1d
5ac4267cf866d897e1e6446ebbc71143b10a77ef
/ExcelAutomationLib/Noncopyable.h
4db2c80281e0d46d7eac04daa93717f8f449c7d2
[]
no_license
yongce/excel-automation-lib
404782b867b287477e96a7ef2a391dcb06210164
c79711a6623aa43e6d64ad9e9de87c3854cbdba5
refs/heads/master
2021-01-01T16:35:00.472266
2010-10-04T14:09:29
2010-10-04T14:09:29
32,120,791
2
1
null
null
null
null
UTF-8
C++
false
false
949
h
/*! * @file Noncopyable.h * @brief Header file for class Noncopyable * @date 2009-12-01 * @author Tu Yongce <[email protected]> * @version $Id$ */ #ifndef NONCOPYABLE_H_GUID_77EEEF35_EF3F_4B71_AA1E_5AECDA38DDAB #define NONCOPYABLE_H_GUID_77EEEF35_EF3F_4B71_AA1E_5AECDA38DDAB #include "LibDef.h" // <begin> namespace EXCEL_AUTOMATION_NAMESPACE_START /*! * @brief An utility class used to forbid copy ctor & copy assignment. * @details Any class can inherit this class to forbid its own copy ctor & copy assignment. */ class Noncopyable { protected: Noncopyable() {} ~Noncopyable() {} private: // Forbid copy ctor & copy assignment. No need to implement them. Noncopyable(const Noncopyable &); Noncopyable& operator = (const Noncopyable &); }; // <end> namespace EXCEL_AUTOMATION_NAMESPACE_END #endif //NONCOPYABLE_H_GUID_77EEEF35_EF3F_4B71_AA1E_5AECDA38DDAB
[ "tuyongce@e04aa62a-14a2-92d9-bf20-eeb9a5d2289a" ]
[ [ [ 1, 42 ] ] ]
d335de604297b9428950b62f5a1fbe78bf0f05bf
1ae2f659bb2e80698684074c48920d05cd6bc05a
/src/tad08OK.cpp
959753e67d5229871162a45d70401ecc2cd17f5e
[]
no_license
AntonioManuelGarcia/ped-loris
f1a479de890ee274f081618cf505bd5a377e3dbf
4d9847c9d280e1141d1cf6dbe6825970d1109bad
refs/heads/master
2016-09-01T11:07:04.989259
2011-06-11T17:33:25
2011-06-11T17:33:25
36,604,917
0
0
null
null
null
null
UTF-8
C++
false
false
229
cpp
//Mostrar tablas hash vacias de distinto tamaño #include "thashcalendario.h" int main() { THASHCalendario a(1), b(2), c(3); cout << a << endl; cout << b << endl; cout << c << endl; return 0; }
[ "arkariang@f1768c50-85fa-8e18-060e-33f9a243e389", "Arkariang@f1768c50-85fa-8e18-060e-33f9a243e389" ]
[ [ [ 1, 2 ], [ 4, 4 ], [ 7, 7 ], [ 9, 11 ], [ 13, 14 ], [ 16, 16 ] ], [ [ 3, 3 ], [ 5, 6 ], [ 8, 8 ], [ 12, 12 ], [ 15, 15 ] ] ]
7c67a7ea6d9f8168028daa349f2d94ccef4e319e
6c8c4728e608a4badd88de181910a294be56953a
/TextureDecoderModule/TextureRequest.cpp
f5defcffb692425c7b5df7f7e149cf032a0629b3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
caocao/naali
29c544e121703221fe9c90b5c20b3480442875ef
67c5aa85fa357f7aae9869215f840af4b0e58897
refs/heads/master
2021-01-21T00:25:27.447991
2010-03-22T15:04:19
2010-03-22T15:04:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,181
cpp
#include "StableHeaders.h" #include "TextureRequest.h" #include "TextureDecoderModule.h" namespace TextureDecoder { TextureRequest::TextureRequest() : requested_(false), decode_requested_(false), size_(0), received_(0), width_(0), height_(0), levels_(-1), decoded_level_(-1), next_level_(5) { } TextureRequest::TextureRequest(const std::string& id) : id_(id), requested_(false), decode_requested_(false), size_(0), received_(0), width_(0), height_(0), levels_(-1), decoded_level_(-1), next_level_(5) { } TextureRequest::~TextureRequest() { } void TextureRequest::UpdateSizeReceived(uint size, uint received) { size_ = size; received_ = received; // If has all data, can decode the max. quality level if ((size_) && (received >= size_)) next_level_ = 0; } bool TextureRequest::HasEnoughData() const { return received_ >= EstimateDataSize(next_level_); } uint TextureRequest::EstimateDataSize(int level) const { if (level < 0) level = 0; // If nothing known of the image yet, assume the first full packet will tell us everything uint estimate = 600; // If know the dimensions, do data size estimation if ((width_) && (height_) && (components_)) estimate = (uint)((width_ >> level) * (height_ >> level) * components_ * 0.15f); // If asset size known, adjust level 0 to require whole asset downloaded, and make sure // the estimate is not higher than actual data size if (size_) { if (!level) estimate = size_; if (estimate > size_) estimate = size_; } return estimate; } bool TextureRequest::UpdateWithDecodeResult(DecodeResult* result) { if (result) { // Decode no longer pending decode_requested_ = false; // Update amount of quality levels, should now be known levels_ = result->max_levels_; // See if successfully decoded data if (result->texture_) { // Update texture original dimensions, should now be known width_ = result->original_width_; height_ = result->original_height_; components_ = result->components_; decoded_level_ = next_level_; } // Set next quality level to decode // We do this regardless of success or failure, so that illegal texture data will // not cause endless re-decoding attempts if (next_level_ > 0) { next_level_--; return false; } } return true; } }
[ "cadaver@5b2332b8-efa3-11de-8684-7d64432d61a3" ]
[ [ [ 1, 110 ] ] ]
88b0a5ed41a0af6fef32eee6e999c9164c692347
960a896c95a759a41a957d0e7dbd809b5929c999
/Game/SwarmState.cpp
dccaca61bc3bc66ae9eeed336b3c0aa389244672
[]
no_license
WSPSNIPER/dangerwave
8cbd67a02eb45563414eaf9ecec779cc1a7f09d5
51af1171880104aa823f6ef8795a2f0b85b460d8
refs/heads/master
2016-08-12T09:50:00.996204
2010-08-24T22:55:52
2010-08-24T22:55:52
48,472,531
0
0
null
null
null
null
UTF-8
C++
false
false
6,380
cpp
#include "SwarmState.h" #include "GameManager.h" #include "FailState.h" #include "Trig.h" int state = OUT_OF_ROUND; int status = PASS; bool setup = false; SwarmState* SwarmState::_instance = NULL; // listinging to chelsea grin and bring me the horizion and programming my ass off to meet the // dead line lol SwarmState* SwarmState::GetInst() { if(!_instance) _instance = new SwarmState; return _instance; } SwarmState::SwarmState() : _scoreGoal(0), _score(0), _currentLevel(0), _player(0), _level("maps/island2.map", "images/tiles.png"), _manager(EntityManager::GetInst()), _images(ImageManager::GetInst()), _tree(2, _level.GetWidth()*32, _level.GetHeight()*32), _enemyCount(0) { std::cout << _level.GetHeight() << std::endl; _player = new Player(320, 240, &_view, "images/player.png"); _manager->Add(_player); srand((unsigned)time(NULL)); _pressText.SetPosition(150, 200); _pressText.SetText("Press P To Start The Round"); _timerText2.SetPosition(2.f,10.f); _scoreText2.SetPosition(2.f,30.f); _levelText2.SetPosition(2.f,50.f); _timerText.SetPosition(100.f,10.f); _scoreText.SetPosition(100.f,30.f); _levelText.SetPosition(100.f,50.f); _message.SetPosition(2.f, 80.f); _message.SetText("START THE GAME ALREADY"); _timerText2.SetText("time:"); _scoreText2.SetText("score:"); _levelText2.SetText("level:"); _music.OpenFromFile("sounds/game_music.ogg"); _health = _player->GetHealthBar(); } SwarmState::~SwarmState() { if(_instance) delete _instance; } void SwarmState::Init() { _rand.SetSeed((unsigned)time(NULL)); } void SwarmState::Cleanup() { } void SwarmState::HandleEvents(GameManager* mgr) { const sf::Input& input = mgr->GetInput(); while(mgr->GetEvent(_event)) { cell::UIState::GetInst()->Update(_event); if(_event.Type == sf::Event::Closed) { mgr->Close(); } if(state == OUT_OF_ROUND) { if(input.IsKeyDown(sf::Key::P)) { StartRound(_currentLevel); state = IN_ROUND; _currentLevel++; _music.Play(); _spawnTimer.Reset(); _scoreTimer.Reset(); } } } } void SwarmState::SpawnFood(int amnt) { for(int i =0; i < amnt; i++) { _manager->Add(new Food(_rand.Random(40, (_level.GetWidth()*32) - 50), _rand.Random(40, (_level.GetHeight()*32) - 50), 10, "images/food.png")); } _scoreGoal = amnt; } void SwarmState::SpawnWave(int amnt) { for(int i = 0; i < amnt; i++) { _manager->Add(new Enemy(_rand.Random(40, (_level.GetWidth()*32) - 50), _rand.Random(40, (_level.GetHeight()*32)- 50), _rand.Random(1.f, 3.5f))); } } void SwarmState::StartRound(int level) { SpawnWave(40); SpawnFood(20); amount = 12; _timer.Reset(); } void SwarmState::Render(GameManager* mgr) { _level.Render(*mgr); _manager->Render(*mgr); mgr->Draw(_scoreText); mgr->Draw(_timerText); mgr->Draw(_levelText); mgr->Draw(_scoreText2); mgr->Draw(_timerText2); mgr->Draw(_levelText2); mgr->Draw(_health); mgr->Draw(_message); if(state == OUT_OF_ROUND) { mgr->Draw(_pressText); } } void SwarmState::UpdateMsg() { if(_score == 0) { _message.SetText("SUPER NOOB"); } if(_score >= 1) { _message.SetText("NOOB"); } if(_score >= 5) { _message.SetText("Surviving!"); } if(_score >= 10) { _message.SetText("Beast!"); } if(_score >= 15) { _message.SetText("The Best of the Best!"); } if(_score >= 20) { _message.SetText("GOD!!!"); } } void SwarmState::UpdateText() { UpdateMsg(); if(_scoreTimer.GetElapsedTime() >= 10) { _score++; score++; _scoreTimer.Reset(); } if(_spawnTimer.GetElapsedTime() >= 20.f) { SpawnWave(22); SpawnFood(30); _spawnTimer.Reset(); } char buffer[33]; _scoreText.SetText(itoa(_score, buffer, 10)); _levelText.SetText(itoa(_currentLevel, buffer, 10)); _timerText.SetText(itoa((int)_timer.GetElapsedTime(), buffer, 10)); } /// make the scoring about seeing how long you can last the wave. void SwarmState::Update(GameManager* mgr) { _timerText2.SetPosition(mgr->ConvertCoords(2.f,10.f, &_view)); _scoreText2.SetPosition(mgr->ConvertCoords(2.f,30.f, &_view)); _levelText2.SetPosition(mgr->ConvertCoords(2.f,50.f, &_view)); _timerText.SetPosition(mgr->ConvertCoords(100.f,10.f, &_view)); _scoreText.SetPosition(mgr->ConvertCoords(100.f,30.f, &_view)); _levelText.SetPosition(mgr->ConvertCoords(100.f,50.f, &_view)); _message.SetPosition(mgr->ConvertCoords(2.f, 80.f, &_view)); if(_player->GetHp() > 50) _health = sf::Shape::Rectangle(mgr->ConvertCoords(520, 20, &_view), mgr->ConvertCoords(520+_player->GetHp(), 40, &_view), sf::Color(20, 230, 30)); else _health = sf::Shape::Rectangle(mgr->ConvertCoords(520, 20, &_view), mgr->ConvertCoords(520+_player->GetHp(), 40, &_view), sf::Color(230, 20, 30)); if(!setup) { _view = mgr->GetDefaultView(); _player->SetView(&_view); mgr->SetView(_view); setup = true; } _manager->Update(); UpdateText(); if(state == IN_ROUND) { _tree.Update(_manager); _tree.CheckCollisions(); if(_timer.GetElapsedTime() >= TIME_LIMIT) { state = OUT_OF_ROUND; _manager->Clear(); status = FAIL; mgr->PushState(FailState::GetInst()); } else if(_player->Dead()) { state = OUT_OF_ROUND; _manager->Clear(); status = FAIL; mgr->PushState(FailState::GetInst()); } std::cout << _manager->GetVector().size() << std::endl; } }
[ "michaelbond2008@e78017d1-81bd-e181-eab4-ba4b7880cff6", "lukefangel@e78017d1-81bd-e181-eab4-ba4b7880cff6" ]
[ [ [ 1, 2 ], [ 8, 9 ], [ 13, 21 ], [ 31, 31 ], [ 56, 63 ], [ 65, 72 ], [ 111, 112 ], [ 124, 125 ], [ 193, 193 ], [ 195, 196 ], [ 246, 246 ] ], [ [ 3, 7 ], [ 10, 12 ], [ 22, 30 ], [ 32, 55 ], [ 64, 64 ], [ 73, 110 ], [ 113, 123 ], [ 126, 192 ], [ 194, 194 ], [ 197, 245 ] ] ]
42f7d329ad2c3307343133cadb369262e8fe1878
f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0
/Depend/MyGUI/Tools/LayoutEditor/WidgetContainer.h
92b04e04138d9f6d457dc31f5f6f2992d817c605
[]
no_license
lxinhcn/starworld
79ed06ca49d4064307ae73156574932d6185dbab
86eb0fb8bd268994454b0cfe6419ffef3fc0fc80
refs/heads/master
2021-01-10T07:43:51.858394
2010-09-15T02:38:48
2010-09-15T02:38:48
47,859,019
2
1
null
null
null
null
UTF-8
C++
false
false
1,612
h
#ifndef __WIDGET_CONTAINER_H__ #define __WIDGET_CONTAINER_H__ #include "MyGUI.h" namespace tools { const std::string DEFAULT_EDITOR_LAYER = "LayoutEditor_Widgets"; const std::string DEFAULT_LAYER = "Back"; struct ControllerInfo { std::string mType; MyGUI::MapString mProperty; }; struct WidgetContainer { WidgetContainer() : widget(nullptr), relative_mode(false) { } WidgetContainer(const std::string& _type, const std::string& _skin, MyGUI::Widget* _widget, const std::string& _name = ""): widget(_widget), type(_type), skin(_skin), name(_name), layer(""), relative_mode(false) { } MyGUI::Widget* widget; std::vector<WidgetContainer*> childContainers; MyGUI::VectorStringPairs mProperty; MyGUI::VectorStringPairs mUserString; std::vector<ControllerInfo*> mController; std::string type; std::string skin; std::string align; std::string name; std::string layer; // not for saving std::string position(bool _percent = true) { if (relative_mode) { MyGUI::FloatCoord coord = MyGUI::CoordConverter::convertToRelative(widget->getCoord(), widget->getParentSize()); std::ostringstream stream; if (_percent) stream << coord.left * 100 << " " << coord.top * 100 << " " << coord.width * 100 << " " << coord.height * 100; else stream << coord.left << " " << coord.top << " " << coord.width << " " << coord.height; return stream.str(); } return widget->getCoord().print(); } bool relative_mode; }; } // namespace tools #endif // __WIDGET_CONTAINER_H__
[ "albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c" ]
[ [ [ 1, 60 ] ] ]
54d4c4d339c6eb2c905ee73870bcf5dadee0236d
fc4946d917dc2ea50798a03981b0274e403eb9b7
/gentleman/gentleman/WindowsAPICodePack/WindowsAPICodePack/DirectX/DirectX/Direct3D10/D3D10DepthStencilState.h
e2ad0dd25ee3c0699296d5fe7654d02952fdc48c
[]
no_license
midnite8177/phever
f9a55a545322c9aff0c7d0c45be3d3ddd6088c97
45529e80ebf707e7299887165821ca360aa1907d
refs/heads/master
2020-05-16T21:59:24.201346
2010-07-12T23:51:53
2010-07-12T23:51:53
34,965,829
3
2
null
null
null
null
UTF-8
C++
false
false
1,229
h
//Copyright (c) Microsoft Corporation. All rights reserved. #pragma once #include "D3D10DeviceChild.h" namespace Microsoft { namespace WindowsAPICodePack { namespace DirectX { namespace Direct3D10 { using namespace System; /// <summary> /// A depth-stencil-state interface accesses depth-stencil state which sets up the depth-stencil test for the output-merger stage. /// <para>(Also see DirectX SDK: ID3D10DepthStencilState)</para> /// </summary> public ref class DepthStencilState : public DeviceChild { public: /// <summary> /// Get the depth-stencil state. /// <para>(Also see DirectX SDK: ID3D10DepthStencilState::GetDesc)</para> /// </summary> /// <returns>The depth-stencil state (see <see cref="DepthStencilDescription"/>)<seealso cref="DepthStencilDescription"/>.</returns> property DepthStencilDescription Description { DepthStencilDescription get(); } internal: DepthStencilState() { } DepthStencilState(ID3D10DepthStencilState* pNativeID3D10DepthStencilState) : DeviceChild(pNativeID3D10DepthStencilState) { } }; } } } }
[ "lucemia@9e708c16-f4dd-11de-aa3c-59de0406b4f5" ]
[ [ [ 1, 35 ] ] ]
06602791976e6ffd1fe97bbd1752c9d6c2a14599
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/Dependencies/Xerces/include/xercesc/validators/datatype/NCNameDatatypeValidator.cpp
02315b8a1bdca65659e1d2a2a2c877ad0f3ed826
[]
no_license
svn2github/ngene
b2cddacf7ec035aa681d5b8989feab3383dac012
61850134a354816161859fe86c2907c8e73dc113
refs/heads/master
2023-09-03T12:34:18.944872
2011-07-27T19:26:04
2011-07-27T19:26:04
78,163,390
2
0
null
null
null
null
UTF-8
C++
false
false
4,615
cpp
/* * Copyright 2001,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: NCNameDatatypeValidator.cpp 191054 2005-06-17 02:56:35Z jberry $ */ // --------------------------------------------------------------------------- // Includes // --------------------------------------------------------------------------- #include <xercesc/validators/datatype/NCNameDatatypeValidator.hpp> #include <xercesc/validators/datatype/InvalidDatatypeValueException.hpp> XERCES_CPP_NAMESPACE_BEGIN // --------------------------------------------------------------------------- // Constructors and Destructor // --------------------------------------------------------------------------- NCNameDatatypeValidator::NCNameDatatypeValidator(MemoryManager* const manager) :StringDatatypeValidator(0, 0, 0, DatatypeValidator::NCName, manager) {} NCNameDatatypeValidator::~NCNameDatatypeValidator() {} NCNameDatatypeValidator::NCNameDatatypeValidator( DatatypeValidator* const baseValidator , RefHashTableOf<KVStringPair>* const facets , RefArrayVectorOf<XMLCh>* const enums , const int finalSet , MemoryManager* const manager) :StringDatatypeValidator(baseValidator, facets, finalSet, DatatypeValidator::NCName, manager) { init(enums, manager); } DatatypeValidator* NCNameDatatypeValidator::newInstance ( RefHashTableOf<KVStringPair>* const facets , RefArrayVectorOf<XMLCh>* const enums , const int finalSet , MemoryManager* const manager ) { return (DatatypeValidator*) new (manager) NCNameDatatypeValidator(this, facets, enums, finalSet, manager); } NCNameDatatypeValidator::NCNameDatatypeValidator( DatatypeValidator* const baseValidator , RefHashTableOf<KVStringPair>* const facets , const int finalSet , const ValidatorType type , MemoryManager* const manager) :StringDatatypeValidator(baseValidator, facets, finalSet, type, manager) { // do not invoke init() here!!! } // ----------------------------------------------------------------------- // Compare methods // ----------------------------------------------------------------------- int NCNameDatatypeValidator::compare(const XMLCh* const lValue , const XMLCh* const rValue , MemoryManager* const) { return ( XMLString::equals(lValue, rValue)? 0 : -1); } void NCNameDatatypeValidator::validate(const XMLCh* const content , ValidationContext* const context , MemoryManager* const manager) { // use StringDatatypeValidator (which in turn, invoke // the baseValidator) to validate content against // facets if any. // StringDatatypeValidator::validate(content, context, manager); return; } void NCNameDatatypeValidator::checkValueSpace(const XMLCh* const content , MemoryManager* const manager) { // // 3.3.7 check must: "NCName" // if ( !XMLString::isValidNCName(content)) { ThrowXMLwithMemMgr1(InvalidDatatypeValueException , XMLExcepts::VALUE_Invalid_NCName , content , manager); } } /*** * Support for Serialization/De-serialization ***/ IMPL_XSERIALIZABLE_TOCREATE(NCNameDatatypeValidator) void NCNameDatatypeValidator::serialize(XSerializeEngine& serEng) { StringDatatypeValidator::serialize(serEng); } XERCES_CPP_NAMESPACE_END /** * End of file NCNameDatatypeValidator.cpp */
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 126 ] ] ]
b4bf5a3a369cbe5cd29b3bd49a0373c6c9e5c9c9
49f5a108a2ac593b9861f9747bd82eb597b01e24
/src/LinearAlgebra/Transformation.cpp
27ae6c8034c2e06b3d0758fd5e461a45074c14b9
[]
no_license
gpascale/iSynth
5801b9a1b988303ad77872fad98d4bf76d86e8fe
e45e24590fabb252a5ffd10895b2cddcc988b83d
refs/heads/master
2021-03-19T06:01:57.451784
2010-08-02T02:22:54
2010-08-02T02:22:54
811,695
0
1
null
null
null
null
UTF-8
C++
false
false
3,403
cpp
#include "Transformation.h" Transformation::Transformation(void) : m_rotation(0.0f, 0.0f, 0.0f) { applyIdentity(); } Transformation::~Transformation(void) { } void Transformation::applyIdentity() { Matrix::IdentityMatrix(m_translate); Matrix::IdentityMatrix(m_rotate); Matrix::IdentityMatrix(m_scale); Matrix::IdentityMatrix(m_composite); } void Transformation::applyAbsoluteTranslation(float x, float y, float z) { Matrix::TranslationMatrix( m_translate, x, y, z ); m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyRelativeTranslation(float x, float y, float z) { m_translate(3, 0) += x; m_translate(3, 1) += y; m_translate(3, 2) += z; m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyAbsoluteTranslation(const Vector3 &v) { applyAbsoluteTranslation(v.x, v.y, v.z); } void Transformation::applyRelativeTranslation(const Vector3 &v) { applyRelativeTranslation(v.x, v.y, v.z); } void Transformation::applyAbsoluteRotation(float x, float y, float z) { /* m_rotation[0] = fmod(x, 6.28f); m_rotation[1] = fmod(y, 6.28f); m_rotation[2] = fmod(z, 6.28f); */ m_rotation[0] = x; m_rotation[1] = y; m_rotation[2] = z; Matrix::RotationMatrixXYZ(m_rotate, m_rotation.x, m_rotation.y, m_rotation.z); m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyRelativeRotation(float x, float y, float z) { m_rotation[0] += x; m_rotation[1] += y; m_rotation[2] += z; Matrix::RotationMatrixXYZ(m_rotate, m_rotation.x, m_rotation.y, m_rotation.z); m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyAbsoluteRotation(const Vector3 &v) { applyAbsoluteRotation(v.x, v.y, v.z); m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyRelativeRotation(const Vector3 &v) { applyRelativeRotation(v.x, v.y, v.z); m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyAbsoluteScale(float x, float y, float z) { Matrix::ScaleMatrix(m_scale, x, y, z); m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyRelativeScale(float x, float y, float z) { m_scale(0, 0) *= x; m_scale(1, 1) *= y; m_scale(2, 2) *= z; m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyAbsoluteScale(const Vector3 &v) { applyAbsoluteScale(v.x, v.y, v.z); m_composite = m_scale * m_rotate * m_translate; } void Transformation::applyRelativeScale(const Vector3 &v) { applyRelativeScale(v.x , v.y, v.z); m_composite = m_scale * m_rotate * m_translate; } const Matrix& Transformation::getMatrix() const { //get rid of this when done debugging //m_composite = m_scale * m_rotate * m_translate; return (const Matrix&) m_composite; } void Transformation::getPosition(Vector3 &out) const { out.x = m_translate(3, 0); out.y = m_translate(3, 1); out.z = m_translate(3, 2); } void Transformation::getRotation(Vector3 &out) const { Vector3::copyVector3(out, m_rotation); } void Transformation::getScale(Vector3 &out) const { out.x = m_scale(0, 0); out.y = m_scale(1, 1); out.z = m_scale(2, 2); }
[ [ [ 1, 181 ] ] ]
07e1a8c5144c20070556c5207a6748bccb348c10
216ae2fd7cba505c3690eaae33f62882102bd14a
/utils/nxogre/include/NxOgreContactPair.h
dc497174cb1dc9f0b9a173c2df8f5913c77071e2
[]
no_license
TimelineX/balyoz
c154d4de9129a8a366c1b8257169472dc02c5b19
5a0f2ee7402a827bbca210d7c7212a2eb698c109
refs/heads/master
2021-01-01T05:07:59.597755
2010-04-20T19:53:52
2010-04-20T19:53:52
56,454,260
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
2,159
h
/** File: NxOgreContactPair.h Created on: 20-Aug-09 Author: Robin Southern "betajaen" SVN: $Id$ © Copyright, 2008-2009 by Robin Southern, http://www.nxogre.org This file is part of NxOgre. NxOgre is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NxOgre is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with NxOgre. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NXOGRE_CONTACTPAIR_H #define NXOGRE_CONTACTPAIR_H #include "NxOgreStable.h" #include "NxOgreCommon.h" namespace NxOgre_Namespace { /** \brief */ class ContactPair { public: /** \brief The two RigidBodies that are in contact */ RigidBody* mFirst, *mSecond; /** \brief The total contact normal force that was applied for this pair, to maintain nonpenetration constraints. You should set Enums::ContactPairFlags_Forces in order to receive this value. */ Vec3 mSumNormalForce; /** \brief The total tangential force that was applied for this pair. You should set Enums::ContactPairFlags_Forces in order to receive this value. */ Vec3 mSumFrictionForce; }; } // namespace PhysXEntityReport #endif
[ "umutert@b781d008-8b8c-11de-b664-3b115b7b7a9b" ]
[ [ [ 1, 67 ] ] ]
15e0ac99678a4595cb3db2ccfe687f713f3e4848
0720d1d1dafeab58e9da83e8d4b16008ef63222d
/Renderer/TextureMapTest1.cpp
105918b53f6f6205ef11b51da6c00423080ef69b
[]
no_license
theonlynexus/quokka3d
a676f617ad4d7ee655401f37ed8820c4497e12b4
faeaf00f366b964c94e5a1e9ba979be193d82c4d
refs/heads/master
2016-09-05T21:17:04.981500
2007-06-02T16:01:48
2007-06-02T16:01:48
41,408,006
0
1
null
null
null
null
UTF-8
C++
false
false
8,792
cpp
// Renderer.cpp : Defines the entry point for the console application. // #include <iostream> #include <string> #include "vector3d.h" #include "rectangle3D.h" #include "primitives.h" #include "viewwindow.h" #include "solidpolygon3d.h" #include "polygonrenderer.h" #include "solidpolygonrenderer.h" #include "SimpleTexturedPolygonRenderer.h" #include "PixelToaster.h" using namespace std; using namespace Quokka3D; using namespace PixelToaster; const int width = 640; const int height = 480; std::vector<TrueColorPixel> pixels(width * height); // screen is a linear sequence of pixels class Application : public Listener { public: Application() { quit = false; keyW = false; keyS = false; keyA = false; keyD = false; keyUp = false; keyDown = false; keyRotLeft = false; keyRotRight = false; keyTiltLeft = false; keyTiltRight = false; mouse_x = width/2.0f; mouse_y = height/2.0f; firstRun = true; x = 0.0f; y = 100.0f; z = 0.0f; numFrames = 0; diff_x = 0.0f; diff_y = 0.0f; mouseMoved = false; } // Create a house (convex polyhedra) // All faces must use anti-clockwise winding order void createPolygons() { Polygon3D poly; // walls poly = Polygon3D( Vector3D(-128, 256, -1000), Vector3D(-128, 0, -1000), Vector3D(128, 0, -1000), Vector3D(128, 256, -1000)); polys.push_back(poly); } // timeDelta is in seconds void update(double timeDelta) { float distanceChange = 500.0f * (float)timeDelta; float angleChange = 0.1f * (float)timeDelta; if (keyW) { polygonRenderer->getCamera().getLocation().x -= distanceChange * polygonRenderer->getCamera().getSinAngleY(); polygonRenderer->getCamera().getLocation().z -= distanceChange * polygonRenderer->getCamera().getCosAngleY(); } if (keyS) { polygonRenderer->getCamera().getLocation().x += distanceChange * polygonRenderer->getCamera().getSinAngleY(); polygonRenderer->getCamera().getLocation().z += distanceChange * polygonRenderer->getCamera().getCosAngleY(); } if (keyA) { polygonRenderer->getCamera().getLocation().x -= distanceChange * polygonRenderer->getCamera().getCosAngleY(); polygonRenderer->getCamera().getLocation().z += distanceChange * polygonRenderer->getCamera().getSinAngleY(); } if (keyD) { polygonRenderer->getCamera().getLocation().x += distanceChange * polygonRenderer->getCamera().getCosAngleY(); polygonRenderer->getCamera().getLocation().z -= distanceChange * polygonRenderer->getCamera().getSinAngleY(); } if (keyUp) { polygonRenderer->getCamera().getLocation().y += distanceChange; } if (keyDown) { polygonRenderer->getCamera().getLocation().y -= distanceChange; } if (keyRotLeft) { polygonRenderer->getCamera().rotateAngleY(angleChange); } if (keyRotRight) { polygonRenderer->getCamera().rotateAngleY(-angleChange); } if (keyTiltLeft) { polygonRenderer->getCamera().rotateAngleZ(angleChange); } if (keyTiltRight) { polygonRenderer->getCamera().rotateAngleZ(-angleChange); } if (mouseMoved) { polygonRenderer->getCamera().rotateAngleY(-diff_x * angleChange); polygonRenderer->getCamera().rotateAngleX(-diff_y * angleChange); mouseMoved = false; } } void render(Display& display) { polygonRenderer->startFrame(); for (size_t i=0; i!=polys.size(); ++i) { polygonRenderer->draw(&polys[i]); } display.update(pixels); } int run() { Display display( "Fullscreen Example", width, height, Output::Windowed, Mode::TrueColor ); // register listener display.listener(this); createPolygons(); ViewWindow view(0, 0, width, height, DegToRad(75)); Transform3D camera(x, y, z); polygonRenderer = new SimpleTexturedPolygonRenderer(camera, view, "test_pattern.png"); //remember to delete // TEST // SimpleTexturedPolygonRenderer* stpr = new SimpleTexturedPolygonRenderer(camera, view, "test_pattern.png"); // END OF TEST double time = timer.time(); while (!quit) { //const double delta = timer.delta(); //const double res = timer.resolution(); update(timer.delta()); //cout << "Facing: " << polygonRenderer->m_numFacing << " Clipped: " << polygonRenderer->m_numClipped << endl; // quick and dirty fps calculator, calculate every 0.5s time = timer.time(); if (time > 0.5) { cout << (double)numFrames / time << endl; numFrames = 0; timer.reset(); } render(display); polygonRenderer->resetCounters(); numFrames++; } delete polygonRenderer; return 0; } protected: void handleKeys(const Key& key) { switch(key) { case Key::W : keyW = !keyW; break; case Key::S : keyS = !keyS; break; case Key::A : keyA = !keyA; break; case Key::D : keyD = !keyD; break; case Key::Up : keyUp = !keyUp; break; case Key::Down : keyDown = !keyDown; break; case Key::Left : keyRotLeft = !keyRotLeft; break; case Key::Right : keyRotRight = !keyRotRight; break; case Key::Z : keyTiltLeft = !keyTiltLeft; break; case Key::X : keyTiltRight = !keyTiltRight; break; default: break; } } void onKeyDown( DisplayInterface & my_display, Key key ) { handleKeys(key); if (key == Key::Escape) { quit = true; } //return false; // disable default key handlers } void onKeyUp( DisplayInterface & display, Key key ) { handleKeys(key); } void onKeyPressed( DisplayInterface & my_display, Key key ) { } void onMouseButtonDown( DisplayInterface & display, Mouse mouse ) { // ... } void onMouseButtonUp( DisplayInterface & display, Mouse mouse ) { // ... } void onMouseMove( DisplayInterface & display, Mouse mouse ) { //cout << mouse.x << " " << mouse.y << endl; mouseMoved = true; if (firstRun) { curr_mouse_x = mouse.x; curr_mouse_y = mouse.y; firstRun = false; } diff_x = mouse.x - curr_mouse_x; diff_y = mouse.y - curr_mouse_y; curr_mouse_x = mouse.x; curr_mouse_y = mouse.y; } void onActivate( DisplayInterface & display, bool active ) { // ... } bool onClose( DisplayInterface & display ) { return quit = true; // returning true indicates that we want the display close to proceed } private: //Display display;// ( "Fullscreen Example", width, height, Output::Windowed, Mode::TrueColor ); bool quit; float x, y, z, angleY; // camera location and current rotation angle //vector<SolidPolygon3D> polys; vector<Polygon3D> polys; PolygonRenderer* polygonRenderer ; bool keyW, keyS, keyA, keyD, keyUp, keyDown, keyRotLeft, keyRotRight, keyTiltLeft, keyTiltRight; float mouse_x, mouse_y, curr_mouse_x, curr_mouse_y, diff_x, diff_y; Timer timer; int numFrames; bool firstRun, mouseMoved; }; int main(int argc, char* argv[]) { Application app; app.run(); }
[ "martin.rennix@b6e4cb7b-8d2e-0410-91ea-c19743d4332f" ]
[ [ [ 1, 330 ] ] ]
2e95d32ae76b65159ca833e8ddaef7f6df0e6dd9
6d680e20e4a703f0aa0d4bb5e50568143241f2d5
/src/passuello/ProvaFirst/ui_SetBackground.h
72821ab5b3f04e2ea3a3bc859454e4da75340dfb
[]
no_license
sirnicolaz/MobiHealt
f7771e53a4a80dcea3d159eca729e9bd227e8660
bbfd61209fb683d5f75f00bbf81b24933922baac
refs/heads/master
2021-01-20T12:21:17.215536
2010-04-21T14:21:16
2010-04-21T14:21:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,274
h
/******************************************************************************** ** Form generated from reading ui file 'SetBackground.ui' ** ** Created: Wed Jun 3 20:24:47 2009 ** by: Qt User Interface Compiler version 4.5.0-garden ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ********************************************************************************/ #ifndef UI_SETBACKGROUND_H #define UI_SETBACKGROUND_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QHeaderView> #include <QtGui/QMainWindow> #include <QtGui/QMenuBar> #include <QtGui/QStatusBar> #include <QtGui/QWidget> QT_BEGIN_NAMESPACE class Ui_SetBackgroundClass { public: QWidget *centralwidget; QMenuBar *menubar; QStatusBar *statusbar; void setupUi(QMainWindow *SetBackgroundClass) { if (SetBackgroundClass->objectName().isEmpty()) SetBackgroundClass->setObjectName(QString::fromUtf8("SetBackgroundClass")); SetBackgroundClass->resize(800, 600); centralwidget = new QWidget(SetBackgroundClass); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); SetBackgroundClass->setCentralWidget(centralwidget); menubar = new QMenuBar(SetBackgroundClass); menubar->setObjectName(QString::fromUtf8("menubar")); menubar->setGeometry(QRect(0, 0, 800, 21)); SetBackgroundClass->setMenuBar(menubar); statusbar = new QStatusBar(SetBackgroundClass); statusbar->setObjectName(QString::fromUtf8("statusbar")); SetBackgroundClass->setStatusBar(statusbar); retranslateUi(SetBackgroundClass); QMetaObject::connectSlotsByName(SetBackgroundClass); } // setupUi void retranslateUi(QMainWindow *SetBackgroundClass) { SetBackgroundClass->setWindowTitle(QApplication::translate("SetBackgroundClass", "MainWindow", 0, QApplication::UnicodeUTF8)); Q_UNUSED(SetBackgroundClass); } // retranslateUi }; namespace Ui { class SetBackgroundClass: public Ui_SetBackgroundClass {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_SETBACKGROUND_H
[ [ [ 1, 67 ] ] ]
ef1db33878d6a50822a194aa0ab8863d00fc3504
74c8da5b29163992a08a376c7819785998afb588
/NetAnimal/Game/Hunter/NewGameComponent/GameNeedleComponent/include/MaterialInstance.h
31cb6541fb0834fddf28ec833a438c24fd4e54e2
[]
no_license
dbabox/aomi
dbfb46c1c9417a8078ec9a516cc9c90fe3773b78
4cffc8e59368e82aed997fe0f4dcbd7df626d1d0
refs/heads/master
2021-01-13T14:05:10.813348
2011-06-07T09:36:41
2011-06-07T09:36:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,123
h
#ifndef __MATERIALINSTANCE_H__ #define __MATERIALINSTANCE_H__ #include "Ogre/Ogre.h" using namespace Ogre; /** An instance of a single material. * This class represents a single instance of a material. It's mainly * an utility to allow a single Renderable to change its transparency without changing every * other renderables' transparency which also use this material. * It will create (and use) a copy of the original material only when needed. But it will keep * the reference to the cloned material until it's no longer needed (to save re-clonation time). * Allows also changing the Renderable material through this class, so it's no need to destroy * this instance and create a new one if the material changes. * @note Transparency is applied to all the passes in all the techniques. * @note Default blending method is alpha blending. Blending methods in the original material will be overriden. * @note Modulative blending is not supported as it can't be done if some textures exist. * @author Kencho * @todo Check lighting enabled or not. Disabled lighting won't allow colour changing. * @todo Take care of shininess, specularity, and emissiveness. * @todo Add existing material recognising support (to allow existing transparency updating...). */ class MaterialInstance { // Attributes ================================================================================= public: protected: /** Reference to the original material. */ MaterialPtr mOriginalMat; /** Reference to the copy material. */ MaterialPtr mCopyMat; /** Keeps the current transparency value. */ Real mCurrentTransparency; /** Current blending method. */ SceneBlendType mSBT; // Methods ==================================================================================== public: /** Constructor. * Initialises references and parameters. */ MaterialInstance (); /** Destructor. * @note Destroys the copy material if needed. */ ~MaterialInstance (); /** Sets the blending method to use to adjust transparency. * @param sbt The SceneBlendType desired. */ void setSceneBlending (SceneBlendType sbt); /** Changes this instance transparency. * @param transparency The new transparency. Values will be clamped to [0..1]. * @note This changes transparency. A value of 0 means full opacity, while 1 means full * transparency (invisible) * @note If transparency equals 0, it will use the original material instead of the copy * (the copy is mandatory transparent, and thus might be slower than the original). */ void setTransparency (Real transparency); /** Retrieves a shared pointer to its cloned material. * @return A MaterialPtr of the cloned material. */ MaterialPtr getCopyMaterial (); protected: /** Initialises the reference to the original material. */ virtual void initOriginalMaterial () = 0; /** Clones the original material. */ void createCopyMaterial (); /** If exists, removes the copy material, and clears the reference to it. */ void clearCopyMaterial (); }; #endif // __MATERIALINSTANCE_H__
[ [ [ 1, 78 ] ] ]
79c0ce5a775100310f980b3a872e2b88cc85259d
f91a80b06aa6fe834ad02aae7850e17bca42888d
/OpenAirspace/Airspace.cpp
bcb524df86a2ad16964390bb4367255b4daaea10
[]
no_license
monkeyonagazeboo/OpenAirspace
f86d90a7d009b3812c87be8d6e9a1e4e2760a3d5
359600441499d080707ed64321ca8329b638638f
refs/heads/master
2021-01-18T20:35:31.162729
2011-12-28T14:20:07
2011-12-28T14:20:07
3,062,710
0
0
null
null
null
null
UTF-8
C++
false
false
5,245
cpp
#include "Airspace.h" Updraft::Airspace::Coordinate Updraft::Airspace::X; namespace Updraft { Airspace::Airspace(QTextStream& ts) { QString text(""); //X.valid = false; this->validAN = false; this->validAL = false; this->validAH = false; this->validTO = false; //this->validX = false; this->CW = true; this->Wi = -1; //this->validZ = false; this->validDA = false; this->validDB = false; //float Airspace::Z; //this->X.valid = false; this->Z = -1; this->SP.valid = false; this->SB.valid = false; ts >> text; if (text != "AC") return; ts >> text; if (text == "R") this->AC = R; else if (text == "Q") this->AC = Q; else if (text == "P") this->AC = P; else if (text == "A") this->AC = A; else if (text == "B") this->AC = B; else if (text == "C") this->AC = C; else if (text == "D") this->AC = D; else if (text == "GP") this->AC = GP; else if (text == "CTR") this->AC = CTR; else if (text == "W") this->AC = W; else return; while (!ts.atEnd()) { ts >> text; if (text == "AC") return; QString parse; ts.skipWhiteSpace(); parse = ts.readLine(); if (text == "*") continue; else if (text == "AN") { this->AN = parse; validAN = true; } else if (text == "AL") { this->AL = parse; // !!! can be text e.g. Ask on 122.8 !!! validAL = true; } else if (text == "AH") { this->AH = parse; // !!! can be text e.g. Ask on 122.8 !!! validAH = true; } else if (text == "AT") { this->AT.push_back(ParseCoord(parse)); } else if (text == "TO") { this->TO = parse; validTO = true; } else if (text == "TC") { this->TC = parse; validTC = true; } else if (text == "SP") { int i = parse.indexOf(','); SP.style = parse.left(i).toInt(); i = parse.indexOf(','); SP.width = parse.left(i).toInt(); i = parse.indexOf(','); SP.R = parse.left(i).toInt(); i = parse.indexOf(','); SP.G = parse.left(i).toInt(); i = parse.indexOf(','); SP.B = parse.left(i).toInt(); SP.valid = true; } else if (text == "SB") { int i = parse.indexOf(','); SB.R = parse.left(i).toInt(); i = parse.indexOf(','); SB.G = parse.left(i).toInt(); i = parse.indexOf(','); SB.B = parse.left(i).toInt(); SB.valid = true; } else if (text == "V") { QChar ch = parse.at(0); parse = parse.right(parse.size() - parse.indexOf('=') -1); if (ch == 'X') { //this->X = ParseCoord(parse); X = ParseCoord(parse); this->validX = true; } else if (ch == 'D') { if (parse.trimmed().at(0) == '-') this->CW = false; else this->CW = true; } else if (ch == 'W') { this->Wi = parse.toInt(); } else if (ch == 'Z') { this->Z = parse.toFloat(); //this->validZ = true; } } // V else if (text == "DP") { this->DP.push_back(ParseCoord(parse)); } else if (text == "DA") { //init ArcI arc; /*if (validZ)*/ arc.Zoom = this->Z; /*if (validX)*/ arc.Centre = X; arc.CW = this->CW; // parse row int i = parse.indexOf(','); arc.R = parse.left(i).toInt(); parse = parse.right(parse.size() - i -1 ); i = parse.indexOf(','); arc.Start = parse.left(i).toInt(); parse = parse.right(parse.size() - i -1 ); arc.End = parse.toInt(); arc.valid = true; this->DA.push_back(arc); } else if (text == "DB") { ArcII arc; /*if (validZ)*/ arc.Zoom = this->Z; /*if (validX)*/ arc.Centre = X; arc.CW = this->CW; // parse row int i = parse.indexOf(','); arc.Start = ParseCoord(parse.left(i)); parse = parse.right(parse.size() - i -1 ); parse = parse.right(parse.size() - i -1 ); arc.End = arc.Start = ParseCoord(parse); arc.valid = true; this->DB.push_back(arc); } else if (text == "DC") { Circle cir; /*if (validZ)*/ cir.Zoom = this->Z; /*if (validX)*/ cir.Centre = X; // parse row cir.R = parse.toInt(); cir.valid = true; this->DC.push_back(cir); } else if (text == "DY") { this->DY.push_back(ParseCoord(parse)); } } } Airspace::Coordinate Airspace::ParseCoord(QString& text) { Coordinate cor; QString parse = text; int i = 0, j = 0; while (text.at(i) != 'N' && text.at(i) != 'S' && i < text.size()) ++i; while (text.at(j) != 'E' && text.at(j) != 'W' && j < text.size()) ++j; if (i == text.size() || j == text.size()) qFatal("Error parsing coordinates in UserAirspace file"); parse = text.left(i); cor.N.min = parse.section(':',0,0).toInt(); cor.N.sec = parse.section(':',1,1).toFloat(); if (text.at(i) == 'S') cor.N.min *= -1; parse = text.mid(i+1, j - i - 1); cor.E.min = parse.section(':',0,0).toInt(); cor.E.sec = parse.section(':',1,1).toFloat(); if (text.at(j) == 'W') cor.E.min *= -1; cor.valid = true; return cor; } } // Updraft
[ [ [ 1, 234 ] ] ]
c4d5deb77a904345d56b611e790bb708bdd0b88c
b369aabb8792359175aedfa50e949848ece03180
/src/wblib/wblib/Camera.h
b22e68c10bd683b6fb35f487d4534563502aa21d
[]
no_license
LibreGamesArchive/magiccarpet
6d49246817ab913f693f172fcfc53bf4cc153842
39210d57096d5c412de0f33289fbd4d08c20899b
refs/heads/master
2021-05-08T02:00:46.182694
2009-01-06T20:25:36
2009-01-06T20:25:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,694
h
#ifndef _CAMERA_H #define _CAMERA_H #include <math.h> #include <list> #include <GL/glew.h> #include <GL/glut.h> #include "Maths.h" // To prevent strange flipping of view direction, the camera has to be // bound to a certain maximal angle for looking up and down #define CAM_MAX_Y_LOOK 1.4f namespace wbLib { class Result { public: float x; float y; }; /** * USAGE: * 1. Create variable and initialize with initial position * Camera g_Camera(0.0f, 0.0f, 0.0f); * * 2. To update the camera's view direction, call MouseRotate(long x, long y); * g_Camera.MouseRotate(mouse_state.lX, mouse_state.lY); * The parameters to MouseRotate() are the deltas of mouse movement. * * 3. To update camera's position call * g_Camera.MoveForward(); * g_Camera.MoveBackward(); * g_Camera.StrafeLeft(); * g_Camera.StrafeRight(); * * 4. If the camera is too fast, adjust the public variables xLookSpeed and * yLookSpeed */ class Camera { public: Camera(); Camera(float x, float y, float z); void MouseRotate(float _x, float _y); void MouseUpdate(long x, long y); virtual void MoveForward() = 0; virtual void MoveBackward() = 0; void StrafeLeft(); void StrafeRight(); void ResetCamera(); void AddView(float xAngle, float yAngle); void PrepareAnimate(); void Animate(); void ClearUpAnimationList(); protected: void UpdateCamera(); void SetPrespective(float m_PitchDegrees, float m_HeadingDegrees); Result Filter(long x, long y); void PrepareViewingMatrix(GLdouble _eyeX, GLdouble _eyeY, GLdouble _eyeZ, GLdouble _centerX, GLdouble _centerY, GLdouble _centerZ, GLdouble _upX, GLdouble _upY, GLdouble _upZ); public: Vector3f initialPos; Vector3f pos; Vector3f view; // view direction Vector3f up; Vector3f perp; Vector3f eyesephalfvector; float thetaX; float thetaY; float controlThetaY; float xAngle; float yAngle; double focallength; double aperture; double eyesep; double dNear; double dFar; int screenheight; int screenwidth; std::list<Result *> animationList; float xLookSpeed; float yLookSpeed; float moveSpeed; protected: int index; float xbuffer[10]; float ybuffer[10]; float strength[10]; unsigned int step; Quaternion startRotAroundUpByThetaX; Quaternion startRotAroundPerpByThetaY; Quaternion endRotAroundUpByThetaX; Quaternion endRotAroundPerpByThetaY; float t; bool increase; }; } #endif
[ [ [ 1, 114 ] ] ]
57e1883d9a6c6c9b2407209a1f9f641b5be577c0
74c8da5b29163992a08a376c7819785998afb588
/NetAnimal/Game/wheel/NewWheelController/include/NewHardwareEngineDecorator.h
135af2f7e1c60f6881ff97215d7b9a5b1917a26b
[]
no_license
dbabox/aomi
dbfb46c1c9417a8078ec9a516cc9c90fe3773b78
4cffc8e59368e82aed997fe0f4dcbd7df626d1d0
refs/heads/master
2021-01-13T14:05:10.813348
2011-06-07T09:36:41
2011-06-07T09:36:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
820
h
#ifndef __Orz_NewHardwareEngineDecorator_h__ #define __Orz_NewHardwareEngineDecorator_h__ #include "WheelControllerConfig.h" #include "NewHandler.h" #include "WheelEngineInterface.h" namespace Orz { class _OrzNewWheelControlleExport NewHardwareEngineDecorator: public SingleChipListener, public WheelEngineInterface { public: NewHardwareEngineDecorator(WheelEngineInterfacePtr engine); ~NewHardwareEngineDecorator(void); void dealMassage(HardwareMsg & msg); void read(boost::circular_buffer<unsigned char> & data); void startGame(size_t time); void pushRate(void); void runGame(void); virtual void findSC(void); private: NewHandler _handler; WheelEngineInterfacePtr _engine; }; //typedef boost::shared_ptr<NewHardwareEngineDecorator> HardwarePtr; } #endif
[ [ [ 1, 38 ] ] ]
b663e8cededd051e39329e4608903cf23428afd8
877bad5999a3eeab5d6d20b5b69a273b730c5fd8
/TestKhoaLuan/DirectShowTVSample/Chapter-12/CDPlayer/StdAfx.cpp
d5911a1c873cd89460040aabf2bd880a7ebd2681
[]
no_license
eaglezhao/tracnghiemweb
ebdca23cb820769303d27204156a2999b8381e03
aaae7bb7b9393a8000d395c1d98dcfc389e3c4ed
refs/heads/master
2021-01-10T12:26:27.694468
2010-10-06T01:15:35
2010-10-06T01:15:35
45,880,587
1
0
null
null
null
null
UTF-8
C++
false
false
295
cpp
// stdafx.cpp : source file that includes just the standard includes // CDPlayer.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
[ [ [ 1, 8 ] ] ]
8f1b2c771090b619b88714fc7964ef149ed0b6bc
3ec03fa7bb038ea10801d09a685b9561f827928b
/js_curl/dllmain.cpp
7516f0b5f32e5a2b00469e9a5f8803243e2f009b
[]
no_license
jbreams/njord
e2354f2013af0d86390ae7af99a419816ee417cb
ef7ff45fa4882fe8d2c6cabfa7691e2243fe8341
refs/heads/master
2021-01-24T17:56:32.048502
2009-12-15T18:57:32
2009-12-15T18:57:32
38,331,688
1
0
null
null
null
null
UTF-8
C++
false
false
6,143
cpp
/* * Copyright 2009 Drew University * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "stdafx.h" #include "jsapi.h" #include "curl\curl.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } const struct JSConstDoubleSpec curlOptConsts[] = { {CURLOPT_VERBOSE, "CURLOPT_VERBOSE", 0, 0}, {CURLOPT_UPLOAD, "CURLOPT_UPLOAD", 0, 0}, {CURLOPT_UNRESTRICTED_AUTH, "CURLOPT_UNRESTRICTED_AUTH", 0, 0}, {CURLOPT_TRANSFERTEXT, "CURLOPT_TRANSFERTEXT", 0, 0}, {CURLOPT_SSL_VERIFYPEER, "CURLOPT_SSL_VERIFYPEER", 0, 0}, {CURLOPT_PUT, "CURLOPT_PUT", 0, 0}, {CURLOPT_POST, "CURLOPT_POST", 0, 0}, {CURLOPT_NOSIGNAL, "CURLOPT_NOSIGNAL", 0, 0}, {CURLOPT_NOPROGRESS, "CURLOPT_NOPROGRESS", 0, 0}, {CURLOPT_NOBODY, "CURLOPT_NOBODY", 0, 0}, {CURLOPT_NETRC, "CURLOPT_NETRC", 0, 0}, {CURLOPT_HTTPPROXYTUNNEL, "CURLOPT_HTTPPROXYTUNNEL", 0, 0}, {CURLOPT_HTTPGET, "CURLOPT_HTTPGET", 0, 0}, {CURLOPT_HEADER, "CURLOPT_HEADER", 0, 0}, {CURLOPT_FTPLISTONLY, "CURLOPT_FTPLISTONLY", 0, 0}, {CURLOPT_FTPAPPEND, "CURLOPT_FTPAPPEND", 0, 0}, {CURLOPT_FTP_USE_EPSV, "CURLOPT_FTP_USE_EPSV", 0, 0}, {CURLOPT_FTP_USE_EPRT, "CURLOPT_FTP_USE_EPRT", 0, 0}, {CURLOPT_FRESH_CONNECT, "CURLOPT_FRESH_CONNECT", 0, 0}, {CURLOPT_FORBID_REUSE, "CURLOPT_FORBID_REUSE", 0, 0}, {CURLOPT_FOLLOWLOCATION, "CURLOPT_FOLLOWLOCATION", 0, 0}, {CURLOPT_FILETIME, "CURLOPT_FILETIME", 0, 0}, {CURLOPT_FAILONERROR, "CURLOPT_FAILONERROR", 0, 0}, {CURLOPT_DNS_USE_GLOBAL_CACHE, "CURLOPT_DNS_USE_GLOBAL_CACHE", 0, 0}, {CURLOPT_CRLF, "CURLOPT_CRLF", 0, 0}, {CURLOPT_COOKIESESSION, "CURLOPT_COOKIESESSION", 0, 0}, {CURLOPT_AUTOREFERER, "CURLOPT_AUTOREFERER", 0, 0}, {CURLOPT_BUFFERSIZE, "CURLOPT_BUFFERSIZE", 0, 0}, {CURLOPT_CLOSEPOLICY, "CURLOPT_CLOSEPOLICY", 0, 0}, {CURLOPT_CONNECTTIMEOUT, "CURLOPT_CONNECTTIMEOUT", 0, 0}, {CURLOPT_DNS_CACHE_TIMEOUT, "CURLOPT_DNS_CACHE_TIMEOUT", 0, 0}, {CURLOPT_FTPSSLAUTH, "CURLOPT_FTPSSLAUTH", 0, 0}, {CURLOPT_HTTP_VERSION, "CURLOPT_HTTP_VERSION", 0, 0}, {CURLOPT_HTTPAUTH, "CURLOPT_HTTPAUTH", 0, 0}, {CURLOPT_INFILESIZE, "CURLOPT_INFILESIZE", 0, 0}, {CURLOPT_LOW_SPEED_LIMIT, "CURLOPT_LOW_SPEED_LIMIT", 0, 0}, {CURLOPT_LOW_SPEED_TIME, "CURLOPT_LOW_SPEED_TIME", 0, 0}, {CURLOPT_MAXCONNECTS, "CURLOPT_MAXCONNECTS", 0, 0}, {CURLOPT_MAXREDIRS, "CURLOPT_MAXREDIRS", 0, 0}, {CURLOPT_PORT, "CURLOPT_PORT", 0, 0}, {CURLOPT_PROXYAUTH, "CURLOPT_PROXYAUTH", 0, 0}, {CURLOPT_PROXYPORT, "CURLOPT_PROXYPORT", 0, 0}, {CURLOPT_PROXYTYPE, "CURLOPT_PROXYTYPE", 0, 0}, {CURLOPT_RESUME_FROM, "CURLOPT_RESUME_FROM", 0, 0}, {CURLOPT_SSL_VERIFYHOST, "CURLOPT_SSL_VERIFYHOST", 0, 0}, {CURLOPT_SSLVERSION, "CURLOPT_SSLVERSION", 0, 0}, {CURLOPT_TIMECONDITION, "CURLOPT_TIMECONDITION", 0, 0}, {CURLOPT_TIMEOUT, "CURLOPT_TIMEOUT", 0, 0}, {CURLOPT_TIMEVALUE, "CURLOPT_TIMEVALUE", 0, 0}, {CURLOPT_CAINFO, "CURLOPT_CAINFO", 0, 0}, {CURLOPT_CAPATH, "CURLOPT_CAPATH", 0, 0}, {CURLOPT_COOKIE, "CURLOPT_COOKIE", 0, 0}, {CURLOPT_COOKIEFILE, "CURLOPT_COOKIEFILE", 0, 0}, {CURLOPT_COOKIEJAR, "CURLOPT_COOKIEJAR", 0, 0}, {CURLOPT_CUSTOMREQUEST, "CURLOPT_CUSTOMREQUEST", 0, 0}, {CURLOPT_EGDSOCKET, "CURLOPT_EGDSOCKET", 0, 0}, {CURLOPT_ENCODING, "CURLOPT_ENCODING", 0, 0}, {CURLOPT_FTPPORT, "CURLOPT_FTPPORT", 0, 0}, {CURLOPT_INTERFACE, "CURLOPT_INTERFACE", 0, 0}, {CURLOPT_KRB4LEVEL, "CURLOPT_KRB4LEVEL", 0, 0}, {CURLOPT_POSTFIELDS, "CURLOPT_POSTFIELDS", 0, 0}, {CURLOPT_PROXY, "CURLOPT_PROXY", 0, 0}, {CURLOPT_PROXYUSERPWD, "CURLOPT_PROXYUSERPWD", 0, 0}, {CURLOPT_RANDOM_FILE, "CURLOPT_RANDOM_FILE", 0, 0}, {CURLOPT_RANGE, "CURLOPT_RANGE", 0, 0}, {CURLOPT_REFERER, "CURLOPT_REFERER", 0, 0}, {CURLOPT_SSL_CIPHER_LIST, "CURLOPT_SSL_CIPHER_LIST", 0, 0}, {CURLOPT_SSLCERT, "CURLOPT_SSLCERT", 0, 0}, {CURLOPT_SSLCERTPASSWD, "CURLOPT_SSLCERTPASSWD", 0, 0}, {CURLOPT_SSLCERTTYPE, "CURLOPT_SSLCERTTYPE", 0, 0}, {CURLOPT_SSLENGINE, "CURLOPT_SSLENGINE", 0, 0}, {CURLOPT_SSLENGINE_DEFAULT, "CURLOPT_SSLENGINE_DEFAULT", 0, 0}, {CURLOPT_SSLKEY, "CURLOPT_SSLKEY", 0, 0}, {CURLOPT_SSLKEYPASSWD, "CURLOPT_SSLKEYPASSWD", 0, 0}, {CURLOPT_SSLKEYTYPE, "CURLOPT_SSLKEYTYPE", 0, 0}, {CURLOPT_URL, "CURLOPT_URL", 0, 0}, {CURLOPT_USERAGENT, "CURLOPT_USERAGENT", 0, 0}, {CURLOPT_USERPWD, "CURLOPT_USERPWD", 0, 0}, {0, 0, 0, 0}, }; extern struct JSFunctionSpec curlClassMethods[]; JSBool curl_init(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval *rval); void curl_cleanup(JSContext * cx, JSObject * obj); JSClass curlClass = { "Curl", /* name */ JSCLASS_HAS_PRIVATE, /* flags */ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, curl_cleanup, JSCLASS_NO_OPTIONAL_MEMBERS }; #ifdef __cplusplus extern "C" { #endif BOOL __declspec(dllexport) InitExports(JSContext * cx, JSObject * global) { if(curl_global_init(CURL_GLOBAL_ALL) != 0) return FALSE; JS_BeginRequest(cx); JS_DefineConstDoubles(cx, global, (JSConstDoubleSpec*)curlOptConsts); JS_InitClass(cx, global, NULL, &curlClass, curl_init, 0, NULL, curlClassMethods, NULL, NULL); JS_EndRequest(cx); return TRUE; } BOOL __declspec(dllexport) CleanupExports(JSContext * cx, JSObject * global) { curl_global_cleanup(); return TRUE; } #ifdef __cplusplus } #endif
[ "jreams@1c42f586-7543-11de-ba67-499d525147dd" ]
[ [ [ 1, 152 ] ] ]
d078dbd7a3fbc3bd428d0c2373605fec53d66277
b22c254d7670522ec2caa61c998f8741b1da9388
/dependencies/OpenSceneGraph/include/osgViewer/GraphicsWindow
78cae55f22e2a4e4e5938f95974875f39583b9b4
[]
no_license
ldaehler/lbanet
341ddc4b62ef2df0a167caff46c2075fdfc85f5c
ecb54fc6fd691f1be3bae03681e355a225f92418
refs/heads/master
2021-01-23T13:17:19.963262
2011-03-22T21:49:52
2011-03-22T21:49:52
39,529,945
0
1
null
null
null
null
UTF-8
C++
false
false
12,496
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGVIEWER_GRAPHICWINDOW #define OSGVIEWER_GRAPHICWINDOW 1 #include <osg/GraphicsContext> #include <osg/Notify> #include <osgGA/EventQueue> #include <osgGA/GUIActionAdapter> #include <osgViewer/Export> extern "C" { typedef void (* CGraphicsWindowFunction) (void); } namespace osgViewer { /** Base class for providing Windowing API agnostic access to creating and managing graphics window and events. * Note, the GraphicsWindow is subclassed from osg::GraphicsContext, and to provide an implemention you'll need to implement its * range of pure virtual functions, you'll find these all have naming convention methodNameImplemention(..). * GraphicsWindow adds the event queue on top of the GraphicsContext, thereby adding a mechanism for adapting Windowing events * as well as basics graphics context work, you should wire up custom GraphicsWindowImplementation to push their events through * into the EventQueue. */ class OSGVIEWER_EXPORT GraphicsWindow : public osg::GraphicsContext, public osgGA::GUIActionAdapter { public: GraphicsWindow() { _eventQueue = new osgGA::EventQueue; _eventQueue->setGraphicsContext(this); } virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsWindow*>(object)!=0; } virtual const char* libraryName() const { return "osgViewer"; } virtual const char* className() const { return "GraphicsWindow"; } void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; } osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); } const osgGA::EventQueue* getEventQueue() const { return _eventQueue.get(); } virtual void checkEvents() {} /** Set the window's position and size.*/ void setWindowRectangle(int x, int y, int width, int height) { if (setWindowRectangleImplementation(x ,y ,width, height) && _traits.valid()) { resized(x,y,width,height); } } /** implementation of setWindowRectangle, should be implemented by derived classes */ virtual bool setWindowRectangleImplementation(int /*x*/, int /*y*/, int /*width*/, int /*height*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::setWindowRectangleImplementation(..) not implemented."<<std::endl; return false; } /** Get the window's position and size.*/ virtual void getWindowRectangle(int& x, int& y, int& width, int& height) { if (_traits.valid()) { x = _traits->x; y = _traits->y; width = _traits->width; height = _traits->height; } } /** Set Window decoration.*/ void setWindowDecoration(bool flag) { if (setWindowDecorationImplementation(flag) && _traits.valid()) { _traits->windowDecoration = flag; } } /** implementation of setWindowDecoration, should be implemented by derived classes */ virtual bool setWindowDecorationImplementation(bool /*flag*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::setWindowDecorationImplementation(..) not implemented."<<std::endl; return false; } /** Set Window decoration.*/ virtual bool getWindowDecoration() const { return _traits.valid() ? _traits->windowDecoration : false; } /** Get focus.*/ virtual void grabFocus() { osg::notify(osg::NOTICE)<<"GraphicsWindow::grabFocus(..) not implemented."<<std::endl; } /** Get focus on if the pointer is in this window.*/ virtual void grabFocusIfPointerInWindow() { osg::notify(osg::NOTICE)<<"GraphicsWindow::grabFocusIfPointerInWindow(..) not implemented."<<std::endl; } /** Raise the window to the top.*/ virtual void raiseWindow() { osg::notify(osg::NOTICE)<<"GraphicsWindow::raiseWindow(..) not implemented."<<std::endl; } /** Mouse cursor types, the same ones already present with ancient glut ... */ enum MouseCursor { InheritCursor, NoCursor, RightArrowCursor, LeftArrowCursor, InfoCursor, DestroyCursor, HelpCursor, CycleCursor, SprayCursor, WaitCursor, TextCursor, CrosshairCursor, HandCursor, UpDownCursor, LeftRightCursor, TopSideCursor, BottomSideCursor, LeftSideCursor, RightSideCursor, TopLeftCorner, TopRightCorner, BottomRightCorner, BottomLeftCorner }; /** Set the name of the window */ virtual void setWindowName(const std::string& /*name*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::setWindowName(..) not implemented."<<std::endl; } /** Return the name of the window */ virtual std::string getWindowName() { return _traits.valid() ? _traits->windowName : ""; } /** Switch on/off the cursor.*/ virtual void useCursor(bool cursorOn) { setCursor(cursorOn ? InheritCursor : NoCursor); } /** Set mouse cursor to a specific shape.*/ virtual void setCursor(MouseCursor /*mouseCursor*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::setCursor(..) not implemented."<<std::endl; } /** Create a new mouse cursor from the usual bitmap data.*/ //virtual MouseCursor createCursor(const char *data, const char *mask, unsigned w, unsigned h, unsigned hotx, unsigned hoty) { osg::notify(osg::NOTICE)<<"GraphicsWindow::createCursor(..) not implemented."<<std::endl; } public: /** Return whether a valid and usable GraphicsContext has been created.*/ virtual bool valid() const { osg::notify(osg::NOTICE)<<"GraphicsWindow::valid() not implemented."<<std::endl; return false; } /** Realize the GraphicsContext implementation, * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual bool realizeImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::realizeImplementation() not implemented."<<std::endl; return false; } /** Return true if the graphics context has been realized, and is ready to use, implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual bool isRealizedImplementation() const { osg::notify(osg::NOTICE)<<"GraphicsWindow::isRealizedImplementation() not implemented."<<std::endl; return false; } /** Close the graphics context implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual void closeImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::closeImplementation() not implemented."<<std::endl; } /** Make this graphics context current implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual bool makeCurrentImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::makeCurrentImplementation() not implemented."<<std::endl; return false;} /** Make this graphics context current with specified read context implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual bool makeContextCurrentImplementation(GraphicsContext* /*readContext*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::makeContextCurrentImplementation(..) not implemented."<<std::endl; return false;} /** Release the graphics context.*/ virtual bool releaseContextImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::releaseContextImplementation(..) not implemented."<<std::endl; return false; } /** Pure virtual, Bind the graphics context to associated texture implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual void bindPBufferToTextureImplementation(GLenum /*buffer*/) { osg::notify(osg::NOTICE)<<"GraphicsWindow::bindPBufferToTextureImplementation(..) not implemented."<<std::endl; } /** Swap the front and back buffers implementation. * Pure virtual - must be implemented by concrete implementations of GraphicsContext. */ virtual void swapBuffersImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow:: swapBuffersImplementation() not implemented."<<std::endl; } public: // Override from GUIActionAdapter virtual void requestRedraw() {} // Override from GUIActionAdapter virtual void requestContinuousUpdate(bool /*needed*/=true) {} // Override from GUIActionAdapter virtual void requestWarpPointer(float /*x*/,float /*y*/) {} protected: osg::ref_ptr<osgGA::EventQueue> _eventQueue; }; class GraphicsWindowEmbedded : public GraphicsWindow { public: GraphicsWindowEmbedded(osg::GraphicsContext::Traits* traits=0) { _traits = traits; init(); } GraphicsWindowEmbedded(int x, int y, int width, int height) { _traits = new GraphicsContext::Traits; _traits->x = x; _traits->y = y; _traits->width = width; _traits->height = height; init(); } virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsWindowEmbedded*>(object)!=0; } virtual const char* libraryName() const { return "osgViewer"; } virtual const char* className() const { return "GraphicsWindowEmbedded"; } void init() { if (valid()) { setState( new osg::State ); getState()->setGraphicsContext(this); if (_traits.valid() && _traits->sharedContext) { getState()->setContextID( _traits->sharedContext->getState()->getContextID() ); incrementContextIDUsageCount( getState()->getContextID() ); } else { getState()->setContextID( osg::GraphicsContext::createNewContextID() ); } } } // dummy implementations, assume that graphics context is *always* current and valid. virtual bool valid() const { return true; } virtual bool realizeImplementation() { return true; } virtual bool isRealizedImplementation() const { return true; } virtual void closeImplementation() {} virtual bool makeCurrentImplementation() { return true; } virtual bool releaseContextImplementation() { return true; } virtual void swapBuffersImplementation() {} virtual void grabFocus() {} virtual void grabFocusIfPointerInWindow() {} virtual void raiseWindow() {} }; struct GraphicsWindowFunctionProxy { GraphicsWindowFunctionProxy(CGraphicsWindowFunction function) { (function)(); } }; #define USE_GRAPICSWINDOW_IMPLEMENTATION(ext) \ extern "C" void graphicswindow_##ext(void); \ static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext); #if defined(_WIN32) #define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32) #elif defined(__APPLE__) #define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Carbon) #else #define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(X11) #endif } #endif
[ "vdelage@3806491c-8dad-11de-9a8c-6d5b7d1e4d13" ]
[ [ [ 1, 270 ] ] ]
b907001f430dddf0c5136d569f11de67b1ef7971
b822313f0e48cf146b4ebc6e4548b9ad9da9a78e
/KylinSdk/Engine/Source/SubEntityMaterialInstance.h
e34f789e8ac8bc6a153cac3a9ce3be21282ca7be
[]
no_license
dzw/kylin001v
5cca7318301931bbb9ede9a06a24a6adfe5a8d48
6cec2ed2e44cea42957301ec5013d264be03ea3e
refs/heads/master
2021-01-10T12:27:26.074650
2011-05-30T07:11:36
2011-05-30T07:11:36
46,501,473
0
0
null
null
null
null
UTF-8
C++
false
false
2,149
h
#ifndef __SUBENTITYMATERIALINSTANCE_H__ #define __SUBENTITYMATERIALINSTANCE_H__ #include "MaterialInstance.h" using namespace Ogre; /** Specialisation of the MaterialInstance class for SubEntities. * @author Kencho. * @see MaterialInstance. */ class SubEntityMaterialInstance : public MaterialInstance { // Attributes ================================================================================= public: protected: /** Reference to the affected SubEntity. */ SubEntity *mSubEntity; // Methods ==================================================================================== public: /** Constructor. * Initialises references and parameters. * @param se The SubEntity this SubEntityMaterialInstance works on. */ SubEntityMaterialInstance (SubEntity *se); /** Destructor. * @note Destroys the copy material if needed. */ ~SubEntityMaterialInstance (); /** Changes this SubEntity material and does any needed operations to keep the previous * material instance parameters (transparency and such). * @param name Name of the new material. * @note This also changes the references SubEntity material, so there is no need to call * SubEntity::setMaterialName() if this method is called. Indeed it's recommended to * change it through this instance rather than changing it manually. */ void setMaterialName (String name); /** Changes this instance transparency. * @param transparency The new transparency. Values will be clamped to [0..1]. * @note This changes transparency. A value of 0 means full opacity, while 1 means full * transparency (invisible) * @note If transparency equals 0, it will use the original material instead of the copy * (the copy is mandatory transparent, and thus might be slower than the original). * @see MaterialInstance::setTransparency(). */ void setTransparency (Real transparency); protected: /** Initialises the reference to the original material from the SubEntity's. * @see MaterialInstance::initOriginalMaterial(). */ void initOriginalMaterial (); }; #endif // __SUBENTITYMATERIALINSTANCE_H__
[ [ [ 1, 54 ] ] ]
adae9a31cd73196fb6879cb5f80a26a59f0df5d2
0c1f669f3dfdab47085bf537348b0354f836abea
/ qtremotedroid/QtRemoteDroidServer/src/remotedroidserver.h
ea0fd7e945a92332c55aea6a39e160c70ac229b3
[]
no_license
harlentan/qtremotedroid
fc5fc96d4374c39561aea73470a88d1f0a68b637
d07dd045213711538b38c7ced2fd6d5a8edcf241
refs/heads/master
2021-01-10T11:37:59.331004
2010-12-12T09:55:39
2010-12-12T09:55:39
54,114,402
0
0
null
null
null
null
UTF-8
C++
false
false
557
h
#ifndef REMOTEDROIDSERVER_H #define REMOTEDROIDSERVER_H #include <QWidget> #include <QUdpSocket> #include "oscserver.h" #include "oscservermethod.h" #include "mousemethod.h" #include "leftbuttonmethod.h" #include "rightbuttonmethod.h" class RemoteDroidServer : public QWidget { Q_OBJECT public: explicit RemoteDroidServer(QWidget *parent = 0); ~RemoteDroidServer(); signals: public slots: void oscReceive(); private: QUdpSocket *udpSocket; OscServer *server; }; #endif // REMOTEDROIDSERVER_H
[ [ [ 1, 32 ] ] ]
26b1df2be9b662ad1f41249b472b96ff6bae485f
77aa13a51685597585abf89b5ad30f9ef4011bde
/dep/src/boost/boost/config/stdlib/libcomo.hpp
74cbb8c664bd06978d98af863ec9b70a5b80d209
[]
no_license
Zic/Xeon-MMORPG-Emulator
2f195d04bfd0988a9165a52b7a3756c04b3f146c
4473a22e6dd4ec3c9b867d60915841731869a050
refs/heads/master
2021-01-01T16:19:35.213330
2009-05-13T18:12:36
2009-05-14T03:10:17
200,849
8
10
null
null
null
null
UTF-8
C++
false
false
1,335
hpp
// (C) Copyright John Maddock 2002 - 2003. // (C) Copyright Jens Maurer 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // Comeau STL: #if !defined(__LIBCOMO__) # include <boost/config/no_tr1/utility.hpp> # if !defined(__LIBCOMO__) # error "This is not the Comeau STL!" # endif #endif // // std::streambuf<wchar_t> is non-standard // NOTE: versions of libcomo prior to beta28 have octal version numbering, // e.g. version 25 is 21 (dec) #if __LIBCOMO_VERSION__ <= 22 # define BOOST_NO_STD_WSTREAMBUF #endif #if (__LIBCOMO_VERSION__ <= 31) && defined(_WIN32) #define BOOST_NO_SWPRINTF #endif #if __LIBCOMO_VERSION__ >= 31 # define BOOST_HAS_HASH # define BOOST_HAS_SLIST #endif // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which // has intrinsic compiler support with SGI's compilers. // Whatever map SGI style type traits to boost equivalents: // #define BOOST_HAS_SGI_TYPE_TRAITS #define BOOST_STDLIB "Comeau standard library " BOOST_STRINGIZE(__LIBCOMO_VERSION__)
[ "pepsi1x1@a6a5f009-272a-4b40-a74d-5f9816a51f88" ]
[ [ [ 1, 46 ] ] ]
83ef705eab2af6aa441234a571eb811d966c4925
59166d9d1eea9b034ac331d9c5590362ab942a8f
/CullDrawCallbacks/SimpleUpdateCallback.cpp
7ac7d4bc7d6c52f6f959967966186da248f8f773
[]
no_license
seafengl/osgtraining
5915f7b3a3c78334b9029ee58e6c1cb54de5c220
fbfb29e5ae8cab6fa13900e417b6cba3a8c559df
refs/heads/master
2020-04-09T07:32:31.981473
2010-09-03T15:10:30
2010-09-03T15:10:30
40,032,354
0
3
null
null
null
null
UTF-8
C++
false
false
417
cpp
#include "SimpleUpdateCallback.h" SimpleUpdateCallback::SimpleUpdateCallback( osg::Camera *_pCamera ) : m_pCamera( _pCamera ) { } SimpleUpdateCallback::~SimpleUpdateCallback() { } void SimpleUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv ) { m_pCamera->getProjectionMatrix(); // first update subgraph to make sure objects are all moved into position traverse(node,nv); }
[ "asmzx79@3290fc28-3049-11de-8daa-cfecb5f7ff5b" ]
[ [ [ 1, 20 ] ] ]
d7281e95edb5364a8ea432651abca65388c5ef7b
2f72d621e6ec03b9ea243a96e8dd947a952da087
/src/missileObject.cpp
2434efdccacd7364bb386ce16a3b00fc553aa7f8
[]
no_license
gspu/lol4fg
752358c3c3431026ed025e8cb8777e4807eed7a0
12a08f3ef1126ce679ea05293fe35525065ab253
refs/heads/master
2023-04-30T05:32:03.826238
2011-07-23T23:35:14
2011-07-23T23:35:14
364,193,504
0
0
null
null
null
null
UTF-8
C++
false
false
9,184
cpp
#include "MissileObject.h" #include "Level.h" #include "functions.h" #include "GameObject.h" #include "ExplosionObject.h" #include "Source.h" #include <TypeConverter.h> using namespace TypeConverter; //MissileObject::MissileObject(GameObject *_caster,MissileData data, Level *lvl, Ogre::Vector3 pos, Ogre::Quaternion ornt, Ogre::Vector3 v0) //{ //} MissileObject::MissileObject(TiXmlElement *XMLNode, Level *lvl,Ogre::Vector3 positionOffset) { //SpecificMissileData data; Ogre::Vector3 velocity = Ogre::StringConverter::parseVector3(XMLNode->Attribute("velocity")); Ogre::Vector3 omega = Ogre::Vector3::ZERO; int SaveGameID = 0; Ogre::Vector3 pos = Ogre::StringConverter::parseVector3(XMLNode->Attribute("pos"))+positionOffset; Ogre::Vector3 scale = Ogre::Vector3::UNIT_SCALE; Ogre::Quaternion ornt = Ogre::Quaternion::IDENTITY; if(XMLNode->Attribute("orient")) { ornt = Ogre::StringConverter::parseQuaternion(XMLNode->Attribute("orient")); } if(XMLNode->Attribute("scale")) { scale = Ogre::StringConverter::parseVector3(XMLNode->Attribute("scale")); } if(XMLNode->Attribute("omega")) { omega = Ogre::StringConverter::parseVector3(XMLNode->Attribute("omega")); } if(XMLNode->Attribute("SGID")) { SGID = Ogre::StringConverter::parseInt(XMLNode->Attribute("SGID")); } gamedata_damagedealer *castitem = NULL; if(XMLNode->Attribute("castingItem") && XMLNode->Attribute("castingItemType")) { Ogre::String strType = XMLNode->Attribute("castingItemType"); Ogre::String itemID = XMLNode->Attribute("castingItem"); StandardApplication *app = StandardApplication::getSingletonPtr(); if(strType == "item") { castitem = app->getItemDataPtr(itemID); } else { castitem = app->getSpellDataPtr(itemID); } } /*StandardApplication *app = StandardApplication::getSingletonPtr(); data.missile = app->parseMissileData(XMLNode->FirstChildElement("missileData")); if(XMLNode->FirstChildElement("damage")) { data.dmg = app->parseDamageData(XMLNode->FirstChildElement("damage")); } if(XMLNode->FirstChildElement("explosion")) { ExplosionData *d = new ExplosionData(); *d = app->parseExplosionData(XMLNode->FirstChildElement("explosion")); data.expl.bind(d); } if(XMLNode->Attribute("spell")) { data.spell = app->getSpellDataPtr(XMLNode->Attribute("spell")); }*/ GameObject * caster = NULL; if(XMLNode->Attribute("caster")) { int casterID = Ogre::StringConverter::parseInt(XMLNode->Attribute("caster")); caster = lvl->getObjectBySGID(casterID); //caster = ObjectPtr(lvl,casterID); } init(caster,castitem,lvl,pos,ornt,Ogre::Vector3::ZERO,SGID); if(mSnd) { mSnd->setMsecOffset(lifetime); } if(XMLNode->Attribute("inlevelfile")) { isInLevelFile = Ogre::StringConverter::parseBool(XMLNode->Attribute("inlevelfile")); } mBody->setVelocity(velocity); mBody->setOmega(omega); } void MissileObject::init(GameObject *caster, gamedata_damagedealer *source, Level *lvl, Ogre::Vector3 pos, Ogre::Quaternion ornt, Ogre::Vector3 v0,int SaveGameID) { if(!source->Missile) { //zomg! keine MissileData! mLog("Error: Could not construct Missile, because item/spell \""+source->id+"\" contains no MissileData"); throw EX_CONSTR_FAILED; } isInLevelFile = false; SGID = SaveGameID; lifetime = 0; mNode = NULL; mArt = NULL; mLevel = lvl; mSnd = NULL; type = otMissile; mCaster = caster; mCastingItem = source; //mData = data; Ogre::SceneManager *mSceneMgr = mLevel->getSceneManager(); /*Ogre::String mesh = mData.mesh; Ogre::String material = mData.material;*/ hasCollided = false; ID = "missile"; mNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); OgreNewt::World *mWorld = mLevel->getWorld(); // Ogre::SceneManager *mSceneMgr = mLevel->getSceneManager(); //Ogre::Vector3 inert=OgreNewt::MomentOfInertia::CalcEllipsoidSolid(mass,Ogre::Vector3(1,1,1)); mColData = mCastingItem->Missile->cData; createBody(mColData); mBody->setMaterialGroupID(mLevel->projMaterial); //mBody = new OgreNewt::Body(mWorld,test); //mNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); //ent = mSceneMgr->createEntity(getUniqueEntityName(mSceneMgr),"ellipsoid.mesh"); //mNode->attachObject(ent); mArt = new WorldArt(this,mCastingItem->Missile->wData); mNode = mArt->getSceneNode(); //mBody->attachToNode(mNode); mBody->setLinearDamping(0); mBody->setPositionOrientation(pos,ornt); //mBody->setMassMatrix(mass,inert); Ogre::Vector3 vel = ornt*Ogre::Vector3(0,0,-mCastingItem->Missile->velocity) + v0; mBody->setVelocity(vel); //jetzt sound if(mCastingItem->Missile->sound != "") { mSnd = mLevel->createSource(NULL,stSfxLevel,true); if(mSnd) { mSnd->setBuffer(mLevel->getBuffer(mCastingItem->Missile->sound)); mSnd->setPosition(pos); mSnd->setVelocity(v0); mSnd->play(); } } mLog("Created Missile "+ptrAsStr()); mLevel->registerObject(this); } MissileObject::~MissileObject() { mLog("About to delete Missile "+ptrAsStr()); //void *test = this; //long muhkuh = reinterpret_cast<long>(test); ////test2 << test; //char buffer[33]; //int base = 16; //ltoa(muhkuh,buffer,base); //mLevel->unregisterObject(this); //delete mBody; //if(mArt) // delete mArt; if(mSnd) { mSnd->stop(); mLevel->destroySource(mSnd); //mNode->detachObject(mSnd); //OgreAL::SoundManager::getSingletonPtr()->destroySound(mSnd); } ////mSceneMgr->destroySceneNode(mNode->getName()); //destroyNode(mLevel->getSceneManager(),mNode); } TiXmlElement* MissileObject::getXmlElem(Ogre::Vector3 startPosition,bool savegame) { Ogre::String strtype = objectTypeToString(type); if(strtype == "") return NULL; TiXmlElement* xmlElem = new TiXmlElement(strtype.c_str()); Ogre::Vector3 pos, scale; Ogre::Quaternion ornt; scale = getScale(); getPositionOrientation(pos,ornt); pos -= startPosition; xmlElem->SetAttribute("pos",Ogre::StringConverter::toString(pos).c_str()); if(ornt != Ogre::Quaternion::IDENTITY) { xmlElem->SetAttribute("orient",Ogre::StringConverter::toString(ornt).c_str()); } if(SGID) { xmlElem->SetAttribute("SGID",Ogre::StringConverter::toString(SGID).c_str()); } //nun das casting-teil if(mCastingItem->type == gtItem) { xmlElem->SetAttribute("castingItemType","item"); } else { xmlElem->SetAttribute("castingItemType","spell"); } xmlElem->SetAttribute("castingItem",mCastingItem->id); StandardApplication *app = StandardApplication::getSingletonPtr(); /*TiXmlElement *missileElem = new TiXmlElement("missileData"); app->missileDataToXml(missileElem,mData.missile); xmlElem->LinkEndChild(missileElem); TiXmlElement *dmgElem = new TiXmlElement("damage"); app->damageDataToXml(dmgElem,mData.dmg); xmlElem->LinkEndChild(dmgElem); if(!mData.expl.isNull()) { TiXmlElement *exElem = new TiXmlElement("explosion"); app->explosionDataToXml(exElem,*mData.expl.getPointer()); xmlElem->LinkEndChild(exElem); }*/ if(mCaster) xmlElem->SetAttribute("caster",ogre_str(mCaster->getSGID())); /*if(mData.spell) xmlElem->SetAttribute("spell",mData.spell->id);*/ Ogre::Vector3 omega = mBody->getOmega(); Ogre::Vector3 velocity = mBody->getVelocity(); if(omega != Ogre::Vector3::ZERO) { xmlElem->SetAttribute("omega",Ogre::StringConverter::toString(omega).c_str()); } xmlElem->SetAttribute("velocity",Ogre::StringConverter::toString(velocity).c_str()); xmlElem->SetAttribute("inlevelfile",Ogre::StringConverter::toString(isInLevelFile).c_str()); return xmlElem; } void MissileObject::onCollision(GameObject *with,ContCallback *callback) { if(hasCollided) return; hasCollided = true; //mLog("missile kollidiert"); //MACHEN SO: // with->AddEffects(mData.effects,caster); //with->addEffect(effect); if(with) { //nun schauen. spell? gamedata_spell *spell = NULL; if(mCastingItem->type == gtSpell) spell = static_cast<gamedata_spell*>(mCastingItem); else { gamedata_item *item = static_cast<gamedata_item*>(mCastingItem); //if(item->rangedSpell) spell = item->rangedSpell; //hier auch damage with->onDamage(item->rangedDamage,mCaster); } if(spell) with->AddSpell(spell,mCaster); } //jetzt einen effect erstellen. der effect kriegt nun nur die ExplosionData, keinen Pointer auf den Spell oder Item if(mCastingItem->Explosion)//eData.isEmpty()) { Ogre::Vector3 pos; Ogre::Quaternion ornt; getPositionOrientation(pos,ornt); //mDebugText(ogre_str(pos)); new ExplosionObject(mCaster,with,mCastingItem,mLevel,pos,true,false,ornt); } if(mSnd) mSnd->stop(); mLevel->deleteObject(this); } void MissileObject::update(Ogre::Real time) { mLog("updating "+getDebugInfo()); if(mSnd) { mSnd->setPosition(getPosition()); } lifetime += time; if (lifetime >= MISSILE_LIFESPAN ) mLevel->deleteObject(this); }
[ "praecipitator@bd7a9385-7eed-4fd6-88b1-0096df50a1ac" ]
[ [ [ 1, 324 ] ] ]
587bb6357c96b047c471f3cd0ebe31c774d8c1c1
3b0bcc3e6cba0109463101aea0b1a3406fc45429
/Debugger/source/RuntimeMethodReplacer.h
4d1599d587f2f18ca694bc862d1e734909d4d057
[ "MIT" ]
permissive
lsalamon/slimgen
85a5dad4995b590152f761b18eebc174f9baebbc
a4c959438a9d6dfc487fc34856e2b69a146c1e61
refs/heads/master
2021-01-10T08:17:50.381747
2010-11-07T04:29:26
2010-11-07T04:29:26
54,969,433
0
0
null
null
null
null
UTF-8
C++
false
false
1,454
h
/* * Copyright (c) 2007-2010 SlimGen Group * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #pragma once #include "MethodIterator.h" namespace SlimGen { class RuntimeMethodReplacer : public MethodIterator { public: RuntimeMethodReplacer(std::vector<MethodInformation>& methods) : MethodIterator(methods) { } protected: void FoundMethod(ICorDebugFunction* function, MethodInformation& method); }; }
[ "Mike.Popoloski@dc685512-7b07-11de-a624-ab7c8f4ec817", "ryoohki@dc685512-7b07-11de-a624-ab7c8f4ec817" ]
[ [ [ 1, 23 ], [ 25, 27 ], [ 29, 29 ], [ 33, 34 ] ], [ [ 24, 24 ], [ 28, 28 ], [ 30, 32 ] ] ]
89758c93a3662353be72b2956f862c3370b4b914
f0c08b3ddefc91f1fa342f637b0e947a9a892556
/branches/develop/calcioIA/Calcio/Player.cpp
86e68926b6cc568bedb1d84177845d709b824d5c
[]
no_license
BackupTheBerlios/coffeestore-svn
1db0f60ddb85ccbbdfeb9b3271a687b23e29fc8f
ddee83284fe9875bf0d04e6b7da7a2113e85a040
refs/heads/master
2021-01-01T05:30:22.345767
2009-10-11T08:55:35
2009-10-11T08:55:35
40,725,038
0
0
null
null
null
null
UTF-8
C++
false
false
514
cpp
#include "Player.h" Player::Player(AbstractPlayer& player) : _player(player), _radius(3),_see(1.0f,0.0f) { } AbstractPlayer& Player::abstractPlayer() { return _player; } Point& Player::position() { return _position; } const Point& Player::position() const { return _position; } float Player::radius() const { return _radius; } const Vector& Player::sightDirection() const { return _see; } void Player::sightDirection(const Vector& dir) { _see = dir.normalize(); }
[ "fabioppp@e591b805-c13a-0410-8b2d-a75de64125fb", "ranzuglia@e591b805-c13a-0410-8b2d-a75de64125fb" ]
[ [ [ 1, 3 ], [ 5, 27 ] ], [ [ 4, 4 ], [ 28, 37 ] ] ]
d82cec2e28b9c948084049620805ab1f77dd9b0a
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/spirit/test/file_iterator_tests.cpp
1fe9b5fc1dc0e019ded73b0b3a01c2eb42730bf7
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
4,578
cpp
/*============================================================================= Copyright (c) 2003 Giovanni Bajo http://spirit.sourceforge.net/ Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #include <boost/detail/lightweight_test.hpp> #include <cstdio> #include <iostream> #include <boost/concept_check.hpp> #include <boost/spirit/iterator/file_iterator.hpp> // This checks for a namespace related problem in VC8 // The problem can be avoided by not using "using namespace std;" in the // Spirit headers namespace vc8_bug_1 { struct plus {}; } namespace vc8_bug_2 { using namespace vc8_bug_1; struct test : plus {}; } using namespace std; using namespace boost::spirit; namespace { static const char* TMP_FILE = "file_iter.tmp"; bool CreateTempFile(void) { FILE* f = fopen(TMP_FILE, "wb"); if (!f) return false; for (int i=0;i<256;i++) { unsigned char ci = (unsigned char)i; if (fwrite(&ci,1,1,f) == 0) { fclose(f); return false; } } fclose(f); return true; } template <typename ITER> void RunTest(void) { // Check constructor opening a file ITER a(TMP_FILE); BOOST_TEST(!!a); // Assert dereference (twice: derefence // must not move the iterator) BOOST_TEST(*a == 0); BOOST_TEST(*a == 0); // Check random access BOOST_TEST(a[123] == 123); // Check copy constructor and operator== ITER c(a); BOOST_TEST(c == a); BOOST_TEST(!(c != a)); // Check assignment operator ITER d; d = a; BOOST_TEST(d == a); BOOST_TEST(!(d != a)); // Check make_end() ITER b(a.make_end()); BOOST_TEST(!!b); BOOST_TEST(a != b); BOOST_TEST(a+256 == b); BOOST_TEST(a == b-256); // Check copy constructor on non-trivial position BOOST_TEST(*ITER(a+67) == 67); // Check increment ++a; ++a; a++; a++; BOOST_TEST(*a == 4); BOOST_TEST(a == c+4); // Check decrement --a; --a; a--; a--; BOOST_TEST(*a == 0); BOOST_TEST(a == c); // Check end iterator increment/decrement --b; b--; BOOST_TEST(*b == 254); BOOST_TEST(a+254 == b); ++b; b++; BOOST_TEST(a+256 == b); // Check order a += 128; BOOST_TEST(c < a); BOOST_TEST(a < b); BOOST_TEST(a > c); BOOST_TEST(b > a); // Check assignment a = b; BOOST_TEST(a == b); a = c; BOOST_TEST(a == c); // Check weak order BOOST_TEST(a <= c); BOOST_TEST(a >= c); BOOST_TEST(a <= b); BOOST_TEST(!(a >= b)); // Check increment through end a += 255; BOOST_TEST(a != b); ++a; BOOST_TEST(a == b); ++a; BOOST_TEST(a != b); } /////////////////////////////////////////////////////////////////////////////// } typedef unsigned char character_t; typedef file_iterator<character_t, fileiter_impl::std_file_iterator<character_t> > iter; BOOST_CLASS_REQUIRE(iter, boost, RandomAccessIteratorConcept); #ifdef BOOST_SPIRIT_FILEITERATOR_WINDOWS typedef file_iterator<character_t, fileiter_impl::mmap_file_iterator<character_t> > iterwin; BOOST_CLASS_REQUIRE(iterwin, boost, RandomAccessIteratorConcept); #endif #ifdef BOOST_SPIRIT_FILEITERATOR_POSIX typedef file_iterator<character_t, fileiter_impl::mmap_file_iterator<character_t> > iterposix; BOOST_CLASS_REQUIRE(iterposix, boost, RandomAccessIteratorConcept); #endif int main(void) { if (!CreateTempFile()) { cerr << "ERROR: Cannot create temporary file file_iter.tmp" << endl; return 2; } cerr << "Testing standard iterator" << endl; RunTest<iter>(); #ifdef BOOST_SPIRIT_FILEITERATOR_WINDOWS cerr << "Testing Windows iterator" << endl; RunTest<iterwin>(); #endif #ifdef BOOST_SPIRIT_FILEITERATOR_POSIX cerr << "Testing POSIX iterator" << endl; RunTest<iterposix>(); #endif // Check if the file handles were closed correctly BOOST_TEST(remove(TMP_FILE) == 0); return boost::report_errors(); } #ifdef BOOST_NO_EXCEPTIONS namespace boost { void throw_exception(std::exception const& e) { BOOST_EROR("throw_exception"); } } #endif
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 186 ] ] ]
4a1124c5014415594180bc83eb58cb3ef59b0b44
7b582dab2e88912f8b47f8513b10674b0907b988
/Native/MulticastLib/Logger.h
9be54bc7668d1ca53b50953de9b68fd50848031c
[ "MS-PL" ]
permissive
mdavid/ProjectStarlight-CodePlex-clone
26ad6e820f681e272e353536c791a6e70da0a4e3
afdbc25aa0df521be85a63ff26ed693aaf98fa6b
refs/heads/master
2020-05-21T13:00:41.707375
2010-08-13T04:09:31
2010-08-13T04:09:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,067
h
/** * --- BEGIN LICENSE HEADER --- * * This license governs use of the accompanying software. If you use the software, you * accept this license. If you do not accept the license, do not use the software. * * 1. Definitions * The terms "reproduce," "reproduction," "derivative works," and "distribution" have the * same meaning here as under U.S. copyright law. * A "contribution" is the original software, or any additions or changes to the software. * A "contributor" is any person that distributes its contribution under this license. * "Licensed patents" are a contributor's patent claims that read directly on its contribution. * * 2. Grant of Rights * (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. * (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. * * 3. Conditions and Limitations * (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. * (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. * (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. * (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. * (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. * * --- END LICENSE HEADER --- */ #ifndef INC_MULTICAST_LOGGER_H #define INC_MULTICAST_LOGGER_H /* A simple logging interface. Implemented by users of this library. */ class Logger { public: virtual ~Logger() {}; virtual void LogError(const char* errorMessage) = 0; virtual void LogTrace(const char* errorMessage) = 0; }; #endif /* INC_MULTICAST_LOGGER_H */
[ "SND\\mpoindexter_cp@ffd33b8c-2492-42e0-bdc5-587b920b7d6d" ]
[ [ [ 1, 40 ] ] ]
8e5899ff41f499b31bb10adfb9c011277596243e
82afdf1a0de48235b75a9b6ca61c9dbcfefcfafa
/BinaryExpr.h
2311562ed9b296a15321e4caffd8a6b0c906f3f0
[]
no_license
shilrobot/shilscript_plus_plus
eec85d01074ec379da63abe00562d7663c664398
09dbdbdadc28d131fa3c8026b14015336a55ed62
refs/heads/master
2021-01-25T00:17:10.004698
2009-12-16T22:45:52
2009-12-16T22:45:52
2,589,159
0
0
null
null
null
null
UTF-8
C++
false
false
1,690
h
#ifndef SS_BINARYEXPR_H #define SS_BINARYEXPR_H #include "Expr.h" namespace SS { enum BinaryOp { BINOP_ADD, BINOP_SUB, BINOP_MUL, BINOP_DIV, BINOP_MOD, BINOP_POW, BINOP_BIT_AND, BINOP_BIT_OR, BINOP_BIT_XOR, BINOP_LOG_AND, BINOP_LOG_OR, BINOP_SHL, BINOP_SHR, BINOP_LT, BINOP_LE, BINOP_GT, BINOP_GE, BINOP_EQ, BINOP_NE, // Used for assignexpr with no extra op. BINOP_NONE }; class SS_EXPORT BinaryExpr : public Expr { public: SS_CLASS(BinaryExpr, "BinaryExpr", Expr); BinaryExpr(BinaryOp op, Expr* left, Expr* right) : m_op(op), m_left(left), m_right(right) {} virtual ~BinaryExpr() { delete m_left; delete m_right; } SS_GETSET(BinaryOp, Op, m_op); SS_GETSET(Expr*, Left, m_left); SS_GETSET(Expr*, Right, m_right); String GetOpName() const { switch(m_op) { case BINOP_ADD: return "+"; case BINOP_SUB: return "-"; case BINOP_MUL: return "*"; case BINOP_DIV: return "/"; case BINOP_MOD: return "%"; case BINOP_POW: return "**"; case BINOP_BIT_AND: return "&"; case BINOP_BIT_OR: return "|"; case BINOP_BIT_XOR: return "^"; case BINOP_LOG_AND: return "&&"; case BINOP_LOG_OR: return "||"; case BINOP_SHL: return "<<"; case BINOP_SHR: return ">>"; case BINOP_LT: return "<"; case BINOP_LE: return "<="; case BINOP_GT: return ">"; case BINOP_GE: return ">="; case BINOP_EQ: return "=="; case BINOP_NE: return ">="; case BINOP_NONE: return "<NONE>"; default: return "<INVALID BINARY OP>"; } } // TODO: Other expr. stuff private: BinaryOp m_op; Expr* m_left; Expr* m_right; }; } #endif // SS_BINARYEXPR_H
[ "shilbert@6dcb506c-49f4-8c44-b148-53dce8eab73e" ]
[ [ [ 1, 90 ] ] ]
4a13d2b683c524e2ab4080cedcad850a3295ba3c
789a98d9133f0d560c435c72c93da977196a5283
/RTOS4_Test/main.cpp
b66b3ddbfc7387bb2c22900b68e4255268d55537
[]
no_license
Wiles/rtos4
d949f9b063d65dc6b2b463879ea3f3c1f57ecb89
84f422e0adf96230188a8b7fa1ee115bb3cfb32c
refs/heads/master
2020-08-12T22:39:21.375368
2010-12-15T14:49:51
2010-12-15T14:49:51
214,850,757
0
0
null
null
null
null
UTF-8
C++
false
false
9,357
cpp
/*! * \file main.cpp * \author Hekar Khani, Samuel Lewis, Adrian Hyde, Dan Evans * \date December 14, 2010 * \description * Test application for RTOS Milestone 4. This application * allows us to simulate the theoretical functions * that Team #1 was designated with. Not all the functionality * is in this Windows application. We saw that it was not a * wise idea to do that. Those functions are in the * Visual 68k simulation based project. */ /*! \mainpage My Personal Index Page * * \section RTOS4 "RTOS Four" * \subsection RTOS4Milestone "RTOS Four Milestone" * Default simulation under Visual 68k * * \subsection RTOS4Test "RTOS Four Windows Test Application" * Test application for RTOS Milestone 4. This application * allows us to simulate the theoretical functions * that Team #1 was designated with. Not all the functionality * is in this Windows application. We saw that it was not a * wise idea to do that. Those functions are in the * Visual 68k simulation based project. * * Samuel Lewis, Dan Evans, Adrian Hyde, Hekar Khani */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h> #include <windows.h> #include "global_const.h" #include "draw.h" #include "../RTOS4/globals.h" #include "../RTOS4/rtos.h" #pragma warning ( disable : 4996 ) /*! * Windows Application instance */ static HINSTANCE hInst; /*! * Windows Application Name for identification */ static const char szAppName[] = "RTOS4App"; /*! * Title of the main window */ static const char szTitle[] = "RTOS4 Test Application"; LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); /*! * This is the entry point for all Windows programs. It is informed * of the current instance handle, the previous instance handle, the * current commandline, and the show flag for how the window is to be * displayed. * * \param HINSTANCE hInstance - Current instance of application * \param HINSTANCE hPrevInstance - Previous instance of application * \param LPSTR lpszCmdParam - Command line arguments * \param int nCmdShow - Window state to show * * \return * Operating system return code */ int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) { HWND hwnd; MSG msg; WNDCLASS wndclass; long style; // proceed with WNDCLASS registration if (!hPrevInstance) { wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon (NULL, NULL); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)GetStockObject (WHITE_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szAppName; RegisterClass (&wndclass); } hInst = hInstance; #ifdef UNDER_CE // Different styling under Windows CE style = WS_BORDER; #else style = WS_OVERLAPPEDWINDOW; #endif // Create our main window hwnd = CreateWindow (szAppName, szTitle, style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); // Show our window ShowWindow (hwnd, nCmdShow); UpdateWindow (hwnd); while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); } return msg.wParam; } /*! * * \brief * This is the Window Procedure for the main window of this application. * It processes all messages destined for this main window. * * \param HWND hwnd - Handle to window * \param UINT message - Message identifier * \param WPARAM wParam - wParam * \param LPARAM lParam - lParam */ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; RECT bounds; HDC hdc; RTOSTESTDATA *pData; switch (message) { case WM_CREATE: // Initialize the RT OS InitOS (); pData = (RTOSTESTDATA *)malloc (sizeof (RTOSTESTDATA)); if (pData == NULL) return -1; SetWindowLong (hwnd, GWL_USERDATA, (LONG)pData); // Enable the serial debug output timer SetTimer (hwnd, IDT_INTERRUPT_DEBUG_OUT, 100, NULL); // Enable the interrupt timer SetTimer (hwnd, IDT_INTERRUPT_7, 1000, NULL); // Keyboard buffer is our default view pData->CurrentView = VIEW_KEYBOARD_BUFFER; // Create our radio buttons for changing window panes CreateWindow ("BUTTON", KEYBOARD_IN, WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 0, 0, VIEW_BUTTON_SIZE, 24, hwnd, (HMENU)IDC_VIEW_KEYBOARD_BUFFER, hInst, NULL); CreateWindow ("BUTTON", SERIAL_IN, WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, VIEW_BUTTON_SIZE, 0, VIEW_BUTTON_SIZE, 24, hwnd, (HMENU)IDC_VIEW_SERIAL_IN_BUFFER, hInst, NULL); CreateWindow ("BUTTON", SERIAL_OUT, WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, VIEW_BUTTON_SIZE * 2, 0, VIEW_BUTTON_SIZE, 24, hwnd, (HMENU)IDC_VIEW_SERIAL_OUT_BUFFER, hInst, NULL); CreateWindow ("BUTTON", OTHER, WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, VIEW_BUTTON_SIZE * 3, 0, VIEW_BUTTON_SIZE, 24, hwnd, (HMENU)IDC_VIEW_OTHER, hInst, NULL); // Keyboard buffer is our default view CheckDlgButton (hwnd, IDC_VIEW_KEYBOARD_BUFFER, TRUE); return 0; case WM_PAINT: { pData = (RTOSTESTDATA *)GetWindowLong (hwnd, GWL_USERDATA); if (pData == NULL) return -1; GetClientRect (hwnd, &bounds); hdc = BeginPaint (hwnd, &ps); // Draw each view differently depending on // what view state we're in switch (pData->CurrentView) { case VIEW_KEYBOARD_BUFFER: DrawCircularBuffer <short, unsigned char> (hwnd, hdc, keyboard_data, keyboard_head, keyboard_tail, ARRAYSIZE(keyboard_data), 0, 32, 32, 32); break; case VIEW_SERIAL_IN_BUFFER: DrawCircularBuffer <short, unsigned char> (hwnd, hdc, serial_in_data, serial_in_head, serial_in_tail, ARRAYSIZE(serial_in_data), 0, 32, 32, 32); break; case VIEW_SERIAL_OUT_BUFFER: DrawCircularBuffer <short, unsigned char> (hwnd, hdc, serial_out_data, serial_out_head, serial_out_tail, ARRAYSIZE(serial_out_data), 0, 32, 32, 32); break; case VIEW_OTHER: { // Display the tickcount on view other char buffer[512]; sprintf (buffer, "TickCount: %u", GetSystemTickCount()); ExtTextOut (hdc, 0, 40, 0, NULL, buffer, strlen (buffer), NULL); break; } } // Write out the information of each PDB // This happens in every view int y = 400; char buffer[512]; PDB *pdb = pdb_First; int i = 2; while (i-- > 0) { sprintf (buffer, "PDB Name: %s Status: %c Reason %d", pdb->ApplicationName, pdb->Status, pdb->Reason); ExtTextOut (hdc, 0, y, 0, NULL, buffer, strlen (buffer), NULL); y += 24; pdb = pdb->NextPDB; } EndPaint (hwnd, &ps); return 0; } case WM_COMMAND: pData = (RTOSTESTDATA *)GetWindowLong (hwnd, GWL_USERDATA); if (pData == NULL) return -1; // Handle radio button clicks and change // view panes accordingly switch (wParam) { case IDC_VIEW_KEYBOARD_BUFFER: pData->CurrentView = VIEW_KEYBOARD_BUFFER; break; case IDC_VIEW_SERIAL_IN_BUFFER: pData->CurrentView = VIEW_SERIAL_IN_BUFFER; break; case IDC_VIEW_SERIAL_OUT_BUFFER: pData->CurrentView = VIEW_SERIAL_OUT_BUFFER; break; case IDC_VIEW_OTHER: pData->CurrentView = VIEW_OTHER; break; } // SetFocus to the window (not the radio buttons) // and redraw everything SetFocus (hwnd); InvalidateRect (hwnd, NULL, TRUE); return 0; case WM_TIMER: pData = (RTOSTESTDATA *)GetWindowLong (hwnd, GWL_USERDATA); if (pData == NULL) return -1; // Handle our timers switch (wParam) { case IDT_INTERRUPT_DEBUG_OUT: // Fire off the DebugOutputInterrupt DebugOutputInterrupt (); break; case IDT_INTERRUPT_7: // Redraw the screen and execute the Interrupt 7 handler // (RoundRobinScheduler) InvalidateRect (hwnd, NULL, TRUE); gTickCount++; RoundRobinScheduler (); break; } break; case WM_KEYDOWN: pData = (RTOSTESTDATA *)GetWindowLong (hwnd, GWL_USERDATA); if (pData == NULL) return -1; // Handle keydowns on a per window pane basis switch (pData->CurrentView) { case VIEW_KEYBOARD_BUFFER: if (wParam == VK_DELETE) { InputKeyboardCharacter(); } else { keyboard_data[keyboard_tail++] = wParam; } break; case VIEW_SERIAL_IN_BUFFER: if (wParam == VK_DELETE) { InputDebugCharacter(); } else { serial_in_data[serial_in_tail++] = wParam; } break; case VIEW_SERIAL_OUT_BUFFER: OutputDebugCharacter (wParam); break; case VIEW_OTHER: break; } InvalidateRect (hwnd, NULL, TRUE); return 0; case WM_CLOSE: // Ask the user if they wish to exit if (MessageBox (hwnd, SureExit, szTitle, MB_ICONSTOP | MB_YESNO) == IDYES) { DestroyWindow (hwnd); } return 0; case WM_DESTROY: // Cleanup our timers KillTimer (hwnd, IDT_INTERRUPT_DEBUG_OUT); KillTimer (hwnd, IDT_INTERRUPT_7); PostQuitMessage (0); return 0; } return DefWindowProc (hwnd, message, wParam, lParam); }
[ [ [ 1, 343 ] ] ]
3a423939908379c8636058ba8d46ede73dd3b7af
41efaed82e413e06f31b65633ed12adce4b7abc2
/projects/lab2/src/MyApp.cpp
62c7e01b744115c9fed313405f85cb5108cba19c
[]
no_license
ivandro/AVT---project
e0494f2e505f76494feb0272d1f41f5d8f117ac5
ef6fe6ebfe4d01e4eef704fb9f6a919c9cddd97f
refs/heads/master
2016-09-06T03:45:35.997569
2011-10-27T15:00:14
2011-10-27T15:00:14
2,642,435
0
2
null
2016-04-08T14:24:40
2011-10-25T09:47:13
C
UTF-8
C++
false
false
793
cpp
#include "MyApp.h" namespace lab2 { MyApp::MyApp() { _windowInfo.caption = "Lab2"; _windowInfo.width = 800; _windowInfo.height = 600; } MyApp::~MyApp() { } void MyApp::createEntities() { addEntity(new MyController("controller")); addEntity(new MyWorld("world")); addEntity(new MyRectangle("rectangle")); addEntity(new MyTopCamera("camera")); } void MyApp::createViews() { cg::View* v0 = createView("view1"); v0->setViewport(0.1f,0.25f,0.35f,0.5f); v0->linkEntityAtEnd("camera"); v0->linkEntityAtEnd("world"); v0->linkEntityAtEnd("rectangle"); cg::View* v1 = createView("view2"); v1->setViewport(0.55f,0.25f,0.35f,0.5f); v1->linkEntityAtEnd("camera"); v1->linkEntityAtEnd("world"); v1->linkEntityAtEnd("rectangle"); } }
[ "Moreira@Moreira-PC.(none)" ]
[ [ [ 1, 31 ] ] ]
7fe711cd6bfe966aa8125980c7ebf2afd6051c50
2e02b608c8b121086dd61195b0519ca352358882
/Demos/OgreCudaDemo/include/CudaVertexBufferRenderable.h
24bb548a1b4de435aa251c8836ce347b509581f5
[]
no_license
lianlab/visual-experiments
6d2a31fb9fa57fb6193cf60bc5b0998400c4ef04
92ae27aa5b8a75f4dc2ffae7aef493189e38c60f
refs/heads/master
2021-01-01T05:38:12.721514
2010-11-20T14:30:37
2010-11-20T14:30:37
35,229,264
0
0
null
null
null
null
UTF-8
C++
false
false
625
h
#pragma once #include <OgreSimpleRenderable.h> #include <OgreHardwareBuffer.h> #include <OgreHardwareVertexBuffer.h> class CudaVertexBufferRenderable : public Ogre::SimpleRenderable { public: CudaVertexBufferRenderable(int width, int height); Ogre::HardwareVertexBufferSharedPtr getHardwareVertexBuffer(); protected: void createMaterial(); void fillHardwareBuffers(); virtual Ogre::Real getBoundingRadius(void) const; virtual Ogre::Real getSquaredViewDepth(const Ogre::Camera *) const; protected: int mWidth; int mHeight; Ogre::HardwareVertexBufferSharedPtr mVertexBuffer; };
[ "[email protected]@b64f52df-4a69-c3da-be2f-ea126f9f5add" ]
[ [ [ 1, 23 ] ] ]
730a5929885170ff0d3329b9f04e009689920816
555ce7f1e44349316e240485dca6f7cd4496ea9c
/DirectShowFilters/TsReader/source/H264Nalu.cpp
302d23c9b5cad38c54a7ff945faa8d7d42e80000
[]
no_license
Yura80/MediaPortal-1
c71ce5abf68c70852d261bed300302718ae2e0f3
5aae402f5aa19c9c3091c6d4442b457916a89053
refs/heads/master
2021-04-15T09:01:37.267793
2011-11-25T20:02:53
2011-11-25T20:11:02
2,851,405
2
0
null
null
null
null
UTF-8
C++
false
false
2,647
cpp
/* * $Id: H264Nalu.cpp 788 2008-09-08 10:48:50Z casimir666 $ * * (C) 2006-2007 see AUTHORS * * This file is part of mplayerc. * * Mplayerc is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Mplayerc is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #include "StdAfx.h" #include "H264Nalu.h" // For more details for memory leak detection see the alloctracing.h header #include "..\..\alloctracing.h" void CH264Nalu::SetBuffer(BYTE* pBuffer, int nSize, int nNALSize) { m_pBuffer = pBuffer; m_nSize = nSize; m_nNALSize = nNALSize; m_nCurPos = 0; m_nNextRTP = 0; m_nNALStartPos = 0; m_nNALDataPos = 0; } bool CH264Nalu::MoveToNextStartcode() { int nBuffEnd = (m_nNextRTP > 0) ? min (m_nNextRTP, m_nSize-4) : m_nSize-4; for (int i=m_nCurPos; i<nBuffEnd; i++) { if ((*((DWORD*)(m_pBuffer+i)) & 0x00FFFFFF) == 0x00010000) { // Find next AnnexB Nal m_nCurPos = i; return true; } } if ((m_nNALSize != 0) && (m_nNextRTP < m_nSize)) { m_nCurPos = m_nNextRTP; return true; } m_nCurPos = m_nSize; return false; } bool CH264Nalu::ReadNext() { int nTemp; if (m_nCurPos >= m_nSize) return false; if ((m_nNALSize != 0) && (m_nCurPos == m_nNextRTP)) { // RTP Nalu type : (XX XX) XX XX NAL..., with XX XX XX XX or XX XX equal to NAL size m_nNALStartPos = m_nCurPos; m_nNALDataPos = m_nCurPos + m_nNALSize; nTemp = 0; for (int i=0; i<m_nNALSize; i++) { nTemp = (nTemp << 8) + m_pBuffer[m_nCurPos++]; } m_nNextRTP += nTemp + m_nNALSize; MoveToNextStartcode(); } else { // Remove trailing bits while (m_pBuffer[m_nCurPos]==0x00 && ((*((DWORD*)(m_pBuffer+m_nCurPos)) & 0x00FFFFFF) != 0x00010000)) m_nCurPos++; // AnnexB Nalu : 00 00 01 NAL... m_nNALStartPos = m_nCurPos; m_nCurPos += 3; m_nNALDataPos = m_nCurPos; MoveToNextStartcode(); } forbidden_bit = (m_pBuffer[m_nNALDataPos]>>7) & 1; nal_reference_idc = (m_pBuffer[m_nNALDataPos]>>5) & 3; nal_unit_type = (NALU_TYPE) (m_pBuffer[m_nNALDataPos] & 0x1f); return true; }
[ [ [ 1, 102 ] ] ]
5846e6f6eebcba46829380621d72d229e79bb1f8
656aba8d1c0379c82261b34de6875704d7133645
/trunk/Sources/Win32/libWinSpec/winspec.cpp
6fe4a057c20a22f1cc0166d9c0acee37f733c53d
[]
no_license
BackupTheBerlios/exspecto-svn
7ac87d6f30896add78adeebc68fffe720ec46d56
c0cd6af554231680e5bf404e25330907b194bd24
refs/heads/master
2020-12-24T13:28:04.023732
2008-03-10T15:04:43
2008-03-10T15:04:43
40,664,795
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
319
cpp
#include "Os_Spec.h" #include <errno.h> #include "windows.h" std::string get_basepath() { char str[255]; //Получаем имя файла текущего процесса и составляем из него имя файла журнала GetModuleFileName( NULL, str, sizeof(str) ); return str; }
[ "parshind@284ff1dd-de15-0410-891b-f61abf421a23" ]
[ [ [ 1, 15 ] ] ]
a6b4c41b543ba3dabc265961aa40fe529a88632e
3182b05c41f13237825f1ee59d7a0eba09632cd5
/add/RPGPack/Constraint/CST_ShapeBase.h
2ec6a07a0f703138317c38acb7511289ac24a059
[]
no_license
adhistac/ee-client-2-0
856e8e6ce84bfba32ddd8b790115956a763eec96
d225fc835fa13cb51c3e0655cb025eba24a8cdac
refs/heads/master
2021-01-17T17:13:48.618988
2010-01-04T17:35:12
2010-01-04T17:35:12
null
0
0
null
null
null
null
GB18030
C++
false
false
352
h
#ifndef __CST_SHAPEBASE__ #define __CST_SHAPEBASE__ #include "CST_GameBase.h" /* supported constraint string : #shapebase.objName //场景中叫objName的一个sceneObject */ class CST_ShapeBase : public CST_GameBase { typedef CST_GameBase Parent; public: CST_ShapeBase(); DECLARE_CONOBJECT(CST_ShapeBase); }; #endif
[ [ [ 1, 20 ] ] ]
76379d47194d8135eb4c8d59027a2be3b17af6f1
5506729a4934330023f745c3c5497619bddbae1d
/vst2.x/P4P1band/source/again.h
52f92c1fdb96422a699f34047e66908d5cbbe06f
[]
no_license
berak/vst2.0
9e6d1d7246567f367d8ba36cf6f76422f010739e
9d8f51ad3233b9375f7768be528525c15a2ba7a1
refs/heads/master
2020-03-27T05:42:19.762167
2011-02-18T13:35:09
2011-02-18T13:35:09
1,918,997
4
3
null
null
null
null
WINDOWS-1252
C++
false
false
1,720
h
//------------------------------------------------------------------------------------------------------- // VST Plug-Ins SDK // Version 2.4 $Date: 2005/11/15 15:14:03 $ // // Category : VST 2.x SDK Samples // Filename : again.h // Created by : Steinberg Media Technologies // Description : Stereo plugin which applies Gain [-oo, 0dB] // // © 2005, Steinberg Media Technologies, All Rights Reserved //------------------------------------------------------------------------------------------------------- #ifndef __again__ #define __again__ #include "public.sdk/source/vst2.x/audioeffectx.h" //------------------------------------------------------------------------------------------------------- class AGain : public AudioEffectX { public: AGain (audioMasterCallback audioMaster); ~AGain (); // Processing virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); // Program virtual void setProgramName (char* name); virtual void getProgramName (char* name); // Parameters virtual void setParameter (VstInt32 index, float value); virtual float getParameter (VstInt32 index); virtual void getParameterLabel (VstInt32 index, char* label); virtual void getParameterDisplay (VstInt32 index, char* text); virtual void getParameterName (VstInt32 index, char* text); virtual bool getEffectName (char* name); virtual bool getVendorString (char* text); virtual bool getProductString (char* text); virtual VstInt32 getVendorVersion (); protected: float fGain; char programName[kVstMaxProgNameLen+1]; }; #endif
[ [ [ 1, 50 ] ] ]
cf4fb9c925b16ba0252a1019e346503cd7ec43ea
3643bb671f78a0669c8e08935476551a297ce996
/C_SafeCogs.cpp
4b218efb13d9ec9c4183cb75df29755200af7378
[]
no_license
mattfischer/3dportal
44b3b9fb2331650fc406596b941f6228f37ff14b
e00f7d601138f5cf72aac35f4d15bdf230c518d9
refs/heads/master
2020-12-25T10:36:51.991814
2010-08-29T22:53:06
2010-08-29T22:53:06
65,869,788
1
0
null
null
null
null
UTF-8
C++
false
false
568
cpp
#include "C_Script.h" #ifdef SAFECOGSINTERNAL char *C_Script::safeCogs[]={ "00_std_elev.cog", "00_doorswitch.cog", "00_door.cog", "06_towerdoors.cog", "00_elev_switch.cog", "01_funiculara.cog", "01_funicularb.cog", "01_cargodoors.cog", "01_cargoelev1.cog", "01_cargoelev2.cog", "01_red_elev.cog", "01_neonsign.cog", "00_1waydoor.cog", "02_cratepuzdoor.cog", "02_signanim.cog", "02_boom0.cog", "02_boom1.cog", "02_end_elevator.cog", "00_doorkey.cog", "02_pipedoor.cog", "02_skywaycrates.cog", "00_secretareas.cog", "pow_", "" }; #endif
[ "devnull@localhost" ]
[ [ [ 1, 32 ] ] ]
53cbfbd0311deaaf2fbcb7a5cf8bbc404eab560c
1cc5720e245ca0d8083b0f12806a5c8b13b5cf98
/v102/ok/10295/c.cpp
1872ca79ca02d22a70b8be563af72e63e54aff5f
[]
no_license
Emerson21/uva-problems
399d82d93b563e3018921eaff12ca545415fd782
3079bdd1cd17087cf54b08c60e2d52dbd0118556
refs/heads/master
2021-01-18T09:12:23.069387
2010-12-15T00:38:34
2010-12-15T00:38:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
533
cpp
#include <iostream> #include <map> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; int main() { int m,n; double val; string t; map<string,double> mapa; while((cin >> m >> n)) { mapa.clear(); while(m--) { string s = string(); cin >> s >> val; mapa[s] = val; } while(n--) { val = 0; while((true)) { cin >> t; if(t[0]=='.') break; if(mapa.find(t)!=mapa.end()) { val += mapa[t]; } } cout << val << endl; } } }
[ [ [ 1, 35 ] ] ]
0cfaff7b0abb4a7d64c751d99d6ac0e038d1eb1b
14447604061a3ded605cd609b44fec3979d9b1cc
/Cacoon/stdafx.cpp
5bfde2783cb65c9bcca64df34c96024b96425f7f
[]
no_license
sinsoku/cacoon
459e441aacf4dc01311a6b5cd7eae2425fbf4c3f
36e81b689b53505c2d8117ff60ce8e4012d6eae6
refs/heads/master
2020-05-30T23:34:08.361671
2010-12-03T17:44:20
2010-12-03T17:44:20
809,470
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
270
cpp
// stdafx.cpp : 標準インクルード Cacoon.pch のみを // 含むソース ファイルは、プリコンパイル済みヘッダーになります。 // stdafx.obj にはプリコンパイルされた型情報が含まれます。 #include "stdafx.h"
[ [ [ 1, 8 ] ] ]
efdca3bbfb84b76d0fd6101b9961ffc67ce96c29
59ce53af7ad5a1f9b12a69aadbfc7abc4c4bfc02
/src/SkinResEditor_Old/SkinResImageListView.h
ca4972ed57521e31a777d2adbc6fccfc15c31822
[]
no_license
fingomajom/skinengine
444a89955046a6f2c7be49012ff501dc465f019e
6bb26a46a7edac88b613ea9a124abeb8a1694868
refs/heads/master
2021-01-10T11:30:51.541442
2008-07-30T07:13:11
2008-07-30T07:13:11
47,892,418
0
0
null
null
null
null
GB18030
C++
false
false
23,171
h
/******************************************************************** * CreatedOn: 2007-12-19 17:40 * FileName: SkinResImageListView.h * CreatedBy: lidengwang <[email protected]> * $LastChangedDate$ * $LastChangedRevision$ * $LastChangedBy$ * $HeadURL: $ * Purpose: *********************************************************************/ #pragma once #include <atlframe.h> #include <atlpath.h> #include <skingdi.h> #include <skinxmlctrls.h> #include "SkinControlsMgt.h" class CMyFileDialog : public CFileDialogImpl<CMyFileDialog> { public: CMyFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, HWND hWndParent = NULL) : CFileDialogImpl<CMyFileDialog>(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) { } LPCTSTR GetStartPosition() const { return (LPCTSTR)m_ofn.lpstrFile; } WTL::CString GetNextPathName(LPCTSTR& pos) const { BOOL bExplorer = m_ofn.Flags & OFN_EXPLORER; TCHAR chDelimiter; if (bExplorer) chDelimiter = '\0'; else chDelimiter = ' '; LPTSTR lpsz = (LPTSTR)pos; if (lpsz == m_ofn.lpstrFile) // first time { if ((m_ofn.Flags & OFN_ALLOWMULTISELECT) == 0) { pos = NULL; return m_ofn.lpstrFile; } // find char pos after first Delimiter while(*lpsz != chDelimiter && *lpsz != '\0') lpsz = _tcsinc(lpsz); lpsz = _tcsinc(lpsz); // if single selection then return only selection if (*lpsz == 0) { pos = NULL; return m_ofn.lpstrFile; } } WTL::CString strBasePath = m_ofn.lpstrFile; if (!bExplorer) { LPTSTR lpszPath = m_ofn.lpstrFile; while(*lpszPath != chDelimiter) lpszPath = _tcsinc(lpszPath); strBasePath = strBasePath.Left(int(lpszPath - m_ofn.lpstrFile)); } LPTSTR lpszFileName = lpsz; WTL::CString strFileName = lpsz; // find char pos at next Delimiter while(*lpsz != chDelimiter && *lpsz != '\0') lpsz = _tcsinc(lpsz); if (!bExplorer && *lpsz == '\0') pos = NULL; else { if (!bExplorer) strFileName = strFileName.Left(int(lpsz - lpszFileName)); lpsz = _tcsinc(lpsz); if (*lpsz == '\0') // if double terminated then done pos = NULL; else pos = (LPCTSTR)lpsz; } TCHAR strDrive[_MAX_DRIVE], strDir[_MAX_DIR], strName[_MAX_FNAME], strExt[_MAX_EXT]; Checked::tsplitpath_s(strFileName, strDrive, _MAX_DRIVE, strDir, _MAX_DIR, strName, _MAX_FNAME, strExt, _MAX_EXT); TCHAR strPath[_MAX_PATH]; if (*strDrive || *strDir) { Checked::tcscpy_s(strPath, _countof(strPath), strFileName); } else { Checked::tsplitpath_s(strBasePath+_T("\\"), strDrive, _MAX_DRIVE, strDir, _MAX_DIR, NULL, 0, NULL, 0); Checked::tmakepath_s(strPath, _MAX_PATH, strDrive, strDir, strName, strExt); } return strPath; } // override base class map and references to handlers DECLARE_EMPTY_MSG_MAP() }; enum { em_imagelist_height = 60 }; class SkinResImageListView : public CWindowImpl<SkinResImageListView, CListBox>, public COwnerDraw<SkinResImageListView>, public SkinTreeItemControl, public SkinPropertyView::PropertyEditNotify { public: SkinResImageListView() { m_neditindex = -1; } enum{ em_image_unknown = 0, em_image_bitmap, em_image_icon, em_image_cursor, em_image_new }; typedef struct image_item_info { int ntype; KSGUI::CString strIDName; KSGUI::CString strFileName; }; std::vector<image_item_info> m_vtItems; int m_neditindex; public: virtual void InitResult(HTREEITEM hTreeItem) { SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); if (m_hWnd == NULL) { } ClearImage(); std::vector<SkinImageResDoc::_ImageItemInfo>& vtList = ControlsMgt.m_resDocument.m_resImageDoc.m_vtItemList; for (size_t i = 0; i < vtList.size(); i++) { AppendImage(vtList[i].strIDName, vtList[i].strFileName); } AppendImage(_T(""), _T("")); } virtual void ShowResult(HTREEITEM hTreeItem, LPARAM lParam) { SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); ::ShowWindow(GetParent(), SW_SHOW); ControlsMgt.m_piSkinFrame->SetActiveResultWindow(GetParent()); } virtual void HideResult(HTREEITEM hTreeItem, LPARAM lParam) { SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); ControlsMgt.m_skinResPropertyView.Clear(); ::ShowWindow(GetParent(), SW_HIDE); } public: BEGIN_MSG_MAP(SkinResImageListView) MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) REFLECTED_COMMAND_CODE_HANDLER(LBN_SELCHANGE, OnSelChanged) CHAIN_MSG_MAP_ALT(COwnerDraw<SkinResImageListView>, 1) END_MSG_MAP() LRESULT OnSelChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { int index = CListBox::GetCurSel(); SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); ControlsMgt.m_skinResPropertyView.Clear(); ControlsMgt.m_skinResPropertyView.SetPropertyEditNotify(this); m_neditindex = index; if (index >= 0 ) { std::vector<SkinImageResDoc::_ImageItemInfo>& vtList = ControlsMgt.m_resDocument.m_resImageDoc.m_vtItemList; ControlsMgt.m_skinResPropertyView.AppendProperty( _T("ID"), (index < GetCount() - 1) ? vtList[index].strIDName : _T(""), SkinPropertyView::it_text); ControlsMgt.m_skinResPropertyView.AppendProperty( _T("FileName"), (index < GetCount() - 1) ? vtList[index].strFileName : _T(""), SkinPropertyView::it_button); } return DefWindowProc(); } virtual void OnValueChange ( LPCTSTR pszPropertyName, LPCTSTR pszOldValue, LPCTSTR pszNewValue) { SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); std::vector<SkinImageResDoc::_ImageItemInfo>& vtList = ControlsMgt.m_resDocument.m_resImageDoc.m_vtItemList; ControlsMgt.m_resDocument.Modify(TRUE); if (!_tcscmp(pszPropertyName, _T("ID"))) { if (m_neditindex >= 0) { if ( _tcslen(pszNewValue) <= _tcslen(_T("ID")) || _tcsncmp(pszNewValue, _T("ID"), _tcslen(_T("ID")) ) ) // 不合法的项名 { ControlsMgt.m_skinResPropertyView.SetProperty(_T("ID"), pszOldValue); KSGUI::CString strMsg; strMsg.Format( _T("[%s]不是合法的项名\n必顺以 ID 开头的字符串。"), pszNewValue); MessageBox(strMsg, _T("错误")); return; } for (size_t i = 0; i < m_vtItems.size(); i++) { if ( !m_vtItems[i].strIDName.CollateNoCase( pszNewValue ) ) { KSGUI::CString strMsg; strMsg.Format( _T("[%s]项名已存在。请输入其它的名称。"), pszNewValue); MessageBox(strMsg, _T("错误")); return; } } m_vtItems[m_neditindex].strIDName = pszNewValue; if ( m_neditindex < (GetCount() - 1) ) { vtList[m_neditindex].strIDName = pszNewValue; } else { AppendImage(_T(""), _T("")); SkinImageResDoc::_ImageItemInfo item; item.strIDName = pszNewValue; item.strFileName = m_vtItems[m_neditindex].strFileName; if (item.strFileName.GetLength() <= 0) { item.strFileName = _T("unknown"); m_vtItems[m_neditindex].strFileName = _T("unknown"); m_vtItems[m_neditindex].ntype = GetType(_T("unknown")); ControlsMgt.m_skinResPropertyView.SetProperty( _T("FileName"), _T("unknown")); } vtList.push_back(item); } CWindow::Invalidate(FALSE); } } else if (!_tcscmp(pszPropertyName, _T("FileName"))) { if (m_neditindex >= 0) { m_vtItems[m_neditindex].strFileName = pszNewValue; m_vtItems[m_neditindex].ntype = GetType(pszNewValue); if ( m_neditindex < (GetCount() - 1) ) { vtList[m_neditindex].strFileName = pszNewValue; } } } //else // ATLASSERT(FALSE); CWindow::Invalidate(FALSE); } virtual void OnButtonClieck(LPCTSTR pszPropertyName) { CMyFileDialog openDlg(TRUE, _T(""), _T(""), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,// | OFN_ALLOWMULTISELECT, _T("Bitmap file(*.bmp)\0*.bmp\0Icon file(*.ico)\0*.ico\0Cursor file(*.cur)\0*.cur\0所有文件(*.*)\0*.*\0\0")); openDlg.m_ofn.lpstrTitle = (_T("打开文件")); TCHAR szBuffer[4096] = { 0 }; openDlg.m_ofn.lpstrFile = szBuffer; if (IDOK == openDlg.DoModal()) { SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); std::vector<SkinImageResDoc::_ImageItemInfo>& vtList = ControlsMgt.m_resDocument.m_resImageDoc.m_vtItemList; WTL::CString strPathFile = openDlg.m_ofn.lpstrFile; CPath path = strPathFile; KSGUI::CString strFileName = path.m_strPath.Mid(path.FindFileName()); KSGUI::CString strIDName = path.m_strPath.Mid(path.FindFileName()); skinconfigbase* pskinconfig = ControlsMgt.m_resDocument.m_resImageDoc.m_pskinconfig; if (pskinconfig != 0) { KSGUI::CString strImagePath = pskinconfig->GetSkinImagePath(); path.RemoveFileSpec(); if ( strImagePath.CompareNoCase(path.m_strPath) != 0) { CPath pathCopyTo = strImagePath; pathCopyTo.Append(strFileName); CopyFile(strPathFile, pathCopyTo.m_strPath, FALSE); } } ControlsMgt.m_skinResPropertyView.SetProperty(_T("FileName"), strFileName); if (m_neditindex >= 0) { m_vtItems[m_neditindex].strFileName = strFileName; m_vtItems[m_neditindex].ntype = GetType(strFileName); if ( m_neditindex < (GetCount() - 1) ) vtList[m_neditindex].strFileName = strFileName; CWindow::Invalidate(FALSE); } ControlsMgt.m_resDocument.Modify(TRUE); //AppendImageBefNew(strIDName, strFileName ); } } LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (wParam == VK_DELETE) { int nIndex = GetCurSel(); if (nIndex >= 0 && nIndex < GetCount() - 1) { DeleteString(nIndex); m_vtItems.erase( m_vtItems.begin() + nIndex ); SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); ControlsMgt.m_resDocument.m_resImageDoc.m_vtItemList.erase( ControlsMgt.m_resDocument.m_resImageDoc.m_vtItemList.begin() + nIndex); ControlsMgt.m_resDocument.Modify(TRUE); CListBox::SetCurSel(nIndex); } } return DefWindowProc(); } void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CDCHandle dc = lpDrawItemStruct->hDC; RECT rcItem = lpDrawItemStruct->rcItem; int nItem = lpDrawItemStruct->itemID; bool bSelected = (lpDrawItemStruct->itemState & ODS_SELECTED) != 0; bool bFocus = GetFocus() == m_hWnd; COLORREF clrBkGnd = bSelected ? (bFocus ? GetSysColor(COLOR_HIGHLIGHT) : GetSysColor( COLOR_BTNFACE) ) : GetSysColor(COLOR_WINDOW); CBrush brushBkgnd; TCHAR szBuffer[MAX_PATH] = { 0 }; brushBkgnd.CreateSolidBrush( clrBkGnd ); dc.FillRect(&rcItem, brushBkgnd); COLORREF clrTextColor = bSelected ? (bFocus ? GetSysColor(COLOR_HIGHLIGHTTEXT) : GetSysColor( COLOR_BTNTEXT) ) : GetSysColor(COLOR_BTNTEXT); const image_item_info& itemInfo = m_vtItems[nItem]; KSGUI::CString strDisplayName; KSGUI::CString strFileName; if (itemInfo.ntype == em_image_new) { strDisplayName = _T("New..."); } else { strDisplayName = itemInfo.strIDName; strFileName = itemInfo.strFileName; } RECT rcIdName = rcItem; RECT rcFileName = rcItem; RECT rcImage = rcItem; rcIdName.left += 10; rcIdName.right = rcFileName.left = 220; rcFileName.right = rcImage.left = 440; dc.SetTextColor(clrTextColor); dc.SetBkMode(0); CFont font; CFont sfont; font.CreatePointFont(128, _T("Courier New"), dc, true); sfont.CreatePointFont(96 , _T("Courier New"), dc); HFONT hOldFont = dc.SelectFont(font); dc.DrawText(strDisplayName, -1 , &rcIdName , DT_LEFT | DT_VCENTER | DT_SINGLELINE); dc.DrawText(strFileName , -1 , &rcFileName, DT_LEFT | DT_VCENTER | DT_SINGLELINE ); dc.SelectFont(sfont); strDisplayName.Format(_T("Index(%d)"), nItem); dc.DrawText(strDisplayName, -1 , &rcIdName , DT_LEFT ); //dc.DrawText(strFileName , -1 , &rcFileName, DT_LEFT ); dc.SelectFont(hOldFont); DrawImage(dc, &rcImage, itemInfo); } void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) { if(lpMeasureItemStruct->CtlType != ODT_MENU) { lpMeasureItemStruct->itemHeight = em_imagelist_height; } else lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU); } void CalcDrawRect( LPRECT lprect, LPRECT lpDrawrect, int nWidth, int nHeight, int & bBig) { *lpDrawrect = *lprect; bBig = FALSE; //if (nWidth < lprect->right - lprect->left) //{ // lpDrawrect->left = lprect->left + (lprect->right - lprect->left - nWidth) / 2; // lpDrawrect->right = lpDrawrect->left + nWidth; //} //else // bBig = TRUE; if (nHeight < lprect->bottom - lprect->top) { lpDrawrect->top = lprect->top + (lprect->bottom - lprect->top - nHeight) / 2; lpDrawrect->bottom = lpDrawrect->top + nHeight; } else bBig = TRUE; } void DrawImage(CDCHandle dc, LPRECT lprect, const image_item_info& itemInfo ) { SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); CSkinDCHandle skindc = dc.m_hDC; RECT rcdraw = { 0 }; int bbig = false; skinconfigbase* pskinconfig = ControlsMgt.m_resDocument.m_resImageDoc.m_pskinconfig; CPath pathImage; pathImage.m_strPath = pskinconfig->GetSkinImagePath(); pathImage.Append(itemInfo.strFileName); switch( itemInfo.ntype ) { case em_image_bitmap: { CBitmap bmp; bmp.m_hBitmap = (HBITMAP)::LoadImage(NULL, pathImage.m_strPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE | LR_DEFAULTCOLOR); if (bmp.m_hBitmap == NULL) break; BITMAP bm = { 0 }; if (!bmp.GetBitmap(&bm)) return; CalcDrawRect(lprect, &rcdraw, bm.bmWidth, bm.bmHeight, bbig); POINT pt; pt.x = rcdraw.left; pt.y = rcdraw.top; if (bbig) { skindc.SkinDrawBitmap(pt, lprect->right - lprect->left, lprect->bottom - lprect->top, bmp); } else { skindc.SkinDrawBitmap(pt, bmp); } } break; case em_image_icon: { CIcon icon = (HICON)::LoadImage(NULL, pathImage.m_strPath , IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTCOLOR | LR_DEFAULTSIZE); if (icon.m_hIcon != NULL) icon.DrawIcon( dc, lprect->left, lprect->top ); } break; case em_image_cursor: { CIcon icon = (HICON)LoadImage(NULL, pathImage.m_strPath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTCOLOR | LR_DEFAULTSIZE); if (icon.m_hIcon != NULL) icon.DrawIcon( dc, lprect->left, lprect->top ); //CCursor cursor = (HCURSOR)document.getskinimageedit().LoadImage(itemInfo.strIDName, // IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTCOLOR | LR_DEFAULTSIZE); // //if (cursor.m_hCursor != NULL) //{ // CURSORINFO cursorinfo = { 0 }; // cursor.GetCursorInfo( &cursorinfo ); // icon.DrawIcon( dc, lprect->left, lprect->top ); //} } break; case em_image_unknown: case em_image_new: default: break; } } BOOL AppendImage(const KSGUI::CString& strIDName, const KSGUI::CString& strFileName) { image_item_info item; item.ntype = GetType(strFileName); item.strIDName = strIDName; item.strFileName = strFileName; m_vtItems.push_back(item); AddString(strIDName); return TRUE; } BOOL AppendImageBefNew(const KSGUI::CString& strIDName, const KSGUI::CString& strFileName) { image_item_info item; item.ntype = GetType(strFileName); item.strIDName = strIDName; item.strFileName = strFileName; int nIndex = GetCount() - 1; m_vtItems.insert(m_vtItems.begin() + nIndex, item); InsertString(nIndex, strIDName); return TRUE; } BOOL SetImage(int nIndex, const KSGUI::CString& strIDName, const KSGUI::CString& strFileName) { for (int i = 0; i < GetCount(); i++) { if (i == nIndex) continue; if (strIDName.CompareNoCase(m_vtItems[i].strIDName) == 0) { SetCurSel(i); return TRUE; } } m_vtItems[nIndex].ntype = GetType(strFileName); m_vtItems[nIndex].strIDName = strIDName; m_vtItems[nIndex].strFileName = strFileName; if (nIndex == GetCount() - 1) { AppendImage(_T(""), _T("")); } SkinControlsMgt& ControlsMgt = SkinControlsMgt::Instance(); std::vector<SkinImageResDoc::_ImageItemInfo>& vtList = ControlsMgt.m_resDocument.m_resImageDoc.m_vtItemList; vtList[nIndex].strIDName = strIDName; vtList[nIndex].strFileName = strFileName; return TRUE; } int GetType(const KSGUI::CString& strFileName) { int nresult = em_image_unknown; if (strFileName.GetLength() <= 0) return em_image_new; CPath path; path.m_strPath = strFileName; ATL::CString strExtension = path.GetExtension(); if (strExtension.CompareNoCase(_T(".bmp")) == 0) { nresult = em_image_bitmap; } else if (strExtension.CompareNoCase(_T(".ico")) == 0) { nresult = em_image_icon; } else if (strExtension.CompareNoCase(_T(".cur")) == 0) { nresult = em_image_cursor; } return nresult; } BOOL ClearImage() { while (GetCount() > 0) { DeleteString(0); } m_vtItems.clear(); return TRUE; } }; class CImageResEditDlg : public CDialogImpl<CImageResEditDlg> { public: SkinResImageListView m_wndResImageList; enum { IDD = IDD_RESEDITIMAGE_DIALOG }; BEGIN_MSG_MAP(CImageResEditDlg) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_SIZE , OnSize) REFLECT_NOTIFICATIONS() END_MSG_MAP() LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if (m_wndResImageList.m_hWnd != NULL) { RECT rcClient = { 0 }; GetClientRect(&rcClient); m_wndResImageList.MoveWindow(&rcClient); } return DefWindowProc(); } LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { m_wndResImageList.SubclassWindow(GetDlgItem(IDC_IMAGE_LIST)); m_wndResImageList.SetItemHeight(0, em_imagelist_height); return TRUE; } };
[ [ [ 1, 800 ] ] ]
6ef665d34a35ef01de97edff1d87b2687dbf22d9
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Common/Com/ScdSlv/ScdDebug.h
a530b7557655c85a4e7fa08591ea9f4421481516
[]
no_license
abcweizhuo/Test3
0f3379e528a543c0d43aad09489b2444a2e0f86d
128a4edcf9a93d36a45e5585b70dee75e4502db4
refs/heads/master
2021-01-17T01:59:39.357645
2008-08-20T00:00:29
2008-08-20T00:00:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,759
h
// ScdDebug.h : Declaration of the CScdDebug #ifndef __SCDDEBUG_H_ #define __SCDDEBUG_H_ #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CScdDebug class ATL_NO_VTABLE CScdDebug : //public CScdCOCmdBase, public CComObjectRootEx<CComMultiThreadModel>, public CComCoClass<CScdDebug, &CLSID_ScdDebug>, public IDispatchImpl<IScdDebug, &IID_IScdDebug, &LIBID_ScdSlv> //, public IDispatchImpl<IScdASyncEvents, &IID_IScdASyncEvents, &LIBID_ScdIF> { public: CScdDebug() //: CScdCOCmdBase(WMU_COM_APP) { //m_pUnkMarshaler = NULL; } DECLARE_REGISTRY_RESOURCEID(IDR_SCDDEBUG) DECLARE_GET_CONTROLLING_UNKNOWN() DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CScdDebug) COM_INTERFACE_ENTRY(IScdDebug) COM_INTERFACE_ENTRY(IDispatch) //COM_INTERFACE_ENTRY2(IDispatch, IScdDebug) //COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p) //COM_INTERFACE_ENTRY(IScdASyncEvents) END_COM_MAP() DECLARE_SCD(long); HRESULT FinalConstruct() { return S_OK; //CoCreateFreeThreadedMarshaler(GetControllingUnknown(), &m_pUnkMarshaler.p); } void FinalRelease() { //m_pUnkMarshaler.Release(); } //CComPtr<IUnknown> m_pUnkMarshaler; // IScdDebug public: STDMETHOD(FileClose)(); STDMETHOD(FileOpen)(/*[in]*/ BSTR FileName); // // IScdASyncEvents //STDMETHOD(DoEventMsg)(LONG Evt, LONG Data) // { // CScdCOCmdBase::DoEventMsg(Evt, Data); // return S_OK; // } // virtual void FireTheEvent(long Evt, long Data){}; }; #endif //__SCDDEBUG_H_
[ [ [ 1, 66 ] ] ]
610cdd9d59e6d2486676088a75097820994c1987
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Animation/Animation/hkaAnimationContainer.inl
ef718936f9655eeb3ce8af9fa785f22fe9ae494b
[]
no_license
TheProjecter/olafurabertaymsc
9360ad4c988d921e55b8cef9b8dcf1959e92d814
456d4d87699342c5459534a7992f04669e75d2e1
refs/heads/master
2021-01-10T15:15:49.289873
2010-09-20T12:58:48
2010-09-20T12:58:48
45,933,002
0
0
null
null
null
null
UTF-8
C++
false
false
1,950
inl
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ HK_FORCE_INLINE hkaAnimationContainer::hkaAnimationContainer() { } HK_FORCE_INLINE hkaAnimationContainer::hkaAnimationContainer(const hkaAnimationContainer& other) : hkReferencedObject(other) { *this = other; } HK_FORCE_INLINE hkaAnimationContainer::hkaAnimationContainer(hkFinishLoadedObjectFlag f) : hkReferencedObject(f), m_skeletons(f), m_animations(f), m_bindings(f), m_attachments(f), m_skins(f) { } HK_FORCE_INLINE hkaAnimationContainer& hkaAnimationContainer::operator=(const hkaAnimationContainer& other) { if( this == &other ) { return *this; } m_skeletons = other.m_skeletons; m_animations = other.m_animations; m_bindings = other.m_bindings; m_attachments = other.m_attachments; m_skins = other.m_skins; return *this; } /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222) * * Confidential Information of Havok. (C) Copyright 1999-2009 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
[ [ [ 1, 53 ] ] ]
19502d8d1af31f9c7a6fe78703f3ab7b322b0459
1c9f99b2b2e3835038aba7ec0abc3a228e24a558
/Projects/elastix/elastix_sources_v4/src/Components/Transforms/SplineKernelTransform/itkThinPlateR2LogRSplineKernelTransform2.h
cdcc43906a5b6109a35a6b73edfbb5bd85b4afd8
[]
no_license
mijc/Diploma
95fa1b04801ba9afb6493b24b53383d0fbd00b33
bae131ed74f1b344b219c0ffe0fffcd90306aeb8
refs/heads/master
2021-01-18T13:57:42.223466
2011-02-15T14:19:49
2011-02-15T14:19:49
1,369,569
0
0
null
null
null
null
UTF-8
C++
false
false
4,341
h
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkThinPlateR2LogRSplineKernelTransform2.h,v $ Language: C++ Date: $Date: 2006/03/19 04:36:59 $ Version: $Revision: 1.7 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkThinPlateR2LogRSplineKernelTransform2_h #define __itkThinPlateR2LogRSplineKernelTransform2_h #include "itkKernelTransform2.h" namespace itk { /** \class ThinPlateR2LogRSplineKernelTransform2 * This class defines the thin plate spline (TPS) transformation. * It is implemented in as straightforward a manner as possible from * the IEEE TMI paper by Davis, Khotanzad, Flamig, and Harms, * Vol. 16 No. 3 June 1997. * * The kernel used in this variant of TPS is \f$ R^2 log(R) \f$ * * \ingroup Transforms */ template <class TScalarType, // Data type for scalars (float or double) unsigned int NDimensions = 3> // Number of dimensions class ITK_EXPORT ThinPlateR2LogRSplineKernelTransform2 : public KernelTransform2< TScalarType, NDimensions> { public: /** Standard class typedefs. */ typedef ThinPlateR2LogRSplineKernelTransform2 Self; typedef KernelTransform2< TScalarType, NDimensions> Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; /** New macro for creation of through a Smart Pointer */ itkNewMacro( Self ); /** Run-time type information (and related methods). */ itkTypeMacro( ThinPlateR2LogRSplineKernelTransform2, KernelTransform2 ); /** Scalar type. */ typedef typename Superclass::ScalarType ScalarType; /** Parameters type. */ typedef typename Superclass::ParametersType ParametersType; /** Jacobian Type */ typedef typename Superclass::JacobianType JacobianType; /** Dimension of the domain space. */ itkStaticConstMacro(SpaceDimension, unsigned int,Superclass::SpaceDimension); /** These (rather redundant) typedefs are needed because on SGI, typedefs * are not inherited */ typedef typename Superclass::InputPointType InputPointType; typedef typename Superclass::OutputPointType OutputPointType; typedef typename Superclass::InputVectorType InputVectorType; typedef typename Superclass::OutputVectorType OutputVectorType; typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType; typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType; typedef typename Superclass::PointsIterator PointsIterator; protected: ThinPlateR2LogRSplineKernelTransform2() {}; virtual ~ThinPlateR2LogRSplineKernelTransform2() {} /** These (rather redundant) typedefs are needed because on SGI, typedefs * are not inherited. */ typedef typename Superclass::GMatrixType GMatrixType; /** Compute G(x) * For the thin plate spline, this is: * G(x) = r(x)^2 log(r(x)) * I * \f$ G(x) = r(x)^2 log(r(x)) * I \f$ * where * r(x) = Euclidean norm = sqrt[x1^2 + x2^2 + x3^2] * \f[ r(x) = \sqrt{ x_1^2 + x_2^2 + x_3^2 } \f] * I = identity matrix. */ void ComputeG(const InputVectorType & x, GMatrixType & GMatrix) const; /** Compute the contribution of the landmarks weighted by the kernel funcion to the global deformation of the space */ virtual void ComputeDeformationContribution( const InputPointType & inputPoint, OutputPointType & result ) const; private: ThinPlateR2LogRSplineKernelTransform2(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkThinPlateR2LogRSplineKernelTransform2.txx" #endif #endif // __itkThinPlateR2LogRSplineKernelTransform2_h
[ [ [ 1, 111 ] ] ]
f0de56186c73299857fa6b745935af460c5e094a
22438bd0a316b62e88380796f0a8620c4d129f50
/displays/displays.h
e4898f725ca0323bdd12f4480507f46ff1d755f0
[ "BSL-1.0" ]
permissive
DannyHavenith/NAPL
1578f5e09f1b825f776bea9575f76518a84588f4
5db7bf823bdc10587746d691cb8d94031115b037
refs/heads/master
2021-01-20T02:17:01.186461
2010-11-26T22:26:25
2010-11-26T22:26:25
1,856,141
0
1
null
null
null
null
UTF-8
C++
false
false
1,354
h
// Displays.h : main header file for the DISPLAYS application // #if !defined(AFX_DISPLAYS_H__94FA6F07_A060_11D1_A5BB_00AA001149F7__INCLUDED_) #define AFX_DISPLAYS_H__94FA6F07_A060_11D1_A5BB_00AA001149F7__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CDisplaysApp: // See Displays.cpp for the implementation of this class // class CDisplaysApp : public CWinApp { public: CDisplaysApp(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDisplaysApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CDisplaysApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #endif // !defined(AFX_DISPLAYS_H__94FA6F07_A060_11D1_A5BB_00AA001149F7__INCLUDED_)
[ [ [ 1, 49 ] ] ]
50b26615a446b56988c2de82a47a17d775458f32
57574cc7192ea8564bd630dbc2a1f1c4806e4e69
/Poker/Servidor/FabricaOperacionesServidor.h
c77c4fce28e98d7a42fc9b4a512165ed888d74c5
[]
no_license
natlehmann/taller-2010-2c-poker
3c6821faacccd5afa526b36026b2b153a2e471f9
d07384873b3705d1cd37448a65b04b4105060f19
refs/heads/master
2016-09-05T23:43:54.272182
2010-11-17T11:48:00
2010-11-17T11:48:00
32,321,142
0
0
null
null
null
null
UTF-8
C++
false
false
731
h
#ifndef _FABRICAOPERACIONES_SERVIDOR_H_ #define _FABRICAOPERACIONES_SERVIDOR_H_ #include "Operacion.h" #include "DomTree.h" #include <vector> using namespace std; #define IDOPERACIONESCENARIO = "OpEnviarEscenario" #define IDOPERACIONARCHIVO = "OpEnviarArchivo" class FabricaOperacionesServidor { public: FabricaOperacionesServidor(); virtual ~FabricaOperacionesServidor(); Operacion* newOperacion(DomTree* domTree, int idCliente); Operacion* newOperacion(string nombreOperacion, vector<string> parametros, int idCliente); private: void FabricaOperacionesServidor::validarParametro(Elemento* parametro, string idOperacion, int numeroDeParametro); }; #endif /* _FABRICAOPERACIONES_SERVIDOR_H_ */
[ "[email protected]@a9434d28-8610-e991-b0d0-89a272e3a296", "pablooddo@a9434d28-8610-e991-b0d0-89a272e3a296" ]
[ [ [ 1, 9 ], [ 13, 25 ] ], [ [ 10, 12 ] ] ]
97fa2a16c98550202a8125006c80267f04fb88af
7b379862f58f587d9327db829ae4c6493b745bb1
/JuceLibraryCode/modules/juce_data_structures/values/juce_Value.cpp
066152f0472fdb651dbdf488c2403968dab740ef
[]
no_license
owenvallis/Nomestate
75e844e8ab68933d481640c12019f0d734c62065
7fe7c06c2893421a3c77b5180e5f27ab61dd0ffd
refs/heads/master
2021-01-19T07:35:14.301832
2011-12-28T07:42:50
2011-12-28T07:42:50
2,950,072
2
0
null
null
null
null
UTF-8
C++
false
false
5,687
cpp
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ BEGIN_JUCE_NAMESPACE //============================================================================== Value::ValueSource::ValueSource() { } Value::ValueSource::~ValueSource() { } void Value::ValueSource::sendChangeMessage (const bool synchronous) { if (synchronous) { // (hold a local reference to this object in case it's freed during the callbacks) const ReferenceCountedObjectPtr<ValueSource> localRef (this); for (int i = valuesWithListeners.size(); --i >= 0;) { Value* const v = valuesWithListeners[i]; if (v != nullptr) v->callListeners(); } } else { if (valuesWithListeners.size() > 0) triggerAsyncUpdate(); } } void Value::ValueSource::handleAsyncUpdate() { sendChangeMessage (true); } //============================================================================== class SimpleValueSource : public Value::ValueSource { public: SimpleValueSource() { } SimpleValueSource (const var& initialValue) : value (initialValue) { } var getValue() const { return value; } void setValue (const var& newValue) { if (! newValue.equalsWithSameType (value)) { value = newValue; sendChangeMessage (false); } } private: var value; JUCE_DECLARE_NON_COPYABLE (SimpleValueSource); }; //============================================================================== Value::Value() : value (new SimpleValueSource()) { } Value::Value (ValueSource* const value_) : value (value_) { jassert (value_ != nullptr); } Value::Value (const var& initialValue) : value (new SimpleValueSource (initialValue)) { } Value::Value (const Value& other) : value (other.value) { } Value& Value::operator= (const Value& other) { value = other.value; return *this; } #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS Value::Value (Value&& other) noexcept : value (static_cast <ReferenceCountedObjectPtr <ValueSource>&&> (other.value)) { } Value& Value::operator= (Value&& other) noexcept { value = static_cast <ReferenceCountedObjectPtr <ValueSource>&&> (other.value); return *this; } #endif Value::~Value() { if (listeners.size() > 0) value->valuesWithListeners.removeValue (this); } //============================================================================== var Value::getValue() const { return value->getValue(); } Value::operator var() const { return getValue(); } void Value::setValue (const var& newValue) { value->setValue (newValue); } String Value::toString() const { return value->getValue().toString(); } Value& Value::operator= (const var& newValue) { value->setValue (newValue); return *this; } void Value::referTo (const Value& valueToReferTo) { if (valueToReferTo.value != value) { if (listeners.size() > 0) { value->valuesWithListeners.removeValue (this); valueToReferTo.value->valuesWithListeners.add (this); } value = valueToReferTo.value; callListeners(); } } bool Value::refersToSameSourceAs (const Value& other) const { return value == other.value; } bool Value::operator== (const Value& other) const { return value == other.value || value->getValue() == other.getValue(); } bool Value::operator!= (const Value& other) const { return value != other.value && value->getValue() != other.getValue(); } //============================================================================== void Value::addListener (ValueListener* const listener) { if (listener != nullptr) { if (listeners.size() == 0) value->valuesWithListeners.add (this); listeners.add (listener); } } void Value::removeListener (ValueListener* const listener) { listeners.remove (listener); if (listeners.size() == 0) value->valuesWithListeners.removeValue (this); } void Value::callListeners() { Value v (*this); // (create a copy in case this gets deleted by a callback) listeners.call (&ValueListener::valueChanged, v); } OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const Value& value) { return stream << value.toString(); } END_JUCE_NAMESPACE
[ "ow3nskip" ]
[ [ [ 1, 233 ] ] ]
883b8194191e8e1ad6bef440f76c5dff94bb9d9b
222bc22cb0330b694d2c3b0f4b866d726fd29c72
/src/nv38box/Math/WmlPoint4.h
a686a433d67ecb6e7d451532c30360ab3dc1b925
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference" ]
permissive
darwin/inferno
02acd3d05ca4c092aa4006b028a843ac04b551b1
e87017763abae0cfe09d47987f5f6ac37c4f073d
refs/heads/master
2021-03-12T22:15:47.889580
2009-04-17T13:29:39
2009-04-17T13:29:39
178,477
2
0
null
null
null
null
UTF-8
C++
false
false
1,341
h
// Magic Software, Inc. // http://www.magic-software.com // http://www.wild-magic.com // Copyright (c) 2003. All Rights Reserved // // The Wild Magic Library (WML) source code is supplied under the terms of // the license agreement http://www.magic-software.com/License/WildMagic.pdf // and may not be copied or disclosed except in accordance with the terms of // that agreement. #ifndef WMLPOINT4_H #define WMLPOINT4_H #include "WmlPoint.h" namespace Wml { template<class Real> class WML_ITEM Point4: public Point<4, Real> { public: // construction Point4(); Point4(Real fX, Real fY, Real fZ, Real fW); Point4(const Point4& rkP); Point4(const Point<4, Real>& rkP); // member access Real X() const; Real& X(); Real Y() const; Real& Y(); Real Z() const; Real& Z(); Real W() const; Real& W(); // special point static const Point4 ZERO; }; typedef Point4<float> Point4f; typedef Point4<double> Point4d; } #endif
[ [ [ 1, 46 ] ] ]