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
a799d1a33e561a0049ddf9d86f01c4f7eb9dc98c
a3d70ef949478e1957e3a548d8db0fddb9efc125
/各分块设定示例/脚本/src/common.h
5ed4f7317d3a60602a5e94f08972a6d3cb5f89ad
[]
no_license
SakuraSinojun/ling
fc58afea7c4dfe536cbafa93c0c6e3a7612e5281
46907e5548008d7216543bdd5b9cc058421f4eb8
refs/heads/master
2021-01-23T06:54:30.049039
2011-01-16T12:23:24
2011-01-16T12:23:24
32,323,103
0
0
null
null
null
null
GB18030
C++
false
false
623
h
#pragma once #ifndef __COMMON_H__ #define __COMMON_H__ #include "comdef.h" namespace common { void Error(const char * string, ...); // error.cpp } // 这个名字空间里的函数用于加载文件. // pl = preload // 当重复加载同一个文件时,load函数会查找已加载的文件以防止重复利用. // preload.cpp namespace pl { void * load(const char * filename, unsigned int& __out__len); void unload(const char * filename); void unloadall(); } // datafile.cpp namespace res { void * loadimg(const char * filename, BMPINFOHEADER * info); } #endif
[ "SakuraSinojun@f09d58f5-735d-f1c9-472e-e8791f25bd30" ]
[ [ [ 1, 35 ] ] ]
5791184b79707e6bda0fe4220f8169850dfe6084
b14d5833a79518a40d302e5eb40ed5da193cf1b2
/cpp/extern/xercesc++/2.6.0/src/xercesc/sax2/LexicalHandler.hpp
70998ce626329b43dcbb6835d4a3092163c0d081
[ "Apache-2.0" ]
permissive
andyburke/bitflood
dcb3fb62dad7fa5e20cf9f1d58aaa94be30e82bf
fca6c0b635d07da4e6c7fbfa032921c827a981d6
refs/heads/master
2016-09-10T02:14:35.564530
2011-11-17T09:51:49
2011-11-17T09:51:49
2,794,411
1
0
null
null
null
null
UTF-8
C++
false
false
5,656
hpp
/* * Copyright 1999-2000,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. */ /* * $Log: LexicalHandler.hpp,v $ * Revision 1.4 2004/09/08 13:56:20 peiyongz * Apache License Version 2.0 * * Revision 1.3 2003/03/07 18:10:30 tng * Return a reference instead of void for operator= * * Revision 1.2 2002/11/04 14:55:45 tng * C++ Namespace Support. * * Revision 1.1.1.1 2002/02/01 22:22:09 peiyongz * sane_include * * Revision 1.1 2000/12/22 15:17:04 tng * SAX2-ext's LexicalHandler support added by David Bertoni. * * */ #ifndef LEXICALHANDLER_HPP #define LEXICALHANDLER_HPP #include <xercesc/util/XercesDefs.hpp> XERCES_CPP_NAMESPACE_BEGIN /** * Receive notification of lexical events. * * <p>This is an extension handler for that provides lexical information * about an XML document. It does not provide information about document * content. For those events, an application must register an instance of * a ContentHandler.</p> * * <p>The order of events in this interface is very important, and * mirrors the order of information in the document itself. For * example, startDTD() and endDTD() events will occur before the * first element in the document.</p> * * @see SAX2XMLReader#setLexicalHandler * @see SAX2XMLReader#setContentHandler */ class SAX2_EXPORT LexicalHandler { public: /** @name Constructors and Destructor */ //@{ /** Default constructor */ LexicalHandler() { } /** Destructor */ virtual ~LexicalHandler() { } //@} /** @name The virtual document handler interface */ //@{ /** * Receive notification of comments. * * <p>The Parser will call this method to report each occurence of * a comment in the XML document.</p> * * <p>The application must not attempt to read from the array * outside of the specified range.</p> * * @param chars The characters from the XML document. * @param length The number of characters to read from the array. * @exception SAXException Any SAX exception, possibly * wrapping another exception. */ virtual void comment ( const XMLCh* const chars , const unsigned int length ) = 0; /** * Receive notification of the end of a CDATA section. * * <p>The SAX parser will invoke this method at the end of * each CDATA parsed.</p> * * @exception SAXException Any SAX exception, possibly * wrapping another exception. */ virtual void endCDATA () = 0; /** * Receive notification of the end of the DTD declarations. * * <p>The SAX parser will invoke this method at the end of the * DTD</p> * * @exception SAXException Any SAX exception, possibly * wrapping another exception. */ virtual void endDTD () = 0; /** * Receive notification of the end of an entity. * * <p>The SAX parser will invoke this method at the end of an * entity</p> * * @param name The name of the entity that is ending. * @exception SAXException Any SAX exception, possibly * wrapping another exception. */ virtual void endEntity (const XMLCh* const name) = 0; /** * Receive notification of the start of a CDATA section. * * <p>The SAX parser will invoke this method at the start of * each CDATA parsed.</p> * * @exception SAXException Any SAX exception, possibly * wrapping another exception. */ virtual void startCDATA () = 0; /** * Receive notification of the start of the DTD declarations. * * <p>The SAX parser will invoke this method at the start of the * DTD</p> * * @param name The document type name. * @param publicId The declared public identifier for the external DTD subset, or null if none was declared. * @param systemId The declared system identifier for the external DTD subset, or null if none was declared. * @exception SAXException Any SAX exception, possibly * wrapping another exception. */ virtual void startDTD ( const XMLCh* const name , const XMLCh* const publicId , const XMLCh* const systemId ) = 0; /** * Receive notification of the start of an entity. * * <p>The SAX parser will invoke this method at the start of an * entity</p> * * @param name The name of the entity that is starting. * @exception SAXException Any SAX exception, possibly * wrapping another exception. */ virtual void startEntity (const XMLCh* const name) = 0; //@} private : /* Unimplemented Constructors and operators */ /* Copy constructor */ LexicalHandler(const LexicalHandler&); /** Assignment operator */ LexicalHandler& operator=(const LexicalHandler&); }; XERCES_CPP_NAMESPACE_END #endif
[ [ [ 1, 188 ] ] ]
491d45a816a7de53650762630f11c199d36ff976
10bac563fc7e174d8f7c79c8777e4eb8460bc49e
/sense/MTi_server_t.cpp
da41bb3fa550b2452692f69d966b8f1e561ced04
[]
no_license
chenbk85/alcordev
41154355a837ebd15db02ecaeaca6726e722892a
bdb9d0928c80315d24299000ca6d8c492808f1d5
refs/heads/master
2021-01-10T13:36:29.338077
2008-10-22T15:57:50
2008-10-22T15:57:50
44,953,286
0
1
null
null
null
null
UTF-8
C++
false
false
1,622
cpp
#include "MTi_server_t.h" #include "alcor/core/config_parser_t.hpp" //------------------------------------------------------------------- namespace all { namespace sense { //------------------------------------------------------------------- MTi_server_t::MTi_server_t(const std::string& inifile) { // mti_.reset(); // all::core::config_parser_t config; // config.load(core::tags::ini, inifile); // int comport = config.get<int>("config.comport",12144); //assegna porta set_port(comport); //ora definisci le funzioni che rispondono ad un determinato servizio //sono solo esempi! add_command_handler ("rpy_service", boost::bind(&MTi_server_t::rpy_service_, this,_1, _2)); } //------------------------------------------------------------------- void MTi_server_t::set_device_ptr(all::sense::MTi_driver_ptr device_) { mti_= device_; } //------------------------------------------------------------------- void MTi_server_t::rpy_service_(core::client_connection_ptr_t client_, core::net_packet_ptr_t packet_) { packet_.reset(new core::net_packet_t); if(mti_) { all::math::rpy_angle_t current = mti_->get_euler(); packet_->double_to_buf(current.roll.deg()); packet_->double_to_buf(current.pitch.deg()); packet_->double_to_buf(current.yaw.deg()); } send_answer_packet("rpy_service", client_, packet_); } //------------------------------------------------------------------- }}//all::sense //-------------------------------------------------------------------
[ "andrea.carbone@1c7d64d3-9b28-0410-bae3-039769c3cb81" ]
[ [ [ 1, 48 ] ] ]
03c43aaad218581ca8bd39de2d418e0a805873dd
83ed25c6e6b33b2fabd4f81bf91d5fae9e18519c
/code/SceneCombiner.h
e6a5035cdcbde1763cd143cc4cb0934bf5e8147b
[ "BSD-3-Clause" ]
permissive
spring/assimp
fb53b91228843f7677fe8ec18b61d7b5886a6fd3
db29c9a20d0dfa9f98c8fd473824bba5a895ae9e
refs/heads/master
2021-01-17T23:19:56.511185
2011-11-08T12:15:18
2011-11-08T12:15:18
2,017,841
1
1
null
null
null
null
UTF-8
C++
false
false
12,885
h
/* Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------- Copyright (c) 2006-2010, ASSIMP Development Team All rights reserved. Redistribution and use of this software 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 the ASSIMP team, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the ASSIMP Development Team. 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 OWNER 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. ---------------------------------------------------------------------- */ /** @file Declares a helper class, "SceneCombiner" providing various * utilities to merge scenes. */ #ifndef AI_SCENE_COMBINER_H_INC #define AI_SCENE_COMBINER_H_INC #include "../include/aiAssert.h" namespace Assimp { // --------------------------------------------------------------------------- /** \brief Helper data structure for SceneCombiner. * * Describes to which node a scene must be attached to. */ struct AttachmentInfo { AttachmentInfo() : scene (NULL) , attachToNode (NULL) {} AttachmentInfo(aiScene* _scene, aiNode* _attachToNode) : scene (_scene) , attachToNode (_attachToNode) {} aiScene* scene; aiNode* attachToNode; }; // --------------------------------------------------------------------------- struct NodeAttachmentInfo { NodeAttachmentInfo() : node (NULL) , attachToNode (NULL) , resolved (false) , src_idx (SIZE_MAX) {} NodeAttachmentInfo(aiNode* _scene, aiNode* _attachToNode,size_t idx) : node (_scene) , attachToNode (_attachToNode) , resolved (false) , src_idx (idx) {} aiNode* node; aiNode* attachToNode; bool resolved; size_t src_idx; }; // --------------------------------------------------------------------------- /** @def AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES * Generate unique names for all named scene items */ #define AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES 0x1 /** @def AI_INT_MERGE_SCENE_GEN_UNIQUE_MATNAMES * Generate unique names for materials, too. * This is not absolutely required to pass the validation. */ #define AI_INT_MERGE_SCENE_GEN_UNIQUE_MATNAMES 0x2 /** @def AI_INT_MERGE_SCENE_DUPLICATES_DEEP_CPY * Use deep copies of duplicate scenes */ #define AI_INT_MERGE_SCENE_DUPLICATES_DEEP_CPY 0x4 /** @def AI_INT_MERGE_SCENE_RESOLVE_CROSS_ATTACHMENTS * If attachment nodes are not found in the given master scene, * search the other imported scenes for them in an any order. */ #define AI_INT_MERGE_SCENE_RESOLVE_CROSS_ATTACHMENTS 0x8 /** @def AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES_IF_NECESSARY * Can be combined with AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES. * Unique names are generated, but only if this is absolutely * required to avoid name conflicts. */ #define AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES_IF_NECESSARY 0x10 typedef std::pair<aiBone*,unsigned int> BoneSrcIndex; // --------------------------------------------------------------------------- /** @brief Helper data structure for SceneCombiner::MergeBones. */ struct BoneWithHash : public std::pair<uint32_t,aiString*> { std::vector<BoneSrcIndex> pSrcBones; }; // --------------------------------------------------------------------------- /** @brief Utility for SceneCombiner */ struct SceneHelper { SceneHelper () : scene (NULL) , idlen (0) { id[0] = 0; } SceneHelper (aiScene* _scene) : scene (_scene) , idlen (0) { id[0] = 0; } AI_FORCE_INLINE aiScene* operator-> () const { return scene; } // scene we're working on aiScene* scene; // prefix to be added to all identifiers in the scene ... char id [32]; // and its strlen() unsigned int idlen; // hash table to quickly check whether a name is contained in the scene std::set<unsigned int> hashes; }; // --------------------------------------------------------------------------- /** \brief Static helper class providing various utilities to merge two * scenes. It is intended as internal utility and NOT for use by * applications. * * The class is currently being used by various postprocessing steps * and loaders (ie. LWS). */ class SceneCombiner { // class cannot be instanced SceneCombiner() {} public: // ------------------------------------------------------------------- /** Merges two or more scenes. * * @param dest Receives a pointer to the destination scene. If the * pointer doesn't point to NULL when the function is called, the * existing scene is cleared and refilled. * @param src Non-empty list of scenes to be merged. The function * deletes the input scenes afterwards. There may be duplicate scenes. * @param flags Combination of the AI_INT_MERGE_SCENE flags defined above */ static void MergeScenes(aiScene** dest,std::vector<aiScene*>& src, unsigned int flags = 0); // ------------------------------------------------------------------- /** Merges two or more scenes and attaches all sceenes to a specific * position in the node graph of the masteer scene. * * @param dest Receives a pointer to the destination scene. If the * pointer doesn't point to NULL when the function is called, the * existing scene is cleared and refilled. * @param master Master scene. It will be deleted afterwards. All * other scenes will be inserted in its node graph. * @param src Non-empty list of scenes to be merged along with their * corresponding attachment points in the master scene. The function * deletes the input scenes afterwards. There may be duplicate scenes. * @param flags Combination of the AI_INT_MERGE_SCENE flags defined above */ static void MergeScenes(aiScene** dest, aiScene* master, std::vector<AttachmentInfo>& src, unsigned int flags = 0); // ------------------------------------------------------------------- /** Merges two or more meshes * * The meshes should have equal vertex formats. Only components * that are provided by ALL meshes will be present in the output mesh. * An exception is made for VColors - they are set to black. The * meshes should have the same material indices, too. The output * material index is always the material index of the first mesh. * * @param dest Destination mesh. Must be empty. * @param flags Currently no parameters * @param begin First mesh to be processed * @param end Points to the mesh after the last mesh to be processed */ static void MergeMeshes(aiMesh** dest,unsigned int flags, std::vector<aiMesh*>::const_iterator begin, std::vector<aiMesh*>::const_iterator end); // ------------------------------------------------------------------- /** Merges two or more bones * * @param out Mesh to receive the output bone list * @param flags Currently no parameters * @param begin First mesh to be processed * @param end Points to the mesh after the last mesh to be processed */ static void MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator it, std::vector<aiMesh*>::const_iterator end); // ------------------------------------------------------------------- /** Builds a list of uniquely named bones in a mesh list * * @param asBones Receives the output list * @param it First mesh to be processed * @param end Last mesh to be processed */ static void BuildUniqueBoneList(std::list<BoneWithHash>& asBones, std::vector<aiMesh*>::const_iterator it, std::vector<aiMesh*>::const_iterator end); // ------------------------------------------------------------------- /** Add a name prefix to all nodes in a scene. * * @param Current node. This function is called recursively. * @param prefix Prefix to be added to all nodes * @param len STring length */ static void AddNodePrefixes(aiNode* node, const char* prefix, unsigned int len); // ------------------------------------------------------------------- /** Add an offset to all mesh indices in a node graph * * @param Current node. This function is called recursively. * @param offset Offset to be added to all mesh indices */ static void OffsetNodeMeshIndices (aiNode* node, unsigned int offset); // ------------------------------------------------------------------- /** Attach a list of node graphs to well-defined nodes in a master * graph. This is a helper for MergeScenes() * * @param master Master scene * @param srcList List of source scenes along with their attachment * points. If an attachment point is NULL (or does not exist in * the master graph), a scene is attached to the root of the master * graph (as an additional child node) * @duplicates List of duplicates. If elem[n] == n the scene is not * a duplicate. Otherwise elem[n] links scene n to its first occurence. */ static void AttachToGraph ( aiScene* master, std::vector<NodeAttachmentInfo>& srcList); static void AttachToGraph (aiNode* attach, std::vector<NodeAttachmentInfo>& srcList); // ------------------------------------------------------------------- /** Get a deep copy of a scene * * @param dest Receives a pointer to the destination scene * @param src Source scene - remains unmodified. */ static void CopyScene(aiScene** dest,const aiScene* source,bool allocate = true); // ------------------------------------------------------------------- /** Get a flat copy of a scene * * Only the first hierarchy layer is copied. All pointer members of * aiScene are shared by source and destination scene. If the * pointer doesn't point to NULL when the function is called, the * existing scene is cleared and refilled. * @param dest Receives a pointer to the destination scene * @param src Source scene - remains unmodified. */ static void CopySceneFlat(aiScene** dest,const aiScene* source); // ------------------------------------------------------------------- /** Get a deep copy of a mesh * * @param dest Receives a pointer to the destination mesh * @param src Source mesh - remains unmodified. */ static void Copy (aiMesh** dest, const aiMesh* src); // similar to Copy(): static void Copy (aiMaterial** dest, const aiMaterial* src); static void Copy (aiTexture** dest, const aiTexture* src); static void Copy (aiAnimation** dest, const aiAnimation* src); static void Copy (aiCamera** dest, const aiCamera* src); static void Copy (aiBone** dest, const aiBone* src); static void Copy (aiLight** dest, const aiLight* src); static void Copy (aiNodeAnim** dest, const aiNodeAnim* src); // recursive, of course static void Copy (aiNode** dest, const aiNode* src); private: // ------------------------------------------------------------------- // Same as AddNodePrefixes, but with an additional check static void AddNodePrefixesChecked(aiNode* node, const char* prefix, unsigned int len, std::vector<SceneHelper>& input, unsigned int cur); // ------------------------------------------------------------------- // Add node identifiers to a hashing set static void AddNodeHashes(aiNode* node, std::set<unsigned int>& hashes); // ------------------------------------------------------------------- // Search for duplicate names static bool FindNameMatch(const aiString& name, std::vector<SceneHelper>& input, unsigned int cur); }; } #endif // !! AI_SCENE_COMBINER_H_INC
[ "aramis_acg@67173fc5-114c-0410-ac8e-9d2fd5bffc1f" ]
[ [ [ 1, 365 ] ] ]
f989f886de0c8bd20eaccbaa6a6d1476d31c363e
b14d5833a79518a40d302e5eb40ed5da193cf1b2
/cpp/extern/xercesc++/2.6.0/src/xercesc/util/regx/UnionToken.cpp
3e5692e6a311608d12a688ca133e7ec65faceccc
[ "Apache-2.0" ]
permissive
andyburke/bitflood
dcb3fb62dad7fa5e20cf9f1d58aaa94be30e82bf
fca6c0b635d07da4e6c7fbfa032921c827a981d6
refs/heads/master
2016-09-10T02:14:35.564530
2011-11-17T09:51:49
2011-11-17T09:51:49
2,794,411
1
0
null
null
null
null
UTF-8
C++
false
false
6,678
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. */ /* * $Log: UnionToken.cpp,v $ * Revision 1.9 2004/09/08 13:56:47 peiyongz * Apache License Version 2.0 * * Revision 1.8 2003/12/24 15:24:15 cargilld * More updates to memory management so that the static memory manager. * * Revision 1.7 2003/12/17 00:18:37 cargilld * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. * * Revision 1.6 2003/05/18 14:02:06 knoaman * Memory manager implementation: pass per instance manager. * * Revision 1.5 2003/05/16 21:37:00 knoaman * Memory manager implementation: Modify constructors to pass in the memory manager. * * Revision 1.4 2003/05/16 00:03:10 knoaman * Partial implementation of the configurable memory manager. * * Revision 1.3 2002/11/04 15:17:01 tng * C++ Namespace Support. * * Revision 1.2 2002/03/18 19:29:53 knoaman * Change constant names to eliminate possible conflict with user defined ones. * * Revision 1.1.1.1 2002/02/01 22:22:34 peiyongz * sane_include * * Revision 1.4 2001/06/05 14:50:32 knoaman * Fixes to regular expression. * * Revision 1.3 2001/05/11 13:26:52 tng * Copyright update. * * Revision 1.2 2001/05/03 18:17:59 knoaman * Some design changes: * o Changed the TokenFactory from a single static instance, to a * normal class. Each RegularExpression object will have its own * instance of TokenFactory, and that instance will be passed to * other classes that need to use a TokenFactory to create Token * objects (with the exception of RangeTokenMap). * o Added a new class RangeTokenMap to map a the different ranges * in a given category to a specific RangeFactory object. In the old * design RangeFactory had dual functionality (act as a Map, and as * a factory for creating RangeToken(s)). The RangeTokenMap will * have its own copy of the TokenFactory. There will be only one * instance of the RangeTokenMap class, and that instance will be * lazily deleted when XPlatformUtils::Terminate is called. * * Revision 1.1 2001/03/02 19:23:02 knoaman * Schema: Regular expression handling part I * */ // --------------------------------------------------------------------------- // Includes // --------------------------------------------------------------------------- #include <xercesc/util/regx/UnionToken.hpp> #include <xercesc/framework/XMLBuffer.hpp> #include <xercesc/util/regx/RegxUtil.hpp> #include <xercesc/util/regx/TokenFactory.hpp> #include <xercesc/util/regx/StringToken.hpp> XERCES_CPP_NAMESPACE_BEGIN // --------------------------------------------------------------------------- // Static member data initialization // --------------------------------------------------------------------------- const unsigned short UnionToken::INITIALSIZE = 8; // --------------------------------------------------------------------------- // UnionToken: Constructors and Destructors // --------------------------------------------------------------------------- UnionToken::UnionToken(const unsigned short tokType, MemoryManager* const manager) : Token(tokType, manager) , fChildren(0) { } UnionToken::~UnionToken() { delete fChildren; } // --------------------------------------------------------------------------- // UnionToken: Children manipulation methods // --------------------------------------------------------------------------- void UnionToken::addChild(Token* const child, TokenFactory* const tokFactory) { if (child == 0) return; if (fChildren == 0) fChildren = new (tokFactory->getMemoryManager()) RefVectorOf<Token>(INITIALSIZE, false, tokFactory->getMemoryManager()); if (getTokenType() == T_UNION) { fChildren->addElement(child); return; } unsigned short childType = child->getTokenType(); unsigned int childSize = child->size(); if (childType == T_CONCAT) { for (unsigned int i = 0; i < childSize; i++) { addChild(child->getChild(i), tokFactory); } return; } unsigned int childrenSize = fChildren->size(); if (childrenSize == 0) { fChildren->addElement(child); return; } Token* previousTok = fChildren->elementAt(childrenSize - 1); unsigned short previousType = previousTok->getTokenType(); if (!((previousType == T_CHAR || previousType == T_STRING) && (childType == T_CHAR || childType == T_STRING))) { fChildren->addElement(child); return; } // Continue XMLBuffer stringBuf(1023, tokFactory->getMemoryManager()); if (previousType == T_CHAR) { XMLInt32 ch = previousTok->getChar(); if (ch >= 0x10000) { XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, tokFactory->getMemoryManager()); stringBuf.append(chSurrogate); tokFactory->getMemoryManager()->deallocate(chSurrogate);//delete [] chSurrogate; } else { stringBuf.append((XMLCh) ch); } previousTok = tokFactory->createString(0); fChildren->setElementAt(previousTok, childrenSize - 1); } else { stringBuf.append(previousTok->getString()); } if (childType == T_CHAR) { XMLInt32 ch = child->getChar(); if (ch >= 0x10000) { XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, tokFactory->getMemoryManager()); stringBuf.append(chSurrogate); tokFactory->getMemoryManager()->deallocate(chSurrogate);//delete [] chSurrogate; } else { stringBuf.append((XMLCh) ch); } } else { stringBuf.append(child->getString()); } ((StringToken*) previousTok)->setString(stringBuf.getRawBuffer()); } XERCES_CPP_NAMESPACE_END /** * End of file UnionToken.cpp */
[ [ [ 1, 200 ] ] ]
ec485edeebcdb10ab0b9b6f397ae64cec32f7c14
4130b759a019fd0c6e30f820b1aed3b705520d77
/Vanilla3.h
eacd184f1aba1c2b7cd59e6df4c925269984304d
[]
no_license
abzaremba/Joshi
f8df80e6bd1abc938b8cc57a296ac4160677332c
e8ce402b777191d6735dc0179afca721c80c542b
refs/heads/master
2021-01-23T08:15:13.234955
2011-11-14T16:01:37
2011-11-14T16:01:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
312
h
#ifndef VANILLA_3_H #define VANILLA_3_H #include "PayoffBridge.h" class VanillaOption { public: VanillaOption(const PayoffBridge &ThePayoff_, double Expiry_); double OptionPayoff(double Spot) const; double GetExpiry() const; private: double Expiry; PayoffBridge ThePayoff; }; #endif
[ [ [ 1, 20 ] ] ]
5863ca74bd7cefa14db3dd7ea996fe1b51d9f0f6
9fb229975cc6bd01eb38c3e96849d0c36985fa1e
/src/Bluetooth/AsyncBase.h
0574fa2962e6780e1faf1bbb3b94faee765f42c2
[]
no_license
Danewalker/ahr
3758bf3219f407ed813c2bbed5d1d86291b9237d
2af9fd5a866c98ef1f95f4d1c3d9b192fee785a6
refs/heads/master
2016-09-13T08:03:43.040624
2010-07-21T15:44:41
2010-07-21T15:44:41
56,323,321
0
0
null
null
null
null
UTF-8
C++
false
false
395
h
#ifndef __ASYNCBASE__ #define __ASYNCBASE__ #include "config.h" #ifdef HAS_BLUETOOTH_SYMBIAN #ifdef __SYMBIAN32__ #include <e32base.h> #include <es_sock.h> class CAsyncBase : public CActive { public: CAsyncBase(); virtual ~CAsyncBase(); protected: TRequestStatus *m_status; }; #endif //__SYMBIAN32__ #endif // HAS_BLUETOOTH_SYMBIAN #endif // __ASYNCBASE__
[ "jakesoul@c957e3ca-5ece-11de-8832-3f4c773c73ae" ]
[ [ [ 1, 27 ] ] ]
cf6bf53ae1688c418d7fed3b6d0215316b833dcd
7d5bde00c1d3f3e03a0f35ed895068f0451849b2
/logframe.h
b99f5872590ae5d7bb4137d7911da3925c449568
[]
no_license
jkackley/jeremykackley-dfjobs-improvment
6638af16515d140e9d68c7872b11b47d4f6d7587
73f53a26daa7f66143f35956150c8fe2b922c2e2
refs/heads/master
2021-01-16T01:01:38.642050
2011-05-16T18:03:23
2011-05-16T18:03:23
32,128,889
0
0
null
null
null
null
UTF-8
C++
false
false
1,749
h
/*- * Copyright (c) 2011, Derek Young * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. * */ #ifndef LOGFRAME_H #define LOGFRAME_H #include <QFrame> #include <QString> namespace Ui { class LogFrame; } class LogFrame : public QFrame { Q_OBJECT public: explicit LogFrame(QWidget *parent = 0); ~LogFrame(); public slots: void print(QString); private: Ui::LogFrame *ui; }; #endif // LOGFRAME_H
[ "Devek@localhost" ]
[ [ [ 1, 51 ] ] ]
42ebb7c993fd95c000c69cb697672e1c0cef68a0
25281ba3fc17716aaca69186a6f115e914c8ecf8
/src/textoutput.h
47e0d5919dc53d23d94fa7a1e7375ad770843b56
[]
no_license
rehno-lindeque/osi-glgui
97b2c6f771d2dd646e023366bcf05f7f68a5e2cc
0b9e939e17fdb62fd089985cb6e67ac7aa11d1e6
refs/heads/master
2020-03-30T20:12:48.683127
2011-01-29T09:57:45
2011-01-29T09:57:45
1,303,874
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
642
h
#ifndef __GLGUI_TEXTOUTPUT_H__ #define __GLGUI_TEXTOUTPUT_H__ ////////////////////////////////////////////////////////////////////////////// // // TEXTOUTPUT.H // // Copyright © 2007, Rehno Lindeque. All rights reserved. // ////////////////////////////////////////////////////////////////////////////// /* DOCUMENTATION */ /* DESCRIPTION: GLGUI text output class. */ namespace GLGUI { /* CLASSES */ class TextOutput : public Base::Object { public: }; } #endif
[ [ [ 1, 26 ] ] ]
4390ecaa22faa46e0b5b066081dcb192d978a262
718dc2ad71e8b39471b5bf0c6d60cbe5f5c183e1
/soft micros/Codigo/codigo portable/Vista/DiagramaDeNavegacion/Boxes/BoxPrincipalControlSD.hpp
7c0a5b80f01334e74547ba5d61d5323e641b9f5b
[]
no_license
jonyMarino/microsdhacel
affb7a6b0ea1f4fd96d79a04d1a3ec3eaa917bca
66d03c6a9d3a2d22b4d7104e2a38a2c9bb4061d3
refs/heads/master
2020-05-18T19:53:51.301695
2011-05-30T20:40:24
2011-05-30T20:40:24
34,532,512
0
0
null
null
null
null
UTF-8
C++
false
false
2,072
hpp
#ifndef _BOX_PRINCIPAL_CONTROL_SD_HPP #define _BOX_PRINCIPAL_CONTROL_SD_HPP #include "Box.hpp" #include "Propiedades/ConstructorPropiedadGetter.hpp" #include "MessagesOut/MessagesOut.hpp" #include "Timer/FlagTimer/FlagTimer.hpp" #include "PE/include/PE_Types.h" #include "Memoria/Prom/Flash/FlashBkp.hpp" #include "Propiedades/PropiedadGetterVisual/PropGetterVisual.hpp" #pragma DATA_SEG BoxPrincipalControlSD_DATA #pragma CODE_SEG BoxPrincipalControlSD_CODE #pragma CONST_SEG DEFAULT /* Constant section for this module */ #define CANTIDAD_CANALES 4 #define PRI_PAR_SECONDS 5000 //El parametro se muestra 5 segundos luego de 'u' o 'd' #define REFRESH_SECONDS 2000 #ifndef TIME_BETWEEN_PARS #define TIME_BETWEEN_PARS 2000 #endif struct ConstructorBoxPrincipalControlSD{ struct ConstructorBox super; Getter ** snsrs; MessagesOut * msjs[CANTIDAD_CANALES]; FlashBkp * flash; }; class BoxPrincipalControlSD:public Box{ public: BoxPrincipalControlSD(struct ConstructorBoxPrincipalControlSD * constructor); virtual ~BoxPrincipalControlSD(); virtual Box * procesarTecla(uchar tecla,TEstadoBox& estado); protected: struct ConstructorBoxPrincipalControlSD * constructor; FlagTimer timerPri; // Timer de refresco FlagTimer timerRefresh; uint msj_index[CANTIDAD_CANALES]; // indice del msj a mostrar // private: // bool _refrescar; }; struct BoxPrincipalControlSDFactory:public BoxFactory{ virtual Box& getBox(const void*args,void*obj,uchar numObjeto)const{ return *new BoxPrincipalControlSD((struct ConstructorBoxPrincipalControlSD *)args); } }; extern const struct BoxPrincipalControlSDFactory boxPrincipalControlSDFactory; #pragma DATA_SEG DEFAULT #pragma CODE_SEG DEFAULT #endif
[ "nicopimen@9fc3b3b2-dce3-11dd-9b7c-b771bf68b549" ]
[ [ [ 1, 68 ] ] ]
6a6c64531d96d79557388448e43312190ef63395
48113249b9c24b965a55cd8cef98d9a6edc0bb31
/sidescroller/game.h
798fbf43d788d08f29a775b103e6f0430ffa3bca
[]
no_license
janww/sidescroller
f2d6e16784be5585f16334119b35be28f8e79abb
caac450f92272b8b13710236cde73322a558755c
refs/heads/master
2020-12-24T13:28:59.400165
2011-10-06T18:59:13
2011-10-06T18:59:13
2,528,012
0
0
null
null
null
null
UTF-8
C++
false
false
592
h
#include <iostream> #include <fstream> #include <vector> #include <SDL.h> #include "base.h" #include "player.h" class game{ SDL_Surface* screen, *background, *block; SDL_Rect camera; std::vector<std::vector<int>> map; bool direction[2]; bool running; SDL_Surface* load_image(const char* filename); void loadmap(const char* filename); void showmap(); void handleEvents(); static const int SCREEN_WIDTH = 640; static const int SCREEN_HEIGHT = 480; static const int SCREEN_BPP = 32; player* player1; public: game(); ~game(); void start(); };
[ [ [ 1, 30 ] ] ]
b43889279c9f7977aba3356196d26f13797b01dd
138a353006eb1376668037fcdfbafc05450aa413
/source/GameListener.cpp
5f849b3bd08e752ec65a3b1e3864ae5c3dcd2d61
[]
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
648
cpp
#include "GameListener.h" #include "Game.h" #include "GameServices.h" #include "InputManager.h" GameListener::GameListener(Ogre::Root *ogreRoot) { mGameServices = new GameServices(ogreRoot); mGame = new Game(ogreRoot, mGameServices); //mGameServices->setGame(mGame); } GameListener::~GameListener() { delete mGame; delete mGameServices; } bool GameListener::frameStarted(const Ogre::FrameEvent &evnt) { mGameServices->update(); mGame->startUpdate(); return !mGameServices->input()->keyDown(OIS::KC_ESCAPE); } bool GameListener::frameEnded(const Ogre::FrameEvent &evnt) { mGame->endUpdate(); return true; }
[ "Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e" ]
[ [ [ 1, 28 ] ] ]
bbb9c269bbde3fefd1ba190bda9f34f35ab76cd9
076413cfd054131591ae7b4ef0b769c48b6d967b
/tetris/TetrominoS.h
27b6794136bf66df5f4801010ab3f7ec6b9021ac
[ "MIT" ]
permissive
oliverzheng/tetris
9ef134266ea528303f9fb6b8c28095575ef7b882
8a0c629e7378fd90c6b6f40a904b58e7110c4040
refs/heads/master
2020-06-03T15:08:26.444621
2010-02-02T03:54:40
2010-02-02T03:54:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,599
h
/****************************************************************************** TetrominoS.h Created for: Tetris Copyright (C) 2006-2007 Oliver Zheng. All rights reserved. No part of this software may be used or reproduced in any form by any means without prior written permission. - - | - - Inherited from Tetromino ******************************************************************************/ #include "Tetromino.h" class TetrominoS : public Tetromino { Block* blocks; Block* blocks_buffer; static const int block_count = 4; static const blockColor block_color = CYAN; int rotation_state; static const int rotation_count = 2; static int setup_positions_x[block_count]; static int setup_positions_y[block_count]; static int next_positions_x[block_count]; static int next_positions_y[block_count]; // relative positions that each block should move to static int rotation_positions_x[rotation_count][block_count]; static int rotation_positions_y[rotation_count][block_count]; public: TetrominoS(); ~TetrominoS(); bool setup(void); void nextSetup(void); int getBlockCount(void) const { return block_count; }; Block* getBlocks(void) const { return blocks; }; Block* getBlocksBuffer(void) const { return blocks_buffer; }; blockColor getBlockColor(void) const { return block_color; }; int getRotationState(void) const { return rotation_state; }; int getRotationCount(void) const { return rotation_count; }; void setRotationState(int s) { rotation_state = s; }; void rotate_map(void); };
[ [ [ 1, 58 ] ] ]
9c4c0febb3f7b6761739a462dcbd8062317897d2
1493997bb11718d3c18c6632b6dd010535f742f5
/direct_ui/UIlib/UIMarkup.h
28bcf52beb2968b1a83fdd27ec63f0e26db09f6a
[]
no_license
kovrov/scrap
cd0cf2c98a62d5af6e4206a2cab7bb8e4560b168
b0f38d95dd4acd89c832188265dece4d91383bbb
refs/heads/master
2021-01-20T12:21:34.742007
2010-01-12T19:53:23
2010-01-12T19:53:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,644
h
#if !defined(AFX_MARKUP_H__20050505_6983_3DDF_F867_0080AD509054__INCLUDED_) #define AFX_MARKUP_H__20050505_6983_3DDF_F867_0080AD509054__INCLUDED_ #pragma once class CMarkup; class CMarkupNode; class UILIB_API CMarkup { friend CMarkupNode; public: CMarkup(LPCTSTR pstrXML = NULL); ~CMarkup(); bool Load(LPCTSTR pstrXML); bool LoadFromFile(LPCTSTR pstrFilename); void Release(); bool IsValid() const; void SetPreserveWhitespace(bool bPreserve = true); void GetLastErrorMessage(LPTSTR pstrMessage, SIZE_T cchMax) const; void GetLastErrorLocation(LPTSTR pstrSource, SIZE_T cchMax) const; CMarkupNode GetRoot(); private: typedef struct tagXMLELEMENT { ULONG iStart; ULONG iChild; ULONG iNext; ULONG iParent; ULONG iData; } XMLELEMENT; LPTSTR m_pstrXML; XMLELEMENT* m_pElements; ULONG m_nElements; ULONG m_nReservedElements; TCHAR m_szErrorMsg[100]; TCHAR m_szErrorXML[50]; bool m_bPreserveWhitespace; private: bool _Parse(); bool _Parse(LPTSTR& pstrText, ULONG iParent); XMLELEMENT* _ReserveElement(); inline void _SkipWhitespace(LPTSTR& pstr) const; inline void _SkipWhitespace(LPCTSTR& pstr) const; inline void _SkipIdentifier(LPTSTR& pstr) const; inline void _SkipIdentifier(LPCTSTR& pstr) const; bool _ParseData(LPTSTR& pstrText, LPTSTR& pstrData, char cEnd); void _ParseMetaChar(LPTSTR& pstrText, LPTSTR& pstrDest); bool _ParseAttributes(LPTSTR& pstrText); bool _Failed(LPCTSTR pstrError, LPCTSTR pstrLocation = NULL); }; class UILIB_API CMarkupNode { friend CMarkup; private: CMarkupNode(); CMarkupNode(CMarkup* pOwner, int iPos); public: bool IsValid() const; CMarkupNode GetParent(); CMarkupNode GetSibling(); CMarkupNode GetChild(); CMarkupNode GetChild(LPCTSTR pstrName); bool HasSiblings() const; bool HasChildren() const; LPCTSTR GetName() const; LPCTSTR GetValue() const; bool HasAttributes(); bool HasAttribute(LPCTSTR pstrName); int GetAttributeCount(); LPCTSTR GetAttributeName(int iIndex); LPCTSTR GetAttributeValue(int iIndex); LPCTSTR GetAttributeValue(LPCTSTR pstrName); bool GetAttributeValue(int iIndex, LPTSTR pstrValue, SIZE_T cchMax); bool GetAttributeValue(LPCTSTR pstrName, LPTSTR pstrValue, SIZE_T cchMax); private: void _MapAttributes(); enum { MAX_XML_ATTRIBUTES = 20 }; typedef struct { ULONG iName; ULONG iValue; } XMLATTRIBUTE; int m_iPos; int m_nAttributes; XMLATTRIBUTE m_aAttributes[MAX_XML_ATTRIBUTES]; CMarkup* m_pOwner; }; #endif // !defined(AFX_MARKUP_H__20050505_6983_3DDF_F867_0080AD509054__INCLUDED_)
[ [ [ 1, 109 ] ] ]
32bce2a99e4d40942ab2c04f547809cf1d80f3d2
1cc5720e245ca0d8083b0f12806a5c8b13b5cf98
/v107/c/c.cpp
21dc3e25396ca78ea6e1cf254aba1cfc41774e97
[]
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
1,490
cpp
#include <iostream> #include <assert.h> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; /*void start() { }*/ /*bool start() { return false; }*/ int n; double pes[110]; int posc; double tot; double pos[3100000]; int quem[3100000]; int pre[3100000]; int main () { while(true) { cin >> n; int i,j,k; if(n==0) return 0; tot = 0; double minval = 0; for(i=0;i!=n;i++) { cin >> pes[i]; tot += pes[i]; if(i==0 || pes[i]<minval) { minval = pes[i]; } } double mindes = 0.98 * tot / 1.98; double maxdes = 1.02 * tot / 2.02; // cout << mindes << "," << maxdes << endl; posc = 0; int temp; for(i=0;i!=n;i++) { temp = posc; if(pes[i]<=maxdes) { pre[temp] = -1; quem[temp] = i; pos[temp++] = pes[i]; if(pes[i]>=mindes) { cout << i << endl; goto fim; } } // foi com uma so? for(j=0;j!=posc;j++) { pos[temp] = pos[j] + pes[i]; if(pos[temp]<=maxdes) { // cout << endl << pos[temp] << endl; pre[temp] = j; quem[temp] = i; if(pos[temp]>=mindes) { // achei while(pre[temp]!=-1) { cout << (quem[temp]+1) << " "; temp = pre[temp]; } cout << (quem[temp]+1); cout << endl; goto fim; } if(pos[temp]+minval<=maxdes) { temp++; } } } posc = temp; } //assert(false); fim:; } return 0; }
[ [ [ 1, 86 ] ] ]
66903c3c2888aab3536e648297b7d9b7d8313345
dde6e080c5f427d57dbd416f92b25e1bb32aad83
/Sphere.h
e265294a6cdb7401bb4b3b2b7c2a24f7e20a73b8
[]
no_license
davidjonsson/aglobal
b0d715fa155cce1767cc0a4577e8d60006dbbf30
a7c1fb8bf456de655bd5fa62259d131b8f18f48d
refs/heads/master
2021-01-01T19:39:09.981802
2010-11-08T15:39:58
2010-11-08T15:39:58
1,025,287
1
0
null
null
null
null
UTF-8
C++
false
false
384
h
#ifndef SPHERE_H #define SPHERE_H #include "Shape.h" class Sphere : public Shape{ public: Sphere(); Sphere(float, Vec3f, Material); float radius; Vec3f origin; Vec3f intersect(Ray* r, Vec3f *normalR); // Vec3f getNormal(Vec3f p){return origin-p;}; }; #endif
[ [ [ 1, 24 ] ] ]
63a7f90ebd20ca0c2a48c63a53a163d19938a9d2
9089f5a53ae6ede61f9da7ddd44fefe47e9e5f07
/phase_4/driver.cpp
d335ebf77be4a6b4f83919697d83cb8665474a73
[]
no_license
akamel001/File-System
a5f27deea482da1693d0a83b797e4ba6fa8ff338
901d5392a9c3112a3834c7d5071a4eb5f7858bc6
refs/heads/master
2021-01-19T12:38:47.928372
2011-11-22T00:53:46
2011-11-22T00:53:46
2,824,363
1
1
null
null
null
null
UTF-8
C++
false
false
534
cpp
/* * Author: Abdelrahman Kamel * Assignment: CSCI 350 project 1 * Creation date: 10/3/2009 * Description: A test driver for the simulation disk */ #include <iostream> #include <fstream> #include "table.h" using namespace std; int main() { Pdisk disk("disk",500,128); fileSys fs(disk); Table tb(fs, "flatfile", "bindxf"); tb.build_table("data2009.txt"); //tb.search("471"); string x ; cout << "Enter the Date: "; cin >> x; cout << endl; tb.search(x); fs.fsClose(); }
[ [ [ 1, 31 ] ] ]
ed70f175fc8309eb104269249d8873af56d1541a
028d6009f3beceba80316daa84b628496a210f8d
/uidesigner/com.nokia.sdt.referenceprojects.test/data/lists_3_0/reference/inc/lists_3_0Application.h
a65d33b8a97751332fe5e2b8fad2377ebd047832
[]
no_license
JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
fa50cafa69d3e317abf0db0f4e3e557150fd88b3
4420f338bc4e522c563f8899d81201857236a66a
refs/heads/master
2020-12-30T16:45:28.474973
2010-10-20T16:19:31
2010-10-20T16:19:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
809
h
#ifndef LISTS_3_0APPLICATION_H #define LISTS_3_0APPLICATION_H // [[[ begin generated region: do not modify [Generated Includes] #include <aknapp.h> // ]]] end generated region [Generated Includes] // [[[ begin generated region: do not modify [Generated Constants] const TUid KUidlists_3_0Application = { 0xE88ED6FE }; // ]]] end generated region [Generated Constants] /** * * @class Clists_3_0Application lists_3_0Application.h * @brief A CAknApplication-derived class is required by the S60 application * framework. It is subclassed to create the application's document * object. */ class Clists_3_0Application : public CAknApplication { private: TUid AppDllUid() const; CApaDocument* CreateDocumentL(); }; #endif // LISTS_3_0APPLICATION_H
[ [ [ 1, 27 ] ] ]
18341088cf0d45560007aed8dece1df97772e2d5
990e19b7ae3d9bd694ebeae175c50be589abc815
/src/cwapp/Parser.cpp
06fab91830b4c713bbe3eca49c34707c20b1e628
[]
no_license
shadoof/CW2
566b43cc2bdea2c86bd1ccd1e7b7e7cd85b8f4f5
a3986cb28270a702402c197cdb16373bf74b9d03
refs/heads/master
2020-05-16T23:39:56.007788
2011-12-08T06:10:22
2011-12-08T06:10:22
2,389,647
1
0
null
null
null
null
UTF-8
C++
false
false
5,478
cpp
#include "main.h" #include "ConvertUTF.h" //=========================================== void assign(Color3 &color, string str) { if (str.length() > 0) { if (str[0] != '(') { str = "(" + str + ")"; } Vector3 vec = Parser::to_vector(str); //scale down to 0-1 range color.r = vec.x / 255.f; color.g = vec.y / 255.f; color.b = vec.z / 255.f; } } //=========================================== void assign(Color4 &color, string str) { if (str.length() > 0) { if (str[0] != '(') { str = "(" + str + ")"; } Vector3 vec = Parser::to_vector(str); //scale down to 0-1 range color.r = vec.x / 255.f; color.g = vec.y / 255.f; color.b = vec.z / 255.f; } } //=========================================== Parser::~Parser() { } //=========================================== bool Parser::init(const std::string& filename) { TiXmlDocument* doc = new TiXmlDocument(); if (!G3D::fileExists(filename)) { string error = "Story File \"" + filename + "\" Was Not Found. Check the name and make sure it exists."; msgBox(error, "CaveWriting Error"); return false; } doc->SetCondenseWhiteSpace(false); // Get the document, and its root element if (!doc->LoadFile(filename)) { string error = "File \"" + filename + "\" is not a valid Story XML file"; msgBox(error, "CaveWriting Error"); return false; } the_root = doc->FirstChildElement("Story"); return true; } //=========================================== Vector3 Parser::to_vector(const string& str) { TextInput input(TextInput::FROM_STRING, str); Vector3 vec; vec.deserialize(input); return vec; } //=========================================== const TiXmlElement* Parser::get_element(const TiXmlElement* root, const string& name) { return root->FirstChildElement(name); } //=========================================== string Parser::get_element_value(const TiXmlElement* root, const string& name) { const TiXmlElement *elem = get_element(root, name); if (elem) { return string(elem->GetText()); } return string(); } //=========================================== wstring Parser::get_element_wstring_value(const TiXmlElement* root, const string& name) { static wchar_t buff[BUFF_SIZE]; memset(buff, 0, sizeof(buff)); std::string str = get_element_value(root, name); const char* srcp = str.c_str(); wchar_t* dstp = buff; if (sizeof(wchar_t) == 2) { ConvertUTF8toUTF16((const UTF8**)&srcp, (const UTF8*)&srcp[str.length()], (UTF16**)&dstp, (UTF16*)&buff[BUFF_SIZE], lenientConversion); } else if (sizeof(wchar_t) == 4) { ConvertUTF8toUTF32((const UTF8**)&srcp, (const UTF8*)&srcp[str.length()], (UTF32**)&dstp, (UTF32*)&buff[BUFF_SIZE], lenientConversion); } else { //ERROR! } return wstring(buff); //if (elem) { // const XMLCh* chars = elem->getTextContent(); // if (chars) { // if (!wchar_transcoder) { // string non_unicode(chars); // text.assign(non_unicode.begin(), non_unicode.end()); // } else { // unsigned int len = XMLString::stringLen(chars); // XMLSize_t eaten = 0; // wchar_transcoder->transcodeTo(chars, len, buff, BUFF_SIZE - sizeof(wchar_t), eaten, XMLTranscoder::UnRep_RepChar); // wchar_t *wide = (wchar_t*)buff; // wide[eaten] = NULL; // text = wide; // } // } //} //return text; } //=========================================== void Parser::get_elements(Array<const TiXmlNode*>& elems, const TiXmlElement* root, const string& name) { elems.clear(); if (!root) { return; } const TiXmlNode *child = root->FirstChild(); while (child) { if ((!name.length() || (name == child->ValueStr())) && (child->Type() == TiXmlNode::ELEMENT)) { elems.append(child); } child = child->NextSibling(); } } //=========================================== const TiXmlElement* Parser::get_first_element(const TiXmlNode* root) { const TiXmlNode *child = root->FirstChild(); if (!child) { return NULL; } if (child->Type() == TiXmlNode::ELEMENT) { return (const TiXmlElement*)child; } else { return get_sibling_element(child); } } //=========================================== const TiXmlElement* Parser::get_sibling_element(const TiXmlNode* curr) { const TiXmlNode *sib = NULL; if (!curr) { return NULL; } while (curr = curr->NextSibling()) { if (curr->Type() == TiXmlNode::ELEMENT) { return (const TiXmlElement*)curr; } } return NULL; } //=========================================== void Parser::get_box(const TiXmlElement* child, AABox& box, bool& is_inside) { Vector3 p1, p2; assign(p1, child->Attribute("corner1")); assign(p2, child->Attribute("corner2")); Vector3 bmin = p1.min(p2); Vector3 bmax = p1.max(p2); bool ignore_y; assign(ignore_y, child->Attribute("ignore-Y")); if (ignore_y) { bmin.y = -1000; bmax.y = 1000; } box.set(bmin, bmax); const TiXmlElement *inside_elem = Parser::get_element(child, "Movement"); const TiXmlElement *in_out = Parser::get_first_element(inside_elem); string inside = in_out->ValueStr(); is_inside = (inside == "Inside"); }
[ [ [ 1, 215 ] ] ]
110a53d7b49e4b55b05fd09f3e65a4d118179974
051ee8974ba920bf92c4456ce7fd92154068764f
/boolib/crypt/ShakedValue.h
96bb7d0f4e8e05d580efd4934d478ff751f618c8
[]
no_license
k06a/boolib
ab0f379ad9079434e91452d7287509b843dc2641
9b154e6d54b7e54b6fe847d53580ec61fd358c20
refs/heads/master
2016-09-06T18:25:02.912776
2010-12-26T19:11:21
2010-12-26T19:11:21
32,887,618
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
3,594
h
#ifndef SHAKEDVALUE_H #define SHAKEDVALUE_H #include <stdlib.h> namespace boolib { namespace crypt { template<class T> class ShakedValue { int itemCount; T ** items; public: // Конструкторы и деструкторы ShakedValue(const T & value = T(), int count = 2, int scrambler = 0) { init(value, count, scrambler); } ShakedValue(const ShakedValue<T> & value) { init(value.currentValue(), value.itemCount); } ~ShakedValue() { deinit(); } // Операторы ShakedValue<T> & operator = (const T newValue) { randomItem() += newValue - currentValue(); return *this; } operator const T () const { return currentValue(); } const ShakedValue<T> & operator + (const T value) { randomItem() += value; return *this; } const ShakedValue<T> & operator - (const T value) { randomItem() -= value; return *this; } const ShakedValue<T> & operator * (const T value) { return operator = (currentValue() * value); } const ShakedValue<T> & operator / (const T value) { return operator = (currentValue() / value); } ShakedValue<T> & operator += (const T value) { randomItem() += value; return *this; } ShakedValue<T> & operator -= (const T value) { randomItem() -= value; return *this; } ShakedValue<T> & operator *= (const T value) { return operator = (currentValue() * value); } ShakedValue<T> & operator /= (const T value) { return operator = (currentValue() / value); } const ShakedValue<T> & operator ++ (int a) { randomItem()++; return *this; } const ShakedValue<T> & operator -- (int a) { randomItem()--; return *this; } ShakedValue<T> & operator ++ () { ++randomItem(); return *this; } ShakedValue<T> & operator -- () { --randomItem(); return *this; } // Методы private: void init(T value = T(), int count = 2, int scrambler = 0) { this->itemCount = count; items = new T * [count]; char * buf = 0; for (int i = 0; i < count; i++) { if (scrambler) { delete [] buf; buf = new char [rand() % scrambler]; } items[i] = new T; } operator = (value); } void deinit() { for (int i = 0; i < itemCount; i++) delete items[i]; delete [] items; items = NULL; itemCount = 0; } const T currentValue() const { T summa = T(); for (int i = 0; i < itemCount; i++) summa += *items[i]; return summa; } T & randomItem() const { return *items[rand() % itemCount]; } }; } // namespace crypt } // namespace boolib #endif // SHAKEDVALUE_H
[ "k06a@localhost" ]
[ [ [ 1, 117 ] ] ]
6376449870b953f2f2ae3c79a1568416b297bb44
29e87c19d99b77d379b2f9760f5e7afb3b3790fa
/src/util/StrFormat.h
efbf3f0eb168613c9422eb3396d1b87604787cd5
[]
no_license
wilcobrouwer/dmplayer
c0c63d9b641a0f76e426ed30c3a83089166d0000
9f767a15e25016f6ada4eff6a1cdd881ad922915
refs/heads/master
2021-05-30T17:23:21.889844
2011-03-29T08:51:52
2011-03-29T08:51:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,066
h
#ifndef STR_FORMAT_H #define STR_FORMAT_H #include <string> #include <boost/format.hpp> /** * convenience wrapper for boost::format * * @param fmt format string * @param ... values to fill in * @return formatted std::string * * @see http://www.boost.org/libs/format/doc/format.html * for formatting info etc (its mostly compatible with printf, though) */ #define STRFORMAT(fmt, ...) \ ((StrFormat::detail::macro_str_format(fmt), ## __VA_ARGS__).str()) namespace StrFormat { namespace detail { // dont allow this class easily into normal namespace // it has dangerous overload for comma operator // so hide it in detail subnamespace class macro_str_format { private: boost::format bfmt; macro_str_format(); public: macro_str_format(const std::string & fmt) : bfmt(fmt) {}; template<typename T> macro_str_format& operator,(const T & v) { bfmt % v; return *this; } std::string str() { return bfmt.str(); } }; } } #endif//STR_FORMAT_H
[ "simon.sasburg@e69229e2-1541-0410-bedc-87cb2d1b0d4b" ]
[ [ [ 1, 44 ] ] ]
8b7b523c766e393ba9a540d8438f26191f5f07b9
b822313f0e48cf146b4ebc6e4548b9ad9da9a78e
/KylinSdk/Standard/Source/CSVFile.h
38177aef2a980dcb885f19f9df9dc7354d2f2ba2
[]
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
1,730
h
#pragma once namespace Kylin { class CSVFile { public: CSVFile(void); ~CSVFile(void); // open and load csv file KBOOL Open(KCCHAR* pFilePath); // get max row KINT GetRowCount(KVOID); // get max col KINT GetColCount(KVOID); // get KSTR KCCHAR* GetString(KINT nRow, KINT nCol, KCCHAR* defaultValue = ""); // get KSTR by Col name KCCHAR* GetString(KINT nRow, KCCHAR* pColName, KCCHAR* defaultValue = ""); // get KBOOL KBOOL GetBool(KINT nRow, KINT nCol, KBOOL defaultValue = false); // get KBOOL by Col name KBOOL GetBool(KINT nRow, KCCHAR* pColName, KBOOL defaultValue = false); // get KINT KINT GetInt(KINT nRow, KINT nCol, KINT defaultValue = 0); // get KINT by Col name KINT GetInt(KINT nRow, KCCHAR* pColName, KINT defaultValue = 0); // get KFLOAT KFLOAT GetFloat(KINT nRow, KINT nCol, KFLOAT defaultValue = 0.0); // get KFLOAT by Col name KFLOAT GetFloat(KINT nRow, KCCHAR* pColName, KFLOAT defaultValue = 0.0); // get the filename of the stream KCCHAR* GetFilename() const; // if has column KBOOL HasColumn(KCCHAR* pColName); // find col number by col name KINT FindColIndex(KCCHAR* pColName); private: // load csv file and save data to DataTable KBOOL Init(ifstream &file); // split KSTR and save to vector KINT SplitString(KCCHAR* sTemp, vector<KSTR>& vLineData); // judge row && line valid or not KBOOL IsRowLineValid(KINT nCol, KINT nRow); KSTR filename; // DataTable[i][j] indicate the data in row i and column j typedef std::vector< std::vector<KSTR> > DATATABLE; vector<KSTR> m_DataHeaderInfo; // the first line of the table DATATABLE m_DataTable; // data table }; }
[ [ [ 1, 56 ] ] ]
fe5cb1192411f62af881d3def81a3fe7ea0ee91c
fbc105604f9be63c18017a77bb6cb590eec00b3e
/ssdt-hook/vs2010-exe/protectTask/protectTask.h
7854514530400934d56626aab2b5844b8b3741c2
[]
no_license
340211173/windows-driver-sky
973e010c26a48fc0b51c98424bfa73474ebec132
ae26fe3792b07f989c8802e6b63e63b5437baa29
refs/heads/master
2021-01-24T01:42:28.356172
2011-08-28T15:22:10
2011-08-28T15:22:10
null
0
0
null
null
null
null
GB18030
C++
false
false
516
h
// protectTask.h : PROJECT_NAME 应用程序的主头文件 // #pragma once #ifndef __AFXWIN_H__ #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件" #endif #include "resource.h" // 主符号 // CprotectTaskApp: // 有关此类的实现,请参阅 protectTask.cpp // class CprotectTaskApp : public CWinApp { public: CprotectTaskApp(); // 重写 public: virtual BOOL InitInstance(); // 实现 DECLARE_MESSAGE_MAP() }; extern CprotectTaskApp theApp;
[ "[email protected]@3a3cd65c-1fc1-b21e-901d-6b6205d3bd68" ]
[ [ [ 1, 32 ] ] ]
017678260469ca1e94dedf1173312964705f47cc
de0881d85df3a3a01924510134feba2fbff5b7c3
/apps/moreExamples/contourAnalysisExample/src/testApp.cpp
bfccf1fa7d1ec84e1f4e4ab5ebca707a3b111f9d
[]
no_license
peterkrenn/ofx-dev
6091def69a1148c05354e55636887d11e29d6073
e08e08a06be6ea080ecd252bc89c1662cf3e37f0
refs/heads/master
2021-01-21T00:32:49.065810
2009-06-26T19:13:29
2009-06-26T19:13:29
146,543
1
1
null
null
null
null
UTF-8
C++
false
false
2,311
cpp
#include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){ ofBackground(0,0,0); image.loadImage(ofToDataPath("images/board_0.jpg")); w = image.width; h = image.height; imageAsGray.allocate(w,h); mouseX = 0; mouseY = 0; imageAsGray.setFromPixels( image.getPixels(), w, h); imageAsGray.threshold(100); imageAsGray.invert(); int minArea = 20; int maxArea = w*h*.5; int nConsidered = 30; bool bFindHoles = false; bool bUseApproximation = false; contourFinder.findContours(imageAsGray,minArea,maxArea,nConsidered, bFindHoles,bUseApproximation); } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ofEnableAlphaBlending(); ofSetColor(0xffffff); image.draw(0,0); ofSetColor(0x8aff00); ofNoFill(); glLineWidth(2.0); for( int i = 0; i < contourFinder.nBlobs; i++) { findLines(contourFinder.blobs[i].pts,lines,30,40,30); for( int j = 0; j < lines.size(); j++) { ofLine(lines[j].x,lines[j].y,lines[j].z,lines[j].w); ofCircle(lines[j].x,lines[j].y,3); ofCircle(lines[j].z,lines[j].w,3); } } ofSetColor(0xffffff); ofDrawBitmapString( ofToString( ofGetFrameRate(),2), 40, 460); } //-------------------------------------------------------------- void testApp::keyPressed (int key){ switch( key ) { default: break; } } //-------------------------------------------------------------- void testApp::keyReleased (int key){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ) { mouseX = x; mouseY = y; } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mouseReleased(){ }
[ [ [ 1, 117 ] ] ]
659d53230d289d8bbbfca0375e9abc3cc3e16f8e
9566086d262936000a914c5dc31cb4e8aa8c461c
/EnigmaAudio/IAudioEncoder.hpp
1fa1710ce69e54ec4e14316d82ec50e3e51408b2
[]
no_license
pazuzu156/Enigma
9a0aaf0cd426607bb981eb46f5baa7f05b66c21f
b8a4dfbd0df206e48072259dbbfcc85845caad76
refs/heads/master
2020-06-06T07:33:46.385396
2011-12-19T03:14:15
2011-12-19T03:14:15
3,023,618
1
0
null
null
null
null
WINDOWS-1252
C++
false
false
1,331
hpp
#ifndef IAUDIOENCODER_HPP_INCLUDED #define IAUDIOENCODER_HPP_INCLUDED /* Copyright © 2011 Christopher Joseph Dean Schaefer (disks86) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "string.hpp" #include "TypeDefs.hpp" namespace Enigma { class DllExport IAudioEncoder { private: protected: public: virtual ~IAudioEncoder(){}; virtual Enigma::u8* Encode(Enigma::u8* inputBuffer,size_t inputSize, size_t& outputSize)=0; }; }; #endif // IAUDIOENCODER_HPP_INCLUDED
[ [ [ 1, 36 ] ] ]
d0f3e3e77f72dd5c66e0cc95ba57996b6c2f00bc
ee2e06bda0a5a2c70a0b9bebdd4c45846f440208
/word/CppUTest/src/Platforms/Gcc/GccMemoryLeakWarning.cpp
3f2d550c28be851fbf35be363e4a9ecaa8763d0a
[]
no_license
RobinLiu/Test
0f53a376e6753ece70ba038573450f9c0fb053e5
360eca350691edd17744a2ea1b16c79e1a9ad117
refs/heads/master
2021-01-01T19:46:55.684640
2011-07-06T13:53:07
2011-07-06T13:53:07
1,617,721
2
0
null
null
null
null
UTF-8
C++
false
false
6,742
cpp
/* * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde * 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 the <organization> 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 EARLIER MENTIONED AUTHORS ``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 <copyright holder> 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 "CppUTest/MemoryLeakWarning.h" #include <stdlib.h> #include <stdio.h> /* Static since we REALLY can have only one of these! */ static int allocatedBlocks = 0; static int allocatedArrays = 0; static int firstInitialBlocks = 0; static int firstInitialArrays = 0; static bool reporterRegistered = false; class MemoryLeakWarningData { public: MemoryLeakWarningData(); int initialBlocksUsed; int initialArraysUsed; int blockUsageCheckPoint; int arrayUsageCheckPoint; int expectCount; char message[100]; }; void MemoryLeakWarning::CreateData() { _impl = (MemoryLeakWarningData*) malloc(sizeof(MemoryLeakWarningData)); _impl->initialBlocksUsed = 0; _impl->initialArraysUsed = 0; _impl->blockUsageCheckPoint = 0; _impl->arrayUsageCheckPoint = 0; _impl->expectCount = 0; _impl->message[0] = '\0'; } void MemoryLeakWarning::DestroyData() { free(_impl); } extern "C" { void reportMemoryBallance(); } void reportMemoryBallance() { int blockBalance = allocatedBlocks - firstInitialBlocks; int arrayBalance = allocatedArrays - firstInitialArrays; if (blockBalance == 0 && arrayBalance == 0) ; else if (blockBalance + arrayBalance == 0) printf("No leaks but some arrays were deleted without []\n"); else { if (blockBalance > 0) printf("Memory leak! %d blocks not deleted\n", blockBalance); if (arrayBalance > 0) printf("Memory leak! %d arrays not deleted\n", arrayBalance); if (blockBalance < 0) printf("More blocks deleted than newed! %d extra deletes\n", blockBalance); if (arrayBalance < 0) printf("More arrays deleted than newed! %d extra deletes\n", arrayBalance); printf("NOTE - some memory leaks appear to be allocated statics that are not released\n" " - by the standard library\n" " - Use the -r switch on your unit tests to repeat the test sequence\n" " - If no leaks are reported on the second pass, it is likely a static\n" " - that is not released\n"); } } MemoryLeakWarning* MemoryLeakWarning::_latest = NULL; MemoryLeakWarning::MemoryLeakWarning() { _latest = this; CreateData(); } MemoryLeakWarning::~MemoryLeakWarning() { DestroyData(); } MemoryLeakWarning* MemoryLeakWarning::GetLatest() { return _latest; } void MemoryLeakWarning::SetLatest(MemoryLeakWarning* latest) { _latest = latest; } void MemoryLeakWarning::Enable() { _impl->initialBlocksUsed = allocatedBlocks; _impl->initialArraysUsed = allocatedArrays; if (!reporterRegistered) { firstInitialBlocks = allocatedBlocks; firstInitialArrays = allocatedArrays; reporterRegistered = true; } } const char* MemoryLeakWarning::FinalReport(int toBeDeletedLeaks) { if (_impl->initialBlocksUsed != (allocatedBlocks-toBeDeletedLeaks) || _impl->initialArraysUsed != allocatedArrays ) { printf("initial blocks=%d, allocated blocks=%d\ninitial arrays=%d, allocated arrays=%d\n", _impl->initialBlocksUsed, allocatedBlocks, _impl->initialArraysUsed, allocatedArrays); return "Memory new/delete imbalance after running tests\n"; } else return ""; } void MemoryLeakWarning::CheckPointUsage() { _impl->blockUsageCheckPoint = allocatedBlocks; _impl->arrayUsageCheckPoint = allocatedArrays; } bool MemoryLeakWarning::UsageIsNotBalanced() { int arrayBalance = allocatedArrays - _impl->arrayUsageCheckPoint; int blockBalance = allocatedBlocks - _impl->blockUsageCheckPoint; if (_impl->expectCount != 0 && blockBalance + arrayBalance == _impl->expectCount) return false; if (blockBalance == 0 && arrayBalance == 0) return false; else if (blockBalance + arrayBalance == 0) sprintf(_impl->message, "No leaks but some arrays were deleted without []\n"); else { int nchars = 0; if (_impl->blockUsageCheckPoint != allocatedBlocks) nchars = sprintf(_impl->message, "this test leaks %d blocks", allocatedBlocks - _impl->blockUsageCheckPoint); if (_impl->arrayUsageCheckPoint != allocatedArrays) sprintf(_impl->message + nchars, "this test leaks %d arrays", allocatedArrays - _impl->arrayUsageCheckPoint); } return true; } const char* MemoryLeakWarning::Message() { return _impl->message; } void MemoryLeakWarning::ExpectLeaks(int n) { _impl->expectCount = n; } /* Global overloaded operators */ void* operator new(size_t size) { allocatedBlocks++; return malloc(size); } void operator delete(void* mem) { if(mem == NULL) return; allocatedBlocks--; free(mem); } void* operator new[](size_t size) { allocatedArrays++; return malloc(size); } void operator delete[](void* mem) { if(mem == NULL) return; allocatedArrays--; free(mem); } void* operator new(size_t size, const char* file, int line) { allocatedBlocks++; return malloc(size); }
[ "RobinofChina@43938a50-64aa-11de-9867-89bd1bae666e" ]
[ [ [ 1, 229 ] ] ]
80885c880e815f09e36941dbfacffe3cbb1241ca
67346d8d188dbf2a958520a7e80637481d15e676
/source/GameStateCredits.cpp
a2ca736ca9b116151bc80cc68876be082a6f34a7
[]
no_license
Alrin77/ndsgameengine
1a137621eb1b32849c179cd7f8c719c600b1a1f6
7afbb847273074ba0f7d3050322d7183c2b2c212
refs/heads/master
2016-09-03T07:30:11.105686
2010-12-04T22:05:16
2010-12-04T22:05:16
33,461,675
0
0
null
null
null
null
UTF-8
C++
false
false
354
cpp
#include "GameStateCredits.h" GameStateCredits::GameStateCredits(){ } GameStateCredits::~GameStateCredits(){ } void GameStateCredits::Initialize(){ } void GameStateCredits::Update(){ } void GameStateCredits::Draw(){ } void GameStateCredits::Cleanup(){ } void GameStateCredits::Pause(){ } void GameStateCredits::Resume(){ }
[ "[email protected]@21144042-5242-e64c-d35b-eb64d47aa59c" ]
[ [ [ 1, 25 ] ] ]
748a8dffd0e39eeec836577264361f3cb1dacf66
f2cc5cef5b0375083b98a13cd28edcee19e55e70
/src/SharedData/SharedData.cpp
0004bec0490c781f924b6648d21c7a87d2eaf592
[]
no_license
romanio/mpsqt
6153b598d6c17e0127a2e8130036bf7bb9e7aa26
7dbeb33cf92f7db46763ec94fc008f6e7635dac1
refs/heads/master
2021-01-20T10:11:07.723341
2010-07-14T20:36:21
2010-07-14T20:36:21
32,221,641
0
0
null
null
null
null
UTF-8
C++
false
false
1,510
cpp
#include "SharedData.h" SharedData::SharedData() { isAllocated = false; } SharedData::~SharedData() { ClearArrays(); } SharedData* SharedData::Instance() { if (!self) self = new SharedData(); refcount++; return self; } void SharedData::FreeInst() { refcount--; if (!refcount) { delete this; self = 0; } } void SharedData::InitArrays() { ClearArrays(); opt = new float[wellCount * daysCount]; gwfr = new float[groupCount * wellCount]; gpt = new float[wellCount * daysCount]; wpt = new float[wellCount * daysCount]; wit = new float[wellCount * daysCount]; opr = new float[wellCount * daysCount]; wpr = new float[wellCount * daysCount]; gpr = new float[wellCount * daysCount]; wir = new float[wellCount * daysCount]; xloc = new float[wellCount]; yloc = new float[wellCount]; qdata = new float[quantCount * daysCount]; isAllocated = true; } void SharedData::ClearArrays() { wellNames.clear(); groupNames.clear(); aquiferNames.clear(); quantMnemonic.clear(); quantUnits.clear(); quantAssociated.clear(); quantDescription.clear(); if (isAllocated) { delete[] opt; delete[] gwfr; delete[] gpt; delete[] wpt; delete[] wit; delete[] opr; delete[] wpr; delete[] gpr; delete[] wir; delete[] xloc; delete[] yloc; delete[] qdata; } } void SharedData::finishDataLoading() { emit dataUpdate(); } SharedData* SharedData::self = 0; int SharedData::refcount = 0;
[ "rkositsyn@95aae30a-fe7a-11de-b8ab-b3eb4b1fa784" ]
[ [ [ 1, 82 ] ] ]
5abe452744d37dcfd9dc7418372ab6ec17fe29f0
2ae633d4e9794f8be42c3945071812d944d32146
/Bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp
f7d5d00cb166ddb758afd9b6825864b556d518a4
[ "Zlib" ]
permissive
mmmovania/bullet-physics-viewer
fa27134e84ed1896dbc49b5bee1538703ec94647
962f6b6fd74317ce8f9edd26c7772c57a5cae12c
refs/heads/master
2021-01-01T16:55:10.600797
2011-10-28T03:26:04
2011-10-28T03:26:04
32,207,656
1
0
null
null
null
null
UTF-8
C++
false
false
52,120
cpp
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ //#define COMPUTE_IMPULSE_DENOM 1 //It is not necessary (redundant) to refresh contact manifolds, this refresh has been moved to the collision algorithms. #include "btSequentialImpulseConstraintSolver.h" #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" #include "BulletDynamics/Dynamics/btRigidBody.h" #include "btContactConstraint.h" #include "btSolve2LinearConstraint.h" #include "btContactSolverInfo.h" #include "LinearMath/btIDebugDraw.h" #include "btJacobianEntry.h" #include "LinearMath/btMinMax.h" #include "BulletDynamics/ConstraintSolver/btTypedConstraint.h" #include <new> #include "LinearMath/btStackAlloc.h" #include "LinearMath/btQuickprof.h" #include "btSolverBody.h" #include "btSolverConstraint.h" #include "LinearMath/btAlignedObjectArray.h" #include <string.h> //for memset int gNumSplitImpulseRecoveries = 0; btSequentialImpulseConstraintSolver::btSequentialImpulseConstraintSolver() :m_btSeed2(0) { } btSequentialImpulseConstraintSolver::~btSequentialImpulseConstraintSolver() { } #ifdef USE_SIMD #include <emmintrin.h> #define btVecSplat(x, e) _mm_shuffle_ps(x, x, _MM_SHUFFLE(e,e,e,e)) static inline __m128 btSimdDot3( __m128 vec0, __m128 vec1 ) { __m128 result = _mm_mul_ps( vec0, vec1); return _mm_add_ps( btVecSplat( result, 0 ), _mm_add_ps( btVecSplat( result, 1 ), btVecSplat( result, 2 ) ) ); } #endif//USE_SIMD // Project Gauss Seidel or the equivalent Sequential Impulse void btSequentialImpulseConstraintSolver::resolveSingleConstraintRowGenericSIMD(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& c) { #ifdef USE_SIMD __m128 cpAppliedImp = _mm_set1_ps(c.m_appliedImpulse); __m128 lowerLimit1 = _mm_set1_ps(c.m_lowerLimit); __m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit); __m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhs), _mm_mul_ps(_mm_set1_ps(c.m_appliedImpulse),_mm_set1_ps(c.m_cfm))); __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128)); __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128)); deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv))); deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv))); btSimdScalar sum = _mm_add_ps(cpAppliedImp,deltaImpulse); btSimdScalar resultLowerLess,resultUpperLess; resultLowerLess = _mm_cmplt_ps(sum,lowerLimit1); resultUpperLess = _mm_cmplt_ps(sum,upperLimit1); __m128 lowMinApplied = _mm_sub_ps(lowerLimit1,cpAppliedImp); deltaImpulse = _mm_or_ps( _mm_and_ps(resultLowerLess, lowMinApplied), _mm_andnot_ps(resultLowerLess, deltaImpulse) ); c.m_appliedImpulse = _mm_or_ps( _mm_and_ps(resultLowerLess, lowerLimit1), _mm_andnot_ps(resultLowerLess, sum) ); __m128 upperMinApplied = _mm_sub_ps(upperLimit1,cpAppliedImp); deltaImpulse = _mm_or_ps( _mm_and_ps(resultUpperLess, deltaImpulse), _mm_andnot_ps(resultUpperLess, upperMinApplied) ); c.m_appliedImpulse = _mm_or_ps( _mm_and_ps(resultUpperLess, c.m_appliedImpulse), _mm_andnot_ps(resultUpperLess, upperLimit1) ); __m128 linearComponentA = _mm_mul_ps(c.m_contactNormal.mVec128,body1.internalGetInvMass().mVec128); __m128 linearComponentB = _mm_mul_ps((c.m_contactNormal).mVec128,body2.internalGetInvMass().mVec128); __m128 impulseMagnitude = deltaImpulse; body1.internalGetDeltaLinearVelocity().mVec128 = _mm_add_ps(body1.internalGetDeltaLinearVelocity().mVec128,_mm_mul_ps(linearComponentA,impulseMagnitude)); body1.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(body1.internalGetDeltaAngularVelocity().mVec128 ,_mm_mul_ps(c.m_angularComponentA.mVec128,impulseMagnitude)); body2.internalGetDeltaLinearVelocity().mVec128 = _mm_sub_ps(body2.internalGetDeltaLinearVelocity().mVec128,_mm_mul_ps(linearComponentB,impulseMagnitude)); body2.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(body2.internalGetDeltaAngularVelocity().mVec128 ,_mm_mul_ps(c.m_angularComponentB.mVec128,impulseMagnitude)); #else resolveSingleConstraintRowGeneric(body1,body2,c); #endif } // Project Gauss Seidel or the equivalent Sequential Impulse void btSequentialImpulseConstraintSolver::resolveSingleConstraintRowGeneric(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& c) { btScalar deltaImpulse = c.m_rhs-btScalar(c.m_appliedImpulse)*c.m_cfm; const btScalar deltaVel1Dotn = c.m_contactNormal.dot(body1.internalGetDeltaLinearVelocity()) + c.m_relpos1CrossNormal.dot(body1.internalGetDeltaAngularVelocity()); const btScalar deltaVel2Dotn = -c.m_contactNormal.dot(body2.internalGetDeltaLinearVelocity()) + c.m_relpos2CrossNormal.dot(body2.internalGetDeltaAngularVelocity()); // const btScalar delta_rel_vel = deltaVel1Dotn-deltaVel2Dotn; deltaImpulse -= deltaVel1Dotn*c.m_jacDiagABInv; deltaImpulse -= deltaVel2Dotn*c.m_jacDiagABInv; const btScalar sum = btScalar(c.m_appliedImpulse) + deltaImpulse; if (sum < c.m_lowerLimit) { deltaImpulse = c.m_lowerLimit-c.m_appliedImpulse; c.m_appliedImpulse = c.m_lowerLimit; } else if (sum > c.m_upperLimit) { deltaImpulse = c.m_upperLimit-c.m_appliedImpulse; c.m_appliedImpulse = c.m_upperLimit; } else { c.m_appliedImpulse = sum; } body1.internalApplyImpulse(c.m_contactNormal*body1.internalGetInvMass(),c.m_angularComponentA,deltaImpulse); body2.internalApplyImpulse(-c.m_contactNormal*body2.internalGetInvMass(),c.m_angularComponentB,deltaImpulse); } void btSequentialImpulseConstraintSolver::resolveSingleConstraintRowLowerLimitSIMD(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& c) { #ifdef USE_SIMD __m128 cpAppliedImp = _mm_set1_ps(c.m_appliedImpulse); __m128 lowerLimit1 = _mm_set1_ps(c.m_lowerLimit); __m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit); __m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhs), _mm_mul_ps(_mm_set1_ps(c.m_appliedImpulse),_mm_set1_ps(c.m_cfm))); __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128)); __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128)); deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv))); deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv))); btSimdScalar sum = _mm_add_ps(cpAppliedImp,deltaImpulse); btSimdScalar resultLowerLess,resultUpperLess; resultLowerLess = _mm_cmplt_ps(sum,lowerLimit1); resultUpperLess = _mm_cmplt_ps(sum,upperLimit1); __m128 lowMinApplied = _mm_sub_ps(lowerLimit1,cpAppliedImp); deltaImpulse = _mm_or_ps( _mm_and_ps(resultLowerLess, lowMinApplied), _mm_andnot_ps(resultLowerLess, deltaImpulse) ); c.m_appliedImpulse = _mm_or_ps( _mm_and_ps(resultLowerLess, lowerLimit1), _mm_andnot_ps(resultLowerLess, sum) ); __m128 linearComponentA = _mm_mul_ps(c.m_contactNormal.mVec128,body1.internalGetInvMass().mVec128); __m128 linearComponentB = _mm_mul_ps((c.m_contactNormal).mVec128,body2.internalGetInvMass().mVec128); __m128 impulseMagnitude = deltaImpulse; body1.internalGetDeltaLinearVelocity().mVec128 = _mm_add_ps(body1.internalGetDeltaLinearVelocity().mVec128,_mm_mul_ps(linearComponentA,impulseMagnitude)); body1.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(body1.internalGetDeltaAngularVelocity().mVec128 ,_mm_mul_ps(c.m_angularComponentA.mVec128,impulseMagnitude)); body2.internalGetDeltaLinearVelocity().mVec128 = _mm_sub_ps(body2.internalGetDeltaLinearVelocity().mVec128,_mm_mul_ps(linearComponentB,impulseMagnitude)); body2.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(body2.internalGetDeltaAngularVelocity().mVec128 ,_mm_mul_ps(c.m_angularComponentB.mVec128,impulseMagnitude)); #else resolveSingleConstraintRowLowerLimit(body1,body2,c); #endif } // Project Gauss Seidel or the equivalent Sequential Impulse void btSequentialImpulseConstraintSolver::resolveSingleConstraintRowLowerLimit(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& c) { btScalar deltaImpulse = c.m_rhs-btScalar(c.m_appliedImpulse)*c.m_cfm; const btScalar deltaVel1Dotn = c.m_contactNormal.dot(body1.internalGetDeltaLinearVelocity()) + c.m_relpos1CrossNormal.dot(body1.internalGetDeltaAngularVelocity()); const btScalar deltaVel2Dotn = -c.m_contactNormal.dot(body2.internalGetDeltaLinearVelocity()) + c.m_relpos2CrossNormal.dot(body2.internalGetDeltaAngularVelocity()); deltaImpulse -= deltaVel1Dotn*c.m_jacDiagABInv; deltaImpulse -= deltaVel2Dotn*c.m_jacDiagABInv; const btScalar sum = btScalar(c.m_appliedImpulse) + deltaImpulse; if (sum < c.m_lowerLimit) { deltaImpulse = c.m_lowerLimit-c.m_appliedImpulse; c.m_appliedImpulse = c.m_lowerLimit; } else { c.m_appliedImpulse = sum; } body1.internalApplyImpulse(c.m_contactNormal*body1.internalGetInvMass(),c.m_angularComponentA,deltaImpulse); body2.internalApplyImpulse(-c.m_contactNormal*body2.internalGetInvMass(),c.m_angularComponentB,deltaImpulse); } void btSequentialImpulseConstraintSolver::resolveSplitPenetrationImpulseCacheFriendly( btRigidBody& body1, btRigidBody& body2, const btSolverConstraint& c) { if (c.m_rhsPenetration) { gNumSplitImpulseRecoveries++; btScalar deltaImpulse = c.m_rhsPenetration-btScalar(c.m_appliedPushImpulse)*c.m_cfm; const btScalar deltaVel1Dotn = c.m_contactNormal.dot(body1.internalGetPushVelocity()) + c.m_relpos1CrossNormal.dot(body1.internalGetTurnVelocity()); const btScalar deltaVel2Dotn = -c.m_contactNormal.dot(body2.internalGetPushVelocity()) + c.m_relpos2CrossNormal.dot(body2.internalGetTurnVelocity()); deltaImpulse -= deltaVel1Dotn*c.m_jacDiagABInv; deltaImpulse -= deltaVel2Dotn*c.m_jacDiagABInv; const btScalar sum = btScalar(c.m_appliedPushImpulse) + deltaImpulse; if (sum < c.m_lowerLimit) { deltaImpulse = c.m_lowerLimit-c.m_appliedPushImpulse; c.m_appliedPushImpulse = c.m_lowerLimit; } else { c.m_appliedPushImpulse = sum; } body1.internalApplyPushImpulse(c.m_contactNormal*body1.internalGetInvMass(),c.m_angularComponentA,deltaImpulse); body2.internalApplyPushImpulse(-c.m_contactNormal*body2.internalGetInvMass(),c.m_angularComponentB,deltaImpulse); } } void btSequentialImpulseConstraintSolver::resolveSplitPenetrationSIMD(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& c) { #ifdef USE_SIMD if (!c.m_rhsPenetration) return; gNumSplitImpulseRecoveries++; __m128 cpAppliedImp = _mm_set1_ps(c.m_appliedPushImpulse); __m128 lowerLimit1 = _mm_set1_ps(c.m_lowerLimit); __m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit); __m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhsPenetration), _mm_mul_ps(_mm_set1_ps(c.m_appliedPushImpulse),_mm_set1_ps(c.m_cfm))); __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetPushVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetTurnVelocity().mVec128)); __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetTurnVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetPushVelocity().mVec128)); deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv))); deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv))); btSimdScalar sum = _mm_add_ps(cpAppliedImp,deltaImpulse); btSimdScalar resultLowerLess,resultUpperLess; resultLowerLess = _mm_cmplt_ps(sum,lowerLimit1); resultUpperLess = _mm_cmplt_ps(sum,upperLimit1); __m128 lowMinApplied = _mm_sub_ps(lowerLimit1,cpAppliedImp); deltaImpulse = _mm_or_ps( _mm_and_ps(resultLowerLess, lowMinApplied), _mm_andnot_ps(resultLowerLess, deltaImpulse) ); c.m_appliedPushImpulse = _mm_or_ps( _mm_and_ps(resultLowerLess, lowerLimit1), _mm_andnot_ps(resultLowerLess, sum) ); __m128 linearComponentA = _mm_mul_ps(c.m_contactNormal.mVec128,body1.internalGetInvMass().mVec128); __m128 linearComponentB = _mm_mul_ps((c.m_contactNormal).mVec128,body2.internalGetInvMass().mVec128); __m128 impulseMagnitude = deltaImpulse; body1.internalGetPushVelocity().mVec128 = _mm_add_ps(body1.internalGetPushVelocity().mVec128,_mm_mul_ps(linearComponentA,impulseMagnitude)); body1.internalGetTurnVelocity().mVec128 = _mm_add_ps(body1.internalGetTurnVelocity().mVec128 ,_mm_mul_ps(c.m_angularComponentA.mVec128,impulseMagnitude)); body2.internalGetPushVelocity().mVec128 = _mm_sub_ps(body2.internalGetPushVelocity().mVec128,_mm_mul_ps(linearComponentB,impulseMagnitude)); body2.internalGetTurnVelocity().mVec128 = _mm_add_ps(body2.internalGetTurnVelocity().mVec128 ,_mm_mul_ps(c.m_angularComponentB.mVec128,impulseMagnitude)); #else resolveSplitPenetrationImpulseCacheFriendly(body1,body2,c); #endif } unsigned long btSequentialImpulseConstraintSolver::btRand2() { m_btSeed2 = (1664525L*m_btSeed2 + 1013904223L) & 0xffffffff; return m_btSeed2; } //See ODE: adam's all-int straightforward(?) dRandInt (0..n-1) int btSequentialImpulseConstraintSolver::btRandInt2 (int n) { // seems good; xor-fold and modulus const unsigned long un = static_cast<unsigned long>(n); unsigned long r = btRand2(); // note: probably more aggressive than it needs to be -- might be // able to get away without one or two of the innermost branches. if (un <= 0x00010000UL) { r ^= (r >> 16); if (un <= 0x00000100UL) { r ^= (r >> 8); if (un <= 0x00000010UL) { r ^= (r >> 4); if (un <= 0x00000004UL) { r ^= (r >> 2); if (un <= 0x00000002UL) { r ^= (r >> 1); } } } } } return (int) (r % un); } #if 0 void btSequentialImpulseConstraintSolver::initSolverBody(btSolverBody* solverBody, btCollisionObject* collisionObject) { btRigidBody* rb = collisionObject? btRigidBody::upcast(collisionObject) : 0; solverBody->internalGetDeltaLinearVelocity().setValue(0.f,0.f,0.f); solverBody->internalGetDeltaAngularVelocity().setValue(0.f,0.f,0.f); solverBody->internalGetPushVelocity().setValue(0.f,0.f,0.f); solverBody->internalGetTurnVelocity().setValue(0.f,0.f,0.f); if (rb) { solverBody->internalGetInvMass() = btVector3(rb->getInvMass(),rb->getInvMass(),rb->getInvMass())*rb->getLinearFactor(); solverBody->m_originalBody = rb; solverBody->m_angularFactor = rb->getAngularFactor(); } else { solverBody->internalGetInvMass().setValue(0,0,0); solverBody->m_originalBody = 0; solverBody->m_angularFactor.setValue(1,1,1); } } #endif btScalar btSequentialImpulseConstraintSolver::restitutionCurve(btScalar rel_vel, btScalar restitution) { btScalar rest = restitution * -rel_vel; return rest; } void applyAnisotropicFriction(btCollisionObject* colObj,btVector3& frictionDirection); void applyAnisotropicFriction(btCollisionObject* colObj,btVector3& frictionDirection) { if (colObj && colObj->hasAnisotropicFriction()) { // transform to local coordinates btVector3 loc_lateral = frictionDirection * colObj->getWorldTransform().getBasis(); const btVector3& friction_scaling = colObj->getAnisotropicFriction(); //apply anisotropic friction loc_lateral *= friction_scaling; // ... and transform it back to global coordinates frictionDirection = colObj->getWorldTransform().getBasis() * loc_lateral; } } void btSequentialImpulseConstraintSolver::setupFrictionConstraint(btSolverConstraint& solverConstraint, const btVector3& normalAxis,btRigidBody* solverBodyA,btRigidBody* solverBodyB,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity, btScalar cfmSlip) { btRigidBody* body0=btRigidBody::upcast(colObj0); btRigidBody* body1=btRigidBody::upcast(colObj1); solverConstraint.m_contactNormal = normalAxis; solverConstraint.m_solverBodyA = body0 ? body0 : &getFixedBody(); solverConstraint.m_solverBodyB = body1 ? body1 : &getFixedBody(); solverConstraint.m_friction = cp.m_combinedFriction; solverConstraint.m_originalContactPoint = 0; solverConstraint.m_appliedImpulse = 0.f; solverConstraint.m_appliedPushImpulse = 0.f; { btVector3 ftorqueAxis1 = rel_pos1.cross(solverConstraint.m_contactNormal); solverConstraint.m_relpos1CrossNormal = ftorqueAxis1; solverConstraint.m_angularComponentA = body0 ? body0->getInvInertiaTensorWorld()*ftorqueAxis1*body0->getAngularFactor() : btVector3(0,0,0); } { btVector3 ftorqueAxis1 = rel_pos2.cross(-solverConstraint.m_contactNormal); solverConstraint.m_relpos2CrossNormal = ftorqueAxis1; solverConstraint.m_angularComponentB = body1 ? body1->getInvInertiaTensorWorld()*ftorqueAxis1*body1->getAngularFactor() : btVector3(0,0,0); } #ifdef COMPUTE_IMPULSE_DENOM btScalar denom0 = rb0->computeImpulseDenominator(pos1,solverConstraint.m_contactNormal); btScalar denom1 = rb1->computeImpulseDenominator(pos2,solverConstraint.m_contactNormal); #else btVector3 vec; btScalar denom0 = 0.f; btScalar denom1 = 0.f; if (body0) { vec = ( solverConstraint.m_angularComponentA).cross(rel_pos1); denom0 = body0->getInvMass() + normalAxis.dot(vec); } if (body1) { vec = ( -solverConstraint.m_angularComponentB).cross(rel_pos2); denom1 = body1->getInvMass() + normalAxis.dot(vec); } #endif //COMPUTE_IMPULSE_DENOM btScalar denom = relaxation/(denom0+denom1); solverConstraint.m_jacDiagABInv = denom; #ifdef _USE_JACOBIAN solverConstraint.m_jac = btJacobianEntry ( rel_pos1,rel_pos2,solverConstraint.m_contactNormal, body0->getInvInertiaDiagLocal(), body0->getInvMass(), body1->getInvInertiaDiagLocal(), body1->getInvMass()); #endif //_USE_JACOBIAN { btScalar rel_vel; btScalar vel1Dotn = solverConstraint.m_contactNormal.dot(body0?body0->getLinearVelocity():btVector3(0,0,0)) + solverConstraint.m_relpos1CrossNormal.dot(body0?body0->getAngularVelocity():btVector3(0,0,0)); btScalar vel2Dotn = -solverConstraint.m_contactNormal.dot(body1?body1->getLinearVelocity():btVector3(0,0,0)) + solverConstraint.m_relpos2CrossNormal.dot(body1?body1->getAngularVelocity():btVector3(0,0,0)); rel_vel = vel1Dotn+vel2Dotn; // btScalar positionalError = 0.f; btSimdScalar velocityError = desiredVelocity - rel_vel; btSimdScalar velocityImpulse = velocityError * btSimdScalar(solverConstraint.m_jacDiagABInv); solverConstraint.m_rhs = velocityImpulse; solverConstraint.m_cfm = cfmSlip; solverConstraint.m_lowerLimit = 0; solverConstraint.m_upperLimit = 1e10f; } } btSolverConstraint& btSequentialImpulseConstraintSolver::addFrictionConstraint(const btVector3& normalAxis,btRigidBody* solverBodyA,btRigidBody* solverBodyB,int frictionIndex,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity, btScalar cfmSlip) { btSolverConstraint& solverConstraint = m_tmpSolverContactFrictionConstraintPool.expandNonInitializing(); solverConstraint.m_frictionIndex = frictionIndex; setupFrictionConstraint(solverConstraint, normalAxis, solverBodyA, solverBodyB, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation, desiredVelocity, cfmSlip); return solverConstraint; } int btSequentialImpulseConstraintSolver::getOrInitSolverBody(btCollisionObject& body) { #if 0 int solverBodyIdA = -1; if (body.getCompanionId() >= 0) { //body has already been converted solverBodyIdA = body.getCompanionId(); } else { btRigidBody* rb = btRigidBody::upcast(&body); if (rb && rb->getInvMass()) { solverBodyIdA = m_tmpSolverBodyPool.size(); btSolverBody& solverBody = m_tmpSolverBodyPool.expand(); initSolverBody(&solverBody,&body); body.setCompanionId(solverBodyIdA); } else { return 0;//assume first one is a fixed solver body } } return solverBodyIdA; #endif return 0; } #include <stdio.h> void btSequentialImpulseConstraintSolver::setupContactConstraint(btSolverConstraint& solverConstraint, btCollisionObject* colObj0, btCollisionObject* colObj1, btManifoldPoint& cp, const btContactSolverInfo& infoGlobal, btVector3& vel, btScalar& rel_vel, btScalar& relaxation, btVector3& rel_pos1, btVector3& rel_pos2) { btRigidBody* rb0 = btRigidBody::upcast(colObj0); btRigidBody* rb1 = btRigidBody::upcast(colObj1); const btVector3& pos1 = cp.getPositionWorldOnA(); const btVector3& pos2 = cp.getPositionWorldOnB(); // btVector3 rel_pos1 = pos1 - colObj0->getWorldTransform().getOrigin(); // btVector3 rel_pos2 = pos2 - colObj1->getWorldTransform().getOrigin(); rel_pos1 = pos1 - colObj0->getWorldTransform().getOrigin(); rel_pos2 = pos2 - colObj1->getWorldTransform().getOrigin(); relaxation = 1.f; btVector3 torqueAxis0 = rel_pos1.cross(cp.m_normalWorldOnB); solverConstraint.m_angularComponentA = rb0 ? rb0->getInvInertiaTensorWorld()*torqueAxis0*rb0->getAngularFactor() : btVector3(0,0,0); btVector3 torqueAxis1 = rel_pos2.cross(cp.m_normalWorldOnB); solverConstraint.m_angularComponentB = rb1 ? rb1->getInvInertiaTensorWorld()*-torqueAxis1*rb1->getAngularFactor() : btVector3(0,0,0); { #ifdef COMPUTE_IMPULSE_DENOM btScalar denom0 = rb0->computeImpulseDenominator(pos1,cp.m_normalWorldOnB); btScalar denom1 = rb1->computeImpulseDenominator(pos2,cp.m_normalWorldOnB); #else btVector3 vec; btScalar denom0 = 0.f; btScalar denom1 = 0.f; if (rb0) { vec = ( solverConstraint.m_angularComponentA).cross(rel_pos1); denom0 = rb0->getInvMass() + cp.m_normalWorldOnB.dot(vec); } if (rb1) { vec = ( -solverConstraint.m_angularComponentB).cross(rel_pos2); denom1 = rb1->getInvMass() + cp.m_normalWorldOnB.dot(vec); } #endif //COMPUTE_IMPULSE_DENOM btScalar denom = relaxation/(denom0+denom1); solverConstraint.m_jacDiagABInv = denom; } solverConstraint.m_contactNormal = cp.m_normalWorldOnB; solverConstraint.m_relpos1CrossNormal = rel_pos1.cross(cp.m_normalWorldOnB); solverConstraint.m_relpos2CrossNormal = rel_pos2.cross(-cp.m_normalWorldOnB); btVector3 vel1 = rb0 ? rb0->getVelocityInLocalPoint(rel_pos1) : btVector3(0,0,0); btVector3 vel2 = rb1 ? rb1->getVelocityInLocalPoint(rel_pos2) : btVector3(0,0,0); vel = vel1 - vel2; rel_vel = cp.m_normalWorldOnB.dot(vel); btScalar penetration = cp.getDistance()+infoGlobal.m_linearSlop; solverConstraint.m_friction = cp.m_combinedFriction; btScalar restitution = 0.f; if (cp.m_lifeTime>infoGlobal.m_restingContactRestitutionThreshold) { restitution = 0.f; } else { restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution); if (restitution <= btScalar(0.)) { restitution = 0.f; }; } ///warm starting (or zero if disabled) if (infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING) { solverConstraint.m_appliedImpulse = cp.m_appliedImpulse * infoGlobal.m_warmstartingFactor; if (rb0) rb0->internalApplyImpulse(solverConstraint.m_contactNormal*rb0->getInvMass()*rb0->getLinearFactor(),solverConstraint.m_angularComponentA,solverConstraint.m_appliedImpulse); if (rb1) rb1->internalApplyImpulse(solverConstraint.m_contactNormal*rb1->getInvMass()*rb1->getLinearFactor(),-solverConstraint.m_angularComponentB,-(btScalar)solverConstraint.m_appliedImpulse); } else { solverConstraint.m_appliedImpulse = 0.f; } solverConstraint.m_appliedPushImpulse = 0.f; { btScalar rel_vel; btScalar vel1Dotn = solverConstraint.m_contactNormal.dot(rb0?rb0->getLinearVelocity():btVector3(0,0,0)) + solverConstraint.m_relpos1CrossNormal.dot(rb0?rb0->getAngularVelocity():btVector3(0,0,0)); btScalar vel2Dotn = -solverConstraint.m_contactNormal.dot(rb1?rb1->getLinearVelocity():btVector3(0,0,0)) + solverConstraint.m_relpos2CrossNormal.dot(rb1?rb1->getAngularVelocity():btVector3(0,0,0)); rel_vel = vel1Dotn+vel2Dotn; btScalar positionalError = 0.f; btScalar velocityError = restitution - rel_vel;// * damping; if (penetration>0) { positionalError = 0; velocityError -= penetration / infoGlobal.m_timeStep; } else { positionalError = -penetration * infoGlobal.m_erp/infoGlobal.m_timeStep; } btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv; btScalar velocityImpulse = velocityError *solverConstraint.m_jacDiagABInv; if (!infoGlobal.m_splitImpulse || (penetration > infoGlobal.m_splitImpulsePenetrationThreshold)) { //combine position and velocity into rhs solverConstraint.m_rhs = penetrationImpulse+velocityImpulse; solverConstraint.m_rhsPenetration = 0.f; } else { //split position and velocity into rhs and m_rhsPenetration solverConstraint.m_rhs = velocityImpulse; solverConstraint.m_rhsPenetration = penetrationImpulse; } solverConstraint.m_cfm = 0.f; solverConstraint.m_lowerLimit = 0; solverConstraint.m_upperLimit = 1e10f; } } void btSequentialImpulseConstraintSolver::setFrictionConstraintImpulse( btSolverConstraint& solverConstraint, btRigidBody* rb0, btRigidBody* rb1, btManifoldPoint& cp, const btContactSolverInfo& infoGlobal) { if (infoGlobal.m_solverMode & SOLVER_USE_FRICTION_WARMSTARTING) { { btSolverConstraint& frictionConstraint1 = m_tmpSolverContactFrictionConstraintPool[solverConstraint.m_frictionIndex]; if (infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING) { frictionConstraint1.m_appliedImpulse = cp.m_appliedImpulseLateral1 * infoGlobal.m_warmstartingFactor; if (rb0) rb0->internalApplyImpulse(frictionConstraint1.m_contactNormal*rb0->getInvMass()*rb0->getLinearFactor(),frictionConstraint1.m_angularComponentA,frictionConstraint1.m_appliedImpulse); if (rb1) rb1->internalApplyImpulse(frictionConstraint1.m_contactNormal*rb1->getInvMass()*rb1->getLinearFactor(),-frictionConstraint1.m_angularComponentB,-(btScalar)frictionConstraint1.m_appliedImpulse); } else { frictionConstraint1.m_appliedImpulse = 0.f; } } if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { btSolverConstraint& frictionConstraint2 = m_tmpSolverContactFrictionConstraintPool[solverConstraint.m_frictionIndex+1]; if (infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING) { frictionConstraint2.m_appliedImpulse = cp.m_appliedImpulseLateral2 * infoGlobal.m_warmstartingFactor; if (rb0) rb0->internalApplyImpulse(frictionConstraint2.m_contactNormal*rb0->getInvMass(),frictionConstraint2.m_angularComponentA,frictionConstraint2.m_appliedImpulse); if (rb1) rb1->internalApplyImpulse(frictionConstraint2.m_contactNormal*rb1->getInvMass(),-frictionConstraint2.m_angularComponentB,-(btScalar)frictionConstraint2.m_appliedImpulse); } else { frictionConstraint2.m_appliedImpulse = 0.f; } } } else { btSolverConstraint& frictionConstraint1 = m_tmpSolverContactFrictionConstraintPool[solverConstraint.m_frictionIndex]; frictionConstraint1.m_appliedImpulse = 0.f; if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { btSolverConstraint& frictionConstraint2 = m_tmpSolverContactFrictionConstraintPool[solverConstraint.m_frictionIndex+1]; frictionConstraint2.m_appliedImpulse = 0.f; } } } void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* manifold,const btContactSolverInfo& infoGlobal) { btCollisionObject* colObj0=0,*colObj1=0; colObj0 = (btCollisionObject*)manifold->getBody0(); colObj1 = (btCollisionObject*)manifold->getBody1(); btRigidBody* solverBodyA = btRigidBody::upcast(colObj0); btRigidBody* solverBodyB = btRigidBody::upcast(colObj1); ///avoid collision response between two static objects if ((!solverBodyA || !solverBodyA->getInvMass()) && (!solverBodyB || !solverBodyB->getInvMass())) return; for (int j=0;j<manifold->getNumContacts();j++) { btManifoldPoint& cp = manifold->getContactPoint(j); if (cp.getDistance() <= manifold->getContactProcessingThreshold()) { btVector3 rel_pos1; btVector3 rel_pos2; btScalar relaxation; btScalar rel_vel; btVector3 vel; int frictionIndex = m_tmpSolverContactConstraintPool.size(); btSolverConstraint& solverConstraint = m_tmpSolverContactConstraintPool.expandNonInitializing(); btRigidBody* rb0 = btRigidBody::upcast(colObj0); btRigidBody* rb1 = btRigidBody::upcast(colObj1); solverConstraint.m_solverBodyA = rb0? rb0 : &getFixedBody(); solverConstraint.m_solverBodyB = rb1? rb1 : &getFixedBody(); solverConstraint.m_originalContactPoint = &cp; setupContactConstraint(solverConstraint, colObj0, colObj1, cp, infoGlobal, vel, rel_vel, relaxation, rel_pos1, rel_pos2); // const btVector3& pos1 = cp.getPositionWorldOnA(); // const btVector3& pos2 = cp.getPositionWorldOnB(); /////setup the friction constraints solverConstraint.m_frictionIndex = m_tmpSolverContactFrictionConstraintPool.size(); if (!(infoGlobal.m_solverMode & SOLVER_ENABLE_FRICTION_DIRECTION_CACHING) || !cp.m_lateralFrictionInitialized) { cp.m_lateralFrictionDir1 = vel - cp.m_normalWorldOnB * rel_vel; btScalar lat_rel_vel = cp.m_lateralFrictionDir1.length2(); if (!(infoGlobal.m_solverMode & SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION) && lat_rel_vel > SIMD_EPSILON) { cp.m_lateralFrictionDir1 /= btSqrt(lat_rel_vel); if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { cp.m_lateralFrictionDir2 = cp.m_lateralFrictionDir1.cross(cp.m_normalWorldOnB); cp.m_lateralFrictionDir2.normalize();//?? applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2); addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyA,solverBodyB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); } applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1); addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyA,solverBodyB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); cp.m_lateralFrictionInitialized = true; } else { //re-calculate friction direction every frame, todo: check if this is really needed btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2); if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2); addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyA,solverBodyB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); } applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1); addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyA,solverBodyB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); cp.m_lateralFrictionInitialized = true; } } else { addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyA,solverBodyB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation,cp.m_contactMotion1, cp.m_contactCFM1); if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyA,solverBodyB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, cp.m_contactMotion2, cp.m_contactCFM2); } setFrictionConstraintImpulse( solverConstraint, rb0, rb1, cp, infoGlobal); } } } btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCollisionObject** bodies, int numBodies, btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc) { BT_PROFILE("solveGroupCacheFriendlySetup"); (void)stackAlloc; (void)debugDrawer; if (!(numConstraints + numManifolds)) { // printf("empty\n"); return 0.f; } if (infoGlobal.m_splitImpulse) { for (int i = 0; i < numBodies; i++) { btRigidBody* body = btRigidBody::upcast(bodies[i]); if (body) { body->internalGetDeltaLinearVelocity().setZero(); body->internalGetDeltaAngularVelocity().setZero(); body->internalGetPushVelocity().setZero(); body->internalGetTurnVelocity().setZero(); } } } else { for (int i = 0; i < numBodies; i++) { btRigidBody* body = btRigidBody::upcast(bodies[i]); if (body) { body->internalGetDeltaLinearVelocity().setZero(); body->internalGetDeltaAngularVelocity().setZero(); } } } if (1) { int j; for (j=0;j<numConstraints;j++) { btTypedConstraint* constraint = constraints[j]; constraint->buildJacobian(); constraint->internalSetAppliedImpulse(0.0f); } } //btRigidBody* rb0=0,*rb1=0; //if (1) { { int totalNumRows = 0; int i; m_tmpConstraintSizesPool.resize(numConstraints); //calculate the total number of contraint rows for (i=0;i<numConstraints;i++) { btTypedConstraint::btConstraintInfo1& info1 = m_tmpConstraintSizesPool[i]; if (constraints[i]->isEnabled()) { constraints[i]->getInfo1(&info1); } else { info1.m_numConstraintRows = 0; info1.nub = 0; } totalNumRows += info1.m_numConstraintRows; } m_tmpSolverNonContactConstraintPool.resize(totalNumRows); ///setup the btSolverConstraints int currentRow = 0; for (i=0;i<numConstraints;i++) { const btTypedConstraint::btConstraintInfo1& info1 = m_tmpConstraintSizesPool[i]; if (info1.m_numConstraintRows) { btAssert(currentRow<totalNumRows); btSolverConstraint* currentConstraintRow = &m_tmpSolverNonContactConstraintPool[currentRow]; btTypedConstraint* constraint = constraints[i]; btRigidBody& rbA = constraint->getRigidBodyA(); btRigidBody& rbB = constraint->getRigidBodyB(); int j; for ( j=0;j<info1.m_numConstraintRows;j++) { memset(&currentConstraintRow[j],0,sizeof(btSolverConstraint)); currentConstraintRow[j].m_lowerLimit = -SIMD_INFINITY; currentConstraintRow[j].m_upperLimit = SIMD_INFINITY; currentConstraintRow[j].m_appliedImpulse = 0.f; currentConstraintRow[j].m_appliedPushImpulse = 0.f; currentConstraintRow[j].m_solverBodyA = &rbA; currentConstraintRow[j].m_solverBodyB = &rbB; } rbA.internalGetDeltaLinearVelocity().setValue(0.f,0.f,0.f); rbA.internalGetDeltaAngularVelocity().setValue(0.f,0.f,0.f); rbB.internalGetDeltaLinearVelocity().setValue(0.f,0.f,0.f); rbB.internalGetDeltaAngularVelocity().setValue(0.f,0.f,0.f); btTypedConstraint::btConstraintInfo2 info2; info2.fps = 1.f/infoGlobal.m_timeStep; info2.erp = infoGlobal.m_erp; info2.m_J1linearAxis = currentConstraintRow->m_contactNormal; info2.m_J1angularAxis = currentConstraintRow->m_relpos1CrossNormal; info2.m_J2linearAxis = 0; info2.m_J2angularAxis = currentConstraintRow->m_relpos2CrossNormal; info2.rowskip = sizeof(btSolverConstraint)/sizeof(btScalar);//check this ///the size of btSolverConstraint needs be a multiple of btScalar btAssert(info2.rowskip*sizeof(btScalar)== sizeof(btSolverConstraint)); info2.m_constraintError = &currentConstraintRow->m_rhs; currentConstraintRow->m_cfm = infoGlobal.m_globalCfm; info2.m_damping = infoGlobal.m_damping; info2.cfm = &currentConstraintRow->m_cfm; info2.m_lowerLimit = &currentConstraintRow->m_lowerLimit; info2.m_upperLimit = &currentConstraintRow->m_upperLimit; info2.m_numIterations = infoGlobal.m_numIterations; constraints[i]->getInfo2(&info2); ///finalize the constraint setup for ( j=0;j<info1.m_numConstraintRows;j++) { btSolverConstraint& solverConstraint = currentConstraintRow[j]; if (solverConstraint.m_upperLimit>=constraints[i]->getBreakingImpulseThreshold()) { solverConstraint.m_upperLimit = constraints[i]->getBreakingImpulseThreshold(); } if (solverConstraint.m_lowerLimit<=-constraints[i]->getBreakingImpulseThreshold()) { solverConstraint.m_lowerLimit = -constraints[i]->getBreakingImpulseThreshold(); } solverConstraint.m_originalContactPoint = constraint; { const btVector3& ftorqueAxis1 = solverConstraint.m_relpos1CrossNormal; solverConstraint.m_angularComponentA = constraint->getRigidBodyA().getInvInertiaTensorWorld()*ftorqueAxis1*constraint->getRigidBodyA().getAngularFactor(); } { const btVector3& ftorqueAxis2 = solverConstraint.m_relpos2CrossNormal; solverConstraint.m_angularComponentB = constraint->getRigidBodyB().getInvInertiaTensorWorld()*ftorqueAxis2*constraint->getRigidBodyB().getAngularFactor(); } { btVector3 iMJlA = solverConstraint.m_contactNormal*rbA.getInvMass(); btVector3 iMJaA = rbA.getInvInertiaTensorWorld()*solverConstraint.m_relpos1CrossNormal; btVector3 iMJlB = solverConstraint.m_contactNormal*rbB.getInvMass();//sign of normal? btVector3 iMJaB = rbB.getInvInertiaTensorWorld()*solverConstraint.m_relpos2CrossNormal; btScalar sum = iMJlA.dot(solverConstraint.m_contactNormal); sum += iMJaA.dot(solverConstraint.m_relpos1CrossNormal); sum += iMJlB.dot(solverConstraint.m_contactNormal); sum += iMJaB.dot(solverConstraint.m_relpos2CrossNormal); solverConstraint.m_jacDiagABInv = btScalar(1.)/sum; } ///fix rhs ///todo: add force/torque accelerators { btScalar rel_vel; btScalar vel1Dotn = solverConstraint.m_contactNormal.dot(rbA.getLinearVelocity()) + solverConstraint.m_relpos1CrossNormal.dot(rbA.getAngularVelocity()); btScalar vel2Dotn = -solverConstraint.m_contactNormal.dot(rbB.getLinearVelocity()) + solverConstraint.m_relpos2CrossNormal.dot(rbB.getAngularVelocity()); rel_vel = vel1Dotn+vel2Dotn; btScalar restitution = 0.f; btScalar positionalError = solverConstraint.m_rhs;//already filled in by getConstraintInfo2 btScalar velocityError = restitution - rel_vel * info2.m_damping; btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv; btScalar velocityImpulse = velocityError *solverConstraint.m_jacDiagABInv; solverConstraint.m_rhs = penetrationImpulse+velocityImpulse; solverConstraint.m_appliedImpulse = 0.f; } } } currentRow+=m_tmpConstraintSizesPool[i].m_numConstraintRows; } } { int i; btPersistentManifold* manifold = 0; // btCollisionObject* colObj0=0,*colObj1=0; for (i=0;i<numManifolds;i++) { manifold = manifoldPtr[i]; convertContact(manifold,infoGlobal); } } } btContactSolverInfo info = infoGlobal; int numConstraintPool = m_tmpSolverContactConstraintPool.size(); int numFrictionPool = m_tmpSolverContactFrictionConstraintPool.size(); ///@todo: use stack allocator for such temporarily memory, same for solver bodies/constraints m_orderTmpConstraintPool.resize(numConstraintPool); m_orderFrictionConstraintPool.resize(numFrictionPool); { int i; for (i=0;i<numConstraintPool;i++) { m_orderTmpConstraintPool[i] = i; } for (i=0;i<numFrictionPool;i++) { m_orderFrictionConstraintPool[i] = i; } } return 0.f; } btScalar btSequentialImpulseConstraintSolver::solveSingleIteration(int iteration, btCollisionObject** /*bodies */,int /*numBodies*/,btPersistentManifold** /*manifoldPtr*/, int /*numManifolds*/,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* /*debugDrawer*/,btStackAlloc* /*stackAlloc*/) { int numConstraintPool = m_tmpSolverContactConstraintPool.size(); int numFrictionPool = m_tmpSolverContactFrictionConstraintPool.size(); int j; if (infoGlobal.m_solverMode & SOLVER_RANDMIZE_ORDER) { if ((iteration & 7) == 0) { for (j=0; j<numConstraintPool; ++j) { int tmp = m_orderTmpConstraintPool[j]; int swapi = btRandInt2(j+1); m_orderTmpConstraintPool[j] = m_orderTmpConstraintPool[swapi]; m_orderTmpConstraintPool[swapi] = tmp; } for (j=0; j<numFrictionPool; ++j) { int tmp = m_orderFrictionConstraintPool[j]; int swapi = btRandInt2(j+1); m_orderFrictionConstraintPool[j] = m_orderFrictionConstraintPool[swapi]; m_orderFrictionConstraintPool[swapi] = tmp; } } } if (infoGlobal.m_solverMode & SOLVER_SIMD) { ///solve all joint constraints, using SIMD, if available for (j=0;j<m_tmpSolverNonContactConstraintPool.size();j++) { btSolverConstraint& constraint = m_tmpSolverNonContactConstraintPool[j]; resolveSingleConstraintRowGenericSIMD(*constraint.m_solverBodyA,*constraint.m_solverBodyB,constraint); } for (j=0;j<numConstraints;j++) { constraints[j]->solveConstraintObsolete(constraints[j]->getRigidBodyA(),constraints[j]->getRigidBodyB(),infoGlobal.m_timeStep); } ///solve all contact constraints using SIMD, if available int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); for (j=0;j<numPoolConstraints;j++) { const btSolverConstraint& solveManifold = m_tmpSolverContactConstraintPool[m_orderTmpConstraintPool[j]]; resolveSingleConstraintRowLowerLimitSIMD(*solveManifold.m_solverBodyA,*solveManifold.m_solverBodyB,solveManifold); } ///solve all friction constraints, using SIMD, if available int numFrictionPoolConstraints = m_tmpSolverContactFrictionConstraintPool.size(); for (j=0;j<numFrictionPoolConstraints;j++) { btSolverConstraint& solveManifold = m_tmpSolverContactFrictionConstraintPool[m_orderFrictionConstraintPool[j]]; btScalar totalImpulse = m_tmpSolverContactConstraintPool[solveManifold.m_frictionIndex].m_appliedImpulse; if (totalImpulse>btScalar(0)) { solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; resolveSingleConstraintRowGenericSIMD(*solveManifold.m_solverBodyA, *solveManifold.m_solverBodyB,solveManifold); } } } else { ///solve all joint constraints for (j=0;j<m_tmpSolverNonContactConstraintPool.size();j++) { btSolverConstraint& constraint = m_tmpSolverNonContactConstraintPool[j]; resolveSingleConstraintRowGeneric(*constraint.m_solverBodyA,*constraint.m_solverBodyB,constraint); } for (j=0;j<numConstraints;j++) { constraints[j]->solveConstraintObsolete(constraints[j]->getRigidBodyA(),constraints[j]->getRigidBodyB(),infoGlobal.m_timeStep); } ///solve all contact constraints int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); for (j=0;j<numPoolConstraints;j++) { const btSolverConstraint& solveManifold = m_tmpSolverContactConstraintPool[m_orderTmpConstraintPool[j]]; resolveSingleConstraintRowLowerLimit(*solveManifold.m_solverBodyA,*solveManifold.m_solverBodyB,solveManifold); } ///solve all friction constraints int numFrictionPoolConstraints = m_tmpSolverContactFrictionConstraintPool.size(); for (j=0;j<numFrictionPoolConstraints;j++) { btSolverConstraint& solveManifold = m_tmpSolverContactFrictionConstraintPool[m_orderFrictionConstraintPool[j]]; btScalar totalImpulse = m_tmpSolverContactConstraintPool[solveManifold.m_frictionIndex].m_appliedImpulse; if (totalImpulse>btScalar(0)) { solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; resolveSingleConstraintRowGeneric(*solveManifold.m_solverBodyA,*solveManifold.m_solverBodyB,solveManifold); } } } return 0.f; } void btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc) { int iteration; if (infoGlobal.m_splitImpulse) { if (infoGlobal.m_solverMode & SOLVER_SIMD) { for ( iteration = 0;iteration<infoGlobal.m_numIterations;iteration++) { { int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); int j; for (j=0;j<numPoolConstraints;j++) { const btSolverConstraint& solveManifold = m_tmpSolverContactConstraintPool[m_orderTmpConstraintPool[j]]; resolveSplitPenetrationSIMD(*solveManifold.m_solverBodyA,*solveManifold.m_solverBodyB,solveManifold); } } } } else { for ( iteration = 0;iteration<infoGlobal.m_numIterations;iteration++) { { int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); int j; for (j=0;j<numPoolConstraints;j++) { const btSolverConstraint& solveManifold = m_tmpSolverContactConstraintPool[m_orderTmpConstraintPool[j]]; resolveSplitPenetrationImpulseCacheFriendly(*solveManifold.m_solverBodyA,*solveManifold.m_solverBodyB,solveManifold); } } } } } } btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyIterations(btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc) { BT_PROFILE("solveGroupCacheFriendlyIterations"); //should traverse the contacts random order... int iteration; { solveGroupCacheFriendlySplitImpulseIterations(bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc); for ( iteration = 0;iteration<infoGlobal.m_numIterations;iteration++) { solveSingleIteration(iteration, bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc); } } return 0.f; } btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyFinish(btCollisionObject** bodies ,int numBodies,btPersistentManifold** /*manifoldPtr*/, int /*numManifolds*/,btTypedConstraint** /*constraints*/,int /* numConstraints*/,const btContactSolverInfo& infoGlobal,btIDebugDraw* /*debugDrawer*/,btStackAlloc* /*stackAlloc*/) { int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); int i,j; for (j=0;j<numPoolConstraints;j++) { const btSolverConstraint& solveManifold = m_tmpSolverContactConstraintPool[j]; btManifoldPoint* pt = (btManifoldPoint*) solveManifold.m_originalContactPoint; btAssert(pt); pt->m_appliedImpulse = solveManifold.m_appliedImpulse; if (infoGlobal.m_solverMode & SOLVER_USE_FRICTION_WARMSTARTING) { pt->m_appliedImpulseLateral1 = m_tmpSolverContactFrictionConstraintPool[solveManifold.m_frictionIndex].m_appliedImpulse; pt->m_appliedImpulseLateral2 = m_tmpSolverContactFrictionConstraintPool[solveManifold.m_frictionIndex+1].m_appliedImpulse; } //do a callback here? } numPoolConstraints = m_tmpSolverNonContactConstraintPool.size(); for (j=0;j<numPoolConstraints;j++) { const btSolverConstraint& solverConstr = m_tmpSolverNonContactConstraintPool[j]; btTypedConstraint* constr = (btTypedConstraint*)solverConstr.m_originalContactPoint; constr->internalSetAppliedImpulse(solverConstr.m_appliedImpulse); if (btFabs(solverConstr.m_appliedImpulse)>=constr->getBreakingImpulseThreshold()) { constr->setEnabled(false); } } if (infoGlobal.m_splitImpulse) { for ( i=0;i<numBodies;i++) { btRigidBody* body = btRigidBody::upcast(bodies[i]); if (body) body->internalWritebackVelocity(infoGlobal.m_timeStep); } } else { for ( i=0;i<numBodies;i++) { btRigidBody* body = btRigidBody::upcast(bodies[i]); if (body) body->internalWritebackVelocity(); } } m_tmpSolverContactConstraintPool.resize(0); m_tmpSolverNonContactConstraintPool.resize(0); m_tmpSolverContactFrictionConstraintPool.resize(0); return 0.f; } /// btSequentialImpulseConstraintSolver Sequentially applies impulses btScalar btSequentialImpulseConstraintSolver::solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc,btDispatcher* /*dispatcher*/) { BT_PROFILE("solveGroup"); //you need to provide at least some bodies btAssert(bodies); btAssert(numBodies); solveGroupCacheFriendlySetup( bodies, numBodies, manifoldPtr, numManifolds,constraints, numConstraints,infoGlobal,debugDrawer, stackAlloc); solveGroupCacheFriendlyIterations(bodies, numBodies, manifoldPtr, numManifolds,constraints, numConstraints,infoGlobal,debugDrawer, stackAlloc); solveGroupCacheFriendlyFinish(bodies, numBodies, manifoldPtr, numManifolds,constraints, numConstraints,infoGlobal,debugDrawer, stackAlloc); return 0.f; } void btSequentialImpulseConstraintSolver::reset() { m_btSeed2 = 0; } btRigidBody& btSequentialImpulseConstraintSolver::getFixedBody() { static btRigidBody s_fixed(0, 0,0); s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btScalar(0.),btScalar(0.))); return s_fixed; }
[ "[email protected]@a37908be-9fcf-b1de-0eca-ed7eba0bb5bd" ]
[ [ [ 1, 1238 ] ] ]
36e69d895ff081ea83335501775ecb4f7cdce779
bfbe6667ce1a0b7b2772f4de57829d8760a0f55c
/var.3/Проекты/main.cpp
a99206798f0747f9b7fc332f1727c91dbbf1bfb6
[]
no_license
buger/CPP-Labs
50333a317657d495ad5a3f120441ed5988ea16d5
f413c505af4a9f612c597214ab68384b588f5389
refs/heads/master
2023-07-12T11:41:10.793947
2009-10-17T16:00:24
2009-10-17T16:00:24
339,804
2
0
null
null
null
null
UTF-8
C++
false
false
258
cpp
#include <stdio.h> #include <conio.h> #include <stdlib.h> #include "func.h" const int r1=7; const int r2=8; const int r3=6; void main() { int M[r1],L[r2],C[r3]; randomize(); clrscr(); form(M,L,C,r1,r2,r3); func(M,L,C,r1,r2,r3); getch(); }
[ [ [ 1, 17 ] ] ]
e0aaa5b489084c88bc8d7a1a72c905a4a8b706d2
5fb9b06a4bf002fc851502717a020362b7d9d042
/developertools/MapRenderer/src/renderer/Animation.cpp
c215299eae69efb3928c6d88ab6deba4ad9eb7a7
[]
no_license
bravesoftdz/iris-svn
8f30b28773cf55ecf8951b982370854536d78870
c03438fcf59d9c788f6cb66b6cb9cf7235fbcbd4
refs/heads/master
2021-12-05T18:32:54.525624
2006-08-21T13:10:54
2006-08-21T13:10:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
735
cpp
// // File: Animation.cpp // Created by: Alexander Oster - [email protected] // #include "renderer/Animation.h" #include "include.h" using namespace std; cAnimation::cAnimation () { } cAnimation::~cAnimation () { ClearFrames(); } void cAnimation::ClearFrames() { for (int i=0; i < frames.size(); i++) delete frames[i]; frames.clear(); } sAnimationFrame * cAnimation::AddFrame() { sAnimationFrame * result = new sAnimationFrame; memset(result, 0, sizeof (struct sAnimationFrame)); frames.push_back(result); return result; } sAnimationFrame * cAnimation::GetFrame(Uint32 frame) { if (frame < frames.size()) return frames[frame]; }
[ "sience@a725d9c3-d2eb-0310-b856-fa980ef11a19" ]
[ [ [ 1, 39 ] ] ]
7557f1ef1d813f0ebafded44515780a53d06d906
9190ca752045c29a3afb830fed21e4782c4714af
/sandbox/gui_plan_lol/Control/vdfilecontrol.cpp
c52b8485ca43d51e2ab5ac93138aa796febc7a78
[]
no_license
andrikoka/vdmanager
2422ac654059feca178a1ad60b4865476327f41d
63feffae35383be753757c0e075d3112e5f0f483
refs/heads/master
2021-01-10T13:47:01.523688
2010-12-07T17:48:24
2010-12-07T17:48:24
47,425,124
0
0
null
null
null
null
UTF-8
C++
false
false
3,413
cpp
#include <Control/vdfilecontrol.h> VDFileControl::VDFileControl(MainWindow * GUI,QObject *parent) : QObject(parent) { this->t.start(); QDir dir; dir = QDir(); dispatcher = new VDDispatcher(this); this->mw = GUI; QList<QFileInfo> drive = dir.drives(); QFileIconProvider qficp; qDebug() << "drives:"; for (short int i=0;i < drive.count();i++){ mw->setDrive(drive[i].path(),qficp.icon(drive[i])); } connect(dispatcher,SIGNAL(ExecutionRequest(QString,int)),this,SLOT(ExecutionRequest(QString,int))); connect(mw,SIGNAL(itemActivated(QString,int)),dispatcher,SLOT(PanelItemDoubleClicked(QString,int))); for (unsigned int i=0;i<2;i++){ /* magyarazat: 1: panelok feltoltese (i most konstans, de a megnyitott panelok szamanak megfelelo is lehet) 2: elso elem letrehozasa, kesobb settings alapjan lehet a last used dir es egyeb 3: vdfileitem pointereket beallitjuk majd megcsinaljuk a handler-t hozza 4: bedrotozzuk a megfelelo helyre 5: majd azt mondjuk neki, hogy toltikezhet */ this->item = new VDFileItem(dir.homePath()); this->panelRootList << this->item; this->panelRootList[i]->setItemIndex(i,0); this->localItem = new VDLocalFile(this->panelRootList[i]->getFileName(), this->panelRootList[i]); this->handlerRootList << this->localItem; connect(this->panelRootList[i],SIGNAL(readyToDisplay(VDFileItem*)), this,SLOT(VDRootItemIsReady(VDFileItem*))); this->handlerRootList[i]->fillVDItem(); } qDebug("Constructor end: Time elapsed: %d ms", t.elapsed()); } void VDFileControl::VDRootItemIsReady(VDFileItem * rootItem){ unsigned int panelindex = rootItem->getPanelIndex(); this->mw->clearPanel(panelindex); this->mw->addItemToAddressbar(rootItem->getStandardURL(),panelindex); qDebug("RootItemReady: Time elapsed: %d ms, generateList called", t.restart()); this->handlerRootList[panelindex]->generateList(QString(),this->mw,panelindex); qDebug("RootItemReadyEnd: Time elapsed: %d ms, generateList finished", t.elapsed()); } void VDFileControl::ExecutionRequest(QString url, int panel){ qDebug("Exec: Start: %d ms", t.restart()); // VDExecute kellene ide, ami ezt megcsinalja QStringList parts,pieces; qDebug() << "Control: ExecutionRequest" << url << panel; parts = url.split("://"); pieces = parts[1].split("/"); if (pieces.last() == ".."){ qDebug() << "Command: .. (cdUp)"; this->handlerRootList[panel]->cdUp(); this->handlerRootList[panel]->fillVDItem(); } else { this->item = new VDFileItem(parts[1]); this->localItem = new VDLocalFile(this->item->getFileName(),this->item); this->localItem->fillVDItem(); if(this->item->isDir() and !this->item->isRoot()) { this->handlerRootList[panel]->cd(parts[1]); this->handlerRootList[panel]->fillVDItem(); } else if (this->item->isRoot()){ this->handlerRootList[panel]->changePath(this->item->getFullPath()); this->handlerRootList[panel]->fillVDItem(); } else { qDebug() << "File execution request:" << this->item->getFullPath() << this->item->getFileName() << "isDir:" << this->item->isDir(); qDebug() << QProcess::startDetached("cmd.exe /C \""+parts[1]+"\""); } } qDebug("Exec: FillVDItem finished: %d ms", t.restart()); }
[ [ [ 1, 85 ] ] ]
c48da8818ee3bd9f29afb4c14fab443b045e2b1a
d81bbe5a784c804f59f643fcbf84be769abf2bc9
/Gosling/include/GosLine.h
5e81d509e6c92f85677dea235420de900be2994e
[]
no_license
songuke/goslingviz
9d071691640996ee88171d36f7ca8c6c86b64156
f4b7f71e31429e32b41d7a20e0c151be30634e4f
refs/heads/master
2021-01-10T03:36:25.995930
2010-04-16T08:49:27
2010-04-16T08:49:27
36,341,765
0
0
null
null
null
null
UTF-8
C++
false
false
390
h
#ifndef _GOS_LINE_ #define _GOS_LINE_ #include "GosMustHave.h" namespace Gos { class Line { public: Line(void); ~Line(void); public: static void draw(Image* image, Float2 src, Float2 dest, Float4 color); /** Return additional mask marking the drawn pixels. */ static void draw(Image* image, Float2 src, Float2 dest, Float4 color, Image* mask); }; } #endif
[ "songuke@00dcdb3d-b287-7056-8bd8-84a1afe327dc" ]
[ [ [ 1, 24 ] ] ]
a9de8fd5ab8a61baea4a9c0820485e86b25fb636
b8fbe9079ce8996e739b476d226e73d4ec8e255c
/src/engine/rb_extui/jobjectfrontend.h
75df0f6cecd60fd42574cd111f04f8dfaf821859
[]
no_license
dtbinh/rush
4294f84de1b6e6cc286aaa1dd48cf12b12a467d0
ad75072777438c564ccaa29af43e2a9fd2c51266
refs/heads/master
2021-01-15T17:14:48.417847
2011-06-16T17:41:20
2011-06-16T17:41:20
41,476,633
1
0
null
2015-08-27T09:03:44
2015-08-27T09:03:44
null
UTF-8
C++
false
false
1,342
h
/***********************************************************************************/ // File: JObjectFrontEnd.h // Date: 14.10.2005 // Author: Ruslan Shestopalyuk /***********************************************************************************/ #ifndef __JOBJECTFRONTEND_H__ #define __JOBJECTFRONTEND_H__ #include "JWidget.h" /***********************************************************************************/ // Class: JObjectFrontEnd // Desc: Representation of the specific object's widget in the object tree /***********************************************************************************/ class JObjectFrontEnd : public JWidget { JString m_ObjectName; JString m_ObjectClass; public: JObjectFrontEnd (); const char* GetObjectName () const { return m_ObjectName.c_str(); } const char* GetObjectClass () const { return m_ObjectClass.c_str(); } void SetObjectName ( const char* name ); void SetObjectClass ( const char* name ); expose(JObjectFrontEnd) { parent(JWidget); prop( "ObjectName", GetObjectName, SetObjectName ); prop( "ObjectClass", GetObjectClass, SetObjectClass ); } }; // class JObjectFrontEnd #endif //__JOBJECTFRONTEND_H__
[ [ [ 1, 37 ] ] ]
86f986868ccafb43d8f894956ac0915d20e19479
45229380094a0c2b603616e7505cbdc4d89dfaee
/wavelets/facedetector_src/src/cvLib/MotionDetector.cpp
52766b4a3f519343c5cd505f7e755333b766b2b6
[]
no_license
xcud/msrds
a71000cc096723272e5ada7229426dee5100406c
04764859c88f5c36a757dbffc105309a27cd9c4d
refs/heads/master
2021-01-10T01:19:35.834296
2011-11-04T09:26:01
2011-11-04T09:26:01
45,697,313
1
2
null
null
null
null
UTF-8
C++
false
false
2,205
cpp
#include "stdafx.h" #include "motiondetector.h" #include "vec2d.h" #include "vec2dc.h" #include "facedetector.h" MotionDetector::MotionDetector() : m_status(-1), m_last_frame(0), m_motion_vector(0), m_TH(10.0) { } MotionDetector::~MotionDetector() { close(); } void MotionDetector::init(unsigned int image_width, unsigned int image_height) { close(); m_last_frame = new vec2D(image_height, image_width); m_motion_vector = new vec2Dc(image_height, image_width); m_status = 0; } void MotionDetector::close() { if (m_last_frame != 0) { delete m_last_frame; m_last_frame = 0; } if (m_motion_vector != 0) { delete m_motion_vector; m_motion_vector = 0; } m_status = -1; } const vec2Dc* MotionDetector::detect(const vec2D* frame, const FaceDetector* fdetect) { if (status() < 0) return 0; //m_last = frame - m_last m_last_frame->sub(*frame, *m_last_frame); //set to 1.0 faces rects RECT r0; for (unsigned int i = 0; i < fdetect->get_faces_number(); i++) { const RECT* r = fdetect->get_face_rect(i); r0.left = r->left; r0.top = r->top; r0.right = r->right; r0.bottom = r->bottom; m_last_frame->set(255.0f, r0); } for (unsigned int y = fdetect->get_dy(); y < m_motion_vector->height() - fdetect->get_dy(); y++) { for (unsigned int x = fdetect->get_dx(); x < m_motion_vector->width() - fdetect->get_dx(); x++) { if (fabs((*m_last_frame)(y, x)) > m_TH) (*m_motion_vector)(y, x) = 1; else (*m_motion_vector)(y, x) = 0; } } *m_last_frame = *frame; return m_motion_vector; } void MotionDetector::clear_last_frame() { if (m_last_frame != 0) m_last_frame->set(0.0f); }
[ "perpet99@cc61708c-8d4c-0410-8fce-b5b73d66a671" ]
[ [ [ 1, 77 ] ] ]
44481c11a6d92db39ba296baa90003678cef6e01
073dfce42b384c9438734daa8ee2b575ff100cc9
/RCF/include/RCF/RcfBoostThreads/boost_1_33_1/boost/thread/detail/config.hpp
d603f4a4612b08d9d59c7fda7060444d61471a7c
[]
no_license
r0ssar00/iTunesSpeechBridge
a489426bbe30ac9bf9c7ca09a0b1acd624c1d9bf
71a27a52e66f90ade339b2b8a7572b53577e2aaf
refs/heads/master
2020-12-24T17:45:17.838301
2009-08-24T22:04:48
2009-08-24T22:04:48
285,393
1
0
null
null
null
null
UTF-8
C++
false
false
1,062
hpp
//****************************************************************************** // RCF - Remote Call Framework // Copyright (c) 2005 - 2009, Jarl Lindrud. All rights reserved. // Consult your license for conditions of use. // Version: 1.1 // Contact: jarl.lindrud <at> gmail.com //****************************************************************************** // Copyright (C) 2001-2003 // William E. Kempf // // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies and // that both that copyright notice and this permission notice appear // in supporting documentation. William E. Kempf makes no representations // about the suitability of this software for any purpose. // It is provided "as is" without express or implied warranty. #ifndef RCF_BOOST_THREAD_CONFIG_WEK01032003_HPP #define RCF_BOOST_THREAD_CONFIG_WEK01032003_HPP #endif // RCF_BOOST_THREAD_CONFIG_WEK1032003_HPP
[ [ [ 1, 24 ] ] ]
08e9f59490b0add338e089a914c9e1f60c7ea511
bfdfb7c406c318c877b7cbc43bc2dfd925185e50
/common/hySymbolID.h
cc356d78286ede6d7ffe3e9453afd14542d85820
[ "MIT" ]
permissive
ysei/Hayat
74cc1e281ae6772b2a05bbeccfcf430215cb435b
b32ed82a1c6222ef7f4bf0fc9dedfad81280c2c0
refs/heads/master
2020-12-11T09:07:35.606061
2011-08-01T12:38:39
2011-08-01T12:38:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
632
h
/* -*- coding: sjis-dos; -*- */ /* * copyright 2010 FUKUZAWA Tadashi. All rights reserved. */ #ifndef m_HYSYMBOLID_H_ #define m_HYSYMBOLID_H_ #include "machdep.h" namespace Hayat { namespace Common { #ifdef SYMBOL_ID_IS_HYU16 typedef hyu16 SymbolID_t; static const SymbolID_t SYMBOL_ID_ERROR = 0xffff; #else #ifdef SYMBOL_ID_IS_HYU32 typedef hyu32 SymbolID_t; static const SymbolID_t SYMBOL_ID_ERROR = 0xffffffff; #else #error SYMBOL_ID_IS_HYU16 or SYMBOL_ID_IS_HYU32 must be specified in machdep.h #endif #endif } } #endif /* m_HYSYMBOLID_H_ */
[ [ [ 1, 30 ] ] ]
3a35e5695ac9821c90a95d5c2ae408fcabdecf50
a473bf3be1f1cda62b1d0dc23292fbf7ec00dcee
/src/image.cpp
f9c9bf5a5dd6d3617ffb34d653c2188b771b7e0c
[]
no_license
SymbiSoft/htmlcontrol-for-symbian
23821e9daa50707b1d030960e1c2dcf59633a335
504ca3cb3cf4baea3adc5c5b44e8037e0d73c3bb
refs/heads/master
2021-01-10T15:04:51.760462
2009-08-14T05:40:14
2009-08-14T05:40:14
48,186,784
1
0
null
null
null
null
UTF-8
C++
false
false
2,390
cpp
#include "htmlcontrol.h" #include "htmlctlenv.h" #include "image.h" #include "imagepool.h" #include "imageimpl.h" #include "gcproxy.h" #include "utils.h" CHcImage* CHcImage::NewL(const THcImageLocation& aLocation) { CHcImage* self; switch(aLocation.iType) { case ELTFileGeneral: self = new (ELeave)CHcImageGeneral(); break; case ELTFileMbm: self = new (ELeave)CHcImageMbm(); break; case ELTFileSvg: self = new (ELeave)CHcImageSvg(); break; case ELTAppIcon: self = new (ELeave)CHcImageAppIcon(); break; case ELTGradient: self = new (ELeave)CHcImageGradient(); break; case ELTSkin: #ifdef __SERIES60__ self = new (ELeave)CHcImageAknsBackground(); #endif #ifdef __UIQ__ self = new (ELeave)CHcImageUIQSkin(); #endif break; #ifdef __SERIES60__ case ELTFrame: self = new (ELeave)CHcImageAknsFrame(); break; #endif case ELTIcon: #ifdef __SERIES60__ self = new (ELeave)CHcImageAknsIcon(); #endif #ifdef __UIQ__ self = new (ELeave)CHcImageUIQIcon(); #endif break; default: self = new (ELeave)CHcImageNull(); } self->iLocation = aLocation; self->Construct(); self->AddRef(); return self; } CHcImage::~CHcImage() { iSubscribers.Close(); } void CHcImage::Construct() { if(!iLocation.iValid) iError = KErrNotFound; else { TRAPD(error, ConstructL()); iError = error; } #ifdef __WINSCW__ if(iError) RDebug::Print(_L("CHcImage: load failed %i: %S"), iError, &iLocation.iFileName); #endif } void CHcImage::AddLoadedEventSubscriber(MImageLoadedEventSubscriber* aSubscriber) { TInt pos = iSubscribers.Find(aSubscriber); if(pos==KErrNotFound) iSubscribers.Append(aSubscriber); } void CHcImage::RemoveLoadedEventSubscriber(MImageLoadedEventSubscriber* aSubscriber) { TInt pos = iSubscribers.Find(aSubscriber); if(pos!=KErrNotFound) iSubscribers.Remove(pos); } TBool CHcImage::Refresh(TInt) { return EFalse; } TBool CHcImage::Draw(CBitmapContext& aGc, const TRect& aDestRect, THcDrawImageParams aParams) { if(iError || !iLoaded) return EFalse; aGc.SetBrushStyle(CGraphicsContext::ENullBrush); return DoDraw(aGc, aDestRect, aParams); } TBool CHcImage::Draw(CBitmapContext& aGc, const TPoint& aDestPos, THcDrawImageParams aParams) { return Draw(aGc, TRect(aDestPos, iSize), aParams); }
[ "gzytom@0e8b9480-e87f-11dd-80ed-bda8ba2650cd" ]
[ [ [ 1, 116 ] ] ]
c36b8bfc1d6c9a5baa7d4d9e0c2323612be92975
636990a23a0f702e3c82fa3fc422f7304b0d7b9e
/ocx/AnvizOcx/AnvizOcx/ProtocolTest/User.h
5786bc4cc5a66ed573c6e2e09bb9bf04302b54a0
[]
no_license
ak869/armcontroller
09599d2c145e6457aa8c55c8018514578d897de9
da68e180cacce06479158e7b31374e7ec81c3ebf
refs/heads/master
2021-01-13T01:17:25.501840
2009-02-09T18:03:20
2009-02-09T18:03:20
40,271,726
0
1
null
null
null
null
UTF-8
C++
false
false
671
h
// User.h: interface for the CUser class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_USER_H__77E14D8C_DBFA_4B48_90DC_A499F4F88614__INCLUDED_) #define AFX_USER_H__77E14D8C_DBFA_4B48_90DC_A499F4F88614__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "Controller.h" class CUser : public CController { public: BOOL GetGroup(BYTE *value,BYTE nSize); BOOL GetAttrib(BYTE node, BYTE *value); BOOL SetAttrib(BYTE node, BYTE value); CUser(DWORD nID,BYTE nGroup); virtual ~CUser(); }; #endif // !defined(AFX_USER_H__77E14D8C_DBFA_4B48_90DC_A499F4F88614__INCLUDED_)
[ "leon.b.dong@41cf9b94-d0c3-11dd-86c2-0f8696b7b6f9" ]
[ [ [ 1, 25 ] ] ]
1d62c0875d1ce0154f3edf9156f3e0c8242638f2
da48afcbd478f79d70767170da625b5f206baf9a
/tbmessage/src/stdafx.cpp
a76c323592073b134af0e3c0d29c7371e70c9cbd
[]
no_license
haokeyy/fahister
5ba50a99420dbaba2ad4e5ab5ee3ab0756563d04
c71dc56a30b862cc4199126d78f928fce11b12e5
refs/heads/master
2021-01-10T19:09:22.227340
2010-05-06T13:17:35
2010-05-06T13:17:35
null
0
0
null
null
null
null
GB18030
C++
false
false
172
cpp
// stdafx.cpp : 只包括标准包含文件的源文件 // tbmessage.pch 将作为预编译头 // stdafx.obj 将包含预编译类型信息 #include "stdafx.h"
[ "[email protected]@d41c10be-1f87-11de-a78b-a7aca27b2395" ]
[ [ [ 1, 8 ] ] ]
743ccdb15a14821a748a71f6055f18ca2217759b
f177993b13e97f9fecfc0e751602153824dfef7e
/ImProSln/TouchLibFilter/Touchlib/include/ICapture.h
84d4b8b1ab3f7664014942a76cd749d3c13dfa63
[]
no_license
svn2github/imtophooksln
7bd7412947d6368ce394810f479ebab1557ef356
bacd7f29002135806d0f5047ae47cbad4c03f90e
refs/heads/master
2020-05-20T04:00:56.564124
2010-09-24T09:10:51
2010-09-24T09:10:51
11,787,598
1
0
null
null
null
null
UTF-8
C++
false
false
256
h
#ifndef __TOUCHLIB_ICAPTURE__ #define __TOUCHLIB_ICAPTURE__ #include <Image.h> #include <touchlib_platform.h> namespace touchlib { class ICapture { public: virtual IBwImage *getFrame() = 0; }; } #endif // __TOUCHLIB_ICAPTURE__
[ "ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a" ]
[ [ [ 1, 17 ] ] ]
a2771c3a984659cf59bb6630ecc3026f710eaa26
406b4b18f5c58c689d2324f49db972377fe8feb6
/ANE/Source/Foundation/TimeManager.cpp
23e1969c566aa6b7a5abea40d260f908764e82d3
[]
no_license
Mobiwoom/ane
e17167de36699c451ed92eab7bf733e7d41fe847
ec20667c556a99351024f3ae9c8880e944c5bfbd
refs/heads/master
2021-01-17T13:09:57.966141
2010-03-23T16:30:17
2010-03-23T16:30:17
33,132,357
0
1
null
null
null
null
UHC
C++
false
false
1,209
cpp
#include "Foundation/TimeManager.h" #include "Ane/Ane/Iocp.h" namespace Ane { TimeManager::TimeManager() :Ane::Singleton<TimeManager>(RELEASE_LEVEL_2),m_isStart(FALSE) { Ane::Iocp::Instance()->CreateThread(1); this->Start(); } TimeManager::~TimeManager() { } void TimeManager::Start() { m_isStart = TRUE; Iocp::Instance()->PostIocp(this); } void TimeManager::Stop() { m_isStart = FALSE; } void TimeManager::Complete() { m_Lock.Enter(); if(TRUE == m_isStart) { Sleep(1);//TODO : 슬립 안부르고 cpu 점유율 내리는 방법을 찾아야 함 Iocp::Instance()->PostIocp(this); } m_Lock.Leave(); } void TimeManager::AttachTimer( Ane::Time* pTime, Ane::Timer* pTimer ) { m_Lock.Enter(); UNREFERENCED_PARAMETER(pTime); UNREFERENCED_PARAMETER(pTimer); m_Lock.Leave(); } void TimeManager::DetachTimer( Ane::Time* pTime ) { m_Lock.Enter(); // TODO : OnTimer에서 KillTimer부르면 문제 있을듯.ㅋ UNREFERENCED_PARAMETER(pTime); m_Lock.Leave(); } void TimeManager::AttachAlarm( Ane::Time* pTime, Ane::Timer* pTimer ) { UNREFERENCED_PARAMETER(pTime); UNREFERENCED_PARAMETER(pTimer); } }//namespace Ane
[ "inthejm@5abed23c-1faa-11df-9e62-c93c6248c2ac" ]
[ [ [ 1, 67 ] ] ]
5ba9947bb43de2d453c2897105ffbd2a8420db85
3d9e738c19a8796aad3195fd229cdacf00c80f90
/src/geometries/witness_2/Witness_2.h
806257a15d469284cf94b86d8271c53850f29245
[]
no_license
mrG7/mesecina
0cd16eb5340c72b3e8db5feda362b6353b5cefda
d34135836d686a60b6f59fa0849015fb99164ab4
refs/heads/master
2021-01-17T10:02:04.124541
2011-03-05T17:29:40
2011-03-05T17:29:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,751
h
/* This source file is part of Mesecina, a software for visualization and studying of * the medial axis and related computational geometry structures. * More info: http://www.agg.ethz.ch/~miklosb/mesecina * Copyright Balint Miklos, Applied Geometry Group, ETH Zurich * * $Id: Union_of_balls_2.h 737 2009-05-16 15:40:46Z miklosb $ */ #ifndef MESECINA_WITNESS_2_H #define MESECINA_WITNESS_2_H #include <geometries/Geometry.h> #include <list> #include <vector> #include <string> template <class K, int N = 2> class Witness_landmark_set_2; template <class K> // Kernel used in all computations class Witness_2 : public Geometry { public: typedef Witness_landmark_set_2<K> Witness_landmark_set; typedef typename Witness_landmark_set::Witness_triangulation Witness_triangulation; typedef typename K::Point_2 Point_2; typedef typename K::Vector_2 Vector_2; typedef typename K::FT Coord_type; typedef typename Witness_landmark_set::Witness_iterator Witness_iterator; typedef typename Witness_landmark_set::Landmark_list Landmark_list; typedef typename Witness_landmark_set::Witness_handle Witness_handle; typedef typename K::Segment_2 Segment_2; typedef typename K::Line_2 Line_2; typedef typename K::Ray_2 Ray_2; typedef typename Witness_landmark_set::Witness_complex_triangulation Witness_complex_triangulation; Witness_2(); virtual ~Witness_2(); virtual Geometry* clone(); // methods to communicate with other geometries virtual std::list<std::string> offer_structures(); virtual void* give_structure(const std::string& name); virtual void receive_structure_changed(const std::string& name); //// points communication with user interface //virtual void add_point(double x, double y); //virtual void add_points(std::list<QPointF>* points); //virtual std::list<QPointF>* get_points(); //// ball communication with user interface //virtual void add_weighted_point(Point3D point); //virtual void add_weighted_points(std::list<Point3D>* points); //virtual std::list<Point3D>* get_weighted_points(); // receive application settings changes virtual void application_settings_changed(const QString&); // modification for evolutions virtual void apply_modification(const std::string& ); Witness_landmark_set* get_witness_landmark_set(); Witness_complex_triangulation* get_witness_complex_triangulation(); void invalidate_cache(); private: // std::list<Vertex_handle> inserted_landmarks; Witness_landmark_set witness_landmark_set; //std::list<QPointF> points; bool has_points; //std::list<Point_2> witness_point_list; }; #endif //MESECINA_WITNESS_2_H
[ "balint.miklos@localhost" ]
[ [ [ 1, 82 ] ] ]
a83879623a8c49cd0af39c322ef871bc80b9ed24
5ac13fa1746046451f1989b5b8734f40d6445322
/minimangalore/Nebula2/code/mangalore/msg/movefollow.cc
7b6c608377b33ce085ac652b52bdd4f82b4c7d50
[]
no_license
moltenguy1/minimangalore
9f2edf7901e7392490cc22486a7cf13c1790008d
4d849672a6f25d8e441245d374b6bde4b59cbd48
refs/heads/master
2020-04-23T08:57:16.492734
2009-08-01T09:13:33
2009-08-01T09:13:33
35,933,330
0
0
null
null
null
null
UTF-8
C++
false
false
414
cc
//------------------------------------------------------------------------------ // msg/movefollow.cc // (C) 2005 Radon Labs GmbH //------------------------------------------------------------------------------ #include "msg/movefollow.h" namespace Message { ImplementRtti(Message::MoveFollow, Message::Msg); ImplementFactory(Message::MoveFollow); ImplementMsgId(MoveFollow); } // namespace Message
[ "BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 12 ] ] ]
fc13623da3de470bc5935507ddc04c70bb250b63
8a3fce9fb893696b8e408703b62fa452feec65c5
/priority_queue/priority_queue/TimerList.cpp
74ad7d5e7cf3f67c7398e32249d638e6d5adf8a4
[]
no_license
win18216001/tpgame
bb4e8b1a2f19b92ecce14a7477ce30a470faecda
d877dd51a924f1d628959c5ab638c34a671b39b2
refs/heads/master
2021-04-12T04:51:47.882699
2011-03-08T10:04:55
2011-03-08T10:04:55
42,728,291
0
2
null
null
null
null
GB18030
C++
false
false
2,501
cpp
#include "StdAfx.h" #include "TimerList.h" template<class type_name> CTimerList<type_name>::CTimerList(void) { m_pTimerArray = (tagTimerVar*)VirtualAlloc( NULL , sizeof(tagTimerVar) * MAX_TIMER_NUM , MEM_COMMIT ,PAGE_READWRITE ); for ( int count = 0 ; count < MAX_TIMER_NUM ; count ++ ) { m_pTimerArray[i].TimerId = count + 1; m_pTimerArray[i].Type = NULL; m_pTimerArray[i].StartTime=0; m_UnUsingList.AddNode( &m_pTimerArray[i] ); } } template<class type_name> CTimerList<type_name>::~CTimerList(void) { m_UnUsingList.ReleaseList(); m_UsingList.ReleaseList(); VirtualFree(m_pTimerArray,0,MEM_RELEASE); } template<class type_name> long CTimerList<type_name>::AddTimer(const type_name * arg, unsigned long stime, unsigned long interval) { sync::scope_guard sg ( m_section ); tagTimerVar * timeNode = m_UnUsingList.GetHead(); if ( timeNode != NULL ) { m_UnUsingList.RemoveNode( timeNode ); timeNode->pObj = arg; timeNode->StartTime = stime; timeNode->Interval = interval; m_UsingList.AddNode( tagTimerVar ); return timeNode->TimerId; } return 0; } /* * 执行定时器的元素 * 注:这样效率低下,查找需要O(n) */ template< class type_name > long CTimerList<type_name>::Expired(long CurrentTime) { sync::scope_guard sg ( m_section ); tagTimerVar * pRoot = m_UsingList.GetHead(); while ( pRoot ) { if ( (CurrentTime - pRoot->StartTime) >= pRoot->Interval ) { pRoot->pObj->Execute( pRoot ); if ( pRoot->Interval != 0 ) { AddTimer( pRoot->pObj, timeGetTime()+pRoot->Interval , Interval ); } RemoveTimer( pRoot ); return pRoot->TimerId; } pRoot = pRoot->next; } return 0; } template < class type_name > long CTimerList<type_name>::OnTimeOut(const type_name * arg) { return 0; } template < class type_name > bool CTimerList<type_name>::RelaseGameEndTimer(long id) { sync::scope_guard sg ( m_section ); tagTimerVar * pRoot = m_UsingList.GetHead(); while ( pRoot ) { if ( id == pRoot->TimerId ) { m_UsingList.RemoveNode ( pRoot ); m_UnUsingList.AddNode( pRoot ); return true ; } pRoot = pRoot->next; } return false; } template < class type_name > bool CTimerList<type_name>::RemoveTimer(tagTimerVar *node) { sync::scope_guard sg ( m_section ); m_UsingList.RemoveNode ( node ); m_UnUsingList.AddNode( node ); return true; }
[ [ [ 1, 118 ] ] ]
f63e8dfef58b99e3361b36f1f173c74b5e5ead66
c86338cfb9a65230aa7773639eb8f0a3ce9d34fd
/wxWidgets/ProgressListenerWx.cpp
535692230055d75da1d3954499ba9e367863eee1
[]
no_license
jonike/mnrt
2319fb48d544d58984d40d63dc0b349ffcbfd1dd
99b41c3deb75aad52afd0c315635f1ca9b9923ec
refs/heads/master
2021-08-24T05:52:41.056070
2010-12-03T18:31:24
2010-12-03T18:31:24
113,554,148
0
0
null
null
null
null
UTF-8
C++
false
false
3,118
cpp
//////////////////////////////////////////////////////////////////////////////////////////////////// // MNRT License //////////////////////////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2010 Mathias Neumann, www.maneumann.com. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // 2. 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. // // 3. Neither the name Mathias Neumann, nor the names of 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 OWNER 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 "ProgressListenerWx.h" #include "../MNUtilities.h" #include <wx/progdlg.h> ProgressListenerWx::ProgressListenerWx(wxWindow* pParent, const wxString& strTitle, const wxString& strMsg) { m_pParent = pParent; m_strTitle = strTitle; m_strMessage = strMsg; m_pDlg = NULL; } ProgressListenerWx::~ProgressListenerWx(void) { } void ProgressListenerWx::SetMaximum(int maxValue) { // Now we can initialize and show the progress dialog as we have a maximum value. m_pDlg = new wxProgressDialog(m_strTitle, m_strMessage, maxValue, m_pParent, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_REMAINING_TIME | wxPD_ELAPSED_TIME | wxPD_CAN_ABORT); } bool ProgressListenerWx::Update(int newValue, const std::string& strNewMessage/* = ""*/) { if(m_pDlg == NULL) MNFatal("Progress dialog initialization missing."); bool result = m_pDlg->Update(newValue, wxString(strNewMessage)); if(!result) { // Just destroy for now. Asking would be too much. m_pDlg->Destroy(); } // Yields control to pending messages in the windowing system. Also disables controls to // avoid illegal user input. wxSafeYield(); return result; }
[ [ [ 1, 73 ] ] ]
acfaa9a89dc3797f2e06ecb94f5a1269e3fc1127
e9d3e5a1b03dd94e740daa3ff64bd19a2059872a
/StarbuckLibrary/RIMWebPage.cpp
85e85ae94581ed59daa4f81380e6d252e0bd539b
[ "Apache-2.0" ]
permissive
nukulb/Ripple-Framework
3da8703f3d67963c58a89ffc95b217dde6a328eb
8f70f5bce6722f7019f1812405d30d3fff9c1ae3
refs/heads/master
2020-12-25T03:50:44.318582
2011-08-25T09:31:51
2011-08-25T10:41:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,145
cpp
/* * Copyright 2010-2011 Research In Motion Limited. * * 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 "RIMWebPage.h" #include <QDebug> RIMWebPage::RIMWebPage(QObject *parent) : QObject(parent) { _webView = 0; } RIMWebPage::~RIMWebPage(void) { } void RIMWebPage::SetWebView(RIMStageWebView *webView) { _webView = webView; } //bool RIMWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type) //{ // if(_webView) // return ((RIMStageWebView*)_webView)->LocationChanging(request, type); // // return true; //}
[ [ [ 1, 43 ] ] ]
63185adc949c6a6d09c498da01e80250b580b40f
925e7b0a9f5757cad97981b37c6af180c30b2f6e
/nntpServer/nntpServer/MsQeue.cpp
cf29d76e5370984fa07f5657774a45308d2194c9
[]
no_license
jmg/nttp-server
08c2b6be2183b00989c8e4ea35dffaef3947385a
0308abe74e793fe0c16676e797ae16150566e1d6
refs/heads/master
2016-09-05T10:53:25.116857
2011-07-16T01:28:32
2011-07-16T01:28:32
2,739,107
0
0
null
null
null
null
UTF-8
C++
false
false
1,893
cpp
#ifndef MsQeue_CPP #define MsQeue_CPP #define DllExport __declspec(dllexport) #include "Console.cpp" #include <windows.h> #include <string> #include <iostream> #import "mqoa.dll" no_namespace #include "Utils/Logs.h" using namespace std; class MsQeue { private: IMSMQQueuePtr qQueue; IMSMQQueueInfoPtr qInfo; IMSMQMessagePtr qMsg; public: MsQeue() { CoInitialize(NULL); OleInitialize(NULL); try { qInfo.CreateInstance("MSMQ.MSMQQueueInfo"); qMsg.CreateInstance("MSMQ.MSMQMessage"); qInfo->PathName = ".\\Private$\\myPrivateQueue"; LogFileLogEntry(MAINPROCESSNAME, NOTHREADID, LOGTYPEINFO, "Se creo la cola en: ", qInfo->PathName ); qInfo->Journal = 1; qInfo->Create(); qInfo->Refresh(); } catch (_com_error com) { LogFileLogEntry(MAINPROCESSNAME, NOTHREADID, LOGTYPEINFO, "", (char*)com.Description()); CoUninitialize(); } } void Insert(BSTR XmlNew) { qQueue = qInfo->Open(MQ_SEND_ACCESS, MQ_DENY_NONE); qMsg->Body = XmlNew; qMsg->Send(qQueue); LogFileLogEntry(MAINPROCESSNAME, NOTHREADID, LOGTYPEINFO, "Se inserto en la cola", (char*)XmlNew); } BSTR Get() { _variant_t timeOut((long)1000); _variant_t wantBody((bool)true); qQueue = qInfo->Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE); qMsg = qQueue->Receive(&vtMissing, &vtMissing, &wantBody, &timeOut); if (qMsg == NULL) { LogFileLogEntry(MAINPROCESSNAME, NOTHREADID, LOGTYPEINFO, "No hay mas mensajes en la cola", NOPARMS); return NULL; } LogFileLogEntry(MAINPROCESSNAME, NOTHREADID, LOGTYPEINFO, "Se saco de la cola ", (char*)qMsg->Body.bstrVal); return qMsg->Body.bstrVal; } ~MsQeue() { try { CoUninitialize(); } catch(exception) {} } }; #endif
[ "jmg.utn@208282a9-e914-21dd-f66b-6e6d9519d739" ]
[ [ [ 1, 78 ] ] ]
adb7f5cca1cc67beb1d3af2b14b29f61a2b05e19
7c05ad9a0266e5bb09230bd0f2e3427466eb83b7
/ wildcards/normalGame.cpp
03509adf1c6aa41b9b56d68346dae3427f682a02
[]
no_license
shachar-b/wildcards
cb6ac90020c97db78b201eac68d0ffc6b987729f
f09e88cc7f4b9c237d5e53146b46ebba6dc47a97
refs/heads/master
2021-01-10T04:15:31.248002
2011-01-03T19:10:02
2011-01-03T19:10:02
48,319,862
0
0
null
null
null
null
UTF-8
C++
false
false
2,201
cpp
#include "normalGame.h" //************************************ // Method: getNormalPlayerAt - returns a pointer the place player in the current game order or null if no such place // FullName: normalGame::getPlayerAt // Access: private // Returns: NormalPlayer *-a pointer the place player in the current game order NULL if no such place // Qualifier: // Parameter: unsigned int place- a number from 0 to the number of players -1 //************************************ NormalPlayer * normalGame::getNormalPlayerAt( unsigned int place ) { if (place>(m_players.size()-1))//no such place { return NULL; } else { return (NormalPlayer*)m_players[getUserPlace(place)];; } } //************************************ // Method: returnNameOfWinningPlayer - returns the name of the player with the highest score(or the last one if more then one) // FullName: normalGame::returnNameOfWinningPlayer // Access: private // Returns: const char * - the name of the player with the highest score // Qualifier: //************************************ const char * normalGame::returnNameOfWinningPlayer() { NormalPlayer * currPlayer=(NormalPlayer*)m_players[0]; NormalPlayer * next; for(unsigned int i=1;i<m_numberOfplayers; i++) { next=(NormalPlayer*)m_players[i]; if(next->getScore()>currPlayer->getScore()) { currPlayer=next; } } return currPlayer->getName(); } //************************************ // Method: initRound - Expands the base's initRound by plotting the correct game screen // FullName: normalGame::initRound // Access: private // Returns: void // Qualifier: //************************************ void normalGame::initRound() { Game::initRound(); UIs::UI::plotGameScreen(m_numberOfplayers); } //************************************ // Method: closeRound - Expands base's closeRound by calling the correct decideWinners. // FullName: normalGame::closeRound // Access: private // Returns: void // Qualifier: //************************************ void normalGame::closeRound() { decideWinners();//if more then one winner picks the last one Game::closeRound(); }
[ "darklinger@82b006e3-cfb3-7549-8677-63f1bdd51797", "blame.me@82b006e3-cfb3-7549-8677-63f1bdd51797" ]
[ [ [ 1, 43 ], [ 46, 52 ], [ 57, 69 ] ], [ [ 44, 45 ], [ 53, 56 ], [ 70, 70 ] ] ]
80e9c9bdeb59c09526b66454c00d3b63ef458302
374d23f6a603046a5299596fc59171dc1c6b09b4
/tensores/FltkImageViewer/fltkFrustumFunctionControlGUI.h
487cfd9dadc5c8991d513ebb8fa81c76e719b638
[]
no_license
mounyeh/tensorespablo
aa9b403ceef82094872e50f7ddd0cdd89b6b7421
f045a5c1e1decf7302de17f4448abbd284b3c2de
refs/heads/master
2021-01-10T06:09:53.357175
2010-09-19T22:57:16
2010-09-19T22:57:16
51,831,049
1
0
null
null
null
null
UTF-8
C++
false
false
2,474
h
// generated by Fast Light User Interface Designer (fluid) version 1.0107 #ifndef fltkFrustumFunctionControlGUI_h #define fltkFrustumFunctionControlGUI_h #include <FL/Fl.H> #include <FL/Fl_Double_Window.H> #include <FL/Fl_Value_Output.H> #include <FL/Fl_Adjuster.H> #include <FL/Fl_Box.H> #include <FL/Fl_Roller.H> class fltkFrustumFunctionControlGUI { public: fltkFrustumFunctionControlGUI(); Fl_Double_Window *controlWindow; Fl_Value_Output *angleZValueOutput; Fl_Adjuster *xAdjuster; private: void cb_xAdjuster_i(Fl_Adjuster*, void*); static void cb_xAdjuster(Fl_Adjuster*, void*); public: Fl_Value_Output *xValueOutput; Fl_Adjuster *yAdjuster; private: void cb_yAdjuster_i(Fl_Adjuster*, void*); static void cb_yAdjuster(Fl_Adjuster*, void*); public: Fl_Value_Output *yValueOutput; Fl_Adjuster *zAdjuster; private: void cb_zAdjuster_i(Fl_Adjuster*, void*); static void cb_zAdjuster(Fl_Adjuster*, void*); public: Fl_Value_Output *zValueOutput; Fl_Roller *angleZRoller; private: void cb_angleZRoller_i(Fl_Roller*, void*); static void cb_angleZRoller(Fl_Roller*, void*); public: Fl_Roller *apertureAngleXRoller; private: void cb_apertureAngleXRoller_i(Fl_Roller*, void*); static void cb_apertureAngleXRoller(Fl_Roller*, void*); public: Fl_Value_Output *apertureAngleXValueOutput; Fl_Roller *apertureAngleYRoller; private: void cb_apertureAngleYRoller_i(Fl_Roller*, void*); static void cb_apertureAngleYRoller(Fl_Roller*, void*); public: Fl_Value_Output *apertureAngleYValueOutput; Fl_Adjuster *topPlaneAdjuster; private: void cb_topPlaneAdjuster_i(Fl_Adjuster*, void*); static void cb_topPlaneAdjuster(Fl_Adjuster*, void*); public: Fl_Value_Output *topPlaneValueOutput; Fl_Value_Output *bottomPlaneValueOutput; Fl_Adjuster *bottomPlaneAdjuster; private: void cb_bottomPlaneAdjuster_i(Fl_Adjuster*, void*); static void cb_bottomPlaneAdjuster(Fl_Adjuster*, void*); public: virtual ~fltkFrustumFunctionControlGUI(); virtual void SetAngleZ( double radius ); virtual void SetApexX( double x ); virtual void SetApexY( double y ); virtual void SetApexZ( double z ); virtual void Show(void); virtual void Hide(void); virtual void SetApertureAngleX( double radius ); virtual void SetApertureAngleY( double radius ); virtual void SetBottomPlane( double radius ); virtual void SetTopPlane( double radius ); }; #endif
[ "diodoledzeppelin@9de476db-11b3-a259-9df9-d52a56463d6f" ]
[ [ [ 1, 76 ] ] ]
f71d59159e5bfa5fa14d036d0cc3bd5f6219fc43
cd387cba6088f351af4869c02b2cabbb678be6ae
/lib/geometry/algorithms/distance.hpp
7bdfe8c79386e75c79d1c3d9d1e0319d1d3e879b
[ "BSL-1.0" ]
permissive
pedromartins/mew-dev
e8a9cd10f73fbc9c0c7b5bacddd0e7453edd097e
e6384775b00f76ab13eb046509da21d7f395909b
refs/heads/master
2016-09-06T14:57:00.937033
2009-04-13T15:16:15
2009-04-13T15:16:15
32,332,332
0
0
null
null
null
null
UTF-8
C++
false
false
6,635
hpp
// Geometry Library // // Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands. // Copyright Bruno Lalande 2008 // 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) #ifndef _GEOMETRY_DISTANCE_HPP #define _GEOMETRY_DISTANCE_HPP #include <cmath> #include <iterator> #include <geometry/geometries/segment.hpp> #include <geometry/strategies/strategy_traits.hpp> #include <geometry/util/promotion_traits.hpp> /*! \defgroup distance distance: distance calculation algorithms The distance algorithm returns the distance between two geometries. The distance is always returned as a double type, regardless of the input type, because the distance between integer coordinates is a square root and might be a double. \note All primary distance functions return a std::pair<double, bool> with (distance, squared) if squared=true, it is the squared distance, otherwise it is the distance. This is for efficiency, often distance is used for comparisons only and then squared is OK. However, some algorithms such as great circle do NOT use sqrt in their formula and then it is not necessary to first calculate the sqr and lateron take the sqrt */ namespace geometry { /*! \brief Utility selecting the most appropriate coordinate type. \ingroup utility \note Still to be moved to another file */ template <typename PC1, typename PC2> struct select_coordinate_type { typedef typename select_type_traits< typename support::coordinate<PC1>::type, typename support::coordinate<PC2>::type >::type type; }; namespace impl { namespace distance { template <typename P1, typename P2, typename S> inline BOOST_CONCEPT_REQUIRES(((ConstPoint<P1>)) ((ConstPoint<P2>)), (distance_result)) point_to_point(const P1& p1, const P2& p2, const S& strategy) { return strategy(p1, p2); } template<typename P, typename IT, typename S> inline BOOST_CONCEPT_REQUIRES(((ConstPoint<P>)) ((ConstPoint<typename std::iterator_traits<IT>::value_type>)), (distance_result)) point_to_iterator_pair(const P& p, IT begin, IT end, const S& strategy) { typedef typename select_coordinate_type<P, typename std::iterator_traits<IT>::value_type>::type T; if (begin == end) { return distance_result(0, false); } // line of one point: return point square_distance IT it = begin; IT prev = it++; if (it == end) { typename S::distance_strategy_type pp; return pp(p, *begin); } typedef segment<const typename std::iterator_traits<IT>::value_type> CS; // start with first segment distance typename strategy_traits<P>::point_segment_distance f2; distance_result d = f2(p, CS(*prev, *it)); // check if other segments are closer prev = it++; while(it != end) { distance_result ds = f2(p, CS(*prev, *it)); if (ds.first <= std::numeric_limits<double>::epsilon()) { return distance_result(0, false); } else if (ds.first < d.first) { d = ds; } prev = it++; } return d; } } // namespace distance } // namespace impl /*! \brief Calculate distance between two points \ingroup distance \details This version of distance calculates the distance between two points, using the specified strategy \param p1 first point \param p2 second point \param strategy strategy to calculate distance between two points \return the distance \par Example: Example showing distance calculation of two lat long points, using the accurate Vincenty approximation \dontinclude doxygen_examples.cpp \skip example_distance_point_point_strategy \line { \until } */ template <typename P1, typename P2, typename S> inline double distance(const P1& p1, const P2& p2, const S& strategy) { distance_result result = impl::distance::point_to_point(p1, p2, strategy); return result.value(); } /*! \brief Calculate distance between two points \ingroup distance \details This version of distance calculates the distance between two points, using the default distance-calculation-strategy \param p1 first point \param p2 second point \return the distance \note The two point may be of different types, if there is a strategy_traits specialization for this type combination \par Example: Example showing distance calculation of two points, in xy and in latlong coordinates \dontinclude doxygen_examples.cpp \skip example_distance_point_point \line { \until } */ template <typename P1, typename P2> inline double distance(const P1& p1, const P2& p2) { return distance(p1, p2, typename strategy_traits<P1, P2>::point_distance()); } /*! \brief Calculate distance between a point and a linestring (iterator pair) \ingroup distance \details This version of distance calculates the distance between a point and a line-string, using the specified strategy \param p point \param begin start of the linestring \param end end of the linestring \param strategy strategy to calculate distance of point to segment \return the distance \note The point might be of another type the points in the iterator pair (if the specified strategy allows this) \note The strategy might implement an enclosed point-point distance strategy */ template<typename P, typename IT, typename S> inline double distance(const P& p, IT begin, IT end, const S& strategy) { distance_result result = impl::distance::point_to_iterator_pair(p, begin, end, strategy); return result.value(); } /*! \brief Calculate distance between a point and a linestring (iterator pair) \ingroup distance \details This version of distance calculates the distance between a point and a line-string, using the default strategy \param p point \param begin start of the linestring \param end end of the linestring \return the distance \note The point might be of another type the points in the iterator pair (if there is a strategy_traits specialization for this type combination) */ template<typename P, typename IT> inline double distance(const P& p, IT begin, IT end) { return distance(p, begin, end, typename strategy_traits<P, typename std::iterator_traits<IT>::value_type>::point_segment_distance()); } } // namespace geometry #endif // _GEOMETRY_DISTANCE_HPP
[ "fushunpoon@1fd432d8-e285-11dd-b2d9-215335d0b316" ]
[ [ [ 1, 201 ] ] ]
2dc5f26dfce6985ef820ba1ece574ee97c76ec5c
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Application/SysCAD/ChildFrm.cpp
e93abddb04ae02016d177b8f35f1ed445ccf683c
[]
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,533
cpp
// ChildFrm.cpp : implementation of the CChildFrame class // #include "stdafx.h" #include "SysCAD.h" #include "ChildFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CChildFrame IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) //{{AFX_MSG_MAP(CChildFrame) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CChildFrame construction/destruction CChildFrame::CChildFrame() { // TODO: add member initialization code here } CChildFrame::~CChildFrame() { } BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs if( !CMDIChildWnd::PreCreateWindow(cs) ) return FALSE; return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CChildFrame diagnostics #ifdef _DEBUG void CChildFrame::AssertValid() const { CMDIChildWnd::AssertValid(); } void CChildFrame::Dump(CDumpContext& dc) const { CMDIChildWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CChildFrame message handlers
[ [ [ 1, 70 ] ] ]
c8090384b55ad04d0387e0933bb7a4e951d3f12e
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Physics/Collide/Query/Collector/BodyPairCollector/hkpFlagCdBodyPairCollector.h
215f73b02e6d35d6432e4e07ddf9191ee66c0108
[]
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
2,214
h
/* * * 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. * */ #ifndef HK_FLAG_CD_BODY_PAIR_COLLECTOR_H #define HK_FLAG_CD_BODY_PAIR_COLLECTOR_H #include <Physics/Collide/Agent/Query/hkpCdBodyPairCollector.h> /// hkpFlagCdBodyPairCollector collects only a boolean flag, indicating whether there is a hit or not /// It is useful if you want to simply know whether two objects (where one or both are shape collections) /// are overlapping or not. class hkpFlagCdBodyPairCollector : public hkpCdBodyPairCollector { public: HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_AGENT, hkpFlagCdBodyPairCollector); /// Constructor calls reset(). inline hkpFlagCdBodyPairCollector(); inline virtual ~hkpFlagCdBodyPairCollector(); /// This function returns true if this class has collected a hit. inline hkBool hasHit( ) const; protected: virtual void addCdBodyPair( const hkpCdBody& bodyA, const hkpCdBody& bodyB ); }; #include <Physics/Collide/Query/Collector/BodyPairCollector/hkpFlagCdBodyPairCollector.inl> #endif //HK_FLAG_CD_BODY_PAIR_COLLECTOR_H /* * 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 ] ] ]
1ad46be8ba08d31580119b72aa84ef18ab118330
971b000b9e6c4bf91d28f3723923a678520f5bcf
/GraphicsViewEdit/qtextdocument_parse/xmlhighlighter.h
9cf466ab7d3a798e323f83fad413f0bb71a241f4
[]
no_license
google-code-export/fop-miniscribus
14ce53d21893ce1821386a94d42485ee0465121f
966a9ca7097268c18e690aa0ea4b24b308475af9
refs/heads/master
2020-12-24T17:08:51.551987
2011-09-02T07:55:05
2011-09-02T07:55:05
32,133,292
2
0
null
null
null
null
UTF-8
C++
false
false
3,191
h
#ifndef XMLHIGHLIGHTER_H #define XMLHIGHLIGHTER_H #include <QSyntaxHighlighter> #include <QTextCharFormat> #include <QColor> #include <QTextEdit> #include <QtCore> #include <QtGui> #include <QtGui> #include <QtCore> #include <QWidget> #include <QPair> #include <QTextDocument> #include <QPair> #include <QMap> #include <QDateTime> #include <QFile> #include <QtCore> #include <QCoreApplication> #include <iostream> #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <QInputDialog> #include <QMenu> #include <QString> #include <QtDebug> #include <QDebug> #include <QDesktopServices> #include <QDebug> #include <QString> #include <QMap> #include <QList> #include <QStringList> #include <QObject> #include <QDateTime> #include <QDate> #include <QImageReader> #include <QPixmap> #include <QSettings> #include <QTimer> #include <QProgressDialog> #include <QPainter> #include <QPixmap> #include <QUrl> #include <QColorDialog> #include <QMessageBox> #include <QWorkspace> #include <QDomDocument> #include <QtDebug> #include <QDebug> #include <QSettings> #include <QDomDocument> #include <QDomElement> #include <QDomImplementation> #include <QDomProcessingInstruction> #include <QFile> #include <QTextCodec> #include <QString> #include <QTextDocument> #include <QTextCursor> #include <QTextBrowser> #include <QTextBlockFormat> #include <QTextFrame> #include <QTextTable> class XmlHighlighter : public QSyntaxHighlighter { public: XmlHighlighter(QObject* parent); XmlHighlighter(QTextDocument* parent); XmlHighlighter(QTextEdit* parent); ~XmlHighlighter(); enum HighlightType { SyntaxChar, ElementName, Comment, AttributeName, AttributeValue, Error, Other }; void setHighlightColor(HighlightType type, QColor color, bool foreground = true); void setHighlightFormat(HighlightType type, QTextCharFormat format); protected: void highlightBlock(const QString& rstrText); int processDefaultText(int i, const QString& rstrText); private: void init(); QTextCharFormat fmtSyntaxChar; QTextCharFormat fmtElementName; QTextCharFormat fmtComment; QTextCharFormat fmtAttributeName; QTextCharFormat fmtAttributeValue; QTextCharFormat fmtError; QTextCharFormat fmtOther; enum ParsingState { NoState = 0, ExpectElementNameOrSlash, ExpectElementName, ExpectAttributeOrEndOfElement, ExpectEqual, ExpectAttributeValue }; enum BlockState { NoBlock = -1, InComment, InElement }; ParsingState state; }; class XMLTextEdit : public QTextEdit { Q_OBJECT // public: XMLTextEdit( QWidget * parent = 0 ); bool Conform(); QDomDocument xml_document(); inline QString text() const { return QTextEdit::toPlainText(); } QMenu *createOwnStandardContextMenu(); protected: void contextMenuEvent ( QContextMenuEvent * e ); bool event( QEvent *event ); private: XmlHighlighter *highlight; signals: public slots: void Syntaxcheck(); void setPlainText( const QString txt ); }; #endif // XMLHIGHLIGHTER_H
[ "ppkciz@9af58faf-7e3e-0410-b956-55d145112073" ]
[ [ [ 1, 172 ] ] ]
8ac752d11183ad9ea7f24b4127673f5ee8704de9
8a8873b129313b24341e8fa88a49052e09c3fa51
/inc/ContentListCacheSettingWindow.h
59743ec216c875f915bef1500661d8bad9c53214
[]
no_license
flaithbheartaigh/wapbrowser
ba09f7aa981d65df810dba2156a3f153df071dcf
b0d93ce8517916d23104be608548e93740bace4e
refs/heads/master
2021-01-10T11:29:49.555342
2010-03-08T09:36:03
2010-03-08T09:36:03
50,261,329
1
0
null
null
null
null
GB18030
C++
false
false
1,932
h
/* ============================================================================ Name : ContentListCacheSettingWindow.h Author : smallcat Version : Copyright : Your copyright notice Description : CContentListCacheSettingWindow declaration ============================================================================ */ #ifndef CONTENTLISTCACHESETTINGWINDOW_H #define CONTENTLISTCACHESETTINGWINDOW_H // INCLUDES #include "Window.h" #include "DialogObserver.h" class CSelectGroup; class CMainEngine; class CFileReadByRow; // CLASS DECLARATION /** * CContentListCacheSettingWindow * */ class CContentListCacheSettingWindow : public CWindow,public MDialogObserver { public: // Constructors and destructor ~CContentListCacheSettingWindow(); static CContentListCacheSettingWindow* NewL(CWindow* aParent,CMainEngine& aMainEngine); static CContentListCacheSettingWindow* NewLC(CWindow* aParent,CMainEngine& aMainEngine); private: CContentListCacheSettingWindow(CWindow* aParent,CMainEngine& aMainEngine); void ConstructL(); public://From CWindow //派生类实现激活视图 virtual void DoActivateL(); //派生类实现冻结视图 virtual void DoDeactivate(); //派生类实现绘图 virtual void DoDraw(CGraphic& aGraphic)const; //派生类实现按键事件响应 virtual TBool DoKeyEventL(TInt aKeyCode); //派生类实现命令事件响应 virtual TBool DoHandleCommandL(TInt aCommand); //派生类实现界面尺寸改变 virtual void DoSizeChanged(); //派生类实现设置左右按钮,以便覆盖按钮的控件返回时回复原样 virtual void ChangeButton(); public://From MDialogObserver virtual void DialogEvent(TInt aCommand); private: void InitSelectGroup(); private: CSelectGroup* iSelectGroup; CMainEngine& iMainEngine; CFileReadByRow* iRes; }; #endif // CONTENTLISTCACHESETTINGWINDOW_H
[ "sungrass.xp@37a08ede-ebbd-11dd-bd7b-b12b6590754f" ]
[ [ [ 1, 70 ] ] ]
7a3e56ca084e31fb3d675739ddd0e9647bfe94f0
ec4c161b2baf919424d8d21cd0780cf8065e3f69
/Velo/Source/Embedded Controller/arduino/NMEA.cpp
1b4a4b0253e75a55d0664bf396a376442cfe3f12
[]
no_license
jhays200/EV-Tracking
b215d2a915987fe7113a05599bda53f254248cfa
06674e6f0f04fc2d0be1b1d37124a9a8e0144467
refs/heads/master
2016-09-05T18:41:21.650852
2011-06-04T01:50:25
2011-06-04T01:50:25
1,673,213
2
0
null
null
null
null
UTF-8
C++
false
false
8,480
cpp
#include "NMEA.h" /****************************************************************************** * Constants *****************************************************************************/ /****************************************************************************** * Methods *****************************************************************************/ //Constructor NMEA::NMEA() { c = 0; Checksum = 0; StrChecksum = 0; ChecksumIn = false; Status = false; } float ParseToFloat(char* field, unsigned int field_size, char stop_char, unsigned int parse_size ) { char* b = new char[field_size+1]; unsigned int copied = 0; //Copy the chars until a stop. while( field[copied] && field[copied] != stop_char && copied <= field_size ) { b[copied++] = field[copied]; } //Check if( field_size < copied ) return -1; //Place the null at the end of the string b[parse_size] = '\0'; //Perform the conversion float value = atof(b); //Delete the buffer delete b; //Return the value return value; } int ParseToInt(char* field, unsigned int field_size, char stop_char, unsigned int parse_size ) { char* b = new char[field_size+1]; unsigned int copied = 0; //Copy the chars until a stop. while( field[copied] && field[copied] != stop_char && copied <= field_size ) { b[copied++] = field[copied]; } //Check if( field_size < copied ) return -1; //Place the null at the end of the string b[parse_size] = '\0'; //Perform the conversion int value = atoi(b); //Delete the buffer delete b; //Return the value return value; } bool NMEA::Parse(char read) { switch(read) { case '$': //Null the pointers ChecksumIn = false; Checksum = 0; StrChecksum = 0; c = 0; break; default: sentence[c++] = read; if(ChecksumIn) { if(!StrChecksum) StrChecksum = 16 * ((read >= '0' && read <= '9') ? ( read - 48 ) : ( read - 65 + 10 )); else StrChecksum += ((read >= '0' && read <= '9') ? ( read - 48 ) : ( read - 65 + 10 )); } else if(read != ',') Checksum ^= read; break; case '*': sentence[c++] = read; ChecksumIn = true; break; case '\r': sentence[c++] = '\0'; break; case '\n': if(Checksum == StrChecksum) { //Switch on hash value of NMEA sentance name EX GPGGA = 287(P+G+G+A) switch( sentence[1] + sentence[2] + sentence[3] + sentence[4] ) { //TODO: Switch over to ENUMS in future to avoid magic numbers case 287: ParseGPGGA(sentence); break; case 299: ParseGPGSA(sentence); break; case 320: ParseGPGSV(sentence); break; case 306: ParseGPRMC(sentence); break; case 296: //GPRMB Not Implemented; break; default: /*Serial.print("Parse Failed: "); Serial.print(sentence[0]); Serial.print(sentence[1]); Serial.print(sentence[2]); Serial.print(sentence[3]); Serial.print(sentence[4]); Serial.print(sentence[5]); Serial.println( sentence[2] + sentence[3] + sentence[4] + sentence[5] , DEC );*/ break; } } else { //TODO: Report bad checksum here } break; } //VS2008 code - Have to return something in VS2008 return false; } //Global Positioning System Fix Data bool NMEA::ParseGPGGA(char* s) //287 { while(*s != ',') s++; s++; char tempBuffer[10]; int tempNum(0); int degrees; float minutes; //Hours tempBuffer[0] = *s++; tempBuffer[1] = *s++; tempBuffer[2] = 0; timestamp.hour = atoi(tempBuffer); //Minutes tempBuffer[0] = *s++; tempBuffer[1] = *s++; tempBuffer[2] = 0; timestamp.minute = atoi(tempBuffer); //Seconds tempBuffer[0] = *s++; tempBuffer[1] = *s++; tempBuffer[2] = 0; timestamp.second = atoi(tempBuffer); s++; //latitude - Degrees tempBuffer[0] = *s++; tempBuffer[1] = *s++; tempBuffer[2] = 0; degrees = atoi(tempBuffer); //latitude - Minutes tempNum = 0; while(*s != ',') { tempBuffer[tempNum] = *s++; tempNum++; } tempBuffer[tempNum] = 0; //TODO: This will cause small rounding errors here minutes = atof(tempBuffer); s++; if(*s++ != 'N') { degrees *= -1; minutes *= -1; } s++; //TODO: Verify this formulas accuracy Latitude = minutes/60 + degrees; //Longitude - Degrees tempBuffer[0] = *s++; tempBuffer[1] = *s++; tempBuffer[2] = 0; Direction = atoi(tempBuffer); //Longitude - Minutes tempNum = 0; while(*s != ',') { tempBuffer[tempNum] = *s++; tempNum++; } tempBuffer[tempNum] = 0; //TODO: This will cause small rounding errors here minutes = atof(tempBuffer); s++; if(*s++ != 'N') { degrees *= -1; minutes *= -1; } s++; //TODO: Verify this formulas accuracy Latitude = minutes/60 + degrees; tempBuffer[0] = *s++; tempBuffer[1] = 0; gpsQuality = atoi(tempBuffer); s++; tempBuffer[0] = *s++; tempBuffer[1] = *s++; tempBuffer[2] = 0; sateliteCount = atoi(tempBuffer); s++; //EMBEDDED CODE //Serial.println(s); return false; } //GPS DOP and Active Satellites bool NMEA::ParseGPGSA(char* s) //299 { //EMBEDDED CODE //Serial.println(s); return false; } //GPS Satellites in View bool NMEA::ParseGPGSV(char* s) //320 { //EMBEDDED CODE //Serial.println(s); return false; } //Recommended Minimum Specific GPS/TRANSIT Data bool NMEA::ParseGPRMC(char* sentence) //306 { //char buffer[16]; //int index = 0; //char * token; ////timestamp time hh //token = strtok (sentence, ",* "); //timestamp.hour = ParseToInt( &token[0], 2 ); ////timestamp time mm //timestamp.minute = ParseToInt( &token[2], 2 ); ////timestamp time ss.s //timestamp.second = ParseToInt( &token[4], 2 ); // ////latitude dddmm.mmmmm //token = strtok (NULL, ","); //timestamp.hour = ParseToInt( &token[0], 11 ); // case 2: // Status flag already used. // break; // case 3: // LAT // if( strlen(token) == 11 ) //dddmm.mmmmm // { // memcpy(buffer, &token[0],3); // buffer[3] = '\0'; // latitude = atof(buffer); // memcpy(buffer, &token[3],8); // buffer[8] = '\0'; // latitude += atof(buffer)/60; // } // else if( strlen(token) == 10 ) //ddmm.mmmmm // { // memcpy(buffer, &token[0],2); // buffer[2] = '\0'; // latitude = atof(buffer); // memcpy(buffer, &token[2],8); // buffer[8] = '\0'; // latitude += atof(buffer)/60; // } // break; // case 4: // LAT N/S // if( token[0] == 'S' ) // latitude *= -1; // break; // case 5: // LONG // if( strlen(token) == 11 ) //dddmm.mmmmm // { // memcpy(buffer, &token[0],3); // buffer[3] = '\0'; // Longitude = atof(buffer); // memcpy(buffer, &token[3],8); // buffer[8] = '\0'; // Longitude += atof(buffer)/60; // } // else if( strlen(token) == 10 ) //ddmm.mmmmm // { // memcpy(buffer, &token[0],2); // buffer[2] = '\0'; // Longitude = atof(buffer); // memcpy(buffer, &token[2],8); // buffer[8] = '\0'; // Longitude += atof(buffer)/60; // } // break; // case 6: // LONG E/W // if( token[0] == 'W' ) // Longitude *= -1; // break; // case 7: // Speed over ground // if( strlen(token) == 6 ) // { // memcpy(buffer, &token[0],6); // buffer[6] = '\0'; // Speed = atof(buffer) * 1.15077945; // } // break; // case 8: // Course over ground // if( strlen(token) == 5 ) // { // memcpy(buffer, &token[0],5); // buffer[5] = '\0'; // Heading = atof(buffer); // } // break; // case 9: // Date ddmmyy // if( strlen(token) == 6 ) // { // memcpy(buffer, &token[0],2); // buffer[2] = '\0'; // timestamp.day = atoi(buffer); // memcpy(buffer, &token[2],2); // buffer[2] = '\0'; // timestamp.month = atoi(buffer); // memcpy(buffer, &token[4],2); // buffer[2] = '\0'; // timestamp.year = atoi(buffer); // } // break; // case 10: // Magnetic Variation // if( strlen(token) == 5 ) // { // memcpy(buffer, &token[0],5); // buffer[5] = '\0'; // Declination = atof(buffer); // } // break; // case 11: // Magnetic Variation Direction // if( token[0] == 'E' ) // Declination *= -1; // break; // } // token = strtok (NULL, ","); // index++; //} return true; }
[ [ [ 1, 416 ] ] ]
1325bfd9dac3cc99ec226d4dfc3dcf70db237247
5efa73a9fbbc10a5b8e63704a640faf8aa365f93
/ zapmanager --username Devon.ScottTunkin/ZapManagerData.cpp
6ac1db2b4c4d62321abac278c7f93202b991775e
[]
no_license
abhay123lp/zapmanager
4529fabbd1acce1ecadea4078df166982aae698f
343e26ecf7cc6d05f5e638550a9e37b20e844fc9
refs/heads/master
2021-01-10T14:43:45.096277
2009-06-26T04:44:06
2009-06-26T04:44:06
46,339,704
0
0
null
null
null
null
UTF-8
C++
false
false
2,739
cpp
#include "ZapManagerData.h" //std #include <string> using namespace std; //wxWidgets #include <wx/filename.h> FileProperties::FileProperties( wxString name, wxString size, wxString hash ) { my_properties[0] = name; my_properties[1] = size; my_properties[2] = hash; } FileProperties::FileProperties() { my_properties[0] = "New File"; my_properties[1] = "0"; my_properties[2] = ""; } FileProperties& FileProperties::operator=( const FileProperties &RhData ) { this->my_properties[0] = RhData.my_properties[0]; this->my_properties[1] = RhData.my_properties[1]; this->my_properties[2] = RhData.my_properties[2]; return *this; } bool FileProperties::operator==(const FileProperties &RhData) const { if( this->my_properties[0] != RhData.my_properties[0] || this->my_properties[1] != RhData.my_properties[1] || this->my_properties[2] != RhData.my_properties[2] ) { return false; } else return true; } //Compare strings for limited alphabetizing and speeding up comparisons bool FileProperties::operator<(const FileProperties &RhData) const { if( this->my_properties[0] < RhData.my_properties[0] ) return true; else return false; } void FileProperties::compare_with( const FileProperties &RhData ) { if( this->operator==( RhData ) ) my_status = 'm'; if( this->my_properties[0] != RhData.my_properties[0] && this->my_properties[1] == RhData.my_properties[1] && this->my_properties[2] == RhData.my_properties[2] ) { my_status = 'n'; } else my_status = 'u'; } wxString FileProperties::get_property(const int i) const { if (i >= 0 && i < 3) return my_properties[i]; else { throw "Data request out of bounds"; //wxMessageBox( _("Data request out of bounds") ); //return "Data request out of bounds"; } } void FileProperties::set_property( const int i, const wxString str ) { my_properties[i] = str; } char FileProperties::get_status() const { return my_status; } void FileProperties::load_from_dir( wxString file_name, wxString dir_name, HashTransformation &hash_type ) { set_property( 0, file_name ); wxFileName file_attributes( dir_name, file_name ); wxULongLong file_size = file_attributes.GetSize(); set_property( 1, _( file_size.ToString() ) ); string file_hash; FileSource convert_to_hash( file_attributes.GetFullPath(), true, new HashFilter( hash_type, new HexEncoder( new StringSink( file_hash ) ) ) ); set_property( 2, file_hash ); }
[ "Devon.ScottTunkin@628a09a6-0380-11de-ada4-5153b8187bf2" ]
[ [ [ 1, 96 ] ] ]
4bb287618049c0a5efbf61a3edeb18914bd5bae5
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/tags/techdemo2/engine/script/include/ScriptObjectMarker.h
82adcc75fd69a1e13ba8b05a771301a2137d2e7b
[ "ClArtistic", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jacmoe/dsa-hl-svn
55b05b6f28b0b8b216eac7b0f9eedf650d116f85
97798e1f54df9d5785fb206c7165cd011c611560
refs/heads/master
2021-04-22T12:07:43.389214
2009-11-27T22:01:03
2009-11-27T22:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,739
h
/* This source file is part of Rastullahs Lockenpracht. * Copyright (C) 2003-2005 Team Pantheon. http://www.team-pantheon.de * * This program is free software; you can redistribute it and/or modify * it under the terms of the Clarified Artistic License. * * 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 * Clarified Artistic License for more details. * * You should have received a copy of the Clarified Artistic License * along with this program; if not you can get it here * http://www.jpaulmorrison.com/fbp/artistic2.htm. */ #ifndef __ScriptObjectMarker_H__ #define __ScriptObjectMarker_H__ #include "ScriptPrerequisites.h" #include <OgreSingleton.h> #include <map> #include <OgreNoMemoryMacros.h> #include "FixRubyHeaders.h" #include <ruby.h> #include "FixRubyHeaders.h" #include <OgreMemoryMacros.h> #include "ScriptWrapper.h" namespace rl { class _RlScriptExport ScriptObjectMarker : protected Ogre::Singleton<ScriptObjectMarker>, protected ScriptWrapperInstance { public: ScriptObjectMarker(); ~ScriptObjectMarker(); static ScriptObjectMarker& getSingleton(); static ScriptObjectMarker* getSingletonPtr(); virtual void owned( void* ptr ); virtual void disowned( void* ptr ); virtual void deleted( void* ptr ); private: typedef std::map<VALUE,unsigned int> ValueCountMap; typedef std::pair<VALUE,unsigned int> ValueCountPair; ValueCountMap m_RubyRefCountMap; VALUE mRubyArray; }; } #endif
[ "tanis@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 58 ] ] ]
2a1a272b6385e88cc8a681111c20487a387bba67
fceff9260ff49d2707060241b6f9b927b97db469
/ZombieGentlemen_SeniorProject/turret.cpp
a01ebc81e5bea2a16db348769fbd55f274b2441d
[]
no_license
EddyReyes/gentlemen-zombies-senior-project
9f5a6be90f0459831b3f044ed17ef2f085bec679
d88458b716c6eded376b3d44b5385c80deeb9a16
refs/heads/master
2021-05-29T12:13:47.506314
2011-07-04T17:20:38
2011-07-04T17:20:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,511
cpp
#include "turret.h" turret::turret() { type = entityTurret; turretTimer = 5; state = fortyFiveRight; wallState = faceUp; bullets = NULL; bulletIterator = 0; } turret::~turret() { if(bullets) { destroyProjectiles(); } } void turret::update(float timePassed) { turretTimer += timePassed; if(turretTimer >= 5.0f) { animate(); for(int i = 0; i< numProjectiles; i++) { bullets[i].setDirection(int(wallState), int(state)); bullets[i].reset(); } turretTimer = 0; bulletIterator = 0; } else { if((turretTimer >= 0.5f * bulletIterator) && (bulletIterator < numProjectiles)) { bullets[bulletIterator].fire(); bulletIterator++; } for(int i = 0; i< numProjectiles; i++) { bullets[i].update(timePassed); } } } void turret::animate() { switch(wallState) { case faceRight: switch(state) { case fortyFiveRight: m_object->setSprite(2, 1); state = ninety; break; case ninety: m_object->setSprite(2, 0); state = fortyFiveLeft; break; case fortyFiveLeft: m_object->setSprite(2, 2); state = fortyFiveRight; break; } break; case faceDown: switch(state) { case fortyFiveRight: m_object->setSprite(0, 1); state = ninety; break; case ninety: m_object->setSprite(0, 2); state = fortyFiveLeft; break; case fortyFiveLeft: m_object->setSprite(0, 0); state = fortyFiveRight; break; } break; case faceUp: switch(state) { case fortyFiveRight: m_object->setSprite(1, 1); state = ninety; break; case ninety: m_object->setSprite(1, 0); state = fortyFiveLeft; break; case fortyFiveLeft: m_object->setSprite(1, 2); state = fortyFiveRight; break; } break; case faceLeft: switch(state) { case fortyFiveRight: m_object->setSprite(3, 1); state = ninety; break; case ninety: m_object->setSprite(3, 0); state = fortyFiveLeft; break; case fortyFiveLeft: m_object->setSprite(3, 2); state = fortyFiveRight; break; } break; } } void turret::reset() { alive = true; armor = false; } void turret::setWall(char side) { // if turret is on a top wall it is facing down if(side == 'd'){wallState = faceDown;} // if turret is on a bottom wall then it is facing up if(side == 'u'){wallState = faceUp;} // if turret is on a left wall then it is facing right if(side == 'r'){wallState = faceRight;} // if turret is on a right wall then it is facing left if(side == 'l'){wallState = faceLeft;} } void turret::setProjectiles(object ** a_projectiles, int a_numProjectiles) { numProjectiles = a_numProjectiles; // set objects for projectiles bullets = new projectile[numProjectiles]; for(int i = 0; i < numProjectiles; i++) { if(a_projectiles[i]) { // toggle collision for projectiles so they can move through each other a_projectiles[i]->toggleCollision(); bullets[i].setObject(a_projectiles[i]); } else { MessageBox(NULL, "Error: could not load projectiles", "Turret Error", MB_OK); } } } void turret::hideProjectiles() { float xOffset, yOffset; // this will hide the projectiles behind the turret switch(wallState) { case faceDown: xOffset = 0.5f; // these values could change yOffset = -0.1f; break; case faceUp: xOffset = 0.35f; // these values could change yOffset = -0.7f; break; case faceLeft: xOffset = 0.7f; // these values could change yOffset = -0.45f; break; case faceRight: xOffset = 0.2f; // these values could change yOffset = -0.45f; break; default: xOffset = 0; // these values could change yOffset = 0; break; } for(int i = 0; i < numProjectiles; i++) { // the projectiles must be hiden behind the turret D3DXVECTOR3 * pos = this->getObject()->getPosition(); bullets[i].setPosition(pos->x + xOffset, pos->y + yOffset); bullets[i].init(D3DXVECTOR3(pos->x + xOffset, pos->y + yOffset, 0), 2); bullets[i].setDirection(int(wallState), int(state)); } } int turret::getNumProjectiles(){return numProjectiles;} projectile * turret::getProjectile(int index){return &(bullets[index]);} void turret::destroyProjectiles() { delete [] bullets; bullets = NULL; } void turret::flip() { // turrets do not flip } void turret::setDirection(char dir) { }
[ "[email protected]@66a8e42f-0ee8-26ea-976e-e3172d02aab5", "[email protected]@66a8e42f-0ee8-26ea-976e-e3172d02aab5" ]
[ [ [ 1, 4 ], [ 7, 7 ], [ 11, 13 ], [ 18, 22 ], [ 25, 26 ], [ 46, 46 ], [ 51, 56 ], [ 58, 61 ], [ 63, 66 ], [ 68, 75 ], [ 77, 80 ], [ 82, 83 ], [ 85, 85 ], [ 87, 91 ], [ 93, 95 ], [ 97, 100 ], [ 102, 105 ], [ 107, 115 ], [ 117, 120 ], [ 122, 125 ], [ 127, 132 ], [ 138, 139 ], [ 154, 154 ], [ 218, 218 ] ], [ [ 5, 6 ], [ 8, 10 ], [ 14, 17 ], [ 23, 24 ], [ 27, 45 ], [ 47, 50 ], [ 57, 57 ], [ 62, 62 ], [ 67, 67 ], [ 76, 76 ], [ 81, 81 ], [ 84, 84 ], [ 86, 86 ], [ 92, 92 ], [ 96, 96 ], [ 101, 101 ], [ 106, 106 ], [ 116, 116 ], [ 121, 121 ], [ 126, 126 ], [ 133, 137 ], [ 140, 153 ], [ 155, 217 ] ] ]
d18aa03de417f3e31579fdb8a88d5e1a740b2dd9
f9774f8f3c727a0e03c170089096d0118198145e
/传奇mod/Mir2ExCode/Mir2/LoginProcess/Login/Login.cpp
f74e7c22b8355b37a7c0487c194a51302d7ed0a1
[]
no_license
sdfwds4/fjljfatchina
62a3bcf8085f41d632fdf83ab1fc485abd98c445
0503d4aa1907cb9cf47d5d0b5c606df07217c8f6
refs/heads/master
2021-01-10T04:10:34.432964
2010-03-07T09:43:28
2010-03-07T09:43:28
48,106,882
1
1
null
null
null
null
UTF-8
C++
false
false
8,650
cpp
#include "stdafx.h" #define LOGIN_BUTTON_COUNT 4 #define LOGIN_INPUT_COUNT 2 #define LOGIN_IMAGE_COUNT 4 #define POS_ID_INS_X 193 #define POS_ID_INS_Y 435 #define POS_PASS_INS_X 390 #define POS_PASS_INS_Y 435 #define _LEFT_LOGIN 0 #define _TOP_LOGIN 372 #define _RIGHT_LOGIN 640 #define _BOTTOM_LOGIN 480 #define _LEFT_ID_PASS 170 #define _TOP_ID_PASS 65 #define _IMG_IDX_LOGIN_BORDER 1 #define _IMG_IDX_LOGIN_IDPASS 2 #define _IMG_IDX_BTN_LOGIN 10 #define _IMG_IDX_BTN_NEW 12 #define _IMG_IDX_BTN_CHANGE 14 #define _IMG_IDX_BTN_EXIT 16 #define _LEFT_LOGIN_BTN 140 #define _LEFT_NEW_BTN 205 #define _LEFT_CHANGE_BTN 325 #define _LEFT_EXIT_BTN 475 #define _TOP_LOGIN_BTNS 8 CLogin::CLogin():CBMWnd() { } CLogin::~CLogin() { } VOID CLogin::Create(CWHWilImageData* pxImage) { INT nLoop; // Buttons BUTTONINFO LoginProcBtnInfo[] = { { _IMG_IDX_BTN_LOGIN, _LEFT_LOGIN_BTN, _TOP_LOGIN_BTNS, 0, 0}, // Login Button { _IMG_IDX_BTN_NEW, _LEFT_NEW_BTN, _TOP_LOGIN_BTNS, 0, 0}, // New Account { _IMG_IDX_BTN_CHANGE, _LEFT_CHANGE_BTN, _TOP_LOGIN_BTNS, 0, 0}, // Change Password { _IMG_IDX_BTN_EXIT, _LEFT_EXIT_BTN, _TOP_LOGIN_BTNS, 0, 0} // Exit }; // EditBox State INPUTSTATE LoginInputState[] = { { LGM_INPUT_ID, POS_ID_INS_X, POS_ID_INS_Y, 100, 15, 0, 10, "\0"}, // Input ID in Login { LGM_INPUT_PASSWORD, POS_PASS_INS_X, POS_PASS_INS_Y, 100, 15, 0, 10, "\0"} // Input Password In Login }; m_pxImage = pxImage; for(nLoop = 0 ; nLoop < LOGIN_INPUT_COUNT ; nLoop ++) memcpy(&m_xInputState[nLoop],&LoginInputState[nLoop],sizeof(INPUTSTATE)); for(nLoop = 0 ; nLoop < LOGIN_BUTTON_COUNT ; nLoop ++) m_xButtons[nLoop].SetBtn(&LoginProcBtnInfo[nLoop]); m_fShowIDPASS = FALSE; ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE); SetFocus(g_xMainWnd.GetSafehWnd()); SetRect(&m_rcWnd,_LEFT_LOGIN,_TOP_LOGIN,_RIGHT_LOGIN,_BOTTOM_LOGIN); } HRESULT CLogin::OnKeyDown(WPARAM wParam, LPARAM lParam) { if(m_fShowIDPASS) { if (wParam == VK_RETURN || wParam == VK_TAB) { SetFocusBefore(); switch(m_nUserState) { case LGM_INPUT_ID: { m_nUserState = LGM_INPUT_PASSWORD; break; } case LGM_INPUT_PASSWORD: { if( ( lstrlen( m_xInputState[LGM_INPUT_ID-1].szData) >= LIMIT_USERID ) && lstrlen( m_xInputState[LGM_INPUT_PASSWORD-1].szData ) ) { g_xClientSocket.OnLogin(m_xInputState[LGM_INPUT_ID-1].szData,m_xInputState[LGM_INPUT_PASSWORD-1].szData); strcpy(g_szUserID,m_xInputState[LGM_INPUT_ID-1].szData); return 0L; } m_nUserState = LGM_INPUT_ID; break; } } SetFocusAfter(); } } return 0; } HRESULT CLogin::OnButtonDown(WPARAM wParam, LPARAM lParam) { INT i; RECT tRect; m_fIsButtonDown = TRUE; if(m_fShowIDPASS) for( i = LGM_INPUT_ID-1 ; i < LGM_INPUT_PASSWORD; i ++) { SetRect(&tRect ,m_xInputState[i].Left,m_xInputState[i].Top ,m_xInputState[i].Left+m_xInputState[i].Width,m_xInputState[i].Top+m_xInputState[i].Height); if( IsInRect( tRect, LOWORD( lParam ), HIWORD( lParam ) ) ) { SetFocusBefore(); m_nUserState = i+1; SetFocusAfter(); } } return 0; } HRESULT CLogin::OnButtonDown(POINT ptMouse) { m_fIsButtonDown = TRUE; return 0; } HRESULT CLogin::OnButtonUp(WPARAM wParam, LPARAM lParam) { INT i; RECT tRect; m_fIsButtonDown = FALSE; for(i = BTN_LOGIN_ID; i <= BTN_EXIT_ID; i++) {// m_xButtons[i].m_nState = BUTTON_STATE_UP; m_pxImage->NewSetIndex(m_xButtons[i].m_nButtonID + m_xButtons[i].m_nState - 1); SetRect(&tRect ,m_xButtons[i].m_Rect.left + m_rcWnd.left ,m_xButtons[i].m_Rect.top + m_rcWnd.top ,m_xButtons[i].m_Rect.left + m_rcWnd.left + m_pxImage->m_lpstNewCurrWilImageInfo->shWidth ,m_xButtons[i].m_Rect.top + m_rcWnd.top + m_pxImage->m_lpstNewCurrWilImageInfo->shHeight); if (IsInRect(tRect,LOWORD( lParam ), HIWORD( lParam ) ) ) { switch(m_xButtons[i].m_nButtonID) { case _IMG_IDX_BTN_LOGIN: { m_fShowIDPASS = !m_fShowIDPASS; break; } case _IMG_IDX_BTN_NEW: { m_fShowIDPASS = FALSE; break; } case _IMG_IDX_BTN_CHANGE: { m_fShowIDPASS = FALSE; break; } case _IMG_IDX_BTN_EXIT: { m_fShowIDPASS = FALSE; SendMessage(g_xMainWnd.GetSafehWnd(), WM_DESTROY, NULL, NULL); return 0L;break; } }// switch }// if }// for if(m_fShowIDPASS) { ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_SHOW); SetFocus(g_xChatEditBox.GetSafehWnd()); } else { ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE); SetFocus(g_xMainWnd.GetSafehWnd()); } return 0; } HRESULT CLogin::OnButtonUp(POINT ptMouse) { return 0; } LRESULT CLogin::OnMouseMove(WPARAM wParam, LPARAM lParam) { INT i; RECT tRect; if(!m_fIsButtonDown) { for( i = BTN_LOGIN_ID ; i <= BTN_EXIT_ID ; i ++) { m_pxImage->NewSetIndex(m_xButtons[i].m_nButtonID + m_xButtons[i].m_nState - 1); SetRect(&tRect ,m_xButtons[i].m_Rect.left + m_rcWnd.left ,m_xButtons[i].m_Rect.top + m_rcWnd.top ,m_xButtons[i].m_Rect.left + m_rcWnd.left + m_pxImage->m_lpstNewCurrWilImageInfo->shWidth ,m_xButtons[i].m_Rect.top + m_rcWnd.top + m_pxImage->m_lpstNewCurrWilImageInfo->shHeight); if (IsInRect(tRect,LOWORD( lParam ), HIWORD( lParam ) ) ) m_xButtons[i].m_nState = BUTTON_STATE_ON; else m_xButtons[i].m_nState = BUTTON_STATE_UP; } } return 0; } VOID CLogin::Render(INT nLoopTime) { int i; char Pass[16]=""; if(m_fIsActive) { MoveWindow(g_xChatEditBox.GetSafehWnd(), g_xMainWnd.m_rcWindow.left + m_xInputState[m_nUserState-1].Left +5, g_xMainWnd.m_rcWindow.top + m_xInputState[m_nUserState-1].Top + 5 , m_xInputState[m_nUserState-1].Width, m_xInputState[m_nUserState-1].Height, TRUE); ShowWindow(g_xChatEditBox.GetSafehWnd(), (m_fShowIDPASS ? SW_SHOW:SW_HIDE)); // Draw Login Border if(!m_fShowIDPASS) { m_pxImage->NewSetIndex(_IMG_IDX_LOGIN_BORDER); g_xMainWnd.DrawWithABlendCompDataWithBackBuffer(m_rcWnd.left ,m_rcWnd.top , m_pxImage->m_lpstNewCurrWilImageInfo->shWidth ,m_pxImage->m_lpstNewCurrWilImageInfo->shHeight ,(WORD*)m_pxImage->m_pbCurrImage,640,480); // Draw Button Image for ( i = BTN_LOGIN_ID ; i <= BTN_EXIT_ID ; i++) { m_pxImage->NewSetIndex(m_xButtons[i].m_nButtonID + m_xButtons[i].m_nState - 1); g_xMainWnd.DrawWithImageForComp(m_rcWnd.left + m_xButtons[i].m_Rect.left, m_rcWnd.top + m_xButtons[i].m_Rect.top, m_pxImage->m_lpstNewCurrWilImageInfo->shWidth, m_pxImage->m_lpstNewCurrWilImageInfo->shHeight, (WORD*)(m_pxImage->m_pbCurrImage)); } } // Draw ID & Pass Image if(m_fShowIDPASS) { m_pxImage->NewSetIndex(_IMG_IDX_LOGIN_IDPASS); g_xMainWnd.DrawWithImageForComp(_LEFT_ID_PASS,m_rcWnd.top + _TOP_ID_PASS, m_pxImage->m_lpstNewCurrWilImageInfo->shWidth ,m_pxImage->m_lpstNewCurrWilImageInfo->shHeight,(WORD*)m_pxImage->m_pbCurrImage); memset(Pass,'*',strlen(m_xInputState[1].szData)); g_xMainWnd.PutsHan(NULL, m_xInputState[0].Left+7, m_xInputState[0].Top+6, RGB(255,255,255), RGB(0,0,0), m_xInputState[0].szData); g_xMainWnd.PutsHan(NULL, m_xInputState[1].Left+7, m_xInputState[1].Top+6, RGB(255,255,255), RGB(0,0,0), Pass); } } } VOID CLogin::SetFocusBefore(VOID) { INT nTemp; nTemp = m_nUserState - 1; if(g_xChatEditBox.m_szInputMsg[0]!=NULL) lstrcpy(m_xInputState[nTemp].szData , g_xChatEditBox.m_szInputMsg); else GetWindowText(g_xChatEditBox.GetSafehWnd(),m_xInputState[nTemp].szData ,m_xInputState[nTemp].nSize); ZeroMemory(g_xChatEditBox.m_szInputMsg,sizeof(g_xChatEditBox.m_szInputMsg)); ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE); g_xChatEditBox.SetSelectAll(); } VOID CLogin::SetFocusAfter(VOID) { CHAR cChr; INT nTemp; ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_SHOW); nTemp = m_nUserState - 1; g_xChatEditBox.SetLimitText(m_xInputState[nTemp].nSize); if( m_nUserState != LGM_INPUT_PASSWORD ) cChr = NULL; else cChr = '*'; SendMessage(g_xChatEditBox.GetSafehWnd(),EM_SETPASSWORDCHAR,(WPARAM)cChr,0); SetWindowText(g_xChatEditBox.GetSafehWnd(), m_xInputState[nTemp].szData); SetFocus(g_xChatEditBox.GetSafehWnd()); g_xChatEditBox.SetSelectAll(); }
[ "fjljfat@4a88d1ba-22b1-11df-8001-4f4b503b426e" ]
[ [ [ 1, 294 ] ] ]
14441ab76d0f931990b5ea37670d37c702aae5e5
de98f880e307627d5ce93dcad1397bd4813751dd
/3libs/ut/include/OXBrowseDirEditList.h
2601eff1a52cae399a4377c53e745447b95d0417
[]
no_license
weimingtom/sls
7d44391bc0c6ae66f83ddcb6381db9ae97ee0dd8
d0d1de9c05ecf8bb6e4eda8a260c7a2f711615dd
refs/heads/master
2021-01-10T22:20:55.638757
2011-03-19T06:23:49
2011-03-19T06:23:49
44,464,621
2
0
null
null
null
null
WINDOWS-1252
C++
false
false
3,126
h
// ========================================================================== // Class Specification : COXBrowseDirEditList // ========================================================================== // Header file : OXBrowseDirEditList.h // Version: 9.3 // This software along with its related components, documentation and files ("The Libraries") // is © 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is // governed by a software license agreement ("Agreement"). Copies of the Agreement are // available at The Code Project (www.codeproject.com), as part of the package you downloaded // to obtain this file, or directly from our office. For a copy of the license governing // this software, you may contact us at [email protected], or by calling 416-849-8900. // ////////////////////////////////////////////////////////////////////////// #ifndef __OXBROWSEDIREDITLIST_H__ #define __OXBROWSEDIREDITLIST_H__ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include "OXDllExt.h" #include "OXEditList.h" #include "OXBrowseDirEdit.h" class OX_CLASS_DECL COXBrowseDirGridEdit : public COXBaseBrowseDirEdit<COXGridEdit> { protected: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); }; class OX_CLASS_DECL COXBrowseDirGridEdit16 : public COXBaseBrowseDirEdit16<COXGridEdit> { protected: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); }; class OX_CLASS_DECL COXBrowseFileGridEdit : public COXBaseBrowseFileEdit<COXGridEdit> { protected: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); }; //////////////////////////////////////////////////////////////////////////////// class OX_CLASS_DECL COXBrowseDirEditList : public COXEditList { public: COXBrowseDirEditList(EToolbarPosition eToolbarPosition=TBPHorizontalTopRight, BOOL bAllowDuplicates=FALSE, BOOL bOrderedList=TRUE) : COXEditList(eToolbarPosition,bAllowDuplicates,bOrderedList) {}; protected: COXBrowseDirGridEdit m_browseDirEdit; public: virtual COXGridEdit* GetGridEditCtrl() { return &m_browseDirEdit; } }; class OX_CLASS_DECL COXBrowseDirEditList16 : public COXEditList { public: COXBrowseDirEditList16(EToolbarPosition eToolbarPosition=TBPHorizontalTopRight, BOOL bAllowDuplicates=FALSE, BOOL bOrderedList=TRUE) : COXEditList(eToolbarPosition,bAllowDuplicates,bOrderedList) {}; protected: COXBrowseDirGridEdit16 m_browseDirEdit16; public: virtual COXGridEdit* GetGridEditCtrl() { return &m_browseDirEdit16; } }; class OX_CLASS_DECL COXBrowseFileEditList : public COXEditList { public: COXBrowseFileEditList(EToolbarPosition eToolbarPosition=TBPHorizontalTopRight, BOOL bAllowDuplicates=FALSE, BOOL bOrderedList=TRUE) : COXEditList(eToolbarPosition,bAllowDuplicates,bOrderedList) {}; protected: COXBrowseFileGridEdit m_browseFileEdit; public: virtual COXGridEdit* GetGridEditCtrl() { return &m_browseFileEdit; } }; #endif // __OXBROWSEDIREDITLIST_H__
[ [ [ 1, 101 ] ] ]
b6250a7923b2b524eaedde6ce62b1143f039c377
967868cbef4914f2bade9ef8f6c300eb5d14bc57
/Object/Orb.cpp
aedfaa764e8e78f522d566ca16db0611c9f37b71
[]
no_license
saminigod/baseclasses-001
159c80d40f69954797f1c695682074b469027ac6
381c27f72583e0401e59eb19260c70ee68f9a64c
refs/heads/master
2023-04-29T13:34:02.754963
2009-10-29T11:22:46
2009-10-29T11:22:46
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
861
cpp
/* © Vestris Inc., Geneva, Switzerland http://www.vestris.com, 1994-1999 All Rights Reserved _____________________________________________________ written by Daniel Doubrovkine - [email protected] and Serge Huber - [email protected] */ #include "Orb.hpp" bool COrb::AddObject(const CString& ObjectName, CObject* ObjectPtr) { bool Result = m_ObjectTable.Set(ObjectName, ObjectPtr); return Result; } bool COrb::RemoveObject(const CString& ObjectName) { bool Result = m_ObjectTable.Remove(ObjectName); return Result; } CObject * COrb::FindObject(const CString& ObjectName) const { CObject ** Result = (CObject **) m_ObjectTable.FindElement(ObjectName); if (Result) return (* Result); else return NULL; } // Object repository procedures COrb::COrb(void) { } COrb::~COrb(void) { m_ObjectTable.RemoveAll(); }
[ [ [ 1, 36 ] ] ]
b80fa47e73accdeb7aea7cd210c7a71f7ba38b79
55d6f54f463bf0f97298eb299674e2065863b263
/mainwindow.cpp
e212db0c2db27a7c96d26741762aecd49dce1e3f
[]
no_license
Coinche/CoinchePAV
a344e69b096ef5fd4e24c98af1b24de2a99235f0
134cac106ee8cea78abc5b29b23a32706b2aad08
refs/heads/master
2020-06-01T09:35:51.793153
2011-12-01T19:57:12
2011-12-01T19:57:12
2,729,958
0
0
null
null
null
null
ISO-8859-1
C++
false
false
10,285
cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include "windows.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //GroupBox non visibles au démarrage..il faut utiliser Servir ui->groupBoxAnnonce->setVisible(false); ui->groupBoxDPli->setVisible(false); //configuration des objets metier joueur_principal.set_joueurHG(this); kebab.set_donneurGraphique(this); npp[0] = new IA_intermediate(); npp[1] = new IA_intermediate(); npp[2] = new IA_intermediate(); kebab.set_joueurs(&joueur_principal, npp[0], npp[1], npp[2]); for(int i=0; i<3; i++) npp[i]->set_donneur(&kebab); //Adressage des différentes Carte + mappage couleur pour pouvoir boucler/accéder rapidement Pli_Joueur[0] = ui->Pli_Joueur0; Pli_Joueur[1] = ui->Pli_Joueur1; Pli_Joueur[2] = ui->Pli_Joueur2; Pli_Joueur[3] = ui->Pli_Joueur3; Carte_Jeu[0] = ui->Carte0; Carte_Jeu[1] = ui->Carte1; Carte_Jeu[2] = ui->Carte2; Carte_Jeu[3] = ui->Carte3; Carte_Jeu[4] = ui->Carte4; Carte_Jeu[5] = ui->Carte5; Carte_Jeu[6] = ui->Carte6; Carte_Jeu[7] = ui->Carte7; DPli_Joueur[0] = ui->DPli_Joueur0; DPli_Joueur[1] = ui->DPli_Joueur1; DPli_Joueur[2] = ui->DPli_Joueur2; DPli_Joueur[3] = ui->DPli_Joueur3; mapAnnonceCouleur.insert(COEUR,ui->radioButtonCoeur); mapAnnonceCouleur.insert(CARREAU,ui->radioButtonCarreau); mapAnnonceCouleur.insert(PIQUE,ui->radioButtonPique); mapAnnonceCouleur.insert(TREFLE,ui->radioButtonTrefle); mapCouleur.insert(COEUR, "coeur"); mapCouleur.insert(CARREAU, "carreau"); mapCouleur.insert(PIQUE, "pique"); mapCouleur.insert(TREFLE, "trefle"); mapValeur.insert(SEPT,"7"); mapValeur.insert(HUIT,"8"); mapValeur.insert(NEUF,"9"); mapValeur.insert(DIX,"10"); mapValeur.insert(VALET,"valet"); mapValeur.insert(DAME,"dame"); mapValeur.insert(ROI,"roi"); mapValeur.insert(AS,"as"); mapHauteur.insert(QUATRE_VINGT,"80"); mapHauteur.insert(QUATRE_VINGT_DIX,"90"); mapHauteur.insert(CENT,"100"); mapHauteur.insert(CENT_DIX,"110"); mapHauteur.insert(CENT_VINGT,"120"); mapHauteur.insert(CENT_TRENTE,"130"); mapHauteur.insert(CENT_QUARANTE,"140"); mapHauteur.insert(CENT_CINQUANTE,"150"); mapHauteur.insert(CENT_SOIXANTE,"160"); mapHauteur.insert(CENT_SOIXANTE_DIX,"170"); mapHauteur.insert(CAPOT,"Capot"); mapHauteur.insert(PASSE,"Passe"); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_action_New_activated() { StartDialog startDialog(this); QStringList info; if (startDialog.exec() == QDialog::Accepted) info = startDialog.readSettings(); // dialog accepté, info contient les infos nécessaires ! //Initialisation du Jeu ! //init_game(); kebab.jouerUnePartie(); } void MainWindow::init_game() { //Box annonces DPli visibles ui->groupBoxAnnonce->setVisible(true); ui->groupBoxDPli->setVisible(true); //On Désactive les Annonces ui->radioButtonCarreau->setEnabled(false); ui->radioButtonCoeur->setEnabled(false); ui->radioButtonPique->setEnabled(false); ui->radioButtonTrefle->setEnabled(false); //On supprime la pix des cartes du pli et de dernier pli for (int i=0; i<4;i++) { Pli_Joueur[i]->setPixmap(QPixmap()); DPli_Joueur[i]->setPixmap(QPixmap()); } //Init Graph des jeux IA ui->Jeu2->setPixmap(QPixmap(":/new/prefix1/Resources/Cartes/dos/dos8v.jpg") ); ui->Jeu3->setPixmap(QPixmap(":/new/prefix1/Resources/Cartes/dos/dos8.jpg") ); ui->Jeu4->setPixmap(QPixmap(":/new/prefix1/Resources/Cartes/dos/dos8v.jpg") ); ui->LabelScore->setText(""); ui->listWidgetAnnonce->clear(); } void MainWindow::afficherScores(int attaque, int defense) { ui->LabelScore->setText("N "+QString::number(attaque)+" E "+QString::number(defense)); } void MainWindow::afficherCarte(int joueur,Carte carte) { Pli_Joueur[joueur]->setPixmap(QPixmap(":/new/prefix1/Resources/Cartes/"+ mapCouleur[carte.get_couleur()]+"/"+ mapValeur[carte.get_valeur()]+".png")); //Pli_Joueur[joueur]->repaint(); Pli_Joueur[joueur]->raise(); } void MainWindow::afficherAnnonce(int joueur,Annonce annonce) { QString dAnnonce; if (annonce.get_hauteur() == PASSE) { dAnnonce = "Joueur "+QString::number(joueur)+" passe comme un pd"; } else{ dAnnonce = "Joueur "+QString::number(joueur)+" "+mapHauteur[annonce.get_hauteur()]+" "+mapCouleur[annonce.get_couleur()]; } ui->listWidgetAnnonce->addItem(dAnnonce); ui->label_Annonce->setText(dAnnonce); } void MainWindow::ramasserPli() { //Ramassage du pli et placement en position dernier pli ! for (int i=0; i<4; i++) { const QPixmap* mPixmap = Pli_Joueur[i]->pixmap(); DPli_Joueur[i]->setPixmap(*mPixmap); Pli_Joueur[i]->clear(); } } //JoueurHumainGraphique int MainWindow::afficherMainEtJouer(Main main,std::vector<bool> jouable) { afficherMain(main,jouable); QEventLoop myLoop; for (unsigned int i=0; i<main.size(); i++) { QObject::connect(Carte_Jeu[i], SIGNAL(clicked()), &myLoop, SLOT(quit())); } /*for (unsigned int i=0; i<main.size(); i++) { Carte_Jeu[i]->setIcon(QIcon(":/new/prefix1/Resources/Cartes/"+ mapCouleur[main[i].get_couleur()]+"/"+ mapValeur[main[i].get_valeur()]+".png")); Carte_Jeu[i]->setEnabled(jouable[i]); QObject::connect(Carte_Jeu[i], SIGNAL(clicked()), &myLoop, SLOT(quit())); } //On désactive les boutons correspondant aux carte déjà jouées ! for (unsigned int i=main.size(); i < 8; i++) { Carte_Jeu[i]->setVisible(false); } */ myLoop.exec(); Carte_Jeu[lastbutton_clicked]->setIcon(QIcon()); return lastbutton_clicked; } void MainWindow::afficherMain(Main main,std::vector<bool> jouable) { for (unsigned int i=0; i<main.size(); i++) { Carte_Jeu[i]->setIcon(QIcon(":/new/prefix1/Resources/Cartes/"+ mapCouleur[main[i].get_couleur()]+"/"+ mapValeur[main[i].get_valeur()]+".png")); Carte_Jeu[i]->setVisible(true); Carte_Jeu[i]->setEnabled(jouable[i]); } //On désactive les boutons correspondant aux carte déjà jouées ! for (unsigned int i=main.size(); i < 8; i++) { Carte_Jeu[i]->setVisible(false); } } Annonce MainWindow::afficherAnnonceEtParler(std::vector<Hauteur> hauteurs_possibles,std::vector<Couleur> couleurs_possibles) { QEventLoop myLoop; ui->comboBoxAnnonce->clear(); mapAnnonceCouleur[CARREAU]->setEnabled(false); mapAnnonceCouleur[COEUR]->setEnabled(false); mapAnnonceCouleur[PIQUE]->setEnabled(false); mapAnnonceCouleur[TREFLE]->setEnabled(false); for (unsigned int i=0; i<hauteurs_possibles.size(); i++) { ui->comboBoxAnnonce->addItem(mapHauteur[hauteurs_possibles[i]]); } for (unsigned int j=0; j<couleurs_possibles.size();j++) { mapAnnonceCouleur[couleurs_possibles[j]]->setEnabled(true); mapAnnonceCouleur[couleurs_possibles[j]]->setChecked(true); } QObject::connect(ui->SpeakButton, SIGNAL(clicked()), &myLoop, SLOT(quit())); myLoop.exec(); Couleur couleur_choisie; if (ui->radioButtonCarreau->isChecked()) couleur_choisie = CARREAU; if (ui->radioButtonCoeur->isChecked()) couleur_choisie = COEUR; if (ui->radioButtonPique->isChecked()) couleur_choisie = PIQUE; if (ui->radioButtonTrefle->isChecked()) couleur_choisie = TREFLE; if (ui->comboBoxAnnonce->currentText() == "Passe") { return Annonce(PASSE,couleur_choisie); } else if (ui->comboBoxAnnonce->currentText() == "Capot") { return Annonce(CAPOT,couleur_choisie); } else { return Annonce((Hauteur) ui->comboBoxAnnonce->currentText().toInt(),couleur_choisie); } } //JoueurIAGraphique void MainWindow::afficherMain(Main main) { for (unsigned int i=0; i<main.size(); i++) { Carte_Jeu[i]->setIcon(QIcon(":/new/prefix1/Resources/Cartes/"+ mapCouleur[main[i].get_couleur()]+"/"+ mapValeur[main[i].get_valeur()]+".png")); Carte_Jeu[i]->setEnabled(true); } //On désactive les boutons correspondant aux carte déjà jouées ! } void MainWindow::on_Carte0_clicked() { // On détruit la carte..ici donneur graphique le fait //Carte_Jeu[0]->setIcon(QIcon()); lastbutton_clicked = 0; } void MainWindow::on_Carte1_clicked() { //Carte_Jeu[1]->setIcon(QIcon()); lastbutton_clicked = 1; } void MainWindow::on_Carte2_clicked() { //Carte_Jeu[2]->setIcon(QIcon()); lastbutton_clicked = 2; } void MainWindow::on_Carte3_clicked() { //Carte_Jeu[3]->setIcon(QIcon()); lastbutton_clicked = 3; } void MainWindow::on_Carte4_clicked() { //Carte_Jeu[4]->setIcon(QIcon()); lastbutton_clicked = 4; } void MainWindow::on_Carte5_clicked() { //Carte_Jeu[5]->setIcon(QIcon()); lastbutton_clicked = 5; } void MainWindow::on_Carte6_clicked() { //Carte_Jeu[6]->setIcon(QIcon()); lastbutton_clicked = 6; } void MainWindow::on_Carte7_clicked() { //Carte_Jeu[7]->setIcon(QIcon()); lastbutton_clicked = 7; }
[ "lucas@graham.(none)", "[email protected]" ]
[ [ [ 1, 2 ], [ 4, 17 ], [ 22, 22 ], [ 24, 162 ], [ 164, 316 ] ], [ [ 3, 3 ], [ 18, 21 ], [ 23, 23 ], [ 163, 163 ] ] ]
2641bcc80ea3140a7d16748ac18ffd5bcdcc9e63
3920e5fc5cbc2512701a3d2f52e072fd50debb83
/Source/Modules/PixelMathFilters/itkNegateImageFilter.h
eb14ee6591a9b1092381576ca2cb601366cc2638
[ "MIT" ]
permissive
amirsalah/manageditk
4063a37d7370dcbcd08bfe9d24d22015d226ceaf
1ca3a8ea7db221a3b6a578d3c75e3ed941ef8761
refs/heads/master
2016-08-12T05:38:03.377086
2010-08-02T08:17:32
2010-08-02T08:17:32
52,595,294
0
0
null
null
null
null
UTF-8
C++
false
false
2,865
h
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkNegateImageFilter.h,v $ Language: C++ Date: $Date: 2007-08-31 22:17:25 +0200 (Fri, 31 Aug 2007) $ Version: $Revision: 2 $ 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 __itkNegateImageFilter_h #define __itkNegateImageFilter_h #include "itkUnaryFunctorImageFilter.h" #include "itkConceptChecking.h" namespace itk { /** \class NegateImageFilter * \brief Computes the pixel-wise negation of the value. * * \ingroup IntensityImageFilters Multithreaded */ namespace Function { template< class TInput, class TOutput> class Negate { public: Negate() {} ~Negate() {} bool operator!=( const Negate & ) const { return false; } bool operator==( const Negate & other ) const { return !(*this != other); } inline TOutput operator()( const TInput & A ) { return (TOutput)( -A ); } }; } template <class TInputImage, class TOutputImage> class ITK_EXPORT NegateImageFilter : public UnaryFunctorImageFilter<TInputImage,TOutputImage, Function::Negate< typename TInputImage::PixelType, typename TOutputImage::PixelType> > { public: /** Standard class typedefs. */ typedef NegateImageFilter Self; typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, Function::Negate< typename TInputImage::PixelType, typename TOutputImage::PixelType> > Superclass; typedef SmartPointer<Self> Pointer; typedef SmartPointer<const Self> ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ itkConceptMacro(ConvertibleCheck, (Concept::Convertible<typename TInputImage::PixelType, typename TOutputImage::PixelType>)); itkConceptMacro(InputGreaterThanIntCheck, (Concept::GreaterThanComparable<typename TInputImage::PixelType, int>)); /** End concept checking */ #endif protected: NegateImageFilter() {} virtual ~NegateImageFilter() {} private: NegateImageFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented }; } // end namespace itk #endif
[ "dan.muel@a4e08166-d753-0410-af4e-431cb8890a25" ]
[ [ [ 1, 95 ] ] ]
78d6710a47a0674df8ed2f83b58bebe75cd5ebfb
b6ad4ca18cb717e403aecb8d045df660e9933f56
/put.cpp
a72071c85eacba83f003eec31d205e70b706afb6
[]
no_license
vi-k/vi-k.cpptests
ea6d47cd4c4d7dfe2604d58d1d78e8aa250a290b
7ca512f61418359cd8c1c6d1fcd49c35321a2685
refs/heads/master
2021-01-10T02:01:17.590606
2010-06-18T06:58:31
2010-06-18T06:58:31
44,516,049
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
5,195
cpp
#include <stdio.h> #include <stdlib.h> #include <my_stopwatch.h> #include <algorithm> #include <iostream> #include <sstream> using namespace std; #include <libs/date_time/src/gregorian/date_generators.cpp> #include <libs/date_time/src/posix_time/posix_time_types.cpp> #include <boost/date_time/posix_time/posix_time.hpp> #define SIZE 10000 #define CHAR char #define COUT cout /* Вывод бинарной строки заданного размера */ template<class Char> inline std::size_t put(Char *buf, std::size_t buf_sz, const Char *str, std::size_t str_sz) { Char *ptr = buf; if (buf_sz) { const Char *end = str + (buf_sz > str_sz ? str_sz : buf_sz - 1); /* Этот вариант быстрее std::copy() */ while (str != end) *ptr++ = *str++; *ptr = 0; } return ptr - buf; } /* Вывод бинарной строки заданного размера */ template<class Char> inline std::size_t put2(Char *buf, std::size_t buf_sz, const Char *str, std::size_t str_sz) { if (buf_sz) { buf_sz = (buf_sz > str_sz ? str_sz : buf_sz - 1); memcpy(buf, str, buf_sz * sizeof(Char)); buf[buf_sz] = 0; } return buf_sz; } /* Вывод бинарной строки заданного размера */ template<class Char> inline std::size_t put3(Char *buf, std::size_t buf_sz, const Char *str, std::size_t str_sz) { Char *ptr = buf; if (buf_sz) { const Char *end = str + (buf_sz > str_sz ? str_sz : buf_sz - 1); ptr = std::copy(str, end, buf); *ptr = 0; } return ptr - buf; } CHAR strs1[SIZE][64] = {0}; CHAR strs2[SIZE][1000] = {0}; CHAR bufs1[SIZE][200]; CHAR bufs2[SIZE][15]; CHAR bufs3[SIZE][1100]; int main(int argc, char *argv[]) { my::stopwatch timer(MY_SW_AVG); int n = 1000; int nn; if (argc > 1) n = atoi(argv[1]); cout << "n=" << n << endl; cout << "*** " << sizeof(*strs1)/sizeof(**strs1) << " -> " << sizeof(*bufs1)/sizeof(**bufs1) << " ***\n\n"; { cout << "put with while(): " << flush; timer.restart(); for (nn = 0; nn < n; ++nn) for (int i = 0; i < SIZE; ++i) { put(bufs1[i], sizeof(*bufs1)/sizeof(**bufs1), strs1[i], sizeof(*strs1)/sizeof(**strs1)); } timer.finish(); timer.count = nn; cout << timer << endl; } { cout << "put with memcpy(): " << flush; timer.restart(); for (nn = 0; nn < n; ++nn) for (int i = 0; i < SIZE; ++i) { put2(bufs1[i], sizeof(*bufs1)/sizeof(**bufs1), strs1[i], sizeof(*strs1)/sizeof(**strs1)); } timer.finish(); timer.count = nn; cout << timer << endl; } { cout << "put with copy(): " << flush; timer.restart(); for (nn = 0; nn < n; ++nn) for (int i = 0; i < SIZE; ++i) { put3(bufs1[i], sizeof(*bufs1)/sizeof(**bufs1), strs1[i], sizeof(*strs1)/sizeof(**strs1)); } timer.finish(); timer.count = nn; cout << timer << endl; } cout << "\n*** " << sizeof(*strs1)/sizeof(**strs1) << " -> " << sizeof(*bufs2)/sizeof(**bufs2) << " ***\n\n"; { cout << "put with while(): " << flush; timer.restart(); for (nn = 0; nn < n; ++nn) for (int i = 0; i < SIZE; ++i) { put(bufs2[i], sizeof(*bufs2)/sizeof(**bufs2), strs1[i], sizeof(*strs1)/sizeof(**strs1)); } timer.finish(); timer.count = nn; cout << timer << endl; } { cout << "put with memcpy(): " << flush; timer.restart(); for (nn = 0; nn < n; ++nn) for (int i = 0; i < SIZE; ++i) { put2(bufs2[i], sizeof(*bufs2)/sizeof(**bufs2), strs1[i], sizeof(*strs1)/sizeof(**strs1)); } timer.finish(); timer.count = nn; cout << timer << endl; } { cout << "put with copy(): " << flush; timer.restart(); for (nn = 0; nn < n; ++nn) for (int i = 0; i < SIZE; ++i) { put3(bufs2[i], sizeof(*bufs2)/sizeof(**bufs2), strs1[i], sizeof(*strs1)/sizeof(**strs1)); } timer.finish(); timer.count = nn; cout << timer << endl; } cout << "\n*** " << sizeof(*strs2)/sizeof(**strs2) << " -> " << sizeof(*bufs3)/sizeof(**bufs3) << " ***\n\n"; { cout << "put with while(): " << flush; timer.restart(); for (nn = 0; nn < n/10; ++nn) for (int i = 0; i < SIZE; ++i) { put(bufs3[i], sizeof(*bufs3)/sizeof(**bufs3), strs2[i], sizeof(*strs2)/sizeof(**strs2)); } timer.finish(); timer.count = nn; cout << timer << endl; } { cout << "put with memcpy(): " << flush; timer.restart(); for (nn = 0; nn < n/10; ++nn) for (int i = 0; i < SIZE; ++i) { put2(bufs3[i], sizeof(*bufs3)/sizeof(**bufs3), strs2[i], sizeof(*strs2)/sizeof(**strs2)); } timer.finish(); timer.count = nn; cout << timer << endl; } { cout << "put with copy(): " << flush; timer.restart(); for (nn = 0; nn < n/10; ++nn) for (int i = 0; i < SIZE; ++i) { put3(bufs3[i], sizeof(*bufs3)/sizeof(**bufs3), strs2[i], sizeof(*strs2)/sizeof(**strs2)); } timer.finish(); timer.count = nn; cout << timer << endl; } return 0; }
[ [ [ 1, 242 ] ] ]
da08a51b76b12413b71f338547f866b8c3285e0a
585293085e12dbd8339c49098c0882f9e001f2c1
/ nupix/NuPix/src/NPCore.cpp
a925b1ee329bb3f1d0e5e19b47f471152a2bf62b
[]
no_license
fmd/nupix
ba4d9fc5fe56e08abe03b2b39302c4d7129dd45c
49ada30fdbe091df3f1d2b341cce1ea4bcc0a011
refs/heads/master
2021-01-02T09:53:47.099303
2010-03-17T03:01:53
2010-03-17T03:01:53
32,323,794
0
0
null
null
null
null
UTF-8
C++
false
false
2,675
cpp
#include "NPCore.h" using namespace newPix; NPCore* NPCore::mInstance = 0; NPCore::NPCore() { } bool NPCore::initialise(const VideoSettings& vidset) { printf("Initialising newPix Core:\n"); mVideoMgr = new VideoMgr(); if (!mVideoMgr->initialise(vidset)) return false; mInputMgr = new InputMgr(); if (!mInputMgr->initialise()) return false; mGeometryMgr = new GeometryMgr(); if (!mGeometryMgr->initialise()) return false; mTextureMgr = new TextureMgr(); if (!mTextureMgr->initialise()) return false; mRootNode = new Node(); mPreviousTime = SDL_GetTicks(); mTimeSinceLastFrame = 0; printf("Initialised newPix Core.\n\n"); return true; } void NPCore::shutdown() { //PROFILER_OUTPUT("out.txt"); printf("Shutting down newPix Core:\n"); delete this; } NPCore::~NPCore() { delete mGeometryMgr; delete mTextureMgr; delete mInputMgr; delete mVideoMgr; printf(" -Nodes... "); Node::destroyAll(); printf("Done.\n"); SDL_Quit(); printf("Shut down newPix Core.\n\n"); } NPCore* NPCore::getPtr() { if (!mInstance) mInstance = new NPCore(); return mInstance; } VideoMgr* NPCore::getVideoMgr() { return mVideoMgr; } InputMgr* NPCore::getInputMgr() { return mInputMgr; } TextureMgr* NPCore::getTextureMgr() { return mTextureMgr; } Node* NPCore::getRootNode() { return mRootNode; } uint32 NPCore::getTimeSinceLastFrame() { return mTimeSinceLastFrame; } void NPCore::processOneFrame() { uint32 currTime = SDL_GetTicks(); mTimeSinceLastFrame = currTime - mPreviousTime; mPreviousTime = currTime; //PROFILE_BEGIN(buffers); mInputMgr->processBuffers(); //PROFILE_END(); //PROFILE_BEGIN(swap_window); SDL_GL_SwapBuffers(); //PROFILE_END(); //PROFILE_BEGIN(sdl_event); SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: mInputMgr->keyPressed(event.key.keysym.sym); break; case SDL_KEYUP: mInputMgr->keyReleased(event.key.keysym.sym); break; case SDL_MOUSEMOTION: mInputMgr->mouseMoved(event.motion); break; case SDL_MOUSEBUTTONDOWN: mInputMgr->mousePressed(event.button.button); break; case SDL_MOUSEBUTTONUP: mInputMgr->mouseReleased(event.button.button); break; } } //PROFILE_END(); //PROFILE_BEGIN(gl_ident_and_clear); glLoadIdentity(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //PROFILE_END(); mGeometryMgr->render(); //PROFILER_UPDATE(); } GeometryMgr* NPCore::getGeometryMgr() { return mGeometryMgr; }
[ "fareeddudhia@c567426a-3e4a-1c2b-9c7e-01d812d4f56b" ]
[ [ [ 1, 150 ] ] ]
d14e38dbf9cd31df481de40ef2f8f3f392277396
7f30cb109e574560873a5eb8bb398c027f85eeee
/src/wxWiimoteEvent.cxx
5cb4832fa108414a84ae18b09a4c5da79f394d4b
[]
no_license
svn2github/MITO
e8fd0e0b6eebf26f2382f62660c06726419a9043
71d1269d7666151df52d6b5a98765676d992349a
refs/heads/master
2021-01-10T03:13:55.083371
2011-10-14T15:40:14
2011-10-14T15:40:14
47,415,786
1
0
null
null
null
null
UTF-8
C++
false
false
2,412
cxx
#include "wxWiimoteEvent.h" DEFINE_EVENT_TYPE(wxEVT_WII_MOTION_IR); DEFINE_EVENT_TYPE(wxEVT_WII_A_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_A_UP); DEFINE_EVENT_TYPE(wxEVT_WII_B_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_B_UP); DEFINE_EVENT_TYPE(wxEVT_WII_MINUS_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_MINUS_UP); DEFINE_EVENT_TYPE(wxEVT_WII_HOME_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_HOME_UP); DEFINE_EVENT_TYPE(wxEVT_WII_PLUS_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_PLUS_UP); DEFINE_EVENT_TYPE(wxEVT_WII_ONE_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_ONE_UP); DEFINE_EVENT_TYPE(wxEVT_WII_TWO_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_TWO_UP); DEFINE_EVENT_TYPE(wxEVT_WII_CROSS_DOWN); DEFINE_EVENT_TYPE(wxEVT_WII_CROSS_UP); IMPLEMENT_DYNAMIC_CLASS(wxWiimoteEvent, wxEvent) wxWiimoteEvent::wxWiimoteEvent() : wxEvent() { A = B = Plus = Minus = Home = One = Two = false; LeftCross = RightCross = UpCross = DownCross = false; WiiX = WiiY = WiiZ = 0.f; IRLight1X = IRLight1Y = IRLight2X = IRLight2Y = -1; IRLight1Found = IRLight2Found = false; Led1 = Led2 = Led3 = Led4 = false; idWii = 0; } wxWiimoteEvent::wxWiimoteEvent(wxEventType type) { wxWiimoteEvent(); this->SetEventType(type); } wxWiimoteEvent::wxWiimoteEvent(const wxWiimoteEvent & event) { wxWiimoteEvent(); //--- new --- this->A = event.A; this->B = event.B; this->Minus = event.Minus; this->Home = event.Home; this->Plus = event.Plus; this->One = event.One; this->Two = event.Two; this->LeftCross = event.LeftCross; this->RightCross = event.RightCross; this->UpCross = event.UpCross; this->DownCross = event.DownCross; this->WiiX = event.WiiX; this->WiiY = event.WiiY; this->WiiZ = event.WiiZ; this->IRLight1Found = event.IRLight1Found; this->IRLight1X = event.IRLight1X; this->IRLight1Y = event.IRLight1Y; this->IRLight2Found = event.IRLight2Found; this->IRLight2X = event.IRLight2X; this->IRLight2Y = event.IRLight2Y; this->Led1 = event.Led1; this->Led2 = event.Led2; this->Led3 = event.Led3; this->Led4 = event.Led4; this->idWii = event.idWii; this->SetEventObject(event.GetEventObject()); this->SetEventType(event.GetEventType()); this->SetTimestamp(event.GetTimestamp()); //--- --- ---- //this->SetEventType( event.GetEventType() ); //not really needed in this sample, but it's boring to have it empty }
[ "kg_dexterp37@fde90bc1-0431-4138-8110-3f8199bc04de" ]
[ [ [ 1, 79 ] ] ]
ed45e42377cb15f64ef3bfbfc49ef4f1f537890c
fa609a5b5a0e7de3344988a135b923a0f655f59e
/Source/CastValues.h
4bd3a6c9badeda21f9d31aa844938821ca6d8052
[ "MIT" ]
permissive
Sija/swift
3edfd70e1c8d9d54556862307c02d1de7d400a7e
dddedc0612c0d434ebc2322fc5ebded10505792e
refs/heads/master
2016-09-06T09:59:35.416041
2007-08-30T02:29:30
2007-08-30T02:29:30
null
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
2,725
h
/** * Swift Parser Library * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @filesource * @copyright Copyright (c) 2007 Sijawusz Pur Rahnama * @copyright Copyright (c) 2007 Paweł Złomaniec * @version $Revision: 90 $ * @modifiedby $LastChangedBy: ursus6 $ * @lastmodified $Date: 2007-08-06 11:41:22 +0200 (Pn, 06 sie 2007) $ */ #pragma once #ifndef __SWIFT_CASTVALUES_H__ #define __SWIFT_CASTVALUES_H__ #include "values/String.h" #include "values/Int.h" #include "values/Int64.h" #include "values/Bool.h" #include "values/Date.h" #include "values/RegExPattern.h" #include "values/Array.h" #include "values/Hash.h" #include "values/Proxy.h" #include "values/Void.h" namespace Swift { inline oValue strToInt(const oValue& value) { return _wtoi(((Values::String*)value.get())->output().w_str()); } inline oValue strToInt64(const oValue& value) { return _wtoi64(((Values::String*)value.get())->output().w_str()); } inline oValue strToBool(const oValue& value) { const String& retValue = ((Values::String*)value.get())->output(); return !(!retValue.size() || retValue == "false"); } inline oValue intToStr(const oValue& value) { char buff[128]; _itoa_s(((Values::Int*)value.get())->output(), buff, 128, 10); return buff; } inline oValue intToBool(const oValue& value) { return ((Values::Int*)value.get())->output() != 0 ? true : false; } inline oValue intToInt64(const oValue& value) { return (__int64) ((Values::Int*)value.get())->output(); } inline oValue int64ToStr(const oValue& value) { char buff[128]; _i64toa_s(((Values::Int64*)value.get())->output(), buff, 128, 10); return buff; } inline oValue int64ToBool(const oValue& value) { return ((Values::Int64*)value.get())->output() != 0 ? true : false; } inline oValue int64ToInt(const oValue& value) { return (int) ((Values::Int64*)value.get())->output(); } inline oValue boolToStr(const oValue& value) { return ((Values::Bool*)value.get())->output() ? "true" : "false"; } inline oValue dateToStr(const oValue& value) { return ((Values::Date*)value.get())->output().strftime("%X, %x"); } inline oValue regExpToStr(const oValue& value) { return ((Values::RegExPattern*)value.get())->output(); } inline oValue voidToStr(const oValue& value) { return ""; } inline oValue hashToStr(const oValue& value) { return value->getName(); } inline oValue arrayToStr(const oValue& value) { return value->getName(); } } #endif // __SWIFT_CASTVALUES_H__
[ [ [ 1, 87 ] ] ]
cf57cf092c87745478a8e23e46be825d4387b477
fa00eae24d28263ca15fd41ef4b44f462595cc56
/p07/AviWrite.h
59ce527d16fbec7ca4bde0c6c29d8f5c3d976285
[]
no_license
jnsdbr/ss2010
57b9ec4a4b9e347270c266ccdd0213fb25f9e5dd
2404acf2cf5a770f0defc00b5ce038af985476d3
refs/heads/master
2020-03-29T17:21:18.709638
2010-06-09T19:41:38
2010-06-09T19:41:38
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
956
h
// -------------------------------------------------------------- // AviWrite: Object for writing uncompressed AVI Files // class definition // (c) Prof. Dr.-Ing. Bernhard Lang // May 2005 // -------------------------------------------------------------- #ifndef _AviWrite_h_ #define _AviWrite_h_ // #include <stdio.h> #include "FileIO.h" #include "Image.h" #include "RGB_Pixel.h" class AviWrite: public FileOut, public Align { private: int width; // Bildbreite int height; // Bildhöhe int framenumber; // Aktuelle Frame-Nummer int framerate; // Bilder pro Sekunde int error; char* ErrorText; void WriteJunkHeader(char* buffer, long size); void WriteTag(char* buffer); public: AviWrite(const char* FileName, long w, long h, int rate=25); ~AviWrite(); AviWrite& operator<<(const Image&); const char* get_Error() const { return ErrorText; } }; #endif
[ "boris@freakology.(none)" ]
[ [ [ 1, 35 ] ] ]
7bffade66643fffb308f93a8f034faaf4ac088fb
9773c3304eecc308671bcfa16b5390c81ef3b23a
/MDI AIPI V.6.92 2003 ( Correct Save Fired Rules, AM =-1, g_currentLine)/AIPI/ChartPointPropDlg.h
06b495f7b91eb1d086e401669aaf7c814e3e57d8
[]
no_license
15831944/AiPI-1
2d09d6e6bd3fa104d0175cf562bb7826e1ac5ec4
9350aea6ac4c7870b43d0a9f992a1908a3c1c4a8
refs/heads/master
2021-12-02T20:34:03.136125
2011-10-27T00:07:54
2011-10-27T00:07:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,411
h
#if !defined(AFX_CHARTPOINTPROPDLG_H__FAF80241_8AF1_4494_8D55_F0752CC7E9CD__INCLUDED_) #define AFX_CHARTPOINTPROPDLG_H__FAF80241_8AF1_4494_8D55_F0752CC7E9CD__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // ChartPointPropDlg.h : header file // ///////////////////////////////////////////////////////////////////////////// // CChartPointPropDlg dialog class CChartPointPropDlg : public CDialog { // Construction public: CChartPointPropDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CChartPointPropDlg) enum { IDD = IDD_CHART_POINTPROP_DLG }; CComboBox m_CtrlPointsType; int m_iPointsHeight; int m_iPointsWidth; int m_iPointsType; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CChartPointPropDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CChartPointPropDlg) virtual void OnCancel(); virtual void OnOK(); virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_CHARTPOINTPROPDLG_H__FAF80241_8AF1_4494_8D55_F0752CC7E9CD__INCLUDED_)
[ [ [ 1, 52 ] ] ]
dc755e84dd01055d605df5f2f1c51c0e2d724e6c
b73f27ba54ad98fa4314a79f2afbaee638cf13f0
/RegisterUtility/SoftwareEncrypt/InstallDate.h
ae9530d49b135b4556bdcd01ff9f533e5a7b988a
[]
no_license
weimingtom/httpcontentparser
4d5ed678f2b38812e05328b01bc6b0c161690991
54554f163b16a7c56e8350a148b1bd29461300a0
refs/heads/master
2021-01-09T21:58:30.326476
2009-09-23T08:05:31
2009-09-23T08:05:31
48,733,304
3
0
null
null
null
null
GB18030
C++
false
false
865
h
#ifndef _SOFTWARE_ENCRYPT_INSTALLDATE_H__ #define _SOFTWARE_ENCRYPT_INSTALLDATE_H__ #include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/date_time/posix_time/conversion.hpp> #include <windows.h> namespace software_encrypt { const int INSTALL_DAYS_ERROR = 0xFFFFFFFF; int setInstall(); std::string getInstallData(); unsigned int getInstalledDays(); // 获取安装的天数 boost::posix_time::ptime getInstallDataTime(); namespace internal_utility { void setInstallDataOnRegistry(const FILETIME &ft); void setInstallDateFile(const FILETIME &ft); void setInstallDateInWin(const FILETIME &ft); boost::posix_time::ptime getInstallDateFromRegistry() ; boost::posix_time::ptime getInstallDateFromFile() ; boost::posix_time::ptime getInstallDateFromWin() ; } }; #endif // _SOFTWARE_ENCRYPT_INSTALLDATE_H__
[ [ [ 1, 28 ] ] ]
a0e7edd4293e39f5a9eccdbefb515829f813866b
dd5c8920aa0ea96607f2498701c81bb1af2b3c96
/multicrewui/multicrewui.h
8a4ba44a17fb669b14699d3fb64d5b7b61ad6d4f
[]
no_license
BackupTheBerlios/multicrew-svn
913279401e9cf886476a3c912ecd3d2b8d28344c
5087f07a100f82c37d2b85134ccc9125342c58d1
refs/heads/master
2021-01-23T13:36:03.990862
2005-06-10T16:52:32
2005-06-10T16:52:32
40,747,367
0
0
null
null
null
null
UTF-8
C++
false
false
1,381
h
/* Multicrew Copyright (C) 2004,2005 Stefan Schimanski 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 MULTICREWUI_H_INCLUDED #define MULTICREWUI_H_INCLUDED #include "common.h" #include "resource.h" #include "../multicrewcore/multicrewcore.h" class MulticrewUI { public: MulticrewUI( HWND hwnd ); virtual ~MulticrewUI(); void host(); void connect(); void disconnect(); void status(); void start(); void log(); void async(); HMENU newMenu(); private: void updateMenu(); void disconnected( std::string error ); void logged( const char *line ); void asyncSlot(); void modeChanged( MulticrewCore::Mode newMode ); struct Data; friend Data; Data *d; }; #endif
[ "schimmi@cb9ff89a-abed-0310-8fc6-a4cabe7d48c9" ]
[ [ [ 1, 56 ] ] ]
0770d891e42c335a89a79f14ff5225bcf989ad5a
fd518ed0226c6a044d5e168ab50a0e4a37f8efa9
/iAuthor/AmpSdk/prodcode/StdAfx.cpp
44692651e39e7050a6adb49493c5a1a50c611a08
[]
no_license
shilinxu/iprojects
e2e2394df9882afaacfb9852332f83cbef6a8c93
79bc8e45596577948c45cf2afcff331bc71ab026
refs/heads/master
2020-05-17T19:15:43.197685
2010-04-02T15:58:11
2010-04-02T15:58:11
41,959,151
0
0
null
null
null
null
UTF-8
C++
false
false
210
cpp
// stdafx.cpp : source file that includes just the standard includes // ProdCode.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
[ [ [ 1, 8 ] ] ]
57f06f5c1a4708b99a80a880ea51b1a2fa01524b
ce2a953f667d34cc56d7ce1adc057504e6b0eabe
/Jepg/dialog.cpp
363eb21833b72950bd44775dcdf36b5e6d8186cc
[]
no_license
JCWu/jpeg-decoder
915cd44cf193628cf86a55cf882a6860b8bcc063
14e042ae7cd3724102cf625b75bc10b5693ace19
refs/heads/master
2021-01-10T16:32:56.438281
2010-12-14T14:39:28
2010-12-14T14:39:28
36,046,023
1
0
null
null
null
null
UTF-8
C++
false
false
1,014
cpp
#include "dialog.h" #include <windows.h> bool GetFileName(std::wstring &filename) { OPENFILENAME ofn; // common dialog box structure TCHAR szFile[260]; // buffer for file name HWND hwnd = 0; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd; ofn.lpstrFile = szFile; // Set lpstrFile[0] to '\0' so that GetOpenFileName does not // use the contents of szFile to initialize itself. ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = TEXT("Supported Image\0*.bmp;*.jpg\0"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; // Display the Open dialog box. if (GetOpenFileName(&ofn)==TRUE) { //hf = CreateFile(ofn.lpstrFile, GENERIC_READ, 0, (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL); filename = ofn.lpstrFile; return true; } return false; }
[ "[email protected]@c774a4f1-b9b9-ec5f-4c86-73bda70207c7" ]
[ [ [ 1, 33 ] ] ]
d75c195ebd4a36fa5b978e87fc904841df635f7b
c267e416aba473054330378d18bc3cd172bbad21
/Applet/VirtuaDesktop/lib/VirtualDesktop.cpp
baddf723fd317615b45b07cb25ad1fe23f2b4f08
[]
no_license
chenwp/shuax
c3b7dea72708ee539664ac8db1d9885e87fefed7
b13bea0aae7e252650f4c8f5df1b2a716455ef80
refs/heads/master
2021-04-26T16:43:25.168306
2011-10-22T15:09:37
2011-10-22T15:09:37
45,179,472
2
0
null
null
null
null
GB18030
C++
false
false
4,563
cpp
#include "stdlib.h" #include "LinkList.h" d_list::d_list() { d_nCount=0; now_pos=0; head=(node*)malloc(sizeof(node)); head->d_h=NULL; head->d=-1; head->next=NULL; tail=head; } d_list::~d_list() { node *temp=head->next,*m_head; while(temp!=NULL) { m_head=temp->next; free(temp); d_nCount--; temp=m_head; } tail=head; } void d_list::get() { node *temp=head->next,*m_head; while(temp!=NULL) { m_head=temp->next; free(temp); d_nCount--; temp=m_head; } tail=head; } int d_list::d_insert(HWND h,int n) { node *temp=(node*)malloc(sizeof(node)); temp->d_h=h; temp->d=n; temp->next=NULL; tail->next=temp; tail=temp; d_nCount++; return 0; } int d_list::d_delete(HWND h,int n) { node *temp=head->next; node *pre=NULL; while(temp->d_h!=h) { pre=temp; temp=temp->next; } if(temp) { pre->next=temp->next; free(temp); d_nCount--; } return 0; } int d_list::d_haveSame(HWND h) { int n=0; node *temp=head->next; while(temp->d_h!=h) { temp=temp->next; n++; } if(temp!=NULL) return n; else return -1; } HWND d_list::d_read(int n) { node *temp=head; while(n>0) { temp=temp->next; n--; } return temp->d_h; } int d_list::d_getnCount() { return d_nCount; } d_list &d_list::operator =(d_list &m_list) { // this->~d_list(); this->get(); int d=m_list.d_getnCount(); int i=1; while(i<=d) { this->d_insert(m_list.d_read(i++),0); } return *this; } int d_list::d_comp(d_list &m_list) { int i1=this->d_getnCount(); int i2=m_list.d_getnCount(); int i3=1,i4=1; int temp; //前者与后者比较 temp=i1; while(i3<=i2) { while(i1>=1) { if(this->d_read(i1)==m_list.d_read(i3)) { m_list.d_setpos(i3,1); //找到了 break; } i1--; } if(i1==0) m_list.d_setpos(i3,0); //没找到 i1=temp; i3++; } //后者与前者相比较 i1=this->d_getnCount(); i2=m_list.d_getnCount(); temp=i2; while(i4<=i1) { while(i2>=1) { if(this->d_read(i4)==m_list.d_read(i2)) { this->d_setpos(i4,1); //找到了 break; } i2--; } if(i2==0) this->d_setpos(i4,0); //没找到 i2=temp; i4++; } return 0; } int d_list::d_setpos(int n,int num) { node *temp=head; while(n>0) { temp=temp->next; n--; } temp->d=num; return 0; } int d_list::d_read_add(d_list &m_list,int way) { int i=1; node *temp=head->next; while(i<=d_nCount) { if((way==0)&&(temp!=NULL)&&(temp->d==0)) m_list.d_delete(temp->d_h,0); if((way==1)&&(temp!=NULL)&&(temp->d==0)) m_list.d_insert(temp->d_h,0); temp=temp->next; i++; } return 0; } int DESKTOPNUM = 4; int pre_desk_num; int now_desk_num; d_list now_desk; d_list pre_desk; d_list desktop[9]; BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { char buff[256]; if (GetWindowLong(hwnd, GWL_STYLE) & WS_VISIBLE) { GetWindowText(hwnd, buff, 255); if (lstrcmp(buff, szClassName) == 0) //自己 return 1; if (lstrcmp(buff, "Program Manager") == 0) //桌面 return 1; GetClassName(hwnd, buff, 255); if (lstrcmp(buff, "tooltips_class32") == 0) //任务栏提示 return 1; if (lstrcmp(buff, "Shell_TrayWnd") == 0) //任务栏 return 1; if (lstrcmp(buff, "WorkerW") == 0) //桌面图标 return 1; now_desk.d_insert(hwnd, 0); ShowWindow(hwnd, SW_HIDE); } return 1; } void ContorlVirtualDesktop(int x,HWND hWnd) { if(x>=DESKTOPNUM) return; if(now_desk_num==x) return; pre_desk_num = now_desk_num; pre_desk = now_desk; now_desk_num = x; EnumWindows(EnumWindowsProc, LPARAM(NULL)); pre_desk.d_comp(now_desk); pre_desk.d_read_add(desktop[pre_desk_num], 0); now_desk.d_read_add(desktop[pre_desk_num], 1); desktop[now_desk_num].d_comp(now_desk); desktop[now_desk_num].d_read_add(desktop[now_desk_num], 0); if(x==0) { desktop[now_desk_num].d_comp(now_desk); desktop[now_desk_num].d_read_add(desktop[now_desk_num],0); } int i = 1; while (i <= desktop[now_desk_num].d_getnCount()) ::ShowWindow(desktop[now_desk_num].d_read(i++), SW_SHOW); InvalidateRect(hWnd, NULL, TRUE); }
[ [ [ 1, 247 ] ] ]
2d16ce3d9a7ff6196f93d1b9b1a386e8db60cb3b
58ef4939342d5253f6fcb372c56513055d589eb8
/LemonPlayer_2nd/Source/LPPlaylist/src/PlaylistControl.cpp
fa79926f491995837d7d71287c79a5c04464628e
[]
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,977
cpp
/* ============================================================================ Name : PlaylistControl.cpp Author : zengcity Version : 1.0 Copyright : Your copyright notice Description : CPlaylistControl implementation ============================================================================ */ #include "PlaylistControl.h" #include "CustomControlList.h" #include "MacroUtil.h" CPlaylistControl::CPlaylistControl() { // No implementation required } CPlaylistControl::~CPlaylistControl() { SAFE_DELETE(iList); } CPlaylistControl* CPlaylistControl::NewLC() { CPlaylistControl* self = new (ELeave)CPlaylistControl(); CleanupStack::PushL(self); self->ConstructL(); return self; } CPlaylistControl* CPlaylistControl::NewL() { CPlaylistControl* self=CPlaylistControl::NewLC(); CleanupStack::Pop(); // self; return self; } void CPlaylistControl::ConstructL() { iList = CCustomControlList::NewL(); TPoint point(0, 0); TSize size(100, 100); iList->InitData(point, size, size); } void CPlaylistControl::SetShowDesArray(CDesCArrayFlat& aDesArray) { iList->ClearItem(); for (TInt i=0; i<aDesArray.Count(); i++) { iList->AddItem(aDesArray[i]); } } void CPlaylistControl::SetShowDesArray(RPointerArray<ListItemStruct>* aList) { iList->ResetItem(aList); } void CPlaylistControl::Draw(CBitmapContext& gc) { iList->Draw(gc); } TInt CPlaylistControl::Update(ECustomControlDirection aDirection) { return iList->Update(aDirection); } void CPlaylistControl::CleanList() { iList->ClearItem(); } void CPlaylistControl::AddListItem(const TDesC& aName, TInt aIndex) { iList->AddItem(aName, aIndex); } void CPlaylistControl::AddListItem(pListItemStruct aItem) { iList->AddItem(aItem); } void CPlaylistControl::SelectEvent() { } pListItemStruct CPlaylistControl::GetCurrentItem() { return iList->GetCurrentItem(); }
[ "zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494" ]
[ [ [ 1, 97 ] ] ]
694774cea1dc16ed0aeafa6e1d35329a297b6524
ef23e388061a637f82b815d32f7af8cb60c5bb1f
/src/mame/includes/drmicro.h
20927c1ffe24b84eee5fc009bd1e3950e6abcbde
[]
no_license
marcellodash/psmame
76fd877a210d50d34f23e50d338e65a17deff066
09f52313bd3b06311b910ed67a0e7c70c2dd2535
refs/heads/master
2021-05-29T23:57:23.333706
2011-06-23T20:11:22
2011-06-23T20:11:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
814
h
/************************************************************************* Dr. Micro *************************************************************************/ class drmicro_state : public driver_device { public: drmicro_state(running_machine &machine, const driver_device_config_base &config) : driver_device(machine, config) { } /* memory pointers */ UINT8 * m_videoram; /* video-related */ tilemap_t *m_bg1; tilemap_t *m_bg2; int m_flipscreen; /* misc */ int m_nmi_enable; int m_pcm_adr; /* devices */ device_t *m_msm; }; /*----------- defined in video/drmicro.c -----------*/ PALETTE_INIT( drmicro ); VIDEO_START( drmicro ); SCREEN_UPDATE( drmicro ); WRITE8_HANDLER( drmicro_videoram_w );
[ "Mike@localhost" ]
[ [ [ 1, 37 ] ] ]
28ff25be3df8e8cda1b1ee50034eec27fed84e26
0fe672525051ffc86e93706c57103d180a95d736
/RoboEnvCompiler/trunk/RoboEnvCompiler/rimalWindow.h
423fe5d296ff6db942f1c6c355efe4f8a97e04dd
[]
no_license
Kristijan10048/roboenvcompiler
b168375c7700e1c3e3e6a264538b9328745db8be
231e6287e2593bcaaead6d4faf3b526b9e866f94
refs/heads/master
2021-01-10T16:44:21.712143
2010-06-16T22:40:43
2010-06-16T22:40:43
44,439,492
0
0
null
null
null
null
UTF-8
C++
false
false
5,574
h
#pragma once using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; namespace RoboEnvCompiler { /// <summary> /// Summary for rimalWindow /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public ref class rimalWindow : public System::Windows::Forms::Form { public: rimalWindow(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~rimalWindow() { if (components) { delete components; } } private: System::Windows::Forms::TableLayoutPanel^ tableLayoutPanel1; protected: private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::GroupBox^ groupBox1; public: System::Windows::Forms::RichTextBox^ richTextBox1; private: private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(rimalWindow::typeid)); this->tableLayoutPanel1 = (gcnew System::Windows::Forms::TableLayoutPanel()); this->button1 = (gcnew System::Windows::Forms::Button()); this->groupBox1 = (gcnew System::Windows::Forms::GroupBox()); this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox()); this->tableLayoutPanel1->SuspendLayout(); this->groupBox1->SuspendLayout(); this->SuspendLayout(); // // tableLayoutPanel1 // this->tableLayoutPanel1->ColumnCount = 3; this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent, 45))); this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent, 6.04333F))); this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent, 49.03079F))); this->tableLayoutPanel1->Controls->Add(this->button1, 1, 0); this->tableLayoutPanel1->Dock = System::Windows::Forms::DockStyle::Bottom; this->tableLayoutPanel1->Location = System::Drawing::Point(0, 530); this->tableLayoutPanel1->Name = L"tableLayoutPanel1"; this->tableLayoutPanel1->RowCount = 1; this->tableLayoutPanel1->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Percent, 100))); this->tableLayoutPanel1->Size = System::Drawing::Size(877, 31); this->tableLayoutPanel1->TabIndex = 4; // // button1 // this->button1->AutoSize = true; this->button1->Location = System::Drawing::Point(397, 3); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(46, 23); this->button1->TabIndex = 1; this->button1->Text = L"OK"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &rimalWindow::button1_Click); // // groupBox1 // this->groupBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right)); this->groupBox1->Controls->Add(this->richTextBox1); this->groupBox1->Location = System::Drawing::Point(12, 12); this->groupBox1->Name = L"groupBox1"; this->groupBox1->Size = System::Drawing::Size(853, 512); this->groupBox1->TabIndex = 6; this->groupBox1->TabStop = false; // // richTextBox1 // this->richTextBox1->Dock = System::Windows::Forms::DockStyle::Fill; this->richTextBox1->Location = System::Drawing::Point(3, 16); this->richTextBox1->Name = L"richTextBox1"; this->richTextBox1->Size = System::Drawing::Size(847, 493); this->richTextBox1->TabIndex = 0; this->richTextBox1->Text = L""; // // rimalWindow // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(877, 561); this->Controls->Add(this->groupBox1); this->Controls->Add(this->tableLayoutPanel1); this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon"))); this->Name = L"rimalWindow"; this->Text = L"rimalWindow"; this->tableLayoutPanel1->ResumeLayout(false); this->tableLayoutPanel1->PerformLayout(); this->groupBox1->ResumeLayout(false); this->ResumeLayout(false); } #pragma endregion private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { this->Close(); } }; }
[ "kristijan.petkov@c259c68d-e23d-8608-8b20-da301517ae45" ]
[ [ [ 1, 144 ] ] ]
737b69708596f8e730b2e99f0e346e87bd8e367c
28b0332fabba904ac0668630f185e0ecd292d2a1
/src/Common/ClassInstance.h
692e5d51b96adc69008305557b2bfed1f457884d
[]
no_license
iplayfast/crylib
57a507ba996d1abe020f93ea4a58f47f62b31434
dbd435e14abc508c31d1f2f041f8254620e24dc0
refs/heads/master
2016-09-05T10:33:02.861605
2009-04-19T05:17:55
2009-04-19T05:17:55
35,353,897
0
0
null
null
null
null
UTF-8
C++
false
false
4,191
h
/*************************************************************************** * Copyright (C) 2003 by Chris Bruner * * [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. * ***************************************************************************/ #include "HeadImp.h" //#include "classbuilder.h" #include "PrimInstance.h" namespace Crystal { #ifndef CClassInstance #define CClassInstance "ClassInstance" class ClassBuilder; /** When designing a new class this class will represent internal instances of classes used by the class. (The same way that you can have int's etc). @author Chris Bruner */ class ClassInstance : public PrimInstance { String Type;// TODO Handle Instance as pointer Object *p; // one instance so we can figure out includes and abstract /// checks for file preexisting, and if not and p->IsA(Type) then adds it. bool HasDefault; // set to true if a default property is set, public: StdFunctionsNoDup(ClassInstance,CodeFactory); ClassInstance(CodeFactory *Parent) : PrimInstance(Parent) { p = 0; HasDefault = false;} ~ClassInstance(); // ClassInstance(CodeFactory *Parent,const char *ClassType,const char *ClassName,int count,bool IsProperty,bool IsPointer,bool IsArrayPointer,const char *DefaultValue); virtual Object *Create(const PropertyParser &PropertyName,CodeFactory *Parent); virtual const char *GetType() const; const Object *Getp() const { return p; } virtual bool SetProperty(const PropertyParser &PropertyName,const char *PropertyValue); virtual bool HasProperty(const PropertyParser &PropertyName) const; /*! The count of the properties a class has */ virtual int GetPropertyCount() const; /*! will return the property named in PropertyName in a string format */ virtual const char *GetProperty(const PropertyParser &PropertyName,String &Result) const; /*! Make a list of all property names, the function is called from the parent class through each inheritance until it reaches this class, at which point a list is created and filled with any properties on the way back through the inheritance */ virtual PropertyList* PropertyNames() const; //bool GetIsProperty() const; //void SetIsArrayPointer(bool _IsArrayPointer); //bool GetIsArrayPointer() const; virtual Object *Create(const PropertyParser &PropertyName,Object *Parent) { return CodeFactory::Create(PropertyName,Parent); } virtual Object *Create(Stream &FromStream) { return CodeFactory::Create(FromStream); } virtual Object *Create(const char *FactoryName,const PropertyParser &PropertyName,Object *Parent) { return PrimInstance::Create(FactoryName,PropertyName,Parent); } virtual const char *Code_AssignDefaultValue(String &Result) const; virtual const char *Code_SetProperty(String &Result) const; virtual const char *Code_GetProperty(String &Result) const; }; #endif }
[ "cwbruner@f8ea3247-a519-0410-8bc2-439d413616df" ]
[ [ [ 1, 84 ] ] ]
177015bbe38498ac3e4155233aa6d767f659f86a
74c8da5b29163992a08a376c7819785998afb588
/NetAnimal/Game/wheel/MyWheelController/include/ScoreData.h
0f4b4ef03796b0b369fcb5b0440ab40a05f52462
[]
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
577
h
#ifndef __Orz_ScoreData_h__ #define __Orz_ScoreData_h__ #include "WheelControllerConfig.h" #include "WheelEnum.h" #include "WinData.h" #include "CoinPool.h" namespace Orz { /*class ScoreData { public: ScoreData(void):_pool(0),_awardRateOfReturn(0.90f) {} static WheelEnum::AnimalItem getAnimalItem(int button); static WheelEnum::WINNER getWinner(int button); static int innuendo(int button); private: unsigned int _pool; unsigned int _prizePool; unsigned int _harvest; float _awardRateOfReturn; }; */ } #endif
[ [ [ 1, 33 ] ] ]
01d183560348476aa224dfff16c4ba4697421cc1
58b7b01fdb47eb6f05682f4f1fc26e69616a1c0b
/addons/ofxFiducialFinder/src/ofxFiducial.h
40018f0e9c384bf9baa22b317c6075a143e09083
[]
no_license
brolin/openFrameworks
8942e3152ad5e89645782a9ba6447ed8865263ee
d97c18b3b02dba8d5d39adc4d2541960449e024f
refs/heads/master
2020-12-30T18:38:57.092170
2010-11-17T15:01:57
2010-11-17T15:01:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,354
h
/* * ofxFiducial.h * openFrameworks * * Created by Alain Ramos a.k.a. ding * Copyright 2008 Alain Ramos. * * For Free 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. */ // ---------------------------------------------------------------------------------------------------- #ifndef OF_X_FIDUCIAL_H #define OF_X_FIDUCIAL_H #include "ofMain.h" #include "libfidtrack/fidtrackX.h" #define INVALID_ID (-1) #define FIDUCIAL_LOST 0 #define FIDUCIAL_FOUND 1 #define FIDUCIAL_INVALID 2 #define FIDUCIAL_WRONG 3 #define FIDUCIAL_REGION 4 //this is for storing x, y and angle //and to figure out speed and acceleration of position, rotation and angle struct _frame { float xpos,ypos,angle; float rotation_speed, rotation_accel; float motion_speed, motion_accel; float motion_speed_x, motion_speed_y; int time; float cameraToScreen_xpos,cameraToScreen_ypos; }; class ofxFiducial { public: //public variables //****//-------------------------------------------------------------------------------------- int fidId; // fiducial id float r_size, l_size; //root size and leaf size _frame current, last; //current and last fid info bool updateCorners; //do we want to auto update corners? vector <ofPoint> cornerPoints;//vector to store corner points //For CCV purpose only , to map into calibration float x_pos,y_pos; //Constructor //****//-------------------------------------------------------------------------------------- ofxFiducial() { fidId = INVALID_ID; current.xpos = current.ypos = -100.0f; current.angle = 0.0f; current.rotation_speed = current.rotation_accel = 0.0f; current.motion_speed = current.motion_accel = 0.0f; current.motion_speed_x = current.motion_speed_y = 0.0f; alive = true; cornersUpdated = false; updated = false; updateCorners = false; life = 3; current.time = 0; cornerPoints.resize(4); saveLastFrame(); } //getter functions //****//-------------------------------------------------------------------------------------- int getId() { return fidId; } float getMSpeed() { return current.motion_speed; } float getMAccel() { return current.motion_accel; } float getMSpeedX() { return current.motion_speed_x; } float getMSpeedY() { return current.motion_speed_y; } float getX() { return current.xpos; } float getY() { return current.ypos; } float getAngle() { return TWO_PI - current.angle; } //radian (phi) float getAngleDeg() { return 360 - (current.angle * ( 180 / PI )); } //reversed to compensate for OF float getRSpeed() { return current.rotation_speed; } float getRAccel() { return current.rotation_accel; } float getRootSize() { return r_size; } bool getCornerUpdateStatus() { return updateCorners; } void setUpdateCorners(bool _update){ updateCorners = _update; } //added by Stefan Schlupek //TODO : last.... / give the cameraToScreenMap? float getCameraToScreenX() { return current.cameraToScreen_xpos; } float getCameraToScreenY() { return current.cameraToScreen_ypos; } void setCameraToScreenPosition(float x, float y){ //printf("fiducial.setCameraToScreenPosition:%f:%f\n", x,y); current.cameraToScreen_xpos= x; current.cameraToScreen_ypos= y; }; void initLastFrame(){ //printf("fiducial.initLastFrame:%p:\n", this); saveLastFrame(); } //------------------------ //Update Fiducial //****//-------------------------------------------------------------------------------------- void update(float _x, float _y, float _angle, float _root, float _leaf) { //printf("---fiducial.update:%p:\n", this); //printf("fiducial.update.raw:%f:%f\n", _x,_y); //this is to try and filter out some of the jitter //------------------------------------------------ float jitterThreshold = 1.0; //if new posit - current posit is less than threshold dont update it must be jitter if ( fabs(_x - current.xpos) > jitterThreshold ) current.xpos = _x; else current.xpos = last.xpos; if ( fabs(_y - current.ypos) > jitterThreshold ) current.ypos = _y; else current.ypos = last.ypos; //if new angle - current angle is less than threshold/20 dont update it must be jitter if ( fabs(_angle - current.angle) > jitterThreshold/20 ) current.angle = _angle; else current.angle = last.angle; //------------------------------------------------ //printf("fiducial.update:%f:%f\n", current.xpos,current.ypos); current.time = ofGetElapsedTimeMillis(); //get current time r_size = _root; //update root size l_size = _leaf; //update leaf size state = FIDUCIAL_FOUND; //fiducial found updated = true; //got updated computeSpeedAccel(); //compute speed & acceleration if ( updateCorners ) computeCorners(); //figures out the corners and fills the cornerPoints vector else cornersUpdated = false; saveLastFrame(); //last frame equal to this frame } //Check for Removal //this is done to make sure is survives for 2 frames if found missing //****//-------------------------------------------------------------------------------------- bool isAlive() { //if not updated take care of some things if (!updated) { state = FIDUCIAL_LOST; //lable as lost current.time = ofGetElapsedTimeMillis(); current.xpos = last.xpos; current.ypos = last.ypos; current.angle = last.angle; computeSpeedAccel(); --life; //if not updated subtract life } if (!life) alive = false; //if life is gone alive is false ae. it is dead updated = false; //reset updated message return alive; //return life state } //computes the corners an fills the cornerPoints vector //****//-------------------------------------------------------------------------------------- void computeCorners() { //**here is the order// //0+______+1// // | | // // | | // //3+______+2// //clear vector cornerPoints.clear(); //get upper left corner float upperLeftCornerX = current.xpos - (r_size/2); float upperLeftCornerY = current.ypos - (r_size/2); // this is half the width ---- ^^^^ //get the hypotenuse float hyp = getDistance(upperLeftCornerX, upperLeftCornerY); //get the current angle in radian //must add pi to the radian to compensate for OF fliped cartesian coordinates float rad = getAngle() + PI; //the point we are going to use ofPoint addPoint; //this formula finds a point in the circumfrence of a circle //point.x = hypotenuse * cos(radian) //point.y = hypotenuse * sin(radian) //*corner degrees*/ //UR = 45 //UL = 135 //LL = 225 //LR = 315 //http://en.wikipedia.org/wiki/Unit_circle //upper left addPoint.set((hyp * cos(rad + radians(135))) + current.xpos, (hyp * sin(rad + radians(135))) + current.ypos); cornerPoints.push_back(addPoint); //upper right addPoint.set((hyp * cos(rad + radians(45))) + current.xpos, (hyp * sin(rad + radians(45))) + current.ypos); cornerPoints.push_back(addPoint); //lower right addPoint.set((hyp * cos(rad + radians(315))) + current.xpos, (hyp * sin(rad + radians(315))) + current.ypos); cornerPoints.push_back(addPoint); //lower left addPoint.set((hyp * cos(rad + radians(225))) + current.xpos, (hyp * sin(rad + radians(225))) + current.ypos); cornerPoints.push_back(addPoint); cornersUpdated = true; } //is a point inside this fiducial //http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/ //****//-------------------------------------------------------------------------------------- bool isPointInside(float _x, float _y) { if ( !cornersUpdated ) computeCorners(); int counter = 0; int i; double xinters; ofPoint p1,p2; p1 = cornerPoints[0]; for (i=1;i<=4;i++) { p2 = cornerPoints[i % 4]; if (_y > MIN(p1.y,p2.y)) { if (_y <= MAX(p1.y,p2.y)) { if (_x <= MAX(p1.x,p2.x)) { if (p1.y != p2.y) { xinters = (_y-p1.y)*(p2.x-p1.x)/(p2.y-p1.y)+p1.x; if (p1.x == p2.x || _x <= xinters) counter++; } } } } p1 = p2; } if (counter % 2 == 0) return false; else return true; } // Returns true if this fiducial collided with an other fiducial. //****//-------------------------------------------------------------------------------------- bool isFidCollided(ofxFiducial& fiducial_2) { //make sure corners are up to date fiducial_2.computeCorners(); int counter = 0; bool inside = false; //check to make sure none of that fiducials points are inside this fiducial for(int i = 0; i < 4 ;i++) { if ( isPointInside(fiducial_2.cornerPoints[i].x, fiducial_2.cornerPoints[i].y) ) counter++; } //if we found a point its inside of us if (counter > 0) inside = true; //check to make sure none of this fiducials points are inside that fiducial for(int i = 0; i < 4 ;i++) { if ( fiducial_2.isPointInside(cornerPoints[i].x, cornerPoints[i].y) ) counter++; } //if we found a point we are inside of it if (counter > 0) inside = true; //return result return inside; } // returns the distance to this fiducials current position //****//-------------------------------------------------------------------------------------- float getDistance(float _x, float _y) { float dx = _x - current.xpos; float dy = _y - current.ypos; return sqrt(dx*dx+dy*dy); } //Operator overloading for FiducialX & ofxFiducial //****//-------------------------------------------------------------------------------------- void operator=( const FiducialX& fiducial) { fidId = fiducial.id; current.xpos = fiducial.x; current.ypos = fiducial.y; current.angle = fiducial.angle; r_size = fiducial.root_size; l_size = fiducial.leaf_size; current.time = ofGetElapsedTimeMillis(); } void operator=( const ofxFiducial& fiducial) { fidId = fiducial.fidId; current.xpos = fiducial.current.xpos; current.ypos = fiducial.current.ypos; current.angle = fiducial.current.angle; r_size = fiducial.r_size; l_size = fiducial.l_size; current.time = fiducial.current.time; } //draw fiducial //****//-------------------------------------------------------------------------------------- void draw( float _x, float _y ) { ofNoFill(); ofSetRectMode(OF_RECTMODE_CENTER); glPushMatrix(); glTranslatef(current.xpos + _x, current.ypos + _y, 0); float deg = degrees(getAngle()); // get degree glRotatef(deg, 0, 0, 1.0); // must flip degrees to compensate for image flip ofSetColor(255, 0, 0);//set color red ofRect(0, 0, r_size, r_size); //draw root size red ofSetColor(0, 0, 255); //set color blue ofCircle(0, l_size*4, l_size); //draw leaf size blue ofSetColor(0, 255, 0); //set color green ofDrawBitmapString(ofToString( fidId ), 0, 0); //draw fiducial number green glPopMatrix(); ofSetRectMode(OF_RECTMODE_CORNER); ofSetColor(255,255,255); } //**** added by Stefan Schlupek//-------------------------------------------------------------------------------------- void drawScaled( float _x, float _y, float _scale_x, float _scale_y) { ofFill(); ofEnableAlphaBlending() ; ofSetRectMode(OF_RECTMODE_CENTER); glPushMatrix(); glTranslatef((current.xpos*_scale_x) + _x, (current.ypos* _scale_y) + _y, 0); float deg = degrees(getAngle()); // get degree glRotatef(deg, 0, 0, 1.0); // must flip degrees to compensate for image flip ofSetColor(0, 255, 0,104);//set color green ofRect(0, 0, r_size*_scale_x, r_size*_scale_y); //draw root size red ofDisableAlphaBlending() ; ofNoFill(); ofSetColor(0, 0, 255); //set color blue ofCircle(0, l_size*4, 4); //draw leaf size blue ofSetColor(0, 54, 0); //set color green ofDrawBitmapString(ofToString( fidId ), 0, 0); //draw fiducial number green glPopMatrix(); ofSetRectMode(OF_RECTMODE_CORNER); ofSetColor(255,255,255); } //draw corners //****//-------------------------------------------------------------------------------------- void drawCorners( float _x, float _y ) { if ( !cornersUpdated ) computeCorners(); ofSetColor(0, 255, 0); ofNoFill(); glPushMatrix(); glTranslatef(_x, _y, 0); if (cornerPoints.size() > 0) { for(int i = 0; i < cornerPoints.size() ;i++) { ofCircle(cornerPoints[i].x, cornerPoints[i].y, 4); ////printf("corner 0.x: %f corner 0.y %f\n", cornerPoints[i].x, cornerPoints[i].y); } } glPopMatrix(); ofSetColor(255,255,255); //printf("corner 0.x: %f corner 0.y %f\n", cornerPoints[0].x, cornerPoints[0].y); } //**** added by Stefan Schlupek//-------------------------------------------------------------------------------------- void drawCornersScaled( float _x, float _y, float _scale_x, float _scale_y ) { if ( !cornersUpdated ) computeCorners(); ofSetColor(0, 255, 0); ofNoFill(); glPushMatrix(); glTranslatef(_x, _y, 0); if (cornerPoints.size() > 0) { for(int i = 0; i < cornerPoints.size() ;i++) { ofCircle(cornerPoints[i].x*_scale_x, cornerPoints[i].y*_scale_y, 3); ////printf("corner 0.x: %f corner 0.y %f\n", cornerPoints[i].x, cornerPoints[i].y); } } glPopMatrix(); ofSetColor(255,255,255); //printf("corner 0.x: %f corner 0.y %f\n", cornerPoints[0].x, cornerPoints[0].y); } //private stuff //****//-------------------------------------------------------------------------------------- private: bool alive; //can we remove fid from list bool updated;// has fid been updated bool cornersUpdated; int life;//fids lifespan in frames int state;//fids lost/found state // conversions from degree to radian and back float radians (float degrees) { return degrees*PI/180.0; } float degrees (float radians) { return radians*180.0/PI; } //compute speed, accel, etc... void computeSpeedAccel() { if (last.time==0) return; int dt = current.time - last.time; float dx = current.xpos - last.xpos; float dy = current.ypos - last.ypos; float dist = sqrt(dx*dx+dy*dy); current.motion_speed = dist/dt; current.motion_speed_x = fabs(dx/dt); current.motion_speed_y = fabs(dy/dt); current.rotation_speed = fabs(current.angle-last.angle)/dt; current.motion_accel = (current.motion_speed-last.motion_speed)/dt; current.rotation_accel = (current.rotation_speed-last.rotation_speed)/dt; } //make last frame = this frame void saveLastFrame() { last.time = current.time; last.xpos = current.xpos; last.ypos = current.ypos; last.angle = current.angle; last.motion_speed = current.motion_speed; last.rotation_speed = current.rotation_speed; } }; #endif
[ [ [ 1, 442 ] ] ]
b9007ddec9e9838c47e582b64c7175707c1b7710
7956f4ceddbbcbabd3dd0ae211899cfa5934fc7a
/OgreSnowSim/OgreCudaHelper.h
c7c4fb0b9e09b782f414b3b46a92a4ac1dcb8277
[]
no_license
pranavsureshpn/gpusphsim
8d77cde45f5951aee65a13d1ea7edcb5837c6caa
723d950efbd0d2643edb4b99845bcc658ce38f20
refs/heads/master
2021-01-10T05:18:21.705120
2011-09-08T01:58:38
2011-09-08T01:58:38
50,779,129
0
0
null
null
null
null
UTF-8
C++
false
false
1,233
h
#ifndef __OgreCudaHelper_h__ #define __OgreCudaHelper_h__ //#include <cutil_inline.h> //#include <cutil_gl_inline.h> #include "OgreHardwareBufferManager.h" #include "OgreHardwareVertexBuffer.h" #include "OgreGLRenderSystem.h" #include "OgreGLHardwareVertexBuffer.h" #include "OgreD3D9RenderSystem.h" #include "OgreD3D9HardwareVertexBuffer.h" #define SPHSIMLIB_3D_SUPPORT #include "SnowSimConfig.h" #include "SimCudaHelper.h" namespace SnowSim { class OgreCudaHelper { public: OgreCudaHelper::OgreCudaHelper(SnowSim::Config *config, SimLib::SimCudaHelper *simCudaHelper); ~OgreCudaHelper(); void Initialize(); // CUDA REGISTER void RegisterHardwareBuffer(Ogre::HardwareVertexBufferSharedPtr hardwareBuffer); void UnregisterHardwareBuffer(Ogre::HardwareVertexBufferSharedPtr hardwareBuffer); // CUDA MAPPING void MapBuffer(void **devPtr, Ogre::HardwareVertexBufferSharedPtr bufObj); void UnmapBuffer(void **devPtr, Ogre::HardwareVertexBufferSharedPtr bufObj); private: SnowSim::Config *mSnowConfig; SimLib::SimCudaHelper *mSimCudaHelper; enum RenderingMode { GL = 0, D3D9 = 1, }; RenderingMode mRenderingMode; }; } #endif
[ "oystein.krog@cd07e373-eec6-1eb2-8c47-9a5824a9cb26", "yaoyansi@cd07e373-eec6-1eb2-8c47-9a5824a9cb26" ]
[ [ [ 1, 4 ], [ 6, 16 ], [ 19, 55 ] ], [ [ 5, 5 ], [ 17, 18 ] ] ]
6a90823cbf6109d6e759c8deb0f712450e96c154
5e5e02f7663d86089d87d47aebf609ec6dbcf97c
/Ghost.h
8854adbc9434259e9bbee3e72e89dc178fe37ca3
[]
no_license
mcejp/PacWorld
3483fce6512848dbc45dcea33a558b522faf24e2
b900387ac36d3f2f226c4534cd34ba90c7e7e9c3
refs/heads/master
2020-05-18T17:23:10.795308
2000-10-08T09:22:14
2019-05-02T09:22:14
184,553,619
2
0
null
null
null
null
ISO-8859-1
C++
false
false
1,248
h
// Ghost.h: Schnittstelle für die Klasse CGhost. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_GHOST_H__906E8DE0_B882_11D3_A5E4_B5590424C036__INCLUDED_) #define AFX_GHOST_H__906E8DE0_B882_11D3_A5E4_B5590424C036__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include <CDX.H> #include "cdxhpc.h" class CGhost { private: int index; CDXHPC pc1, pc2; int paccyX, paccyY; bool chased; int leftPassage, rightPassage; bool newDir; int goWhere; int dir; int x,y,v; int hideoutY; int hideoutX; bool up, down, left, right; bool goUp, goDown, goLeft, goRight; void StartGhost(); CDXMap* Map; public: bool onWayHome; void MoveHome(); bool vulnerable; bool startingPhase; void Reset(); void SetIndex(int index); bool alive; void Kill(); int lives; bool isNear; void SetPaccyState(int x, int y, bool ch); void SetPassages(int y1, int y2); int GetY(); int GetX(); bool started; void SetHideout(int x, int y); void MoveGhost(); int moving; void SetMap(CDXMap *map); CGhost(); virtual ~CGhost(); }; #endif // !defined(AFX_GHOST_H__906E8DE0_B882_11D3_A5E4_B5590424C036__INCLUDED_)
[ [ [ 1, 61 ] ] ]
aa0696364ab909dc60204175a3e541fd3257639d
77957df975b0b622fdbfede798b83c1d30ae117d
/practica2/Input/InputManager.h
f577f1c03be9c8f6ba308b5c1dd22e2afb2d7390
[]
no_license
Juanmaramon/aplicacion-practica-basica
92f80b0699c8450c3c32a6cdaff395bb257d3a95
9d7776dcc55c7de4cf03085c998d6c7461f4cae5
refs/heads/master
2016-08-12T19:49:55.787837
2011-07-10T15:34:01
2011-07-10T15:34:01
43,250,262
0
0
null
null
null
null
UTF-8
C++
false
false
1,121
h
#ifndef INPUT_MANAGER #define INPUT_MANAGER #include <vector> #include "InputAction.h" #include "InputEntry.h" #include "Keyboard.h" #include "..\Utility\Singleton.h" #define IsPressed( ACTION ) cInputManager::Get().GetAction( ACTION ).GetIsPressed() class OIS::InputManager; enum eDevices { eKeyboard = 0 }; struct tActionMapping { int miAction; int miDevice; int miChannel; }; class cInputManager : public cSingleton<cInputManager> { public: void Init( const tActionMapping laActionMapping[], unsigned luiActionCount ); void Update(const float &lfTimestep); void Deinit(); inline cInputAction &GetAction(const int &lActionId){ return mActions[lActionId]; } friend class cSingleton<cInputManager>; protected: cInputManager() { ; } // Protected constructor private: float Check(int liDevice, int liChannel); std::vector <cInputAction> mActions; std::vector <cGenericDevice *> mDevices; std::vector < std::vector < cInputEntry > > mMapped; // Specific OIS vars friend class cKeyboard; OIS::InputManager * mpOISInputManager; }; #endif
[ [ [ 1, 47 ] ] ]
0985022d2bbe07fb828a66aaec3bf59cfac2a96a
e354a51eef332858855eac4c369024a7af5ff804
/mysqldb.h
d4b13df65b7358e9432f800e094fd6d2c1fe32d7
[]
no_license
cjus/msgCourierLite
0f9c1e05b71abf820c55f74a913555eec2267bb4
9efc1d54737ba47620a03686707b31b1eeb61586
refs/heads/master
2020-04-05T22:41:39.141740
2010-09-05T18:43:12
2010-09-05T18:43:12
887,172
1
0
null
null
null
null
UTF-8
C++
false
false
1,913
h
/* mysqldb.h Copyright (C) 2002 Carlos Justiniano [email protected], [email protected], [email protected] mysqldb.h 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. mysqldb.h was developed by Carlos Justiniano for use on the msgCourier project and the ChessBrain Project and is now 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 main.cpp; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MYSQLDB_H #define _MYSQLDB_H #include <stdio.h> #define _USEDB 1 #ifdef _PLATFORM_WIN32 #ifdef _USEDB #include "mysql.h" #endif //_USEDB #else #include </usr/include/mysql/mysql.h> #endif //_PLATFORM_WIN32 #include "idatabase.h" class cMySQLdb : public cIDatabase { public: cMySQLdb(); ~cMySQLdb(); bool IsOpen() { return m_bOpen; } //int Connect(const char *pHostMachine, const char *pDatabase, const char *pUserName, const char *pPassword); int Connect(const char* szConnect); int Disconnect(); const char *GetDBStats(); const char *GetErrorDesc(); int Query(const char *pQuery); int QueryFree(); int GetRow(); const char *GetFirstField(); const char *GetNextField(); int GetFieldCount(); const char *EscapeSingleQuotes(cBuffer &Text); //int CreateEscapedString(char *pTo, const char *pFrom, int iFromSize); private: int m_iTotalFields; int m_iCol; bool m_bOpen; #ifdef _USEDB MYSQL m_mysql; MYSQL_RES *m_pResult; MYSQL_ROW m_row; #endif //_USEDB }; #endif //_MYSQLDB_H
[ [ [ 1, 76 ] ] ]
790888417fb1fad18fded7ba003b812529381f99
4aadb120c23f44519fbd5254e56fc91c0eb3772c
/Source/EduNetGames/ModNetSoccer/NetSoccerClientPlugin.h
45a48f636686c99dad1f0ec8e1f51954d6175339
[]
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
3,528
h
#ifndef __NETSOCCERCLIENTPLUGIN_H__ #define __NETSOCCERCLIENTPLUGIN_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 "NetSoccerPlugin.h" #include "EduNetConnect/ClientPlugin.h" #include "EduNetConnect/SerializablePlayer.h" #include "EduNetConnect/AbstractEntityReplicaConnection.h" typedef ClientPlugin<NetSoccerPlugin> TSoccerClientPlugin; //----------------------------------------------------------------------------- class SoccerClientPlugin : public TSoccerClientPlugin { ET_DECLARE_BASE(TSoccerClientPlugin) public: SoccerClientPlugin( bool bAddToRegistry = true ): BaseClass( bAddToRegistry ), m_pkClientFactory(NULL), m_kReplicaManager(NULL), m_pkClientPlayer(NULL) { } OS_IMPLEMENT_CLASSNAME( SoccerClientPlugin ) virtual const char* name() const { return this->getClassName(); }; //------------------------------------------------------------------------- virtual void StartNetworkSession( void ) { BaseClass::StartNetworkSession(); this->m_kReplicaManager = ET_NEW AbstractEntityReplicaManager(); } //------------------------------------------------------------------------- virtual void CreateContent( void ); //------------------------------------------------------------------------- virtual void DeleteContent( void ); virtual void update (const float currentTime, const float elapsedTime); virtual OpenSteer::AbstractEntityFactory* getGamePluginEntityFactory( void ) const; virtual void addPlayer (OpenSteer::AbstractPlayer* pkPlayer); virtual void removePlayer (OpenSteer::AbstractPlayer* pkPlayer); private: AbstractEntityCCReplicaFactory* m_pkClientFactory; OpenSteer::AbstractPlayer* m_pkClientPlayer; AbstractEntityReplicaManager* m_kReplicaManager; }; #endif // __NETSOCCERCLIENTPLUGIN_H__
[ "janfietz@localhost" ]
[ [ [ 1, 82 ] ] ]
e59babd5847947080a6ce25d56aaa60e82a06d5c
3cfa229d1d57ce69e0e83bc99c3ca1d005ae38ad
/glome/common/DefaultFileSystem.cpp
79d5b9a689673f74edcb879b3a7f1d698e0751d5
[]
no_license
chadaustin/sphere
33fc2fe65acf2eb56e35ade3619643faaced7021
0d74cfb268c16d07ebb7cb2540b7b0697c2a127a
refs/heads/master
2021-01-10T13:28:33.766988
2009-11-08T00:38:57
2009-11-08T00:38:57
36,419,098
2
1
null
null
null
null
UTF-8
C++
false
false
1,957
cpp
#ifdef _WIN32 #include <windows.h> #endif #include <stdio.h> #include "DefaultFileSystem.hpp" #include "DefaultFile.hpp" DefaultFileSystem g_DefaultFileSystem; //////////////////////////////////////////////////////////////////////////////// IFile* DefaultFileSystem::Open(const char* filename, int mode) { #ifdef _WIN32 if (mode == IFileSystem::read) { // make sure the filename has the correct case char old_directory[MAX_PATH]; GetCurrentDirectory(MAX_PATH, old_directory); // convert the filename into a path and name and set it as current const char* name = filename; char path[MAX_PATH]; strcpy(path, filename); if (strrchr(path, '\\')) { *strrchr(path, '\\') = 0; name = path + strlen(path) + 1; } else if (strrchr(path, '/')) { *strrchr(path, '/') = 0; name = path + strlen(path) + 1; } SetCurrentDirectory(path); // enumerate the files to make sure 'filename' is in the list WIN32_FIND_DATA ffd; HANDLE find = FindFirstFile("*", &ffd); if (find == INVALID_HANDLE_VALUE) { SetCurrentDirectory(old_directory); return NULL; } bool found = false; do { if (strcmp(name, ffd.cFileName) == 0) { found = true; break; } } while (FindNextFile(find, &ffd)); FindClose(find); SetCurrentDirectory(old_directory); if (found == false) { return NULL; } } #endif // build a fopen() format string char md[4] = { 0, 0, 0, 0 }; char* p = md; if (mode & IFileSystem::write) *p++ = 'w'; if (mode & IFileSystem::read) *p++ = 'r'; *p++ = 'b'; // binary // open the file FILE* file = fopen(filename, md); if (file == NULL) return NULL; else return new DefaultFile(file); } ////////////////////////////////////////////////////////////////////////////////
[ "surreality@c0eb2ce6-7f40-480a-a1e0-6c4aea08c2c2" ]
[ [ [ 1, 86 ] ] ]
3c2b10b34888875574d38041efe54e60d06bbe28
59cae771eaa097510750a011979e93bfed24696e
/Player.hpp
fb6df21301781cd6af3a6c143b7f3396d1b63873
[]
no_license
PhiBabin/LD21---Escape
7121fa99b61e7027776dbc464618e705070200b7
861514ebc1b2f480961ef6f19728d788b45f138b
refs/heads/master
2020-06-05T04:38:24.524584
2011-08-21T19:08:03
2011-08-21T19:08:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,536
hpp
/** Copyright (C) 2011 babin philippe 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.*/ #ifndef PLAYER_HPP_INCLUDED #define PLAYER_HPP_INCLUDED class MapTile; class Player:public ImgAnim{ public: //! Construteur Player(MapTile **map); //! Affiche void Drawing(sf::RenderWindow* app); //! Retourne le rectangle de Camera sf::FloatRect GetViewRect(); //! Retourne le rectangle de collision sf::FloatRect GetPlayerRect(); sf::FloatRect GetMovedPlayerRect(const float moveX,const float moveY); //! Collision bool CollisionGeneral(const sf::FloatRect playerRect,bool &kill); bool CollisionHorizontal(const sf::FloatRect playerRect, bool &gauche, bool &droite,int &solidLimit); bool CollisionVertical(const sf::FloatRect playerRect, bool &haut, bool &bas,int &solidLimit); void SetBottomCollision(bool is); bool GetBottomCollision() const; //! Saut void Jump(); void UnlockJump(); //! Switch void Switch(); bool IsPrincess(); //! Déplacement void Turn(bool left, bool right); void TurnUp(bool up); //! Link la liste des entités void SetMapObject(vector<GameEntity*> *listObject); //! Vie et mort bool IsDead(); //! Velocité void Gravity(sf::RenderWindow &app); float GetVelx(); float GetVely(); void SetVelx(float nx); void SetVely(float ny); void Pause(); void Resume(); //! Déconstruteur ~Player(); private: MapTile **m_map; vector<GameEntity*> *m_listObject; float m_velx; float m_vely; bool m_jumpLock; bool m_colBot; bool m_direction; bool m_moving; bool m_princess; PausableClock m_switch; sf::Sound m_jump; }; #endif // PLAYER_HPP_INCLUDED
[ [ [ 1, 76 ] ] ]
c89f607e71004f7f60a9dec9b3c5c1a4321d2f96
b08e948c33317a0a67487e497a9afbaf17b0fc4c
/Application/Application.h
2c044073652440789099465de29b7a569bcc5022
[]
no_license
15831944/bastionlandscape
e1acc932f6b5a452a3bd94471748b0436a96de5d
c8008384cf4e790400f9979b5818a5a3806bd1af
refs/heads/master
2023-03-16T03:28:55.813938
2010-05-21T15:00:07
2010-05-21T15:00:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,694
h
#ifndef __APPLICATION_H__ #define __APPLICATION_H__ #include "../Application/ApplicationIncludes.h" namespace BastionGame { //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- #define WATER_COUNT 4 //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- class Application : public CoreObject { public: enum EStateMode { EStateMode_UNINITIALIZED, EStateMode_ERROR, EStateMode_INITIALING_WINDOW, EStateMode_INITIALING_DISPLAY, EStateMode_INITIALING_INPUT, EStateMode_INITIALING_FS, EStateMode_INITIALING_SHADERS, EStateMode_READY, EStateMode_RUNNING, EStateMode_QUIT, }; public: Application(); virtual ~Application(); virtual bool Create(const boost::any& _rConfig); virtual void Update(); virtual void Release(); const EStateMode& GetStateMode() const; const GraphicConfigData& GetGraphicConfigData() const; DisplayPtr GetDisplay(); const float& GetDeltaTime() const; void SetMousePos(const float _fX, const float _fY); const Vector3& GetMousePos(); void SetData(const Key _uDataKey, VoidPtr _pData); VoidPtr GetData(const Key _uDataKey); protected: typedef boost::function<void()> UpdateFunction; struct CameraParams { CameraParams(); void Reset(const bool _bResetSpeed = true); float m_fMoveSpeed; float m_fFront; float m_fFront2; float m_fStrafe; float m_fUp; }; protected: void LoadScene(); void RenderScene(); void UpdateInput(); void UpdateSpectatorCamera(const float& _fElapsedTime); bool GetLuaConfigParameters(); bool AddViewportFromLua(LuaObjectRef _rLuaObject); void Log(const string& _strFormat, ...); bool CreateActions(); void ProcessActions(UInt _uActionID); void ProcessPendingAction(UInt _uActionID); void ReleaseActions(); protected: GraphicConfigData m_oGraphicConfig; CameraParams m_oCameraParams; VoidPtrMap m_mDataExchanger; Vector3 m_f3MousePos; EStateMode m_eStateMode; DisplayPtr m_pDisplay; ScenePtr m_pScene; LandscapePtr m_pLandscape; LandscapeLayerManagerPtr m_pLandscapeLayerManager; UpdateFunction m_pUpdateFunction; FSPtr m_pFSRoot; FSPtr m_pFSNative; FSPtr m_pFSMemory; InputPtr m_pInput; InputDevicePtr m_pKeyboard; InputDevicePtr m_pMouse; TimePtr m_pTime; unsigned int m_uUpdateTimerID; unsigned int m_uProfileTimerID; float m_fRelativeTime; float m_fElapsedTime; float m_fCameraMoveSpeed; Byte m_aKeysInfo[256]; Byte m_aKeysInfoOld[256]; DIMouseState m_oMouseInfo; DIMouseState m_oMouseInfoOld; CameraListenerPtr m_pCameraListener; LuaStatePtr m_pLuaState; DisplayCameraPtr m_pMainCamera; ActionKeybindingManagerPtr m_pKeybinds; ActionDispatcherPtr m_pActionDispatcher; FilePtr m_pLog; ActionCallbackFunc m_pActionCallback; JobManagerPtr m_pJobManager; JobPtr m_pOneJob; EntityPtr m_pSelectedEntity; Key m_uProcessAction; UInt m_uPendingAction; private: }; } #endif // __APPLICATION_H__
[ "voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329" ]
[ [ [ 1, 128 ] ] ]
242ae52603fc9fc448248aa6efe9326c2eb9b384
7b379862f58f587d9327db829ae4c6493b745bb1
/JuceLibraryCode/modules/juce_gui_basics/widgets/juce_ImageComponent.h
e63f1649ccf554fb9dcd9ed39410767015921a65
[]
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
3,213
h
/* ============================================================================== 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. ============================================================================== */ #ifndef __JUCE_IMAGECOMPONENT_JUCEHEADER__ #define __JUCE_IMAGECOMPONENT_JUCEHEADER__ #include "../components/juce_Component.h" #include "../mouse/juce_TooltipClient.h" //============================================================================== /** A component that simply displays an image. Use setImage to give it an image, and it'll display it - simple as that! */ class JUCE_API ImageComponent : public Component, public SettableTooltipClient { public: //============================================================================== /** Creates an ImageComponent. */ ImageComponent (const String& componentName = String::empty); /** Destructor. */ ~ImageComponent(); //============================================================================== /** Sets the image that should be displayed. */ void setImage (const Image& newImage); /** Sets the image that should be displayed, and its placement within the component. */ void setImage (const Image& newImage, const RectanglePlacement& placementToUse); /** Returns the current image. */ const Image& getImage() const; /** Sets the method of positioning that will be used to fit the image within the component's bounds. By default the positioning is centred, and will fit the image inside the component's bounds whilst keeping its aspect ratio correct, but you can change it to whatever layout you need. */ void setImagePlacement (const RectanglePlacement& newPlacement); /** Returns the current image placement. */ const RectanglePlacement getImagePlacement() const; //============================================================================== /** @internal */ void paint (Graphics& g); private: Image image; RectanglePlacement placement; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ImageComponent); }; #endif // __JUCE_IMAGECOMPONENT_JUCEHEADER__
[ "ow3nskip" ]
[ [ [ 1, 83 ] ] ]
b1a6c2417e5598a7dff06963ca7e573ff51b50d6
77aa13a51685597585abf89b5ad30f9ef4011bde
/dep/src/boost/boost/config/stdlib/sgi.hpp
6e9c55b8728a9a0d87af08c5220d161484c12b54
[]
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
3,261
hpp
// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001. // (C) Copyright Jens Maurer 2001 - 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. // generic SGI STL: #if !defined(__STL_CONFIG_H) # include <boost/config/no_tr1/utility.hpp> # if !defined(__STL_CONFIG_H) # error "This is not the SGI STL!" # endif #endif // // No std::iterator traits without partial specialisation: // #if !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) # define BOOST_NO_STD_ITERATOR_TRAITS #endif // // No std::stringstream with gcc < 3 // #if defined(__GNUC__) && (__GNUC__ < 3) && \ ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)) && \ !defined(__STL_USE_NEW_IOSTREAMS) || \ defined(__APPLE_CC__) // Note that we only set this for GNU C++ prior to 2.95 since the // latest patches for that release do contain a minimal <sstream> // If you are running a 2.95 release prior to 2.95.3 then this will need // setting, but there is no way to detect that automatically (other // than by running the configure script). // Also, the unofficial GNU C++ 2.96 included in RedHat 7.1 doesn't // have <sstream>. # define BOOST_NO_STRINGSTREAM #endif // // Assume no std::locale without own iostreams (this may be an // incorrect assumption in some cases): // #if !defined(__SGI_STL_OWN_IOSTREAMS) && !defined(__STL_USE_NEW_IOSTREAMS) # define BOOST_NO_STD_LOCALE #endif // // Original native SGI streams have non-standard std::messages facet: // #if defined(__sgi) && (_COMPILER_VERSION <= 650) && !defined(__SGI_STL_OWN_IOSTREAMS) # define BOOST_NO_STD_LOCALE #endif // // SGI's new iostreams have missing "const" in messages<>::open // #if defined(__sgi) && (_COMPILER_VERSION <= 740) && defined(__STL_USE_NEW_IOSTREAMS) # define BOOST_NO_STD_MESSAGES #endif // // No template iterator constructors, or std::allocator // without member templates: // #if !defined(__STL_MEMBER_TEMPLATES) # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS # define BOOST_NO_STD_ALLOCATOR #endif // // We always have SGI style hash_set, hash_map, and slist: // #define BOOST_HAS_HASH #define BOOST_HAS_SLIST // // If this is GNU libstdc++2, then no <limits> and no std::wstring: // #if (defined(__GNUC__) && (__GNUC__ < 3)) # include <string> # if defined(__BASTRING__) # define BOOST_NO_LIMITS // Note: <boost/limits.hpp> will provide compile-time constants # undef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_STD_WSTRING # endif #endif // // There is no standard iterator unless we have namespace support: // #if !defined(__STL_USE_NAMESPACES) # define BOOST_NO_STD_ITERATOR #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 "SGI standard library"
[ "pepsi1x1@a6a5f009-272a-4b40-a74d-5f9816a51f88" ]
[ [ [ 1, 111 ] ] ]
acdbfbdf94a911d1ca39ac9b79474a0ec0117b11
0cc80cab288248cd9c3a2cc922487ac2afd5148c
/tu_quoque/tu_quoque/Mutex.hpp
3b1bdfb95cf66c028b7f1c60f5bf3fc344a7cdeb
[]
no_license
WestleyArgentum/tu-quoque
a3fbdb37dfebe9e9f0b00254144a48fdee89e946
38f661a145916768727b1a6fb7df5aa37072b6d2
refs/heads/master
2021-01-02T08:57:39.513862
2011-02-20T05:56:36
2011-02-20T05:56:36
33,832,399
0
0
null
null
null
null
UTF-8
C++
false
false
1,282
hpp
// Westley Hennigh // Mutex.hpp: Interface for working with mutexes. // Feb 25th 2010 #ifndef MUTEX_H #define MUTEX_H #define WIN32_LEAN_AND_MEAN #include <windows.h> class Lock; // forward declare for mutex /* Create a mutex (which will wrap up a critical section). When you need to use shared data, create a lock with the mutex you created. The lock will enter the critical section upon construction and then leave upon destruction (so no need to remember to unlock). */ class Mutex { public: Mutex () { InitializeCriticalSection (&CriticalSection); } ~Mutex () { DeleteCriticalSection (&CriticalSection); } private: // Acquire and release will be called by the lock only, there is no // external access. void Acquire () { EnterCriticalSection (&CriticalSection); } void Release () { LeaveCriticalSection (&CriticalSection); } CRITICAL_SECTION CriticalSection; // the critical section for this mutex friend class Lock; }; class Lock { public: // Acquire the semaphore Lock ( Mutex& mutex_ ) : mutex(mutex_) { mutex.Acquire(); } // Release the semaphore ~Lock () { mutex.Release(); } private: Mutex& mutex; // DO NOT CALL Lock& operator = ( Lock& ); }; #endif
[ "westleyargentum@259acd2b-3792-e4e4-6ce2-44c093ac8a23" ]
[ [ [ 1, 69 ] ] ]
97cb9e2468948c23468b94075ce87846b8ceb03b
ad80c85f09a98b1bfc47191c0e99f3d4559b10d4
/code/src/particle/ntrailrender_cmds.cc
d6378a2c1dddc70027f2c31d43980670cc063446
[]
no_license
DSPNerd/m-nebula
76a4578f5504f6902e054ddd365b42672024de6d
52a32902773c10cf1c6bc3dabefd2fd1587d83b3
refs/heads/master
2021-12-07T18:23:07.272880
2009-07-07T09:47:09
2009-07-07T09:47:09
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
1,246
cc
#define N_IMPLEMENTS nTrailRender //------------------------------------------------------------------------------ // © 2001 Radon Labs GmbH #include "particle/ntrailrender.h" #include "kernel/npersistserver.h" //------------------------------------------------------------------------------ /** @scriptclass ntrailrender @superclass nprender @classinfo Render a trail of connected particles. */ //------------------------------------------------------------------------------ /** @param clazz used to associate the registered commands with the class. */ void n_initcmds(nClass* clazz) { clazz->BeginCmds(); clazz->EndCmds(); } //------------------------------------------------------------------------------ /** fills an nCmd object with the appropriate persistent data and passes the nCmd object on to the nPersistServer for output to a file. @param fileServer writes the nCmd object contents out to a file. @return success or failure */ bool nTrailRender::SaveCmds(nPersistServer* fileServer) { if (nPRender::SaveCmds(fileServer)) { return true; } else { return false; } }
[ "plushe@411252de-2431-11de-b186-ef1da62b6547" ]
[ [ [ 1, 51 ] ] ]
fe55eaf919509bf4edae1bd082592e7dffe65fcc
27d5670a7739a866c3ad97a71c0fc9334f6875f2
/CPP/Targets/SupportWFLib/symbian/BTGPS/SdpRepeater.cpp
633d90e26adc8409a3539897b2f524398d328099
[ "BSD-3-Clause" ]
permissive
ravustaja/Wayfinder-S60-Navigator
ef506c418b8c2e6498ece6dcae67e583fb8a4a95
14d1b729b2cea52f726874687e78f17492949585
refs/heads/master
2021-01-16T20:53:37.630909
2010-06-28T09:51:10
2010-06-28T09:51:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,101
cpp
/* Copyright (c) 1999 - 2010, Vodafone Group Services Ltd 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 the Vodafone Group Services Ltd 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 "SdpRepeater.h" #include "SdpExaminer.h" #include "TimeOutTimer.h" #include "SdpRepeaterObserver.h" #include "Log.h" #define LOGPOINTER if(iLog)iLog #include "LogMacros.h" const TInt TSdpRepeatSettings::KDefaultConnectionAttempts = 5; const TInt TSdpRepeatSettings::KDefaultAttemptPeriod = 5*1000*1000; const TInt TSdpRepeatSettings::KInfiniteRepeats = KMaxTInt; const TInt TSdpRepeatSettings::KMinAttemptPeriod = 1*1000*1000; TSdpRepeatSettings::TSdpRepeatSettings() : iRepeats(KDefaultConnectionAttempts), iPeriod(KDefaultAttemptPeriod) { } TSdpRepeatSettings::TSdpRepeatSettings(TInt aRepeats, const class TTimeIntervalMicroSeconds32& aPeriod) : iRepeats(aRepeats), iPeriod(Max(aPeriod.Int(), KMinAttemptPeriod)) { } TSdpRepeatSettings::TSdpRepeatSettings(const class TTimeIntervalMinutes& aTotalTime, const class TTimeIntervalSeconds& aPeriod) : iRepeats(KDefaultConnectionAttempts), iPeriod(KDefaultAttemptPeriod) { iRepeats = (aTotalTime.Int() * 60) / aPeriod.Int(); iPeriod = Max(aPeriod.Int() * 1000000, KMinAttemptPeriod); } TSdpRepeatSettings::TSdpRepeatSettings(const class TTimeIntervalSeconds& aPeriod) : iRepeats(KInfiniteRepeats), iPeriod(KDefaultAttemptPeriod) { iPeriod = Max(aPeriod.Int() * 1000000, KMinAttemptPeriod); } CSdpRepeater::CSdpRepeater(class MSdpRepeaterObserver& aObserver, const class TBTDevAddr& aAddr) : CActiveLog("SdpRepeater"), iObserver(aObserver), iRepeatCount(iRepeatSettings.iRepeats), iAddress(aAddr) { } void CSdpRepeater::ConstructL() { CActiveScheduler::Add(this); iTimer = CTimeOutTimer::NewL(EPriorityStandard, *this); } class CSdpRepeater* CSdpRepeater::NewL(class MSdpRepeaterObserver& aObserver, const class TBTDevAddr& aAddress) { class CSdpRepeater* self = new (ELeave) CSdpRepeater(aObserver, aAddress); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); return self; } CSdpRepeater::~CSdpRepeater() { if(IsActive()){ DBG("Destroyed while active. That sure sucks!"); Cancel(); } delete iExaminer; delete iTimer; } void CSdpRepeater::RunL() { if(iStatus != KErrNone){ DBG("Complete with iStatus == %d", iStatus.Int()); if(iStatus == KErrHardwareNotAvailable){ DBG("Hardware not available. Low battery or flight mode."); Complete(iStatus); } else if((iRepeatCount == TSdpRepeatSettings::KInfiniteRepeats) || (iRepeatCount-- > 0)){ //not decremeted if inf. DBG("set timer since connect failed."); //XXX notify user iTimer->After(iRepeatSettings.iPeriod); } else { DBG("Out of retries, completeing with KErrNotFound"); iIsRunning = EFalse; Complete(KErrNotFound); } } else { DBG("Found it, completing with KErrNone."); iIsRunning = EFalse; Complete(KErrNone); } } void CSdpRepeater::DoCancel() { DBG("DoCancel"); DBG("Completeing the request"); Complete(KErrCancel); if(iExaminer){ DBG("Canceling examiner"); iExaminer->CancelFind(); } delete iExaminer; iExaminer = NULL; if(iTimer && iTimer->IsActive()){ DBG("Canceling timer"); iTimer->Cancel(); } delete iTimer; iTimer = NULL; DBG("DoCancel done"); } void CSdpRepeater::CreateAndStartExaminerL() { iObserver.SdpRepeatInfo(iRepeatSettings.iRepeats - iRepeatCount, iRepeatSettings.iRepeats); //new SdpExaminer delete iExaminer; iExaminer = NULL; iExaminer = CSdpExaminer::NewL(iAddress); UpdateLogMastersL(); //start the examiner iExaminer->FindSerialPortL(&iStatus); SetActive(); } void CSdpRepeater::FindSerialPortL(class TRequestStatus* aStatus) { if(! iIsRunning){ //reset repeat counter iRepeatCount = iRepeatSettings.iRepeats; CreateAndStartExaminerL(); //set status Activate(aStatus); iIsRunning = ETrue; DBG("A search has been started."); } else { WARN("FindSerialPortL called while running."); } } void CSdpRepeater::CancelFind() { Complete(KErrCancel); } TInt CSdpRepeater::Port() { return iExaminer->Port(); } void CSdpRepeater::SetPeriod(class TTimeIntervalMicroSeconds32 aPeriod) { SetRepeatSettings(TSdpRepeatSettings(GetTotalAttempts(), aPeriod)); } class TTimeIntervalMicroSeconds32 CSdpRepeater::GetPeriod() const { return iRepeatSettings.iPeriod; } void CSdpRepeater::SetTotalAttempts(TInt aAttempts) { SetRepeatSettings(TSdpRepeatSettings(aAttempts, GetPeriod())); } TInt CSdpRepeater::GetTotalAttempts() const { return iRepeatSettings.iRepeats; } void CSdpRepeater::SetRepeatSettings(const class TSdpRepeatSettings& aSettings) { iRepeatSettings = aSettings; iRepeatCount = iRepeatSettings.iRepeats; } const class TBTDevAddr& CSdpRepeater::GetAddress() const { return iAddress; } CArrayPtr<CActiveLog>* CSdpRepeater::SubLogArrayLC() { CArrayPtr<CActiveLog>* array = new (ELeave) CArrayPtrFlat<CActiveLog>(2); CleanupStack::PushL(array); array->AppendL(iExaminer); return array; } void CSdpRepeater::TimerExpired() { DBG("TimerExpired"); CreateAndStartExaminerL(); }
[ [ [ 1, 221 ] ] ]
0bb9cbc1f4aad3f8fa827e3853f03cc56d09742a
5dfa2f8acf81eb653df4a35a76d6be973b10a62c
/branches/test/CCV_Select_Camera/addons/ofxNCore/src/Modules/ofxNCoreVision.h
3c5ec2760ff79591a8de8b2101c8381d29fcb971
[]
no_license
guozanhua/ccv-multicam
d69534ff8592f7984a5eadc83ed8b20b9d3df949
31206f0de7f73b3d43f2a910fdcdffb7ed1bf2c2
refs/heads/master
2021-01-22T14:24:52.321877
2011-08-31T14:18:44
2011-08-31T14:18:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,651
h
/* * ofxNCoreVision.h * NUI Group Community Core Vision * * Created by NUI Group Dev Team A on 2/1/09. * Copyright 2009 NUI Group/Inc. All rights reserved. * */ #ifndef _ofxNCoreVision_H #define _ofxNCoreVision_H //Main #include "ofMain.h" //Addons #ifdef TARGET_WIN32 #include "ofxffmv.h" //#include "ofxPS3.h" #include "ofxDSVL.h" #endif #include "ofxOpenCv.h" #include "ofxDirList.h" #include "ofxVectorMath.h" #include "ofxNetwork.h" #include "ofxOsc.h" #include "ofxThread.h" #include "ofxXmlSettings.h" #include "ofxFiducialTracker.h" // Our Addon //#include "MultiCams/MultiCams.h" #include "ofxNCore.h" // height and width of the source/tracked draw window #define MAIN_WINDOW_HEIGHT 240.0f #define MAIN_WINDOW_WIDTH 320.0f class ofxNCoreVision : public ofxGuiListener { // ofxGUI setup stuff enum { propertiesPanel, propertiesPanel_flipV, propertiesPanel_flipH, propertiesPanel_settings, propertiesPanel_pressure, optionPanel, optionPanel_tuio_osc, optionPanel_tuio_tcp, optionPanel_bin_tcp, calibrationPanel, calibrationPanel_calibrate, calibrationPanel_warp, sourcePanel, sourcePanel_cam, sourcePanel_nextCam, sourcePanel_previousCam, TemplatePanel, TemplatePanel_minArea, TemplatePanel_maxArea, backgroundPanel, backgroundPanel_remove, backgroundPanel_dynamic, backgroundPanel_learn_rate, smoothPanel, smoothPanel_use, smoothPanel_smooth, amplifyPanel, amplifyPanel_use, amplifyPanel_amp, highpassPanel, highpassPanel_use, highpassPanel_blur, highpassPanel_noise, trackedPanel, trackedPanel_darkblobs, trackedPanel_use, trackedPanel_threshold, trackedPanel_min_movement, trackedPanel_min_blob_size, trackedPanel_max_blob_size, trackedPanel_outlines, trackedPanel_ids, trackingPanel, //Panel for selecting what to track-Fingers, Objects or Fiducials trackingPanel_trackFingers, trackingPanel_trackObjects, trackingPanel_trackFiducials, savePanel, kParameter_SaveXml, kParameter_File, kParameter_LoadTemplateXml, kParameter_SaveTemplateXml, }; public: ofxNCoreVision(bool debug) { ofAddListener(ofEvents.mousePressed, this, &ofxNCoreVision::_mousePressed); ofAddListener(ofEvents.mouseDragged, this, &ofxNCoreVision::_mouseDragged); ofAddListener(ofEvents.mouseReleased, this, &ofxNCoreVision::_mouseReleased); ofAddListener(ofEvents.keyPressed, this, &ofxNCoreVision::_keyPressed); ofAddListener(ofEvents.keyReleased, this, &ofxNCoreVision::_keyReleased); ofAddListener(ofEvents.setup, this, &ofxNCoreVision::_setup); ofAddListener(ofEvents.update, this, &ofxNCoreVision::_update); ofAddListener(ofEvents.draw, this, &ofxNCoreVision::_draw); ofAddListener(ofEvents.exit, this, &ofxNCoreVision::_exit); #ifdef TARGET_WIN32 //PS3 = NULL; ffmv = NULL; dsvl = NULL; #endif debugMode = debug; vidGrabber = NULL; vidPlayer = NULL; //initialize filter filter = NULL; filter_fiducial = NULL; //fps and dsp calculation frames = 0; fps = 0; lastFPSlog = 0; differenceTime = 0; //bools bCalibration= 0; bFullscreen = 0; bcamera = 0; bShowLabels = 1; bMiniMode = 0; bDrawOutlines = 1; bGPUMode = 0; bTUIOMode = 0; bFidMode = 0; showConfiguration = 0; //camera camRate = 30; camWidth = 320; camHeight = 240; //ints/floats backgroundLearnRate = .01; MIN_BLOB_SIZE = 2; MAX_BLOB_SIZE = 100; contourFinder.bTrackFingers=false; contourFinder.bTrackObjects=false; contourFinder.bTrackFiducials=false; //if auto tracker is defined then the tracker automagically comes up //on startup.. #ifdef STANDALONE bStandaloneMode = true; #else bStandaloneMode = false; #endif ////////////////////////////// // MultiCams ////////////////////////////// bMultiCamsInterface = 0; // Do not show the interface multiCams = NULL; camsUtils = NULL; } ~ofxNCoreVision() { // AlexP // C++ guarantees that operator delete checks its argument for null-ness delete filter; filter = NULL; delete filter_fiducial; filter_fiducial = NULL; delete vidGrabber; vidGrabber = NULL; delete vidPlayer; vidPlayer = NULL; #ifdef TARGET_WIN32 //delete PS3; PS3 = NULL; delete ffmv; ffmv = NULL; delete dsvl; dsvl = NULL; delete camsUtils; camsUtils = NULL; delete multiCams; multiCams = NULL; #endif } /**************************************************************** * Public functions ****************************************************************/ //Basic Events called every frame void _setup(ofEventArgs &e); void _update(ofEventArgs &e); void _draw(ofEventArgs &e); void _exit(ofEventArgs &e); //Mouse Events void _mousePressed(ofMouseEventArgs &e); void _mouseDragged(ofMouseEventArgs &e); void _mouseReleased(ofMouseEventArgs &e); //Key Events void _keyPressed(ofKeyEventArgs &e); void _keyReleased(ofKeyEventArgs &e); //GUI void setupControls(); void handleGui(int parameterId, int task, void* data, int length); ofxGui* controls; ofxGui* pControls; //image processing stuff void initDevice(); void getPixels(); void grabFrameToCPU(); void grabFrameToGPU(GLuint target); //drawing void drawFingerOutlines(); void drawMiniMode(); void drawFullMode(); void drawFiducials(); //Load/save settings void loadXMLSettings(); void saveSettings(); //Getters std::map<int, Blob> getBlobs(); std::map<int, Blob> getObjects(); /*************************************************************** * Video Capture Devices ***************************************************************/ #ifdef TARGET_WIN32 ofxffmv* ffmv; //for firefly mv //ofxPS3* PS3; //for ps3 ofxDSVL* dsvl; #endif ofVideoGrabber* vidGrabber; ofVideoPlayer* vidPlayer; /**************************************************************** * Variables in config.xml Settings file *****************************************************************/ int deviceID; int frameseq; int threshold; int wobbleThreshold; int camRate; int camWidth; int camHeight; int winWidth; int winHeight; int MIN_BLOB_SIZE; int MAX_BLOB_SIZE; float backgroundLearnRate; bool showConfiguration; bool bcamera; bool bMiniMode; bool bShowInterface; bool bShowPressure; bool bDrawOutlines; bool bTUIOMode; bool bFullscreen; bool bCalibration; bool bShowLabels; bool bNewFrame; //filters bool bAutoBackground; //modes bool bGPUMode; //Area slider variables int minTempArea; int maxTempArea; //For the fiducial mode drawing bool bFidMode; //auto ~ standalone/non-addon bool bStandaloneMode; /***************************************************** * Fiducial Finder *******************************************************/ ofxFiducialTracker fidfinder; float fiducialDrawFactor_Width; //To draw the Fiducials in the right place we have to scale from camWidth to filter->camWidth float fiducialDrawFactor_Height; Filters* filter_fiducial; CPUImageFilter processedImg_fiducial; /**************************************************** *End config.xml variables *****************************************************/ //Debug mode variables bool debugMode; //Undistortion of Image - Required for some setups bool bUndistort; ofxCvGrayscaleImage undistortedImg; //FPS variables int frames; int fps; float lastFPSlog; int differenceTime; //Fonts ofTrueTypeFont verdana; ofTrueTypeFont sidebarTXT; ofTrueTypeFont bigvideo; //Images ofImage background; //Blob Tracker BlobTracker tracker; //Template Utilities TemplateUtils templates; //Template Registration ofRectangle rect; ofRectangle minRect; ofRectangle maxRect; //Object Selection bools bool isSelecting; //Area sliders /**************************************************************** * Private Stuff ****************************************************************/ string videoFileName; int maxBlobs; // The variable which will check the initilisation of camera //to avoid multiple initialisation bool cameraInited; //Calibration Calibration calib; //Blob Finder ContourFinder contourFinder; //Image filters Filters* filter; CPUImageFilter processedImg; ofxCvColorImage sourceImg; //XML Settings Vars ofxXmlSettings XML; string message; //Communication TUIO myTUIO; string tmpLocalHost; int tmpPort; int tmpFlashPort; //Logging char dateStr [9]; char timeStr [9]; time_t rawtime; struct tm * timeinfo; char fileName [80]; FILE * stream ; /**************************************************************** * MultiCams Stuff ****************************************************************/ public: bool bMultiCamsInterface; void switchMultiCamsGUI( bool showCams = true ); MultiCams* multiCams; CamsUtils* camsUtils; void removePanels(); void addPanels(); }; #endif
[ "baicaibang@da66ed7f-4d6a-8cb4-a557-1474cfe16edc" ]
[ [ [ 1, 402 ] ] ]
331a42df941d6c319d384bd3aec7bbf3df7e9ecc
62cd42ea3851a4e80a8e631ee02cc58433ac2731
/ARIBStringConverter.cpp
f275d76c387a825fe5981355a3c8a25fd7b1a627
[]
no_license
linuxts2epg/ts2epg
a0b84979b8437140843b7b07bc5cad25be3a2585
749f82a9412d94e39dd62570dfb7de2973f20a03
refs/heads/master
2020-05-20T11:28:52.982115
2008-09-07T15:06:36
2008-09-07T15:06:36
50,156
2
2
null
null
null
null
UTF-8
C++
false
false
9,416
cpp
/* * ARIBStringConverter.cpp * * Created on: 2008/09/06 * Author: linux_ts2epg */ #include "ARIBStringConverter.h" #include <cstdio> #include <cstdlib> #include <string> #include <clocale> const wctstring *ARIBStringConverter::hiraganaTable(new wctstring(L"ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん   ゝゞー。「」、・")); const wctstring *ARIBStringConverter::katakanaTable(new wctstring(L"ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヽヾー。「」、・")); ARIBStringConverter::ARIBStringConverter(const char *ptr, size_t length) : planeGL(&planeG[0]), planeGR(&planeG[2]), buf(ptr), bufIndex(0), bufLength( length) { planeG[0] = KANJI; planeG[1] = ALPHANUMERIC; planeG[2] = HIRAGANA; planeG[3] = KATAKANA; } ARIBStringConverter::~ARIBStringConverter() { } int ARIBStringConverter::convert(const char *str, size_t length, char *&utf8str, size_t &utf8length) { ARIBStringConverter converter(str, length); return converter.convertInternal(utf8str, utf8length); } int ARIBStringConverter::convertInternal(char *&utf8str, size_t &utf8length) { wctstring resultString; char utf8buf[1024] = {0}; size_t utf8buflen = 0; while (bufIndex < bufLength) { char b = buf[bufIndex]; // printf("%3d: %02x", bufIndex, (unsigned char) b); if (b == 0x1b) { // エスケープシーケンス if (bufLength - bufIndex < 2) { // 途中でエスケープシーケンスが切れている break; } b = buf[++bufIndex]; // 次のバイトを見る if (b >= 0x28 && b <= 0x2b) { // 1バイトGセットをG0~G3にセット if (bufLength - bufIndex < 2) { // 途中でエスケープシーケンスが切れている break; } int planeIndex = b - 0x28; b = buf[++bufIndex]; // 次のバイトを見る setCodeSet(planeIndex, b, 1); } else if (b == 0x24) { // 2バイトGセットをG0~G3にセット if (bufLength - bufIndex < 2) { // 途中でエスケープシーケンスが切れている break; } b = buf[++bufIndex]; // 次のバイトを見る if (b >= 0x29 && b <= 0x2b) { // G1~G3にセット if (bufLength - bufIndex < 2) { // 途中でエスケープシーケンスが切れている break; } int planeIndex = b - 0x28; b = buf[++bufIndex]; // 次のバイトを見る setCodeSet(planeIndex, b, 2); } else { // G0にセット setCodeSet(0, b, 2); } } else { // LS2, LS3, LS1R, LS2R, LS3R switch (b) { case 0x6e: planeGL = &planeG[2]; // System.out.println("GL = G2(" + planeG[2] + ")"); break; case 0x6f: planeGL = &planeG[3]; // System.out.println("GL = G3(" + planeG[3] + ")"); break; case 0x7e: planeGR = &planeG[1]; // System.out.println("GR = G1(" + planeG[1] + ")"); break; case 0x7d: planeGR = &planeG[2]; // System.out.println("GR = G2(" + planeG[2] + ")"); break; case 0x7c: planeGR = &planeG[3]; // System.out.println("GR = G3(" + planeG[3] + ")"); break; } } } else { // エスケープシーケンスではない // TODO: シングルシフト実装 if (b == 0x0f) { // LS0 planeGL = &planeG[0]; // System.out.println("GL = G0(" + planeG[0] + ")"); } else if (b == 0x0e) { // LS1 planeGL = &planeG[1]; // System.out.println("GL = G1(" + planeG[1] + ")"); } else { // 多分普通の文字列 if ((unsigned char) b >= 0x20 && (unsigned char) b <= 0x7f) { // GL if (getByteLengthOfCodeSet(*planeGL) == 1) { // 1バイト // System.out.println(getChar1Byte(planeG[planeGLnum], // b)); resultString.append(getChar1Byte(*planeGL, b)); } else { // 2バイト if (bufLength - bufIndex < 2) { // 途中で文字が切れている break; } char b2 = buf[++bufIndex]; // System.out.println(getChar2Byte(planeG[planeGLnum], // b, b2)); resultString.append(getChar2Byte(*planeGL, b, b2)); } } else if ((unsigned char) b >= (unsigned char) 0xa0 && (unsigned char) b <= (unsigned char) 0xff) { // GR if (getByteLengthOfCodeSet(*planeGR) == 1) { // 1バイト // System.out.println(getChar1Byte(planeG[planeGRnum], // (byte) (b & 0x7f))); resultString.append(getChar1Byte(*planeGR, (b & 0x7f))); } else { // 2バイト if (bufLength - bufIndex < 2) { // 途中で文字が切れている break; } char b2 = buf[++bufIndex]; if ((unsigned char) b2 <= (unsigned char) 0x7f) { // GRの2バイトなのに2バイト目がGL break; } // System.out.println(getChar2Byte(planeG[planeGRnum], // (byte) (b & 0x7f), (byte) (b2 & 0x7f))); resultString.append(getChar2Byte(*planeGR, (b & 0x7f), (b2 & 0x7f))); } } } } bufIndex++; } const wchar_t *resultStringBuf = resultString.c_str(); uwc2umb(utf8buf, resultStringBuf, 256); utf8buflen = strlen(utf8buf); // printf("%s\n", utf8buf); utf8str = new char[utf8buflen + 1]; memset(utf8str, 0, utf8buflen); strcpy(utf8str, utf8buf); utf8length = utf8buflen; return 0; } // iconv(id, &str, &length, &putf8buf, &utf8buflen); void ARIBStringConverter::setCodeSet(int planeIndex, char b, size_t byteLength) { CodeSet codeSetTo = byteToCodeSet(b); // コードセットのバイト系が正しいかチェック if (byteLength != getByteLengthOfCodeSet(codeSetTo)) { return; } planeG[planeIndex] = codeSetTo; // printf("plane G%d is set to %s\n", planeIndex, codeSetTo); } size_t ARIBStringConverter::getByteLengthOfCodeSet(CodeSet codeSet) { switch (codeSet) { case KANJI: case JIS_KANJI_PLANE_1: case JIS_KANJI_PLANE_2: case ADDITIONAL_SYMBOLS: return 2; default: return 1; } } ARIBStringConverter::CodeSet ARIBStringConverter::byteToCodeSet(char b) { CodeSet result = UNKNOWN; switch (b) { case 0x42: result = KANJI; break; case 0x4a: result = ALPHANUMERIC; break; case 0x30: result = HIRAGANA; break; case 0x31: result = KATAKANA; break; case 0x32: result = MOSAIC_A; break; case 0x33: result = MOSAIC_B; break; case 0x34: result = MOSAIC_C; break; case 0x35: result = MOSAIC_D; break; case 0x36: result = PROP_ALPHANUMERIC; break; case 0x37: result = PROP_HIRAGANA; break; case 0x38: result = PROP_KATAKANA; break; case 0x49: result = JIS_X0201_KATAKANA; break; case 0x39: result = JIS_KANJI_PLANE_1; break; case 0x3a: result = JIS_KANJI_PLANE_2; break; case 0x3b: result = ADDITIONAL_SYMBOLS; break; default: result = UNKNOWN; break; } return result; } void debugprint(wctstring &wstr) { char tmp[20] = {0}; const wchar_t *cstr = wstr.c_str(); ARIBStringConverter::uwc2umb(tmp, wstr.c_str(), 3); printf("%s\n",tmp); } wctstring ARIBStringConverter::getChar1Byte(CodeSet codeSet, char b) { if (b >= 0x21 && b <= 0x7e) { if (codeSet == HIRAGANA) { wctstring substr = hiraganaTable->substr(b - 0x21, 1); // debugprint(substr); return hiraganaTable->substr(b - 0x21, 1); } else if (codeSet == KATAKANA) { wctstring substr = katakanaTable->substr(b - 0x21, 1); // debugprint(substr); return katakanaTable->substr(b - 0x21, 1); } else if (codeSet == ALPHANUMERIC) { wchar_t tmpStr[10] = {0}; char tmpChar[2] = { b, 0x00 }; umb2uwc(tmpStr, tmpChar, 1); return wctstring(tmpStr); } } return L"$" ; } wctstring ARIBStringConverter::getChar2Byte(CodeSet codeSet, char b, char b2) { if (codeSet == KANJI || codeSet == JIS_KANJI_PLANE_1) { char jisBuf[6] = { 0x1b, 0x24, 0x42, b, b2, 0x00 }; char *pjisBuf = jisBuf; size_t jisBufLen = 5; char utf8Buf[10] = {0}; char *putf8Buf = utf8Buf; size_t utf8BufLen = 10; iconv_t id; id = iconv_open("UTF-8", "ISO-2022-JP"); int res = iconv(id, &pjisBuf, &jisBufLen, &putf8Buf, &utf8BufLen); iconv_close(id); if (res == 0) { // printf("%s\n", utf8Buf); wchar_t wbuf[10] = {0}; umb2uwc(wbuf, utf8Buf, strlen(utf8Buf)); wctstring result(wbuf); return result; } else { return L"■" ; } } return L"□"; } size_t ARIBStringConverter::umb2uwc(wchar_t *wcs, const char *mbs, size_t sz) { setlocale(LC_ALL, "ja_JP.UTF-8"); /* ロケールを日本語に設定 */ return mbstowcs(wcs, mbs, sz); } size_t ARIBStringConverter::uwc2umb(char *mbs, const wchar_t *wcs, size_t sz) { setlocale(LC_ALL, "ja_JP.UTF-8"); /* ロケールを日本語に設定 */ return wcstombs(mbs, wcs, sz); }
[ [ [ 1, 320 ] ] ]
880a0d53e901ae12f7a254cc0b181d6a8c49572a
9891c65690bfc3d774285ccfbd4733c2ad249d5a
/ok/ok/AuctionItem.cpp
01d525ad98b6e16ff04ba2cca6c4d230dea52894
[]
no_license
saki21/saki21
55569cdebd012b861f7b0ca9843caf1a404df0cc
f50ef1b9c5ac305f4edce6a4502ecc6afd104a34
refs/heads/master
2021-01-19T07:53:59.989872
2010-10-09T15:22:16
2010-10-09T15:22:16
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
1,598
cpp
#include "StdAfx.h" void AuctionItem::doRireki() { if (h == nullptr) { SubItems[9]->Text += "H"; h = gcnew AuctionHist(this); } else h->go(); }; void AuctionItem::doDelete() { // Parent->Items->Delete(this); }; void AuctionItem::setMode(int nextMode) { WF(("mode {0} -> {1}", mode, nextMode)); mode = nextMode; SubItems[8]->Text = Int32(mode).ToString(); } void AuctionItem::setType() { SubItems[9]->Text += Int32(down_type).ToString(); } using namespace System::Threading; void AuctionItem::wait(){ do { if (!ok::mogi) b.wait(); else { try {Thread::Sleep(Timeout::Infinite);} catch (ThreadInterruptedException ^) {} user = USERNAME; } WF_(("“üŽD’†:{0}", id)); } while(1); } void AuctionItem::go(){ do { if (!ok::mogi) b.go(); else user = USERNAME; WF_(("“üŽD’†:{0}", id)); try {Thread::Sleep(Timeout::Infinite);} catch (ThreadInterruptedException ^) {} } while(1); } void AuctionItem::UpdateStatus(String ^a) { W("UpdateStatus --->" + a); AuctionStatus s(a); } void AuctionItem::UpdateStatus() { AuctionArg b; for (int i = 0; i < AuctionPage::Length; i++) { AuctionItem ^a = AuctionPage::all[i]; switch (a->mode) { default: if (a->down > AuctionItem::limitGo || (!a->Checked && a->down > ok::limitFinal)) { a->skip(); } else { b.set(a); } break; case 2: case 3: case 6: if (a->down != a->look) { a->skip(); } else { b.set(a); } break; case 4: ; } } if (b.test()) UpdateStatus(b.arg); }
[ [ [ 1, 73 ] ] ]
42235bf45ffd86daefd6f741791f8b730a0192b6
dadae22098e24c412a8d8d4133c8f009a8a529c9
/tp1/src/window.cpp
b640e7856037b9ee88381e73aeae89b7f903c2e3
[]
no_license
maoueh/PHS4700
9fe2bdf96576975b0d81e816c242a8f9d9975fbc
2c2710fcc5dbe4cd496f7329379ac28af33dc44d
refs/heads/master
2021-01-22T22:44:17.232771
2009-10-06T18:49:30
2009-10-06T18:49:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
12,185
cpp
#include "keyboard_listener.h" #include "mouse_listener.h" #include "window.h" #include "window_listener.h" LRESULT WINAPI Window::messageDispatcher(HWND windowHandle, UINT messageId, WPARAM wParameter, LPARAM lParameter) { Window* instance = NULL; if(messageId == WM_NCCREATE) { instance = (Window*) ((LPCREATESTRUCT) lParameter)->lpCreateParams; instance->mHandle = windowHandle; SetWindowLongPtr(windowHandle, GWL_USERDATA,(LONG_PTR) instance); } else instance = (Window*) GetWindowLongPtr(windowHandle, GWL_USERDATA); if ( instance == NULL ) return DefWindowProc( windowHandle, messageId, wParameter, lParameter ); else return instance->messageHandler(messageId, wParameter, lParameter); } Window::Window(STRING className, STRING name, BOOL isWindowed) : mClientSize(), mHandle(), mIsWindowed(isWindowed), mClassName(className), mName(name), mRenderingContext(NULL), mWidth(800), mHeight(800), mLastMouseX(-1), mLastMouseY(-1), mWindowListeners() { } Window::~Window() { dispose(); } void Window::addKeyboardListener(KeyboardListener* listener) { mKeyboardListeners.push_back(listener); } void Window::removeKeyboardListener(KeyboardListener* listener) { vector<KeyboardListener*>::iterator it = mKeyboardListeners.begin(); while( it != mKeyboardListeners.end() ) { if ( *it == listener ) mKeyboardListeners.erase(it); it++; } } void Window::addMouseListener(MouseListener* listener) { mMouseListeners.push_back(listener); } void Window::removeMouseListener(MouseListener* listener) { vector<MouseListener*>::iterator it = mMouseListeners.begin(); while( it != mMouseListeners.end() ) { if ( *it == listener ) mMouseListeners.erase(it); it++; } } void Window::addWindowListener(WindowListener* listener) { mWindowListeners.push_back(listener); } void Window::removeWindowListener(WindowListener* listener) { vector<WindowListener*>::iterator it = mWindowListeners.begin(); while( it != mWindowListeners.end() ) { if ( *it == listener ) mWindowListeners.erase(it); it++; } } void Window::dispose() { if ( !mIsWindowed ) { ChangeDisplaySettings(NULL, 0); ShowCursor(TRUE); } if ( mRenderingContext != NULL ) { delete mRenderingContext; mRenderingContext = NULL; } if ( mHandle != NULL ) { DestroyWindow(mHandle); mHandle = NULL; } if ( mInstance != NULL ) { UnregisterClass( mClassName.c_str(), mInstance ); mInstance = NULL; } } void Window::initialize(BOOL isWindowed) { mIsWindowed = isWindowed; WNDCLASSEX windowAttributes; windowAttributes.cbSize = sizeof(windowAttributes); windowAttributes.style = CS_HREDRAW | CS_VREDRAW; windowAttributes.lpfnWndProc = messageDispatcher; windowAttributes.cbClsExtra = 0; windowAttributes.cbWndExtra = 0; windowAttributes.hInstance = mInstance; windowAttributes.hIcon = LoadIcon(NULL, IDI_APPLICATION); // LoadIcon(NULL, :TODO: RESSOURCE); windowAttributes.hCursor = LoadCursor(NULL, IDC_ARROW); // LoadIcon(NULL, :TODO: RESSOURCE); windowAttributes.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); windowAttributes.lpszMenuName = NULL; windowAttributes.lpszClassName = mClassName.c_str(); windowAttributes.hIconSm = LoadIcon(NULL, IDI_WINLOGO); // LoadIcon(NULL, :TODO: RESSOURCE); if( RegisterClassEx(&windowAttributes) == NULL ) { dispose(); MessageBox(mHandle, Utils::format("Couldn't register class %s", mClassName).c_str(), "Error", 0); return; } mWidth = isWindowed ? mWidth : GetSystemMetrics(SM_CXSCREEN); mHeight = isWindowed ? mHeight : GetSystemMetrics(SM_CYSCREEN); INT x = isWindowed ? (INT) ((GetSystemMetrics(SM_CXSCREEN) / 2) - (mWidth / 2.0f)) : 0; INT y = isWindowed ? (INT) ((GetSystemMetrics(SM_CYSCREEN) / 2) - (mHeight / 2.0f)) : 0; DWORD style = isWindowed ? WS_OVERLAPPEDWINDOW : WS_POPUP; DWORD exStyle = isWindowed ? WS_EX_APPWINDOW | WS_EX_WINDOWEDGE : WS_EX_APPWINDOW; if ( !isWindowed ) { DEVMODE deviceSettings; memset(&deviceSettings, 0, sizeof(deviceSettings)); deviceSettings.dmSize = sizeof(deviceSettings); deviceSettings.dmPelsWidth = mWidth; deviceSettings.dmPelsHeight = mHeight; deviceSettings.dmBitsPerPel = 32; deviceSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; ShowCursor(FALSE); if ( ChangeDisplaySettings(&deviceSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL ) { dispose(); MessageBox(mHandle, "Couldn't set device mode settings", "Error", 0); return; } } RECT windowRect = {0, mWidth, 0, mHeight}; AdjustWindowRectEx(&windowRect, style, FALSE, exStyle); if ( !(mHandle = CreateWindowEx(exStyle, mClassName.c_str(), mName.c_str(), style, x, y, mWidth, mHeight, NULL, NULL, mInstance, this)) ) { dispose(); MessageBox(mHandle, Utils::format("Couldn't create window %s", mName).c_str(), "Error", 0); return; } if ( mRenderingContext != NULL ) { mRenderingContext->setWindowHandle(mHandle); mRenderingContext->registerContext(); } SetWindowPos(mHandle, HWND_TOP, x, y, mWidth, mHeight, SWP_NOZORDER | SWP_SHOWWINDOW); SetForegroundWindow(mHandle); SetFocus(mHandle); // Don't show everything off yet hide(); } LRESULT Window::messageHandler(UINT messageId, WPARAM wParameter, LPARAM lParameter) { // TODO Break Down in smaller pieces like keyboardMessageHandler, mouseMessageHandler // and then map key to functions switch(messageId) { case WM_DESTROY: { notifyWindowClosed(); return FALSE; } case WM_SYSKEYDOWN: // Fall through case WM_KEYDOWN: { notifyKeyPressed(wParameter, LOWORD(lParameter)); return FALSE; } case WM_SYSKEYUP: // Fall through case WM_KEYUP: { notifyKeyReleased(wParameter); return FALSE; } case WM_LBUTTONDOWN: { notifyMousePressed(MOUSE_BUTTON_LEFT, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_LBUTTONUP: { notifyMouseReleased(MOUSE_BUTTON_LEFT, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_LBUTTONDBLCLK: { notifyMouseDoubleClicked(MOUSE_BUTTON_LEFT, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_MBUTTONDOWN: { notifyMousePressed(MOUSE_BUTTON_MIDDLE, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_MBUTTONUP: { notifyMouseReleased(MOUSE_BUTTON_MIDDLE, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_MBUTTONDBLCLK: { notifyMouseDoubleClicked(MOUSE_BUTTON_MIDDLE, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_RBUTTONDOWN: { notifyMousePressed(MOUSE_BUTTON_RIGHT, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_RBUTTONUP: { notifyMouseReleased(MOUSE_BUTTON_RIGHT, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_RBUTTONDBLCLK: { notifyMouseDoubleClicked(MOUSE_BUTTON_RIGHT, LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } //case WM_MOUSEHWHEEL: //{ // notifyMouseWheel(LOWORD(lParameter), HIWORD(lParameter)); // return FALSE; //} case WM_MOUSEMOVE: { notifyMouseMoved(LOWORD(lParameter), HIWORD(lParameter)); return FALSE; } case WM_SIZE: { mWidth = LOWORD(lParameter); mHeight = HIWORD(lParameter); notifyWindowResized(); return FALSE; } } return DefWindowProc( mHandle, messageId, wParameter, lParameter ); } void Window::toggleFullscreen() { if( !mIsWindowed ) return; INT width = GetSystemMetrics(SM_CXSCREEN); INT height = GetSystemMetrics(SM_CYSCREEN); SetWindowLongPtr(mHandle, GWL_STYLE, WS_POPUP); SetWindowPos(mHandle, HWND_TOP, 0, 0, width, height, SWP_NOZORDER | SWP_SHOWWINDOW); mIsWindowed = FALSE; } void Window::toggleWindowed(INT width, INT height) { if( mIsWindowed ) return; RECT windowRect = {0, 0, width, height}; AdjustWindowRect(&windowRect, WS_OVERLAPPEDWINDOW, FALSE); SetWindowLongPtr(mHandle, GWL_STYLE, WS_OVERLAPPEDWINDOW); SetWindowPos(mHandle, HWND_TOP, 100, 100, windowRect.right, windowRect.bottom, SWP_NOZORDER | SWP_SHOWWINDOW); mIsWindowed = TRUE; } BOOL Window::isAnyMouseButtonPressed() { return GetAsyncKeyState(VK_LBUTTON) & 0x8000 | GetAsyncKeyState(VK_MBUTTON) & 0x8000 | GetAsyncKeyState(VK_RBUTTON) & 0x8000; } void Window::notifyKeyPressed(INT keyCode, INT repeat) { KeyEvent event(this, keyCode, repeat); vector<KeyboardListener*>::iterator it = mKeyboardListeners.begin(); while( it != mKeyboardListeners.end() ) { (*it)->keyPressed(event); it++; } } void Window::notifyKeyReleased(INT keyCode) { KeyEvent event(this, keyCode); vector<KeyboardListener*>::iterator it = mKeyboardListeners.begin(); while( it != mKeyboardListeners.end() ) { (*it)->keyReleased(event); it++; } } void Window::notifyMousePressed(INT button, INT x, INT y) { MouseEvent event(this, button, x, y); vector<MouseListener*>::iterator it = mMouseListeners.begin(); while( it != mMouseListeners.end() ) { (*it)->mousePressed(event); it++; } } void Window::notifyMouseReleased(INT button, INT x, INT y) { MouseEvent event(this, button, x, y); vector<MouseListener*>::iterator it = mMouseListeners.begin(); while( it != mMouseListeners.end() ) { (*it)->mouseReleased(event); it++; } } void Window::notifyMouseDoubleClicked(INT button, INT x, INT y) { MouseEvent event(this, button, x, y); vector<MouseListener*>::iterator it = mMouseListeners.begin(); while( it != mMouseListeners.end() ) { (*it)->mouseDoubleClicked(event); it++; } } void Window::notifyMouseMoved(INT x, INT y) { BOOL anyMouseButtonPressed = isAnyMouseButtonPressed(); MouseEvent event(this, NO_BUTTON, x, y); if (mLastMouseX != -1) { event.lastX = mLastMouseX; event.lastY = mLastMouseY; } vector<MouseListener*>::iterator it = mMouseListeners.begin(); while( it != mMouseListeners.end() ) { if ( anyMouseButtonPressed ) (*it)->mouseDragged(event); else (*it)->mouseMoved(event); it++; } mLastMouseX = x; mLastMouseY = y; } void Window::notifyMouseWheel(INT x, INT y) { MouseEvent event(this, NO_BUTTON, x, y); vector<MouseListener*>::iterator it = mMouseListeners.begin(); while( it != mMouseListeners.end() ) { (*it)->mouseWheel(event); it++; } } void Window::notifyWindowClosed() { WindowEvent event(this); vector<WindowListener*>::iterator it = mWindowListeners.begin(); while( it != mWindowListeners.end() ) { (*it)->windowClosed(event); it++; } } void Window::notifyWindowResized() { WindowEvent event(this, mWidth, mHeight); vector<WindowListener*>::iterator it = mWindowListeners.begin(); while( it != mWindowListeners.end() ) { (*it)->windowResized(event); it++; } }
[ [ [ 1, 422 ] ] ]
29336177321eff9d1d1cce24ac2f531bba27080e
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/tags/techdemo2/engine/core/include/GameAreaEventSource.h
3753383339224b056c6f3055cd003db4d24fdc2c
[ "ClArtistic", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jacmoe/dsa-hl-svn
55b05b6f28b0b8b216eac7b0f9eedf650d116f85
97798e1f54df9d5785fb206c7165cd011c611560
refs/heads/master
2021-04-22T12:07:43.389214
2009-11-27T22:01:03
2009-11-27T22:01:03
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
3,740
h
/* This source file is part of Rastullahs Lockenpracht. * Copyright (C) 2003-2005 Team Pantheon. http://www.team-pantheon.de * * This program is free software; you can redistribute it and/or modify * it under the terms of the Clarified Artistic License. * * 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 * Clarified Artistic License for more details. * * You should have received a copy of the Clarified Artistic License * along with this program; if not you can get it here * http://www.jpaulmorrison.com/fbp/artistic2.htm. */ #ifndef __GameAreaEventSource_H__ #define __GameAreaEventSource_H__ #include "EventSource.h" #include "EventCaster.h" #include "GameAreaListener.h" #include "GameAreaEvent.h" #include "GameAreaTypes.h" #include "CorePrerequisites.h" namespace rl { /** * GameAreaEventSource * Die Quelle für Ereignisse die das betreten/verlassen eines Areals betreffen. * Hier werden die Actoren die sich zur letzten Abfrage innerhalb des Areals befanden * aufbewahrt, um die Differenzen bestimmen zu können, und die Abfragemethode verwaltet * * @see GameAreaListener, GameAreaEvent, GameEventManager, GameAreaTypes */ class _RlCoreExport GameAreaEventSource : public virtual EventSource { public: /** Konstruktor * @param areaType Die Art des abzufragenden Areals * @param act Der Actor, an den das Zentrum des Areals geknüpft ist */ GameAreaEventSource( GameAreaType* areaType, Actor* act ); /// Dekonstruktor virtual ~GameAreaEventSource(); /** Wird vom GameEventManager aufgerufen um die Szenenabfrage zu starten * Berechnet die verlassenden/betretenden Aktoren und löst mittels * doDispatchEvents die Ereignisse aus. * * @notice Sollte nicht eigenständig aufgerufen werden */ void performQuery( Ogre::Real timePassed ); /** Fügt einen GameAreaListener hinzu, der zukünftig bei GameAreaEvents benachrichtigt wird * * @param list Der hinzuzufügende Listener */ void addAreaListener( GameAreaListener* list ); /** Entfernt einen GameAreaListener * * @param list Der zu entfernende Listener */ void removeAreaListener( GameAreaListener* list ); /// Gibt zurück ob sich Listener angemeldet haben bool hasListeners( ) const; /// Gibt die Art des Areals zurück GameAreaType* getGameAreaType() const { return mAreaType; }; /// Gibt die Actoren die bei der letzten Abfrage innerhalb des Areals waren zurück const ActorMap& getInsideAreaList() const { return mInsideAreaList; }; /// Gibt den Actor zurück, den das Areal umgibt Actor* getActor() const { return mActor; }; private: /** Verteilt die Events an die angefügten Listener * Für jeden Actor wird ein einzelnes Ereigniss generiert, zuerst für alle * verlassenden Actoren, dann für die betretenden * * @param enteringActors Die neu hinzugekommenen Actoren * @param leavingActors Die verlassenden Actoren */ void doDispatchEvents( const ActorMap& enteringActors, const ActorMap& leavingActors ); /// Entfernt alle AreaListener void removeAllAreaListeners( ); /// Der Typ des Areals GameAreaType* mAreaType; /// Der EventCaster der die Verteilung an die Listener übernimmt EventCaster<GameAreaEvent> mAreaEventCaster; /// Die Aktoren innerhalb des Areals ActorMap mInsideAreaList; /// Der Aktor den das Areal umgibt Actor* mActor; }; } #endif
[ "tanis@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 104 ] ] ]
9b231de8d9e8431b3bb261f473440b0224bb7880
acf1b4792425a2ff0565451a044f00029ccf794d
/src/astring_datatype.h
623f5710f0cbe747d06b56709367fce756aa1195
[]
no_license
davgit/ahk2exe-1
d36330e101dbf0f631ebcbb925635ab0631c3619
93e6af3188cff3444dc5be6ad37dd032dd3665d1
refs/heads/master
2016-09-10T22:43:59.400053
2010-07-08T07:34:46
2010-07-08T07:34:46
22,427,624
1
0
null
null
null
null
UTF-8
C++
false
false
4,220
h
#ifndef __ASTRING_H #define __ASTRING_H /////////////////////////////////////////////////////////////////////////////// // // AutoIt // // Copyright (C)1999-2003: // - Jonathan Bennett <[email protected]> // - See "AUTHORS.txt" for contributors. // // 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. // /////////////////////////////////////////////////////////////////////////////// // // astring_datatype.h // // The standalone class for a String datatype. Not using STL because of the // code bloat. // /////////////////////////////////////////////////////////////////////////////// // Includes #include <string.h> class AString { public: // Functions AString(const char szStr[] = ""); // Constructor AString(unsigned int iLen); // Constructor with pre-allocation AString(const AString &sSource); // Copy constructor ~AString(); // Destructor void erase(void); // Erase entire string void erase(unsigned int nStart, unsigned int nEnd); // Erase a range from the string void erase(unsigned int nStart); // Erase a from start to end const char* c_str(void) const { return m_szText; } // Return C style string void tolower(void); // Convert string to lowercase void toupper(void); // Convert string to uppercase void assign(const AString &sStr, unsigned int nStart, unsigned int nEnd); // Assign chars from one str to another unsigned int find_first_not_of(const char *szInput) const; // Find first char not in input unsigned int find_last_not_of(const char *szInput) const; // Find last char not in input unsigned int find_first_of(const char *szInput) const; // Find first char in input unsigned int find_last_of(const char *szInput) const; // Find last char in input unsigned int find_str(const char *szInput, bool bCaseSense) const; // Find first string in input void strip_leading(const char *szInput); // Strip leading chars void strip_trailing(const char *szInput); // Strip trailing chars int strcmp(const AString &sStr) const; // Use C strcmp() routine (compare with AString) int strcmp(const char *szStr) const; // Use C strcmp() routine (compare with C string) int stricmp(const AString &sStr) const; // Use C stricmp() routine (compare with AString) int stricmp(const char *szStr) const; // Use C stricmp() routine (compare with C string) // Properties unsigned int size(void) const { return (unsigned int)m_length; } // Return string length unsigned int length(void) const { return (unsigned int)m_length; } // Return string length unsigned int begin(void) const { return 0; } // Index of first element of a string unsigned int end(void) const { return (unsigned int)m_length; } // Index succeeding last element of a string (The terminator \0) bool empty(void) const; // Tests if string empty // Overloads char& operator[](unsigned int nIndex); // Overloaded [] AString& operator=(const AString &sOp2); // Overloaded = for AString AString& operator=(const char *szOp2); // Overloaded = for C string AString& operator=(const char ch); // Overloaded = for a single char AString& operator+=(const AString &sOp2); // Overloaded += for AString (append) AString& operator+=(const char *szOp2); // Overloaded += for C string (append) AString& operator+=(const char ch); // Overloaded += for a single char (append) friend bool operator==(const AString &sOp1, const AString &sOp2); // Overloaded == for AStrings (case sensitive) friend bool operator!=(const AString &sOp1, const AString &sOp2); // Overloaded != for AStrings (case sensitive) private: // Variables char *m_szText; // The actual string of characters size_t m_length; // String length size_t m_allocated; // Number of bytes allocated for this string }; /////////////////////////////////////////////////////////////////////////////// #endif
[ [ [ 1, 94 ] ] ]