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
ff1da944e25e232a80b1f343ef24c1a99ff04f9c
cfcd2a448c91b249ea61d0d0d747129900e9e97f
/thirdparty/OpenCOLLADA/COLLADAFramework/src/COLLADAFWVisualScene.cpp
7a58b1114e3139a278b9ca9204ddeaa72abc55c0
[]
no_license
fire-archive/OgreCollada
b1686b1b84b512ffee65baddb290503fb1ebac9c
49114208f176eb695b525dca4f79fc0cfd40e9de
refs/heads/master
2020-04-10T10:04:15.187350
2009-05-31T15:33:15
2009-05-31T15:33:15
268,046
0
0
null
null
null
null
UTF-8
C++
false
false
736
cpp
/* Copyright (c) 2008 NetAllied Systems GmbH This file is part of COLLADAFramework. Licensed under the MIT Open Source License, for details please see LICENSE file or the website http://www.opensource.org/licenses/mit-license.php */ #include "COLLADAFWStableHeaders.h" #include "COLLADAFWVisualScene.h" namespace COLLADAFW { //-------------------------------------------------------------------- VisualScene::VisualScene() { } //-------------------------------------------------------------------- VisualScene::~VisualScene() { #if 0 //delete all root node for ( size_t i = 0, count = mRootNodes.getCount(); i < count; ++i) delete mRootNodes[i]; #endif } } // namespace COLLADAFW
[ [ [ 1, 32 ] ] ]
b52f22874c138d5202822edc34d5cdf9ff771423
f1739436e569eee08ae41ccab2157a3e5a64ff12
/MfcXq_Vert(GPS用)/SearchInfo.h
ae4c5a103e80ddcf269eb925e5c80b629a60c123
[]
no_license
IT4551SoftwareDevelopment/ai-chinese-chess-game
d46d51ea965bfcfe8549892a6dcc184a79d13ab9
b612c1ed29d1802feb7e7f31d8126c26a9443d82
refs/heads/master
2021-01-10T17:50:28.621792
2011-12-06T09:11:05
2011-12-06T09:11:05
50,724,005
0
0
null
null
null
null
UTF-8
C++
false
false
1,289
h
#if !defined(AFX_SEARCHINFO_H__E214C1A2_DA61_4F60_BDB5_31790946BC35__INCLUDED_) #define AFX_SEARCHINFO_H__E214C1A2_DA61_4F60_BDB5_31790946BC35__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // SearchInfo.h : header file // ///////////////////////////////////////////////////////////////////////////// // CSearchInfo dialog class CSearchInfo : public CDialog { // Construction public: CSearchInfo(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CSearchInfo) enum { IDD = frmSearchInfo }; CListCtrl m_lsvMoveList; CListCtrl m_lsvDepthTimeCost; CListCtrl m_lsvValue; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CSearchInfo) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CSearchInfo) // NOTE: the ClassWizard will add member functions here //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SEARCHINFO_H__E214C1A2_DA61_4F60_BDB5_31790946BC35__INCLUDED_)
[ [ [ 1, 48 ] ] ]
e8be72614b975647b14fe9e3ebff9579341783ff
8d02de0f3b9a87e30f3d6cfb9c33911b700c3efb
/tree_utility.h
2e401aff00f94d1ff355f90c42d1e7a2c38758f0
[]
no_license
bigsleep/mpl_tree
637c6335df35e069e778b48c75bad00bb16e203a
f82545a938ec351dad1adc5d0bd017190489a513
refs/heads/master
2021-01-01T19:25:43.474008
2011-02-09T10:37:24
2011-02-09T10:37:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,686
h
#ifndef SYKES_MPL_TREE_UTILITY_H #define SYKES_MPL_TREE_UTILITY_H #include "tree_fwd.h" #include "deref.h" #include "vector_utility.h" namespace sykes{ namespace mpl{ //----------------------------------------------------------- // has_child //----------------------------------------------------------- namespace detail{ template<bool IsLeaf, branch B, typename Iterator> struct has_child_impl; } template<typename Iterator> struct has_child_left { static bool const value = detail::has_child_impl< deref<Iterator>::is_leaf, branch::left, Iterator>::value; }; template<typename Iterator> struct has_child_right { static bool const value = detail::has_child_impl< deref<Iterator>::is_leaf, branch::right, Iterator>::value; }; template<typename Iterator> struct has_child { static bool const value = has_child_left<Iterator>::value || has_child_right<Iterator>::value; }; namespace detail{ template<branch B, typename Iterator> struct has_child_impl<true, B, Iterator> { static bool const value = false; }; template<branch B, typename Iterator> struct has_child_impl<false, B, Iterator> { static bool const value = !std::is_same< typename get_child< B, typename deref<Iterator>::subtree >::type, null_type >::value; }; }//---- detail //----------------------------------------------------------- // get_child //----------------------------------------------------------- template<typename Iterator> struct get_child_left; template<typename Tag, typename Route, typename Tree> struct get_child_left<tree_iterator<Tag, Route, Tree>> { static_assert(has_child_left<tree_iterator<Tag, Route, Tree>>::value, "sykes::mpl::get_child_left"); typedef tree_iterator< Tag, typename push_back< Route, std::integral_constant<branch, branch::left>>::type, Tree> type; }; template<typename Iterator> struct get_child_right; template<typename Tag, typename Route, typename Tree> struct get_child_right<tree_iterator<Tag, Route, Tree>> { static_assert(has_child_right<tree_iterator<Tag, Route, Tree>>::value, "sykes::mpl::get_child_left"); typedef tree_iterator< Tag, typename push_back< Route, std::integral_constant<branch, branch::right>>::type, Tree> type; }; //----------------------------------------------------------- // has_parent //----------------------------------------------------------- template<typename Iterator> struct has_parent; template<typename Tag, branch Bhead, branch ... Btail, typename Tree> struct has_parent<tree_iterator<Tag, vector_c<branch, Bhead, Btail...>, Tree>> { static bool const value = true && !std::is_same< typename deref< tree_iterator< Tag, typename pop_back<vector_c<branch, Bhead, Btail...>>::type, Tree > >::type, null_type >::value; }; template<typename Tag, typename Tree> struct has_parent<tree_iterator<Tag, vector_c<branch>, Tree>> { static bool const value = false; }; //----------------------------------------------------------- // get_parent //----------------------------------------------------------- template<typename Iterator> struct get_parent; template<typename Tag, typename Route, typename Tree> struct get_parent<tree_iterator<Tag, Route, Tree>> { static_assert(has_parent<tree_iterator<Tag, Route, Tree>>::value, "sykes::mpl::get_parent"); typedef tree_iterator< Tag, typename pop_back<Route>::type, Tree> type; }; //----------------------------------------------------------- // has_sibling //----------------------------------------------------------- namespace detail{ template<bool HasParent, typename Iterator> struct has_sibling_impl; }//---- detail template<typename Iterator> struct has_sibling { static bool const value = detail::has_sibling_impl< has_parent<Iterator>::value, Iterator>::value; }; template<typename Iterator> struct has_older_sibling; template<typename Tag, typename Route, typename Tree> struct has_older_sibling<tree_iterator<Tag, Route, Tree>> { static bool const value = has_sibling<tree_iterator<Tag, Route, Tree>>::value && (at<size<Route>::value - 1, Route>::value == branch::right); }; template<typename Tag, typename Tree> struct has_older_sibling<tree_iterator<Tag, vector_c<branch>, Tree>> { static bool const value = false; }; template<typename Iterator> struct has_younger_sibling; template<typename Tag, typename Route, typename Tree> struct has_younger_sibling<tree_iterator<Tag, Route, Tree>> { static bool const value = has_sibling<tree_iterator<Tag, Route, Tree>>::value && (at<size<Route>::value - 1, Route>::value == branch::left); }; template<typename Tag, typename Tree> struct has_younger_sibling<tree_iterator<Tag, vector_c<branch>, Tree>> { static bool const value = false; }; namespace detail{ template<typename Tag, typename Route, typename Tree> struct has_sibling_impl<true, tree_iterator<Tag, Route, Tree>> { static bool const value = ((at<size<Route>::value - 1, Route>::value == branch::left) && (has_child_right<typename get_parent<tree_iterator<Tag, Route, Tree>>::type>::value)) || ((at<size<Route>::value - 1, Route>::value == branch::right) && (has_child_left<typename get_parent<tree_iterator<Tag, Route, Tree>>::type>::value)); }; template<typename Iterator> struct has_sibling_impl<false, Iterator> { static bool const value = false; }; }//---- detail //----------------------------------------------------------- // get_sibling //----------------------------------------------------------- template<typename Iterator> struct get_sibling; template<typename Tag, typename Route, typename Tree> struct get_sibling<tree_iterator<Tag, Route, Tree>> { static_assert(has_sibling<tree_iterator<Tag, Route, Tree>>::value, "sykes::mpl::get_sibling"); typedef tree_iterator< Tag, typename replace_at< size<Route>::value - 1, Route, std::integral_constant< branch, (at<size<Route>::value - 1, Route>::value == branch::left) ? branch::right : branch::left > >::type, Tree> type; }; }}//---- #endif
[ "takada@takada-desktop.(none)" ]
[ [ [ 1, 237 ] ] ]
4ddb209a75fcdccf315c66944c9e0558b6b90434
709cd826da3ae55945fd7036ecf872ee7cdbd82a
/Term/Assignment/CG_2nd/CG_2ndViewUser.h
a0c7e9f58b139b833f0d797fb8693161c19e2e59
[]
no_license
argapratama/kucgbowling
20dbaefe1596358156691e81ccceb9151b15efb0
65e40b6f33c5511bddf0fa350c1eefc647ace48a
refs/heads/master
2018-01-08T15:27:44.784437
2011-06-19T15:23:39
2011-06-19T15:23:39
36,738,655
0
0
null
null
null
null
UTF-8
C++
false
false
331
h
#pragma once class CCG_2ndViewUser { public: // Translation float f_transX, f_transY, f_transZ; // Scaling float f_scaleX, f_scaleY, f_scaleZ; // Axis Rotation float f_aRotateX, f_aRotateY, f_aRotateZ; void InitPosition(); void DoModelTransform(); CCG_2ndViewUser(void); ~CCG_2ndViewUser(void); };
[ [ [ 1, 18 ] ] ]
bb0541eab49813838bcada0618b32f212d722fbc
ce262ae496ab3eeebfcbb337da86d34eb689c07b
/SEFoundation/SEEffects/SEMaterialTextureEffect.h
85408619bc5a59a15b5fa2c45104e437e8c8bbac
[]
no_license
pizibing/swingengine
d8d9208c00ec2944817e1aab51287a3c38103bea
e7109d7b3e28c4421c173712eaf872771550669e
refs/heads/master
2021-01-16T18:29:10.689858
2011-06-23T04:27:46
2011-06-23T04:27:46
33,969,301
0
0
null
null
null
null
GB18030
C++
false
false
1,790
h
// Swing Engine Version 1 Source Code // Most of techniques in the engine are mainly based on David Eberly's // Wild Magic 4 open-source code.The author of Swing Engine learned a lot // from Eberly's experience of architecture and algorithm. // Several sub-systems are totally new,and others are re-implimented or // re-organized based on Wild Magic 4's sub-systems. // Copyright (c) 2007-2010. All Rights Reserved // // Eberly's permission: // Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation; either version 2.1 of the License, or (at // your option) any later version. The license is available for reading at // the location: // http://www.gnu.org/copyleft/lgpl.html #ifndef Swing_MaterialTextureEffect_H #define Swing_MaterialTextureEffect_H #include "SEFoundationLIB.h" #include "SEShaderEffect.h" namespace Swing { //---------------------------------------------------------------------------- // Description:所依附的node必须带有material state对象. // Author:Sun Che // Date:20080820 //---------------------------------------------------------------------------- class SE_FOUNDATION_API SEMaterialTextureEffect : public SEShaderEffect { SE_DECLARE_RTTI; SE_DECLARE_NAME_ID; SE_DECLARE_STREAM; public: SEMaterialTextureEffect(const std::string& rBaseName); virtual ~SEMaterialTextureEffect(void); protected: // streaming SEMaterialTextureEffect(void); }; typedef SESmartPointer<SEMaterialTextureEffect> SEMaterialTextureEffectPtr; } #endif
[ "[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac" ]
[ [ [ 1, 54 ] ] ]
8817cecac39a4b69301805762ed26560104c84ca
2f77d5232a073a28266f5a5aa614160acba05ce6
/01.DevelopLibrary/03.Code/UI/EasySmsMainWnd.cpp
3bb80a56ea4fec620b228fab65e85241bbbf818a
[]
no_license
radtek/mobilelzz
87f2d0b53f7fd414e62c8b2d960e87ae359c81b4
402276f7c225dd0b0fae825013b29d0244114e7d
refs/heads/master
2020-12-24T21:21:30.860184
2011-03-26T02:19:47
2011-03-26T02:19:47
58,142,323
0
0
null
null
null
null
GB18030
C++
false
false
7,900
cpp
#include"stdafx.h" #include "resource.h" #include "EasySmsMainWnd.h" #include "SmsLookCtorWnd.h" #include "SmsUnReadWnd.h" #include "SmsFindWnd.h" #include "SmsEncrytpCtorWnd.h" CEasySmsMainWnd::CEasySmsMainWnd(void) { } CEasySmsMainWnd::~CEasySmsMainWnd(void) { } BOOL CEasySmsMainWnd::OnInitDialog() { if ( !CMzWndEx::OnInitDialog() ) { return FALSE; } SetWindowText( L"易短信2.000" ); return SubInitialize(); } void CEasySmsMainWnd::OnMzCommand( WPARAM wParam, LPARAM lParam ) { UINT_PTR id = LOWORD( wParam ); int iRlt = -1; switch( id ) { case MZ_IDC_UNREAD_SMS: { CSmsUnReadWnd clCSmsUnReadWnd; iRlt = DoModalBase( &clCSmsUnReadWnd ); ::SetForegroundWindow(m_hWnd); break; } case MZ_IDC_LOOK_SMS: { CSmsLookCtorWnd clCSmsLookCtorWnd; iRlt = DoModalBase( &clCSmsLookCtorWnd ); ::SetForegroundWindow(m_hWnd); break; } case MZ_IDC_SEND_SMS: { CNewSmsWnd clSendSms; iRlt = DoModalBase( &clSendSms ); ::SetForegroundWindow(m_hWnd); break; } case MZ_IDC_FIND_SMS: { CSmsFindWnd clCSmsFindWnd; iRlt = DoModalBase( &clCSmsFindWnd ); ::SetForegroundWindow(m_hWnd); break; } case MZ_IDC_ENCRYTP_SMS: { CSmsEncrytpCtorWnd clCSmsEncrytpCtorWnd; iRlt = DoModalBase( &clCSmsEncrytpCtorWnd ); ::SetForegroundWindow(m_hWnd); break; } case MZ_IDC_SYNC_SMS: { break; } case MZ_IDC_SETUP_SMS: { break; } case IDR_TOOLBAR_MAIN_WND: { int index = lParam; if ( 2 == index ) { exit( 0 ); } break; } default: break; } } /////private///////////////////////////////////////////////////////////////////// BOOL CEasySmsMainWnd::SubInitialize() { /*设置背景图片*/ m_modeIndex = 0; m_Picture.SetID( MZ_IDC_MAIN_PICTURE ); m_Picture.SetPos( 0, 0, GetWidth(), GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR ); m_Picture.SetPaintMode( modeId[ m_modeIndex ] ); m_Picture.LoadImage( MzGetInstanceHandle(), RT_RCDATA, MAKEINTRESOURCE( IDR_PNG_MAIN_WND_BACKGROUND ) ); AddUiWin( &m_Picture ); //SMS UnRead ImagingHelper* UnReadUp = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_UNREAD_UP, true ); ImagingHelper* UnReadDown = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_UNREAD_DOWN, true ); if ( NULL == UnReadUp || NULL == UnReadDown ) { return FALSE; } m_UnReadSmsBtnImg.SetID( MZ_IDC_UNREAD_SMS ); m_UnReadSmsBtnImg.SetButtonType( MZC_BUTTON_NONE ); m_UnReadSmsBtnImg.SetImage_Normal( UnReadUp ); m_UnReadSmsBtnImg.SetImage_Pressed( UnReadDown ); m_UnReadSmsBtnImg.EnableTextSinkOnPressed( TRUE ); m_UnReadSmsBtnImg.SetMode( UI_BUTTON_IMAGE_MODE_NORMAL ); m_UnReadSmsBtnImg.SwapImageZOrder( true ); m_UnReadSmsBtnImg.SetPos( 30, 80, 140, 180 ); AddUiWin( &m_UnReadSmsBtnImg ); // sms look ImagingHelper* UnSmsUp = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_SMS_UP, true ); ImagingHelper* UnSmsDown = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_SMS_DOWN, true ); m_LookSmsBtnImg.SetID( MZ_IDC_LOOK_SMS ); m_LookSmsBtnImg.SetButtonType( MZC_BUTTON_NONE ); m_LookSmsBtnImg.SetImage_Normal( UnSmsUp ); m_LookSmsBtnImg.SetImage_Pressed( UnSmsDown ); m_LookSmsBtnImg.EnableTextSinkOnPressed( TRUE ); m_LookSmsBtnImg.SetMode( UI_BUTTON_IMAGE_MODE_NORMAL ); m_LookSmsBtnImg.SwapImageZOrder( true ); m_LookSmsBtnImg.SetPos( 170, 80, 140, 180 ); AddUiWin( &m_LookSmsBtnImg ); //sms new ImagingHelper* UnNewUp = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_NEW_UP, true ); ImagingHelper* UnNewDown = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_NEW_DOWN, true ); m_SendSmsBtnImg.SetID( MZ_IDC_SEND_SMS ); m_SendSmsBtnImg.SetButtonType( MZC_BUTTON_NONE ); m_SendSmsBtnImg.SetImage_Normal( UnNewUp ); m_SendSmsBtnImg.SetImage_Pressed( UnNewDown ); m_SendSmsBtnImg.EnableTextSinkOnPressed(TRUE); m_SendSmsBtnImg.SetMode( UI_BUTTON_IMAGE_MODE_NORMAL ); m_SendSmsBtnImg.SwapImageZOrder( true ); m_SendSmsBtnImg.SetPos( 310, 80, 140, 180 ); AddUiWin( &m_SendSmsBtnImg ); //find ImagingHelper* UnFindUp = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_FIND_UP, true ); ImagingHelper* UnFindDown = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_FIND_DOWN, true ); m_UnFindSmsBtnImg.SetID( MZ_IDC_FIND_SMS ); m_UnFindSmsBtnImg.SetButtonType( MZC_BUTTON_NONE ); m_UnFindSmsBtnImg.SetImage_Normal( UnFindUp ); m_UnFindSmsBtnImg.SetImage_Pressed( UnFindDown ); m_UnFindSmsBtnImg.EnableTextSinkOnPressed( TRUE ); m_UnFindSmsBtnImg.SetMode( UI_BUTTON_IMAGE_MODE_NORMAL ); m_UnFindSmsBtnImg.SwapImageZOrder( true ); m_UnFindSmsBtnImg.SetPos( 30, 260, 140, 180 ); AddUiWin( &m_UnFindSmsBtnImg ); //加密 ImagingHelper* UnEncryptUp = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_ENCRYPT_UP, true ); ImagingHelper* UnEncryptDown = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_ENCRYPT_DOWN, true ); m_UnEncryptSmsBtnImg.SetID( MZ_IDC_ENCRYTP_SMS ); m_UnEncryptSmsBtnImg.SetButtonType( MZC_BUTTON_NONE ); m_UnEncryptSmsBtnImg.SetImage_Normal( UnEncryptUp ); m_UnEncryptSmsBtnImg.SetImage_Pressed( UnEncryptDown ); m_UnEncryptSmsBtnImg.EnableTextSinkOnPressed( TRUE ); m_UnEncryptSmsBtnImg.SetMode( UI_BUTTON_IMAGE_MODE_NORMAL ); m_UnEncryptSmsBtnImg.SwapImageZOrder( true ); m_UnEncryptSmsBtnImg.SetPos( 30, 440, 140, 180 ); AddUiWin( &m_UnEncryptSmsBtnImg ); //synchronization ImagingHelper* UnSyncUp = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_SYNC_UP, true ); ImagingHelper* UnSyncDown = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_SYNC_DOWN, true ); m_UnSyncSmsBtnImg.SetID( MZ_IDC_SYNC_SMS ); m_UnSyncSmsBtnImg.SetButtonType( MZC_BUTTON_NONE ); m_UnSyncSmsBtnImg.SetImage_Normal( UnSyncUp ); m_UnSyncSmsBtnImg.SetImage_Pressed( UnSyncDown ); m_UnSyncSmsBtnImg.EnableTextSinkOnPressed( TRUE ); m_UnSyncSmsBtnImg.SetMode( UI_BUTTON_IMAGE_MODE_NORMAL ); m_UnSyncSmsBtnImg.SwapImageZOrder( true ); m_UnSyncSmsBtnImg.SetPos( 170, 260, 140, 180 ); AddUiWin( &m_UnSyncSmsBtnImg ); //设置 ImagingHelper* UnSetUpUp = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_SETUP_UP, true ); ImagingHelper* UnSetUpDown = m_imgContainer_base.LoadImage( MzGetInstanceHandle(), IDR_PNG_SETUP_DOWN, true ); m_UnSetUpSmsBtnImg.SetID( MZ_IDC_SETUP_SMS ); m_UnSetUpSmsBtnImg.SetButtonType( MZC_BUTTON_NONE ); m_UnSetUpSmsBtnImg.SetImage_Normal( UnSetUpUp ); m_UnSetUpSmsBtnImg.SetImage_Pressed( UnSetUpDown ); m_UnSetUpSmsBtnImg.EnableTextSinkOnPressed( TRUE ); m_UnSetUpSmsBtnImg.SetMode( UI_BUTTON_IMAGE_MODE_NORMAL ); m_UnSetUpSmsBtnImg.SwapImageZOrder( true ); // m_UnSetUpSmsBtnImg.SetTextColor( RGB( 0, 0, 0 ) ); m_UnSetUpSmsBtnImg.SetPos( 310, 260, 140, 180 ); AddUiWin( &m_UnSetUpSmsBtnImg ); //ini toolbar m_toolBar_base.SetID( IDR_TOOLBAR_MAIN_WND ); m_toolBar_base.SetPos( 0, GetHeight() - MZM_HEIGHT_TEXT_TOOLBAR , GetWidth() , MZM_HEIGHT_TEXT_TOOLBAR ); m_toolBar_base.SetButton( 2, true, true, L"退出" ); AddUiWin( &m_toolBar_base ); return TRUE; }
[ "[email protected]", "lidan8908589@8983de3c-2b35-11df-be6c-f52728ce0ce6" ]
[ [ [ 1, 44 ], [ 46, 52 ], [ 54, 60 ], [ 62, 68 ], [ 70, 76 ], [ 78, 275 ] ], [ [ 45, 45 ], [ 53, 53 ], [ 61, 61 ], [ 69, 69 ], [ 77, 77 ] ] ]
750b7ab2880904396ebd3dab0240e9db2e602fd4
5e6ff9e6e8427078135a7b4d3b194bcbf631e9cd
/EngineSource/dpslim/dpslim/Database/Headers/DBTaskProd.h
4ed9d8ca6d53986b54289694a3b79d34bac2013d
[]
no_license
karakots/dpresurrection
1a6f3fca00edd24455f1c8ae50764142bb4106e7
46725077006571cec1511f31d314ccd7f5a5eeef
refs/heads/master
2016-09-05T09:26:26.091623
2010-02-01T11:24:41
2010-02-01T11:24:41
32,189,181
0
0
null
null
null
null
UTF-8
C++
false
false
1,221
h
#pragma once #define _CRT_SECURE_NO_WARNINGS // ---------------------- // // Created 11/24/200 // Vicki de Mey, DecisionPower, Inc. // #include <afxdb.h> // MFC ODBC database classes ///////////////////////////////////////////////////////////////////////////// // Task product recordset class TaskProdRecordset : public CRecordset { public: TaskProdRecordset(CDatabase* pDatabase = NULL); DECLARE_DYNAMIC(TaskProdRecordset) // Field/Param Data //{{AFX_FIELD(TaskProdRecordset, CRecordset) long m_ProductID; long m_TaskID; float m_PreUseSKU; float m_PostUseSKU; float m_Suitability; //}}AFX_FIELD // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(TaskProdRecordset) public: virtual CString GetDefaultConnect(); // Default connection string virtual CString GetDefaultSQL(); // Default SQL for Recordset virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support virtual int Open(unsigned int nOpenType = snapshot, LPCTSTR lpszSql = NULL, DWORD dwOptions = none); //}}AFX_VIRTUAL // Implementation #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif };
[ "Isaac.Noble@fd82578e-0ebe-11df-96d9-85c6b80b8d9c" ]
[ [ [ 1, 47 ] ] ]
3561aee18da7e30a59c2b4dfa2e93693fe6af3ce
5acd6b1bc0becbf091304800765644058b047899
/base/Image.h
bec473d300f4fff66284f11a144739782f8c7d40
[]
no_license
malfmalf/partition_old
0c53e6642aa512e411f580a2c8b88085f9483887
bb0dd7a3f362313e319da75fd2f13805ddae5db0
refs/heads/master
2022-11-08T18:36:52.830760
2011-02-14T14:55:07
2011-02-14T14:55:07
276,804,239
0
0
null
null
null
null
UTF-8
C++
false
false
185
h
#pragma once #include "definitions.h" class cResourceManager; class cImage{ friend cResourceManager; public: private: image_t mData; }; typedef cImage* tImagePtr;
[ [ [ 1, 13 ] ] ]
7bf61c001050d8fd032c09f54ad22989dde02b3f
faacd0003e0c749daea18398b064e16363ea8340
/lyxlib/devicesdlg.cpp
0c33579b75c8870cda75622a1e4f87c6bfa68f9b
[]
no_license
yjfcool/lyxcar
355f7a4df7e4f19fea733d2cd4fee968ffdf65af
750be6c984de694d7c60b5a515c4eb02c3e8c723
refs/heads/master
2016-09-10T10:18:56.638922
2009-09-29T06:03:19
2009-09-29T06:03:19
42,575,701
0
0
null
null
null
null
UTF-8
C++
false
false
2,071
cpp
/* * Copyright (C) 2008-2009 Pavlov Denis * * Comments unavailable. * * 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 any later version. * */ #include "devicesdlg.h" ALyxDevicesDialog::ALyxDevicesDialog(QWidget *parent, ASkinner *s) : ALyxDialog(parent, s) { ALyxPushButton *btn = new ALyxPushButton(this, "OK"); btn->setFont(QFont("Calibri", 16)); btn->setUpPixmap(QPixmap("./skins/default/button.png")); btn->setDownPixmap(QPixmap("./skins/default/button_pushed.png")); ALyxPushButton *btn2 = new ALyxPushButton(this, tr("Cancel")); btn2->setFont(QFont("Calibri", 16)); btn2->setUpPixmap(QPixmap("./skins/default/button.png")); btn2->setDownPixmap(QPixmap("./skins/default/button_pushed.png")); addButton(btn, "ok"); addButton(btn2, "cancel"); m_jogdial = new ALyxJogdial(this); clear(); m_jogdial->move(95, 60); m_jogdial->setFixedSize(210, 130); // m_jogdial->show(); } void ALyxDevicesDialog::clear() { m_devices.clear(); m_jogdial->clear(); } ALyxListWidgetItem * ALyxDevicesDialog::activeDeviceItem() { return m_jogdial->activeItem(); } QString ALyxDevicesDialog::activeDevicePath() { return m_devices.value(m_jogdial->activeItem()); } QString ALyxDevicesDialog::activeDeviceName() { return m_jogdial->activeItem()->text(); } void ALyxDevicesDialog::setActiveDeviceByPath(QString path) { ALyxListWidgetItem *item = m_devices.key(path); m_jogdial->setActiveItem(item); } void ALyxDevicesDialog::setActiveDeviceByName(QString name) { } void ALyxDevicesDialog::addDevice(QString path, QString name, QPixmap icon) { ALyxListWidgetItem *item = new ALyxListWidgetItem(m_jogdial, name, icon); item->setTextColor(QColor("white")); m_jogdial->addItem(item); m_devices.insert(item, path); } ALyxDevicesDialog::~ALyxDevicesDialog() { qDebug() << "ALyxDevicesDialog destroyed"; }
[ "futurelink.vl@9e60f810-e830-11dd-9b7c-bbba4c9295f9" ]
[ [ [ 1, 73 ] ] ]
fc46ef41f40c7ae6a7be984258aa73fa94d81949
dde32744a06bb6697823975956a757bd6c666e87
/bwapi/SCProjects/BTHAIModule/Source/HighTemplarAgent.h
137d156e1154c56e25b7b10c8acca8cfce9ae671
[]
no_license
zarac/tgspu-bthai
30070aa8f72585354ab9724298b17eb6df4810af
1c7e06ca02e8b606e7164e74d010df66162c532f
refs/heads/master
2021-01-10T21:29:19.519754
2011-11-16T16:21:51
2011-11-16T16:21:51
2,533,389
0
0
null
null
null
null
UTF-8
C++
false
false
761
h
#ifndef __HIGHTEMPLARAGENT_H__ #define __HIGHTEMPLARAGENT_H__ #include <BWAPI.h> #include "UnitAgent.h" using namespace BWAPI; using namespace std; /** The HighTemplarAgent handles Protoss High Templar units. * * Implemented special abilities: * - * * TODO: * - Merge to Archon * * Author: Johan Hagelback ([email protected]) */ class HighTemplarAgent : public UnitAgent { private: Unit* findPsiStormTarget(); BaseAgent* findHallucinationTarget(); BaseAgent* findArchonTarget(); bool hasCastTransform; public: HighTemplarAgent(Unit* mUnit); /** Called each update to issue orders. */ void computeActions(); /** Returns the unique type name for unit agents. */ string getTypeName(); }; #endif
[ "rymdpung@.(none)" ]
[ [ [ 1, 37 ] ] ]
c460ab952c186ea94b2120951266101760ce383f
bef7d0477a5cac485b4b3921a718394d5c2cf700
/dingus/dingus/resource/MeshBundle.h
281b71b1b4d04af46c528a3bbc46c252a0a05e5f
[ "MIT" ]
permissive
TomLeeLive/aras-p-dingus
ed91127790a604e0813cd4704acba742d3485400
22ef90c2bf01afd53c0b5b045f4dd0b59fe83009
refs/heads/master
2023-04-19T20:45:14.410448
2011-10-04T10:51:13
2011-10-04T10:51:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,335
h
// -------------------------------------------------------------------------- // Dingus project - a collection of subsystems for game/graphics applications // -------------------------------------------------------------------------- #ifndef __MESH_BUNDLE_H #define __MESH_BUNDLE_H #include "StorageResourceBundle.h" #include "DeviceResource.h" #include "../gfx/Mesh.h" #include "../utils/Singleton.h" namespace dingus { class CMeshBundle : public CStorageResourceBundle<CMesh>, public CSingleton<CMeshBundle>, public IDeviceResource { public: virtual void createResource(); virtual void activateResource(); virtual void passivateResource(); virtual void deleteResource(); protected: virtual CMesh* loadResourceById( const CResourceId& id, const CResourceId& fullName ); virtual void deleteResource( CMesh& resource ) { if( resource.isCreated() ) resource.deleteResource(); delete &resource; } private: IMPLEMENT_SIMPLE_SINGLETON(CMeshBundle); CMeshBundle(); virtual ~CMeshBundle() { clear(); }; /// @return false on not found bool loadMesh( const CResourceId& id, const CResourceId& fullName, CMesh& mesh ) const; }; }; // namespace /// Shortcut macro #define RGET_MESH(rid) dingus::CMeshBundle::getInstance().getResourceById(rid) #endif
[ [ [ 1, 51 ] ] ]
5123f200dea89d844a665e40d2d6f84b9726c18f
4b0f51aeecddecf3f57a29ffa7a184ae48f1dc61
/CleanProject/ParticleUniverse/include/ParticleUniverseEventHandlerFactory.h
121753035e2ecfea56e050e945d6f78ae8afb97f
[]
no_license
bahao247/apeengine2
56560dbf6d262364fbc0f9f96ba4231e5e4ed301
f2617b2a42bdf2907c6d56e334c0d027fb62062d
refs/heads/master
2021-01-10T14:04:02.319337
2009-08-26T08:23:33
2009-08-26T08:23:33
45,979,392
0
1
null
null
null
null
UTF-8
C++
false
false
1,969
h
/* ----------------------------------------------------------------------------- This source file is part of the Particle Universe product. Copyright (c) 2006-2008 Henry van Merode Usage of this program is free for non-commercial use and licensed under the the terms of the GNU Lesser General Public License. You should have received a copy of the GNU Lesser 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, or go to http://www.gnu.org/copyleft/lesser.txt. ----------------------------------------------------------------------------- */ #ifndef __PU_EVENT_HANDLER_FACTORY_H__ #define __PU_EVENT_HANDLER_FACTORY_H__ #include "ParticleUniversePrerequisites.h" #include "ParticleUniverseEventHandler.h" #include "ParticleUniverseITokenInitialiser.h" namespace ParticleUniverse { /** This is the base factory of all ParticleEventHandler implementations. */ class _ParticleUniverseExport ParticleEventHandlerFactory : public ITokenInitialiser { protected: /** */ template <class T> ParticleEventHandler* _createEventHandler(void) { ParticleEventHandler* particleEventHandler = new T(); particleEventHandler->setEventHandlerType(getEventHandlerType()); return particleEventHandler; }; public: ParticleEventHandlerFactory(void) {}; virtual ~ParticleEventHandlerFactory(void) {}; /** Returns the type of the factory, which identifies the event handler type this factory creates. */ virtual Ogre::String getEventHandlerType() const = 0; /** Creates a new event handler instance. @remarks */ virtual ParticleEventHandler* createEventHandler(void) = 0; /** Delete an event handler */ void destroyEventHandler (ParticleEventHandler* eventHandler){delete eventHandler;}; }; } #endif
[ "pablosn@06488772-1f9a-11de-8b5c-13accb87f508" ]
[ [ [ 1, 60 ] ] ]
25151a43f93f6a7f31fbe180fad5c631a4e18bf5
968aa9bac548662b49af4e2b873b61873ba6f680
/imgtools/imglib/parameterfileprocessor/include/parameterfileprocessor.h
323686ada1a92f508bece1c764a26e24337d4e92
[]
no_license
anagovitsyn/oss.FCL.sftools.dev.build
b3401a1ee3fb3c8f3d5caae6e5018ad7851963f3
f458a4ce83f74d603362fe6b71eaa647ccc62fee
refs/heads/master
2021-12-11T09:37:34.633852
2010-12-01T08:05:36
2010-12-01T08:05:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,656
h
/* * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * Class for processing parameter-file. * @internalComponent * @released * */ #ifndef PARAMETERFILEPROCESSOR_H #define PARAMETERFILEPROCESSOR_H #include<iostream> #include<string> #include<vector> #include<fstream> using namespace std ; typedef vector<string> VectorOfStrings; /** Class CParameterFileProcessor for processing parameter-file @internalComponent @released */ class CParameterFileProcessor { ifstream iParamFile; string iParamFileName; // Parameter-file name VectorOfStrings iParameters; // Parameters read from parameter-file unsigned int iNoOfArguments; // Number of parameters present in the parameter-file. char **iParamFileArgs; // Pointer to 2D character array containing the parameters // read from parameter-file. public: CParameterFileProcessor(const string& aParamFileName); bool ParameterFileProcessor(); unsigned int GetNoOfArguments() const; char** GetParameters() const; ~CParameterFileProcessor(); private: bool OpenFile(); bool SplitLine(string& aLine); bool SetNoOfArguments(); void SetParameters(); void CloseFile(); }; #endif //PARAMETERFILEPROCESSOR_H
[ "none@none" ]
[ [ [ 1, 64 ] ] ]
d12cffd34e6e3cb1414a874eb1aa88ec48d17c27
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/wave/test/testwave/testfiles/t_6_068.cpp
9d5bff5e2ba3ffce189852d2dd1cb87c835554e5
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
2,343
cpp
/*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library http://www.boost.org/ Copyright (c) 2001-2006 Hartmut Kaiser. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The tests included in this file were initially taken from the mcpp V2.5 preprocessor validation suite and were modified to fit into the Boost.Wave unit test requirements. The original files of the mcpp preprocessor are distributed under the license reproduced at the end of this file. =============================================================================*/ // Tests error reporting: undefined behavior: Argument of #include other than // header-name //E t_6_068.cpp(20): error: ill formed #include directive: filename #include filename /*- * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <[email protected]> * 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 ``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 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. */
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 46 ] ] ]
4a5d2163896a555115198e22f93bcdfc9a78b629
138a353006eb1376668037fcdfbafc05450aa413
/source/ogre/OgreNewt/boost/mpl/order.hpp
45feb79c391e2513bf56f1ddb2bd4435eab99a54
[]
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
1,190
hpp
#ifndef BOOST_MPL_ORDER_HPP_INCLUDED #define BOOST_MPL_ORDER_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2003-2004 // Copyright David Abrahams 2003-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Source: /cvsroot/ogre/ogreaddons/ogrenewt/OgreNewt_Main/inc/boost/mpl/order.hpp,v $ // $Date: 2006/04/17 23:49:40 $ // $Revision: 1.1 $ #include <boost/mpl/order_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> #include <boost/mpl/aux_/order_impl.hpp> #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> namespace boost { namespace mpl { template< typename BOOST_MPL_AUX_NA_PARAM(AssociativeSequence) , typename BOOST_MPL_AUX_NA_PARAM(Key) > struct order : order_impl< typename sequence_tag<AssociativeSequence>::type > ::template apply<AssociativeSequence,Key> { BOOST_MPL_AUX_LAMBDA_SUPPORT(2,order,(AssociativeSequence,Key)) }; BOOST_MPL_AUX_NA_SPEC(2, order) }} #endif // BOOST_MPL_ORDER_HPP_INCLUDED
[ "Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e" ]
[ [ [ 1, 41 ] ] ]
ce05110a5701510d8988d8c13c9afd494d0faefc
f69b9ae8d4c17d3bed264cefc5a82a0d64046b1c
/src/io/export.cxx
c13b4ef37fd524e218ff78b47557c51010f61c8d
[]
no_license
lssgufeng/proteintracer
611501cf8001ff9d4bf5e7aa645c24069cce675f
055cc953d6bf62d17eb9435117f44b3f3d9b8f3f
refs/heads/master
2016-08-09T22:20:40.978584
2009-06-07T22:08:14
2009-06-07T22:08:14
55,025,270
0
0
null
null
null
null
UTF-8
C++
false
false
3,838
cxx
/*============================================================================== Copyright (c) 2009, André Homeyer 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. 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 <io/export.h> #include <fstream> #include <common.h> namespace PT { void exportCSV(const Analysis& analysis, const CellSelection& cellSelection, const char* filepath) { assert(filepath != 0); const std::vector<std::string>& featureNames = analysis.getMetadata().featureNames; std::ofstream file; file.open(filepath); file << "CellID;Well;Position;Slide;Time;"; // write feature names std::vector<std::string>::const_iterator featureNameIt = featureNames.begin(); std::vector<std::string>::const_iterator featureNameEnd = featureNames.end(); for (; featureNameIt != featureNameEnd; ++featureNameIt) { file << (*featureNameIt).c_str() << ";"; } // write cell observations PT::CellSelection::CellIterator cellIt = const_cast<CellSelection&>(cellSelection).getCellStart(); PT::CellSelection::CellIterator cellEnd = const_cast<CellSelection&>(cellSelection).getCellEnd(); for (;cellIt != cellEnd; ++cellIt) { PT::Cell* cell = *cellIt; const ImageLocation& location = cell->getLocation(); const ImageSeries& imageSeries = analysis.getImageSeries(location); ImageSeries::TimeRange timeRange = imageSeries.timeRange; // iterate over all time steps for (short time = timeRange.min; time <= timeRange.max; ++time) { PT::CellObservation* observation = cell->getObservation(time); if (observation != 0) { file << "\n"; file << cell->getId() << ";"; file << location.well << ";" << location.position << ";" << location.slide << ";"; file << time << ";"; for (int featureIndex = 0; featureIndex < featureNames.size(); ++ featureIndex) { if (observation->isFeatureAvailable(featureIndex)) { file << observation->getFeature(featureIndex); } file << ";"; } } } } file << "\n"; file.close(); // throw an exception if an error occured if( !file ) { throw IOException(); } } }
[ "andre.homeyer@localhost" ]
[ [ [ 1, 98 ] ] ]
ac32698b94b8332e4bd656a77165e74c3b850016
713659538c3e4d0d332d43002b7ef96400ed6b53
/src/game/server/gamemodes/ktf.hpp
4fc0d6492c7786ecbce0d80c1ae52e50cd233a99
[ "LicenseRef-scancode-other-permissive", "Zlib", "BSD-3-Clause" ]
permissive
Berzzzebub/TeeFork
449b31ce836a47476efa15f32930a28908a56b37
53142119f62af52379b7a5e7344f38b1b2e56cf7
refs/heads/master
2016-09-06T08:21:23.745520
2010-12-12T09:37:52
2010-12-12T09:37:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
651
hpp
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ #include <game/server/gamecontroller.hpp> //#include <game/server/gamemodes/ctf.hpp> class GAMECONTROLLER_KTF : public GAMECONTROLLER { public: GAMECONTROLLER_KTF(); virtual void tick(); virtual int on_character_death(class CHARACTER *victim, class PLAYER *killer, int weapon); virtual void on_character_spawn(class CHARACTER *chr); virtual void endround(); virtual void startround(); void set_new_flagkeeper(); void draw_dir_stars(); void update_colors(); int leader_score(); class FLAG *flag; int flag_keeper_id; int point_counter; };
[ [ [ 1, 25 ] ] ]
ef6d9b478951f386d8cc998fd4a2c4db2ec8e55d
0b7226783e4b70944b4e66ae21eee9a3a0394e81
/src/Independent/Core/FSContext.cpp
3a2da4a42f4d133de44107efe9d8639c2d37bb45
[]
no_license
LittleEngineer/fridgescript
061e3d3f0d17d8c0c0b8e089a3254c56edfa74e6
55b2e6bab63e826291b8d14f24c40f413f895e54
refs/heads/master
2021-01-10T16:52:37.530928
2009-09-06T10:58:21
2009-09-06T10:58:21
46,175,065
0
0
null
null
null
null
UTF-8
C++
false
false
3,015
cpp
/* This file is part of FridgeScript. FridgeScript is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. FridgeScript is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with FridgeScript. If not, see <http://www.gnu.org/licenses/> */ // main header #include <Core/FridgeScript.h> #include <Core/FSContext.h> #include <malloc.h> #include <string.h> #include <stdio.h> #include "Absyn.h" #include "Parser.H" #include <Core/BadPtr.h> #include <Core/FSAssembler.h> #include <Code/FSCompiledCode.h> #include <ParseTree/FSParseTree.h> #include <Variable/FSVariable.h> #include <Variable/FSVariablePicker.h> #include <Core/SimpleStructures.h> FSContext::~FSContext() { for(unsigned int i = 0; i < numCode; ++i) { delete code[i]; code[i] = BadPtr<FSCompiledCode>(); } free(code); code = BadPtr<FSCompiledCode*>(); for( u_int i = 0; i < constants.GetCount(); ++i ) { delete constants[i]; } } unsigned int FSContext::CompileCode(const char* const& source) { FILE* pTmpFile = tmpfile(); fwrite(source, 1, strlen(source), pTmpFile); rewind(pTmpFile); Program* tree = pProgram(pTmpFile); if(!tree) { // error! fclose(pTmpFile); return 0; } // process the tree FSParseTree parseTree = FSParseTree(this); tree->accept(&parseTree); fclose(pTmpFile); // send the resulting string to an assembler const char* const foo = parseTree.GetAssemblerString(); #ifdef _DEBUG printf( "%s\r\n", foo ); #endif unsigned int length = 0; unsigned char* bytes = FSAssemble( foo, length ); if(!bytes) return 0; ++numCode; code = static_cast<FSCompiledCode**>(realloc(code, sizeof(FSCompiledCode*)*numCode)); code[numCode - 1] = new FSCompiledCode(bytes, length); code[numCode - 1]->SetupVariableStack(parseTree.GetVariableStackPointer()); FSAFree(bytes); return numCode; } void FSContext::ExecuteCode(const unsigned int& id) { // load variables and setup the stack (*code[id - 1])(); } Simple::Stack<FSVariable*>* FSContext::GetVariables(const unsigned int& id) { return code[id - 1]->GetVariables(); } float* FSContext::GetConstant(const float& value) { for( u_int i = 0; i < constants.GetCount(); ++i ) { if( *( constants[i] ) == value ) return constants[i]; } return *( constants.Push( new float( value ) ) ); }
[ "jheriko@78b37d4e-3566-11de-a9fe-ad1e22fc3a8a" ]
[ [ [ 1, 116 ] ] ]
fef6e00c4dedb11d145f4153f8a667a874c114b0
05869e5d7a32845b306353bdf45d2eab70d5eddc
/soft/application/thirdpartylibs/kkmitlib/include/win32_vdonet.h
ef3b26ff9deafd916fa889e51bcc49553b16b496
[]
no_license
shenfahsu/sc-fix
beb9dc8034f2a8fd9feb384155fa01d52f3a4b6a
ccc96bfaa3c18f68c38036cf68d3cb34ca5b40cd
refs/heads/master
2020-07-14T16:13:47.424654
2011-07-22T16:46:45
2011-07-22T16:46:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,240
h
// VideoNet.h : main header file for the VIDEONET application // #if !defined(AFX_VIDEONET_H__B0986304_5F44_11D6_8897_000B2B0F84B6__INCLUDED_) #define AFX_VIDEONET_H__B0986304_5F44_11D6_8897_000B2B0F84B6__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols //#include "encoder\def.h" //bruce ///////////////////////////////////////////////////////////////////////////// // CVideoNetApp: // See VideoNet.cpp for the implementation of this class // class CVideoNetApp : public CWinApp { public: CVideoNetApp(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CVideoNetApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CVideoNetApp) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_VIDEONET_H__B0986304_5F44_11D6_8897_000B2B0F84B6__INCLUDED_)
[ "windyin@2490691b-6763-96f4-2dba-14a298306784" ]
[ [ [ 1, 48 ] ] ]
620fe3c8c4b210cc8538a0d94794b496fdfe62ad
619941b532c6d2987c0f4e92b73549c6c945c7e5
/Source/Toxid/UI/GameScreen.cpp
258ef568b75baff961baa0ff31208505a896cc19
[]
no_license
dzw/stellarengine
2b70ddefc2827be4f44ec6082201c955788a8a16
2a0a7db2e43c7c3519e79afa56db247f9708bc26
refs/heads/master
2016-09-01T21:12:36.888921
2008-12-12T12:40:37
2008-12-12T12:40:37
36,939,169
0
0
null
null
null
null
UTF-8
C++
false
false
3,495
cpp
//  // // ##### # # #### -= Nuclex Library =-  // //  # ## ## # # GameScreen.cpp - Toxid title screen  // //  # ### # #  // //  # ### # # The title screen of the game  // //  # ## ## # #  // //  # # # #### R1 (C)2002-2004 Markus Ewald -> License.txt  // //  // #include "Toxid/UI/GameScreen.h" #include "Toxid/Main.h" #include "Nuclex/GUI/GUIServer.h" using namespace Toxid; // ############################################################################################# // // # Toxid::GameScreen::GameScreen() Constructor # // // ############################################################################################# // GameScreen::GameScreen() : m_spMenu(new GUI::ButtonWidget(Box2<float>(), L"Menu")) { m_spMenu->OnPress.connect(sigc::mem_fun(this, &GameScreen::onMenu)); addWidget("Menu", m_spMenu); } // ############################################################################################# // // # Toxid::GameScreen::draw() # // // ############################################################################################# // void GameScreen::draw(Video::VertexDrawer &VD, GUI::Theme &T) { // setRegion(Box2<float>(Point2<float>(), VD.getScreenSize()); m_spMenu->setRegion(Box2<float>( Point2<float>(VD.getScreenSize(), StaticCastTag()) - Point2<float>(410, 40), Point2<float>(VD.getScreenSize(), StaticCastTag()) - Point2<float>(210, 20) )); DesktopWindow::draw(VD, T); } // ############################################################################################# // // # Toxid::GameScreen::onMenu() # // // ############################################################################################# // void GameScreen::onMenu() { if(getWindowCount() == 0) { /* enableControls(false); shared_ptr<StartDialog> spStartDialog(new StartDialog()); spStartDialog->onClose.connect(SigC::slot(*this, GameScreen::onCloseDialog)); addWindow("Start", spStartDialog); */ } } // ############################################################################################# // // # Toxid::GameScreen::oncloseDialog() # // // ############################################################################################# // void GameScreen::onCloseDialog(bool) { clearWindows(); enableControls(); } // ############################################################################################# // // # Toxid::GameScreen::enableControls() # // // ############################################################################################# // void GameScreen::enableControls(bool bEnable) { m_spMenu->setEnabled(bEnable); }
[ [ [ 1, 67 ] ] ]
a1f5b39c121ddd561ca706fa8db03c5eb4bdffb5
8b47ae9ab10dc23fd5eb4fb91ed509390b0aef69
/ProjetCPPUML/ProjetCPPDll/Des.h
a00b8dc134d25eb818ce4887e5082d163e8e63f3
[]
no_license
candreolli/TintinAuJaponOfTheDeath
6520b7cf88f2ef0fd30873b7c3215b9aeedd8972
99397725b8f9ab348112c280dda87e6935f128b6
refs/heads/master
2020-04-01T16:50:36.875929
2011-11-30T18:20:07
2011-11-30T18:20:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
879
h
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Changes to this file will be lost if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ #pragma once #define WANTDLLEXP #ifdef WANTDLLEXP //exportation dll #define DLL __declspec( dllexport ) #define EXTERNC extern "C" #else #define DLL //standard #define EXTERNC #endif #include<vector> namespace Model { class DLL Des { private : std::vector<int> faces; public : Des() {} ~Des() {} int lancer() { return 5; } }; EXTERNC DLL Des* DES_New() { return new Des(); } EXTERNC DLL void DES_Delete(Des* obj) { delete obj; } EXTERNC DLL int DES_lancer(Des* d) { return d->lancer(); } }
[ [ [ 1, 37 ] ] ]
247b2527c0c616599a8b332bdfaff4971f7ee53f
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/regex/test/static_mutex/static_mutex_test.cpp
289260d5a9e3607a79147c204ce3aeca6962dec2
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
4,292
cpp
/* * * Copyright (c) 2004 * John Maddock * * 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) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE static_mutex_test.cpp * VERSION see <boost/version.hpp> * DESCRIPTION: test program for boost::static_mutex. */ #include <iostream> #include <boost/regex/pending/static_mutex.hpp> #include <boost/thread/thread.hpp> #include <boost/timer.hpp> // // we cannot use the regular Boost.Test in here: it is not thread safe // and calls to BOOST_TEST will eventually crash on some compilers // (Borland certainly) due to race conditions inside the Boost.Test lib. // #define BOOST_TEST(pred) if(!(pred)) failed_test(__FILE__, __LINE__, BOOST_STRINGIZE(pred)); int total_failures = 0; void failed_test(const char* file, int line, const char* pred) { static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ; boost::static_mutex::scoped_lock guard(mut); ++total_failures; std::cout << "Failed test in \"" << file << "\" at line " << line << ": " << pred << std::endl; } void print_cycles(int c) { static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ; boost::static_mutex::scoped_lock guard(mut); std::cout << "Thread exited after " << c << " cycles." << std::endl; } bool sufficient_time() { // return true if enough time has passed since the tests began: static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ; boost::static_mutex::scoped_lock guard(mut); static boost::timer t; // is 10 seconds enough? return t.elapsed() >= 10.0; } // define three trivial test proceedures: bool t1() { static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ; static int has_lock = 0; static int data = 10000; boost::static_mutex::scoped_lock guard(mut); BOOST_TEST(++has_lock == 1); BOOST_TEST(guard.locked()); BOOST_TEST(guard); bool result = (--data > 0) ? true : false; BOOST_TEST(--has_lock == 0); return result; } bool t2() { static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ; static int has_lock = 0; static int data = 10000; boost::static_mutex::scoped_lock guard(mut, false); BOOST_TEST(0 == guard.locked()); BOOST_TEST(!guard); guard.lock(); BOOST_TEST(++has_lock == 1); BOOST_TEST(guard.locked()); BOOST_TEST(guard); bool result = (--data > 0) ? true : false; BOOST_TEST(--has_lock == 0); guard.unlock(); BOOST_TEST(0 == guard.locked()); BOOST_TEST(!guard); return result; } bool t3() { static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT ; static int has_lock = 0; static int data = 10000; boost::static_mutex::scoped_lock guard(mut); BOOST_TEST(++has_lock == 1); BOOST_TEST(guard.locked()); BOOST_TEST(guard); bool result = (--data > 0) ? true : false; BOOST_TEST(--has_lock == 0); return result; } // define their thread procs: void thread1_proc() { int cycles = 0; while(!sufficient_time()) { t1(); t2(); ++cycles; } print_cycles(cycles); } void thread2_proc() { int cycles = 0; while(!sufficient_time()) { t2(); t3(); ++cycles; } print_cycles(cycles); } void thread3_proc() { int cycles = 0; while(!sufficient_time()) { t1(); t3(); ++cycles; } print_cycles(cycles); } // make sure that at least one of our test proceedures // is called during program startup: struct startup1 { startup1() { t1(); } ~startup1() { t1(); } }; startup1 up1; int main() { BOOST_TEST(0 != &up1); boost::thread thrd1(&thread1_proc); boost::thread thrd2(&thread1_proc); boost::thread thrd3(&thread2_proc); boost::thread thrd4(&thread2_proc); boost::thread thrd5(&thread3_proc); boost::thread thrd6(&thread3_proc); thrd1.join(); thrd2.join(); thrd3.join(); thrd4.join(); thrd5.join(); thrd6.join(); return total_failures; }
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 181 ] ] ]
500d7c58b82e069936f8f054cfc7bf858496dae3
8902879a2619a8278c4dd064f62d8e0e8ffb4e3b
/util/WinUtil.h
7265a0d405d364a3e5aec69271b1b687702b147e
[ "BSD-2-Clause" ]
permissive
ArnCarveris/directui
4d9911143db125dfb114ca97a70f426dbd89dd79
da531f8bc7737f932c960906cc5f4481a0e162b8
refs/heads/master
2023-03-17T00:59:28.853973
2011-05-19T02:38:42
2011-05-19T02:38:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,964
h
/* Copyright 2011 the Wdl Extra authors (see AUTHORS file). License: Simplified BSD (see COPYING) */ #ifndef WinUtil_h #define WinUtil_h #include "BaseUtil.h" using namespace Gdiplus; class ScopedGdiPlus { protected: Gdiplus::GdiplusStartupInput si; Gdiplus::GdiplusStartupOutput so; ULONG_PTR token, hookToken; public: // suppress the GDI+ background thread when initiating in WinMain, // as that thread causes DDE messages to be sent too early and // thus unexpected timeouts ScopedGdiPlus() { si.SuppressBackgroundThread = true; Gdiplus::GdiplusStartup(&token, &si, &so); so.NotificationHook(&hookToken); } ~ScopedGdiPlus() { so.NotificationUnhook(hookToken); Gdiplus::GdiplusShutdown(token); } }; class ScopedCom { public: ScopedCom() { CoInitialize(NULL); } ~ScopedCom() { CoUninitialize(); } }; inline void InitAllCommonControls() { INITCOMMONCONTROLSEX cex = {0}; cex.dwSize = sizeof(INITCOMMONCONTROLSEX); cex.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_USEREX_CLASSES | ICC_COOL_CLASSES ; InitCommonControlsEx(&cex); } inline void FillWndClassEx(WNDCLASSEXW &wcex, HINSTANCE hInstance) { wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = 0; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = NULL; wcex.lpszMenuName = NULL; wcex.hIconSm = 0; } inline int RectDx(const RECT& r) { return r.right - r.left; } inline int RectDy(const RECT& r) { return r.bottom - r.top; } inline int RectDx(RECT *r) { return r->right - r->left; } inline int RectDy(RECT *r) { return r->bottom - r->top; } inline void RectZero(RECT *r) { r->left = r->right = r->top = r->bottom = 0; } inline void RectSet(RECT *r, int x, int y, int dx, int dy) { r->left = x; r->right = x + dx; r->top = y; r->bottom = y + dy; } inline void RectSet(RECT& r, int x, int y, int dx, int dy) { r.left = x; r.right = x + dx; r.top = y; r.bottom = y + dy; } inline void RectSetSize(RECT& r, int dx, int dy) { r.left = r.top = 0; r.right = dx; r.bottom = dy; } inline void RectSetDx(RECT& r, int dx) { r.right = r.left + dx; } inline void RectMove(RECT& r, int dx, int dy) { r.left += dx; r.right += dx; r.top += dy; r.bottom += dy; } inline bool PointIn(const RECT&r, int x, int y) { if (x < r.left || x > r.right) return false; if (y < r.top || y > r.bottom) return false; return true; } inline const PointF PointFFromRECT(const RECT& r) { PointF ret; ret.X = (REAL)r.left; ret.Y = (REAL)r.top; return ret; } class MillisecondTimer { LARGE_INTEGER start; LARGE_INTEGER end; public: void Start() { QueryPerformanceCounter(&start); } void Stop() { QueryPerformanceCounter(&end); } double GetCurrTimeInMs() { LARGE_INTEGER curr; LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); QueryPerformanceCounter(&curr); double timeInSecs = (double)(curr.QuadPart-start.QuadPart)/(double)freq.QuadPart; return timeInSecs * 1000.0; } double GetTimeInMs() { LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); double timeInSecs = (double)(end.QuadPart-start.QuadPart)/(double)freq.QuadPart; return timeInSecs * 1000.0; } }; namespace win { inline void ModifyStyleEx(HWND hwnd, LONG styleExSet) { LONG old = GetWindowLong(hwnd, GWL_EXSTYLE); SetWindowLong(hwnd, GWL_EXSTYLE, old | styleExSet); } } // namespace win #endif
[ [ [ 1, 174 ] ] ]
1f7985c20f25a520ca0b8ddcdad9ab71479b9bff
9df2486e5d0489f83cc7dcfb3ccc43374ab2500c
/src/objects/text_box.h
acfd45774b0addd84517cb3c771ef6c80bb5ce6e
[]
no_license
renardchien/Eta-Chronicles
27ad4ffb68385ecaafae4f12b0db67c096f62ad1
d77d54184ec916baeb1ab7cc00ac44005d4f5624
refs/heads/master
2021-01-10T19:28:28.394781
2011-09-05T14:40:38
2011-09-05T14:40:38
1,914,623
1
2
null
null
null
null
UTF-8
C++
false
false
1,840
h
/*************************************************************************** * text_box.h - header for the corresponding cpp file * * Copyright (C) 2007 - 2009 Florian Richter ***************************************************************************/ /* 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 3 of the License, or (at your option) any later version. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SMC_TEXT_BOX_H #define SMC_TEXT_BOX_H #include "../core/globals.h" #include "../objects/box.h" namespace SMC { /* *** *** *** *** *** *** *** *** cText_Box *** *** *** *** *** *** *** *** *** */ class cText_Box : public cBaseBox { public: // constructor cText_Box( float x, float y ); // create from stream cText_Box( CEGUI::XMLAttributes &attributes ); // destructor virtual ~cText_Box( void ); // init defaults void Init( void ); // copy virtual cText_Box *Copy( void ); // create from stream virtual void Create_From_Stream( CEGUI::XMLAttributes &attributes ); // save to stream virtual void Save_To_Stream( ofstream &file ); // Activate virtual void Activate( void ); // update virtual void Update( void ); // Set Text void Set_Text( const std::string &str_text ); // editor activation virtual void Editor_Activate( void ); // editor text text changed event bool Editor_Text_Text_Changed( const CEGUI::EventArgs &event ); // the text std::string text; }; /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ } // namespace SMC #endif
[ [ [ 1, 69 ] ] ]
a7817399d34a3fc3b060b48f3b176b7c42ce16d3
da48afcbd478f79d70767170da625b5f206baf9a
/tbmessage/src/EditAccDlg.h
30dd8e84b014dab4f4c87a37cb15d57c27b2c6c8
[]
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
UTF-8
C++
false
false
563
h
#pragma once // CEditAccountDlg dialog class CEditAccountDlg : public CDialog { DECLARE_DYNAMIC(CEditAccountDlg) public: CEditAccountDlg(CWnd* pParent = NULL); // standard constructor virtual ~CEditAccountDlg(); // Dialog Data enum { IDD = IDD_EDIT_ACC_DLG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() private: CString m_szUserId; CString m_szPassword; public: CString GetUserId(); CString GetPassword(); afx_msg void OnBnClickedOk(); };
[ "[email protected]@d41c10be-1f87-11de-a78b-a7aca27b2395" ]
[ [ [ 1, 28 ] ] ]
2d7cea3341d1045ec255668a0ec38fa18a0d77a6
c95a83e1a741b8c0eb810dd018d91060e5872dd8
/libs/lith/lithsimparystat.h
b71fb2d38af0cc812f75a8f65386375c61406546
[]
no_license
rickyharis39/nolf2
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
refs/heads/master
2021-01-01T17:21:00.678517
2011-07-23T12:11:19
2011-07-23T12:11:19
38,495,312
1
0
null
null
null
null
UTF-8
C++
false
false
1,900
h
/**************************************************************************** ; ; MODULE: LithSimpAryStat (.H) ; ; PURPOSE: Simple array template class that can check bounds in debug builds. ; ; HISTORY: APR-16-98 [blb] ; ; NOTICE: Copyright (c) 1998, MONOLITH, Inc. ; ***************************************************************************/ #ifndef __LITHSIMPARYSTAT_H__ #define __LITHSIMPARYSTAT_H__ #ifndef __LITH_H__ #include "lith.h" #endif // examples of use //#define CLithSimpAryStatVoidPtr CLithSimpAryStat<void*,10> //#define CLithSimpAryStatChar CLithSimpAryStat<char,5> #ifdef _DEBUG #ifndef _LithSimpAryStat_CheckBounds #define _LithSimpAryStat_CheckBounds #endif #endif template<class Type, int nSize> class CLithSimpAryStat { public: // Copy data to the array void Copy(const Type* pSource, const unsigned int size) { #ifdef _LithSimpAryStat_CheckBounds ASSERT(size <= m_nSize); #endif memcpy(m_pData, pSource, size); } // Get an element of the array Type& Get(const unsigned int nIndex) { #ifdef _LithSimpAryStat_CheckBounds ASSERT(nIndex < nSize); #endif return m_pData[nIndex]; } // Set an element of the array void Set(const unsigned int nIndex, Type &data) { #ifdef _LithSimpAryStat_CheckBounds ASSERT(nIndex < nSize); #endif m_pData[nIndex] = data; } // Access to the array with the standard [] // Type& operator[](const unsigned int nIndex) const { return Get(nIndex); }; // allow direct access to the array if necessary // operator const Type* () { return m_pData; }; operator Type* () { return m_pData; }; private: #ifdef _LithSimpAryStat_CheckBounds unsigned int m_nSize; #endif Type m_pData[nSize]; }; #endif
[ [ [ 1, 82 ] ] ]
6d3ee2102aef5a953d47688b0abcde8d262785d4
e680f7b7e88bedb2dc43701a5f192288258a4b1c
/src/UCB/ImageSaver.h
08c4413d136191f2515f17ecb7d91a56b77e2a91
[]
no_license
pseudonumos/SpiderHunt
870e4543d54adb6bda85912f37d20346daacc687
88156327a4393c9e5149ea3fb4d565f67a59a411
refs/heads/master
2016-08-03T18:43:29.403358
2011-03-09T06:21:55
2011-03-09T06:21:55
1,457,988
2
0
null
null
null
null
UTF-8
C++
false
false
867
h
/* * ImageSaver.h * * Created on: Oct 23, 2008 * Author: njoubert */ #ifndef UCBIMAGESAVER_H_ #define UCBIMAGESAVER_H_ #include <sstream> #include <iomanip> #include "Image.h" #include "UCBglobal.h" namespace UCB { using namespace std; #define BPP 24 class ImageSaver { public: /** * Creates an ImageSaver that will write OpenGL window captures * to the specified directory with files names prefix000i.bmp */ ImageSaver(std::string directory, std::string prefix); ~ImageSaver(); /** * Call this to write a frame to disk. Supply the current window size. */ void saveFrame(); private: int _frameCount; string _imgOutDir; string _prefix; }; } #endif /* UCBIMAGESAVER_H_ */
[ [ [ 1, 45 ] ] ]
3f8e91a79425fccca37246f05282b2c6f580fe31
1e01b697191a910a872e95ddfce27a91cebc57dd
/GrfLoadProject.cpp
6ab9adcbbeecea277682e5e5184a944eb44d792d
[]
no_license
canercandan/codeworker
7c9871076af481e98be42bf487a9ec1256040d08
a68851958b1beef3d40114fd1ceb655f587c49ad
refs/heads/master
2020-05-31T22:53:56.492569
2011-01-29T19:12:59
2011-01-29T19:12:59
1,306,254
7
5
null
null
null
null
IBM852
C++
false
false
8,946
cpp
/* "CodeWorker": a scripting language for parsing and generating text. Copyright (C) 1996-1997, 1999-2010 CÚdric Lemaire This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA To contact the author: [email protected] */ #ifdef WIN32 #pragma warning (disable : 4786) #endif #include "ScpStream.h" #include "CppCompilerEnvironment.h" #include "CGRuntime.h" #include "ExprScriptExpression.h" #include <string> #include "DtaScriptVariable.h" #include "ExprScriptVariable.h" //##protect##"INCLUDE FILES" #include "DtaProject.h" //##protect##"INCLUDE FILES" #include "GrfLoadProject.h" namespace CodeWorker { GrfLoadProject::~GrfLoadProject() { delete _pXMLorTXTFileName; delete _pNodeToLoad; } SEQUENCE_INTERRUPTION_LIST GrfLoadProject::executeInternal(DtaScriptVariable& visibility) { std::string sXMLorTXTFileName = _pXMLorTXTFileName->getValue(visibility); DtaScriptVariable* pNodeToLoad = visibility.getVariable(*_pNodeToLoad); //##protect##"execute" //##protect##"execute" return CGRuntime::loadProject(sXMLorTXTFileName, pNodeToLoad); } void GrfLoadProject::populateDefaultParameters() { if (_pNodeToLoad == NULL) _pNodeToLoad = new ExprScriptVariable("project"); } //##protect##"implementation" void GrfLoadProject::parseTextFile(std::istream& theStream, DtaScriptVariable* pNode) { std::string sNodeName; if (!CodeWorker::readString(theStream, sNodeName)) { throw UtlException(theStream, "complete name of the parse tree to load is expected between double quotes"); } CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualTo(theStream, '=')) { throw UtlException(theStream, "'=' expected"); } if (pNode == NULL) { pNode = &(DtaProject::getInstance()); } populateConstantTree(theStream, *pNode); } void GrfLoadProject::parseXMLFile(std::istream& theStream, DtaScriptVariable* pNode) { if (!CodeWorker::isEqualTo(theStream, '<')) throw UtlException(theStream, "excepted char '<' missing"); std::string sNodeName; if (!CodeWorker::readIdentifier(theStream, sNodeName)) throw UtlException(theStream, "complete name of the parse tree to load is expected"); if (!CodeWorker::isEqualTo(theStream, '>')) throw UtlException(theStream, "excepted char '>' missing"); CodeWorker::skipEmpty(theStream); populateConstantTreeToXML(theStream, *pNode); } bool GrfLoadProject::populateConstantTreeToXML(std::istream& theStream, DtaScriptVariable& theNode) { std::string sValue; CodeWorker::skipEmpty(theStream); if (CodeWorker::isEqualTo(theStream, '&')) { // reference to a node CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualToIdentifier(theStream, "ref")) { throw UtlException(theStream, "reference node should be announced by '&ref'"); } CodeWorker::skipEmpty(theStream); std::string sReferenceNode; if (!CodeWorker::readString(theStream, sReferenceNode)) { throw UtlException(theStream, "reference node expected between double quotes"); } CodeWorker::skipEmpty(theStream); if (CodeWorker::isEqualTo(theStream, '=')) { CodeWorker::skipEmpty(theStream); if (!CodeWorker::readString(theStream, sValue)) { throw UtlException(theStream, "syntax error: value expected between double quotes"); } } } else { CodeWorker::readString(theStream, sValue); } theNode.setValue(sValue.c_str()); CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualTo(theStream, '{')) { return false; } CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualTo(theStream, '}')) { do { CodeWorker::skipEmpty(theStream); if (CodeWorker::isEqualTo(theStream, '.')) { CodeWorker::skipEmpty(theStream); std::string sAttribute; if (!CodeWorker::readIdentifier(theStream, sAttribute)) { throw UtlException(theStream, "attribute name expected"); } CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualTo(theStream, '=')) { throw UtlException(theStream, "syntax error, '=' expected"); } populateConstantTree(theStream, *theNode.insertNode(sAttribute.c_str())); } else if (CodeWorker::isEqualTo(theStream, '[')) { do { CodeWorker::skipEmpty(theStream); if (CodeWorker::readString(theStream, sValue) && skipEmpty(theStream) && CodeWorker::isEqualTo(theStream, ':')) { // "key" : "value" or "node" populateConstantTree(theStream, *theNode.addElement(sValue)); } else { populateConstantTree(theStream, *theNode.pushItem(sValue)); } CodeWorker::skipEmpty(theStream); } while (CodeWorker::isEqualTo(theStream, ',')); if (!CodeWorker::isEqualTo(theStream, ']')) { throw UtlException(theStream, "syntax error, ']' expected"); } } else { throw UtlException(theStream, "syntax error"); } CodeWorker::skipEmpty(theStream); } while (CodeWorker::isEqualTo(theStream, ',')); if (!CodeWorker::isEqualTo(theStream, '}')) { throw UtlException(theStream, "syntax error, '}' expected"); } } return true; } bool GrfLoadProject::populateConstantTree(std::istream& theStream, DtaScriptVariable& theNode) { std::string sValue; CodeWorker::skipEmpty(theStream); if (CodeWorker::isEqualTo(theStream, '&')) { // reference to a node CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualToIdentifier(theStream, "ref")) { throw UtlException(theStream, "reference node should be announced by '&ref'"); } CodeWorker::skipEmpty(theStream); std::string sReferenceNode; if (!CodeWorker::readString(theStream, sReferenceNode)) { throw UtlException(theStream, "reference node expected between double quotes"); } CodeWorker::skipEmpty(theStream); if (CodeWorker::isEqualTo(theStream, '=')) { CodeWorker::skipEmpty(theStream); if (!CodeWorker::readString(theStream, sValue)) { throw UtlException(theStream, "syntax error: value expected between double quotes"); } } } else { CodeWorker::readString(theStream, sValue); } theNode.setValue(sValue.c_str()); CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualTo(theStream, '{')) { return false; } CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualTo(theStream, '}')) { do { CodeWorker::skipEmpty(theStream); if (CodeWorker::isEqualTo(theStream, '.')) { CodeWorker::skipEmpty(theStream); std::string sAttribute; if (!CodeWorker::readIdentifier(theStream, sAttribute)) { throw UtlException(theStream, "attribute name expected"); } CodeWorker::skipEmpty(theStream); if (!CodeWorker::isEqualTo(theStream, '=')) { throw UtlException(theStream, "syntax error, '=' expected"); } populateConstantTree(theStream, *theNode.insertNode(sAttribute.c_str())); } else if (CodeWorker::isEqualTo(theStream, '[')) { do { CodeWorker::skipEmpty(theStream); if (CodeWorker::readString(theStream, sValue) && skipEmpty(theStream) && CodeWorker::isEqualTo(theStream, ':')) { // "key" : "value" or "node" populateConstantTree(theStream, *theNode.addElement(sValue)); } else { populateConstantTree(theStream, *theNode.pushItem(sValue)); } CodeWorker::skipEmpty(theStream); } while (CodeWorker::isEqualTo(theStream, ',')); if (!CodeWorker::isEqualTo(theStream, ']')) { throw UtlException(theStream, "syntax error, ']' expected"); } } else { throw UtlException(theStream, "syntax error"); } CodeWorker::skipEmpty(theStream); } while (CodeWorker::isEqualTo(theStream, ',')); if (!CodeWorker::isEqualTo(theStream, '}')) { throw UtlException(theStream, "syntax error, '}' expected"); } } return true; } //##protect##"implementation" void GrfLoadProject::compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const { CW_BODY_INDENT << "CGRuntime::loadProject("; _pXMLorTXTFileName->compileCppString(theCompilerEnvironment); CW_BODY_STREAM << ", "; _pNodeToLoad->compileCpp(theCompilerEnvironment); CW_BODY_STREAM << ");"; CW_BODY_ENDL; } }
[ "cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4", "[email protected]" ]
[ [ [ 1, 73 ], [ 163, 242 ] ], [ [ 74, 162 ] ] ]
027aafbd9a52d461184004b79ec760244ef3c13c
353bd39ba7ae46ed521936753176ed17ea8546b5
/src/layer1_system/system_info/src/axsi_util.cpp
53d90a52ffde5ac2691ad09c41f794b8cc7f950e
[]
no_license
d0n3val/axe-engine
1a13e8eee0da667ac40ac4d92b6a084ab8a910e8
320b08df3a1a5254b776c81775b28fa7004861dc
refs/heads/master
2021-01-01T19:46:39.641648
2007-12-10T18:26:22
2007-12-10T18:26:22
32,251,179
1
0
null
null
null
null
UTF-8
C++
false
false
4,918
cpp
/** * @file * Axe 'system_info' utilities code */ #include "axsi_stdafx.h" #include <dxdiag.h> #define SAFE_RELEASE( p ) { \ if( p ) { \ ( p )->Release(); \ ( p ) = NULL; \ } \ } extern _state state; /// Global state of the library int start_dxdiag() { HRESULT hr; hr = CoInitialize( NULL ); if( hr < 0 ) { axsi_set_error( 5 ); return( AXE_FALSE ); } // CoCreate a IDxDiagProvider* hr = CoCreateInstance( CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER, IID_IDxDiagProvider, (LPVOID*) &state.dxdiag_provider ); if( hr < 0 ) { stop_dxdiag(); return( AXE_FALSE ); } DXDIAG_INIT_PARAMS dxdiag_params; ZeroMemory( &dxdiag_params, sizeof(DXDIAG_INIT_PARAMS) ); dxdiag_params.dwSize = sizeof( DXDIAG_INIT_PARAMS ); dxdiag_params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION; dxdiag_params.bAllowWHQLChecks = FALSE; dxdiag_params.pReserved = NULL; hr = state.dxdiag_provider->Initialize( &dxdiag_params ); if( hr < 0 ) { stop_dxdiag(); return( AXE_FALSE ); } hr = state.dxdiag_provider->GetRootContainer( &state.dxdiag_root ); if( hr < 0 ) { stop_dxdiag(); return( AXE_FALSE ); } return( AXE_TRUE ); } IDxDiagContainer* get_dxdiag_section( char* section ) { HRESULT hr; IDxDiagContainer* child = NULL; WCHAR wtmp[256]; char* token; char separation[10] = "."; bool first = true; // -- patch // I don't know why, but If we don't copy the string here in RELEASE mode // it crashed in strtok.c ... char section2[256]; strcpy( section2, section ); token = strtok( section2, separation ); // -- patch // this only works in DEBUG mode (?!?!) // token = strtok(section, separation); while( token != NULL ) { str_to_wstr( token, wtmp ); if( first == true ) { hr = state.dxdiag_root->GetChildContainer( wtmp, &child ); first = false; } else { hr = child->GetChildContainer( wtmp, &child ); } if( hr < 0 ) { return( NULL ); } token = strtok( NULL, separation ); } return( child ); } int get_bool_dxdiag( char* section, const char* property ) { VARIANT value; if( get_variant_dxdiag(&value, section, property) == AXE_TRUE ) { return( (value.boolVal) ? AXE_TRUE : AXE_FALSE ); } return( AXE_FALSE ); } int get_int_dxdiag( char* section, const char* property ) { VARIANT value; if( get_variant_dxdiag(&value, section, property) == AXE_TRUE ) { return( value.iVal ); } return( AXE_FALSE ); } int get_str_dxdiag( char* to_copy, char* section, const char* property ) { VARIANT value; if( get_variant_dxdiag(&value, section, property) == AXE_TRUE ) { wstr_to_str( value.bstrVal, to_copy ); return( AXE_TRUE ); } to_copy[0] = 0; return( AXE_FALSE ); } int get_variant_dxdiag( VARIANT* value, char* section, const char* property ) { HRESULT hr; VariantInit( value ); if( state.dxdiag_root == NULL ) { return( AXE_FALSE ); } IDxDiagContainer* child = NULL; child = get_dxdiag_section( section ); if( child == NULL ) { return( AXE_FALSE ); } WCHAR wtmp[256]; str_to_wstr( property, wtmp ); hr = child->GetProp( wtmp, value ); if( hr < 0 ) { return( AXE_FALSE ); } return( AXE_TRUE ); } void str_to_wstr( const char* string, wchar_t* wide_string ) { int len = (int) strlen( string ) + 1; for( register int i = 0; i < len; ++i ) { wide_string[i] = string[i]; } } void wstr_to_str( const wchar_t* wide_string, char* string ) { int len = (int) wcslen( wide_string ) + 1; for( register int i = 0; i < len; ++i ) { string[i] = (char) wide_string[i]; } } int stop_dxdiag() { SAFE_RELEASE( state.dxdiag_provider ); SAFE_RELEASE( state.dxdiag_root ); CoUninitialize(); return( AXE_TRUE ); } time_t get_date( const char* str ) { // this string comes like "7/28/2003 14:19:00" struct tm date; sscanf( str, "%d/%d/%d %d:%d:%d", &date.tm_mon, &date.tm_mday, &date.tm_year, &date.tm_hour, &date.tm_min, &date.tm_sec ); date.tm_year -= 1900; date.tm_mon -= 1; return( mktime(&date) ); } int get_list_num( const int pos, const char* separator, char* list ) { char* token; int i; i = 0; token = strtok( list, separator ); while( token != NULL && i < pos ) { token = strtok( NULL, separator ); ++i; } if( token != NULL ) { return( atoi(token) ); } return( AXE_FALSE ); } /* $Id: axsi_util.cpp,v 1.1 2004/06/09 18:23:57 doneval Exp $ */
[ "d0n3val@2cff7946-3f3c-0410-b79f-f9b517ddbf54" ]
[ [ [ 1, 228 ] ] ]
923fd393550b1d8d773709b0e53e8125a257f9a4
5095bbe94f3af8dc3b14a331519cfee887f4c07e
/Shared/SEGReport/XmlFileReader.cpp
59f559d4b25166822b92639117d1211746e61aae
[]
no_license
sativa/apsim_development
efc2b584459b43c89e841abf93830db8d523b07a
a90ffef3b4ed8a7d0cce1c169c65364be6e93797
refs/heads/master
2020-12-24T06:53:59.364336
2008-09-17T05:31:07
2008-09-17T05:31:07
64,154,433
0
0
null
null
null
null
UTF-8
C++
false
false
4,944
cpp
//--------------------------------------------------------------------------- #include <general\pch.h> #include <vcl.h> #pragma hdrstop #include "XmlFileReader.h" #include <vector> #include <string> #include <fstream> #include <general\inifile.h> #include <general\db_functions.h> #include <general\string_functions.h> #include <general\path.h> #include <general\xml.h> #include <general\io_functions.h> #include "DataContainer.h" using namespace std; //--------------------------------------------------------------------------- // Return a unique name for the specified node unique amongst the children of // the specified parent node //--------------------------------------------------------------------------- string makeNameUnique(const XMLNode& parentNode, const XMLNode& node) { string name = node.getName(); int numMatches = 0; int nodeIndex = 0; for (XMLNode::iterator child = parentNode.begin(); child != parentNode.end(); child++) { if (name == child->getName()) numMatches++; if (node == *child) nodeIndex = numMatches; } if (nodeIndex == 0) throw runtime_error("Internal failure in XmlFileReader::makeNameUnique"); if (nodeIndex == 1) return name; else return name + itoa(nodeIndex); } //--------------------------------------------------------------------------- // read the specified XmlNode and add to fieldNames and fieldValues - recursive. //--------------------------------------------------------------------------- void readXmlNode(const XMLNode& node, const string& name, vector<string>& fieldNames, vector<string>& fieldValues) { if (node.begin() == node.end()) { // no children. // make sure the name doesn't clash with an existing name. string fieldName = name; int index = 1; while (find(fieldNames.begin(), fieldNames.end(), fieldName) != fieldNames.end()) { fieldName = name; unsigned posPeriod = fieldName.rfind('.'); if (posPeriod == string::npos) posPeriod = fieldName.length(); index++; fieldName.insert(posPeriod, itoa(index)); } fieldNames.push_back(fieldName); string value = node.getValue(); if (value == "") value = "?"; fieldValues.push_back(value); } else { if (node.getAttribute("name") != "") { fieldNames.push_back(name + ".name"); fieldValues.push_back(node.getAttribute("name")); } for (XMLNode::iterator child = node.begin(); child != node.end(); child++) { string childName = makeNameUnique(node, *child); if (name != "") childName = name + "." + childName; readXmlNode(*child, childName, fieldNames, fieldValues); } } } //--------------------------------------------------------------------------- // read in the contents of our XML file into fieldNames and fieldValues //--------------------------------------------------------------------------- void readXmlFile(const std::string& fileName, vector<string>& fieldNames, vector<string>& fieldValues) { if (!FileExists(fileName)) throw runtime_error("Cannot find XML file: " + fileName); fieldNames.erase(fieldNames.begin(), fieldNames.end()); fieldValues.erase(fieldValues.begin(), fieldValues.end()); XMLDocument xml(fileName.c_str()); readXmlNode(xml.documentElement(), "", fieldNames, fieldValues); } //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // this function reads all xml data from a file //--------------------------------------------------------------------------- void processXmlFileReader(DataContainer& parent, const XMLNode& properties, TDataSet& result) { result.Active = false; addDBField(&result, "name", "xx"); addDBField(&result, "value", "xx"); if (result.FieldDefs->Count > 0) { result.Active = true; std::string fileName = parent.read(properties, "filename"); vector<string> fieldNames, fieldValues; readXmlFile(fileName, fieldNames, fieldValues); for (unsigned i = 0; i != fieldNames.size(); i++) { result.Append(); result.FieldValues["name"] = fieldNames[i].c_str(); result.FieldValues["value"] = fieldValues[i].c_str(); result.Post(); } } }
[ "hol353@8bb03f63-af10-0410-889a-a89e84ef1bc8" ]
[ [ [ 1, 140 ] ] ]
1ea50d7a2d341afbd1e49ebb70f021fac4f4b3d2
e8b8c5d9510b267e41c496024f7f439d1aff1618
/Platform/Platform.cpp
a59d59788971a2f5b073bb062ef8c193a0cd9f7c
[]
no_license
Archetype/milkblocks
b80250cb5820188a16df73d528f80e3523d129b0
28ee5a44e5afc2440b77feec77202b310f395361
refs/heads/master
2021-01-19T21:29:05.453990
2011-07-12T02:44:59
2011-07-12T02:44:59
1,030,899
0
0
null
null
null
null
UTF-8
C++
false
false
233
cpp
#include "Platform.h" #include <stdio.h> #include <assert.h> #ifdef __WIN32 #include "mmgr.h" #endif Platform* Platform::sm_Platform = NULL; Platform::Platform() { assert(sm_Platform == NULL); sm_Platform = this; }
[ [ [ 1, 15 ] ] ]
17ef2a00e20eb0b5a798764f0820b84eecef8fd4
4cfa1921fdde92141c413ee7622b66379736494c
/objects/telemetry.h
173911f85a33a847ddca6c2730d62b20b58957c4
[]
no_license
dragonshx/gps-sdr
aca4341650ba4a8f8ca046a1217410807a029032
1d31fcad1479b0d047c6dac7464b19e6189097fa
refs/heads/master
2021-01-18T05:52:58.837305
2009-01-08T22:13:26
2009-01-08T22:13:26
119,804
1
0
null
null
null
null
UTF-8
C++
false
false
2,580
h
/*! \file Telemetry.h Defines the class Telemetry */ /************************************************************************************************ Copyright 2008 Gregory W Heckler This file is part of the GPS Software Defined Radio (GPS-SDR) The GPS-SDR 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. The GPS-SDR 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 GPS-SDR; if not, write to the: Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ************************************************************************************************/ #ifndef TELEMETRY_H_ #define TELEMETRY_H_ #include "includes.h" /*! \ingroup CLASSES * */ class Telemetry : public Threaded_Object { private: /* Stuff for ncurses display */ WINDOW *mainwnd; WINDOW *screen; WINDOW *my_win; FIFO_M tFIFO; PVT_2_Telem_S tNav; Channel_M tChan[MAX_CHANNELS]; Acq_Command_M tAcq; Ephemeris_Status_M tEphem; SV_Select_2_Telem_S tSelect; int32 active[MAX_CHANNELS]; int32 line; int32 ncurses_on; int32 count; int32 display; FILE *fp_nav; //!< Navigation data FILE *fp_chan; //!< Channel tracking data FILE *fp_pseudo; //!< Pseudoranges FILE *fp_meas; //!< Raw measurements FILE *fp_sv; //!< SV position/velocity output FILE *fp_ge; //!< Google Earth Output uint32 fp_ge_end; //!< Hold place of last Google earth pointer, minus the header public: Telemetry(); ~Telemetry(); void Start(); //!< Start the thread void Import(); //!< Get data into the thread void Export(); //!< Get data out of the thread void SetDisplay(int32 _type){display = _type;} void Init(); void InitScreen(); void UpdateScreen(); void EndScreen(); void PrintChan(); void PrintNav(); void PrintSV(); void PrintEphem(); void PrintAlmanac(); void PrintHistory(); void LogNav(); void LogPseudo(); void LogTracking(); void LogSV(); void LogGoogleEarth(); void GoogleEarthFooter(); void GoogleEarthHeader(); }; #endif /* TELEMETRY_H */
[ "gheckler@core2duo.(none)", "gheckler@gs-mesa3079963w.(none)", "[email protected]" ]
[ [ [ 1, 17 ], [ 19, 22 ], [ 25, 28 ], [ 30, 30 ], [ 32, 39 ], [ 42, 42 ], [ 46, 46 ], [ 48, 52 ], [ 61, 63 ], [ 65, 65 ], [ 70, 70 ], [ 72, 80 ], [ 83, 86 ], [ 90, 92 ] ], [ [ 18, 18 ], [ 23, 24 ], [ 29, 29 ], [ 31, 31 ], [ 40, 41 ], [ 43, 45 ], [ 47, 47 ], [ 53, 53 ], [ 57, 57 ], [ 60, 60 ], [ 64, 64 ], [ 66, 69 ], [ 71, 71 ], [ 81, 81 ], [ 93, 93 ] ], [ [ 54, 56 ], [ 58, 59 ], [ 82, 82 ], [ 87, 89 ] ] ]
a592f0889384f29a4bf233e7f2fa16480c2e019d
032ea9816579a9869070a285d0224f95ba6a767b
/3dProject/trunk/MapSearchNode.h
2b1524cc8b3390c458e6378c5aeabbf449bb68ad
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
sennheiser1986/oglproject
3577bae81c0e0b75001bde57b8628d59c8a5c3cf
d975ed5a4392036dace4388e976b88fc4280a116
refs/heads/master
2021-01-13T17:05:14.740056
2010-06-01T15:48:38
2010-06-01T15:48:38
39,767,324
0
0
null
null
null
null
UTF-8
C++
false
false
4,953
h
/* A* Algorithm Implementation using STL is Copyright (C)2001-2005 Justin Heyes-Jones Permission is given by the author to freely redistribute and include this code in any program as long as this credit is given where due. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. Use at your own risk! FixedSizeAllocator class Copyright 2001 Justin Heyes-Jones This class is a constant time O(1) memory manager for objects of a specified type. The type is specified using a template class. Memory is allocated from a fixed size buffer which you can specify in the class constructor or use the default. Using GetFirst and GetNext it is possible to iterate through the elements one by one, and this would be the most common use for the class. I would suggest using this class when you want O(1) add and delete and you don't do much searching, which would be O(n). Structures such as binary trees can be used instead to get O(logn) access time. */ #include <math.h> #include "stlastar.h" #include "Map.h" class MapSearchNode { public: //changed from unsigned int to int because of compiler warnings int x; // the (x,y) positions of the node int y; MapSearchNode() { x = y = 0; } MapSearchNode( unsigned int px, unsigned int py ) { x=px; y=py; } float GoalDistanceEstimate( MapSearchNode &nodeGoal ); bool IsGoal( MapSearchNode &nodeGoal ); bool GetSuccessors( AStarSearch<MapSearchNode> *astarsearch, MapSearchNode *parent_node ); float GetCost( MapSearchNode &successor ); bool IsSameState( MapSearchNode &rhs ); void PrintNodeInfo(); private: int GetMap(int x, int y); }; int MapSearchNode::GetMap( int x, int y ) { Map * instance = Map::getInstance(); return instance->getValueAt(x,y); } bool MapSearchNode::IsSameState( MapSearchNode &rhs ) { // same state in a maze search is simply when (x,y) are the same if( (x == rhs.x) && (y == rhs.y) ) { return true; } else { return false; } } void MapSearchNode::PrintNodeInfo() { cout << "Node position : (" << x << ", " << y << ")" << endl; } // Here's the heuristic function that estimates the distance from a Node // to the Goal. float MapSearchNode::GoalDistanceEstimate( MapSearchNode &nodeGoal ) { float xd = fabs(float(((float)x - (float)nodeGoal.x))); float yd = fabs(float(((float)y - (float)nodeGoal.y))); return xd + yd; } bool MapSearchNode::IsGoal( MapSearchNode &nodeGoal ) { if( (x == nodeGoal.x) && (y == nodeGoal.y) ) { return true; } return false; } // This generates the successors to the given Node. It uses a helper function called // AddSuccessor to give the successors to the AStar class. The A* specific initialisation // is done for each node internally, so here you just set the state information that // is specific to the application bool MapSearchNode::GetSuccessors( AStarSearch<MapSearchNode> *astarsearch, MapSearchNode *parent_node ) { int parent_x = -1; int parent_y = -1; if( parent_node ) { parent_x = parent_node->x; parent_y = parent_node->y; } MapSearchNode NewNode; // push each possible move except allowing the search to go backwards if( (GetMap( x-1, y ) < 9) && !((parent_x == x-1) && (parent_y == y)) ) { NewNode = MapSearchNode( x-1, y ); astarsearch->AddSuccessor( NewNode ); } if( (GetMap( x, y-1 ) < 9) && !((parent_x == x) && (parent_y == y-1)) ) { NewNode = MapSearchNode( x, y-1 ); astarsearch->AddSuccessor( NewNode ); } if( (GetMap( x+1, y ) < 9) && !((parent_x == x+1) && (parent_y == y)) ) { NewNode = MapSearchNode( x+1, y ); astarsearch->AddSuccessor( NewNode ); } if( (GetMap( x, y+1 ) < 9) && !((parent_x == x) && (parent_y == y+1)) ) { NewNode = MapSearchNode( x, y+1 ); astarsearch->AddSuccessor( NewNode ); } return true; } // given this node, what does it cost to move to successor. In the case // of our map the answer is the map terrain value at this node since that is // conceptually where we're moving float MapSearchNode::GetCost( MapSearchNode &successor ) { return (float) GetMap( x, y ); }
[ "fionnghall@444a4038-2bd8-11df-954b-21e382534593" ]
[ [ [ 1, 187 ] ] ]
051fb2751512c4a183b17b00e9e3248a286b7e6f
b8c3d2d67e983bd996b76825f174bae1ba5741f2
/RTMP/projects/HttpPseudoStreaming/src/connection.cpp
89179a2c1ba48009a5816654c0f78250dbc6a43b
[]
no_license
wangscript007/rtmp-cpp
02172f7a209790afec4c00b8855d7a66b7834f23
3ec35590675560ac4fa9557ca7a5917c617d9999
refs/heads/master
2021-05-30T04:43:19.321113
2008-12-24T20:16:15
2008-12-24T20:16:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,239
cpp
#include "connection.hpp" #include <vector> #include <boost/bind.hpp> #include "connection_manager.hpp" #include "request_handler.hpp" namespace http { namespace server { connection::connection(boost::asio::io_service& io_service, connection_manager& manager, request_handler& handler) : socket_(io_service), connection_manager_(manager), request_handler_(handler) { } boost::asio::ip::tcp::socket& connection::socket() { return socket_; } void connection::start() { socket_.async_read_some(boost::asio::buffer(buffer_), boost::bind(&connection::handle_read, shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } void connection::stop() { socket_.close(); } void connection::handle_read(const boost::system::error_code& e, std::size_t bytes_transferred) { if (!e) { boost::tribool result; boost::tie(result, boost::tuples::ignore) = request_parser_.parse(request_, buffer_.data(), buffer_.data() + bytes_transferred); if (result) { request_handler_.handle_request(request_, reply_); boost::asio::async_write(socket_, reply_.to_buffers(), boost::bind(&connection::handle_write, shared_from_this(), boost::asio::placeholders::error)); } else if (!result) { reply_ = reply::stock_reply(reply::bad_request); boost::asio::async_write(socket_, reply_.to_buffers(), boost::bind(&connection::handle_write, shared_from_this(), boost::asio::placeholders::error)); } else { socket_.async_read_some(boost::asio::buffer(buffer_), boost::bind(&connection::handle_read, shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } } else if (e != boost::asio::error::operation_aborted) { connection_manager_.stop(shared_from_this()); } } void connection::handle_write(const boost::system::error_code& e) { if (!e) { // Initiate graceful connection closure. boost::system::error_code ignored_ec; socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec); } if (e != boost::asio::error::operation_aborted) { connection_manager_.stop(shared_from_this()); } } } // namespace server } // namespace http
[ "fpelliccioni@71ea4c15-5055-0410-b3ce-cda77bae7b57" ]
[ [ [ 1, 74 ] ] ]
e4d12ed2a174d769dd4c5bfbe03f2e1f46b70488
b8fe0ddfa6869de08ba9cd434e3cf11e57d59085
/ouan-tests/TestDebugInfo/Application.cpp
e0f6af05bf6065272c2b13264dc3cc39f9f36c3d
[]
no_license
juanjmostazo/ouan-tests
c89933891ed4f6ad48f48d03df1f22ba0f3ff392
eaa73fb482b264d555071f3726510ed73bef22ea
refs/heads/master
2021-01-10T20:18:35.918470
2010-06-20T15:45:00
2010-06-20T15:45:00
38,101,212
0
0
null
null
null
null
UTF-8
C++
false
false
11,134
cpp
#include "Application.h" #include "OrbitCameraController.h" #include <Ogre.h> #define INIT_CAM_DISTANCE 5 #define INIT_CAM_Y_DEGREES -30 Application::Application() : m_root( NULL ) , m_window( NULL ) , m_sceneManager( NULL ) , m_camera( NULL ) , m_viewport( NULL ) , m_sceneNode( NULL ) , m_entity( NULL ) , m_idleAnimation( NULL ) , m_runAnimation( NULL ) , m_movingDirection( 0 ) , m_cameraController( NULL ) , m_exitRequested( false ) { } Application::~Application() { delete m_cameraController; SimpleInputManager::finalise(); delete m_root; } void Application::initialise() { //m_root = new Ogre::Root( "ogre_plugins.txt", "ogre_configuration.txt", "ogre_log.txt" ); m_root = new Ogre::Root(); // Initialise display options. // It shows the ugly dialog at start-up, so if you don't want to see it, it's up to you // to remove this line and initialise display options manually ( e.g. reading them from // a text file ). bool configDialogUserContinue = m_root->showConfigDialog(); if ( ! configDialogUserContinue ) { throw std::exception( "User closed/canceled config dialog" ); } // Create window with chosen display options. m_window = m_root->initialise( true, "Ogre Window" ); m_sceneManager = m_root->createSceneManager( Ogre::ST_GENERIC ); m_camera = m_sceneManager->createCamera( "DefaultCamera" ); m_viewport = m_window->addViewport( m_camera ); m_viewport->setBackgroundColour( Ogre::ColourValue( 0.5, 0.5, 1 ) ); SimpleInputManager::initialise( m_window ); loadResources(); createScene(); setupCEGUI(); setupOverlay(); } void Application::loadResources() { // You can specify as many locations as you want, or have several resource groups that you // load/unload when you need. // You may also wish to read the resource locations from a configuration file instead of // having them hard-coded. Ogre::ResourceGroupManager& resourceManager = Ogre::ResourceGroupManager::getSingleton(); Ogre::String secName, typeName, archName; Ogre::ConfigFile cf; cf.load("resources.cfg"); Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator(); while (seci.hasMoreElements()) { secName = seci.peekNextKey(); Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); Ogre::ConfigFile::SettingsMultiMap::iterator i; for (i = settings->begin(); i != settings->end(); ++i) { typeName = i->first; archName = i->second; Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName); } } resourceManager.initialiseAllResourceGroups(); } void Application::createScene() { m_entity = m_sceneManager->createEntity( "Freddy", "freddy.mesh" ); m_idleAnimation = m_entity->getAnimationState( "Idle" ); m_idleAnimation->setEnabled( true ); m_runAnimation = m_entity->getAnimationState( "Run" ); m_runAnimation->setEnabled( true ); m_sceneNode = m_sceneManager->getRootSceneNode()->createChildSceneNode(); m_sceneNode->attachObject( m_entity ); Ogre::Entity* groundEntity = m_sceneManager->createEntity( "Ground", "ground.mesh" ); Ogre::SceneNode* groundSceneNode = m_sceneManager->getRootSceneNode()->createChildSceneNode(); groundSceneNode->attachObject( groundEntity ); groundSceneNode->setScale( 20, 1, 20 ); m_cameraController = new OrbitCameraController( m_camera ); m_cameraController->setOrientation( -180, INIT_CAM_Y_DEGREES ); m_cameraController->setDistance( INIT_CAM_DISTANCE ); m_cameraController->setLookAtPosition( 0, 0.5, 0 ); m_camera->setNearClipDistance( 0.01 ); } void Application::go() { Ogre::Timer loopTimer; bool continueRunning = true; while ( continueRunning ) { Ogre::WindowEventUtilities::messagePump(); SimpleInputManager::capture(); // Update logic stuff float elapsedSeconds = loopTimer.getMicroseconds() * 1.0 / 1000000; updateLogic( elapsedSeconds ); // Update graphics stuff updateAnimations( elapsedSeconds ); bool windowClosed = m_window->isClosed(); continueRunning &= ! windowClosed; updateStats(); loopTimer.reset(); bool renderFrameSuccess = m_root->renderOneFrame(); continueRunning &= renderFrameSuccess; continueRunning &= ! m_exitRequested; } } void Application::updateLogic( const float elapsedSeconds ) { const float TURN_DEGREES_PER_SECOND = 360; const float MOVEMENT_UNITS_PER_SECOND = 4; m_movingDirection = 0; if ( m_keyboard->isKeyDown( OIS::KC_LEFT ) ) { m_sceneNode->yaw( Ogre::Degree( -TURN_DEGREES_PER_SECOND * elapsedSeconds ) ); Ogre::Quaternion nodeOri = m_sceneNode->getOrientation(); m_cameraController->addOrientation(nodeOri.getYaw().valueDegrees(), nodeOri.getPitch().valueDegrees()); } if ( m_keyboard->isKeyDown( OIS::KC_RIGHT ) ) { m_sceneNode->yaw( Ogre::Degree( -TURN_DEGREES_PER_SECOND * elapsedSeconds ) ); Ogre::Quaternion nodeOri = m_sceneNode->getOrientation(); m_cameraController->addOrientation(nodeOri.getYaw().valueDegrees(), nodeOri.getPitch().valueDegrees()); } if ( m_keyboard->isKeyDown( OIS::KC_UP ) ) { m_sceneNode->translate( Ogre::Vector3::UNIT_Z * MOVEMENT_UNITS_PER_SECOND * elapsedSeconds, Ogre::Node::TS_LOCAL ); m_movingDirection++; Ogre::Vector3 nodePos = m_sceneNode->getPosition(); m_cameraController->setLookAtPosition(nodePos.x, nodePos.y, nodePos.z); } if ( m_keyboard->isKeyDown( OIS::KC_DOWN ) ) { m_sceneNode->translate( Ogre::Vector3::NEGATIVE_UNIT_Z * MOVEMENT_UNITS_PER_SECOND * elapsedSeconds, Ogre::Node::TS_LOCAL ); m_movingDirection--; Ogre::Vector3 nodePos = m_sceneNode->getPosition(); m_cameraController->setLookAtPosition(nodePos.x, nodePos.y, nodePos.z); } } void Application::updateAnimations( const float elapsedSeconds ) { bool moving = ( m_movingDirection != 0 ); if ( moving ) { m_idleAnimation->setWeight( 0 ); m_runAnimation->setWeight( 1 ); } else { m_idleAnimation->setWeight( 1 ); m_runAnimation->setWeight( 0 ); } m_idleAnimation->addTime( elapsedSeconds ); m_runAnimation->addTime( elapsedSeconds * m_movingDirection ); } bool Application::keyPressed( const OIS::KeyEvent& e ) { if ( e.key == OIS::KC_ESCAPE ) { m_exitRequested = true; } return true; } bool Application::mouseMoved( const OIS::MouseEvent& e ) { assert( m_cameraController != NULL ); bool leftMouseButtonPressed = e.state.buttonDown( OIS::MB_Left ); if ( leftMouseButtonPressed ) { m_cameraController->addOrientation( -e.state.X.rel, -e.state.Y.rel ); } m_cameraController->addDistance( -e.state.Z.rel * 0.002 ); return true; } void Application::setupCEGUI() { // CEGUI setup m_renderer = new CEGUI::OgreCEGUIRenderer(m_window, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, m_sceneManager); m_system = new CEGUI::System(m_renderer); CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme"); m_system->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"); m_system->setDefaultFont((CEGUI::utf8*)"BlueHighway-12"); CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr(); CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "Sheet"); float distanceBorder = 0.01; float sizeX = 0.2; float sizeY = 0.05; float posX = distanceBorder; float posY = distanceBorder; debugWindow = win->createWindow("TaharezLook/StaticText", "Widget1"); debugWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(posX, 0), CEGUI::UDim(posY, 0))); debugWindow->setSize(CEGUI::UVector2(CEGUI::UDim(sizeX, 0), CEGUI::UDim(sizeY, 0))); debugWindow->setText("Debug Info!"); sheet->addChildWindow(debugWindow); m_system->setGUISheet(sheet); } void Application::setupOverlay() { m_debugOverlay = Ogre::OverlayManager::getSingleton().getByName("Core/DebugOverlay"); m_debugOverlay->show(); } void Application::updateStats() { static Ogre::String currFps = "Current FPS: "; static Ogre::String avgFps = "Average FPS: "; static Ogre::String bestFps = "Best FPS: "; static Ogre::String worstFps = "Worst FPS: "; static Ogre::String tris = "Triangle Count: "; static Ogre::String batches = "Batch Count: "; // update stats when necessary try { Ogre::OverlayElement* guiAvg = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/AverageFps"); Ogre::OverlayElement* guiCurr = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/CurrFps"); Ogre::OverlayElement* guiBest = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/BestFps"); Ogre::OverlayElement* guiWorst = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/WorstFps"); const Ogre::RenderTarget::FrameStats& stats = m_window->getStatistics(); guiAvg->setCaption(avgFps + Ogre::StringConverter::toString(stats.avgFPS)); guiCurr->setCaption(currFps + Ogre::StringConverter::toString(stats.lastFPS)); guiBest->setCaption(bestFps + Ogre::StringConverter::toString(stats.bestFPS) +" "+Ogre::StringConverter::toString(stats.bestFrameTime)+" ms"); guiWorst->setCaption(worstFps + Ogre::StringConverter::toString(stats.worstFPS) +" "+Ogre::StringConverter::toString(stats.worstFrameTime)+" ms"); Ogre::OverlayElement* guiTris = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); guiTris->setCaption(tris + Ogre::StringConverter::toString(stats.triangleCount)); Ogre::OverlayElement* guiBatches = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/NumBatches"); guiBatches->setCaption(batches + Ogre::StringConverter::toString(stats.batchCount)); ///////////////////////// Ogre::Vector3 camPos = m_camera->getPosition(); Ogre::Quaternion camOri = m_camera->getOrientation(); Ogre::Vector3 freddyPos = m_sceneNode->getPosition(); Ogre::Quaternion freddyOri = m_sceneNode->getOrientation(); Ogre::OverlayElement* guiDbg = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); guiDbg->setTop(0); Ogre::String message = "Camera Position: x: "+Ogre::StringConverter::toString(camPos.x)+", y: "+Ogre::StringConverter::toString(camPos.y)+", z:"+Ogre::StringConverter::toString(camPos.z) + "\n" + "Camera orientation: yaw: "+Ogre::StringConverter::toString(camOri.getYaw())+", pitch: "+Ogre::StringConverter::toString(camOri.getPitch())+", roll:"+Ogre::StringConverter::toString(camOri.getRoll()) + "\n" + "Freddy position: x: "+Ogre::StringConverter::toString(freddyPos.x)+", y: "+Ogre::StringConverter::toString(freddyPos.y)+", z:"+Ogre::StringConverter::toString(freddyPos.z) + "\n" + "Freddy orientation: yaw: "+Ogre::StringConverter::toString(freddyOri.getYaw())+", pitch: "+Ogre::StringConverter::toString(freddyOri.getPitch())+", roll:"+Ogre::StringConverter::toString(freddyOri.getRoll()); guiDbg->setCaption(message); debugWindow->setText("This is a demo!"); } catch(...) { /* ignore */ } }
[ "ithiliel@6899d1ce-2719-11df-8847-f3d5e5ef3dde" ]
[ [ [ 1, 330 ] ] ]
139029adbd949447e0172f60d431cf550cac1897
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/boost/functional/hash/pair.hpp
e84c2322af89e11fa60a7db16d62e67c52da4769
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
664
hpp
// Copyright Daniel James 2005-2006. 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) // Based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf // issue 6.18. #if !defined(BOOST_FUNCTIONAL_HASH_PAIR_HPP) #define BOOST_FUNCTIONAL_HASH_PAIR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #warning "boost/functional/hash/pair.hpp is deprecated, use boost/functional/hash.hpp instead." #include <boost/functional/hash.hpp> #endif
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 20 ] ] ]
14cef8ae6dcfb8c4a34315bab12f3b704c9198ec
f2cbdee1dfdcad7b77c597e1af5f40ad83bad4aa
/MyJava/JRex/src/native/jni/dom/org_mozilla_jrex_dom_views_JRexAbstractViewImpl.cpp
4a82393a4b7c601e556a4a796eb024d3fb064809
[]
no_license
jdouglas71/Examples
d03d9effc414965991ca5b46fbcf808a9dd6fe6d
b7829b131581ea3a62cebb2ae35571ec8263fd61
refs/heads/master
2021-01-18T14:23:56.900005
2011-04-07T19:34:04
2011-04-07T19:34:04
1,578,581
1
1
null
null
null
null
UTF-8
C++
false
false
5,654
cpp
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * Contributor(s): * C.N Medappa <[email protected]><> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the NPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the NPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "org_mozilla_jrex_dom_views_JRexAbstractViewImpl.h" #include "JRexDOMGlobals.h" //event types for JRexAbsView enum JRexAbsViewEventTypes{JREX_GET_DOC=0U}; static void* PR_CALLBACK HandleJRexAbsViewEvent(PLEvent* aEvent); static void PR_CALLBACK DestroyJRexAbsViewEvent(PLEvent* aEvent); inline JREX_JNI_UTIL::JRexCommonJRV* JRexAbstractViewImpl_GetDocumentInternal(JNIEnv *env, nsIDOMAbstractView* view){ JREX_JNI_UTIL::JRexCommonJRV *jrv=new JREX_JNI_UTIL::JRexCommonJRV; if(IS_NULL(jrv))return NULL; jobject jval=NULL; nsresult rv=NS_ERROR_FAILURE; if (view){ nsCOMPtr<nsIDOMDocumentView> tmpView; rv = view->GetDocument(getter_AddRefs(tmpView)); JREX_LOGLN("JRexAbstractViewImpl_GetDocumentInternal()--> **** GetDocument rv<"<<rv<<"> ****") if(tmpView) jval=JRexDOMGlobals::CreateDocumentView(env, tmpView.get()); } jrv->jobj=jval; jrv->rv=rv; return jrv; } /* * Class: org_mozilla_jrex_dom_views_JRexAbstractViewImpl * Method: GetDocument * Signature: ()Lorg/w3c/dom/views/DocumentView; */ JNIEXPORT jobject JNICALL Java_org_mozilla_jrex_dom_views_JRexAbstractViewImpl_GetDocument (JNIEnv *env, jobject jview){ if(!JRexDOMGlobals::sIntialized)return NULL; JREX_TRY nsIDOMAbstractView* thisView=(nsIDOMAbstractView*)NS_INT32_TO_PTR(env->GetIntField(jview, JRexDOMGlobals::abstractViewPeerID)); JREX_LOGLN("GetDocument()--> **** thisView <"<<thisView<<"> ****") if(IS_NULL(thisView)){ ThrowJRexException(env, "GetDocument()--> **** thisView DOES NOT EXIST!!! ****",0); return NULL; } JREX_JNI_UTIL::JRexCommonJRV *jrv=NULL; if(IS_EQT){ JREX_LOGLN("GetDocument()--> **** IN EVT Q THREAD ****") jrv=JRexAbstractViewImpl_GetDocumentInternal(env, thisView); }else{ nsresult rv=ExecInEventQDOM(thisView, JREX_GET_DOC, nsnull, PR_TRUE, HandleJRexAbsViewEvent, DestroyJRexAbsViewEvent, (void**)&jrv); JREX_LOGLN("GetDocument()--> **** ExecInEventQDOM rv<"<<rv<<"> ****") } JREX_LOGLN("GetDocument()--> **** jrv<"<<jrv<<"> ****") if(NOT_NULL(jrv)){ nsresult rv=jrv->rv; jobject jobj=jrv->jobj; delete jrv; if(NS_FAILED(rv)){ JREX_LOGLN("GetDocument()--> **** GetDocument NON-DOM ERROR OCCURED !!!****") ThrowJRexException(env, "**** GetDocument Failed ****",rv); return NULL; } return jobj; } JREX_CATCH(env) return NULL; } /* * Class: org_mozilla_jrex_dom_views_JRexAbstractViewImpl * Method: Finalize * Signature: ()V */ JNIEXPORT void JNICALL Java_org_mozilla_jrex_dom_views_JRexAbstractViewImpl_Finalize (JNIEnv *env, jobject jview){ if(!JRexDOMGlobals::sIntialized)return; JREX_TRY nsIDOMAbstractView* thisView=(nsIDOMAbstractView*)NS_INT32_TO_PTR(env->GetIntField(jview, JRexDOMGlobals::abstractViewPeerID)); JREX_LOGLN("JRexAbstractViewImpl Finalize()--> **** thisView <"<<thisView<<"> ****") if(IS_NULL(thisView)){ JREX_LOGLN("JRexAbstractViewImpl Finalize()--> **** thisView DOES NOT EXIST!!! ****"); return; } SAFE_RELEASE(thisView) JREX_CATCH(env) } void* PR_CALLBACK HandleJRexAbsViewEvent(PLEvent* aEvent){ if(!JRexDOMGlobals::sIntialized)return nsnull; JRexBasicEvent* event = NS_REINTERPRET_CAST(JRexBasicEvent*, aEvent); nsresult rv=NS_OK; JREX_LOGLN("HandleJRexAbsViewEvent()--> **** target <"<<event->target<<"> ****") switch(event->eventType){ case JREX_GET_DOC: { JREX_LOGLN("HandleJRexAbsViewEvent JREX_GET_DOC EVENT!!!****") nsCOMPtr<nsIDOMAbstractView> view(do_QueryInterface(NS_REINTERPRET_CAST(nsISupports*, event->target))); return (void*)JRexAbstractViewImpl_GetDocumentInternal(nsnull, view.get()); } default: { JREX_LOGLN("HandleJRexAbsViewEvent()--> **** EVENT TYPE<"<<event->eventType<<"> not handled!!! ****") } } JREX_LOGLN("HandleJRexAbsViewEvent()--> **** returning rv<"<<rv<<"> ****") return (void*)rv; } void PR_CALLBACK DestroyJRexAbsViewEvent(PLEvent* aEvent){ JRexBasicEvent* event = NS_REINTERPRET_CAST( JRexBasicEvent*, aEvent); JREX_LOGLN("DestroyJRexAbsViewEvent()--> **** target <"<<event->target<<"> ****") delete event; }
[ [ [ 1, 142 ] ] ]
c45c51c3bc0ca4e8dcd2efa9af76a0fc27d6f336
677f7dc99f7c3f2c6aed68f41c50fd31f90c1a1f
/SolidSBCSrvSvc/SolidSBCResultClientHandlerSocket.h
a2dec543253a0cce4e0d32bfe9eabe5ab31c4d31
[]
no_license
M0WA/SolidSBC
0d743c71ec7c6f8cfe78bd201d0eb59c2a8fc419
3e9682e90a22650e12338785c368ed69a9cac18b
refs/heads/master
2020-04-19T14:40:36.625222
2011-12-02T01:50:05
2011-12-02T01:50:05
168,250,374
0
0
null
null
null
null
UTF-8
C++
false
false
706
h
#pragma once class CSolidSBCClientResultInfo; class CSolidSBCResultClientHandlerSocket { public: CSolidSBCResultClientHandlerSocket(SOCKET hSocket); ~CSolidSBCResultClientHandlerSocket(void); void Close(void); bool WaitForPacket(void); bool OnRead(CSolidSBCClientResultInfo& clientInfo); int GetPeerName(SOCKADDR_IN* pClient){int nClientLen = sizeof(SOCKADDR_IN);return getpeername(m_hSocket,(SOCKADDR*)pClient,&nClientLen);}; private: static UINT WaitForPacketThread(LPVOID lpParam); bool OnResultRequestPacket(CSolidSBCClientResultInfo& clientInfo, PBYTE pPacket); bool OnTestResultPacket(CSolidSBCClientResultInfo& clientInfo, PBYTE pPacket); SOCKET m_hSocket; };
[ "admin@bd7e3521-35e9-406e-9279-390287f868d3" ]
[ [ [ 1, 23 ] ] ]
ec5e27169288d371a2946fab1fba9ca5c7e2d543
138a353006eb1376668037fcdfbafc05450aa413
/source/ogre/OgreNewt/boost/mpl/bind.hpp
ef323c4fd01bcc554e45cb6edee5e60cd5e765ed
[]
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
15,432
hpp
#if !defined(BOOST_PP_IS_ITERATING) ///// header body #ifndef BOOST_MPL_BIND_HPP_INCLUDED #define BOOST_MPL_BIND_HPP_INCLUDED // Copyright Peter Dimov 2001 // Copyright Aleksey Gurtovoy 2001-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Source: /cvsroot/ogre/ogreaddons/ogrenewt/OgreNewt_Main/inc/boost/mpl/bind.hpp,v $ // $Date: 2006/04/17 23:48:05 $ // $Revision: 1.1 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/bind_fwd.hpp> # include <boost/mpl/placeholders.hpp> # include <boost/mpl/next.hpp> # include <boost/mpl/protect.hpp> # include <boost/mpl/apply_wrap.hpp> # include <boost/mpl/limits/arity.hpp> # include <boost/mpl/aux_/na.hpp> # include <boost/mpl/aux_/arity_spec.hpp> # include <boost/mpl/aux_/type_wrapper.hpp> # include <boost/mpl/aux_/yes_no.hpp> # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) # include <boost/type_traits/is_reference.hpp> # endif #endif #include <boost/mpl/aux_/config/bind.hpp> #include <boost/mpl/aux_/config/static_constant.hpp> #include <boost/mpl/aux_/config/use_preprocessed.hpp> #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) # if defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) # define BOOST_MPL_PREPROCESSED_HEADER basic_bind.hpp # else # define BOOST_MPL_PREPROCESSED_HEADER bind.hpp # endif # include <boost/mpl/aux_/include_preprocessed.hpp> #else # include <boost/mpl/aux_/preprocessor/params.hpp> # include <boost/mpl/aux_/preprocessor/default_params.hpp> # include <boost/mpl/aux_/preprocessor/def_params_tail.hpp> # include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp> # include <boost/mpl/aux_/preprocessor/ext_params.hpp> # include <boost/mpl/aux_/preprocessor/repeat.hpp> # include <boost/mpl/aux_/preprocessor/enum.hpp> # include <boost/mpl/aux_/preprocessor/add.hpp> # include <boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp> # include <boost/mpl/aux_/config/ctps.hpp> # include <boost/mpl/aux_/config/ttp.hpp> # include <boost/mpl/aux_/config/dtp.hpp> # include <boost/mpl/aux_/nttp_decl.hpp> # include <boost/preprocessor/iterate.hpp> # include <boost/preprocessor/comma_if.hpp> # include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/inc.hpp> namespace boost { namespace mpl { // local macros, #undef-ined at the end of the header # define AUX778076_APPLY \ BOOST_PP_CAT(apply_wrap,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) \ /**/ # if defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) # define AUX778076_DMC_PARAM() , int dummy_ # else # define AUX778076_DMC_PARAM() # endif # define AUX778076_BIND_PARAMS(param) \ BOOST_MPL_PP_PARAMS( \ BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ , param \ ) \ /**/ # define AUX778076_BIND_DEFAULT_PARAMS(param, value) \ BOOST_MPL_PP_DEFAULT_PARAMS( \ BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ , param \ , value \ ) \ /**/ # define AUX778076_BIND_N_PARAMS(n, param) \ BOOST_PP_COMMA_IF(n) BOOST_MPL_PP_PARAMS(n, param) \ /**/ # define AUX778076_BIND_N_SPEC_PARAMS(n, param, def) \ BOOST_PP_COMMA_IF(n) \ BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \ /**/ #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) # define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ AUX778076_BIND_DEFAULT_PARAMS(param, value) \ /**/ #else # define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ AUX778076_BIND_PARAMS(param) \ /**/ #endif namespace aux { #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template< typename T, AUX778076_BIND_PARAMS(typename U) > struct resolve_bind_arg { typedef T type; }; # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) template< typename T , typename Arg > struct replace_unnamed_arg { typedef Arg next; typedef T type; }; template< typename Arg > struct replace_unnamed_arg< arg<-1>,Arg > { typedef typename Arg::next next; typedef Arg type; }; # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT template< BOOST_MPL_AUX_NTTP_DECL(int, N), AUX778076_BIND_PARAMS(typename U) > struct resolve_bind_arg< arg<N>,AUX778076_BIND_PARAMS(U) > { typedef typename AUX778076_APPLY<mpl::arg<N>, AUX778076_BIND_PARAMS(U)>::type type; }; #if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) template< typename F, AUX778076_BIND_PARAMS(typename T), AUX778076_BIND_PARAMS(typename U) > struct resolve_bind_arg< bind<F,AUX778076_BIND_PARAMS(T)>,AUX778076_BIND_PARAMS(U) > { typedef bind<F,AUX778076_BIND_PARAMS(T)> f_; typedef typename AUX778076_APPLY<f_, AUX778076_BIND_PARAMS(U)>::type type; }; #endif #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // agurt, 15/jan/02: it's not a intended to be used as a function class, and // MSVC6.5 has problems with 'apply' name here (the code compiles, but doesn't // work), so I went with the 'result_' here, and in all other similar cases template< bool > struct resolve_arg_impl { template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ { typedef T type; }; }; template<> struct resolve_arg_impl<true> { template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ { typedef typename AUX778076_APPLY< T , AUX778076_BIND_PARAMS(U) >::type type; }; }; // for 'resolve_bind_arg' template< typename T > struct is_bind_template; template< typename T, AUX778076_BIND_PARAMS(typename U) > struct resolve_bind_arg : resolve_arg_impl< is_bind_template<T>::value > ::template result_< T,AUX778076_BIND_PARAMS(U) > { }; # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) template< typename T > struct replace_unnamed_arg_impl { template< typename Arg > struct result_ { typedef Arg next; typedef T type; }; }; template<> struct replace_unnamed_arg_impl< arg<-1> > { template< typename Arg > struct result_ { typedef typename next<Arg>::type next; typedef Arg type; }; }; template< typename T, typename Arg > struct replace_unnamed_arg : replace_unnamed_arg_impl<T>::template result_<Arg> { }; # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT // agurt, 10/mar/02: the forward declaration has to appear before any of // 'is_bind_helper' overloads, otherwise MSVC6.5 issues an ICE on it template< BOOST_MPL_AUX_NTTP_DECL(int, arity_) > struct bind_chooser; aux::no_tag is_bind_helper(...); template< typename T > aux::no_tag is_bind_helper(protect<T>*); // overload for "main" form // agurt, 15/mar/02: MSVC 6.5 fails to properly resolve the overload // in case if we use 'aux::type_wrapper< bind<...> >' here, and all // 'bind' instantiations form a complete type anyway #if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) template< typename F, AUX778076_BIND_PARAMS(typename T) > aux::yes_tag is_bind_helper(bind<F,AUX778076_BIND_PARAMS(T)>*); #endif template< BOOST_MPL_AUX_NTTP_DECL(int, N) > aux::yes_tag is_bind_helper(arg<N>*); template< bool is_ref_ = true > struct is_bind_template_impl { template< typename T > struct result_ { BOOST_STATIC_CONSTANT(bool, value = false); }; }; template<> struct is_bind_template_impl<false> { template< typename T > struct result_ { BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast<T*>(0))) == sizeof(aux::yes_tag) ); }; }; template< typename T > struct is_bind_template : is_bind_template_impl< ::boost::detail::is_reference_impl<T>::value > ::template result_<T> { }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace aux #define BOOST_PP_ITERATION_PARAMS_1 \ (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/bind.hpp>)) #include BOOST_PP_ITERATE() #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) /// if_/eval_if specializations # define AUX778076_SPEC_NAME if_ # define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, <boost/mpl/bind.hpp>)) # include BOOST_PP_ITERATE() #if !defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) # define AUX778076_SPEC_NAME eval_if # define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, <boost/mpl/bind.hpp>)) # include BOOST_PP_ITERATE() #endif #endif // real C++ version is already taken care of #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) namespace aux { // apply_count_args #define AUX778076_COUNT_ARGS_PREFIX bind #define AUX778076_COUNT_ARGS_DEFAULT na #define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY #include <boost/mpl/aux_/count_args.hpp> } // bind template< typename F, AUX778076_BIND_PARAMS(typename T) AUX778076_DMC_PARAM() > struct bind : aux::bind_chooser< aux::bind_count_args<AUX778076_BIND_PARAMS(T)>::value >::template result_< F,AUX778076_BIND_PARAMS(T) >::type { }; BOOST_MPL_AUX_ARITY_SPEC( BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) , bind ) BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC( BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) , bind ) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # undef AUX778076_BIND_NESTED_DEFAULT_PARAMS # undef AUX778076_BIND_N_SPEC_PARAMS # undef AUX778076_BIND_N_PARAMS # undef AUX778076_BIND_DEFAULT_PARAMS # undef AUX778076_BIND_PARAMS # undef AUX778076_DMC_PARAM # undef AUX778076_APPLY }} #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif // BOOST_MPL_BIND_HPP_INCLUDED ///// iteration, depth == 1 #elif BOOST_PP_ITERATION_DEPTH() == 1 # define i_ BOOST_PP_FRAME_ITERATION(1) #if defined(AUX778076_SPEC_NAME) // lazy metafunction specialization template< template< BOOST_MPL_PP_PARAMS(i_, typename T) > class F, typename Tag > struct BOOST_PP_CAT(quote,i_); template< BOOST_MPL_PP_PARAMS(i_, typename T) > struct AUX778076_SPEC_NAME; template< typename Tag AUX778076_BIND_N_PARAMS(i_, typename T) > struct BOOST_PP_CAT(bind,i_)< BOOST_PP_CAT(quote,i_)<AUX778076_SPEC_NAME,Tag> AUX778076_BIND_N_PARAMS(i_,T) > { template< AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) > struct apply { private: typedef mpl::arg<1> n1; # define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, <boost/mpl/bind.hpp>)) # include BOOST_PP_ITERATE() typedef typename AUX778076_SPEC_NAME< typename t1::type , BOOST_MPL_PP_EXT_PARAMS(2, BOOST_PP_INC(i_), t) >::type f_; public: typedef typename f_::type type; }; }; #undef AUX778076_SPEC_NAME #else // AUX778076_SPEC_NAME template< typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() > struct BOOST_PP_CAT(bind,i_) { template< AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) > struct apply { private: # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) typedef aux::replace_unnamed_arg< F,mpl::arg<1> > r0; typedef typename r0::type a0; typedef typename r0::next n1; typedef typename aux::resolve_bind_arg<a0,AUX778076_BIND_PARAMS(U)>::type f_; /// # else typedef typename aux::resolve_bind_arg<F,AUX778076_BIND_PARAMS(U)>::type f_; # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT # if i_ > 0 # define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, <boost/mpl/bind.hpp>)) # include BOOST_PP_ITERATE() # endif public: # define AUX778076_ARG(unused, i_, t) \ BOOST_PP_COMMA_IF(i_) \ typename BOOST_PP_CAT(t,BOOST_PP_INC(i_))::type \ /**/ typedef typename BOOST_PP_CAT(apply_wrap,i_)< f_ BOOST_PP_COMMA_IF(i_) BOOST_MPL_PP_REPEAT(i_, AUX778076_ARG, t) >::type type; # undef AUX778076_ARG }; }; namespace aux { #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template< typename F AUX778076_BIND_N_PARAMS(i_, typename T), AUX778076_BIND_PARAMS(typename U) > struct resolve_bind_arg< BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)>,AUX778076_BIND_PARAMS(U) > { typedef BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)> f_; typedef typename AUX778076_APPLY<f_, AUX778076_BIND_PARAMS(U)>::type type; }; #else template< typename F AUX778076_BIND_N_PARAMS(i_, typename T) > aux::yes_tag is_bind_helper(BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)>*); #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace aux BOOST_MPL_AUX_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) # if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY /// primary template (not a specialization!) template< typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() > struct bind : BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T) > { }; #else template< typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() > struct bind< F AUX778076_BIND_N_SPEC_PARAMS(i_, T, na) > : BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T) > { }; #endif # else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace aux { template<> struct bind_chooser<i_> { template< typename F, AUX778076_BIND_PARAMS(typename T) > struct result_ { typedef BOOST_PP_CAT(bind,i_)< F AUX778076_BIND_N_PARAMS(i_,T) > type; }; }; } // namespace aux # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # endif // BOOST_MPL_CFG_NO_BIND_TEMPLATE #endif // AUX778076_SPEC_NAME # undef i_ ///// iteration, depth == 2 #elif BOOST_PP_ITERATION_DEPTH() == 2 # define j_ BOOST_PP_FRAME_ITERATION(2) # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) typedef aux::replace_unnamed_arg< BOOST_PP_CAT(T,j_),BOOST_PP_CAT(n,j_) > BOOST_PP_CAT(r,j_); typedef typename BOOST_PP_CAT(r,j_)::type BOOST_PP_CAT(a,j_); typedef typename BOOST_PP_CAT(r,j_)::next BOOST_PP_CAT(n,BOOST_PP_INC(j_)); typedef aux::resolve_bind_arg<BOOST_PP_CAT(a,j_), AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_); /// # else typedef aux::resolve_bind_arg< BOOST_PP_CAT(T,j_),AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_); # endif # undef j_ #endif // BOOST_PP_IS_ITERATING
[ "Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e" ]
[ [ [ 1, 547 ] ] ]
d2740613fc2495a21bc439102ae229aa73ad0534
a30b091525dc3f07cd7e12c80b8d168a0ee4f808
/EngineAll/Textures/D3D9Texture.h
a1f993b680bc427c8537213537f073c1419982ae
[]
no_license
ghsoftco/basecode14
f50dc049b8f2f8d284fece4ee72f9d2f3f59a700
57de2a24c01cec6dc3312cbfe200f2b15d923419
refs/heads/master
2021-01-10T11:18:29.585561
2011-01-23T02:25:21
2011-01-23T02:25:21
47,255,927
0
0
null
null
null
null
UTF-8
C++
false
false
2,181
h
/* D3DTexture.h Written by Matthew Fisher DirectX implementation of BaseTexture. See BaseTexture.h for a definiton of the base functions. */ #pragma once #ifdef USE_D3D9 class D3D9Texture : public BaseTexture { public: D3D9Texture(); D3D9Texture(LPDIRECT3DDEVICE9 Device); ~D3D9Texture(); // // Memory // void FreeMemory(); void ReleaseMemory(); void Reset(LPDIRECT3DDEVICE9 Device); void Associate(GraphicsDevice &GD); //associates this texture with the provided graphics device. //must occur before loading. void Allocate(D3DFORMAT Format, UINT Width, UINT Height, bool RenderTarget); // // Load texture data from memory // void Load(const Bitmap &Bmp); void Load(const Grid<float> &Data); void Load(const Grid<Vec2f> &Data); void Load(const Grid<Vec3f> &Data); void Load(const Grid<Vec4f> &Data); void Load(D3D9Texture &Tex); void UpdateMipMapLevels(); void Clear(); // // Dump texture data to memory // void ReadData(Bitmap &Bmp); void ReadData(Grid<float> &Data); void ReadData(Grid<Vec2f> &Data); void ReadData(Grid<Vec3f> &Data); void ReadData(Grid<Vec4f> &Data); void Flush(); void Set(int Index); void SetAsRenderTarget(int Index); void SetNull(int Index); // // Accessors // __forceinline LPDIRECT3DTEXTURE9 GetTexture() { return _Texture; } __forceinline LPDIRECT3DSURFACE9 SurfaceTopLevel() { return _SurfaceTopLevel; } __forceinline UINT Width() { return _Width; } __forceinline UINT Height() { return _Height; } private: // // These are not permitted // D3D9Texture(const D3D9Texture &Tex); D3D9Texture& operator = (const D3D9Texture &Tex); bool _RenderTarget; UINT _Width, _Height; D3DFORMAT _Format; LPDIRECT3DTEXTURE9 _Texture; LPDIRECT3DSURFACE9 _SurfacePlain; LPDIRECT3DSURFACE9 _SurfaceTopLevel; LPDIRECT3DDEVICE9 _Device; }; #endif
[ "zhaodongmpii@7e7f00ea-7cf8-66b5-cf80-f378872134d2" ]
[ [ [ 1, 89 ] ] ]
ee5f2b83ff30924d22fd9b0ffb6dba80617c00b2
d37a1d5e50105d82427e8bf3642ba6f3e56e06b8
/DVR/HaohanITPlayer/public/Common/SysUtils/UTimecodeUtil.cpp
fb41b73ea223667c4b2e09ebb96d186e575d021e
[]
no_license
080278/dvrmd-filter
176f4406dbb437fb5e67159b6cdce8c0f48fe0ca
b9461f3bf4a07b4c16e337e9c1d5683193498227
refs/heads/master
2016-09-10T21:14:44.669128
2011-10-17T09:18:09
2011-10-17T09:18:09
32,274,136
0
0
null
null
null
null
UTF-8
C++
false
false
6,457
cpp
//----------------------------------------------------------------------------- // UTimecodeUtil.cpp // Copyright (c) 1997 - 2005, Haohanit. All rights reserved. //----------------------------------------------------------------------------- /* File: UTimecodeUtil.cp Contains: Written by: Change History (most recent first): x.x.x spg Initial file creation. */ //SR FS: Reviewed [JAW 20040912] //SR FS: Reviewed [wwt 20040915]: safe input param; MBCS internally; no dangerous API; no registry/sys folder/temp file #include "UTimecodeUtil.h" #include "StringUtilities.h" #include "time_utils.h" #include "sonic_crt.h" typedef enum TimeStates { kNoTime = 0, kFractTime = 1, kFrameTime = 2, kSecondsTime = 3, kMinutesTime = 4, kHoursTime = 5, kInvalidTime = 6 } TimeStates; static char SeparatorChar(bool, bool dropFrameMode) { return (dropFrameMode ? ';' : ':'); } static void BindRange(ptrdiff_t &theValue, SInt32 minVal, SInt32 maxVal) { if (theValue > maxVal) theValue = maxVal; if (theValue < minVal) theValue = minVal; } static void ValidateTimecodeString(std::string& inOutString, bool isNTSC, bool dropFrameMode, bool useFract) { const char sepCharColon = ':'; const char sepCharSemiCln = ';'; const char sepCharFract = '.'; SInt32 timeValues[6] = {0,0,0,0,0,0}; // Array of time values, [unused, frame, seconds, minutes, hours] SInt32 tcLen = static_cast<SInt32>(inOutString.length()); // Length of the current time code string if (tcLen > 0) { // If there is nothing entered, we assume the user wants to leave it blank std::string fieldStr; // String containing current field SInt32 timeState = kHoursTime; // Time state of the current field SInt32 breakPos = 1; // End position of the current field SInt32 fieldStart = 0; // Start position of the current field const ptrdiff_t foundColon = inOutString.find(sepCharColon); const ptrdiff_t foundSemi = inOutString.find(sepCharSemiCln); const ptrdiff_t foundFract = inOutString.find(sepCharFract); const ptrdiff_t n = std::string::npos; bool hasHardBreaks = (foundColon > n) || (foundSemi > n) || (foundFract > n); if (hasHardBreaks) breakPos = 0; // First parse the existing string while (timeState) { if (hasHardBreaks) { // Set the end of the current field to the next colon or semi-colon std::string::size_type tempBreakPos = inOutString.find(sepCharColon, breakPos + 1); if (tempBreakPos == std::string::npos) tempBreakPos = inOutString.find(sepCharSemiCln, breakPos + 1); if (tempBreakPos == std::string::npos) tempBreakPos = inOutString.find(sepCharFract, breakPos + 1); if (tempBreakPos == std::string::npos && kFractTime == timeState) { --timeState; continue; // no field exists for frame fraction } breakPos = static_cast<SInt32>(tempBreakPos); } else // Set the end of the current field to the next 2 digits breakPos += 2; if (breakPos <= 0 || breakPos > tcLen) breakPos = tcLen + 1; // Set the field string to the next field, and convert it to a number fieldStr.assign(inOutString, fieldStart, breakPos - fieldStart); timeValues[timeState] = StringUtils::StringToInt(fieldStr); // Update loop variables timeState = timeState - 1; fieldStart = breakPos; if (hasHardBreaks) fieldStart++; } // Set within limits SInt32 maxFrames = 24; // Pal frames per second if (isNTSC) maxFrames = 29; // NTSC frames per second BindRange(reinterpret_cast<ptrdiff_t &>(timeValues[kHoursTime]), 0, 23); BindRange(reinterpret_cast<ptrdiff_t &>(timeValues[kMinutesTime]), 0, 59); BindRange(reinterpret_cast<ptrdiff_t &>(timeValues[kSecondsTime]), 0, 59); BindRange(reinterpret_cast<ptrdiff_t &>(timeValues[kFrameTime]), 0, maxFrames); BindRange(reinterpret_cast<ptrdiff_t &>(timeValues[kFractTime]), 0, 79); if (dropFrameMode) { // Drop frame algorithm is: // Every minute, drop frames 0 and 1, // Except every tenth minute, when you keep them if ((timeValues[kFrameTime] == 0 || timeValues[kFrameTime] == 1) && (timeValues[kSecondsTime] == 0) && (timeValues[kMinutesTime] % 10 != 0)) { timeValues[kFrameTime] = 2; } } // And reconsitute the string char sep = SeparatorChar(isNTSC,dropFrameMode); char tcCString[30]; if (useFract) sonic::snprintf_safe(tcCString,30, "%02ld%c%02ld%c%02ld%c%02ld.%02ld", timeValues[kHoursTime], sep, timeValues[kMinutesTime], sep, // **CodeWizzard** - Informational: Effective C++ item 2 - Prefer iostream.h to stdio. timeValues[kSecondsTime], sep, timeValues[kFrameTime], timeValues[kFractTime]); else sonic::snprintf_safe(tcCString,30, "%02ld%c%02ld%c%02ld%c%02ld", timeValues[kHoursTime], sep, timeValues[kMinutesTime], sep, // **CodeWizzard** - Informational: Effective C++ item 2 - Prefer iostream.h to stdio. timeValues[kSecondsTime], sep, timeValues[kFrameTime]); inOutString = tcCString; } } // This is obsolete for HD static tc_mode GetTCMode(bool isNTSC, bool dropFrameMode) { tc_mode tcMode; if (isNTSC) tcMode = (dropFrameMode ? TC_SMPTE_29_DF : TC_SMPTE_29_NDF); else tcMode = TC_SMPTE_25; return tcMode; } // ----------------------------------- static double ValidStringToTimecode( const std::string &inString, bool isNTSC, bool dropFrameMode, bool /*useFract*/) { double samplingRate = 0.0; // not used for our purposes tc_mode tcMode = GetTCMode(isNTSC, dropFrameMode); return TCStringToFloat(inString, tcMode, samplingRate); } // ----------------------------------- double UTimecodeUtil::StringToTimecode( const std::string &inString, bool isNTSC, bool dropFrameMode, bool useFract) { std::string validString = inString; ValidateTimecodeString(validString,isNTSC,dropFrameMode,useFract); return ValidStringToTimecode(validString,isNTSC,dropFrameMode,useFract); } // ----------------------------------- void UTimecodeUtil::TimecodeToString( double inTimecode, std::string &outString, bool isNTSC, bool dropFrameMode, bool useFract) { double samplingRate = 0.0; // not used for our purposes tc_mode tcMode = GetTCMode(isNTSC, dropFrameMode); ::FloatToTCString(inTimecode, outString, tcMode, useFract, samplingRate); }
[ "[email protected]@27769579-7047-b306-4d6f-d36f87483bb3" ]
[ [ [ 1, 202 ] ] ]
4f5ac11edf6cf341ad1518732e97c94236cffe4b
80959be98b57106e6bd41c33c5bfb7dd5e9c88cd
/Landscape.h
d5491a31fd19a51060c92ed17a527f711fcf7cc4
[]
no_license
dalorin/FPSDemo
e9ab067cfad73d404cc0ea01190212d5192405b0
cf29b61a9654652a3f8d60d742072e1a8eaa3ca7
refs/heads/master
2020-07-26T17:42:10.801273
2010-12-27T00:16:55
2010-12-27T00:16:55
1,199,462
1
0
null
null
null
null
UTF-8
C++
false
false
212
h
#pragma once #include "objects.h" class Landscape : public Object { public: Landscape(GameEngine* engine); void onRender(); ~Landscape(void); private: GLuint m_buffer; GLuint m_color; };
[ [ [ 1, 16 ] ] ]
afbeabc14b06fde399f0f01b914cd000b792caf6
bda7b365b5952dc48827a8e8d33d11abd458c5eb
/LogFile.h
c257f07ace0e51c54f974d2319cf4d892fb2c9da
[]
no_license
MrColdbird/gameservice
3bc4dc3906d16713050612c1890aa8820d90272e
009d28334bdd8f808914086e8367b1eb9497c56a
refs/heads/master
2021-01-25T09:59:24.143855
2011-01-31T07:12:24
2011-01-31T07:12:24
35,889,912
3
3
null
null
null
null
UTF-8
C++
false
false
736
h
#ifndef __GAMESERVICE_LOGFILE_H__ #define __GAMESERVICE_LOGFILE_H__ namespace GameService { enum { GS_EFileIndex_Log = 0, GS_EFileIndex_TmpImg, GS_EFileIndex_MAX }; class LogFile { public: LogFile(GS_BOOL isDumpLog); virtual ~LogFile(); GS_BOOL DumpLog(const GS_CHAR* log); GS_BOOL WriteLocalFile(GS_INT fileIndex, GS_BYTE* data, GS_DWORD size); static const GS_CHAR* GetFileName(GS_INT fileIndex); private: static GS_CHAR G_FileName[GS_EFileIndex_MAX][64]; #if defined(_XBOX) || defined(_XENON) HANDLE m_hFile[GS_EFileIndex_MAX]; #elif defined(_PS3) int m_iFile[GS_EFileIndex_MAX]; #endif }; } // namespace #endif //__GAMESERVICE_LOGFILE_H__
[ "leavesmaple@383b229b-c81f-2bc2-fa3f-61d2d0c0fe69" ]
[ [ [ 1, 38 ] ] ]
0c10fd4fa5a3f99998f0829e49e628c56ad0fafe
b7c505dcef43c0675fd89d428e45f3c2850b124f
/Src/SimulatorQt/Util/qt/Win32/include/QtCore/qmetatype.h
8b5f987041d3313d7596785b088d68fefcd41354
[ "BSD-2-Clause" ]
permissive
pranet/bhuman2009fork
14e473bd6e5d30af9f1745311d689723bfc5cfdb
82c1bd4485ae24043aa720a3aa7cb3e605b1a329
refs/heads/master
2021-01-15T17:55:37.058289
2010-02-28T13:52:56
2010-02-28T13:52:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,594
h
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information ([email protected]) ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at [email protected]. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QMETATYPE_H #define QMETATYPE_H #include <QtCore/qglobal.h> #include <QtCore/qatomic.h> #ifndef QT_NO_DATASTREAM #include <QtCore/qdatastream.h> #endif #ifdef Bool #error qmetatype.h must be included before any header file that defines Bool #endif QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Core) class Q_CORE_EXPORT QMetaType { public: enum Type { // these are merged with QVariant Void = 0, Bool = 1, Int = 2, UInt = 3, LongLong = 4, ULongLong = 5, Double = 6, QChar = 7, QVariantMap = 8, QVariantList = 9, QString = 10, QStringList = 11, QByteArray = 12, QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17, QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22, QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27, QVariantHash = 28, LastCoreType = 28 /* QVariantHash */, FirstGuiType = 63 /* QColorGroup */, #ifdef QT3_SUPPORT QColorGroup = 63, #endif QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68, QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73, QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77, QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81, LastGuiType = 81 /* QTransform */, FirstCoreExtType = 128 /* VoidStar */, VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, LastCoreExtType = 137 /* QWidgetStar */, User = 256 }; typedef void (*Destructor)(void *); typedef void *(*Constructor)(const void *); #ifndef QT_NO_DATASTREAM typedef void (*SaveOperator)(QDataStream &, const void *); typedef void (*LoadOperator)(QDataStream &, void *); static void registerStreamOperators(const char *typeName, SaveOperator saveOp, LoadOperator loadOp); #endif static int registerType(const char *typeName, Destructor destructor, Constructor constructor); static int type(const char *typeName); static const char *typeName(int type); static bool isRegistered(int type); static void *construct(int type, const void *copy = 0); static void destroy(int type, void *data); static void unregisterType(const char *typeName); #ifndef QT_NO_DATASTREAM static bool save(QDataStream &stream, int type, const void *data); static bool load(QDataStream &stream, int type, void *data); #endif }; template <typename T> void qMetaTypeDeleteHelper(T *t) { delete t; } template <typename T> void *qMetaTypeConstructHelper(const T *t) { if (!t) return new T; return new T(*static_cast<const T*>(t)); } #ifndef QT_NO_DATASTREAM template <typename T> void qMetaTypeSaveHelper(QDataStream &stream, const T *t) { stream << *t; } template <typename T> void qMetaTypeLoadHelper(QDataStream &stream, T *t) { stream >> *t; } #endif // QT_NO_DATASTREAM template <typename T> int qRegisterMetaType(const char *typeName #ifndef qdoc , T * /* dummy */ = 0 #endif ) { typedef void*(*ConstructPtr)(const T*); ConstructPtr cptr = qMetaTypeConstructHelper<T>; typedef void(*DeletePtr)(T*); DeletePtr dptr = qMetaTypeDeleteHelper<T>; return QMetaType::registerType(typeName, reinterpret_cast<QMetaType::Destructor>(dptr), reinterpret_cast<QMetaType::Constructor>(cptr)); } #ifndef QT_NO_DATASTREAM template <typename T> void qRegisterMetaTypeStreamOperators(const char *typeName #ifndef qdoc , T * /* dummy */ = 0 #endif ) { typedef void(*SavePtr)(QDataStream &, const T *); typedef void(*LoadPtr)(QDataStream &, T *); SavePtr sptr = qMetaTypeSaveHelper<T>; LoadPtr lptr = qMetaTypeLoadHelper<T>; qRegisterMetaType<T>(typeName); QMetaType::registerStreamOperators(typeName, reinterpret_cast<QMetaType::SaveOperator>(sptr), reinterpret_cast<QMetaType::LoadOperator>(lptr)); } #endif template <typename T> struct QMetaTypeId { enum { Defined = 0 }; }; template <typename T> struct QMetaTypeId2 { enum { Defined = QMetaTypeId<T>::Defined }; static inline int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); } }; template <typename T> inline int qMetaTypeId( #ifndef qdoc T * /* dummy */ = 0 #endif ) { return QMetaTypeId2<T>::qt_metatype_id(); } template <typename T> inline int qRegisterMetaType( #if !defined(qdoc) && !defined(Q_CC_SUN) T * dummy = 0 #endif ) { #ifdef Q_CC_SUN return qMetaTypeId(static_cast<T *>(0)); #else return qMetaTypeId(dummy); #endif } #define Q_DECLARE_METATYPE(TYPE) \ QT_BEGIN_NAMESPACE \ template <> \ struct QMetaTypeId< TYPE > \ { \ enum { Defined = 1 }; \ static int qt_metatype_id() \ { \ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ if (!metatype_id) \ metatype_id = qRegisterMetaType< TYPE >(#TYPE); \ return metatype_id; \ } \ }; \ QT_END_NAMESPACE #define Q_DECLARE_BUILTIN_METATYPE(TYPE, NAME) \ QT_BEGIN_NAMESPACE \ template<> struct QMetaTypeId2<TYPE> \ { \ enum { Defined = 1, MetaType = QMetaType::NAME }; \ static inline int qt_metatype_id() { return QMetaType::NAME; } \ }; \ QT_END_NAMESPACE class QString; class QByteArray; class QChar; class QStringList; class QBitArray; class QDate; class QTime; class QDateTime; class QUrl; class QLocale; class QRect; class QRectF; class QSize; class QSizeF; class QLine; class QLineF; class QPoint; class QPointF; #ifndef QT_NO_REGEXP class QRegExp; #endif class QWidget; class QObject; #ifdef QT3_SUPPORT class QColorGroup; #endif class QFont; class QPixmap; class QBrush; class QColor; class QPalette; class QIcon; class QImage; class QPolygon; class QRegion; class QBitmap; class QCursor; class QSizePolicy; class QKeySequence; class QPen; class QTextLength; class QTextFormat; class QMatrix; class QTransform; QT_END_NAMESPACE Q_DECLARE_BUILTIN_METATYPE(QString, QString) Q_DECLARE_BUILTIN_METATYPE(int, Int) Q_DECLARE_BUILTIN_METATYPE(uint, UInt) Q_DECLARE_BUILTIN_METATYPE(bool, Bool) Q_DECLARE_BUILTIN_METATYPE(double, Double) Q_DECLARE_BUILTIN_METATYPE(QByteArray, QByteArray) Q_DECLARE_BUILTIN_METATYPE(QChar, QChar) Q_DECLARE_BUILTIN_METATYPE(long, Long) Q_DECLARE_BUILTIN_METATYPE(short, Short) Q_DECLARE_BUILTIN_METATYPE(char, Char) Q_DECLARE_BUILTIN_METATYPE(ulong, ULong) Q_DECLARE_BUILTIN_METATYPE(ushort, UShort) Q_DECLARE_BUILTIN_METATYPE(uchar, UChar) Q_DECLARE_BUILTIN_METATYPE(float, Float) Q_DECLARE_BUILTIN_METATYPE(QObject *, QObjectStar) Q_DECLARE_BUILTIN_METATYPE(QWidget *, QWidgetStar) Q_DECLARE_BUILTIN_METATYPE(void *, VoidStar) Q_DECLARE_BUILTIN_METATYPE(qlonglong, LongLong) Q_DECLARE_BUILTIN_METATYPE(qulonglong, ULongLong) Q_DECLARE_BUILTIN_METATYPE(QStringList, QStringList) Q_DECLARE_BUILTIN_METATYPE(QBitArray, QBitArray) Q_DECLARE_BUILTIN_METATYPE(QDate, QDate) Q_DECLARE_BUILTIN_METATYPE(QTime, QTime) Q_DECLARE_BUILTIN_METATYPE(QDateTime, QDateTime) Q_DECLARE_BUILTIN_METATYPE(QUrl, QUrl) Q_DECLARE_BUILTIN_METATYPE(QLocale, QLocale) Q_DECLARE_BUILTIN_METATYPE(QRect, QRect) Q_DECLARE_BUILTIN_METATYPE(QRectF, QRectF) Q_DECLARE_BUILTIN_METATYPE(QSize, QSize) Q_DECLARE_BUILTIN_METATYPE(QSizeF, QSizeF) Q_DECLARE_BUILTIN_METATYPE(QLine, QLine) Q_DECLARE_BUILTIN_METATYPE(QLineF, QLineF) Q_DECLARE_BUILTIN_METATYPE(QPoint, QPoint) Q_DECLARE_BUILTIN_METATYPE(QPointF, QPointF) #ifndef QT_NO_REGEXP Q_DECLARE_BUILTIN_METATYPE(QRegExp, QRegExp) #endif #ifdef QT3_SUPPORT Q_DECLARE_BUILTIN_METATYPE(QColorGroup, QColorGroup) #endif Q_DECLARE_BUILTIN_METATYPE(QFont, QFont) Q_DECLARE_BUILTIN_METATYPE(QPixmap, QPixmap) Q_DECLARE_BUILTIN_METATYPE(QBrush, QBrush) Q_DECLARE_BUILTIN_METATYPE(QColor, QColor) Q_DECLARE_BUILTIN_METATYPE(QPalette, QPalette) Q_DECLARE_BUILTIN_METATYPE(QIcon, QIcon) Q_DECLARE_BUILTIN_METATYPE(QImage, QImage) Q_DECLARE_BUILTIN_METATYPE(QPolygon, QPolygon) Q_DECLARE_BUILTIN_METATYPE(QRegion, QRegion) Q_DECLARE_BUILTIN_METATYPE(QBitmap, QBitmap) Q_DECLARE_BUILTIN_METATYPE(QCursor, QCursor) Q_DECLARE_BUILTIN_METATYPE(QSizePolicy, QSizePolicy) Q_DECLARE_BUILTIN_METATYPE(QKeySequence, QKeySequence) Q_DECLARE_BUILTIN_METATYPE(QPen, QPen) Q_DECLARE_BUILTIN_METATYPE(QTextLength, QTextLength) Q_DECLARE_BUILTIN_METATYPE(QTextFormat, QTextFormat) Q_DECLARE_BUILTIN_METATYPE(QMatrix, QMatrix) Q_DECLARE_BUILTIN_METATYPE(QTransform, QTransform) QT_END_HEADER #endif // QMETATYPE_H
[ "alon@rogue.(none)" ]
[ [ [ 1, 351 ] ] ]
39705960aed7fe881a5d96b4c631b043de2f68e7
1bbd5854d4a2efff9ee040e3febe3f846ed3ecef
/src/scrview/mousepacket.cpp
632cebeba98c8bca807fe22f29dcf89653945a2e
[]
no_license
amanuelg3/screenviewer
2b896452a05cb135eb7b9eb919424fe6c1ce8dd7
7fc4bb61060e785aa65922551f0e3ff8423eccb6
refs/heads/master
2021-01-01T18:54:06.167154
2011-12-21T02:19:10
2011-12-21T02:19:10
37,343,569
0
0
null
null
null
null
UTF-8
C++
false
false
993
cpp
#include "mousepacket.h" MousePacket::MousePacket() { md = NULL; type = 1; } void MousePacket::makePacket() { if (md == NULL) { currentPacket = NULL; return; } currentPacket = new QByteArray(); QDataStream out(currentPacket, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_2); blockSize = sizeof(md->isRightKey) + sizeof(md->isLeftKey) + sizeof(md->x) + sizeof(md->y) + sizeof(quint16); out << (quint16) blockSize; out << (quint16) type; out << md->x; out << md->y; out << md->isLeftKey; out << md->isRightKey; } void MousePacket::setNewContent(MouseData *md) { delete this->md; this->md = md; } MouseData* MousePacket::analyzePacket(QDataStream& in) { MouseData* tmp = new MouseData(); in >> tmp->x; in >> tmp->y; in >> tmp->isLeftKey; in >> tmp->isRightKey; return tmp; } MouseData* MousePacket::getContent() { return md; }
[ "JuliusR@localhost" ]
[ [ [ 1, 46 ] ] ]
140548abad80b7f49137595e63f32c427cae741e
2a3952c00a7835e6cb61b9cb371ce4fb6e78dc83
/BasicOgreFramework/PhysxSDK/Samples/SampleCommonCode/src/DebugRenderer.h
9d23d18c5d9e51f038b076db6792a4feedfcd090
[]
no_license
mgq812/simengines-g2-code
5908d397ef2186e1988b1d14fa8b73f4674f96ea
699cb29145742c1768857945dc59ef283810d511
refs/heads/master
2016-09-01T22:57:54.845817
2010-01-11T19:26:51
2010-01-11T19:26:51
32,267,377
0
0
null
null
null
null
UTF-8
C++
false
false
793
h
/*----------------------------------------------------------------------------*\ | | AGEIA PhysX Technology | | www.ageia.com | \*----------------------------------------------------------------------------*/ #ifndef DEBUGRENDER_H #define DEBUGRENDER_H class NxDebugRenderable; class DebugRenderer { public: void renderData(const NxDebugRenderable& data) const; private: static void renderBuffer(float* pVertList, float* pColorList, int type, int num); }; #endif //AGCOPYRIGHTBEGIN /////////////////////////////////////////////////////////////////////////// // Copyright (c) 2005-2006 AGEIA Technologies. // All rights reserved. www.ageia.com /////////////////////////////////////////////////////////////////////////// //AGCOPYRIGHTEND
[ "erucarno@789472dc-e1c3-11de-81d3-db62269da9c1" ]
[ [ [ 1, 29 ] ] ]
f802ba1ede6064cd321ccec772f42d076a66e7e6
6c8c4728e608a4badd88de181910a294be56953a
/RexLogicModule/EventHandlers/SceneEventHandler.h
ec601c87a4b1daf1d0fff908b73c5fad0f154daf
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
caocao/naali
29c544e121703221fe9c90b5c20b3480442875ef
67c5aa85fa357f7aae9869215f840af4b0e58897
refs/heads/master
2021-01-21T00:25:27.447991
2010-03-22T15:04:19
2010-03-22T15:04:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
857
h
// For conditions of distribution and use, see copyright notice in license.txt #ifndef incl_SceneEventHandler_h #define incl_SceneEventHandler_h #include "ComponentInterface.h" #include "CoreTypes.h" namespace Foundation { class EventDataInterface; } namespace RexLogic { class RexLogicModule; class SceneEventHandler { public: SceneEventHandler(Foundation::Framework *framework, RexLogicModule *rexlogicmodule); virtual ~SceneEventHandler(); bool HandleSceneEvent(event_id_t event_id, Foundation::EventDataInterface* data); private: Foundation::Framework *framework_; RexLogicModule *rexlogicmodule_; //! handle entity deleted event void HandleEntityDeletedEvent(event_id_t entityid); }; } #endif
[ "jaakkoallander@5b2332b8-efa3-11de-8684-7d64432d61a3", "jujjyl@5b2332b8-efa3-11de-8684-7d64432d61a3", "cadaver@5b2332b8-efa3-11de-8684-7d64432d61a3", "tuco@5b2332b8-efa3-11de-8684-7d64432d61a3" ]
[ [ [ 1, 6 ], [ 13, 23 ], [ 25, 29 ], [ 33, 36 ] ], [ [ 7, 12 ] ], [ [ 24, 24 ], [ 32, 32 ] ], [ [ 30, 31 ] ] ]
aa66104b9c4352d8f880db578a788b965f65e583
335783c9e5837a1b626073d1288b492f9f6b057f
/source/fbxcmd/daocmd/Commands/DumpMesh.cpp
38dc99c0eb7d8bdd871641dbbcee7a3aff752fac
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
code-google-com/fbx4eclipse
110766ee9760029d5017536847e9f3dc09e6ebd2
cc494db4261d7d636f8c4d0313db3953b781e295
refs/heads/master
2016-09-08T01:55:57.195874
2009-12-03T20:35:48
2009-12-03T20:35:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,179
cpp
#include "stdafx.h" #include "program.h" #include <sys/stat.h> #include <io.h> #include <shellapi.h> using namespace std; #include "GFFFormat.h" #include "MSHFormat.h" using namespace DAO; using namespace DAO::GFF; using namespace DAO::MESH; #ifndef ASSERT #ifdef _DEBUG #include <crtdbg.h> #define ASSERT _ASSERTE #else #define ASSERT(exp) #endif #endif ////////////////////////////////////////////////////////////////////////// template <typename T, typename U> void AssignValue(T& dst, const U& src) { ASSERT( !"Assignment not specified."); } template<> void AssignValue(float& dst, const float& src) { dst = src; } template<> void AssignValue(Vector2f& dst, const Vector2f& src) { dst.Set(src[0], src[1]); } template<> void AssignValue(Vector2f& dst, const Float16_2& src) { dst.Set(src[0], src[1]); } template<> void AssignValue(Vector4f& dst, const Vector2f& src) { dst.Set(src[0], src[1], 0.0); } template<> void AssignValue(Vector4f& dst, const Vector3f& src) { dst.Set(src[0], src[1], src[2]); } template<> void AssignValue(Vector4f& dst, const Vector4f& src) { dst.Set(src[0], src[1], src[2]); } template<> void AssignValue(Vector4f& dst, const Float16_4& src) { dst.Set(src[0], src[1], src[2], src[3]); } template<> void AssignValue(Color4& dst, const Vector3f& src) { dst.Set(src[0], src[1], src[2]); } template<> void AssignValue(Color4& dst, const Vector4f& src) { dst.Set(src[0], src[1], src[2], src[3]); } template<> void AssignValue(Color4& dst, const ARGB4& src) { dst.Set(src[0], src[1], src[2], src[3]); } template<> void AssignValue(Color4& dst, const Float16_4& src) { dst.Set(src[0], src[1], src[2], src[3]); } template<> void AssignValue(Vector4f& dst, const Signed_10_10_10& src) { dst.Set(src[0], src[1], src[2]); } template<> void AssignValue(Vector4f& dst, const Unsigned_10_10_10& src){ dst.Set(src[0], src[1], src[2]); } template<> void AssignValue(Color4& dst, const Signed_10_10_10& src) { dst.Set(src[0], src[1], src[2], src[3]); } template<> void AssignValue(Color4& dst, const Unsigned_10_10_10& src) { dst.Set(src[0], src[1], src[2], src[3]); } void Dump(IDAODumpStream& out, LPCTSTR name, const UShort3& val) { char buffer[256]; sprintf(buffer, "[%4hu,%4hu,%4hu]", val[0], val[1], val[2]); Dump(out, name, buffer); } void Dump(IDAODumpStream& out, LPCTSTR name, const UShort4& val) { char buffer[256]; sprintf(buffer, "[%4hu,%4hu,%4hu,%4hu]", val[0], val[1], val[2], val[3]); Dump(out, name, buffer); } template <class T> void AssignValue(T& dst, const DECLValue& src) { switch (src.get_type()) { case DECLTYPE_FLOAT1: AssignValue(dst, src.asFloat()); break; case DECLTYPE_FLOAT2: AssignValue(dst, src.asVector2f()); break; case DECLTYPE_FLOAT3: AssignValue(dst, src.asVector3f()); break; case DECLTYPE_FLOAT4: AssignValue(dst, src.asVector4f()); break; case DECLTYPE_COLOR: AssignValue(dst, src.asColor()); break; case DECLTYPE_UBYTE4: AssignValue(dst, src.asUByte4()); break; case DECLTYPE_SHORT2: AssignValue(dst, src.asShort2()); break; case DECLTYPE_SHORT4: AssignValue(dst, src.asShort4()); break; case DECLTYPE_UBYTE4N: AssignValue(dst, src.asUByte4()); break; case DECLTYPE_SHORT2N: AssignValue(dst, src.asShort2()); break; case DECLTYPE_SHORT4N: AssignValue(dst, src.asShort4()); break; case DECLTYPE_USHORT2N: AssignValue(dst, src.asUShort2()); break; case DECLTYPE_USHORT4N: AssignValue(dst, src.asUShort4()); break; case DECLTYPE_UDEC3: AssignValue(dst, src.asU101010()); break; case DECLTYPE_DEC3N: AssignValue(dst, src.asS101010()); break; case DECLTYPE_FLOAT16_2: AssignValue(dst, src.asFloat16_2()); break; case DECLTYPE_FLOAT16_4: AssignValue(dst, src.asFloat16_4()); break; case DECLTYPE_UNUSED: break; } } void ImportMESH( DAODumpStream& log , CHNKRef chnk , DAOMemStream& idxStream , DAOMemStream& vertStream ) { LPCTSTR nodeName = chnk->get_name().c_str(); int nverts = chnk->get_Vertexcount(); unsigned long vsize = chnk->get_Vertexsize(); unsigned long voff = chnk->get_Vertexoffset(); GFFListRef declList = chnk->get_Vertexdeclarator(); DAOArray<DECLPtr> decls; if ( DynamicCast<DECL>(declList, decls) ) { for (DAOArray<DECLPtr>::iterator itr = decls.begin(); itr != decls.end(); ++itr) { DECLRef decl(*itr); int strmIdx = decl->get_Stream(); if (strmIdx == -1) continue; ASSERT( 0 == strmIdx ); ASSERT( 0 == decl->get_usageIndex() ); ASSERT( 0 == decl->get_Method() ); switch ( decl->get_usage() ) { case DECLUSAGE_POSITION: { DECLTYPE type = decl->get_dataType(); long offset = decl->get_Offset(); DAOArray< Vector4f > verts; verts.resize(nverts); for (int i = 0; i<nverts; ++i) { vertStream.Seek(SEEK_SET, voff + i * vsize + offset); Vector4f& vert = verts[i]; AssignValue( vert, DECLValue(type, vertStream.dataptr()) ); vert = vert; } Dump(log, "Position", verts); } break; #if 0 case DECLUSAGE_NORMAL: { // We want to have one normal for each vertex (or control point), // so we set the mapping mode to eBY_CONTROL_POINT. LayerElementNormal* pNormLayer = LayerElementNormal::Create(pMesh, ""); pNormLayer->SetMappingMode(LayerElement::eBY_CONTROL_POINT); pNormLayer->SetReferenceMode(LayerElement::eDIRECT); lLayer->SetNormals(pNormLayer); LayerElementArrayTemplate<Vector4>& aNorms = pNormLayer->GetDirectArray(); aNorms.Resize(nverts); for (int i = 0; i<nverts; ++i) { vertStream.Seek(SEEK_SET, voff + i * vsize + decl->get_Offset()); AssignValue( aNorms.GetAt(i), DECLValue(decl->get_dataType(), vertStream.dataptr()) ); } } break; case DECLUSAGE_TEXCOORD: { LayerElementUV* lUVLayer=LayerElementUV::Create(pMesh, "UVChannel_1"); lUVLayer->SetMappingMode(LayerElement::eBY_CONTROL_POINT); lUVLayer->SetReferenceMode(LayerElement::eDIRECT); lLayer->SetUVs(lUVLayer, LayerElement::eDIFFUSE_TEXTURES); LayerElementArrayTemplate<Vector2>& aUVs = lUVLayer->GetDirectArray(); aUVs.Resize(nverts); for (int i = 0; i<nverts; ++i) { Vector2 &uvw = aUVs.GetAt(i); vertStream.Seek(SEEK_SET, voff + i * vsize + decl->get_Offset()); AssignValue(uvw, DECLValue(decl->get_dataType(), vertStream.dataptr()) ); if (uvw[0] < 0.0f || uvw[0] > 1.0f) uvw[0] -= floor(uvw[0]); if (uvw[1] < 0.0f || uvw[1] > 1.0f) uvw[1] -= floor(uvw[1]); if (flipUV) uvw[1] = 1.0f-uvw[1]; //if (enableScale) // uvw.Set(uvw[0] * scaleFactor, uvw[1] * scaleFactor); } } break; case DECLUSAGE_TANGENT: { LayerElementTangent* pTangentLayer = LayerElementTangent::Create(pMesh, "Tangents"); pTangentLayer->SetMappingMode(LayerElement::eBY_CONTROL_POINT); pTangentLayer->SetReferenceMode(LayerElement::eDIRECT); lLayer->SetTangents(pTangentLayer); LayerElementArrayTemplate<Vector4>& aTangents = pTangentLayer->GetDirectArray(); aTangents.Resize(nverts); for (int i = 0; i<nverts; ++i) { vertStream.Seek(SEEK_SET, voff + i * vsize + decl->get_Offset()); AssignValue( aTangents.GetAt(i), DECLValue(decl->get_dataType(), vertStream.dataptr()) ); } } break; case DECLUSAGE_BINORMAL: { LayerElementBinormal* pBinormLayer = LayerElementBinormal::Create(pMesh, "Binormals"); pBinormLayer->SetMappingMode(LayerElement::eBY_CONTROL_POINT); pBinormLayer->SetReferenceMode(LayerElement::eDIRECT); lLayer->SetBinormals(pBinormLayer); LayerElementArrayTemplate<Vector4>& aBinorms = pBinormLayer->GetDirectArray(); aBinorms.Resize(nverts); for (int i = 0; i<nverts; ++i) { vertStream.Seek(SEEK_SET, voff + i * vsize + decl->get_Offset()); AssignValue( aBinorms.GetAt(i), DECLValue(decl->get_dataType(), vertStream.dataptr()) ); } } break; //case DECLUSAGE_BLENDWEIGHT: AddVertexBlendWeight(pMesh, decl, value); break; //case DECLUSAGE_BLENDINDICES: AddVertexBlendIndices(pMesh, decl, value); break; //case DECLUSAGE_PSIZE: AddVertexPSize(pMesh, decl, value); break; //case DECLUSAGE_TESSFACTOR: AddVertexTessFactor(pMesh, decl, value); break; //case DECLUSAGE_POSITIONT: AddVertexPositionT(pMesh, decl, value); break; case DECLUSAGE_COLOR: { LayerElementVertexColor* pLayer = LayerElementVertexColor::Create(pMesh, "VertexColors"); pLayer->SetMappingMode(LayerElement::eBY_CONTROL_POINT); pLayer->SetReferenceMode(LayerElement::eDIRECT); lLayer->SetVertexColors(pLayer); LayerElementArrayTemplate<Color>& aColors = pLayer->GetDirectArray(); aColors.Resize(nverts); for (int i = 0; i<nverts; ++i) { vertStream.Seek(SEEK_SET, voff + i * vsize + decl->get_Offset()); AssignValue( aColors.GetAt(i), DECLValue(decl->get_dataType(), vertStream.dataptr()) ); } } break; //case DECLUSAGE_FOG: AddVertexFog(pMesh, decl, value); break; //case DECLUSAGE_DEPTH: AddVertexDepth(pMesh, decl, value); break; //case DECLUSAGE_SAMPLE: AddVertexSample(pMesh, decl, value); break; case DECLUSAGE_UNUSED: break; #endif } } } ASSERT( 0 == chnk->get_Indexformat()); ASSERT( 0 == chnk->get_Basevertexindex()); ASSERT( 0 == chnk->get_Minindex()); DAOArray< long > verts; verts.resize(nverts); idxStream.Seek(SEEK_SET, sizeof(short) * chnk->get_Startindex()); UShort3 * pFaces = (UShort3*)idxStream.dataptr(); int nfaces = chnk->get_Indexcount() / 3; DumpArray(log, "Indices", pFaces, nfaces); for (int i=0; i<nfaces; ++i) { UShort3& t = pFaces[i]; ++verts[t[0]]; ++verts[t[1]]; ++verts[t[2]]; //pMesh->BeginPolygon(i); //pMesh->AddPolygon(t[0]); //pMesh->AddPolygon(t[1]); //pMesh->AddPolygon(t[2]); //pMesh->EndPolygon (); } Dump(log, "VertInfo", verts); } // //void ImportBones( DAODumpStream& log, Matrix44 pm, NODERef node) //{ // int indent = log.IncreaseIndent(); // try // { // Text name = !node.isNull() ? node->get_name() : Text(); // // GFFListRef childList = node->get_children(); // // Vector4f trans = node->GetLocalTranslation(); // Quaternion quat = node->GetLocalRotation(); // float scale = node->GetLocalScale(); // Matrix44 tm(trans, quat, scale); // // float len = trans.Length(); // // // Matrix44 im = pm * tm; // // //[-0.161288,0.000001,0.986907] // //[-0.000001,-1.000000,0.000001] // //[0.986907,-0.000001,0.161288] // //[-0.002451,0.000000,0.371050] // // Matrix44& dm = im; // // Text txtPos, txtRot, txtYpr, txtScale, txtFormat, txtMatrix; // txtPos.Format("(%7.4f, %7.4f, %7.4f)", trans[0], trans[1], trans[2]); // txtRot.Format("(%7.4f, %7.4f, %7.4f, %7.4f)", quat.w, quat.x, quat.y, quat.z); // txtFormat.Format("%%-%ds | %%-24s | %%-32s\n", max(60 - indent*2, 1) ); // //log.Indent(); // //log.PrintF(txtFormat, name.c_str(), txtPos.c_str(), txtRot.c_str()); // // // Text txtPos0, txtPos1, txtPos2, txtPos3; // Vector4f r0 = dm.GetRow(0); // Vector4f r1 = dm.GetRow(1); // Vector4f r2 = dm.GetRow(2); // Vector4f r3 = dm.GetRow(3); // txtPos0.Format("[%7.4f,%7.4f,%7.4f]", r0.x, r0.y, r0.z); // txtPos1.Format("[%7.4f,%7.4f,%7.4f]", r1.x, r1.y, r1.z); // txtPos2.Format("[%7.4f,%7.4f,%7.4f]", r2.x, r2.y, r2.z); // txtPos3.Format("[%7.4f,%7.4f,%7.4f]", r3.x, r3.y, r3.z); // // txtFormat.Format("%%-%ds | %%s %%s %%s %%s\n", max(60 - indent*2, 1) ); // log.Indent(); // log.PrintF(txtFormat, name.c_str(), txtPos0.c_str(), txtPos1.c_str(), txtPos2.c_str(), txtPos3.c_str()); // // // DAOArray< NODEPtr > children; // if ( DynamicCast(childList, children) ) { // for (size_t i=0, n=children.size(); i<n; ++i) // ImportBones(log, im, NODERef(children[i])); // } // } // catch( std::exception & ) // { // } // catch( ... ) // { // } // log.DecreaseIndent(); //} void ImportMesh(MESHRef root) { DAODumpStream out(NULL, false); DAOMemStream vertStream; DAOMemStream idxStream; GFFListRef idxList = root->get_indexdata(); GFFListRef vertList = root->get_vertexdata(); idxStream.Open(idxList->pdata(), idxList->size()); vertStream.Open(vertList->pdata(), vertList->size()); DAOArray<CHNKPtr> chunks; if ( DynamicCast<CHNK>(root->get_chunks(), chunks) ) { for (DAOArray<CHNKPtr>::iterator itr = chunks.begin(); itr != chunks.end(); ++itr) { CHNKRef chnk(*itr); ImportMESH(out, chnk, idxStream, vertStream); } } } ////////////////////////////////////////////////////////////////////////// static void HelpString(Cmd::HelpType type){ switch (type) { case Cmd::htShort: cout << "DumpMesh - Dump MESH Mesh information to console"; break; case Cmd::htLong: { TCHAR fullName[MAX_PATH], exeName[MAX_PATH]; GetModuleFileName(NULL, fullName, MAX_PATH); _tsplitpath(fullName, NULL, NULL, exeName, NULL); cout << "Usage: " << exeName << " erf [-opts[modifiers]] <erf file>" << endl << " Simple skeleton dump help for DA:O MESH files." << endl << endl << " If input argument is a file then the program unpack the erf file." << endl << " If input argument is a path then the program packs an erf file from that path." << endl << endl << "<Switches>" << endl << " v Verbose Help (Lists specific versions)" << endl << endl ; } break; } } static bool ExecuteCmd(Program &prog) { TCHAR infile[MAX_PATH], fullpath[MAX_PATH]; int argc = prog.argc; TCHAR **argv = prog.argv; bool verboseHelp = false; TCHAR path[MAX_PATH]; if (argc == 0) return false; infile[0] = 0; path[0] = 0; for (int i = 0; i < argc; i++) { TCHAR *arg = argv[i]; if (arg == NULL) continue; if (arg[0] == '-' || arg[0] == '/') { switch (arg[1]) { case 'v': verboseHelp = true; break; default: _fputts( _T("ERROR: Unknown argument specified \""), stderr ); _fputts( arg, stderr ); _fputts( _T("\".\n"), stderr ); return false; } } else if (infile[0] == 0) { _tcscpy(infile, arg); } } if (infile[0] == 0) { _ftprintf( stderr, _T("File not specified.\n") ); return false; } TCHAR drive[MAX_PATH], dir[MAX_PATH], fname[MAX_PATH], ext[MAX_PATH]; GetFullPathName(infile, _countof(fullpath), fullpath, NULL); _tsplitpath(fullpath, drive, dir, fname, ext); if (path[0] == 0) { _tmakepath(path, drive, dir, fname, NULL); } struct _stat64 fstats; if ( -1 == _tstat64(fullpath, &fstats) ){ _ftprintf( stderr, _T("Path is not a valid file or directory.\n") ); return false; } if ( (fstats.st_mode & _S_IFDIR) != _S_IFDIR ) // file not directory { MESHFile file; file.open(fullpath); MESHPtr root = file.get_Root(); ImportMesh( MESHRef(root) ); } return false; } REGISTER_COMMAND(DumpMesh, HelpString, ExecuteCmd);
[ "tazpn314@ccf8930c-dfc1-11de-9043-17b7bd24f792" ]
[ [ [ 1, 432 ] ] ]
65e53737660e95d6a450b88f683e42b0af0bb899
a2904986c09bd07e8c89359632e849534970c1be
/topcoder/CheckFunction.cpp
253a0961a8a0640d31a7e98b4385dad98a149917
[]
no_license
naturalself/topcoder_srms
20bf84ac1fd959e9fbbf8b82a93113c858bf6134
7b42d11ac2cc1fe5933c5bc5bc97ee61b6ec55e5
refs/heads/master
2021-01-22T04:36:40.592620
2010-11-29T17:30:40
2010-11-29T17:30:40
444,669
1
0
null
null
null
null
UTF-8
C++
false
false
2,360
cpp
// BEGIN CUT HERE // END CUT HERE #line 5 "CheckFunction.cpp" #include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <numeric> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> using namespace std; #define debug(p) cout << #p << "=" << p << endl; #define forv(i, v) for (int i = 0; i < (int)(v.size()); ++i) #define fors(i, s) for (int i = 0; i < (int)(s.length()); ++i) #define all(a) a.begin(), a.end() #define pb push_back class CheckFunction { public: int newFunction(string code) { int ret=0; fors(i,code){ if(code[i]=='1'){ ret += 2; }else if(code[i]=='7'){ ret += 3; }else if(code[i]=='4'){ ret += 4; }else if(code[i]=='8'){ ret += 7; }else if(code[i]=='2' || code[i]=='3' || code[i]=='5'){ ret += 5; }else if(code[i]=='0' || code[i]=='6' || code[i]=='9'){ ret += 6; } } return ret; } // BEGIN CUT HERE public: void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); } private: template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); } void verify_case(int Case, const int &Expected, const int &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } } void test_case_0() { string Arg0 = "13579"; int Arg1 = 21; verify_case(0, Arg1, newFunction(Arg0)); } void test_case_1() { string Arg0 = "02468"; int Arg1 = 28; verify_case(1, Arg1, newFunction(Arg0)); } void test_case_2() { string Arg0 = "73254370932875002027963295052175"; int Arg1 = 157; verify_case(2, Arg1, newFunction(Arg0)); } // END CUT HERE }; // BEGIN CUT HERE int main() { CheckFunction ___test; ___test.run_test(-1); } // END CUT HERE
[ "shin@CF-7AUJ41TT52JO.(none)" ]
[ [ [ 1, 76 ] ] ]
1105a285bb73225e49722f07d3166a88121f150a
942c07b43867ce218375a2a150d389f6ef11784a
/Window.cpp
2d42c8db9d4b0018b90880099eaebb769288ef01
[]
no_license
NIA/D3DBumpMapping
b8afa25ce367d9cad9ef207490171accec52e25b
cbd3a635ee40e45c2db870a5e3cd88ff72fb48f8
refs/heads/master
2016-09-05T13:56:19.504141
2009-12-27T20:17:57
2009-12-27T20:17:57
411,850
1
1
null
null
null
null
UTF-8
C++
false
false
1,415
cpp
#include "Window.h" namespace { const TCHAR *WINDOW_CLASS = _T("BumpMapping"); const TCHAR *WINDOW_TITLE = _T("BumpMapping"); } Window::Window(int width, int height) { ZeroMemory( &window_class, sizeof(window_class) ); window_class.cbSize = sizeof( WNDCLASSEX ); window_class.style = CS_CLASSDC; window_class.lpfnWndProc = Window::MsgProc; window_class.hInstance = GetModuleHandle( NULL ); window_class.lpszClassName = WINDOW_CLASS; RegisterClassEx( &window_class ); hwnd = CreateWindow( WINDOW_CLASS, WINDOW_TITLE, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, width, height, NULL, NULL, window_class.hInstance, NULL ); if( NULL == hwnd ) { unregister_class(); throw WindowInitError(); } } LRESULT WINAPI Window::MsgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { switch( msg ) { case WM_DESTROY: PostQuitMessage( 0 ); return 0; } return DefWindowProc( hwnd, msg, wparam, lparam ); } void Window::show() const { ShowWindow( *this, SW_SHOWDEFAULT ); } void Window::update() const { UpdateWindow( *this ); } void Window::unregister_class() { UnregisterClass( WINDOW_CLASS, window_class.hInstance ); } Window::~Window() { unregister_class(); }
[ [ [ 1, 62 ] ] ]
039ab35521556afa49e2f8601f22846f31b71d89
00dc01cc668101fa47dccdd0c930e5a5ae1e62a3
/DirectX/DxShader.h
7bf839d546ebe524eaeddefeefd2feaabf5a45c8
[ "MIT" ]
permissive
jtilander/unittestcg
3f18265a4bd6bf4b1d66623ad9b1b13e9fda9512
d56910eb75c6c3d4673a3bf465ab8e21169aaec5
refs/heads/master
2021-01-25T03:40:43.035650
2008-01-15T06:45:38
2008-01-15T06:45:38
32,777,280
0
0
null
null
null
null
UTF-8
C++
false
false
1,103
h
#ifndef aurora_directx_dxshader_h #define aurora_directx_dxshader_h #include "../UnitTestCgConfig.h" #ifdef UNITTESTCG_ENABLE_DIRECTX #include "../Shader.h" #include "../DefinesMap.h" #include <string> struct ID3DXEffect; struct ID3DXInclude; struct IDirect3DDevice9; namespace aurora { class DxShader : public Shader { DxShader( ID3DXEffect* takesOwnership, const std::string& disasm ); public: virtual ~DxShader(); virtual bool setVector4( const char* name, const float* values ); virtual bool setMatrix4x4( const char* name, const float* values ); virtual bool setMatrix4x4Transpose( const char* name, const float* values ); virtual int begin() const; virtual void end() const; virtual void beginPass(int i) const; virtual void endPass() const; virtual void dump( std::ostream& stream ) const; static Shader* create( IDirect3DDevice9* device, const std::string& code, const std::string& name, ID3DXInclude* includes = 0, const DefinesMap* defines = 0); private: ID3DXEffect* m_effect; const std::string m_disasm; }; } #endif #endif
[ "jim.tilander@e486c63a-db1d-0410-a17c-a9b5b17689e2" ]
[ [ [ 1, 43 ] ] ]
e5a9e7b040c8b5c21aab47f7f484253fffff2571
14b1a8bce788af0a3f3479a3e5323ce1729e2084
/CoreApp/src/BasicManager.cpp
1c174eeef440df6b8dc3d3cd8d5b5b595d531a3c
[]
no_license
PedroLopes/MtDjing
0d0aae75690944685e17779d9c6c9d2c17def17e
6a19b73cf4897cd6f7ab581ebd0bbf19dbb69e24
refs/heads/master
2020-05-29T12:54:00.972977
2010-05-23T18:53:55
2010-05-23T18:53:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
438
cpp
/* * BasicManager.cpp * * Created on: Apr 19, 2010 * Author: PedroLopes */ #include "BasicManager.h" namespace MtDjing { BasicManager::BasicManager(string _name, int _id) { name = _name; id = _id; } string BasicManager::getName() const { return name; } int BasicManager::getId() const { return id; } BasicManager::~BasicManager() { // TODO Auto-generated destructor stub } }
[ [ [ 1, 34 ] ] ]
cd9434c00d3faad4ac975be6378189f38fb0b0f7
d39595c0c12a46ece1b1b41c92a9adcf7fe277ee
/GameMap.cpp
9dce1707eb50a4873fdb67f25ced129303d708f5
[]
no_license
pandabear41/Breakout
e89b85708b960e7dd83c22df1552141b1c937af9
64967248274055117b3cf709c084818039ec8278
refs/heads/master
2021-01-17T05:55:34.279752
2011-07-15T05:08:02
2011-07-15T05:08:02
2,039,821
0
0
null
null
null
null
UTF-8
C++
false
false
3,327
cpp
#include <iostream> #include "GameMap.h" using namespace std; GameMap::GameMap(int flags) { this->flags = flags; } GameMap::~GameMap() { } void GameMap::tick() { } void GameMap::render(SDL_Surface* display) { //cout << this->bricks.size() << endl; for (unsigned int i=0; i < this->bricks.size(); i++) { this->bricks.at(i)->render(display); } } void GameMap::reset() { } void GameMap::generateNew() { int rows, columns, brickType, incX, incY, initX; SDL_Surface* brickImg; // cout << sImg << endl; if (flags & MAP_TYPE_LARGE) { brickImg = lImg; brickType = 2; columns = LMX; rows = LMY - 2; incX = 32; incY = 16; initX = 16; } else if (flags & MAP_TYPE_SMALL) { brickImg = sImg; brickType = 3; columns = SMX; rows = SMY - 5; incX = 16; incY = 8; initX = 8; } else { return; } int x = 0; int y = 22; cout << "After init" << endl; for (int i = 1; i <= rows; i++) { x = initX; for (int j = 1; j <= columns; j++) { Brick* brick = new Brick(brickImg, incX, incY); brick->x = x; brick->y = y; brick->brickType = rand() % 10; brick->brickFlag = brickType; bricks.push_back(brick); x += incX; } y += incY; } cout << "After everything" << endl; } void GameMap::loadMap(const string file) { } void GameMap::collidesWith(Ball* item) { // cout << this->bricks.size() << endl; for (unsigned int i=0; i < this->bricks.size(); i++) { Brick* brick = this->bricks.at(i); if (!brick->hidden) { ColliderData hitData; bool hit = brick->circle2Rectangle(item->x, item->y, brick, &hitData); if (hit) { //item->stop = true; brick->hidden = true; //ColliderData hitNoth; //while (brick->circle2Rectangle(item->x, item->y, brick, &hitNoth)) { // item->y += 1.4 * item->direction.get_y(); // item->x -= 1.4 * item->direction.get_x(); //} switch(hitData.config) { /** Collision with a corner: it is a point 2 point collision * so use the impact vector. */ case 0: case 2: case 4: case 6: item->bounceX(); item->bounceY(); return; /** Collision with an edge: it is point 2 line collision * so the adjustement vector depends only on the * line verticality. */ case 1: case 5: item->bounceY(); return; case 3: case 7: item->bounceX(); return; default: return; break; } } } } }
[ [ [ 1, 123 ] ] ]
ed9014257ba085ef964121ad5153c910cdba205a
74c8da5b29163992a08a376c7819785998afb588
/NetAnimal/Game/Hunter/NewGameComponent/GameNeedleComponent/src/GameRotationComponent.cpp
e06f02b06fd95be1761eb5954733f027ee8d61da
[]
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
5,853
cpp
#include "GameNeedleComponentStableHeaders.h" #include "GameRotationComponent.h" #include "COgreCCSInterface.h" #include "CGameNeedleInterface.h" #include "CGameRotationInterface.h" #include "CNewGameSceneInterface.h" #include "CGameBaseInterface.h" #include "CRotationInterface.h" #include "WinnerAnimation.h" using namespace Orz; inline float sub360(float value) { while(value>=360.f) { value-=360.f; } return value; } inline float getAll(float start, float end) { start = sub360(start); if(start >= end) { return end +360 - start; }else return end - start; } inline std::pair<float, float> getStartAll(float start, float end) { return std::make_pair(sub360(start), getAll(start,end)); } bool GameRotationComponent::winner(int id, bool move) { CGameBaseInterface * base = _baseComp->queryInterface<CGameBaseInterface>(); _winnerAnimation.reset(); static int i=0; i++; Ogre::Quaternion q; q.FromAngleAxis( Ogre::Radian(Ogre::Degree(-_base * 15.f)),Ogre::Vector3::UNIT_Y); _node->setOrientation(q); if(move) { _winnerAnimation.reset(new WinnerAnimation("test"+boost::lexical_cast<std::string>(i%2), base->getSceneNode(id), _node)); } else { _winnerAnimation.reset(new WinnerAnimationNoMove("test"+boost::lexical_cast<std::string>(i%2), base->getSceneNode(id))); } _winnerAnimation->play(); _gameRotationInterface->update = boost::bind(&GameRotationComponent::winnerUpdate, this, _1); return true; } bool GameRotationComponent::winnerUpdate(TimeType i) { return _winnerAnimation->update(i); } GameRotationComponent::GameRotationComponent(void):_gameRotationInterface(new CGameRotationInterface),_needleNode(NULL),_baseNode(NULL),_node(NULL) { _needleComp = Orz::ComponentFactories::getInstance().create("GameNeedle"); _needleRotationComp = Orz::ComponentFactories::getInstance().create("Rotation"); _baseComp = Orz::ComponentFactories::getInstance().create("GameBase"); _baseRotationComp = Orz::ComponentFactories::getInstance().create("Rotation"); _gameRotationInterface->init = boost::bind(&GameRotationComponent::init, this, _1); _gameRotationInterface->play = boost::bind(&GameRotationComponent::play, this, _1, _2, _3, _4); //_gameRotationInterface->play2 = boost::bind(&GameRotationComponent::play2, this, _1, _2, _3, _4); _gameRotationInterface->winner = boost::bind(&GameRotationComponent::winner, this, _1, _2); _gameRotationInterface->reset = boost::bind(&GameRotationComponent::reset, this); _base = 0; _needle = 0; } void GameRotationComponent::reset(void) { if(_winnerAnimation) _winnerAnimation->reset(); } bool GameRotationComponent::play(int needle, TimeType needleTime, int base, TimeType baseTime) { CRotationInterface * rotation =NULL; rotation = _needleRotationComp->queryInterface<CRotationInterface>(); rotation->play2(getStartAll(_needle* 15.f, needle * 15.f), needleTime); rotation = _baseRotationComp->queryInterface<CRotationInterface>(); rotation->play2(getStartAll(_base*15.f, base * 15.f), baseTime); _base = base; _needle = needle; _gameRotationInterface->update = boost::bind(&GameRotationComponent::update, this, _1); return true; } //bool GameRotationComponent::play(std::pair<int, int> & needle, TimeType needleTime, std::pair<int, int> & base, TimeType baseTime) //{ // CRotationInterface * rotation =NULL; // // rotation = _needleRotationComp->queryInterface<CRotationInterface>(); // rotation->play(needle.first*15.f, needle.second*15.f, needleTime); // // rotation = _baseRotationComp->queryInterface<CRotationInterface>(); // rotation->play(base.first*15.f, base.second*15.f, baseTime); // // return true; //} bool GameRotationComponent::update(TimeType i) { CRotationInterface * rotation =NULL; rotation = _needleRotationComp->queryInterface<CRotationInterface>(); bool needle = rotation->update(i); rotation = _baseRotationComp->queryInterface<CRotationInterface>(); bool base = rotation->update(i); return base || needle; } bool GameRotationComponent::init(ComponentPtr sceneComp) { CNewGameSceneInterface * scene = sceneComp->queryInterface<CNewGameSceneInterface>(); if(!scene) return false; CGameNeedleInterface * needle = _needleComp->queryInterface<CGameNeedleInterface>(); _needleNode = scene->getHelper(CNewGameSceneInterface::Helper24)->createChildSceneNode(); _baseNode = scene->getHelper(CNewGameSceneInterface::Helper24)->createChildSceneNode(); _node = Orz::OgreGraphicsManager::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode(_baseNode->getPosition()); needle->load(_needleNode); CRotationInterface * rotation = _needleRotationComp->queryInterface<CRotationInterface>(); rotation->init(_needleNode, CRotationInterface::Clockwise, 90.f); rotation->reset(0.f); CGameBaseInterface * base = _baseComp->queryInterface<CGameBaseInterface>(); base->init(_baseNode); for(int i = 0; i< 24; ++i) { base->load(i, scene->getHelper(CNewGameSceneInterface::HELPERS(i))); } rotation = _baseRotationComp->queryInterface<CRotationInterface>(); rotation->init(_baseNode, CRotationInterface::Eastern, 0.f); rotation->reset(0.f); return true; } GameRotationComponent::~GameRotationComponent(void) { } ComponentInterface * GameRotationComponent::_queryInterface(const TypeInfo & info) const { if(info == TypeInfo(typeid(CGameRotationInterface))) return _gameRotationInterface.get(); if(info == TypeInfo(typeid(CGameBaseInterface))) return _baseComp->_queryInterface(info); if(info == TypeInfo(typeid(CRotationInterface))) { return _needleRotationComp->_queryInterface(info); } return _needleComp->_queryInterface(info); }
[ [ [ 1, 204 ] ] ]
5d71f8c71cd48364686f176b0e31bb6e622afc0a
ce262ae496ab3eeebfcbb337da86d34eb689c07b
/SEFoundation/SEComputationalGeometry/SEQuery3.cpp
38d9d5b798fb51d4c96bf4cc1337768756a5c099
[]
no_license
pizibing/swingengine
d8d9208c00ec2944817e1aab51287a3c38103bea
e7109d7b3e28c4421c173712eaf872771550669e
refs/heads/master
2021-01-16T18:29:10.689858
2011-06-23T04:27:46
2011-06-23T04:27:46
33,969,301
0
0
null
null
null
null
UTF-8
C++
false
false
6,948
cpp
// Swing Engine Version 1 Source Code // Most of techniques in the engine are mainly based on David Eberly's // Wild Magic 4 open-source code.The author of Swing Engine learned a lot // from Eberly's experience of architecture and algorithm. // Several sub-systems are totally new,and others are re-implimented or // re-organized based on Wild Magic 4's sub-systems. // Copyright (c) 2007-2010. All Rights Reserved // // Eberly's permission: // Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation; either version 2.1 of the License, or (at // your option) any later version. The license is available for reading at // the location: // http://www.gnu.org/copyleft/lgpl.html #include "SEFoundationPCH.h" #include "SEQuery3.h" using namespace Swing; //---------------------------------------------------------------------------- SEQuery3f::SEQuery3f (int iVCount, const SEVector3f* aVertex) { SE_ASSERT( iVCount > 0 && aVertex ); m_iVCount = iVCount; m_aVertex = aVertex; } //---------------------------------------------------------------------------- SEQuery3f::~SEQuery3f() { } //---------------------------------------------------------------------------- SEQuery::Type SEQuery3f::GetType() const { return SEQuery::QT_REAL; } //---------------------------------------------------------------------------- int SEQuery3f::GetCount() const { return m_iVCount; } //---------------------------------------------------------------------------- const SEVector3f* SEQuery3f::GetVertices() const { return m_aVertex; } //---------------------------------------------------------------------------- int SEQuery3f::ToPlane(int i, int iV0, int iV1, int iV2) const { return ToPlane(m_aVertex[i], iV0, iV1, iV2); } //---------------------------------------------------------------------------- int SEQuery3f::ToPlane(const SEVector3f& rP, int iV0, int iV1, int iV2) const { const SEVector3f& rV0 = m_aVertex[iV0]; const SEVector3f& rV1 = m_aVertex[iV1]; const SEVector3f& rV2 = m_aVertex[iV2]; float fX0 = rP[0] - rV0[0]; float fY0 = rP[1] - rV0[1]; float fZ0 = rP[2] - rV0[2]; float fX1 = rV1[0] - rV0[0]; float fY1 = rV1[1] - rV0[1]; float fZ1 = rV1[2] - rV0[2]; float fX2 = rV2[0] - rV0[0]; float fY2 = rV2[1] - rV0[1]; float fZ2 = rV2[2] - rV0[2]; float fDet3 = Det3(fX0, fY0, fZ0, fX1, fY1, fZ1, fX2, fY2, fZ2); return (fDet3 > 0.0f ? +1 : (fDet3 < 0.0f ? -1 : 0)); } //---------------------------------------------------------------------------- int SEQuery3f::ToTetrahedron(int i, int iV0, int iV1, int iV2, int iV3) const { return ToTetrahedron(m_aVertex[i], iV0, iV1, iV2, iV3); } //---------------------------------------------------------------------------- int SEQuery3f::ToTetrahedron(const SEVector3f& rP, int iV0, int iV1, int iV2, int iV3) const { int iSign0 = ToPlane(rP, iV1, iV2, iV3); if( iSign0 > 0 ) { return +1; } int iSign1 = ToPlane(rP, iV0, iV2, iV3); if( iSign1 < 0 ) { return +1; } int iSign2 = ToPlane(rP, iV0, iV1, iV3); if( iSign2 > 0 ) { return +1; } int iSign3 = ToPlane(rP, iV0, iV1, iV2); if( iSign3 < 0 ) { return +1; } return ((iSign0 && iSign1 && iSign2 && iSign3) ? -1 : 0); } //---------------------------------------------------------------------------- int SEQuery3f::ToCircumsphere(int i, int iV0, int iV1, int iV2, int iV3) const { return ToCircumsphere(m_aVertex[i], iV0, iV1, iV2, iV3); } //---------------------------------------------------------------------------- int SEQuery3f::ToCircumsphere(const SEVector3f& rP, int iV0, int iV1, int iV2, int iV3) const { const SEVector3f& rV0 = m_aVertex[iV0]; const SEVector3f& rV1 = m_aVertex[iV1]; const SEVector3f& rV2 = m_aVertex[iV2]; const SEVector3f& rV3 = m_aVertex[iV3]; float fS0x = rV0[0] + rP[0]; float fD0x = rV0[0] - rP[0]; float fS0y = rV0[1] + rP[1]; float fD0y = rV0[1] - rP[1]; float fS0z = rV0[2] + rP[2]; float fD0z = rV0[2] - rP[2]; float fS1x = rV1[0] + rP[0]; float fD1x = rV1[0] - rP[0]; float fS1y = rV1[1] + rP[1]; float fD1y = rV1[1] - rP[1]; float fS1z = rV1[2] + rP[2]; float fD1z = rV1[2] - rP[2]; float fS2x = rV2[0] + rP[0]; float fD2x = rV2[0] - rP[0]; float fS2y = rV2[1] + rP[1]; float fD2y = rV2[1] - rP[1]; float fS2z = rV2[2] + rP[2]; float fD2z = rV2[2] - rP[2]; float fS3x = rV3[0] + rP[0]; float fD3x = rV3[0] - rP[0]; float fS3y = rV3[1] + rP[1]; float fD3y = rV3[1] - rP[1]; float fS3z = rV3[2] + rP[2]; float fD3z = rV3[2] - rP[2]; float fW0 = fS0x*fD0x + fS0y*fD0y + fS0z*fD0z; float fW1 = fS1x*fD1x + fS1y*fD1y + fS1z*fD1z; float fW2 = fS2x*fD2x + fS2y*fD2y + fS2z*fD2z; float fW3 = fS3x*fD3x + fS3y*fD3y + fS3z*fD3z; float fDet4 = Det4(fD0x, fD0y, fD0z, fW0, fD1x, fD1y, fD1z, fW1, fD2x, fD2y, fD2z, fW2, fD3x, fD3y, fD3z, fW3); return (fDet4 > 0.0f ? 1 : (fDet4 < 0.0f ? -1 : 0)); } //---------------------------------------------------------------------------- float SEQuery3f::Dot(float fX0, float fY0, float fZ0, float fX1, float fY1, float fZ1) { return fX0*fX1 + fY0*fY1 + fZ0*fZ1; } //---------------------------------------------------------------------------- float SEQuery3f::Det3(float fX0, float fY0, float fZ0, float fX1, float fY1, float fZ1, float fX2, float fY2, float fZ2) { float fC00 = fY1*fZ2 - fY2*fZ1; float fC01 = fY2*fZ0 - fY0*fZ2; float fC02 = fY0*fZ1 - fY1*fZ0; return fX0*fC00 + fX1*fC01 + fX2*fC02; } //---------------------------------------------------------------------------- float SEQuery3f::Det4(float fX0, float fY0, float fZ0, float fW0, float fX1, float fY1, float fZ1, float fW1, float fX2, float fY2, float fZ2, float fW2, float fX3, float fY3, float fZ3, float fW3) { float fA0 = fX0*fY1 - fX1*fY0; float fA1 = fX0*fY2 - fX2*fY0; float fA2 = fX0*fY3 - fX3*fY0; float fA3 = fX1*fY2 - fX2*fY1; float fA4 = fX1*fY3 - fX3*fY1; float fA5 = fX2*fY3 - fX3*fY2; float fB0 = fZ0*fW1 - fZ1*fW0; float fB1 = fZ0*fW2 - fZ2*fW0; float fB2 = fZ0*fW3 - fZ3*fW0; float fB3 = fZ1*fW2 - fZ2*fW1; float fB4 = fZ1*fW3 - fZ3*fW1; float fB5 = fZ2*fW3 - fZ3*fW2; return fA0*fB5 - fA1*fB4 + fA2*fB3 + fA3*fB2 - fA4*fB1 + fA5*fB0; } //----------------------------------------------------------------------------
[ "[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac" ]
[ [ [ 1, 198 ] ] ]
783e30988dcd2c0f65c74e1c99f38cd9be47e5be
1775576281b8c24b5ce36b8685bc2c6919b35770
/tags/release_1.0/edit.cpp
7a6a039879da48f305b70e8adb505a52997c2eaf
[]
no_license
BackupTheBerlios/gtkslade-svn
933a1268545eaa62087f387c057548e03497b412
03890e3ba1735efbcccaf7ea7609d393670699c1
refs/heads/master
2016-09-06T18:35:25.336234
2006-01-01T11:05:50
2006-01-01T11:05:50
40,615,146
0
0
null
null
null
null
UTF-8
C++
false
false
30,569
cpp
#include "main.h" #include "map.h" #include "checks.h" #include "edit_move.h" #include "undoredo.h" #include "editor_window.h" #include "info_bar.h" #include "struct_3d.h" #include "mathstuff.h" #include "camera.h" #include "render.h" // VARIABLES ----------------------------- >> float zoom = 16; // Zoom level (pixels per 32 map units) int xoff = 0; // View x offset int yoff = 0; // View y offset int gridsize = 32; // Grid size int edit_mode = 1; // Edit mode: 0=vertices, 1=lines, 2=sectors, 3=things int hilight_item = -1; // The currently hilighted item (-1 for none) bool lock_hilight = false; // Wether to 'lock' hilighting int map_changed = 3; // 0 = no change // 1 = changed, no node rebuild or struct rebuild needed // 2 = changed, no node rebuild needed // 3 = changed, node rebuild needed bool browser = false; // Is the texture browser active? //bool mix_tex = false; // Mix textures & flats (zdoom)? thing_t last_thing; movelist_t move_list; vector<int> select_order; vector<int> selected_items; // Colours rgba_t col_line_solid(200, 200, 200, 255); rgba_t col_line_2s(110, 120, 130, 255); rgba_t col_line_monster(0, 120, 0, 255); rgba_t col_line_nofirst(255, 0, 0, 255); rgba_t col_line_special(100, 115, 180, 255); extern int vid_width, vid_height; extern Map map; extern point2_t mouse; extern Camera camera; // increase_grid: Increases the grid size // ----------------------------------- >> void increase_grid() { gridsize *= 2; if (gridsize > 1024) gridsize = 1024; } // decrease_grid: Decreases the grid size // ----------------------------------- >> void decrease_grid() { gridsize /= 2; if (gridsize < 1) gridsize = 1; } // snap_to_grid: Finds the nearest grid line to a point // ------------------------------------------------- >> int snap_to_grid(double pos) { int upper, lower; for (int i = pos; i >= (pos - gridsize); i--) { if ((i % gridsize) == 0) { lower = i; break; } } for (int i = pos; i < (pos + gridsize); i++) { if ((i % gridsize) == 0) { upper = i; break; } } double mid = lower + ((upper - lower) / 2.0); if (pos > mid) return upper; else return lower; return (int)pos; } // snap_to_grid_custom: Finds the nearest specified grid line to a point // ------------------------------------------------------------------ >> int snap_to_grid_custom(int pos, int grid) { short upper, lower; for (int i = pos; i >= (pos - grid); i--) { if ((i % grid) == 0) { lower = i; break; } } for (int i = pos; i < (pos + grid); i++) { if ((i % grid) == 0) { upper = i; break; } } if ((upper - pos) < (pos - lower)) return upper; else return lower; return pos; } // s_x: Returns the actual screen position of an x coordinate on the map // ------------------------------------------------------------------ >> double s_x(double x) { return ((double)vid_width / 2.0) + (((double)xoff * zoom) + (x * zoom) / MAJOR_UNIT); } // s_y: Returns the actual screen position of a y coordinate on the map // ----------------------------------------------------------------- >> double s_y(double y) { return ((double)vid_height / 2) + (((double)yoff * zoom) + (y * zoom) / MAJOR_UNIT); } point2_t s_p(point2_t point) { return point2_t(s_x(point.x), s_y(point.y)); } // m_x: Returns the map coordiate of an x position on the screen // ---------------------------------------------------------- >> double m_x(double x) { return (((float)x / (float)zoom) * 32.0f) - ((float)xoff * 32.0f) - ((((float)vid_width / 2.0f) / (float)zoom) * MAJOR_UNIT); } // m_y: Returns the map coordiate of a y position on the screen // --------------------------------------------------------- >> double m_y(double y) { return (((float)y / (float)zoom) * 32.0f) - ((float)yoff * 32.0f) - ((((float)vid_height / 2.0f) / (float)zoom) * MAJOR_UNIT); } point2_t m_p(point2_t point) { return point2_t(m_x(point.x), m_y(point.y)); } // get_line_colour: Returns a colour depending on a line's flags // ---------------------------------------------------------- >> void get_line_colour(WORD l, rgba_t *colour) { if (map.lines[l]->flags & LINE_IMPASSIBLE || map.lines[l]->side2 == -1) colour->set(col_line_solid); else { colour->set(col_line_2s); if (map.lines[l]->flags & LINE_BLOCKMONSTERS) colour->set(col_line_monster); } if (map.lines[l]->type != 0) { rgba_t spec2s(col_line_special.r * 0.8, col_line_special.g * 0.8, col_line_special.b * 0.8, col_line_special.a, col_line_special.blend); if (map.lines[l]->flags & LINE_TWOSIDED) colour->set(spec2s); else colour->set(col_line_special); } if (map.lines[l]->flags & LINE_TWOSIDED && map.lines[l]->side2 == -1) colour->set(120, 0, 0, 255); if (map.lines[l]->side1 == -1) colour->set(col_line_nofirst); } // get_nearest_vertex: Gets the nearest vertex to a point // --------------------------------------------------- >> int get_nearest_vertex(int x, int y) { double min_dist = 32; int vertex = -1; for (WORD v = 0; v < map.n_verts; v++) { double dist = distance(map.v_getspoint(v).x, map.v_getspoint(v).y, x, y); if (dist < min_dist) { min_dist = dist; vertex = v; } } return vertex; } // get_nearest_thing: Gets the nearest vertex to a point // --------------------------------------------------- >> int get_nearest_thing(double x, double y) { double min_dist = 64; int thing = -1; for (WORD t = 0; t < map.n_things; t++) { double dist = distance(map.things[t]->x, map.things[t]->y, x, y); if (dist < min_dist) { min_dist = dist; thing = t; } } return thing; } // get_nearest_line: Gets the nearest line to a point // (if any are closer than 64 units) // ----------------------------------------------- >> int get_nearest_line(double x, double y) { double min_dist = 64; int line = -1; for (WORD l = 0; l < map.n_lines; l++) { rect_t r = map.l_getrect(l); double dist = distance_to_line(r.x1(), r.y1(), r.x2(), r.y2(), x, y); if (dist < min_dist) { min_dist = dist; line = l; } } return line; } // get_nearest_line_2: Gets the nearest line to a point // ------------------------------------------------- >> int get_nearest_line_2(double x, double y) { double min_dist = -1; int line = -1; for (WORD l = 0; l < map.n_lines; l++) { rect_t r = map.l_getrect(l); double dist = distance_to_line(r.x1(), r.y1(), r.x2(), r.y2(), x, y); if (min_dist == -1 && map.l_getsector1(l) != -1) { min_dist = dist; line = l; } else if (dist < min_dist && map.l_getsector1(l) != -1) { min_dist = dist; line = l; } } return line; } // clear_hilights: Clears hilighted map items depending on the editing mode // --------------------------------------------------------------------- >> void clear_hilights() { if (!lock_hilight) hilight_item = -1; } // clear_selection: Clears the selected items // --------------------------------------- >> void clear_selection() { selected_items.clear(); select_order.clear(); } bool selection() { if (selected_items.size() == 0) return false; else return true; } // determine_line_side: Determines what side of a line a certain point is on // ---------------------------------------------------------------------- >> bool determine_line_side(int line, float x, float y) { rect_t r; r.set(map.l_getrect(line)); r.tl.y = -r.tl.y; r.br.y = -r.br.y; float side = (-y - (float)r.y1()) * float(r.x2() - r.x1()) - (x - (float)r.x1()) * float(r.y2() - r.y1()); if (side > 0) return true; else return false; } // determine_line_side: Determines what side of a line a certain point is on // ---------------------------------------------------------------------- >> bool determine_line_side(rect_t r, float x, float y) { r.tl.y = -r.tl.y; r.br.y = -r.br.y; float side = (-y - (float)r.y1()) * float(r.x2() - r.x1()) - (x - (float)r.x1()) * float(r.y2() - r.y1()); if (side >= 0) return true; else return false; } // determine_line_side_f: Determines what side of a line a certain point is on // (returns the actual value so we can test for being exactly on the line) // ------------------------------------------------------------------------ >> float determine_line_side_f(rect_t r, float x, float y) { r.tl.y = -r.tl.y; r.br.y = -r.br.y; return (-y - (float)r.y1()) * float(r.x2() - r.x1()) - (x - (float)r.x1()) * float(r.y2() - r.y1()); } // determine_line_side: Determines what side of a line a certain point is on // ---------------------------------------------------------------------- >> bool determine_line_side(float x1, float y1, float x2, float y2, float x, float y) { float side = ((-y + y1) * (x2 - x1)) - ((x - x1) * (-y2 + y1)); if (side > 0) return true; else return false; } // determine_sector: Determines what sector a point lies in // (returns -1 if point is in the 'void') int determine_sector(double x, double y) { //draw_text(16, 16, COL_WHITE, 0, "%d %d", x, y); int line = get_nearest_line_2(x, y); if (line == -1) return -1; if (determine_line_side(line, x, y)) return map.l_getsector1(line); else return map.l_getsector2(line); } // get_hilight_item: Hilights the nearest item to the mouse pointer // (if any items are close enough) // ------------------------------------------------------------- >> void get_hilight_item(int x, int y) { if (lock_hilight) return; int old_hilight = hilight_item; clear_hilights(); if (edit_mode == 0) { hilight_item = get_nearest_vertex(x, y); if (old_hilight != hilight_item) update_vertex_info_bar(hilight_item); } if (edit_mode == 1) { hilight_item = get_nearest_line(m_x(x), -m_y(y)); if (old_hilight != hilight_item) update_line_info_bar(hilight_item); } if (edit_mode == 2) { hilight_item = determine_sector(m_x(x), -m_y(y)); if (old_hilight != hilight_item) update_sector_info_bar(hilight_item); } if (edit_mode == 3) { hilight_item = get_nearest_thing(m_x(x), -m_y(y)); if (old_hilight != hilight_item) update_thing_info_bar(hilight_item); } } // get_side_sector: Attempts to find what sector a line's side is in // -------------------------------------------------------------- >> int get_side_sector(int line, int side) { rect_t linerect = map.l_getrect(line); point2_t mid = midpoint(linerect.tl, linerect.br); point2_t vec(linerect.x2() - linerect.x1(), linerect.y2() - linerect.y1()); if (side == 2) { vec.x = -vec.x; vec.y = -vec.y; } int x = vec.y; int y = vec.x; x = -x; point2_t side_p(mid.x - x, mid.y - y); //printf("side %d\n", side); float min_dist = -1; int nearest_line = -1; point2_t nearest_midpoint; for (DWORD l = 0; l < map.n_lines; l++) { if (l != line) { rect_t line_r = map.l_getrect(l); int x1 = line_r.x1(); int x2 = line_r.x2(); int y1 = line_r.y1(); int y2 = line_r.y2(); point2_t r1 = mid; point2_t r2 = side_p; float u_ray = (float(x2 - x1) * float(r1.y - y1) - float(y2 - y1) * float(r1.x - x1)) / (float(y2 - y1) * float(r2.x - r1.x) - float(x2 - x1) * float(r2.y - r1.y)); float u_line = (float(r2.x - r1.x) * float(r1.y - y1) - float(r2.y - r1.y) * float(r1.x - x1)) / (float(y2 - y1) * float(r2.x - r1.x) - float(x2 - x1) * float(r2.y - r1.y)); if ((u_ray >= 0) &&/* (u_ray < 1) && */(u_line >= 0) && (u_line <= 1)) { if (u_ray < min_dist || min_dist == -1) { nearest_line = l; min_dist = u_ray; nearest_midpoint.set(midpoint(line_r.tl, line_r.br)); } if (u_ray == min_dist) { double nearest_mid_dist = distance_to_line(linerect.x1(), linerect.y1(), linerect.x2(), linerect.y2(), nearest_midpoint.x, nearest_midpoint.y); point2_t this_midpoint(midpoint(line_r.tl, line_r.br)); double this_mid_dist = distance_to_line(linerect.x1(), linerect.y1(), linerect.x2(), linerect.y2(), this_midpoint.x, this_midpoint.y); if (this_mid_dist < nearest_mid_dist) { nearest_line = l; min_dist = u_ray; nearest_midpoint.set(midpoint(line_r.tl, line_r.br)); } } } } } if (nearest_line == -1) { //printf("No intersection\n"); return -1; } else { if (determine_line_side(nearest_line, mid.x, mid.y)) return map.l_getsector1(nearest_line); else return map.l_getsector2(nearest_line); } } // select_item: Selects/Deselects the currently highlighted item // ---------------------------------------------------------- >> void select_item() { if (hilight_item == -1) return; if (vector_exists(selected_items, hilight_item)) { if (edit_mode == 0) select_order.erase(find(select_order.begin(), select_order.end(), hilight_item)); selected_items.erase(find(selected_items.begin(), selected_items.end(), hilight_item)); } else { if (edit_mode == 0) select_order.push_back(hilight_item); selected_items.push_back(hilight_item); } } // select_items_box: Selects items within the selection box // ----------------------------------------------------- >> void select_items_box(rect_t box) { int x1 = m_x(box.left()); int x2 = m_x(box.right()); int y1 = m_y(box.top()); int y2 = m_y(box.bottom()); // Vertices if (edit_mode == 0) { for (DWORD v = 0; v < map.n_verts; v++) { if (point_in_rect(x1, y1, x2, y2, map.verts[v]->x, -map.verts[v]->y)) { selected_items.push_back(v); select_order.push_back(v); } } } // Lines if (edit_mode == 1) { for (DWORD l = 0; l < map.n_lines; l++) { if (point_in_rect(x1, y1, x2, y2, map.l_getrect(l).x1(), -map.l_getrect(l).y1()) && point_in_rect(x1, y1, x2, y2, map.l_getrect(l).x2(), -map.l_getrect(l).y2())) selected_items.push_back(l); } } // Sectors if (edit_mode == 2) { for (DWORD l = 0; l < map.n_lines; l++) { int sector1 = map.l_getsector1(l); int sector2 = map.l_getsector2(l); if (point_in_rect(x1, y1, x2, y2, map.l_getrect(l).x1(), -map.l_getrect(l).y1()) && point_in_rect(x1, y1, x2, y2, map.l_getrect(l).x2(), -map.l_getrect(l).y2())) { if (sector1 != -1) selected_items.push_back(sector1); if (sector2 != -1) selected_items.push_back(sector2); } } } // Things if (edit_mode == 3) { for (DWORD t = 0; t < map.n_things; t++) { if (point_in_rect(x1, y1, x2, y2, map.things[t]->x, -map.things[t]->y)) selected_items.push_back(t); } } } // line_flip: Flips any hilighted/selected lines // ------------------------------------------ >> void line_flip(bool verts, bool sides) { if (selected_items.size() != 0) { for (DWORD l = 0; l < map.n_lines; l++) { if (vector_exists(selected_items, l)) { if (verts) map.l_flip(l); if (sides) map.l_flipsides(l); } } } else if (hilight_item != -1) { if (verts) map.l_flip(hilight_item); if (sides) map.l_flipsides(hilight_item); } if (verts) map.change_level(MC_NODE_REBUILD); //map_changelevel(3); else map.change_level(MC_LINES); //map_changelevel(2); } // sector_changeheight: Changes floor/ceiling height of hilighted or selected sector(s) // --------------------------------------------------------------------------------- >> void sector_changeheight(bool floor, int amount) { if (selected_items.size() == 0) { if (hilight_item != -1) map.s_changeheight(hilight_item, floor, amount); } else { for (DWORD s = 0; s < map.n_sectors; s++) { if (vector_exists(selected_items, s)) map.s_changeheight(s, floor, amount); } } if (hilight_item != -1) update_sector_info_bar(hilight_item); //map_changelevel(2); map.change_level(MC_LINES|MC_SSECTS); } // delete_vertex: Deletes the currently hilighted vertex or all selected vertices // --------------------------------------------------------------------------- >> void delete_vertex() { make_backup(true, false, true, false, false); if (selected_items.size() != 0) { vector<vertex_t *> del_verts; for (int a = 0; a < selected_items.size(); a++) del_verts.push_back(map.verts[selected_items[a]]); for (int a = 0; a < del_verts.size(); a++) map.delete_vertex(del_verts[a]); selected_items.clear(); } else { if (hilight_item != -1) map.delete_vertex(hilight_item); } hilight_item = -1; //remove_free_verts(); //map_changelevel(3); map.change_level(MC_NODE_REBUILD); } // delete_line: Deletes the currently hilighted line or all selected lines // -------------------------------------------------------------------- >> void delete_line() { make_backup(true, false, true, false, false); if (selected_items.size() != 0) { vector<linedef_t *> del_lines; for (int a = 0; a < selected_items.size(); a++) del_lines.push_back(map.lines[selected_items[a]]); for (int a = 0; a < del_lines.size(); a++) map.delete_line(del_lines[a]); selected_items.clear(); } else { if (hilight_item != -1) map.delete_line(hilight_item); } hilight_item = -1; remove_free_verts(); //map_changelevel(3); map.change_level(MC_NODE_REBUILD); } // delete_thing: Deletes the currently hilighted thing or all selected things // ----------------------------------------------------------------------- >> void delete_thing() { make_backup(false, false, false, false, true); if (selected_items.size() != 0) { vector<thing_t *> del_things; for (int a = 0; a < selected_items.size(); a++) del_things.push_back(map.things[selected_items[a]]); for (int a = 0; a < del_things.size(); a++) map.delete_thing(del_things[a]); selected_items.clear(); } else { if (hilight_item != -1) map.delete_thing(hilight_item); } hilight_item = -1; //map_changelevel(2); map.change_level(MC_THINGS); } // delete_sector: Deletes the currently hilighted sector or all selected sectors // -------------------------------------------------------------------------- >> void delete_sector() { make_backup(true, true, false, true, false); if (selected_items.size() != 0) { vector<sector_t *> del_sectors; for (int a = 0; a < selected_items.size(); a++) del_sectors.push_back(map.sectors[selected_items[a]]); for (int a = 0; a < del_sectors.size(); a++) map.delete_sector(del_sectors[a]); selected_items.clear(); } else { if (hilight_item != -1) map.delete_sector(hilight_item); } hilight_item = -1; //map_changelevel(3); map.change_level(MC_NODE_REBUILD); } // map_changelevel: Sets the map_changed variable, ignores the change if not applicable // --------------------------------------------------------------------------------- >> void map_changelevel(int level) { if (level > map_changed) map_changed = level; } // create_vertex: Adds a vertex at the mouse pointer and splits a line if it's close enough // ------------------------------------------------------------------------------------- >> void create_vertex() { point2_t point(snap_to_grid(m_x(mouse.x)), snap_to_grid(-m_y(mouse.y))); if (map.v_checkspot(point.x, point.y)) { int split_line = check_vertex_split(point); if (split_line != -1) { make_backup(true, true, true, false, false); map.add_vertex(point.x, point.y); map.l_split(split_line, map.n_verts - 1); } else { make_backup(false, false, true, false, false); map.add_vertex(point.x, point.y); } } else return; //map_changelevel(2); map.change_level(MC_LINES); } // create_lines: Creates lines between vertices in the select_order array // (joins the last vertex to the first if close is true) // ------------------------------------------------------------------- >> void create_lines(bool close) { if (select_order.size() < 2) return; make_backup(true, false, false, false, false); vector<int> lines; for (WORD p = 0; p < select_order.size() - 1; p++) lines.push_back(map.add_line(select_order[p], select_order[p + 1])); if (close) { if (select_order.size() > 2) { lines.push_back(map.add_line(select_order[select_order.size() - 1], select_order[0])); //if (check_overlapping_lines(&lines)) // merge_overlapping_lines(&lines); } /* else if (select_order.n_numbers == 2) { ldraw_points.add(map.v_getpoint(select_order.numbers[0]), true); ldraw_points.add(map.v_getpoint(select_order.numbers[1]), true); ldraw_points.add(map.v_getpoint(select_order.numbers[1]), false); end_linedraw(); edit_mode = 1; clear_selection(); return; } */ } clear_selection(); edit_mode = 1; for (WORD l = 0; l < lines.size(); l++) selected_items.push_back(lines[l]); lines.clear(); //map_changelevel(3); map.change_level(MC_NODE_REBUILD); } // create_sector: Creates a sector out of selected lines // -------------------------------------------------- >> void create_sector() { int sector = map.add_sector(); int side = -1; make_backup(true, true, false, true, false); for (DWORD l = 0; l < map.n_lines; l++) { if (vector_exists(selected_items, l)) { side = map.add_side(); map.sides[side]->sector = sector; if (map.lines[l]->side1 == -1) map.lines[l]->side1 = side; else if (map.lines[l]->side2 == -1) { map.lines[l]->side2 = side; map.lines[l]->flags = LINE_TWOSIDED; memcpy(map.sectors[sector], map.sectors[map.sides[map.lines[l]->side1]->sector], sizeof(sector_t)); } if (map.lines[l]->side2 == -1) map.lines[l]->flags = LINE_IMPASSIBLE; map.l_setdeftextures(l); } } clear_selection(); selected_items.push_back(sector); edit_mode = 2; //map_changelevel(3); map.change_level(MC_NODE_REBUILD); } // create_thing: Creates a thing at the mouse pointer, with properties taken from the last thing edited // ------------------------------------------------------------------------------------------------- >> void create_thing() { make_backup(false, false, false, false, true); map.add_thing(snap_to_grid(m_x(mouse.x)), snap_to_grid(-m_y(mouse.y)), last_thing); map.things[map.n_things - 1]->ttype = get_thing_type(last_thing.type); //map_changelevel(2); map.change_level(MC_THINGS); } // check_vertex_split: Checks if a vertex is close enough to a line to split it // ------------------------------------------------------------------------- >> int check_vertex_split(DWORD vertex) { int split_line = -1; short vx = map.verts[vertex]->x; short vy = map.verts[vertex]->y; if (gridsize == 1) return -1; for (DWORD l = 0; l < map.n_lines; l++) { rect_t r = map.l_getrect(l); if (distance_to_line(r.x1(), r.y1(), r.x2(), r.y2(), vx, vy) < 2 && map.lines[l]->vertex1 != vertex && map.lines[l]->vertex2 != vertex) return l; } return -1; } // check_vertex_split: Checks if a point is close enough to a line to split it // ------------------------------------------------------------------------ >> int check_vertex_split(point2_t p) { int split_line = -1; int vertex = map.v_getvertatpoint(p); if (gridsize == 1) return -1; for (DWORD l = 0; l < map.n_lines; l++) { rect_t r = map.l_getrect(l); if (distance_to_line(r.x1(), r.y1(), r.x2(), r.y2(), p.x, p.y) < 2 && map.lines[l]->vertex1 != vertex && map.lines[l]->vertex2 != vertex) return l; } return -1; } // merge_verts: Merges all vertices in the map // ---------------------------------------- >> void merge_verts() { for (DWORD v = 0; v < map.n_verts; v++) map.v_mergespot(map.verts[v]->x, map.verts[v]->y); //map_changelevel(3); map.change_level(MC_NODE_REBUILD); //remove_free_verts(); } // check_overlapping_lines: Checks if lines in a list are overlapping any map lines // ----------------------------------------------------------------------------- >> bool check_overlapping_lines(vector<int> lines) { for (DWORD a = 0; a < lines.size(); a++) { int l2 = lines[a]; for (DWORD l = 0; l < map.n_lines; l++) { if (l != l2) { if (map.lines[l]->vertex1 == map.lines[l2]->vertex1 && map.lines[l]->vertex2 == map.lines[l2]->vertex2) return true; if (map.lines[l]->vertex1 == map.lines[l2]->vertex1 && map.lines[l]->vertex2 == map.lines[l2]->vertex1) return true; //if (check_vertex_split(map.lines[l]->vertex1) != -1 || //check_vertex_split(map.lines[l]->vertex2) != -1) //return true; } } } return false; } // merge_overlapping_lines: Merges any overlapping lines (only if they are in the list given) // --------------------------------------------------------------------------------------- >> void merge_overlapping_lines(vector<int> lines) { for (DWORD a = 0; a < lines.size(); a++) { int l2 = lines[a]; for (DWORD l = 0; l < map.n_lines; l++) { if (l != l2) { if (map.lines[l]->vertex1 == map.lines[l2]->vertex1 && map.lines[l]->vertex2 == map.lines[l2]->vertex2) { int sector1 = get_side_sector(l, 1); int sector2 = get_side_sector(l, 2); if (sector1 != -1) map.l_setsector(l, 1, sector1); if (sector2 != -1) map.l_setsector(l, 2, sector2); map.delete_line(l2); break; } if (map.lines[l]->vertex1 == map.lines[l2]->vertex1 && map.lines[l]->vertex2 == map.lines[l2]->vertex1) { int sector1 = get_side_sector(l, 1); int sector2 = get_side_sector(l, 2); if (sector1 != -1) map.l_setsector(l, 1, sector1); if (sector2 != -1) map.l_setsector(l, 2, sector2); map.delete_line(l2); break; } /* if (check_vertex_split(map.lines[l]->vertex1) != -1 && map.lines[l]->vertex1 != map.lines[l2]->vertex1 && map.lines[l]->vertex1 != map.lines[l2]->vertex2) lines->add(map.l_split(l2, map.lines[l]->vertex1), true); if (check_vertex_split(map.lines[l]->vertex2) != -1 && map.lines[l]->vertex2 != map.lines[l2]->vertex1 && map.lines[l]->vertex2 != map.lines[l2]->vertex2) lines->add(map.l_split(l2, map.lines[l]->vertex2), true); */ } } } map.change_level(MC_NODE_REBUILD); //map_changelevel(3); } void change_edit_mode(int mode) { edit_mode = mode; hilight_item = -1; clear_selection(); force_map_redraw(true, false); change_infobar_page(); } // init_map: Focuses on the center of the map & inits 3d camera // --------------------------------------------------------- >> void init_map() { int max_x = 0; int min_x = 0; int max_y = 0; int min_y = 0; for (DWORD v = 0; v < map.n_verts; v++) { if (map.verts[v]->x < min_x) min_x = map.verts[v]->x; if (map.verts[v]->x > max_x) max_x = map.verts[v]->x; if (map.verts[v]->y < min_y) min_y = map.verts[v]->y; if (map.verts[v]->y > max_y) max_y = map.verts[v]->y; } xoff = -(min_x + ((max_x - min_x) / 2)) / MAJOR_UNIT; yoff = (min_y + ((max_y - min_y) / 2)) / MAJOR_UNIT; // Init camera point3_t pos(0.0f, 0.0f, 0.0f); point3_t view(0.0f, 1.0f, 0.0f); pos.z = 0.0f; for (int t = 0; t < map.n_things; t++) { if (map.things[t]->type == 1) { pos.x = map.things[t]->x * SCALE_3D; pos.y = map.things[t]->y * SCALE_3D; int sector = determine_sector(map.things[t]->x, map.things[t]->y); if (sector != -1) pos.z = (map.sectors[sector]->f_height + 40) * SCALE_3D; if (map.things[t]->angle == 0) // east view.set(1.0f, 0.0f, 0.0f); else if (map.things[t]->angle == 45) // northeast view.set(0.7f, 0.7f, 0.0f); else if (map.things[t]->angle == 90) // north view.set(0.0f, 1.0f, 0.0f); else if (map.things[t]->angle == 135) // northwest view.set(-0.7f, 0.7f, 0.0f); else if (map.things[t]->angle == 180) // west view.set(-1.0f, 0.0f, 0.0f); else if (map.things[t]->angle == 225) // southwest view.set(-0.7f, -0.7f, 0.0f); else if (map.things[t]->angle == 270) // south view.set(0.0f, -1.0f, 0.0f); else if (map.things[t]->angle == 315) // southeast view.set(0.7f, -0.7f, 0.0f); else view.set(1.0f, 0.0f, 0.0f); } } camera.position.set(pos); camera.view.set(pos + view); //map_changelevel(3); map.change_level(255); } // get_angle: Gets a doom thing angle from two points // ----------------------------------------------- >> short get_angle(point2_t origin, point2_t point) { // Get a direction vector point2_t vec(point.x - origin.x, point.y - origin.y); float mag = (float)sqrt(float((vec.x * vec.x) + (vec.y * vec.y))); float x = vec.x / mag; float y = vec.y / mag; //draw_text(s_x(origin.x), s_y(origin.y), COL_WHITE, 0, "%1.2f, %1.2f", x, y); //draw_text(s_x(point.x), s_y(point.y), COL_WHITE, 0, "%d, %d", vec.x, vec.y); if (x > 0.89) // east return 0; if (x < -0.89) // west return 180; if (y > 0.89) // north return 90; if (y < -0.89) // south return 270; if (x > 0 && y > 0) // northeast return 45; if (x < 0 && y > 0) // northwest return 135; if (x < 0 && y < 0) // southwest return 225; if (x > 0 && y < 0) // southeast return 315; return 0; } void thing_setquickangle() { point2_t m_mouse(m_x(mouse.x), -m_y(mouse.y)); if (selected_items.size() != 0) { for (DWORD a = 0; a < selected_items.size(); a++) { int t = selected_items[a]; map.things[t]->angle = get_angle(point2_t(map.things[t]->x, map.things[t]->y), m_mouse); } } else if (hilight_item != -1) { map.things[hilight_item]->angle = get_angle(point2_t(map.things[hilight_item]->x, map.things[hilight_item]->y), m_mouse); last_thing.angle = get_angle(point2_t(map.things[hilight_item]->x, map.things[hilight_item]->y), m_mouse); } //update_map(); }
[ "veilofsorrow@0f6d0948-3201-0410-bbe6-95a89488c5be" ]
[ [ [ 1, 1212 ] ] ]
27a96f8c59831acaf002955a7f0a7744ee4119fb
d7b345a8a6b0473c325fab661342de295c33b9c8
/beta/src/polaris/stdafx.h
0f9989c94470808f4c8bf6fa7cb4c11f70d8705c
[]
no_license
raould/Polaris-Open-Source
67ccd647bf40de51a3dae903ab70e8c271f3f448
10d0ca7e2db9e082e1d2ed2e43fa46875f1b07b2
refs/heads/master
2021-01-01T19:19:39.148016
2010-05-10T17:39:26
2010-05-10T17:39:26
631,953
3
2
null
null
null
null
UTF-8
C++
false
false
452
h
// Copyright 2010 Hewlett-Packard under the terms of the MIT X license // found at http://www.opensource.org/licenses/mit-license.html #pragma once //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers. #define _WIN32_WINNT 0x0500 // List additional headers your program requires here. #include <windows.h> #include <userenv.h> #include <assert.h> #include <time.h> #include <string> #include <vector> #include "utils.h"
[ [ [ 1, 18 ] ] ]
24a46b77962f4f281e3a26fc0aa0b2fbf39d1839
f67e1c73e66314bdab4b5a995a2986b67d65fafc
/Tower-D/src/Tower1.cpp
c5086be6b426c0b984c25c658d3f88ddb4663b0c
[]
no_license
sschand/csueb-cs4310-group2-cpp
7caddf9898008ded44ff62ed93cc1cc96505e8c7
97e6148ba7d380f3c4b57bc403cb484d9bfe966a
refs/heads/master
2021-01-10T21:52:21.891530
2011-12-01T05:50:32
2011-12-01T05:50:32
39,962,649
0
0
null
null
null
null
UTF-8
C++
false
false
1,510
cpp
#include "include/Tower1.h" /*Tower1 /.cpp file for Tower1 class / / Created by : Emilio E. Venegas / Sharol Chand / Paola Medina / / 10/31/11 */ void Tower1::setTower1(int fp, bool cv, int sp, int gn,int ss, int c, int t) { damage = fp; enemyInSight = cv; shotCounter = sp; Grid_Number = gn; Shot_Speed= ss; Cost = c; tower_type=t; } int Tower1::getGrid_Number() { return Grid_Number; } void Tower1::setGrid_Number(int Gn) { Grid_Number = Gn; } int Tower1::getDamage() { return damage; } int Tower1::getShotCounter() { return shotCounter; } void Tower1::setDamage(int d) { damage = d; } void Tower1::setshotCounter(int s_counter) { shotCounter = s_counter; } void Tower1::takeShot() { shotCounter++; } void Tower1::resetShotCounter() { shotCounter = 0; } bool Tower1::enemyIsInSight() { return enemyInSight; } void Tower1::setSight(bool enemyInSght) { enemyInSight = enemyInSght; } int Tower1::getIndex_tower_type() { return getIndex();//inherited from Graphics Item. } bool Tower1::getEnemyinSight() { return enemyInSight; } int Tower1::getShotSpeed() { return Shot_Speed; } void Tower1::setShotSpeed(int ss) { Shot_Speed= ss; } int Tower1::getCost() { return Cost; } void Tower1::setCost(int c) { Cost = c; } int Tower1::get_Tower_type() { return tower_type; }
[ "[email protected]", "budador@af8411b0-a30e-eea6-a620-e933f664f179" ]
[ [ [ 1, 12 ], [ 14, 18 ], [ 22, 82 ], [ 91, 91 ] ], [ [ 13, 13 ], [ 19, 21 ], [ 83, 90 ], [ 92, 104 ] ] ]
ff4ef1c4cdd9e6a46612d444cf429cffb861ab55
3af6c2119743037b41eee8a46244ade56a2ac3e3
/Cpp/Box2D/Joints/Box2dJointEdgeRef.h
928590d12c93e3c09100063b1d40a0d0416efd64
[ "MIT" ]
permissive
TheProjecter/tgb-box2d-integration
16f848a8deb89d4ecbd4061712c385c19225b1b7
85cbc6e45f563dafc0b05e75a8f08338e1a5941a
refs/heads/master
2021-01-10T19:20:19.741374
2009-05-02T12:35:20
2009-05-02T12:35:20
42,947,643
0
0
null
null
null
null
UTF-8
C++
false
false
2,161
h
//============================================================================= // Box2dJointEdgeRef.h //============================================================================= /* TGB-Box2D-Integration (http://code.google.com/p/tgb-box2d-integration/) Copyright (c) 2009 Michael Woerister Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _BOX2D_JOINTEDGE_REF_H_ #define _BOX2D_JOINTEDGE_REF_H_ #include "console/simBase.h" #include "Box2D.h" class Box2dBodyRef; class Box2dJointRef; //============================================================================= // class Box2dJointEdgeRef //============================================================================= class Box2dJointEdgeRef : public SimObject { public: Box2dJointEdgeRef( b2JointEdge *jointEdge = NULL ); virtual ~Box2dJointEdgeRef(); Box2dJointRef *getJoint() const; Box2dBodyRef *getOther() const; Box2dJointEdgeRef *getNext() const; Box2dJointEdgeRef *getPrev() const; DECLARE_CONOBJECT(Box2dJointEdgeRef); private: typedef SimObject Parent; const b2JointEdge *mJointEdge; }; #endif
[ "michaelwoerister@f3bf45be-f2fd-11dd-89c5-9df526a60542" ]
[ [ [ 1, 56 ] ] ]
5fd573010581a1b966341c45b6c41bbbaeda6834
ba200ae9f30b89d1e32aee6a6e5ef2c991cee157
/trunk/GosuImpl/Sockets/ListenerSocket.cpp
d4e6b94916687bf13e6e701ff6bf840fb4a45f73
[ "MIT" ]
permissive
clebertavares/gosu
1d5fd08d22825d18f2840dfe1c53c96f700b665f
e534e0454648a4ef16c7934d3b59b80ac9ec7a44
refs/heads/master
2020-04-08T15:36:38.697104
2010-02-20T16:57:25
2010-02-20T16:57:25
537,484
1
0
null
null
null
null
UTF-8
C++
false
false
1,536
cpp
#include <Gosu/Sockets.hpp> #include <GosuImpl/Sockets/Sockets.hpp> #include <cassert> #include <cstring> struct Gosu::ListenerSocket::Impl { Socket socket; }; Gosu::ListenerSocket::ListenerSocket(SocketPort port) : pimpl(new Impl) { pimpl->socket.setHandle(socketCheck(::socket(AF_INET, SOCK_STREAM, 0))); pimpl->socket.setBlocking(false); int enable = 1; socketCheck(::setsockopt(pimpl->socket.handle(), SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&enable), sizeof enable)); sockaddr_in addr; std::memset(&addr, 0, sizeof addr); addr.sin_family = AF_INET; // addr.sin_addr.S_un.S_addr = ::htonl(INADDR_ANY); addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = htons(port); socketCheck(::bind(pimpl->socket.handle(), reinterpret_cast<sockaddr*>(&addr), sizeof addr)); socketCheck(::listen(pimpl->socket.handle(), 10)); } Gosu::ListenerSocket::~ListenerSocket() { } Gosu::SocketAddress Gosu::ListenerSocket::address() const { return pimpl->socket.address(); } Gosu::SocketPort Gosu::ListenerSocket::port() const { return pimpl->socket.port(); } void Gosu::ListenerSocket::update() { while (onConnection) { SocketHandle newHandle = socketCheck(::accept(pimpl->socket.handle(), 0, 0)); if (newHandle == INVALID_SOCKET) break; Socket newSocket; newSocket.setHandle(newHandle); onConnection(newSocket); } }
[ [ [ 1, 60 ] ] ]
f52dd70f8cce7031dde7fc27508c6cf1a3a06247
3ecc6321b39e2aedb14cb1834693feea24e0896f
/include/font.h
622d455f95753e4d28fa526e55864493603458f2
[]
no_license
weimingtom/forget3d
8c1d03aa60ffd87910e340816d167c6eb537586c
27894f5cf519ff597853c24c311d67c7ce0aaebb
refs/heads/master
2021-01-10T02:14:36.699870
2011-06-24T06:21:14
2011-06-24T06:21:14
43,621,966
1
1
null
null
null
null
UTF-8
C++
false
false
3,441
h
/***************************************************************************** * Copyright (C) 2009 The Forget3D Project by Martin Foo ([email protected]) * ALL RIGHTS RESERVED * * License I * Permission to use, copy, modify, and distribute this software for * any purpose and WITHOUT a fee is granted under following requirements: * - You make no money using this software. * - The authors and/or this software is credited in your software or any * work based on this software. * * Licence II * Permission to use, copy, modify, and distribute this software for * any purpose and WITH a fee is granted under following requirements: * - As soon as you make money using this software, you have to pay a * licence fee. Until this point of time, you can use this software * without a fee. * Please contact Martin Foo ([email protected]) for further details. * - The authors and/or this software is credited in your software or any * work based on this software. * * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHORS * BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, * INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, SAVINGS OR * REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR NOT THE AUTHORS HAVE * BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. *****************************************************************************/ #ifndef F3D_FONT_H_ #define F3D_FONT_H_ #include "f3d.h" #include "image.h" namespace F3D { /** * Font class for all games using F3D. */ class Font { private: GLuint m_charWidth; GLuint m_charHeight; GLuint m_colCount; GLuint m_rowCount; GLuint m_fontWidth; GLuint m_fontHeight; Texture* m_texture; Color4f* m_color; //private functions void createFont(GLuint charWidth, GLuint charHeight, GLuint fontWidth, GLuint fontHeight, const char *texName, GLboolean is_absPath = GL_FALSE); public: /** * Constructor */ Font(GLuint charWidth, GLuint charHeight, const char *texName, GLboolean is_absPath = GL_FALSE); // the texName is absolute path? //another font constructor with real draw font width,height Font(GLuint charWidth, GLuint charHeight, GLuint fontWidth, GLuint fontHeight, const char *texName, GLboolean is_absPath = GL_FALSE); /** * Destructor */ virtual ~Font(); void drawString(int x, int y, const char *str, DrawAnchor anchor = BOTTOM_LEFT); void drawString(int x, int y, int fontWidth, int fontHeight, const char *str, DrawAnchor anchor = BOTTOM_LEFT); GLuint getFonWidth(); GLuint getFonHeight(); //font color void setFontColor(Color4f* color); Color4f* getFontColor(); }; } #endif /* F3D_FONT_H_ */
[ "i25ffz@8907dee8-4f14-11de-b25e-a75f7371a613" ]
[ [ [ 1, 94 ] ] ]
0917e179038b0919d5e9da05dffef53878a4ff5c
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Physics/Utilities/Dynamics/SaveContactPoints/hkpPhysicsSystemWithContacts.h
3d742df12e2ad0d79d5be15b57b9f9d23daf4e35
[]
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
3,429
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_DYNAMICS2_PHYSICS_SYSTEM_WITH_CONTACTS_H #define HK_DYNAMICS2_PHYSICS_SYSTEM_WITH_CONTACTS_H #include <Physics/Dynamics/World/hkpPhysicsSystem.h> struct hkpSerializedAgentNnEntry; /// A class to group collections of objects, which typically are serialized together, /// and should be added and removed from the world together. /// Examples are a ragdoll, and a vehicle. class hkpPhysicsSystemWithContacts : public hkpPhysicsSystem { public: HK_DECLARE_CLASS_ALLOCATOR(HK_MEMORY_CLASS_WORLD); HK_DECLARE_REFLECTION(); hkpPhysicsSystemWithContacts() {} virtual ~hkpPhysicsSystemWithContacts(); /// Return a copy of the system, in which all items /// are clones of the originals, sharing as much data /// as possible (eg: shapes, constraintdata, etc) virtual hkpPhysicsSystem* clone() const; /// Shallow copy a system. Just copies arrays of ptrs. void copy(const hkpPhysicsSystemWithContacts& toCopy); /// Add an action to the list void addContact( hkpSerializedAgentNnEntry* c ); /// Remove a contact from the list /// It does a quick remove, so will not preserve /// the order of the list void removeContact( int i ); /// Get the held contact information inline const hkArray<hkpSerializedAgentNnEntry*>& getContacts() const; /// Gets non-const version of contact points information. /// It is recommended to use add/removeContact() instead, as they handle reference counting for the serialized entries. inline hkArray<hkpSerializedAgentNnEntry*>& getContactsRw(); virtual hkBool hasContacts() { return true; } protected: /// Note, ALL these arrays contain reference counted instances. /// The destructor for the system will decrement the references on all held objects /// so it assumes that when you fill out these arrays that you give it a referenced /// count incremented object hkArray<struct hkpSerializedAgentNnEntry*> m_contacts; public: hkpPhysicsSystemWithContacts( hkFinishLoadedObjectFlag f ) : hkpPhysicsSystem(f), m_contacts(f) { } }; #include <Physics/Utilities/Dynamics/SaveContactPoints/hkpPhysicsSystemWithContacts.inl> #endif // HK_DYNAMICS2_PHYSICS_SYSTEM_WITH_CONTACTS_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, 86 ] ] ]
6af09fcdc37066debdeec5002b62651990ae983b
cd61c8405fae2fa91760ef796a5f7963fa7dbd37
/Sauron/Sonar/SonarModel.cpp
58bf69ecb2d83b2c46162a0985d5b1acee5e0520
[]
no_license
rafaelhdr/tccsauron
b61ec89bc9266601140114a37d024376a0366d38
027ecc2ab3579db1214d8a404d7d5fa6b1a64439
refs/heads/master
2016-09-05T23:05:57.117805
2009-12-14T09:41:58
2009-12-14T09:41:58
32,693,544
0
0
null
null
null
null
ISO-8859-1
C++
false
false
17,287
cpp
#include "SonarModel.h" #include <cassert> #include <boost/numeric/ublas/matrix.hpp> #include "log.h" #define SONAR_LOG(level) FILE_LOG(level) << "SonarModel #" << m_sonarNumber << ": " #include "MathHelper.h" #include "Line.h" #include "Cone.h" // A definição _CLR_ é ativada quando o projeto está sendo compilado // para testes unitários. Por algum motivo cósmico, a mera inclusão do // header do mutex do Boost faz com que os testes não carreguem. #ifndef _CLR_ #define SCOPED_READINGS_LOCK() boost::recursive_mutex::scoped_lock __lock__(m_readingsMutex) #else #define SCOPED_READINGS_LOCK() #endif namespace sauron { SonarModel::SonarModel(int sonarNumber, const sauron::Pose& sonarPose) : m_sonarNumber(sonarNumber), m_sonarX(sonarPose.X()), m_sonarY(sonarPose.Y()), m_sonarTheta(sonarPose.getTheta()), m_readings(sauron::configs::sonars::circularBufferLength), m_isTracking(false), m_tracking(sonarNumber){ } SonarModel::SonarModel(int sonarNumber, pose_t x, pose_t y, pose_t theta) : m_sonarNumber(sonarNumber),m_sonarX(x), m_sonarY(y), m_sonarTheta(theta), m_readings(sauron::configs::sonars::circularBufferLength), m_isTracking(false), m_tracking(sonarNumber){ } bool SonarModel::addReading(const SonarReading& reading, const Pose& estimatedPose) { SCOPED_READINGS_LOCK(); if(robotHasTurned(estimatedPose)) { SONAR_LOG(logDEBUG2) << "Robô virou @ " << estimatedPose; m_tracking.reset(); m_isTracking = false; m_readings.clear(); return false; } ReadingAndPose rnp(reading, estimatedPose); if(reading.getReading() > configs::sonars::invalidReading) { SONAR_LOG(logDEBUG1) << "Leitura misteriosa de " << reading.getReading() << " recebida e ignorada @ " << estimatedPose; return false; } if(isReadingMeaningful(rnp)) { SONAR_LOG(logDEBUG2) << "Leitura significativa: " << rnp.reading.getReading() << " @ " << rnp.estimatedPose; m_readings.push_back(rnp); return true; } else { SONAR_LOG(logDEBUG2) << "Leitura NÃO-significativa: " << rnp.reading.getReading() << " @ " << rnp.estimatedPose; } return false; } bool SonarModel::robotHasTurned(const Pose& latestPose) { SCOPED_READINGS_LOCK(); if(m_readings.size() > 0) { return trigonometry::angularDistance( latestPose.Theta(), getOldestReading().estimatedPose.Theta()) > configs::sonars::minimumRobotTurnAngle; } else { return false; } } bool SonarModel::isReadingMeaningful(const ReadingAndPose& readingAndPose) { if(m_readings.size() > 0) { pose_t distMoved = readingAndPose.estimatedPose.getDistance(getLatestReading().estimatedPose); return distMoved > configs::sonars::minimumRobotDistance; } else { return true; } } double SonarModel::getSonarAngleOfIncidence() { return this->m_sonarTheta + ::asin(getSinAlpha()); } Line SonarModel::getObservedLine() { SCOPED_READINGS_LOCK(); double beta_rads = getSonarAngleOfIncidence(); Pose sonarPose = getSonarGlobalPose(getLatestReading().estimatedPose); pose_t thetaWall_rads = trigonometry::PI / 2 - beta_rads + sonarPose.getTheta() ; double reading = getLatestReading().reading * ::sin(beta_rads); double x_times_cos = sonarPose.X() * ::cos(thetaWall_rads); double y_times_sin = sonarPose.Y() * ::sin(thetaWall_rads); pose_t rWall = reading + x_times_cos + y_times_sin ; return Line(rWall, thetaWall_rads); } double SonarModel::getTheoreticalAngleOfIncidence(const Pose& pose, const Line& line) { return this->m_sonarTheta + pose.Theta() + (trigonometry::PI/2 - line.getTheta()); } SonarReading SonarModel::getTheoreticalExpectedReadingByMapLine(const Pose& pose, const LineSegment& lineSegment) { SCOPED_READINGS_LOCK(); sauron::Line line = lineSegment.getSauronLine(); sauron::Pose sonarPose = this->getSonarGlobalPose(pose); //double beta_rads = getSonarAngleOfIncidence(); double beta_rads = getTheoreticalAngleOfIncidence(pose, line); double x_times_cos = sonarPose.X() * ::cos(line.getTheta()); double y_times_sin = sonarPose.Y() * ::sin(line.getTheta()); // expectedReading = (R_wall - X_sonar * cos Th_wall - Y_sonar * sin Th_wall) / sin Beta double expectedReading = (line.getRWall() - x_times_cos - y_times_sin) / ::sin(beta_rads); // HACK não sei ao certo por que às vezes a leitura esperada é negativa. Isso conserta // o teste SonarTest3::ExpectedReadingTest2_S3 SONAR_LOG(logDEBUG2) << "Leitura Esperada: " << expectedReading << " (rWall = " << line.getRWall() << "; thetaWall = " << line.getTheta() << "; beta = " << beta_rads << " rads; sonarGlobalPose =" << sonarPose << ")"; return expectedReading > 0 ? expectedReading : -expectedReading; } SonarReading SonarModel::getExpectedReadingByMapLine(const Pose& pose, const LineSegment& lineSegment) { SCOPED_READINGS_LOCK(); sauron::Line line = lineSegment.getSauronLine(); sauron::Pose sonarPose = this->getSonarGlobalPose(pose); double beta_rads = getSonarAngleOfIncidence(); double x_times_cos = sonarPose.X() * ::cos(line.getTheta()); double y_times_sin = sonarPose.Y() * ::sin(line.getTheta()); // expectedReading = (R_wall - X_sonar * cos Th_wall - Y_sonar * sin Th_wall) / sin Beta double expectedReading = (line.getRWall() - x_times_cos - y_times_sin) / ::sin(beta_rads); // HACK não sei ao certo por que às vezes a leitura esperada é negativa. Isso conserta // o teste SonarTest3::ExpectedReadingTest2_S3 SONAR_LOG(logDEBUG2) << "Leitura Esperada: " << expectedReading << " (rWall = " << line.getRWall() << "; thetaWall = " << line.getTheta() << "; beta = " << beta_rads << " rads; sonarGlobalPose =" << sonarPose << ")"; return expectedReading > 0 ? expectedReading : -expectedReading; } bool SonarModel::validateReadings() { SCOPED_READINGS_LOCK(); /** * Algoritmo: * - verificar se o número de leituras, k, é >= a k_min * - calcular gamma para cada par de leituras * - obtém a variância e a média dos gammas * - calcula variancia_obsmedia * - calcula chi-quadrado dos gammas * - valida a hipótese * - obtém thetaWall e rWall **/ int k = m_readings.size(); if(k < configs::sonars::kMin) { return false; } /* gamma (pág 49 da tese do barra) é a razão entre a diferença do resultado dos sonares em duas leituras consecutivas e a distância percorrida entre essas leituras. Idealmente, esse valor se mantém constante no caso de obser- varmos um movimento retilíneo. como há k leituras, haverá k-1 gammas. */ const std::vector<double> gammas = getGammas(); double gamma_mean = statistics::mean(gammas); double gamma_variance = statistics::sample_variance(gammas, gamma_mean); double obsmedia_variance = getObsMediaVariance(); return statistics::chiSquareNormalDistributionTest( gammas.size(), gamma_variance, obsmedia_variance, configs::sonars::readingValidationAlpha); } std::vector<double> SonarModel::getGammas() { SCOPED_READINGS_LOCK(); int k = m_readings.size(); std::vector<double> gammas(k-1); // começa em 1 mesmo, porque fazemos m_readings[i] - m_readings[i-1] for(int i = 1; i < k; i++) { reading_t diff_readings = m_readings[i].reading - m_readings[i-1].reading; double diff_pose = m_readings[i].estimatedPose.getDistance(m_readings[i-1].estimatedPose); gammas.at(i-1) = diff_readings / diff_pose; } return gammas; } /** Página 50 da tese **/ double SonarModel::getObsMediaVariance() { using namespace boost::numeric; SCOPED_READINGS_LOCK(); double sin_alpha = getSinAlpha(); assert(!(sin_alpha > 1.0 || sin_alpha < -1.0)); double s2_d = getS2_D(); double s2_r = getS2_R(); ublas::matrix<double> eqCovar(2,2); eqCovar(0,0) = s2_d; eqCovar(0,1) = s2_d * sin_alpha; eqCovar(1,0) = s2_d * sin_alpha; eqCovar(1,1) = 2 * s2_r + s2_d * sin_alpha; ublas::vector<double> F(2); double d_robot = getD_Robot(); F(0) = -1.0 * (m_readings.size() - 1) * getD_Sonar() / (d_robot * d_robot); F(1) = (m_readings.size() - 1) / d_robot; ublas::vector<double> prod = ublas::prod(eqCovar, F); return algelin::scalarProduct(prod, F); } double SonarModel::getSinAlpha() { SCOPED_READINGS_LOCK(); // sin(alpha) = 1 / (d_robot / d_sonar), onde // d_robot = distância percorrida pelo robô = // dist_euclideana(última_posição_estimada,primeira_posição_estimada) // d_sonar = última_leitura_sonar - primeira_leitura_sonar // Note que o significado de "último" aqui é "mais recente" (o oposto à tese). double d_sonar = getD_Sonar();// * ::cos(this->m_sonarTheta); double d_robot = getD_Robot(); for(int i = 0; i < m_readings.size(); i++) { SONAR_LOG(logDEBUG2) << "( " << m_readings[i].reading.getReading() << " @ " << m_readings[i].estimatedPose << " ) "; } // cosine law double x = ::sqrt(d_sonar * d_sonar + d_robot * d_robot - 2 * d_sonar * d_robot * ::cos(this->m_sonarTheta)); // sine law double sinAlpha = d_sonar * ::sin(this->m_sonarTheta) / x; SONAR_LOG(logDEBUG2) << "getSinAlpha: " << "d_sonar = " << d_sonar << "; d_robot = " << d_robot << "; sonarTheta = " << this->m_sonarTheta << "; x = " << x << "; sinAlpha = " << sinAlpha; return trigonometry::correctImprecisions(sinAlpha); } bool SonarModel::tryGetMatchingMapLine(Map* map, double sigmaError2, LineSegment* matchedMapLine, SonarReading* expectedReading, SonarReading* actualReading, int* matchScore) { double beta; return tryGetMatchingMapLine(getLatestReading().estimatedPose, map, sigmaError2, matchedMapLine, expectedReading, actualReading, matchScore, &beta); } bool SonarModel::tryGetMatchingMapLine(const Pose& latestPose, Map* map, double sigmaError2, LineSegment* matchedMapLine, SonarReading* expectedReading, SonarReading* actualReading, int* matchScore, double* beta) { SCOPED_READINGS_LOCK(); if(map == 0) return false; *beta = getSonarAngleOfIncidence(); if(!getLatestReading().reading.isValid()) { m_tracking.reset(); m_isTracking = false; SONAR_LOG(logDEBUG2) << "Última leitura foi inválida; não há associação possível"; return false; } if(!m_isTracking) { if(tryAssociateMapLine(latestPose, *map, sigmaError2, matchedMapLine, expectedReading, actualReading)) { m_isTracking = true; m_tracking.reset(); m_tracking.setMatch(*matchedMapLine, *expectedReading, *actualReading); *matchScore = m_tracking.getScore(); SONAR_LOG(logDEBUG2) << "Começou match de " << m_tracking.getSegment() << " com score de " << m_tracking.getScore(); return true; } else { return false; } } else { if(tryTrackMapLine(latestPose, *map, expectedReading, actualReading)) { *matchedMapLine = m_tracking.getSegment(); *matchScore = m_tracking.getScore(); SONAR_LOG(logDEBUG2) << "Manteve match de " << m_tracking.getSegment() << " com score de " << m_tracking.getScore(); return true; } else { SONAR_LOG(logDEBUG2) << "PERDEU match de " << m_tracking.getSegment() << " porque score foi " << m_tracking.getScore() << "; tentando associação..."; return tryGetMatchingMapLine(latestPose, map, sigmaError2, matchedMapLine, expectedReading, actualReading, matchScore, beta); } } } bool SonarModel::tryTrackMapLine(const Pose& latestPose, // a posição mais recente do robô Map& map, // o mapa do ambiente /*out*/ SonarReading* expectedReading, // variável de saída: a leitura que seria esperada para aquela linha /*out*/SonarReading* actualReading) { std::vector<LineSegment> vecTrackedLine; vecTrackedLine.push_back(m_tracking.getSegment()); if(filterBySonarAngle(vecTrackedLine, latestPose).size() == 1) { *actualReading = getLatestReading().reading; *expectedReading = getTheoreticalExpectedReadingByMapLine(latestPose, m_tracking.getSegment()); m_tracking.updateMatch(*expectedReading, *actualReading); if(m_tracking.isMatchValid()) { return true; } else { m_isTracking = false; m_tracking.reset(); return false; } } else { m_isTracking = false; m_tracking.reset(); return false; } } bool SonarModel::tryAssociateMapLine(const Pose& latestPose, Map& map, double sigmaError2, LineSegment* matchedMapLine, SonarReading* expectedReading, SonarReading* actualReading) { std::vector<LineSegment>* pLines = map.getLines(); std::vector<LineSegment> mapLines = filterFarAwayLines(*pLines, latestPose); SONAR_LOG(logDEBUG2) << "Linhas apos FarAwayFilter: " << mapLines.size(); //for(int i = 0; i < mapLines.size(); i++) SONAR_LOG(logDEBUG2) << mapLines[i]; mapLines = filterBySonarAngle(mapLines, latestPose); SONAR_LOG(logDEBUG2) << "Linhas apos SonarAngleFilter: " << mapLines.size(); //for(int i = 0; i < mapLines.size(); i++) SONAR_LOG(logDEBUG2) << mapLines[i]; std::vector<LineSegment> matchedLines; SonarReading latestReading = getLatestReading().reading; for(std::vector<LineSegment>::const_iterator it = mapLines.begin(); it != mapLines.end(); it++) { if(matchMapLineWithReading(latestReading, *it, sigmaError2)) { matchedLines.push_back(*it); } } if(matchedLines.size() == 1) { if(matchedMapLine != NULL) *matchedMapLine = matchedLines[0]; if(expectedReading != NULL) *expectedReading = getTheoreticalExpectedReadingByMapLine(latestPose, matchedLines[0]); if(actualReading != NULL) *actualReading = getLatestReading().reading; return true; } else { SONAR_LOG(logDEBUG2) << "Nao validou pois no. de segmentos eh: " << matchedLines.size(); return false; } } std::vector<LineSegment> SonarModel::filterFarAwayLines(std::vector<LineSegment>& mapLines, const Pose& pose) { std::vector<LineSegment> closeEnoughLines; for(std::vector<LineSegment>::iterator it = mapLines.begin(); it != mapLines.end(); it++) { double distanceToPose = it->getDistToLine(pose); if(floating_point::equalOrLess(distanceToPose, configs::sonars::maximumSonarToLineDistance)) { closeEnoughLines.push_back(*it); } } return closeEnoughLines; } std::vector<LineSegment> SonarModel::filterBySonarAngle(std::vector<LineSegment>& mapLines, const Pose& robotPose) { std::vector<LineSegment> reachableLines; Pose sonarPose = getSonarGlobalPose(robotPose); Cone sonarCone(sonarPose, sonarPose.getTheta(), configs::sonars::sonarApertureAngleRads); for(std::vector<LineSegment>::iterator it = mapLines.begin(); it != mapLines.end(); it++) { if(sonarCone.intersectsSegment(*it)) { reachableLines.push_back(*it); } } return reachableLines; } bool SonarModel::matchMapLineWithReading(const SonarReading &reading, const LineSegment &mapLine, double sigmaError2) { double expectedReading = getExpectedReadingByMapLine(getLatestReading().estimatedPose, mapLine); double v_2 = reading.getReading() - expectedReading; v_2 *= v_2; double s_2 = sigmaError2; SONAR_LOG(logDEBUG2) << "Associando segmento " << mapLine << ". Leitura esperada = " << expectedReading << ";" << " leitura real = " << reading.getReading() << "; v_2 = " << v_2 << "; s_2 = " << s_2 << "; v_2 / s_2 = " << v_2 / s_2 << "wallRejectionValue2 = " << configs::sonars::wallRejectionValue2 << "; resultado: " << (v_2 / s_2 < configs::sonars::wallRejectionValue2) ; return v_2 / s_2 < configs::sonars::wallRejectionValue2; } double SonarModel::getD_Robot() { SCOPED_READINGS_LOCK(); return getLatestReading().estimatedPose.getDistance( getOldestReading().estimatedPose); } double SonarModel::getD_Sonar() { SCOPED_READINGS_LOCK(); return getOldestReading().reading.getReading() - getLatestReading().reading.getReading(); } double SonarModel::getS2_D() { SCOPED_READINGS_LOCK(); double d_robot = getD_Robot(); double s_d = d_robot * configs::sonars::phoErrorFront4mm / (m_readings.size() - 1); return s_d * s_d; } double SonarModel::getS2_R() { SCOPED_READINGS_LOCK(); double s_r = getLatestReading().reading.getStdDeviationMm(); return s_r * s_r; } Pose SonarModel::getSonarGlobalPose(const Pose& robotPose) { pose_t globalSonarX, globalSonarY, globalSonarTh; globalSonarX = robotPose.X() + (m_sonarX * ::cos(robotPose.getTheta()) - m_sonarY * ::sin(robotPose.getTheta())); globalSonarY = robotPose.Y() + (m_sonarX * ::sin(robotPose.getTheta()) + m_sonarY * ::cos(robotPose.getTheta())); globalSonarTh = robotPose.getTheta() + m_sonarTheta; return Pose(globalSonarX, globalSonarY, globalSonarTh); } SonarModel::ReadingAndPose& SonarModel::getLatestReading() { SCOPED_READINGS_LOCK(); return m_readings.back(); } SonarModel::ReadingAndPose& SonarModel::getOldestReading() { SCOPED_READINGS_LOCK(); return *m_readings.begin(); } }
[ "budsbd@8373e73c-ebb0-11dd-9ba5-89a75009fd5d", "rafael.baroque@8373e73c-ebb0-11dd-9ba5-89a75009fd5d" ]
[ [ [ 1, 49 ], [ 54, 249 ], [ 251, 257 ], [ 259, 278 ], [ 280, 287 ], [ 289, 404 ], [ 407, 456 ] ], [ [ 50, 53 ], [ 250, 250 ], [ 258, 258 ], [ 279, 279 ], [ 288, 288 ], [ 405, 406 ] ] ]
61472bc6cb60dc7b78c520662e6fbff0e09b78e5
f6a8ffe1612a9a39fc1daa4e7849cad56ec351f0
/ChromaKeyer/trunk/ChromaKeyer/ImageLoader.h
97238c1e0e7673f14c96c94741439e57769042a0
[]
no_license
comebackfly/c-plusplus-programming
03e097ec5b85a4bf1d8fdd47041a82d7b6ca0753
d9b2fb3caa60459fe459cacc5347ccc533b4b1ec
refs/heads/master
2021-01-01T18:12:09.667814
2011-07-18T22:30:31
2011-07-18T22:30:31
35,753,632
0
0
null
null
null
null
UTF-8
C++
false
false
223
h
#pragma once #include "graphlibHTW.h" #include <string> #include "ImageObject.h" #include <iostream> class ImageLoader { public: static ImageObject* loadImage(int w, int h, int bpp, std::string fileName); };
[ "[email protected]@5f9f56c3-fb77-04ef-e3c5-e71eb3e36737" ]
[ [ [ 1, 12 ] ] ]
2ece40d49abdab47a5b52f1a840d80696615ce71
b2d46af9c6152323ce240374afc998c1574db71f
/cursovideojuegos/theflostiproject/3rdParty/boost/libs/config/test/no_mem_func_spec_pass.cpp
58fc35d8e420d8fcd3fc784bdb0b2fad4ad5c8f5
[]
no_license
bugbit/cipsaoscar
601b4da0f0a647e71717ed35ee5c2f2d63c8a0f4
52aa8b4b67d48f59e46cb43527480f8b3552e96d
refs/heads/master
2021-01-10T21:31:18.653163
2011-09-28T16:39:12
2011-09-28T16:39:12
33,032,640
0
0
null
null
null
null
UTF-8
C++
false
false
1,292
cpp
// This file was automatically generated on Sun Jul 25 11:47:49 GMTDT 2004, // by libs/config/tools/generate // Copyright John Maddock 2002-4. // 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/libs/config for the most recent version. // Test file for macro BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS // This file should compile, if it does not then // BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS needs to be defined. // see boost_no_mem_func_spec.ipp for more details // Do not edit this file, it was generated automatically by // ../tools/generate from boost_no_mem_func_spec.ipp on // Sun Jul 25 11:47:49 GMTDT 2004 // Must not have BOOST_ASSERT_CONFIG set; it defeats // the objective of this file: #ifdef BOOST_ASSERT_CONFIG # undef BOOST_ASSERT_CONFIG #endif #include <boost/config.hpp> #include "test.hpp" #ifndef BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #include "boost_no_mem_func_spec.ipp" #else namespace boost_no_member_function_specializations = empty_boost; #endif int main( int, char *[] ) { return boost_no_member_function_specializations::test(); }
[ "ohernandezba@71d53fa2-cca5-e1f2-4b5e-677cbd06613a" ]
[ [ [ 1, 39 ] ] ]
328a7caf14a45b951fe171b85a9e8bc4f4e6a6fb
9b3df03cb7e134123cf6c4564590619662389d35
/Actor.h
58cf8488755adf366c4c66bab1fe1edd6b01dfae
[]
no_license
CauanCabral/Computacao_Grafica
a32aeff2745f40144a263c16483f53db7375c0ba
d8673aed304573415455d6a61ab31b68420b6766
refs/heads/master
2016-09-05T16:48:36.944139
2010-12-09T19:32:05
2010-12-09T19:32:05
null
0
0
null
null
null
null
ISO-8859-10
C++
false
false
1,852
h
#ifndef __Actor_h #define __Actor_h //[]------------------------------------------------------------------------[] //| | //| GVSG Graphics Library | //| Version 1.0 | //| | //| CopyrightŪ 2007, Paulo Aristarco Pagliosa | //| All Rights Reserved. | //| | //[]------------------------------------------------------------------------[] // // OVERVIEW: Actor.h // ======== // Class definition for actor. #ifndef __DoubleList_h #include "DoubleList.h" #endif #ifndef __Model_h #include "Model.h" #endif #ifndef __SceneComponent_h #include "SceneComponent.h" #endif using namespace System; using namespace System::Collections; namespace Graphics { // begin namespace Graphics ////////////////////////////////////////////////////////// // // Actor: actor class // ===== class Actor: public SceneComponent { public: bool isVisible; // Constructor Actor(Model& model): isVisible(true) { this->model = model.makeUse(); } // Destructor ~Actor(); Model* getModel() const { return model; } void setModel(Model& model) { this->model->release(); this->model = model.makeUse(); } protected: Model* model; DECLARE_DOUBLE_LIST_ELEMENT(Actor); DECLARE_SERIALIZABLE(Actor); friend class Scene; }; // Actor typedef DoubleListImp<Actor> Actors; typedef DoubleListIteratorImp<Actor> ActorIterator; } // end namespace Graphics #endif
[ [ [ 1, 80 ] ] ]
d10b7faeebf82b0927f965d6979916914636a9e9
58ef4939342d5253f6fcb372c56513055d589eb8
/CloverDemo/source/Tools/src/Configuration.cpp
e0237931fc7e1e928ab027c2d2303a8a41842d0e
[]
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
4,229
cpp
/* ============================================================================ Name : Configuration.cpp Author : yaoyang Version : Copyright : Description : CConfiguration implementation ============================================================================ */ #include "Configuration.h" //#include "Utils.h" #include <eikenv.h> #include <f32file.h> #include <utf.h> CConfiguration::CConfiguration() { // No implementation required //iFsSessionPtr = NULL; } CConfiguration::~CConfiguration() { if(!iHasSave){ SaveL(); } if ( iConfigItemArray ) { delete iConfigItemArray; iConfigItemArray=NULL; } } CConfiguration* CConfiguration::NewLC(const TDesC& aConfigFilePath) { CConfiguration* self = new (ELeave)CConfiguration(); CleanupStack::PushL(self); self->ConstructL(aConfigFilePath); return self; } CConfiguration* CConfiguration::NewL(const TDesC& aConfigFilePath) { CConfiguration* self=CConfiguration::NewLC(aConfigFilePath); CleanupStack::Pop(); // self; return self; } void CConfiguration::ConstructL(const TDesC& aConfigFilePath) { iFilePath = aConfigFilePath; iHasSave = true; } TBool CConfiguration::Get(const TDesC& aKey, TDes& aValue) { TBool loadResult = LoadL(); if(!loadResult) return false; for(TInt i = 0; i < iConfigItemArray->Count(); i ++){ if(iConfigItemArray->At(i).iKey == aKey){ aValue.Copy(iConfigItemArray->At(i).iValue); return true; } } return false; } TBool CConfiguration::Set(const TDesC& aKey, const TDesC& aValue) { if(aKey.Length() > 32 || aValue.Length() > 128) return false; TBuf<128> value; TBool hasKey = Get(aKey, value); if(hasKey){ for(TInt i = 0; i < iConfigItemArray->Count(); i ++){ if(iConfigItemArray->At(i).iKey == aKey){ iConfigItemArray->At(i).iValue.Copy(aValue); } } } else{ TConfigItem configItem; configItem.iKey.Copy(aKey); configItem.iValue.Copy(aValue); iConfigItemArray->AppendL(configItem); } iHasSave = SaveL(); return true; } void CConfiguration::ParseLine(TDesC& aLine, TDes& akey, TDes& aValue) { TBuf<1> tag(_L("=")); TInt pos = aLine.Find(tag); if(pos == KErrNotFound){ akey = _L(""); aValue = _L(""); } else{ akey = aLine.Mid(0, pos); aValue = aLine.Mid(pos + 1); } } TBool CConfiguration::SaveL() { return SaveInternalL(CEikonEnv::Static()->FsSession()); } TBool CConfiguration::SaveInternalL(RFs& aFs) { RFs& fsSession = aFs;//CEikonEnv::Static()->FsSession(); RFile file; int pos = iFilePath.LocateReverse( '\\' ); TPtrC dirName = iFilePath.Left( pos+1 ); aFs.MkDirAll(dirName); TInt errCode = file.Replace(fsSession, iFilePath, EFileWrite); if(errCode != KErrNone) return false; TBuf8<2> header; TChar c; c = 0xff; header.Append(c); c = 0xfe; header.Append(c); file.Write(header); for(TInt i = 0; i < iConfigItemArray->Count(); i ++){ TBuf<512> line; line.Append(iConfigItemArray->At(i).iKey); line.Append(_L("=")); line.Append(iConfigItemArray->At(i).iValue); line.Append(_L("\r\n")); TPtr8 ptr((TUint8*)line.Ptr(), line.Length()*2, line.Length()*2) ; file.Write(ptr); } file.Close(); return true; } TBool CConfiguration::LoadL() { TBool val = EFalse; RFs fs; if ( fs.Connect() ) return val; val = LoadInternalL(fs); fs.Close(); return val; } TBool CConfiguration::LoadInternalL(RFs& aFs) { delete iConfigItemArray; iConfigItemArray = new(ELeave)CArrayFixFlat<TConfigItem>(3); RFs& fsSession = aFs;//CEikonEnv::Static()->FsSession(); RFile file; TInt nErr = file.Open(fsSession, iFilePath, EFileRead|EFileShareAny); if (nErr) { return EFalse; } TFileText fileText; fileText.Set(file); HBufC* line = HBufC::NewLC(160); TPtr linePtr = line->Des(); while (fileText.Read(linePtr) == KErrNone){ TBuf<32> key; TBuf<128> value; TConfigItem item; ParseLine(linePtr, key, value); if(key.Length() != 0){ item.iKey.Append(key); item.iValue.Append(value); iConfigItemArray->AppendL(item); } } CleanupStack::PopAndDestroy(); //line file.Close(); return ETrue; }
[ "zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494" ]
[ [ [ 1, 194 ] ] ]
f7ebcf14c1b50d580f1d5992bc1d2d3066bcd62f
14f73382b96f592b53bf77ee8adc4948508a3edf
/src/re330/SceneManager.cpp
aee1f22f6a36c9310e683533f7eced961ad52645
[]
no_license
alawrenc/graphics-projects
2fb86312b13db1fb1d17f6e0c987fcc1af1568bb
d0e4fa974cb49c60ab2e6c11e1185adbea1a32cd
refs/heads/master
2021-01-18T07:58:40.639644
2010-05-12T00:37:19
2010-05-12T00:37:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,636
cpp
#include "SceneManager.h" #include "RenderContext.h" #include "TransformGroup.h" using namespace RE330; SceneManager::SceneManager() : mCamera(0) { } SceneManager::~SceneManager() { if(mCamera) { delete mCamera; } if(rootNode) { delete rootNode; } while(mObjectList.size() > 0) { Object *o = mObjectList.front(); mObjectList.pop_front(); delete o; } while(mLightList.size() > 0) { Light *l = mLightList.front(); mLightList.pop_front(); delete l; } } void SceneManager::setRootNode(TransformGroup *n) { rootNode = n; } Object* SceneManager::createObject() { Object *o = new Object(); mObjectList.push_back(o); return o; } Light* SceneManager::createLight() { if (mLightList.size() >=8) { std::cout << "tried to add too many light sources!" << std::endl; throw; } Light *l = new Light(); mLightList.push_back(l); return l; } Camera* SceneManager::createCamera() { mCamera = new Camera(); return mCamera; } void SceneManager::renderScene() { RenderContext* renderContext = RenderContext::getSingletonPtr(); if(mCamera!=0) { renderContext->beginFrame(); renderContext->setProjectionMatrix(mCamera->getProjectionMatrix()); renderContext->setModelViewMatrix(Matrix4::IDENTITY); renderContext->setLights(mLightList); rootNode->draw(Matrix4::IDENTITY, *renderContext, *mCamera); renderContext->endFrame(); } }
[ [ [ 1, 2 ], [ 4, 7 ], [ 9, 13 ], [ 34, 35 ], [ 40, 40 ], [ 44, 44 ], [ 46, 47 ], [ 61, 62 ], [ 65, 68 ], [ 70, 70 ], [ 74, 74 ], [ 76, 76 ] ], [ [ 3, 3 ], [ 8, 8 ], [ 14, 33 ], [ 36, 36 ], [ 41, 43 ], [ 45, 45 ], [ 48, 60 ], [ 63, 64 ], [ 69, 69 ], [ 71, 73 ], [ 75, 75 ], [ 77, 78 ], [ 80, 83 ] ], [ [ 37, 39 ] ], [ [ 79, 79 ] ] ]
e02e26b5fbdeb9b122c359d138b7fbccc04727d7
9f2d447c69e3e86ea8fd8f26842f8402ee456fb7
/shooting2011/shooting2011/pictureTable.h
5447235e6767f9e757de1b1901774eff898d5825
[]
no_license
nakao5924/projectShooting2011
f086e7efba757954e785179af76503a73e59d6aa
cad0949632cff782f37fe953c149f2b53abd706d
refs/heads/master
2021-01-01T18:41:44.855790
2011-11-07T11:33:44
2011-11-07T11:33:44
2,490,410
0
1
null
null
null
null
SHIFT_JIS
C++
false
false
934
h
#ifndef __PICTURE_TABLE_H__ #define __PICTURE_TABLE_H__ #include"Dxlib.h" #include <map> #include <string> #include <deque> #include "main.h" using namespace std; class PictureTable{ //すべての画像を読み込んでそのidを管理する。 map<int,deque<int>> decode_table; map<string,int> graphic_encode_table; map<int,pair<int,int>>half_size_table;//sizeの半分の大きさが格納されている。 void load_all_graphics(string str); public: ~PictureTable(){InitGraph();}; PictureTable(){}; int get_graphic_id(string str); void initialize(){load_all_graphics("../graphic/");} int getanimation(int tableIdx,int animIdx); int gethalfsize_x(int graphicID){return half_size_table[graphicID].first;}; int gethalfsize_y(int graphicID){return half_size_table[graphicID].second;}; int decode(int tableIdx, int animationIdx); int encode(string str); }; #endif
[ [ [ 1, 2 ], [ 19, 19 ] ], [ [ 3, 9 ], [ 11, 11 ], [ 16, 16 ], [ 26, 36 ] ], [ [ 10, 10 ], [ 13, 15 ], [ 20, 20 ] ], [ [ 12, 12 ], [ 21, 21 ] ], [ [ 17, 18 ], [ 22, 25 ] ] ]
d3449642c7be4e58feb357c6b32a49330ffdedc6
d1dc408f6b65c4e5209041b62cd32fb5083fe140
/src/sidebar/cSideBarFactory.h
2aef1a0b92a653530e69d73862983fbb0e3b4bd1
[]
no_license
dmitrygerasimuk/dune2themaker-fossfriendly
7b4bed2dfb2b42590e4b72bd34bb0f37f6c81e37
89a6920b216f3964241eeab7cf1a631e1e63f110
refs/heads/master
2020-03-12T03:23:40.821001
2011-02-19T12:01:30
2011-02-19T12:01:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
432
h
/* * cSideBarFactory.h * * Created on: Aug 2, 2009 * Author: Stefan */ #ifndef CSIDEBARFACTORY_H_ #define CSIDEBARFACTORY_H_ class cSideBarFactory { private: static cSideBarFactory *instance; protected: cSideBarFactory(); public: static cSideBarFactory *getInstance(); cSideBar *createSideBar(cPlayer * player, int techlevel, int house); private: }; #endif /* CSIDEBARFACTORY_H_ */
[ "stefanhen83@52bf4e17-6a1c-0410-83a1-9b5866916151" ]
[ [ [ 1, 27 ] ] ]
9e9534dfa25f064426a1617191d5cdee3b8942a1
5b3221bdc6edd8123287b2ace0a971eb979d8e2d
/Fiew/Exp_File.cpp
81b1521b1948f10df83105b33f6a0d568af4bd8c
[]
no_license
jackiejohn/fedit-image-editor
0a4b67b46b88362d45db6a2ba7fa94045ad301e2
fd6a87ed042e8adf4bf88ddbd13f2e3b475d985a
refs/heads/master
2021-05-29T23:32:39.749370
2009-02-25T21:01:11
2009-02-25T21:01:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,025
cpp
/* Exp_File.cpp Inherited from Fiew 2.0 Represents the filesystem file as an object. It is the smallest entity in Fedit Explorer. */ #include "stdafx.h" #include "Core.h" File::File(FwCHAR *path, int type, DWORD size, bool archived) { this->filepath = path; this->filename = new FwCHAR(); this->filename->getFilenameFrom(this->filepath); this->size = size; this->archived = archived; if( type == UNDEFINED ) this->type = Explorer::getType(this->filepath); else this->type = type; this->mime = Explorer::getMime(this->type); } File::~File() { delete this->filepath; delete this->filename; } void File::initSort(int sort) { return; } FwCHAR *File::getFilePath() { return this->filepath; } FwCHAR *File::getFileName() { return this->filename; } int File::getType() { return this->type; } int File::getMime() { return this->mime; } DWORD File::getSize() { return this->size; } bool File::isArchived() { return this->archived; }
[ [ [ 1, 68 ] ] ]
a3ee9b0c402d982dc4a19f3443f701f56b7c5a4a
f7be460272b02f7b582430396ede89dc14b50b88
/dimensionsgroupbox.cpp
dbdd9cf5b6d711448805b954ada569655a01a930
[ "MIT" ]
permissive
ShenRen/stlviewer
400934c125e557342bd3d8e81c1974e0a51082a9
3ed2415af299ace5564f6486344c04a680d625ea
refs/heads/master
2021-01-15T22:14:20.658542
2011-01-18T20:54:29
2011-01-18T20:54:29
99,892,752
1
0
null
null
null
null
UTF-8
C++
false
false
4,254
cpp
// Copyright (c) 2009 Olivier Crave // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #include <QtGui/QtGui> #include "dimensionsgroupbox.h" DimensionsGroupBox::DimensionsGroupBox(QWidget *parent) : QGroupBox(tr("Dimensions"), parent) { QGridLayout *layout = new QGridLayout; // Write labels and values QLabel *label = new QLabel("Min"); label->setAlignment(Qt::AlignHCenter); layout->addWidget(label, 0, 1); label = new QLabel("Max"); label->setAlignment(Qt::AlignHCenter); layout->addWidget(label, 0, 2); label = new QLabel("Delta"); label->setAlignment(Qt::AlignHCenter); layout->addWidget(label, 0, 3); layout->addWidget(new QLabel("X"), 1, 0); xMin = new QLabel(""); xMin->setAlignment(Qt::AlignRight); layout->addWidget(xMin, 1, 1); xMax = new QLabel(""); xMax->setAlignment(Qt::AlignRight); layout->addWidget(xMax, 1, 2); xDelta = new QLabel(""); xDelta->setAlignment(Qt::AlignRight); layout->addWidget(xDelta, 1, 3); layout->addWidget(new QLabel("Y"), 2, 0); yMin = new QLabel(""); yMin->setAlignment(Qt::AlignRight); layout->addWidget(yMin, 2, 1); yMax = new QLabel(""); yMax->setAlignment(Qt::AlignRight); layout->addWidget(yMax, 2, 2); yDelta = new QLabel(""); yDelta->setAlignment(Qt::AlignRight); layout->addWidget(yDelta, 2, 3); layout->addWidget(new QLabel("Z"), 3, 0); zMin = new QLabel(""); zMin->setAlignment(Qt::AlignRight); layout->addWidget(zMin, 3, 1); zMax = new QLabel(""); zMax->setAlignment(Qt::AlignRight); layout->addWidget(zMax, 3, 2); zDelta = new QLabel(""); zDelta->setAlignment(Qt::AlignRight); layout->addWidget(zDelta, 3, 3); // Write units of length layout->addWidget(new QLabel("mm"), 1, 4); layout->addWidget(new QLabel("mm"), 2, 4); layout->addWidget(new QLabel("mm"), 3, 4); layout->setColumnMinimumWidth(0, 20); layout->setColumnMinimumWidth(1, 50); layout->setColumnMinimumWidth(2, 50); layout->setColumnMinimumWidth(3, 50); setLayout(layout); } DimensionsGroupBox::~DimensionsGroupBox() {} void DimensionsGroupBox::reset() { // Reset x fields xMax->setText(""); xMin->setText(""); xDelta->setText(""); // Reset y fields yMax->setText(""); yMin->setText(""); yDelta->setText(""); // Reset z fields zMax->setText(""); zMin->setText(""); zDelta->setText(""); } void DimensionsGroupBox::setValues(const StlFile::Stats stats) { QString data; // Write x values contained in stats data.setNum(stats.max.x, 'f', 3); xMax->setText(data); data.setNum(stats.min.x, 'f', 3); xMin->setText(data); data.setNum(stats.max.x-stats.min.x, 'f', 3); xDelta->setText(data); // Write y values contained in stats data.setNum(stats.max.y, 'f', 3); yMax->setText(data); data.setNum(stats.min.y, 'f', 3); yMin->setText(data); data.setNum(stats.max.y-stats.min.y, 'f', 3); yDelta->setText(data); // Write z values contained in stats data.setNum(stats.max.z, 'f', 3); zMax->setText(data); data.setNum(stats.min.z, 'f', 3); zMin->setText(data); data.setNum(stats.max.z-stats.min.z, 'f', 3); zDelta->setText(data); }
[ "cravesoft@939d4a90-b6fe-4fe1-83ef-7ae222a9c67a" ]
[ [ [ 1, 120 ] ] ]
611a8fdcef9ef95d2c35e921b00de136dacdf711
6e563096253fe45a51956dde69e96c73c5ed3c18
/dhplay/dhplay/oldStreamfileOpr.cpp
dd5d61ca3838b19b98ec74051989ac570215b27d
[]
no_license
15831944/phoebemail
0931b76a5c52324669f902176c8477e3bd69f9b1
e10140c36153aa00d0251f94bde576c16cab61bd
refs/heads/master
2023-03-16T00:47:40.484758
2010-10-11T02:31:02
2010-10-11T02:31:02
null
0
0
null
null
null
null
GB18030
C++
false
false
7,346
cpp
#include "stdafx.h" #include "oldStreamfileOpr.h" #include <time.h> OldStreamOperation::OldStreamOperation() { } OldStreamOperation::~OldStreamOperation() { } int OldStreamOperation::CreateIndex(char* fileName, DWORD beginpos, std::vector<DH_INDEX_INFO*>& m_pFileIndex, DWORD& m_totalFrameNum, DHTIME& begintime, DHTIME& endtime,__int64& nDataLen) { HANDLE f_CreateIndex = NULL; unsigned int FOURCC = 0xFFFFFFFF; unsigned char head[50]; unsigned char* pBuf = 0; int rest = 0; DWORD FileReadLen = 0; BOOL FileReadResult = TRUE; DWORD FrameLen = 0; DWORD FileSize = 0; unsigned int FrameOffset = beginpos; unsigned int VideoFrameIndex = 0; DH_INDEX_INFO* pIndexInfo = 0; //打开文件 f_CreateIndex = CreateFile(fileName, GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL); if (f_CreateIndex == NULL) { return 1 ; } //得到文件长度 FileSize = GetFileSize(f_CreateIndex, NULL); if(FileSize == -1) { CloseHandle(f_CreateIndex) ; f_CreateIndex = NULL ; return 1 ; } //索引到第一个帧头 if( myFileSeek(f_CreateIndex, FrameOffset, FILE_BEGIN) == -1) { CloseHandle(f_CreateIndex) ; f_CreateIndex = NULL ; return 1 ; } //建立索引 while(true) { if (m_bCreateIndex == 0) { CloseHandle(f_CreateIndex) ; f_CreateIndex = NULL ; return 1 ; } //读去8字节的头(包括帧标识和帧长度) FileReadResult = ReadFile(f_CreateIndex, head, 50, &FileReadLen, NULL); if (FileReadLen != 50 || FileReadResult == false) { //读帧头不符合我们的要求,退出 m_totalFrameNum = VideoFrameIndex ; if (m_totalFrameNum != 0) { goto IndexCreateOK ; } else { return 1; } } //取标识 FOURCC = head[0] << 24 | head[1] << 16 | head[2] << 8 | head[3]; if (FOURCC == 0x44485054)// "DHPT"如果是视频帧 { //得到视频帧长度 FrameLen = head[7] << 24 | head[6] << 16 | head[5] << 8 | head[4]; //如果此帧不完整,退出 if(FrameOffset + FrameLen + 8 > FileSize || FrameLen > FileSize) { m_totalFrameNum = VideoFrameIndex ; if (m_totalFrameNum != 0) { goto IndexCreateOK ; } else { return 1; } } //此帧完整的话,判断其是关键帧(I帧)还是非关键帧 pBuf = head + 8;//跳到实际的视频数据开头 FOURCC = pBuf[0] << 24 | pBuf[1] << 16 | pBuf[2] << 8 | pBuf[3]; if(FOURCC == 0x00000100)//如果是关键帧就建立索引 { unsigned int ID = 0xFFFFFFFF; pIndexInfo = new DH_INDEX_INFO; memset(pIndexInfo, 0, sizeof(DH_INDEX_INFO)); pIndexInfo->IFramePos = FrameOffset; pIndexInfo->framelen = FrameLen + 8; pIndexInfo->IFrameNum = VideoFrameIndex++; memset((void*)&(pIndexInfo->time),0,sizeof(DHTIME)) ; m_pFileIndex.push_back(pIndexInfo);//添加到索引队列 while (ID != 0x000001B6 && pBuf <= head + 50) { ID = ID << 8 | *pBuf++; if (ID == 0x01B3) { pIndexInfo->time.hour = pBuf[0]>>3 + 1; pIndexInfo->time.minute = (pBuf[0]&0x07)<<3 | pBuf[1]>>5 + 1; pIndexInfo->time.second = (pBuf[1]&0x0f)<<2 | pBuf[2]>>6 + 1; } else if (ID == 0x01B2) { pIndexInfo->IFrameRate = pBuf[6] ; if (pBuf[6] > 150) { if(pBuf[6] == 0xFF) { pIndexInfo->IFrameRate = 1; } else { pIndexInfo->IFrameRate = 25; } } } } FrameOffset += FrameLen + 8;//指向下一帧开始的偏移 } else if(FOURCC == 0x000001B6)//如果不是关键帧,只是做相应的偏移 { if(VideoFrameIndex != 0) { VideoFrameIndex++; } FrameOffset += FrameLen + 8; } } else if (FOURCC == 0x000001f0)//如果是音频帧,只是做相应的偏移 { //得到视频帧长度 FrameLen = head[5] << 8 | head[4]; //如果此帧不完整,退出 if(FrameOffset + FrameLen + 8 > FileSize) { m_totalFrameNum = VideoFrameIndex ; if (m_totalFrameNum != 0) { goto IndexCreateOK ; } else { return 1; } } FrameOffset += FrameLen + 8; } else { //文件中只要码流有错,就放弃建立索引 return 1 ; } //索引到下一个帧头 if (myFileSeek(f_CreateIndex, FrameOffset, FILE_BEGIN) == -1) { CloseHandle(f_CreateIndex) ; f_CreateIndex = NULL ; return 1 ; } } IndexCreateOK: *(DWORD*)&begintime = *(DWORD*)&(m_pFileIndex[0]->time) ; *(DWORD *)&endtime = *(DWORD *)&(m_pFileIndex[m_pFileIndex.size()-1]->time) ; tm* tmp_time = new tm ; tmp_time->tm_hour = endtime.hour - 1 ; tmp_time->tm_min = endtime.minute - 1 ; tmp_time->tm_sec = endtime.second - 1 ; tmp_time->tm_mday = 0; tmp_time->tm_mon = 0 ; tmp_time->tm_year = 100 ; tmp_time->tm_isdst= -1; //自动计算是否为夏时制, (bug: 时区选为美国,自动使用夏时制时,时间计算有误) time_t _time_t = mktime(tmp_time) ; delete tmp_time ; int tmp_rate = m_pFileIndex[m_pFileIndex.size()-1]->IFrameRate ; _time_t += (m_totalFrameNum - m_pFileIndex[m_pFileIndex.size()-1]->IFrameNum - 1) / tmp_rate + 1 ; tmp_time = localtime(&_time_t) ; if (tmp_time != NULL) { endtime.hour = tmp_time->tm_hour + 1 ; endtime.minute = tmp_time->tm_min + 1 ; endtime.second = tmp_time->tm_sec + 1 ; } pIndexInfo = new DH_INDEX_INFO ; *(DWORD *)&pIndexInfo->time = *(DWORD *)&endtime; pIndexInfo->IFramePos = FileSize ; pIndexInfo->IFrameNum = m_totalFrameNum ; pIndexInfo->framelen = 0 ; pIndexInfo->IFrameRate = 25 ; m_pFileIndex.push_back(pIndexInfo) ; CloseHandle(f_CreateIndex) ; f_CreateIndex = NULL ; return 0 ; } __int64 OldStreamOperation::GetFrameEndPos(HANDLE m_pFile, DWORD KeyFrameNum, __int64 KeyFramePos, DWORD nFrame) //得到指定帧的结束位置 { BYTE mData[50]; DWORD len = 0 ; DWORD FrameNum = KeyFrameNum ; __int64 temp_pos = KeyFramePos ; __int64 FileSize = GetFileSize(m_pFile,NULL) ; int FrameLen = 0; unsigned int FOURCC = 0xFFFFFFFF; while(TRUE) { if (temp_pos >= FileSize) { return -1 ; } myFileSeek(m_pFile, temp_pos, FILE_BEGIN) ; ReadFile(m_pFile, mData, 50, &len, NULL) ; if (len < 50) { return -1 ; } FOURCC = mData[0] << 24 | mData[1] << 16 | mData[2] << 8 | mData[3]; if(FOURCC == 0x44485054) { //得到视频帧长度 FrameLen = mData[7] << 24 | mData[6] << 16 | mData[5] << 8 | mData[4]; //如果此帧不完整,退出 temp_pos += FrameLen + 8 ; if(temp_pos > FileSize) { return -1; } if(FrameNum == nFrame) { return temp_pos ; } FrameNum++ ; } else if(FOURCC == 0x000001F0) { //得到音频帧长度 FrameLen = mData[0] << 8 | mData[1]; //如果此帧不完整,退出 temp_pos += FrameLen + 8 ; if(temp_pos + FrameLen + 8 > FileSize) { return -1; } } } } void OldStreamOperation::GetFileInfo(HANDLE m_pFile, DWORD& dwFrame, DH_VIDEOFILE_HDR& _video_info) { }
[ "guoqiao@a83c37f4-16cc-5f24-7598-dca3a346d5dd" ]
[ [ [ 1, 300 ] ] ]
581878654ecf3ead9c5fae6782a2800f0720e5e2
ad85dfd8765f528fd5815d94acde96e28e210a43
/trunk/src/Setup.cpp
f405bf249087f639c9fa37cc1db88ce57778ec2a
[]
no_license
BackupTheBerlios/openlayer-svn
c53dcdd84b74fd4687c919642e6ccef3dd4bba79
3086e76972e6674c9b40282bb7028acb031d0593
refs/heads/master
2021-01-01T19:25:13.382956
2007-07-18T17:09:55
2007-07-18T17:09:55
40,823,139
1
0
null
null
null
null
UTF-8
C++
false
false
3,307
cpp
#include "Setup.hpp" #include "Includes.hpp" #include "Settings.hpp" #include "Blenders.hpp" #include "Transforms.hpp" #include "GarbageCollector.hpp" #include "General.hpp" #include "Internal.hpp" #include "GlDriver.hpp" #include "Rgba.hpp" #include "Canvas.hpp" #ifndef OL_NO_PNG #include <loadpng.h> #endif // OL_NO_PNG using namespace ol; // STATIC CLASS VARIABLES // bool Setup::programIsSetUp = false; bool Setup::screenIsSetUp = false; std::string Setup::executablePath = ""; int Setup::windowWidth = 0; int Setup::windowHeight = 0; int Setup::colorDepth = 0; // GENERAL FUNCTIONS // void OlCollectTheGarbage(); bool Setup:: SetupProgram( int devices ) { return SetupProgram( devices & KEYBOARD, devices & MOUSE, devices & TIMER ); } bool Setup:: SetupProgram( bool setupKeyboard, bool setupMouse, bool setupTimer ) { GlDriver::Get()->SetupProgram( setupKeyboard, setupMouse, setupTimer ); atexit( OlCollectTheGarbage ); executablePath = GlDriver::Get()->GetExecutablePath(); programIsSetUp = true; #ifndef OL_NO_PNG register_png_file_type(); #endif OlLog( "OpenLayer started up succesfully" ); return true; } GarbageCollection &OlGetCollection(); bool Setup:: SetupScreen( int w, int h, bool fullscreen, int colorDepth, int zDepth, int refreshRate ) { GlDriver::Get()->SetupScreen( w, h, fullscreen, colorDepth, zDepth, refreshRate ); Setup::windowWidth = w; Setup::windowHeight = h; Setup::colorDepth = colorDepth; screenIsSetUp = true; Settings::SetOrthographicProjection(); Blenders::Set( ALPHA_BLENDER ); Transforms::SetRotationPivot( SCREEN_W/2, SCREEN_H/2 ); Transforms::SetColorChannels( Rgba::WHITE ); Settings::SetAntialiasing( true ); Canvas::ReadBufferSizes(); Canvas::SetTo( SCREEN_BACKBUF ); Canvas::Fill( Rgba( 0.0, 0.0, 0.0, 1.0 ), ALPHA_ONLY ); Canvas::Refresh(); Canvas::Fill( Rgba( 0.0, 0.0, 0.0, 1.0 ), ALPHA_ONLY ); OlGetCollection().ExecuteQueues(); OlLog( "Screen set up succesfully\n" ); return true; } bool Setup:: IsScreenSetUp() { return screenIsSetUp; } bool Setup:: IsProgramSetUp() { return programIsSetUp; } std::string Setup:: ToAbsolutePathname( std::string pathname ) { return GlDriver::Get()->ToAbsolutePathname( pathname ); } void Setup:: SuspendProgram() { OlGetCollection().UnloadAllToMemory(); } void Setup:: WakeUpProgram() { OlGetCollection().LoadAllToGPU(); } const char *Setup:: GetGLError() { GLenum error = glGetError(); if( error == GL_NO_ERROR ) return 0; if( error == GL_INVALID_ENUM ) return "GL_INVALID_ENUM"; if( error == GL_INVALID_VALUE ) return "GL_INVALID_VALUE"; if( error == GL_INVALID_OPERATION ) return "GL_INVALID_OPERATION"; if( error == GL_STACK_OVERFLOW ) return "GL_STACK_OVERFLOW"; if( error == GL_STACK_UNDERFLOW ) return "GL_STACK_UNDERFLOW"; if( error == GL_OUT_OF_MEMORY ) return "GL_OUT_OF_MEMORY"; OlLog( "Unknown OpenGL error code" ); OlLog( ToString( error )); return "OTHER"; }
[ "bradeeoh@9f4572f3-6e0d-0410-ba3b-903ab02ac46b", "fladimir2002@9f4572f3-6e0d-0410-ba3b-903ab02ac46b" ]
[ [ [ 1, 59 ], [ 61, 167 ] ], [ [ 60, 60 ] ] ]
5e95bb61a361ef1e190c6bc1e22d5ce3f5e96558
6e5c32618b28d2c7a6175d2921e0baeb530183c1
/src/SceneHighscore.h
a2383f4b7fde23da99e6dea1db8973043660348b
[]
no_license
RoestVrijStaal/warehousepanic
79a26e97026b0184a10c4a631dff5df0be8918dc
16eeba14c7e38b2b0eeddd90e5ac6970b0bff9a9
refs/heads/master
2020-05-20T08:04:19.112773
2010-06-09T19:03:54
2010-06-09T19:03:54
35,184,762
0
0
null
null
null
null
UTF-8
C++
false
false
799
h
#ifndef SCENEHIGHSCORE_H #define SCENEHIGHSCORE_H #include "WCEngine/GDN.h" #include "Keyboard.h" #include "Score.h" #include "Text.h" #include <string> #include <list> #include <vector> class SceneHighscore : public gdn::Scene { public: SceneHighscore(); virtual ~SceneHighscore(); void Initialize(); void Terminate(); void Step(); void Draw(); protected: void InsertScore( Score* score ); std::string FormatNumber( int num ); bool isMouseDown; Keyboard* keyboard; Score* newScore; Text* newTextName; // Pointer to the text for which the newly entered name should be put std::list< Score* > scores; gdn::Sound sndClick; Text highscore_title; std::vector< Text* > highscores; gdn::Sprite bg_general; int timer; private: }; #endif // SCENEHIGHSCORE_H
[ "[email protected]@03d7b61e-2572-11df-92c5-9faf7978932a", "[email protected]@03d7b61e-2572-11df-92c5-9faf7978932a" ]
[ [ [ 1, 7 ], [ 9, 9 ], [ 11, 35 ], [ 38, 43 ] ], [ [ 8, 8 ], [ 10, 10 ], [ 36, 37 ] ] ]
d2d89f007631d20b224a1c4a68de1f8afea1a376
f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0
/Depend/MyGUI/Tools/LayoutEditor/MessageBoxManager.cpp
c70c55cf8dd7aac70dd1ea50f492f110d83c52a6
[]
no_license
lxinhcn/starworld
79ed06ca49d4064307ae73156574932d6185dbab
86eb0fb8bd268994454b0cfe6419ffef3fc0fc80
refs/heads/master
2021-01-10T07:43:51.858394
2010-09-15T02:38:48
2010-09-15T02:38:48
47,859,019
2
1
null
null
null
null
UTF-8
C++
false
false
1,600
cpp
/*! @file @author Albert Semenov @date 08/2010 */ #include "precompiled.h" #include "MessageBoxManager.h" template <> tools::MessageBoxManager* MyGUI::Singleton<tools::MessageBoxManager>::msInstance = nullptr; template <> const char* MyGUI::Singleton<tools::MessageBoxManager>::mClassTypeName("MessageBoxManager"); namespace tools { MessageBoxManager::MessageBoxManager() { } MessageBoxManager::~MessageBoxManager() { } void MessageBoxManager::initialise() { } void MessageBoxManager::shutdown() { } MyGUI::Message* MessageBoxManager::create(const MyGUI::UString& _caption, const MyGUI::UString& _message, MyGUI::MessageBoxStyle _style) { MyGUI::Message* message = MyGUI::Message::createMessageBox("Message", _caption, _message, _style); registerMessageBox(message); return message; } bool MessageBoxManager::hasAny() { return !mMessages.empty(); } void MessageBoxManager::endTop(MyGUI::MessageBoxStyle _button) { if (!mMessages.empty()) mMessages.back()->endMessage(_button); } void MessageBoxManager::registerMessageBox(MyGUI::Message* _message) { mMessages.push_back(_message); _message->eventMessageBoxResult += MyGUI::newDelegate(this, &MessageBoxManager::notifMessageBoxResultRegister); } void MessageBoxManager::notifMessageBoxResultRegister(MyGUI::Message* _sender, MyGUI::MessageBoxStyle _result) { VectorMessage::iterator item = std::find(mMessages.begin(), mMessages.end(), _sender); if (item != mMessages.end()) mMessages.erase(item); } } // namespace tools
[ "albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c" ]
[ [ [ 1, 62 ] ] ]
91fdd5940018c4f21e74f723024a3645d43500a9
12203ea9fe0801d613bbb2159d4f69cab3c84816
/Export/cpp/windows/obj/src/nme/Loader.cpp
e7523a6e132d86bb62dad24e9af7ffc9b729f513
[]
no_license
alecmce/haxe_game_of_life
91b5557132043c6e9526254d17fdd9bcea9c5086
35ceb1565e06d12c89481451a7bedbbce20fa871
refs/heads/master
2016-09-16T00:47:24.032302
2011-10-10T12:38:14
2011-10-10T12:38:14
2,547,793
0
0
null
null
null
null
UTF-8
C++
false
false
9,912
cpp
#include <hxcpp.h> #ifndef INCLUDED_cpp_Lib #include <cpp/Lib.h> #endif #ifndef INCLUDED_cpp_io_Process #include <cpp/io/Process.h> #endif #ifndef INCLUDED_haxe_io_Input #include <haxe/io/Input.h> #endif #ifndef INCLUDED_nme_Loader #include <nme/Loader.h> #endif namespace nme{ Void Loader_obj::__construct() { return null(); } Loader_obj::~Loader_obj() { } Dynamic Loader_obj::__CreateEmpty() { return new Loader_obj; } hx::ObjectPtr< Loader_obj > Loader_obj::__new() { hx::ObjectPtr< Loader_obj > result = new Loader_obj(); result->__construct(); return result;} Dynamic Loader_obj::__Create(hx::DynamicArray inArgs) { hx::ObjectPtr< Loader_obj > result = new Loader_obj(); result->__construct(); return result;} bool Loader_obj::moduleInit; ::String Loader_obj::moduleName; Dynamic Loader_obj::tryLoad( ::String inName,::String func,int args){ HX_SOURCE_PUSH("Loader_obj::tryLoad") HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",34) try{ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",36) Dynamic result = ::cpp::Lib_obj::load(inName,func,args); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",37) if (((result != null()))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",39) ::nme::Loader_obj::loaderTrace((HX_CSTRING("Got result ") + inName)); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",40) ::nme::Loader_obj::moduleName = inName; HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",41) return result; } } catch(Dynamic __e){ { Dynamic e = __e;{ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",44) ::nme::Loader_obj::loaderTrace((HX_CSTRING("Failed to load : ") + inName)); } } } HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",47) return null(); } STATIC_HX_DEFINE_DYNAMIC_FUNC3(Loader_obj,tryLoad,return ) ::String Loader_obj::findHaxeLib( ::String inLib){ HX_SOURCE_PUSH("Loader_obj::findHaxeLib") HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",52) try{ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",54) ::cpp::io::Process proc = ::cpp::io::Process_obj::__new(HX_CSTRING("haxelib"),Array_obj< ::String >::__new().Add(HX_CSTRING("path")).Add(inLib)); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",55) if (((proc != null()))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",57) ::haxe::io::Input stream = proc->_stdout; HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",58) try{ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",59) while((true)){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",62) ::String s = stream->readLine(); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",63) if (((s.substr((int)0,(int)1) != HX_CSTRING("-")))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",65) stream->close(); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",66) proc->close(); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",67) ::nme::Loader_obj::loaderTrace((HX_CSTRING("Found haxelib ") + s)); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",68) return s; } } } catch(Dynamic __e){ { Dynamic e = __e;{ } } } HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",73) stream->close(); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",74) proc->close(); } } catch(Dynamic __e){ { Dynamic e = __e;{ } } } HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",79) return HX_CSTRING(""); } STATIC_HX_DEFINE_DYNAMIC_FUNC1(Loader_obj,findHaxeLib,return ) Void Loader_obj::loaderTrace( ::String inStr){ { HX_SOURCE_PUSH("Loader_obj::loaderTrace") HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",87) Dynamic get_env = ::cpp::Lib_obj::load(HX_CSTRING("std"),HX_CSTRING("get_env"),(int)1); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",88) bool debug = (get_env(HX_CSTRING("NME_LOAD_DEBUG")) != null()); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",93) if ((debug)){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",94) ::cpp::Lib_obj::println(inStr); } } return null(); } STATIC_HX_DEFINE_DYNAMIC_FUNC1(Loader_obj,loaderTrace,(void)) Dynamic Loader_obj::sysName( ){ HX_SOURCE_PUSH("Loader_obj::sysName") HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",101) Dynamic sys_string = ::cpp::Lib_obj::load(HX_CSTRING("std"),HX_CSTRING("sys_string"),(int)0); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",102) return sys_string(); } STATIC_HX_DEFINE_DYNAMIC_FUNC0(Loader_obj,sysName,return ) Dynamic Loader_obj::load( ::String func,int args){ HX_SOURCE_PUSH("Loader_obj::load") HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",128) if ((::nme::Loader_obj::moduleInit)){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",129) return ::cpp::Lib_obj::load(::nme::Loader_obj::moduleName,func,args); } HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",133) ::nme::Loader_obj::moduleInit = true; HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",135) ::nme::Loader_obj::moduleName = HX_CSTRING("nme"); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",138) Dynamic result = ::nme::Loader_obj::tryLoad(HX_CSTRING("./nme"),func,args); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",139) if (((result == null()))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",140) result = ::nme::Loader_obj::tryLoad(HX_CSTRING(".\\nme"),func,args); } HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",143) if (((result == null()))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",144) result = ::nme::Loader_obj::tryLoad(HX_CSTRING("nme"),func,args); } HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",146) if (((result == null()))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",148) ::String slash = ( (((::nme::Loader_obj::sysName()->__Field(HX_CSTRING("substr"))((int)7)->__Field(HX_CSTRING("toLowerCase"))() == HX_CSTRING("windows")))) ? ::String(HX_CSTRING("\\")) : ::String(HX_CSTRING("/")) ); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",149) ::String haxelib = ::nme::Loader_obj::findHaxeLib(HX_CSTRING("nme")); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",150) if (((haxelib != HX_CSTRING("")))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",152) result = ::nme::Loader_obj::tryLoad(((((((haxelib + slash) + HX_CSTRING("ndll")) + slash) + ::nme::Loader_obj::sysName()) + slash) + HX_CSTRING("nme")),func,args); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",155) if (((result == null()))){ HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",156) result = ::nme::Loader_obj::tryLoad((((((((haxelib + slash) + HX_CSTRING("ndll")) + slash) + ::nme::Loader_obj::sysName()) + HX_CSTRING("64")) + slash) + HX_CSTRING("nme")),func,args); } } } HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",160) ::nme::Loader_obj::loaderTrace((HX_CSTRING("Result : ") + result)); HX_SOURCE_POS("C:\\Motion-Twin\\haxe\\dev\\nme/nme/Loader.hx",166) return result; } STATIC_HX_DEFINE_DYNAMIC_FUNC2(Loader_obj,load,return ) Loader_obj::Loader_obj() { } void Loader_obj::__Mark(HX_MARK_PARAMS) { HX_MARK_BEGIN_CLASS(Loader); HX_MARK_END_CLASS(); } Dynamic Loader_obj::__Field(const ::String &inName) { switch(inName.length) { case 4: if (HX_FIELD_EQ(inName,"load") ) { return load_dyn(); } break; case 7: if (HX_FIELD_EQ(inName,"tryLoad") ) { return tryLoad_dyn(); } if (HX_FIELD_EQ(inName,"sysName") ) { return sysName_dyn(); } break; case 10: if (HX_FIELD_EQ(inName,"moduleInit") ) { return moduleInit; } if (HX_FIELD_EQ(inName,"moduleName") ) { return moduleName; } break; case 11: if (HX_FIELD_EQ(inName,"findHaxeLib") ) { return findHaxeLib_dyn(); } if (HX_FIELD_EQ(inName,"loaderTrace") ) { return loaderTrace_dyn(); } } return super::__Field(inName); } Dynamic Loader_obj::__SetField(const ::String &inName,const Dynamic &inValue) { switch(inName.length) { case 10: if (HX_FIELD_EQ(inName,"moduleInit") ) { moduleInit=inValue.Cast< bool >(); return inValue; } if (HX_FIELD_EQ(inName,"moduleName") ) { moduleName=inValue.Cast< ::String >(); return inValue; } } return super::__SetField(inName,inValue); } void Loader_obj::__GetFields(Array< ::String> &outFields) { super::__GetFields(outFields); }; static ::String sStaticFields[] = { HX_CSTRING("moduleInit"), HX_CSTRING("moduleName"), HX_CSTRING("tryLoad"), HX_CSTRING("findHaxeLib"), HX_CSTRING("loaderTrace"), HX_CSTRING("sysName"), HX_CSTRING("load"), String(null()) }; static ::String sMemberFields[] = { String(null()) }; static void sMarkStatics(HX_MARK_PARAMS) { HX_MARK_MEMBER_NAME(Loader_obj::moduleInit,"moduleInit"); HX_MARK_MEMBER_NAME(Loader_obj::moduleName,"moduleName"); }; Class Loader_obj::__mClass; void Loader_obj::__register() { Static(__mClass) = hx::RegisterClass(HX_CSTRING("nme.Loader"), hx::TCanCast< Loader_obj> ,sStaticFields,sMemberFields, &__CreateEmpty, &__Create, &super::__SGetClass(), 0, sMarkStatics); } void Loader_obj::__boot() { hx::Static(moduleInit) = false; hx::Static(moduleName) = HX_CSTRING(""); } } // end namespace nme
[ [ [ 1, 283 ] ] ]
d35f149d7de4133da4c50c0a54abff320d808ef0
9773c3304eecc308671bcfa16b5390c81ef3b23a
/MDI AIPI V.6.92 2003 ( Correct Save Fired Rules, AM =-1, g_currentLine)/AIPI/NewProjectPage2.cpp
d506c346f1c804ae9b2772c28dd8e1ca0bf3f255
[]
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
3,876
cpp
// NewProjectPage2.cpp : implementation file // #include "stdafx.h" #include "AIPI.h" #include "NewProjectPage2.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CNewProjectPage2 property page IMPLEMENT_DYNCREATE(CNewProjectPage2, CPropertyPageEx) CNewProjectPage2::CNewProjectPage2() : CPropertyPageEx(CNewProjectPage2::IDD, 0, IDS_HEADERTITLE_PROJ_PAGE2, IDS_HEADERSUBTITLE_PROJ_PAGE2) { //{{AFX_DATA_INIT(CNewProjectPage2) //}}AFX_DATA_INIT } CNewProjectPage2::~CNewProjectPage2() { } void CNewProjectPage2::DoDataExchange(CDataExchange* pDX) { CPropertyPageEx::DoDataExchange(pDX); //{{AFX_DATA_MAP(CNewProjectPage2) DDX_Control(pDX, IDC_CHECK_IMAGES, m_chkImages); DDX_Control(pDX, IDC_CHECK_VIDEOS, m_chkVideos); DDX_Control(pDX, IDC_CHECK_DB, m_chkDataBase); DDX_Control(pDX, IDC_CHECK_OTHER, m_chkOthers); DDX_Control(pDX, IDC_RADIO_FORDWARD, m_radioFordward); DDX_Control(pDX, IDC_RADIO_BACKWARD, m_radioBackward); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CNewProjectPage2, CPropertyPageEx) //{{AFX_MSG_MAP(CNewProjectPage2) ON_BN_CLICKED(IDC_RADIO_FORDWARD, OnRadioForward) ON_BN_CLICKED(IDC_RADIO_BACKWARD, OnRadioBackward) ON_BN_CLICKED(IDC_CHECK_IMAGES, OnCheckImages) ON_BN_CLICKED(IDC_CHECK_VIDEOS, OnCheckVideos) ON_BN_CLICKED(IDC_CHECK_DB, OnCheckDataBases) ON_BN_CLICKED(IDC_CHECK_OTHER, OnCheckOthers) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNewProjectPage2 message handlers BOOL CNewProjectPage2::OnSetActive() { CPropertySheet* pSheet = (CPropertySheet*)GetParent(); ASSERT_KINDOF(CPropertySheet, pSheet); pSheet->SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT); return CPropertyPageEx::OnSetActive(); } BOOL CNewProjectPage2::OnInitDialog() { CPropertyPageEx::OnInitDialog(); CWnd* pCtrl=GetDlgItem(IDC_IMAGE_NEW_PAGE2); ASSERT(pCtrl!=NULL); CString sCurrentDir; GetCurrentDirectory( MAX_SIZE_PATH, sCurrentDir.GetBufferSetLength(MAX_SIZE_PATH) ); sCurrentDir.ReleaseBuffer(); CString m_sFilename = sCurrentDir + _T("\\res\\plarge.bmp"); int m_nAlign = 0; CRect rect; pCtrl->GetWindowRect(rect); pCtrl->DestroyWindow(); ScreenToClient(rect); m_pictureWnd.Create(NULL,NULL,WS_CHILD|WS_VISIBLE,rect,this,IDC_IMAGE_NEW_PAGE2); m_backPainterOrganizer.Attach(&m_pictureWnd,m_sFilename,(PaintType)m_nAlign); m_pictureWnd.ModifyStyleEx(NULL,WS_EX_CLIENTEDGE,SWP_DRAWFRAME); m_pictureWnd.RedrawWindow(); UpdateData(true); m_radioFordward.SetCheck(TRUE); g_projectInference = _T("Fordward-Chaining"); g_projectResource[0] = _T("Not Used"); g_projectResource[1] = _T("Not Used"); g_projectResource[2] = _T("Not Used"); g_projectResource[3] = _T("Not Used"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } LRESULT CNewProjectPage2::OnWizardNext() { /* UpdateData(true); m_radioFordward; m_radioBackward; m_chkImages; m_chkVideos; m_chkDataBase; m_chkOthers; */ return CPropertyPageEx::OnWizardNext(); } void CNewProjectPage2::OnRadioForward() { g_projectInference = _T("Forward-Chaining"); } void CNewProjectPage2::OnRadioBackward() { g_projectInference = _T("Backward-Chaining"); } void CNewProjectPage2::OnCheckImages() { g_projectResource[0] = _T("Used"); } void CNewProjectPage2::OnCheckVideos() { g_projectResource[1] = _T("Used"); } void CNewProjectPage2::OnCheckDataBases() { g_projectResource[2] = _T("Used"); } void CNewProjectPage2::OnCheckOthers() { g_projectResource[3] = _T("Used"); }
[ [ [ 1, 153 ] ] ]
e6f1d1855212213338b5eb4cc619fac7029b5722
c70941413b8f7bf90173533115c148411c868bad
/core/include/vtxColor.h
a6c0264ebdb8fc9c2111c21a5b81c444832c554f
[]
no_license
cnsuhao/vektrix
ac6e028dca066aad4f942b8d9eb73665853fbbbe
9b8c5fa7119ff7f3dc80fb05b7cdba335cf02c1a
refs/heads/master
2021-06-23T11:28:34.907098
2011-03-27T17:39:37
2011-03-27T17:39:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,980
h
/* ----------------------------------------------------------------------------- This source file is part of "vektrix" (the rich media and vector graphics rendering library) For the latest info, see http://www.fuse-software.com/ Copyright (c) 2009-2010 Fuse-Software (tm) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- */ #ifndef __vtxColor_H__ #define __vtxColor_H__ #include "vtxPrerequisites.h" namespace vtx { //----------------------------------------------------------------------- /** Represents a RGBA color value */ class vtxExport Color { public: float r, g, b, a; static const Color BLACK; static const Color RED; static const Color GREEN; static const Color BLUE; Color(float red = 1.0f, float green = 1.0f, float blue = 1.0f, float alpha = 1.0f); }; //----------------------------------------------------------------------- } #endif
[ "stonecold_@9773a11d-1121-4470-82d2-da89bd4a628a", "fixxxeruk@9773a11d-1121-4470-82d2-da89bd4a628a" ]
[ [ [ 1, 31 ], [ 33, 53 ] ], [ [ 32, 32 ] ] ]
e4bf0d23462686aa68ba81862eb8e9636056e37b
5ff30d64df43c7438bbbcfda528b09bb8fec9e6b
/kgraphics/math/Vector2.h
35618fbfbc09fd0ec1809324d6174c3d525672c4
[]
no_license
lvtx/gamekernel
c80cdb4655f6d4930a7d035a5448b469ac9ae924
a84d9c268590a294a298a4c825d2dfe35e6eca21
refs/heads/master
2016-09-06T18:11:42.702216
2011-09-27T07:22:08
2011-09-27T07:22:08
38,255,025
3
1
null
null
null
null
UTF-8
C++
false
false
3,085
h
#pragma once #include <kgraphics/math/Writer.h> namespace gfx { class Vector2 { public: // constructor/destructor inline Vector2() {} inline Vector2( float _x, float _y ) : x(_x), y(_y) { } inline ~Vector2() {} // text output (for debugging) friend Writer& operator<<(Writer& out, const Vector2& source); // accessors inline float& operator[]( unsigned int i ) { return (&x)[i]; } inline float operator[]( unsigned int i ) const { return (&x)[i]; } float Length() const; float LengthSquared() const; // comparison bool operator==( const Vector2& other ) const; bool operator!=( const Vector2& other ) const; bool IsZero() const; // manipulators inline void Set( float _x, float _y ); void Clean(); // sets near-zero elements to 0 inline void Zero(); // sets all elements to 0 void Normalize(); // sets to unit vector // operators Vector2 operator-() const; // addition/subtraction Vector2 operator+( const Vector2& other ) const; Vector2& operator+=( const Vector2& other ); Vector2 operator-( const Vector2& other ) const; Vector2& operator-=( const Vector2& other ); // scalar multiplication Vector2 operator*( float scalar ); friend Vector2 operator*( float scalar, const Vector2& vector ); Vector2& operator*=( float scalar ); Vector2 operator/( float scalar ); Vector2& operator/=( float scalar ); // dot product float Dot( const Vector2& vector ) const; friend float Dot( const Vector2& vector1, const Vector2& vector2 ); // perpendicular and cross product equivalent Vector2 Perpendicular() const { return Vector2(-y, x); } float PerpDot( const Vector2& vector ) const; friend float PerpDot( const Vector2& vector1, const Vector2& vector2 ); Vector2& RotationPos(float dir, float rad); // useful defaults static Vector2 xAxis; static Vector2 yAxis; static Vector2 origin; static Vector2 xy; // member variables float x, y; protected: private: }; //------------------------------------------------------------------------------- // @ Vector2::Set() //------------------------------------------------------------------------------- // Set vector elements //------------------------------------------------------------------------------- inline void Vector2::Set( float _x, float _y ) { x = _x; y = _y; } // End of Vector2::Set() //------------------------------------------------------------------------------- // @ Vector2::Zero() //------------------------------------------------------------------------------- // Zero all elements //------------------------------------------------------------------------------- inline void Vector2::Zero() { x = y = 0.0f; } // End of Vector2::Zero() } // namespace gfx
[ "keedongpark@keedongpark" ]
[ [ [ 1, 104 ] ] ]
c13ebb72c28417244f0c02c652ada2294f1c0659
cd0987589d3815de1dea8529a7705caac479e7e9
/webkit/WebKit2/Shared/win/WebEventFactory.cpp
796a9148e6fbc469b38675f19fd50de6e68d34db
[]
no_license
azrul2202/WebKit-Smartphone
0aab1ff641d74f15c0623f00c56806dbc9b59fc1
023d6fe819445369134dee793b69de36748e71d7
refs/heads/master
2021-01-15T09:24:31.288774
2011-07-11T11:12:44
2011-07-11T11:12:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,688
cpp
/* * Copyright (C) 2010 Apple Inc. All rights reserved. * Copyright (C) 2006-2009 Google Inc. 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "WebEventFactory.h" #include <windowsx.h> #include <wtf/ASCIICType.h> using namespace WebCore; namespace WebKit { static const unsigned short HIGH_BIT_MASK_SHORT = 0x8000; static const unsigned short SPI_GETWHEELSCROLLCHARS = 0x006C; static const unsigned WM_VISTA_MOUSEHWHEEL = 0x30E; static inline LPARAM relativeCursorPosition(HWND hwnd) { POINT point = { -1, -1 }; ::GetCursorPos(&point); ::ScreenToClient(hwnd, &point); return MAKELPARAM(point.x, point.y); } static inline POINT positionForEvent(HWND hWnd, LPARAM lParam) { POINT point = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; return point; } static inline POINT globalPositionForEvent(HWND hWnd, LPARAM lParam) { POINT point = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; ::ClientToScreen(hWnd, &point); return point; } static int horizontalScrollChars() { static ULONG scrollChars; if (!scrollChars && !::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &scrollChars, 0)) scrollChars = 1; return scrollChars; } static int verticalScrollLines() { static ULONG scrollLines; if (!scrollLines && !::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0)) scrollLines = 3; return scrollLines; } static inline int clickCount(WebEvent::Type type, WebMouseEvent::Button button, int positionX, int positionY, double timeStampSeconds) { static int gLastClickCount; static double gLastClickTime; static int lastClickPositionX; static int lastClickPositionY; static WebMouseEvent::Button lastClickButton = WebMouseEvent::LeftButton; bool cancelPreviousClick = (abs(lastClickPositionX - positionX) > (::GetSystemMetrics(SM_CXDOUBLECLK) / 2)) || (abs(lastClickPositionY - positionY) > (::GetSystemMetrics(SM_CYDOUBLECLK) / 2)) || ((timeStampSeconds - gLastClickTime) * 1000.0 > ::GetDoubleClickTime()); if (type == WebEvent::MouseDown) { if (!cancelPreviousClick && (button == lastClickButton)) ++gLastClickCount; else { gLastClickCount = 1; lastClickPositionX = positionX; lastClickPositionY = positionY; } gLastClickTime = timeStampSeconds; lastClickButton = button; } else if (type == WebEvent::MouseMove) { if (cancelPreviousClick) { gLastClickCount = 0; lastClickPositionX = 0; lastClickPositionY = 0; gLastClickTime = 0; } } return gLastClickCount; } static inline WebEvent::Modifiers modifiersForEvent(WPARAM wparam) { unsigned modifiers = 0; if (wparam & MK_CONTROL) modifiers |= WebEvent::ControlKey; if (wparam & MK_SHIFT) modifiers |= WebEvent::ShiftKey; if (::GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT) modifiers |= WebEvent::AltKey; return static_cast<WebEvent::Modifiers>(modifiers); } static inline WebEvent::Modifiers modifiersForCurrentKeyState() { unsigned modifiers = 0; if (::GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT) modifiers |= WebEvent::ControlKey; if (::GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT) modifiers |= WebEvent::ShiftKey; if (::GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT) modifiers |= WebEvent::AltKey; return static_cast<WebEvent::Modifiers>(modifiers); } static inline WebEvent::Type keyboardEventTypeForEvent(UINT message) { switch (message) { case WM_SYSKEYDOWN: case WM_KEYDOWN: return WebEvent::RawKeyDown; break; case WM_SYSKEYUP: case WM_KEYUP: return WebEvent::KeyUp; break; case WM_IME_CHAR: case WM_SYSCHAR: case WM_CHAR: return WebEvent::Char; break; default: ASSERT_NOT_REACHED(); return WebEvent::Char; } } static inline bool isSystemKeyEvent(UINT message) { switch (message) { case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_SYSCHAR: return true; default: return false; } } static bool isKeypadEvent(WPARAM wParam, LPARAM lParam, WebEvent::Type type) { if (type != WebEvent::RawKeyDown && type != WebEvent::KeyUp) return false; switch (wParam) { case VK_NUMLOCK: case VK_NUMPAD0: case VK_NUMPAD1: case VK_NUMPAD2: case VK_NUMPAD3: case VK_NUMPAD4: case VK_NUMPAD5: case VK_NUMPAD6: case VK_NUMPAD7: case VK_NUMPAD8: case VK_NUMPAD9: case VK_MULTIPLY: case VK_ADD: case VK_SEPARATOR: case VK_SUBTRACT: case VK_DECIMAL: case VK_DIVIDE: return true; case VK_RETURN: return HIWORD(lParam) & KF_EXTENDED; case VK_INSERT: case VK_DELETE: case VK_PRIOR: case VK_NEXT: case VK_END: case VK_HOME: case VK_LEFT: case VK_UP: case VK_RIGHT: case VK_DOWN: return !(HIWORD(lParam) & KF_EXTENDED); default: return false; } } static String textFromEvent(WPARAM wparam, WebEvent::Type type) { if (type != WebEvent::Char) return String(); UChar c = static_cast<UChar>(wparam); return String(&c, 1); } static String unmodifiedTextFromEvent(WPARAM wparam, WebEvent::Type type) { if (type != WebEvent::Char) return String(); UChar c = static_cast<UChar>(wparam); return String(&c, 1); } static String keyIdentifierFromEvent(WPARAM wparam, WebEvent::Type type) { if (type == WebEvent::Char) return String(); unsigned short keyCode = static_cast<unsigned short>(wparam); switch (keyCode) { case VK_MENU: return String("Alt"); case VK_CONTROL: return String("Control"); case VK_SHIFT: return String("Shift"); case VK_CAPITAL: return String("CapsLock"); case VK_LWIN: case VK_RWIN: return String("Win"); case VK_CLEAR: return String("Clear"); case VK_DOWN: return String("Down"); case VK_END: return String("End"); case VK_RETURN: return String("Enter"); case VK_EXECUTE: return String("Execute"); case VK_F1: return String("F1"); case VK_F2: return String("F2"); case VK_F3: return String("F3"); case VK_F4: return String("F4"); case VK_F5: return String("F5"); case VK_F6: return String("F6"); case VK_F7: return String("F7"); case VK_F8: return String("F8"); case VK_F9: return String("F9"); case VK_F10: return String("F11"); case VK_F12: return String("F12"); case VK_F13: return String("F13"); case VK_F14: return String("F14"); case VK_F15: return String("F15"); case VK_F16: return String("F16"); case VK_F17: return String("F17"); case VK_F18: return String("F18"); case VK_F19: return String("F19"); case VK_F20: return String("F20"); case VK_F21: return String("F21"); case VK_F22: return String("F22"); case VK_F23: return String("F23"); case VK_F24: return String("F24"); case VK_HELP: return String("Help"); case VK_HOME: return String("Home"); case VK_INSERT: return String("Insert"); case VK_LEFT: return String("Left"); case VK_NEXT: return String("PageDown"); case VK_PRIOR: return String("PageUp"); case VK_PAUSE: return String("Pause"); case VK_SNAPSHOT: return String("PrintScreen"); case VK_RIGHT: return String("Right"); case VK_SCROLL: return String("Scroll"); case VK_SELECT: return String("Select"); case VK_UP: return String("Up"); case VK_DELETE: return String("U+007F"); // Standard says that DEL becomes U+007F. default: return String::format("U+%04X", toASCIIUpper(keyCode)); } } WebMouseEvent WebEventFactory::createWebMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { WebEvent::Type type; WebMouseEvent::Button button = WebMouseEvent::NoButton; switch (message) { case WM_MOUSEMOVE: type = WebEvent::MouseMove; if (wParam & MK_LBUTTON) button = WebMouseEvent::LeftButton; else if (wParam & MK_MBUTTON) button = WebMouseEvent::MiddleButton; else if (wParam & MK_RBUTTON) button = WebMouseEvent::RightButton; break; case WM_MOUSELEAVE: type = WebEvent::MouseMove; if (wParam & MK_LBUTTON) button = WebMouseEvent::LeftButton; else if (wParam & MK_MBUTTON) button = WebMouseEvent::MiddleButton; else if (wParam & MK_RBUTTON) button = WebMouseEvent::RightButton; // Set the current mouse position (relative to the client area of the // current window) since none is specified for this event. lParam = relativeCursorPosition(hWnd); break; case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: type = WebEvent::MouseDown; button = WebMouseEvent::LeftButton; break; case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: type = WebEvent::MouseDown; button = WebMouseEvent::MiddleButton; break; case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: type = WebEvent::MouseDown; button = WebMouseEvent::RightButton; break; case WM_LBUTTONUP: type = WebEvent::MouseUp; button = WebMouseEvent::LeftButton; break; case WM_MBUTTONUP: type = WebEvent::MouseUp; button = WebMouseEvent::MiddleButton; break; case WM_RBUTTONUP: type = WebEvent::MouseUp; button = WebMouseEvent::RightButton; break; default: ASSERT_NOT_REACHED(); type = WebEvent::KeyDown; } POINT position = positionForEvent(hWnd, lParam); POINT globalPosition = globalPositionForEvent(hWnd, lParam); int positionX = position.x; int positionY = position.y; int globalPositionX = globalPosition.x; int globalPositionY = globalPosition.y; double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0) int clickCount = WebKit::clickCount(type, button, positionX, positionY, timestamp); WebEvent::Modifiers modifiers = modifiersForEvent(wParam); return WebMouseEvent(type, button, positionX, positionY, globalPositionX, globalPositionY, 0, 0, 0, clickCount, modifiers, timestamp); } WebWheelEvent WebEventFactory::createWebWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { // Taken from WebCore static const float cScrollbarPixelsPerLine = 100.0f / 3.0f; POINT position = positionForEvent(hWnd, lParam); POINT globalPosition = globalPositionForEvent(hWnd, lParam); int positionX = position.x; int positionY = position.y; int globalPositionX = globalPosition.x; int globalPositionY = globalPosition.y; WebWheelEvent::Granularity granularity = WebWheelEvent::ScrollByPixelWheelEvent; WebEvent::Modifiers modifiers = modifiersForEvent(wParam); double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0) int deltaX = 0; int deltaY = 0; int wheelTicksX = 0; int wheelTicksY = 0; float delta = GET_WHEEL_DELTA_WPARAM(wParam) / static_cast<float>(WHEEL_DELTA); bool isMouseHWheel = (message == WM_VISTA_MOUSEHWHEEL); if (isMouseHWheel) { wheelTicksX = delta; wheelTicksY = 0; delta = -delta; } else { wheelTicksX = 0; wheelTicksY = delta; } if (isMouseHWheel || (modifiers & WebEvent::ShiftKey)) { deltaX = delta * static_cast<float>(horizontalScrollChars()) * cScrollbarPixelsPerLine; deltaY = 0; granularity = WebWheelEvent::ScrollByPixelWheelEvent; } else { deltaX = 0; deltaY = delta; int verticalMultiplier = verticalScrollLines(); if (verticalMultiplier == WHEEL_PAGESCROLL) granularity = WebWheelEvent::ScrollByPageWheelEvent; else { granularity = WebWheelEvent::ScrollByPixelWheelEvent; deltaY *= static_cast<float>(verticalMultiplier) * cScrollbarPixelsPerLine; } } return WebWheelEvent(WebEvent::Wheel, positionX, positionY, globalPositionX, globalPositionY, deltaX, deltaY, wheelTicksX, wheelTicksY, granularity, modifiers, timestamp); } WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { WebEvent::Type type = keyboardEventTypeForEvent(message); String text = textFromEvent(wparam, type); String unmodifiedText = unmodifiedTextFromEvent(wparam, type); String keyIdentifier = keyIdentifierFromEvent(wparam, type); int windowsVirtualKeyCode = static_cast<int>(wparam); int nativeVirtualKeyCode = static_cast<int>(wparam); bool autoRepeat = HIWORD(lparam) & KF_REPEAT; bool isKeypad = isKeypadEvent(wparam, lparam, type); bool isSystemKey = isSystemKeyEvent(message); WebEvent::Modifiers modifiers = modifiersForCurrentKeyState(); double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0) return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp); } } // namespace WebKit
[ [ [ 1, 478 ] ] ]
8e9647c47f66501ca79e5975ca875c89d1e00a17
658a1222b06267650db18923a269d7cf7ae0f100
/BallContactListener.cpp
f224d4ef85312881e4a8ffe3efaffa22c05aa634
[]
no_license
imclab/H.E.A.D
4c3eb84ea8fd12a6b1b6c0598dd910f541aa92e0
02303c25be37d3708a8db66a8f7bb5ee9610c841
refs/heads/master
2021-01-18T10:42:07.368559
2010-09-19T17:43:49
2010-09-19T17:43:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,680
cpp
#include "BallContactListener.h" #include "PhysicalObject.h" #include "ScreenManager.h" #include "Ball.h" #include <stdio.h> //quando 2 objectos colidem pela primeira vez void BallContactListener::BeginContact(b2Contact* contact){ printf("touch\n"); const b2Body* bodyA = contact->GetFixtureA()->GetBody(); const b2Body* bodyB = contact->GetFixtureB()->GetBody(); b2Vec2 posA = bodyA->GetPosition(); b2Vec2 posB = bodyB->GetPosition(); printf("PosA x:%f y:%f\n",posA.x,posA.y); printf("PosB x:%f y:%f\n",posB.x,posB.y); //vou obter o objecto a partir da userdata PhysicalObject * objA = (PhysicalObject *) bodyA->GetUserData(); PhysicalObject * objB = (PhysicalObject *) bodyB->GetUserData(); printf("obj A type: %d\n",objA->getType()); printf("obj B type: %d\n",objB->getType()); if (objA->getType() == O_BALL){ ((Ball *)objA)->playsound(); }else{ ((Ball *)objB)->playsound(); } // no caso de ganhar if (objA->getType()==O_BALL && objB->getType()== O_GOALSENSOR || objA->getType()==O_GOALSENSOR && objB->getType()== O_BALL ) ScreenManager::getInstance()->setScreenType(S_WIN); //no caso de tocar num pit if (objA->getType()==O_BALL && objB->getType()== O_PIT || objA->getType()==O_PIT && objB->getType()== O_BALL ) ScreenManager::getInstance()->setScreenType(S_OVER); } /// Called when two fixtures cease to touch. void BallContactListener::EndContact(b2Contact* contact){ printf("...and go\n"); } void BallContactListener::PreSolve(b2Contact* contact, const b2Manifold* oldManifold) { } void BallContactListener::PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) { }
[ "[email protected]", "jrrt@.(none)" ]
[ [ [ 1, 3 ], [ 5, 24 ], [ 31, 53 ] ], [ [ 4, 4 ], [ 25, 30 ] ] ]
f92b1a3d4ed1d845c90e006322215a370f85975d
54cacc105d6bacdcfc37b10d57016bdd67067383
/trunk/source/io/sections/TreeSection.cpp
5c2fb642d8ec0cdb6a9dc98a5b7f456230425abc
[]
no_license
galek/hesperus
4eb10e05945c6134901cc677c991b74ce6c8ac1e
dabe7ce1bb65ac5aaad144933d0b395556c1adc4
refs/heads/master
2020-12-31T05:40:04.121180
2009-12-06T17:38:49
2009-12-06T17:38:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,014
cpp
/*** * hesperus: TreeSection.cpp * Copyright Stuart Golodetz, 2009. All rights reserved. ***/ #include "TreeSection.h" #include <source/io/util/LineIO.h> #include <source/level/trees/BSPTree.h> namespace hesp { //#################### LOADING METHODS #################### /** Loads a BSP tree from the specified std::istream. @param is The std::istream @return The BSP tree */ BSPTree_Ptr TreeSection::load(std::istream& is) { std::string line; LineIO::read_checked_line(is, "BSPTree"); LineIO::read_checked_line(is, "{"); BSPTree_Ptr tree = BSPTree::load_postorder_text(is); LineIO::read_checked_line(is, "}"); return tree; } //#################### SAVING METHODS #################### /** Saves a BSP tree to the specified std::ostream. @param os The std::ostream @param tree The BSP tree */ void TreeSection::save(std::ostream& os, const BSPTree_CPtr& tree) { os << "BSPTree\n"; os << "{\n"; tree->output_postorder_text(os); os << "}\n"; } }
[ [ [ 1, 46 ] ] ]
f2e20b97c1ac1d42549cdd667771c0ffa7a65f96
27d5670a7739a866c3ad97a71c0fc9334f6875f2
/CPP/Targets/SupportWFLib/symbian/HelpUrlHandler.h
217b9326c1d0a37c51f6d62a55ae509c6ca5db95
[ "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
6,663
h
/* 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. */ #ifndef HELP_URL_HANDLER_H #define HELP_URL_HANDLER_H #include <e32base.h> #include "machine.h" /** * Struct used to contain the view uid mapped to * the views help page name. */ struct ViewNameMapping { TInt iViewId; char* iViewName; }; class CHelpUrlHandler : public CBase { private: /** * Class constructor * * @param */ CHelpUrlHandler(TInt aNoOfMappings); /** * Symbian second stage ConstructL. * * @param aViewNameMappings Array of the applications view-uids mapped * to the help page name. */ void ConstructL(const ViewNameMapping* aViewNameMappings, TInt aLangCodeId); /** * Symbian second stage ConstructL. * * @param aViewNameMappings Array of the applications view-uids mapped * to the help page name. * @param aLangCode The used language code in iso format. */ void ConstructL(const ViewNameMapping* aViewNameMappings, const TDesC& aLangCode); public: /** * Class Destructor */ virtual ~CHelpUrlHandler(); /** * Symbian static NewLC function. * * @param aViewNameMappings Array of the applications view-uids mapped * to the help page name. * @return A HelpUrlHandler instance. */ static CHelpUrlHandler* NewLC(const ViewNameMapping* aViewNameMappings, TInt aNoOfMappings, TInt aLangCodeId); /** * Symbian static NewL function. * * @param aViewNameMappings Array of the applications view-uids mapped * to the help page name. * @return A HelpUrlHandler instance. */ static CHelpUrlHandler* NewL(const ViewNameMapping* aViewNameMappings, TInt aNoOfMappings, TInt aLangCodeId); /** * Symbian static NewLc function. * * @param aViewNameMappings Array of the applications view-uids mapped * to the help page name. * @param aNoOfMappings * @param aLangCode The used language code in iso format. * @return A HelpUrlHandler instance. */ static CHelpUrlHandler* NewLC(const ViewNameMapping* aViewNameMappings, TInt aNoOfMappings, const TDesC& aLangCode); /** * Symbian static NewL function. * * @param aViewNameMappings Array of the applications view-uids mapped * to the help page name. * @param aNoOfMappings * @param aLangCode The used language code in iso format. * @return A HelpUrlHandler instance. */ static CHelpUrlHandler* NewL(const ViewNameMapping* aViewNameMappings, TInt aNoOfMappings, const TDesC& aLangCode); public: /** * Returns a formatted string for use as help url. * Allocates and leaves the string on the cleanup stack. * * @param aViewId The id of the current view. * @param aLangCode The current language code. * @return The full url to the help file. */ HBufC* FormatLC(TInt aViewId, const TDesC& aAnchorName); /** * Returns a formatted string for use as help url. * Allocates and leaves the string on the cleanup stack. * * @param aViewId The id of the current view. * @param aLangCode The current language code. * @return The full url to the help file. */ HBufC* FormatLC(TInt aViewId, const HBufC* aAnchorString = NULL); /** * Returns a formatted string for use as help url. * Allocates the string but does not leave it on the cleanup stack. * * @param aViewId The id of the current view. * @param aLangCode The current language code. * @return The full url to the help file. */ HBufC* FormatL(TInt aViewId, const TDesC& aAnchorName); /** * Returns a formatted string for use as help url. * Allocates the string but does not leave it on the cleanup stack. * * @param aViewId The id of the current view. * @param aLangCode The current language code. * @return The full url to the help file. */ HBufC* FormatL(TInt aViewId, const HBufC* aAnchorString = NULL); TInt HelpFromView(); /** * Get the help page name for view. * * @param aViewId The view. * @return The name for the view. */ HBufC* GetHelpPageNameL( TInt aViewId ); private: ViewNameMapping** iViewNameMappings; TInt iNoOfMappings; HBufC* iLangCode; }; #endif /* HELP_URL_HANDLER_H */
[ [ [ 1, 180 ] ] ]
6be235f9da26b3d563e39dfc6e806a7c04b29fff
619941b532c6d2987c0f4e92b73549c6c945c7e5
/Include/NuclexMain/Main.h
ba313413a4e9652a3e27ebf7e570926be7cc80b5
[]
no_license
dzw/stellarengine
2b70ddefc2827be4f44ec6082201c955788a8a16
2a0a7db2e43c7c3519e79afa56db247f9708bc26
refs/heads/master
2016-09-01T21:12:36.888921
2008-12-12T12:40:37
2008-12-12T12:40:37
36,939,169
0
0
null
null
null
null
UTF-8
C++
false
false
3,281
h
//  // // # # ### # # -= Nuclex Library =-  // // ## # # # ## ## Main.h - Nuclex program entry wrapper  // // ### # # ###  // // # ### # ### Provides a better alternative to the main() function  // // # ## # # ## ##  // // # # ### # # R1 (C)2002-2004 Markus Ewald -> License.txt  // //  // #ifndef NUCLEXMAIN_MAIN_H #define NUCLEXMAIN_MAIN_H #include "Nuclex/Nuclex.h" #include "Nuclex/Support/String.h" namespace Nuclex { //  // //  Nuclex::Environment()  // //  // /// Environment information provider /** Provides informations about the environment in which the application was launched (eg. which path, operating system) */ class Environment { public: /// Operating systems enum OperatingSystem { OS_UNKNWON = 0, ///< Unknown OS OS_WIN32, ///< Win32 OS_LINUX ///< Linux }; /// Destructor /** Destroys an instance of CEnvironment */ virtual ~Environment() {} // // Environment implementation // public: /// Display a message box virtual void showMessageBox(const string &sCaption, const string &sText) = 0; /// Display an error message with ok / cancel buttons virtual bool showErrorBox(const string &sCaption, const string &sText) = 0; /// Get command line arguments /** Returns the command line arguments with which the application was launched @return The command line string */ virtual const string &getCommandLine() const = 0; /// Get launch path /** Retrieves the path from which the application was launched @return The launch path */ virtual const string &getLaunchPath() const = 0; /// Get application path /** Retrieves the path in which the application's executable resides @return The application's path */ virtual const string &getApplicationPath() const = 0; /// Get operating system /** Returns the operating system under which the application runs @return The current operating system */ virtual OperatingSystem getOperatingSystem() const = 0; /// Get total amount of memory /** Returns the amount of memory installed on the system in megabyte @return The amount of memory */ virtual size_t getMemorySize() const = 0; }; } // namespace Nuclex extern void NuclexMain(const Nuclex::Environment &Environment); #endif // NUCLEXMAIN_MAIN_H
[ "ctuoMail@5f320639-c338-0410-82ad-c55551ec1e38" ]
[ [ [ 1, 89 ] ] ]
159648ddb104be6d1908c9b6d36eb7ab824bb0a1
9ad9345e116ead00be7b3bd147a0f43144a2e402
/Extraction/SMDataExtraction/SMDataExtraction/BitStreamInfo.h
9f7660594576b13b75aa3f38ffe139d07f3a37e3
[]
no_license
asankaf/scalable-data-mining-framework
e46999670a2317ee8d7814a4bd21f62d8f9f5c8f
811fddd97f52a203fdacd14c5753c3923d3a6498
refs/heads/master
2020-04-02T08:14:39.589079
2010-07-18T16:44:56
2010-07-18T16:44:56
33,870,353
0
0
null
null
null
null
UTF-8
C++
false
false
3,349
h
#pragma once #include "boost/dynamic_bitset.hpp" #include <vector> #include <string> using namespace boost; using namespace std; class BitStreamInfo{ public: __declspec(dllexport) BitStreamInfo(); __declspec(dllexport) BitStreamInfo(int bitCount); __declspec(dllexport) ~BitStreamInfo(); //__declspec(dllexport) virtual void printVector() = 0; //__declspec(dllexport) virtual void setCompressedStream(vector<unsigned long int> &x) = 0; //__declspec(dllexport) virtual void printArray() = 0; //__declspec(dllexport) virtual void printCompressedStream() = 0; //__declspec(dllexport) virtual vector<unsigned long int>& getCompressedVector() = 0; __declspec(dllexport) virtual dynamic_bitset<> Decompress() = 0; __declspec(dllexport) virtual void CompressWords(boost::dynamic_bitset<>& bitMap) = 0; //__declspec(dllexport) virtual void flip() = 0; //__declspec(dllexport) virtual int getMainArrayLength() = 0; //__declspec(dllexport) virtual dynamic_bitset<> getCompressedWord() = 0; //__declspec(dllexport) virtual int getValue(boost::dynamic_bitset<> & bitMap,int startIndex,int offset) = 0; __declspec(dllexport) virtual int GetSpaceUtilisation() = 0; __declspec(dllexport) virtual BitStreamInfo* operator~() = 0; __declspec(dllexport) virtual BitStreamInfo* operator &(BitStreamInfo &) = 0; __declspec(dllexport) virtual BitStreamInfo* operator |(BitStreamInfo &) = 0; //__declspec(dllexport) virtual const unsigned long int ActiveWordSize() = 0 ; //__declspec(dllexport) virtual void ActiveWordSize(unsigned long int val) = 0; //__declspec(dllexport) virtual unsigned long int ActiveWord() = 0; //__declspec(dllexport) virtual void ActiveWord(unsigned long int val) = 0; //__declspec(dllexport) virtual int MainArraySize() const = 0; //__declspec(dllexport) virtual void MainArraySize(int val) = 0; __declspec(dllexport) dynamic_bitset<> getProcessedBitStream(); __declspec(dllexport) unsigned long long count(){return this->_decompressedVBitStream.count();} __declspec(dllexport) void convert(dynamic_bitset<> bitStream); __declspec(dllexport) void setBitValue(int pos,bool val) {this->_decompressedVBitStream[pos] = val;} __declspec(dllexport) vector<int> getActiveBitIDs(); __declspec(dllexport) int BitCount() {return this->_bitCount;} __declspec(dllexport) void setBitCount(int bitCount){this->_bitCount = bitCount;this->_decompressedVBitStream.resize(bitCount);} __declspec(dllexport) int BitStreamAllocAttID() {return this->_bitStreamAllocAttID;} __declspec(dllexport) void setBitStreamAllocAttID(int attID){this->_bitStreamAllocAttID = attID;} __declspec(dllexport) string BitStreamAllocAttName() {return this->_bitStreamAllocAttName;} __declspec(dllexport) void setBitStreamAllocAttName(string attName){this->_bitStreamAllocAttName = attName;} /* static const unsigned long int ZERO_LITERAL = 0; static const unsigned long int ONE_LITERAL = 2147483647; static const unsigned long int ONE_GAP_START_FLAG = 3221225472; static const unsigned long int ZERO_GAP_START_FLAG = 2147483648; static const int LITERAL_WORD = 0; static const int ZERO_GAP_WORD = 1; static const int ONE_GAP_WORD = 2; */ private: int _bitCount; dynamic_bitset<> _decompressedVBitStream; int _bitStreamAllocAttID; string _bitStreamAllocAttName; };
[ "jaadds@c7f6ba40-6498-11de-987a-95e5a5a5d5f1" ]
[ [ [ 1, 66 ] ] ]
c3136de69884fb54b61dbc9c8be5734b479ce718
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/renaissance/rnsbasicactions/src/ngpblock/ngpblock.cc
2264a053cfe3faab1b70289cfb9baf47381952a8
[]
no_license
ugozapad/TheZombieEngine
832492930df28c28cd349673f79f3609b1fe7190
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
refs/heads/master
2020-04-30T11:35:36.258363
2011-02-24T14:18:43
2011-02-24T14:18:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,396
cc
#include "precompiled/pchrnsbasicactions.h" //------------------------------------------------------------------------------ // ngpblock.cc // (C) 2005 Conjurer Services, S.A. //------------------------------------------------------------------------------ #include "ngpblock/ngpblock.h" #include "ncaistate/ncaistate.h" #include "ncgameplayliving/ncgameplayliving.h" #include "ncgameplayliving/ncgameplaylivingclass.h" #include "zombieentity/nctransform.h" #include "nclogicanimator/nclogicanimator.h" #include "nphysics/ncphycharacterobj.h" #include "rnsgameplay/ndamagemanager.h" #include "rnsgameplay/ncgpweaponmelee.h" #include "animcomp/nccharacter.h" nNebulaScriptClass(nGPBlock, "ngpbasicaction"); //------------------------------------------------------------------------------ /** Nebula class scripting initialization */ NSCRIPT_INITCMDS_BEGIN (nGPBlock) NSCRIPT_ADDCMD('INIT', bool, Init, 3, (nEntityObject*, int, int), 0, ()); NSCRIPT_INITCMDS_END() //------------------------------------------------------------------------------ /** Constructor */ nGPBlock::nGPBlock() : nGPBasicAction(), animator(0), weapon(0), ellapsedTime(0), startOffset(0), endOffset(0), living(0) { // empty } //------------------------------------------------------------------------------ /** Destructor */ nGPBlock::~nGPBlock() { this->End(); } //------------------------------------------------------------------------------ /** Init @param initOffset Is a percentage of the total animation time that indicate the time the player is not parrying at the begining of animation. @param finalOffset Is a percentage of the total animation time that indicate the time the player is not parrying at the end of animation. */ bool nGPBlock::Init (nEntityObject* entity, int initOffset, int finalOffset) { bool valid = entity != 0; if ( valid ) { this->entity = entity; // get the animator this->animator = entity->GetComponentSafe<ncLogicAnimator>(); // get the primary weapon nEntityObject* weaponEntity = 0; this->living = entity->GetComponentSafe<ncGameplayLiving>(); if ( this->living ) { // get melee weapon weaponEntity = this->living->GetCurrentWeapon(); if (weaponEntity) { this->weapon = weaponEntity->GetComponentSafe<ncGPWeaponMelee>(); n_assert( this->weapon ); } } valid = this->weapon != 0; } if ( valid ) { //ncCharacter* character = this->entity->GetComponentSafe<ncCharacter>(); // TODO: Change this when there are a relationship betwen ticks ans seconds //nTime blockTime = character->GetStateDuration(GP_ACTION_MELEEBLOCK); nTime blockTime; blockTime = 0; // Times that the entity is not blocking, are percentages of state duration this->startOffset = initOffset; this->endOffset = finalOffset; this->living->SetBlocking( false ); this->animIndex = this->animator->SetMeleeBlock(); } this->init = valid; return valid; } //------------------------------------------------------------------------------ /** IsDone */ bool nGPBlock::IsDone() const { n_assert(this->init); return !this->animator || this->animator->HasFinished( this->animIndex ); } //------------------------------------------------------------------------------ /** Run */ bool nGPBlock::Run() { n_assert(this->init); this->ellapsedTime++; // Only block between the offsets if ( this->ellapsedTime > startOffset && this->ellapsedTime < this->endOffset && !this->living->IsBlocking()) { this->living->SetBlocking( true ); } else if ( this->living->IsBlocking() ) { this->living->SetBlocking( false ); } return this->IsDone(); } //------------------------------------------------------------------------------ /** End */ void nGPBlock::End() { n_assert( this->living ); if ( this->living ) { this->living->SetBlocking( false ); } }
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
[ [ [ 1, 160 ] ] ]
e9891e09ea2b076dca27a00c49f7378cb26bdee9
38926bfe477f933a307f51376dd3c356e7893ffc
/Source/SDKs/STLPORT/stlport/config/stl_sunpro.h
7c0e07079b6aea4189989fa679f446234f8ea16c
[ "LicenseRef-scancode-stlport-4.5" ]
permissive
richmondx/dead6
b0e9dd94a0ebb297c0c6e9c4f24c6482ef4d5161
955f76f35d94ed5f991871407f3d3ad83f06a530
refs/heads/master
2021-12-05T14:32:01.782047
2008-01-01T13:13:39
2008-01-01T13:13:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,249
h
// STLport configuration file // It is internal STLport header - DO NOT include it directly # define _STLP_LONG_LONG long long // GAB: 11/09/05 // Starting with 5.0 the STLport code expects to be // instantiated during compile time. This is due to undefing // a number of defines that are also used in the c versions // of the file. When they are undefed the c version fails to // compile. // # define _STLP_LINK_TIME_INSTANTIATION 1 # if ! defined(_BOOL) # define _STLP_NO_BOOL 1 # endif // compatibility mode stuff # if (__SUNPRO_CC >= 0x510) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 )) # define _STLP_NATIVE_INCLUDE_PATH ../CC/Cstd # define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../CC # elif (__SUNPRO_CC >= 0x500) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 )) # define _STLP_NATIVE_INCLUDE_PATH ../CC # elif (defined (__SUNPRO_CC_COMPAT) && __SUNPRO_CC_COMPAT == 4) # define _STLP_NATIVE_INCLUDE_PATH ../CC4 # else # define _STLP_NATIVE_INCLUDE_PATH ../CC # endif # define _STLP_STATIC_CONST_INIT_BUG 1 # if (__SUNPRO_CC < 0x530) // those are tested and proved not to work... # define _STLP_STATIC_ARRAY_BUG 1 # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 # define _STLP_USE_OLD_HP_ITERATOR_QUERIES # endif # ifdef _STLP_USE_NO_IOSTREAMS # define _STLP_HAS_NO_NEW_C_HEADERS 1 # endif // those do not depend on compatibility # if (__SUNPRO_CC < 0x510) # define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1 # define _STLP_NONTEMPL_BASE_MATCH_BUG 1 # endif # if (__SUNPRO_CC < 0x510) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5)) # define _STLP_NO_QUALIFIED_FRIENDS 1 // no partial , just for explicit one # define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 # define _STLP_NO_MEMBER_TEMPLATES 1 # define _STLP_NO_FRIEND_TEMPLATES 1 # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 # endif // Features that depend on compatibility switch # if ( __SUNPRO_CC < 0x500 ) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5)) # ifndef _STLP_USE_NO_IOSTREAMS # define _STLP_USE_NO_IOSTREAMS 1 # endif # define _STLP_NO_NEW_NEW_HEADER 1 // # define _STLP_NO_RELOPS_NAMESPACE # define _STLP_HAS_NO_NAMESPACES 1 # define _STLP_NEED_MUTABLE 1 # define _STLP_NO_BAD_ALLOC 1 # define _STLP_NO_EXCEPTION_HEADER 1 # define _STLP_NATIVE_C_INCLUDE_PATH ../include # elif (__SUNPRO_CC < 0x510) // # define _STLP_NATIVE_C_HEADER(header) <../CC/##header##.SUNWCCh> # define _STLP_NATIVE_CPP_C_HEADER(header) <../CC/##header##.SUNWCCh> # define _STLP_NATIVE_C_INCLUDE_PATH /usr/include # elif defined( __SunOS_5_5_1 ) || defined( __SunOS_5_6 ) || defined( __SunOS_5_7 ) # define _STLP_NATIVE_C_INCLUDE_PATH ../CC/std # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std # else # define _STLP_NATIVE_C_INCLUDE_PATH /usr/include # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std # endif # if ( __SUNPRO_CC < 0x500 ) # undef _STLP_NATIVE_C_HEADER # undef _STLP_NATIVE_CPP_C_HEADER # define wint_t __wint_t // famous CC 4.2 bug # define _STLP_INLINE_STRING_LITERAL_BUG 1 // /usr/include # define _STLP_NATIVE_C_INCLUDE_PATH ../include // 4.2 cannot handle iterator_traits<_Tp>::iterator_category as a return type ;( # define _STLP_USE_OLD_HP_ITERATOR_QUERIES // 4.2 does not like it # undef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS # define _STLP_LIMITED_DEFAULT_TEMPLATES 1 # define _STLP_NEED_TYPENAME 1 # define _STLP_NEED_EXPLICIT 1 # define _STLP_UNINITIALIZABLE_PRIVATE 1 # define _STLP_NO_BAD_ALLOC 1 # define _STLP_NO_ARROW_OPERATOR 1 # define _STLP_DEF_CONST_PLCT_NEW_BUG 1 # define _STLP_DEF_CONST_DEF_PARAM_BUG 1 # define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 1 # undef _STLP_HAS_NO_NEW_C_HEADERS # define _STLP_HAS_NO_NEW_C_HEADERS 1 // # define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS # if ( __SUNPRO_CC < 0x420 ) # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 # define _STLP_NO_NEW_STYLE_CASTS 1 # define _STLP_NO_METHOD_SPECIALIZATION 1 # if ( __SUNPRO_CC > 0x401 ) # if (__SUNPRO_CC==0x410) # define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 # endif # else // SUNPro C++ 4.0.1 # define _STLP_BASE_MATCH_BUG 1 # define _STLP_BASE_TYPEDEF_BUG 1 # if (( __SUNPRO_CC < 0x401 ) && !defined(__SUNPRO_C)) __GIVE_UP_WITH_STL(SUNPRO_401) # endif # endif /* 4.0.1 */ # endif /* 4.2 */ # endif /* < 5.0 */ # include <config/stl_solaris.h> #ifndef _MBSTATET_H # define _MBSTATET_H # undef _MBSTATE_T # define _MBSTATE_T typedef struct __mbstate_t { #if defined(_LP64) long __filler[4]; #else int __filler[6]; #endif } __mbstate_t; # ifndef _STLP_HAS_NO_NAMESPACES namespace std { typedef __mbstate_t mbstate_t; } using std::mbstate_t; #else typedef __mbstate_t mbstate_t; # endif #endif /* __MBSTATET_H */
[ [ [ 1, 167 ] ] ]
2dc1b0b38b7ab7d7bf20f5fe1d9ab950e75fe076
370d07b4ae576fc268ff0b5a9d11b3baa0a87ef8
/funcoes.cpp
bf60decffd58d101fbda9a2bbf28e8161cbea3a3
[]
no_license
syu93/uelplayer
db94ee55d155316adac95c77864862a9dfa306a2
e090d3ed2a96424489c43f428f1dd285036f15a9
refs/heads/master
2021-01-02T09:34:32.921487
2009-11-05T03:14:44
2009-11-05T03:14:44
39,090,735
0
0
null
null
null
null
ISO-8859-1
C++
false
false
22,223
cpp
//estrutura Player typedef struct Player{ //ponteiro para música FSOUND_STREAM *musica; //diretorio utilizado pelo programa DIR *dir; //arquivo utilizado pelo programa FILE *bib, *let, *play; //número da música int num; //total de músicas int tot; //modo int modo; //cores; int cor, cor2; //nome do arquivo atual char arquivo[MAX_NAME]; //bitmap para representar a tela BITMAP *tela, *aba1, *aba2, *aba3, *aba4; //clocks clock_t refresh, button, button2; //construtor Player(); void playpause(); void repeat(); void layout(); void criarbiblioteca(); void imprimirbiblioteca(); void passarmouse(); void inicializar(); void mouseesquerdo(); void backnext(bool next); void atualiza(); void letras(); void mute(); void abas(); void config(); }; void init(); void deinit(); void close_button_handle(); float distponto(int x1, int y1, int x2, int y2); //construtor Player::Player(){ //inicializa os clocks refresh = button = button2 = clock(); // inicia da API FMOD, áudio com 5 canais FSOUND_Init(44100, 5, 0); //inicializações do allegro init(); //inicialização das variávies BITMAP tela = create_bitmap(MAX_X, MAX_Y); aba1 = create_bitmap(MAX_X, ABA_Y); aba2 = create_bitmap(MAX_X, ABA_Y); aba3 = create_bitmap(MAX_X, ABA_Y); aba4 = create_bitmap(MAX_X, ABA_Y); //limpa os bitmaps clear(tela); clear(aba1); clear(aba2); clear(aba3); clear(aba4); //começa exibindo a biblioteca modo = BIBLIOTECA; //cores cor = BLUE; cor2 = BLUE2; } //botão play/pause void Player::playpause(){ circlefill(tela, PLAY_X, PLAY_Y, 23, cor); circlefill(tela, 320, 445, 20, cor2); //se não estiver pausado if(FSOUND_GetPaused(0)){ //guarda a duração da música em milisegundos int ms = FSOUND_Stream_GetLengthMs(musica); rectfill(tela, 318, 440, 321, 455, makecol(255,255,255)); rectfill(tela, 325, 440, 328, 455, makecol(255,255,255)); rectfill(tela, 1, 381, 640, 410, cor); rectfill(tela, 1, 411, 640, 420, cor2); //imprime o nome da música char nome[MAX_NAME] = ""; strcat(nome, arquivo+9); textprintf_ex(tela, font, 6, 401, makecol(255,255,255),-1, "%s", nome); //imprime a duração da música textprintf_ex(tela, font, 560, 401, makecol(255,255,255), -1, "%d : %d%d", ms/60000, ((ms/1000)%60)/10, (ms/1000)%10); //despausa se necessário FSOUND_SetPaused(0, false); //toca a música FSOUND_Stream_Play(0, musica); letras(); } else { triangle(tela, 320, 440, 332, 445, 320, 450, makecol(255,255,255)); //pausa FSOUND_SetPaused(0, true); } blit(tela, screen, 0, 0, 0, 0, 640, 480); } void Player::repeat(){ circlefill(tela, REPEAT_X, REPEAT_Y, 18, cor); circlefill(tela, REPEAT_X-3, REPEAT_Y-3, 15, cor2); //seta repeat if(!((FSOUND_Stream_GetMode(musica)) & FSOUND_LOOP_NORMAL)){ FSOUND_Stream_SetMode(musica, FSOUND_LOOP_NORMAL); circle(tela, REPEAT_X, REPEAT_Y, 8, makecol(255,255,255)); circle(tela, REPEAT_X, REPEAT_Y, 9, makecol(255,255,255)); circle(tela, REPEAT_X, REPEAT_Y, 10, makecol(255,255,255)); triangle(tela, REPEAT_X+5, 440, REPEAT_X+15, 445, REPEAT_X+5, 450, makecol(255,255,255)); //cancela repeat } else { FSOUND_Stream_SetMode(musica, FSOUND_LOOP_OFF); rectfill(tela, REPEAT_X-8, REPEAT_Y-2, REPEAT_X+8, REPEAT_Y+1, makecol(255,255,255)); triangle(tela, REPEAT_X+5, REPEAT_Y+5, REPEAT_X+10, REPEAT_Y, REPEAT_X+5, REPEAT_Y-5, makecol(255,255,255)); } if(!FSOUND_GetPaused(0)){ int ms = FSOUND_Stream_GetTime(musica); playpause(); FSOUND_Stream_Stop(musica); FSOUND_Stream_SetTime(musica, ms); playpause(); } } void Player::layout(){ //desenha um retângulo em cima rectfill(tela, 1, 1, 640, 50, cor); rectfill(tela, 1, 51, 640, 60, cor2); //desenha um retângulo em baixo rectfill(tela, 1, 381, 640, 410, cor); rectfill(tela, 1, 411, 640, 420, cor2); //desenha um retângulo prata rectfill(tela, 1, 421, 640, 470, makecol(150,150,150)); rectfill(tela, 1, 471, 640, 480, makecol(130,130,130)); //botão play circlefill(tela, PLAY_X, PLAY_Y, 23, cor); circlefill(tela, PLAY_X-3, PLAY_Y-3, 20, cor2); triangle(tela, 320, 440, 332, 445, 320, 450, makecol(255,255,255)); //repeat circlefill(tela, REPEAT_X, REPEAT_Y, 18, cor); circlefill(tela, REPEAT_X-3, REPEAT_Y-3, 15, cor2); rectfill(tela, REPEAT_X-8, REPEAT_Y-2, REPEAT_X+8, REPEAT_Y+1, makecol(255,255,255)); triangle(tela, REPEAT_X+5, REPEAT_Y+5, REPEAT_X+10, REPEAT_Y, REPEAT_X+5, REPEAT_Y-5, makecol(255,255,255)); //stop circlefill(tela, STOP_X, STOP_Y,18,cor); circlefill(tela, STOP_X-3, STOP_Y-3, 15, cor2); rectfill(tela, STOP_X-4, 440, STOP_X+4, 450, makecol(255,255,255)); //backward circlefill(tela, BWARD_X, BWARD_Y, 18, cor); circlefill(tela, BWARD_X-3, BWARD_Y-3, 15, cor2); triangle(tela, BWARD_X, 440, BWARD_X-10, 445, BWARD_X, 450, makecol(255,255,255)); triangle(tela, BWARD_X+10, 440, BWARD_X, 445, BWARD_X+10, 450, makecol(255,255,255)); //forward circlefill(tela, FWARD_X, FWARD_Y, 18, cor); circlefill(tela, FWARD_X-3, FWARD_Y-3, 15, cor2); triangle(tela, FWARD_X, 440, FWARD_X+10, 445, FWARD_X, 450, makecol(255,255,255)); triangle(tela, FWARD_X-10, 440, FWARD_X, 445, FWARD_X-10, 450, makecol(255,255,255)); //mudo circlefill(tela, MUTE_X, MUTE_Y, 15, cor); circlefill(tela, MUTE_X-3, MUTE_Y-3, 12, cor2); int points[8] = {MUTE_X+8,MUTE_Y+8, MUTE_X+8,MUTE_Y-8, MUTE_X-4,MUTE_Y-4, MUTE_X-4,MUTE_Y+4}; polygon(tela, 4, points, makecol(255, 255, 255)); //volume rectfill(tela, VOL_X1, VOL_Y1, VOL_X2, VOL_Y2, makecol(255,255,255)); rectfill(tela, VOL_X1, VOL_Y1, VOL_X2-32, VOL_Y2, cor2); textout_ex(tela, font, "UEL PLAYER", 260, 10, makecol(255,255,255),-1); textout_ex(tela, font, "Biblioteca", ABA_X1-110, 40, makecol(255,255,255),-1); textout_ex(tela, font, "Letra", ABA_X2-90, 40, makecol(255,255,255),-1); textout_ex(tela, font, "Configuracoes", ABA_X3-130, 40, makecol(255,255,255),-1); textout_ex(tela, font, "Ajuda", ABA_X3+50, 40, makecol(255,255,255),-1); //linhas das abas line(tela, ABA_X1, 35, ABA_X1, 55, makecol(255,255,255)); line(tela, ABA_X2, 35, ABA_X2, 55, makecol(255,255,255)); line(tela, ABA_X3, 35, ABA_X3, 55, makecol(255,255,255)); //posição da música rectfill(tela, POS_X1, POS_Y1, POS_X2, POS_Y2, makecol(0,0,0)); //imprime o nome da música int ms = FSOUND_Stream_GetLengthMs(musica); //imprime o nome da música char nome[MAX_NAME] = ""; strcat(nome, arquivo+9); textprintf_ex(tela, font, 6, 401, makecol(255,255,255),-1, "%s", nome); //imprime a duração da música textprintf_ex(tela, font, 560, 401, makecol(255,255,255), -1, "%d : %d%d", ms/60000, ((ms/1000)%60)/10, (ms/1000)%10); blit(tela, screen, 0, 0, 0, 0, MAX_X, MAX_Y); //imprime configurações na aba3 textout_ex(aba3, font, "Escolha a cor do programa", 150, 20, makecol(255,255,255),-1); circlefill(aba3, COR_X1, COR_Y1, 20, RED); circlefill(aba3, COR_X1-3, COR_Y1-3, 17, RED2); circlefill(aba3, COR_X2, COR_Y2, 20, GREEN); circlefill(aba3, COR_X2-3, COR_Y2-3, 17, GREEN2); circlefill(aba3, COR_X3, COR_Y3, 20, BLUE); circlefill(aba3, COR_X3-3, COR_Y3-3, 17, BLUE2); circlefill(aba3, COR_X4, COR_Y4, 20, GRAY); circlefill(aba3, COR_X4-3, COR_Y4-3, 17, GRAY2); //imprime ajuda na aba4 textout_ex(aba4, font, "Insira as musicas na pasta musicas (mp3/ wav/ wma)", 15, 5, makecol(255,255,255),-1); textout_ex(aba4, font, "Insira as letras na pasta letras", 15, 25, makecol(255,255,255),-1); textout_ex(aba4, font, "As letras devem ter o nome igual a musica (inclusive extensao)", 15, 45, makecol(255,255,255),-1); textout_ex(aba4, font, "Os manuais das bibliotecas utilizadas estao na pasta manuais", 15, 65, makecol(255,255,255),-1); textout_ex(aba4, font, "Sobre:", 15, 105, makecol(255,255,255),-1); textout_ex(aba4, font, "Breno Naodi Kusunoki", 15, 125, makecol(255,255,255),-1); textout_ex(aba4, font, "Ernesto Yuiti Saito", 15, 145, makecol(255,255,255),-1); textout_ex(aba4, font, "Marcos Okamura Rodrigues", 15, 165, makecol(255,255,255),-1); textout_ex(aba4, font, "Robson Fumio Fujii", 15, 185, makecol(255,255,255),-1); textout_ex(aba4, font, "Universidade Estadual de Londrina", 15, 225, makecol(255,255,255),-1); textout_ex(aba4, font, "Ciencia da Computacao", 15, 245, makecol(255,255,255),-1); } void Player::criarbiblioteca(){ dirent* item_dir; int i; //cria pasta mkdir("data"); //cria biblioteca bib = fopen("data\\biblioteca.txt", "w"); //aponta para o diretorio de musicas dir = opendir("musicas."); //se houver erro ao abrir diretorio if(!dir){ perror("opendir"); } else{ //lê os arquivos dos diretorios item_dir = readdir(dir); //contador de itens i = 0; while(item_dir){ if(item_dir->d_name[0] != '.'){ //escreve os nomes dos arquivos na biblioteca fprintf(bib, "%s\n", item_dir -> d_name ); i++; } item_dir = readdir(dir); } } //atribui o total de músicas na pasta tot = i; //se não houver nenhuma música if(tot == 0){ allegro_message("Insira pelo menos uma musica na pasta musicas"); allegro_exit(); exit(1); } //fecha o diretório closedir(dir); //fecha o arquivo fclose(bib); } void Player::letras(){ char letra; int i, j; char nome[MAX_NAME]="letras\\"; strcat(nome, arquivo+9); strcat(nome, ".txt\0"); let = fopen(nome, "r"); clear(aba2); if(let != NULL){ for(i = 1, j = 20; !feof(let); i += 8){ letra = fgetc(let); //escreve uma linha if(letra != '\n' && letra != -1){ textprintf_ex(aba2, font, i, j, makecol(255,255,255), 0, "%c", letra); //pula linha } else { //espaçamento entre linhas(2) j += 10; //volta a margem esquerda i = -7; } } //Desenha a letra na aba 3 e cola na tela fclose(let); } } void Player::imprimirbiblioteca(){ char letra; int i, j; bib = fopen("data\\biblioteca.txt", "r"); for(i = 1, j = 20; !feof(bib); i += 8){ letra = fgetc(bib); //escreve uma linha if(letra != '\n' && letra != -1){ textprintf_ex(aba1, font, i, j, makecol(255,255,255), -1, "%c", letra); //pula linha } else { //espaçamento entre linhas(2) j += 10; //volta a margem esquerda i = -7; } } fclose(bib); //Desenha a biblioteca na aba 1 e cola na tela blit(aba1, tela, 0, 0, 0, ABA_Y1, MAX_X, ABA_Y); } void Player::passarmouse(){ if(mouse_y >= ABA_Y1+20 && mouse_y <= (ABA_Y1+20+ 10*tot-3)){ if(modo == BIBLIOTECA ){ char nome[MAX_NAME]; int cont; bib = fopen("data\\biblioteca.txt", "r"); cont = int((mouse_y-ABA_Y1-20+1)/10); //copia o nome do arquivo cont for(int i = 0; i <= cont; i++){ for(int j = 0; j < MAX_NAME; j++){ nome[j] = getc(bib); if (nome[j] == '\n'){ nome[j] = '\0'; break; } } } fclose(bib); //escreve o nome da música em amarelo textout_ex(screen, font, nome, 0, mouse_y-mouse_y%10+1, makecol(255,255,0),0); } } else if((distponto(mouse_x, mouse_y, PLAY_X, PLAY_Y)) <= 25){ if(FSOUND_GetPaused(0)){ textout_ex(screen, font, "Play", mouse_x-8, mouse_y-8, makecol(255,255,255),0); } else { textout_ex(screen, font, "Pause", mouse_x-8, mouse_y-8, makecol(255,255,255),0); } } else if ((distponto(mouse_x, mouse_y, STOP_X, STOP_Y)) <= 18){ textout_ex(screen, font, "Stop", mouse_x-8, mouse_y-8, makecol(255,255,255),0); } else if ((distponto(mouse_x, mouse_y, MUTE_X, MUTE_Y)) <= 18){ if(FSOUND_GetMute(0)){ textout_ex(screen, font, "Mute On", mouse_x-30, mouse_y-8, makecol(255,255,255),0); } else{ textout_ex(screen, font, "Mute Off", mouse_x-30, mouse_y-8, makecol(255,255,255),0); } } else if ((distponto(mouse_x, mouse_y, REPEAT_X, REPEAT_Y)) <= 18){ if((FSOUND_Stream_GetMode(musica)) & FSOUND_LOOP_NORMAL){ textout_ex(screen, font, "Repeat On", mouse_x-30, mouse_y-8, makecol(255,255,255),0); } else{ textout_ex(screen, font, "Repeat Off", mouse_x-30, mouse_y-8, makecol(255,255,255),0); } } else if ((distponto(mouse_x, mouse_y, BWARD_X, BWARD_Y)) <= 18){ textout_ex(screen, font, "Anterior", mouse_x-8, mouse_y-8, makecol(255,255,255),0); } else if ((distponto(mouse_x, mouse_y, FWARD_X, FWARD_Y)) <= 18){ textout_ex(screen, font, "Proxima", mouse_x-8, mouse_y-8, makecol(255,255,255),0); } else if(mouse_x >= VOL_X1 && mouse_y >= VOL_Y1 && mouse_y <= VOL_Y2 && mouse_x <= VOL_X2){ textprintf_ex(screen, font, mouse_x-20, mouse_y-8, makecol(255,255,255),0, "%Vol %d", ((mouse_x-VOL_X1)*4+3)*100/255); } } void Player::abas(){ if(mouse_x <= ABA_X1){ modo = BIBLIOTECA; } else if(mouse_x <= ABA_X2){ modo = LETRA; } else if(mouse_x <= ABA_X3){ modo = CONFIG; } else{ modo = AJUDA; } } void Player::mute(){ FSOUND_SetMute(0, !FSOUND_GetMute(0)); circlefill(tela, MUTE_X, MUTE_Y, 15, cor); circlefill(tela, MUTE_X-3, MUTE_Y-3, 12, cor2); //cria um poligono int points[8] = {MUTE_X+8,MUTE_Y+8, MUTE_X+8,MUTE_Y-8, MUTE_X-4,MUTE_Y-4, MUTE_X-4,MUTE_Y+4}; polygon(tela, 4, points, makecol(255, 255, 255)); if(FSOUND_GetMute(0)){ line(tela, MUTE_X-8, MUTE_Y+8, MUTE_X+8, MUTE_Y-8, makecol(255,0,0)); line(tela, MUTE_X-7, MUTE_Y+8, MUTE_X+9, MUTE_Y-8, makecol(255,0,0)); line(tela, MUTE_X-8, MUTE_Y-8, MUTE_X+8, MUTE_Y+8, makecol(255,0,0)); line(tela, MUTE_X-7, MUTE_Y-8, MUTE_X+9, MUTE_Y+8, makecol(255,0,0)); } } void Player::mouseesquerdo(){ //abas if(mouse_y <= 55 && mouse_y >= 35){ abas(); //seta posição da musica }else if(mouse_y >= POS_Y1 && mouse_y <= POS_Y2 && mouse_x >= POS_X1 && mouse_x <= POS_X2){ int time = FSOUND_Stream_GetLengthMs(musica); int ms = (mouse_x - POS_X1)*time/500; //pausa e despausa o canal FSOUND_SetPaused(0, true); FSOUND_Stream_SetTime(musica, ms); FSOUND_SetPaused(0, false); //play/pause } else if((distponto(mouse_x, mouse_y, PLAY_X, PLAY_Y)) <= 25){ if(clock() - button >= BUTTON * CLOCKS_PER_SEC){ playpause(); button = clock(); } //stop } else if ((distponto(mouse_x, mouse_y, STOP_X, STOP_Y)) <= 18){ FSOUND_Stream_Stop(musica); FSOUND_SetPaused(0, false); playpause(); //imprime 0 seg/min textprintf_ex(tela, font, 560, 391, makecol(255,255,255), cor, "%d : %d%d", 0, 0, 0); rectfill(tela, POS_X1, POS_Y1, POS_X2, POS_Y2, makecol(0,0,0)); //ativa/desativa o modo mudo } else if ((distponto(mouse_x, mouse_y, MUTE_X, MUTE_Y)) <= 18){ if(clock() - button >= BUTTON * CLOCKS_PER_SEC){ mute(); button = clock(); } //ativa desativa repeat } else if ((distponto(mouse_x, mouse_y, REPEAT_X, REPEAT_Y)) <= 18){ if(clock() - button >= BUTTON * CLOCKS_PER_SEC){ repeat(); button = clock(); } //próxima música } else if ((distponto(mouse_x, mouse_y, FWARD_X, FWARD_Y)) <= 18){ if(clock() - button2 >= BUTTON2 * CLOCKS_PER_SEC){ backnext(true); button2 = clock(); } //música anterior } else if ((distponto(mouse_x, mouse_y, BWARD_X, BWARD_Y)) <= 18){ if(clock() - button2 >= BUTTON2 * CLOCKS_PER_SEC){ backnext(false); button2 = clock(); } //ajusta o volume } else if (mouse_x >= VOL_X1 && mouse_y >= VOL_Y1 && mouse_y <= VOL_Y2 && mouse_x <= VOL_X2){ FSOUND_SetVolumeAbsolute(0, (mouse_x-VOL_X1) * 4 + 1); rectfill(tela, VOL_X1, VOL_Y1, VOL_X2, VOL_Y2, makecol(255,255,255)); rectfill(tela, VOL_X1, VOL_Y1, mouse_x, VOL_Y2, cor2); //configura a cor }else if(modo == CONFIG){ config(); } else { //se apertar a região de uma música if (mouse_y >= ABA_Y1+20 && mouse_y <= (ABA_Y1+20+10*tot-2)){ //para a música antiga FSOUND_Stream_Stop(musica); //para o canal de áudio FSOUND_StopSound(0); //Esvazia o epaço alocado na memória FSOUND_Stream_Close(musica); num = int((mouse_y-ABA_Y1-20)/10); backnext(true); } } } void Player::config(){ if((distponto(mouse_x, mouse_y, COR_X1, COR_Y1+ABA_Y1)) <= 20){ cor = RED; cor2 = RED2; } else if((distponto(mouse_x, mouse_y, COR_X2, COR_Y2+ABA_Y1)) <= 20){ cor = GREEN; cor2 = GREEN2; } else if((distponto(mouse_x, mouse_y, COR_X3, COR_Y3+ABA_Y1)) <= 20){ cor = BLUE; cor2 = BLUE2; } else if((distponto(mouse_x, mouse_y, COR_X4, COR_Y4+ABA_Y1)) <= 20){ cor = GRAY; cor2 = GRAY2; } //desenha o layout novamente layout(); } void Player::backnext(bool next){ int i, j; char nome[MAX_NAME]; //limpa a string com o nome do diretorio strcpy(arquivo, "musicas\\\\"); bib = fopen("data\\biblioteca.txt", "r"); //avança if(next){ //se não for a última música avança normalmente if(num != tot){ num++; //se for a última música avança para a primeira } else { num = 1; } //retrocede } else { //se não for a primeira música retrocede normalmente if(num != 1){ num--; //se for a primeira retrocede para a última } else { num = tot; } } //abre o arquivo de número num for(i = 0; i < num; i++){ for(j = 0; j < MAX_NAME; j++){ nome[j] = getc(bib); if (nome[j] == '\n'){ nome[j] = '\0'; break; } } } fclose(bib); //concatena o nome do arquivo strcat(arquivo, nome); //para a música antiga FSOUND_Stream_Stop(musica); //para o canal de áudio FSOUND_StopSound(0); //muda o ícone playpause(); //Esvazia o epaço alocado na memória FSOUND_Stream_Close(musica); //abre o arquivo de aúdio do nome inserido musica = FSOUND_Stream_Open(arquivo, 0, 0, 0); //toca a música nova playpause(); } void Player::inicializar(){ int i, j; char nome[MAX_NAME]; //limpa a string com o nome do diretorio strcpy(arquivo, "musicas\\\\"); //toca a primeira música num = 1; bib = fopen("data\\biblioteca.txt", "r"); //abre o arquivo de número num for(int i = 0; i < num; i++){ for(j = 0; j < MAX_NAME; j++){ nome[j] = getc(bib); if (nome[j] == '\n'){ nome[j] = '\0'; break; } } } //concatena o nome do arquivo strcat(arquivo, nome); //abre o arquivo de aúdio do nome inserido musica = FSOUND_Stream_Open(arquivo, 0, 0, 0); //configuração inicial: pausada FSOUND_SetPaused(0, true); //configura o volume inicial em torno de 50% FSOUND_SetSFXMasterVolume(127); } void Player::atualiza(){ //atualiza a cada intervalo refresh if(clock() - refresh >= REFRESH * CLOCKS_PER_SEC){ //atualiza a tela acquire_screen(); //biblioteca if(modo == BIBLIOTECA){ blit(aba1, tela, 0, 0, 0, ABA_Y1, MAX_X, ABA_Y); //playlist //letra }else if(modo == LETRA){ blit(aba2, tela, 0, 0, 0, ABA_Y1, MAX_X, ABA_Y); //configurações }else if(modo == CONFIG){ blit(aba3, tela, 0, 0, 0, ABA_Y1, MAX_X, ABA_Y); //ajuda } else { blit(aba4, tela, 0, 0, 0, ABA_Y1, MAX_X, ABA_Y); } blit(tela, screen, 0, 0, 0, 0, MAX_X, MAX_Y); release_screen(); refresh = clock(); } else { //descansa 1 ms para economizar CPU rest(1); } } // inicialização do allegro void init() { int depth, res; allegro_init(); //ativa o botão de fechar LOCK_FUNCTION(close_button_handle); set_close_button_callback(close_button_handle); //seleção da profundidade das cores (em bits) depth = desktop_color_depth(); if (depth == 0) depth = 32; set_color_depth(depth); //seleção da resolução com janela res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, MAX_X, MAX_Y, 0, 0); if (res != 0) { allegro_message(allegro_error); exit(-1); } //funciona sem estar ativo (plano de fundo) set_display_switch_mode(SWITCH_BACKGROUND); //instala o timer, teclado e mouse install_timer(); install_keyboard(); install_mouse(); //ativa o mouse enable_hardware_cursor(); select_mouse_cursor(MOUSE_CURSOR_ARROW); show_mouse(screen); } // limpa o buffer de teclado void deinit() { clear_keybuf(); } //calcula distância entre dois pontos float distponto(int x1, int y1, int x2, int y2){ int a = (x1 - x2)*(x1 - x2); int b = (y1 - y2)*(y1 - y2); float z = sqrt(a+b); return z; }
[ "marokamura@edcf5732-aeb1-11de-b4c2-c9e47ae42fda" ]
[ [ [ 1, 677 ] ] ]
7508ce8edfa2f09e67872873db298cb9d44a93a5
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/MonitorTerminal/StdAfx.cpp
53bcc926de02b0a343f933ed9eaeccda1974da78
[]
no_license
willrebuild/flyffsf
e5911fb412221e00a20a6867fd00c55afca593c7
d38cc11790480d617b38bb5fc50729d676aef80d
refs/heads/master
2021-01-19T20:27:35.200154
2011-02-10T12:34:43
2011-02-10T12:34:43
32,710,780
3
0
null
null
null
null
UTF-8
C++
false
false
228
cpp
// stdafx.cpp : source file that includes just the standard includes // MonitorTerminal.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" HANDLE hPrompt;
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 7 ] ] ]
9ffa8845fbba16e8646d5acb06b9779a7042a283
8aa65aef3daa1a52966b287ffa33a3155e48cc84
/Source/World/World.cpp
2f61ae7f56afb77c886e217ff79a597d3e28496c
[]
no_license
jitrc/p3d
da2e63ef4c52ccb70023d64316cbd473f3bd77d9
b9943c5ee533ddc3a5afa6b92bad15a864e40e1e
refs/heads/master
2020-04-15T09:09:16.192788
2009-06-29T04:45:02
2009-06-29T04:45:02
37,063,569
1
0
null
null
null
null
UTF-8
C++
false
false
1,803
cpp
#include "Includes.h" #include "World.h" #include "Common/Counters.h" namespace P3D { namespace World { World::World(Physics::PhysicalWorld* physicalWorld) : CompoundEntity(this) { _activeCamera = NULL; _timeCounter.Reset(); _physicalWorld.Attach(physicalWorld); _worldBounds.Points[0].Set(-1000, -1000, -1000); _worldBounds.Points[1].Set( 1000, 1000, 1000); } World::~World() { RemoveAllEntities(); } void World::Prepare() { if (_physicalWorld) _physicalWorld->Prepare(this); CompoundEntity::Prepare(); } bool World::Update() { if (_timeCounter.GetTicks() == 0) { _timeCounter.Reset(); Prepare(); } _timeCounter.Tick(); if (_physicalWorld) _physicalWorld->Update(_timeCounter); return CompoundEntity::Update(); } void World::Render(Camera* camera) { ASSERT(camera != NULL); // activate camera _activeCamera = camera; camera->LoadCameraTransform(); // reset counters ;) ClearCounters(); // get camera frustum in world space Frustum frustum = _activeCamera->GetFrustum(); frustum.Transform(_activeCamera->GetTransformToWorldSpace()); // render RendererContext context(frustum); context.Flags = RF_RenderHelpers;// | RF_RenderAll; Render(context); // deactivate camera _activeCamera = NULL; } } }
[ "vadun87@6320d0be-1f75-11de-b650-e715bd6d7cf1" ]
[ [ [ 1, 68 ] ] ]
9558f099c4a2dbcd4567c28f46aae0db3f41cdca
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/nGENE Proj/IDynamicLibrary.cpp
7476250339aec346cf65f563e70698f55b139748
[]
no_license
svn2github/ngene
b2cddacf7ec035aa681d5b8989feab3383dac012
61850134a354816161859fe86c2907c8e73dc113
refs/heads/master
2023-09-03T12:34:18.944872
2011-07-27T19:26:04
2011-07-27T19:26:04
78,163,390
2
0
null
null
null
null
UTF-8
C++
false
false
649
cpp
/* --------------------------------------------------------------------------- This source file is part of nGENE Tech. Copyright (c) 2006- Wojciech Toman This program is free software. File: IDynamicLibrary.cpp Version: 0.01 --------------------------------------------------------------------------- */ #include "PrecompiledHeaders.h" #include "IDynamicLibrary.h" namespace nGENE { IDynamicLibrary::IDynamicLibrary() { } //---------------------------------------------------------------------- IDynamicLibrary::~IDynamicLibrary() { } //---------------------------------------------------------------------- }
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 28 ] ] ]
664774f7cc38a0c6fa8174bb4b2548bbb81d85f4
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/ossrv/stdlibs/apps/libc/testinet/inc/tinet.h
a1b35235e8c4694d1274ccabb484044885560716
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
1,738
h
/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ /* * ============================================================================== * Name : tinet.h * Part of : testinet * * Description : ?Description * Version: 0.5 * */ #ifndef __TESTINET_H__ #define __TESTINET_H__ // INCLUDE FILES #include <test/TestExecuteStepBase.h> #include <e32svr.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <e32std.h> #include <stdio.h> #include <string.h> #include <netdb.h> #include <sys/stat.h> #include <errno.h> #include <utf.h> #include <stdlib.h> #define BUFSIZE 20 _LIT(KInet_addr_with_valid_input, "Inet_addr_with_valid_input"); _LIT(KInet_addr_with_invalid_input, "Inet_addr_with_invalid_input"); _LIT(KInet_ntoaTest, "Inet_ntoaTest"); _LIT(KInet_ptonTest, "Inet_ptonTest"); _LIT(KInet_ntopTest, "Inet_ntopTest"); class CTestInet : public CTestStep { public: ~CTestInet(); CTestInet(const TDesC& aStepName); TVerdict doTestStepL(); TVerdict doTestStepPreambleL(); TVerdict doTestStepPostambleL(); private: TInt Inet_addr_with_valid_input(); TInt Inet_addr_with_invalid_input(); TInt Inet_ntoaTest(); TInt Inet_ptonTest(); TInt Inet_ntopTest(); public: //data TInt iParamCnt; }; #endif
[ "none@none" ]
[ [ [ 1, 74 ] ] ]
eb66a7ed209876e546c75834d65f65466ac970d4
c7120eeec717341240624c7b8a731553494ef439
/src/cplusplus/freezone-samp/src/core/samp/pawn/pawn_log.hpp
37e6eb4399733b707fb2059e278d4f3a6227f763
[]
no_license
neverm1ndo/gta-paradise-sa
d564c1ed661090336621af1dfd04879a9c7db62d
730a89eaa6e8e4afc3395744227527748048c46d
refs/heads/master
2020-04-27T22:00:22.221323
2010-09-04T19:02:28
2010-09-04T19:02:28
174,719,907
1
0
null
2019-03-09T16:44:43
2019-03-09T16:44:43
null
WINDOWS-1251
C++
false
false
329
hpp
#ifndef SAMP_LOG_HPP #define SAMP_LOG_HPP #include <string> namespace pawn { typedef void (*logprintf_t)(char const* format, ...); extern logprintf_t logprintf; // Безопасная версия принта void logprint(std::string const& log_str); } // namespace pawn { #endif // SAMP_LOG_HPP
[ "dimonml@19848965-7475-ded4-60a4-26152d85fbc5" ]
[ [ [ 1, 12 ] ] ]
4cd3bf49ea8ed8e56ba7a5201badea8b030a0d95
260c113e54a8194a20af884e7fd7e3cadb1cf610
/branches/RAAAAGGEEE/sllabzzuf/src/Player.h
ce29791a6accfbbb2aa26d01d29c7cf27b5ce021
[]
no_license
weimingtom/sllabzzuf
8ce0205cc11ff5cdb569e8b2a629eb6cbbfebfc6
5f22cc5686068b179b3c17010d948ff05f16724c
refs/heads/master
2020-06-09T01:02:00.944446
2011-04-07T05:34:22
2011-04-07T05:34:22
38,219,985
0
0
null
null
null
null
UTF-8
C++
false
false
1,895
h
#ifndef PLAYER_H_INCLUDED #define PLAYER_H_INCLUDED #include "Unit.h" #include <vector> #include "ParticleSystem.h" #include "SoundBoard.h" class Player: public Unit{ private: SoundBoard sound; int frame; int framebuffer; int max_hp; int mp; int spell_bonus; int spells_known; int active_spell; bool faceing_left; bool frame_dir_left; int jump_timer; int dash_timer; int dash_direction; int user_x_acc; int user_y_acc; int x_velocity; int y_velocity; int x_acceleration; int y_acceleration; std::vector<std::string> maplist; std::vector<int> mapstarts; std::list<ParticleSystem> systems; std::string path_name; int map_number; SDL_Rect fuzzRIGHT[3]; SDL_Rect fuzzLEFT[3]; public: Player(); void load_profile(); void load_path(); void save_profile(); void load_sprite(); void clip_fuzzy(); void display_player(SDL_Surface *screen, int camera_x, int camera_y); void display_all_particles(SDL_Surface *screen, int camera_x, int camera_y, int mapw, int maph); void setFrame(int framenum); void nextFrame(); int get_active_spell(); int get_max_hp(); int get_mp(); int get_spell_bonus(); int get_spells_known(); std::string get_map_filename(); void set_x(int new_x); void set_y(int new_y); void add_spell_bonus(int amount); void add_max_hp(int amount); void add_mp(int amount); void add_spells_known(int amount); void set_faceing_left(bool face); void set_user_x_move(int amount); void set_user_y_move(int amount); void move_player(Stage stage); void jump(Stage stage); void dash(int direction); void manage_particle_systems(); void nextMap(); void spawn(); }; #endif // PLAYER_H_INCLUDED
[ [ [ 1, 72 ] ] ]
cf793288007cfd5354ddcdbe109da2d0c53085ea
986d745d6a1653d73a497c1adbdc26d9bef48dba
/oldnewthing/462_dpi.cpp
5b907701a6e6a4a1bf521f558d0dffc4d5a8fae0
[]
no_license
AnarNFT/books-code
879f75327c1dad47a13f9c5d71a96d69d3cc7d3c
66750c2446477ac55da49ade229c21dd46dffa99
refs/heads/master
2021-01-20T23:40:30.826848
2011-01-17T11:14:34
2011-01-17T11:14:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
359
cpp
int g_xDPI, g_yDPI; BOOL InitializeDPI() { HDC hdc = GetDC(NULL); // get screen DC if (!hdc) return FALSE; g_xDPI = GetDeviceCaps(hdc, LOGPIXELSX); g_yDPI = GetDeviceCaps(hdc, LOGPIXELSY); ReleaseDC(NULL, hdc); } int AdjustXDPI(int cx) { return MulDiv(cx, g_xDPI, 96); } int AdjustYDPI(int cy) { return MulDiv(cy, g_yDPI, 96); }
[ [ [ 1, 20 ] ] ]
95f76e2ed5a5640229bd1f1d47594fb21f4424b1
c95a83e1a741b8c0eb810dd018d91060e5872dd8
/Game/Shared/DamageTypes.cpp
1b33d562402d5778ac1c2c3d50ace0bbd60f2a3d
[]
no_license
rickyharis39/nolf2
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
refs/heads/master
2021-01-01T17:21:00.678517
2011-07-23T12:11:19
2011-07-23T12:11:19
38,495,312
1
0
null
null
null
null
UTF-8
C++
false
false
8,923
cpp
// ----------------------------------------------------------------------- // // // MODULE : DamageTypes.cpp // // PURPOSE : Implementation of damage types // // CREATED : 01/11/00 // // (c) 2000 Monolith Productions, Inc. All Rights Reserved // // ----------------------------------------------------------------------- // #include "stdafx.h" #include "DamageTypes.h" DTINFO DTInfoArray[kNumDamageTypes] = { #define INCLUDE_AS_STRUCT #include "DamageTypesEnum.h" #undef INCLUDE_AS_STRUCT }; // ----------------------------------------------------------------------- // // // ROUTINE: CDTButeMgr::CDTButeMgr() // // PURPOSE: Constructor // // ----------------------------------------------------------------------- // CDTButeMgr::CDTButeMgr() { } // ----------------------------------------------------------------------- // // // ROUTINE: CDTButeMgr::~CDTButeMgr() // // PURPOSE: Destructor // // ----------------------------------------------------------------------- // CDTButeMgr::~CDTButeMgr() { Term(); } // ----------------------------------------------------------------------- // // // ROUTINE: CDTButeMgr::Init() // // PURPOSE: Init mgr // // ----------------------------------------------------------------------- // LTBOOL CDTButeMgr::Init(const char* szAttributeFile) { if (!szAttributeFile || !Parse(szAttributeFile)) return LTFALSE; std::string sDamageSound = ""; char szKey[256] = ""; for (int i = 0; i < kNumDamageTypes; i++) { DTInfoArray[i].nDamageFlag = ( 1 << ( uint64 )i ); DTInfoArray[i].bJarCamera = (LTBOOL)m_buteMgr.GetInt(pDTNames[i],"JarCamera",0); DTInfoArray[i].bGadget = (LTBOOL)m_buteMgr.GetInt(pDTNames[i],"Gadget",0); DTInfoArray[i].bAccuracy = (LTBOOL)m_buteMgr.GetInt(pDTNames[i],"Accuracy",0); DTInfoArray[i].fSlowMove = (LTFLOAT)m_buteMgr.GetDouble(pDTNames[i],"SlowMovement",0.0); DTInfoArray[i].bScoreTag = (LTBOOL)m_buteMgr.GetInt(pDTNames[i],"ScoreTag",0); DTInfoArray[i].bGrief = (LTBOOL)m_buteMgr.GetInt(pDTNames[i],"Grief",0); DTInfoArray[i].bHurtAnim = !!m_buteMgr.GetInt(pDTNames[i],"HurtAnim",0); // Build the list of damage sounds. for( int nDamageSound = 0; ; nDamageSound++ ) { sprintf( szKey, "PlayerDamageSound%d", nDamageSound ); sDamageSound = m_buteMgr.GetString( pDTNames[i], szKey, "" ); if( !m_buteMgr.Success( )) break; DTInfoArray[i].saPlayerDamageSounds.push_back( sDamageSound ); } } return LTTRUE; } // ----------------------------------------------------------------------- // // // ROUTINE: CDTButeMgr::Term() // // PURPOSE: Clean up. // // ----------------------------------------------------------------------- // void CDTButeMgr::Term() { } // ----------------------------------------------------------------------- // // // ROUTINE: DamageFlagToType() // // PURPOSE: Convert the damage flag to its type equivillent // // ----------------------------------------------------------------------- // DamageType DamageFlagToType(DamageFlags nDamageFlag) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].nDamageFlag == nDamageFlag) { return DTInfoArray[i].eType; } } return DT_INVALID; } // ----------------------------------------------------------------------- // // // ROUTINE: DamageTypeToFlag() // // PURPOSE: Convert the damage type to its flag equivillent // // ----------------------------------------------------------------------- // DamageFlags DamageTypeToFlag(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].nDamageFlag; } } return 0; } // ----------------------------------------------------------------------- // // // ROUTINE: DamageTypeToString() // // PURPOSE: Convert the damage type to its string equivillent // // ----------------------------------------------------------------------- // const char* DamageTypeToString(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].pName; } } return "INVALID"; } // ----------------------------------------------------------------------- // // // ROUTINE: DamageTypeToString() // // PURPOSE: Convert the damage type to its string equivillent // // ----------------------------------------------------------------------- // DamageType StringToDamageType(const char* pDTName) { for (int i=0; i < kNumDamageTypes; i++) { // Check if it matches the main name. if (_stricmp(DTInfoArray[i].pName, pDTName) == 0) { return DTInfoArray[i].eType; } // Check if it matches the alternate name. This is just // used for backwards compatibility with some levels processed // with the old names to damagetypes in the VolumeBrush's. if( DTInfoArray[i].pAltName && _stricmp( DTInfoArray[i].pAltName, pDTName ) == 0 ) { return DTInfoArray[i].eType; } } return DT_INVALID; } // ----------------------------------------------------------------------- // // // ROUTINE: IsJarCameraType() // // PURPOSE: Does this damage type cause the camera to be "jarred" // // ----------------------------------------------------------------------- // LTBOOL IsJarCameraType(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].bJarCamera; } } return LTFALSE; } // ----------------------------------------------------------------------- // // // ROUTINE: IsScoreTagType() // // PURPOSE: Does this damage type score a tag in deathmatch // // ----------------------------------------------------------------------- // LTBOOL IsScoreTagType(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].bScoreTag; } } return LTFALSE; } // ----------------------------------------------------------------------- // // // ROUTINE: IsGriefType() // // PURPOSE: Should the player be protected against multiple instances of // this type in multiplayer. // // ----------------------------------------------------------------------- // LTBOOL IsGriefType(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].bGrief; } } return LTFALSE; } // ----------------------------------------------------------------------- // // // ROUTINE: IsGadgetType() // // PURPOSE: Is this damage type a gadget damage type? // // ----------------------------------------------------------------------- // LTBOOL IsGadgetType(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].bGadget; } } return LTFALSE; } // ----------------------------------------------------------------------- // // // ROUTINE: IsAccuracyType() // // PURPOSE: Does this damage type count towards player accuracy // // ----------------------------------------------------------------------- // LTBOOL IsAccuracyType(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].bAccuracy; } } return LTFALSE; } // ----------------------------------------------------------------------- // // // ROUTINE: SlowMovementDuration() // // PURPOSE: For how long does this damage type slow movement // // ----------------------------------------------------------------------- // LTFLOAT SlowMovementDuration(DamageType eType) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return DTInfoArray[i].fSlowMove; } } return 0.0f; } // ----------------------------------------------------------------------- // // // ROUTINE: GetDTINFO() // // PURPOSE: Gets the damagetype structure. // // ----------------------------------------------------------------------- // DTINFO const* GetDTINFO( DamageType eType ) { for (int i=0; i < kNumDamageTypes; i++) { if (DTInfoArray[i].eType == eType) { return &DTInfoArray[i]; } } return NULL; } // ----------------------------------------------------------------------- // // // ROUTINE: GetDamageFlagsWithHurtAnim // // PURPOSE: Get the list of damageflags that have the hurt flag set. // // ----------------------------------------------------------------------- // DamageFlags GetDamageFlagsWithHurtAnim( ) { DamageFlags damageFlags = 0; for (int i=0; i < kNumDamageTypes; i++) { if( DTInfoArray[i].bHurtAnim ) { damageFlags |= DTInfoArray[i].nDamageFlag; } } return damageFlags; }
[ [ [ 1, 375 ] ] ]
14051483109f488425abfbd4b902025abfdc2acb
7b4c786d4258ce4421b1e7bcca9011d4eeb50083
/Learning OpenCV/Chapter 2 - Introduction to OpenCV/Ex_2_3.cpp
babcc6a28aa9ba131968379c00da76d8ea46b1ad
[]
no_license
lzq123218/guoyishi-works
dbfa42a3e2d3bd4a984a5681e4335814657551ef
4e78c8f2e902589c3f06387374024225f52e5a92
refs/heads/master
2021-12-04T11:11:32.639076
2011-05-30T14:12:43
2011-05-30T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
909
cpp
#include "cv.h" #include "highgui.h" int g_slider_position = 0; CvCapture* g_capture = NULL; void onTrackbarSlide(int pos) { cvSetCaptureProperty( g_capture, CV_CAP_PROP_POS_FRAMES, pos ); } int main( int argc, char** argv ) { cvNamedWindow( "Example3", CV_WINDOW_AUTOSIZE ); if ( argc == 2 ) { g_capture = cvCreateFileCapture( argv[1] ); } int frames = (int) cvGetCaptureProperty( g_capture, CV_CAP_PROP_FRAME_COUNT ); if ( frames != 0 ) { cvCreateTrackbar( "Position", "Example3", &g_slider_position, frames, onTrackbarSlide ); } IplImage* frame; while (1) { frame = cvQueryFrame ( g_capture ); if ( !frame ) break; cvShowImage( "Example2", frame ); char c = cvWaitKey( 33 ); if ( c == 27 ) break; } cvReleaseCapture( &g_capture ); cvDestroyWindow( "Example3" ); return (0); }
[ "baicaibang@70501136-4834-11de-8855-c187e5f49513" ]
[ [ [ 1, 50 ] ] ]
4f9926ef4b27d9a878504e82b20eac9615ad2603
879b481e3d2af7de070d8da986cfea2507adfb6f
/Source/MainComponent.cpp
2a802ea259950b69aa1008b5271c83ff1e22533b
[]
no_license
grimtraveller/Granular-Audio-Destroyer
f1b4861417d5a7d44957bdcc2e9e608228dda881
2d9fb44f89f5914befb0a9e663248e5432598d29
refs/heads/master
2021-01-21T01:33:57.446402
2010-12-09T05:29:16
2010-12-09T05:29:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,779
cpp
/* ============================================================================== This is an automatically generated file created by the Jucer! Creation date: 1 Dec 2010 11:30:39pm Be careful when adding custom code to these files, as only the code within the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. Jucer version: 1.12 ------------------------------------------------------------------------------ The Jucer is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-6 by Raw Material Software ltd. ============================================================================== */ //[Headers] You can add your own extra header files here... //[/Headers] #include "MainComponent.h" //[MiscUserDefs] You can add your own user definitions and misc code here... //[/MiscUserDefs] //============================================================================== MainComponent::MainComponent () : mOpenFileButton (0), mSaveFileButton (0), mPlayButton(0), mCurrentAudioFileSource(0), mInterleavedBuffer(0), mLeftBuffer(0), mRightBuffer(0) { addAndMakeVisible (mOpenFileButton = new TextButton (T("OpenFileButton"))); mOpenFileButton->setButtonText (T("Open File")); mOpenFileButton->addButtonListener (this); addAndMakeVisible (mSaveFileButton = new TextButton (T("SaveFileButton"))); mSaveFileButton->setButtonText (T("Save File")); mSaveFileButton->addButtonListener (this); addAndMakeVisible (mPlayButton = new TextButton (T("PlayButton"))); mPlayButton->setButtonText (T("Play")); mPlayButton->addButtonListener (this); //[UserPreSize] mDeviceManager.initialise (2, 2, 0, true, String::empty, 0); mDeviceManager.addAudioCallback (&mAudioSourcePlayer); mAudioSourcePlayer.setSource (&mTransportSource); mCurrentAudioFileSource = 0; //[/UserPreSize] setSize (1024, 768); //[Constructor] You can add your own custom stuff here.. //setup Grain variables for testing for (int i=0; i< NUM_GRAINS; i++) { mGranularSlices[i] = 0; } //[/Constructor] } MainComponent::~MainComponent() { //[Destructor_pre]. You can add your own custom destruction code here.. //[/Destructor_pre] deleteAndZero (mOpenFileButton); deleteAndZero (mSaveFileButton); //[/Destructor_pre] //[Destructor]. You can add your own custom destruction code here.. mTransportSource.setSource (0); mAudioSourcePlayer.setSource (0); mDeviceManager.removeAudioCallback (&mAudioSourcePlayer); deleteAndZero (mCurrentAudioFileSource); if (mLeftBuffer != 0) { free(mLeftBuffer); mLeftBuffer = 0; } if (mRightBuffer != 0) { free(mRightBuffer); mRightBuffer = 0; } for (int i=0; i< NUM_GRAINS; i++) { if (mGranularSlices[i] != 0) { delete mGranularSlices[i]; mGranularSlices[i] = 0; } } //[/Destructor] } //============================================================================== void MainComponent::paint (Graphics& g) { //[UserPrePaint] Add your own custom painting code here.. //[/UserPrePaint] g.fillAll (Colours::white); //[UserPaint] Add your own custom painting code here.. //[/UserPaint] } void MainComponent::resized() { mOpenFileButton->setBounds (24, 272, 150, 24); mSaveFileButton->setBounds (216, 272, 150, 24); mPlayButton->setBounds (430, 272, 150, 24); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } void MainComponent::buttonClicked (Button* buttonThatWasClicked) { //[UserbuttonClicked_Pre] //[/UserbuttonClicked_Pre] if (buttonThatWasClicked == mOpenFileButton) { //[UserButtonCode_mOpenFileButton] -- add your button handler code here.. if (mPlaying) { mPlaying = false; mPlayButton->setButtonText(T("Play")); mDeviceManager.removeAudioCallback(this); } WildcardFileFilter wildcardFilter ("*.wav","", "Wave files"); FileBrowserComponent browser (FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles, File::nonexistent, &wildcardFilter, 0); FileChooserDialogBox dialogBox ("Open a Wave File", "Please choose a Wave file to open...", browser, true, Colours::lightblue); if (dialogBox.show()) { File mCurrentFile = browser.getSelectedFile(0); memStoreAudioFile(mCurrentFile); //mDeviceManager.addAudioCallback(this); } //[/UserButtonCode_mOpenFileButton] } else if (buttonThatWasClicked == mSaveFileButton) { //[UserButtonCode_mSaveFileButton] -- add your button handler code here.. if (mPlaying) { mPlaying = false; mPlayButton->setButtonText(T("Play")); mDeviceManager.removeAudioCallback(this); } if (mLeftBuffer == 0) return; WildcardFileFilter wildcardFilter ("*.wav","", "Wave files"); FileBrowserComponent browser (FileBrowserComponent::saveMode | FileBrowserComponent::canSelectFiles, File::nonexistent, &wildcardFilter, 0); FileChooserDialogBox dialogBox ("Save a Wave File", "Please choose a Wave file to save...", browser, true, Colours::lightblue); if (dialogBox.show()) { File savefile = browser.getSelectedFile(0); saveAudioFile(savefile); } //[/UserButtonCode_mSaveFileButton] } else if (buttonThatWasClicked == mPlayButton) { //[UserButtonCode_mPlayButton] -- add your button handler code here.. playPressed(); //[/UserButtonCode_mPlayButton] } //[UserbuttonClicked_Post] //[/UserbuttonClicked_Post] } //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... void MainComponent::memStoreAudioFile(File &audioFile) { //we only want raw samples, no header AudioFormatManager formatManager; formatManager.registerBasicFormats(); AudioFormatReader *reader = formatManager.createReaderFor(audioFile); if (reader != 0) { if (mLeftBuffer != 0) { free(mLeftBuffer); mLeftBuffer = 0; } if (mRightBuffer != 0) { free(mRightBuffer); mRightBuffer = 0; } int num = reader->numChannels; int* destBufs[num]; mLeftBuffer = (float*)malloc((reader->lengthInSamples/reader->numChannels*sizeof(float))+4096*sizeof(float)); //add some extra zeros at the end for safety destBufs[0] = (int*)mLeftBuffer; if (reader->numChannels > 1) { mRightBuffer = (float*)malloc((reader->lengthInSamples/reader->numChannels*sizeof(float))+4096*sizeof(float)); //add some extra zeros at the end for safety destBufs[1] = (int*)mRightBuffer; } reader->read(destBufs, reader->numChannels, 0, reader->lengthInSamples/reader->numChannels, false); mBufferLength = reader->lengthInSamples; mNumChannels = reader->numChannels; for (int i=0; i<(mBufferLength/mNumChannels); i++) { //scale to -1.0 to 1.0 floats mLeftBuffer[i] = ((float)destBufs[0][i])/(1.0f*INT_MAX); if (mRightBuffer != 0) mRightBuffer[i] = ((float)destBufs[1][i])/(1.0f*INT_MAX); } delete reader; setupGranularSlices(); } } void MainComponent::setupGranularSlices() { for (int i=0; i< NUM_GRAINS; i++) { if (mGranularSlices[i] != 0) { delete mGranularSlices[i]; mGranularSlices[i] = 0; } mGranularSlices[i] = new GranularSlice(mLeftBuffer, mRightBuffer, mBufferLength, mNumChannels); //experimental settings here - will be controllable via GUI instead in the future mGranularSlices[i]->setPan(1.0f*i/(1.0f*NUM_GRAINS)); mGranularSlices[i]->setGrainLength((i+1)*(44100/4)); mGranularSlices[i]->setGrainStartPosition(i*22050); mGranularSlices[i]->setVelocity(1.0f*(i+1)*0.25f); mGranularSlices[i]->setGrainAdvanceAmount((i+1)*22050/2); } } void MainComponent::saveAudioFile(File &saveFile) { if (mLeftBuffer == 0) //nothing ever loaded, quit here return; resetAudioRenderer(); int num = 1; if (mRightBuffer != 0) num++; float *leftOutputBuffer = (float*)malloc(1024*sizeof(float)); float *rightOutputBuffer = (float*)malloc(1024*sizeof(float));; float* destBufs[num]; destBufs[0] = leftOutputBuffer; if (num>1) { destBufs[1] = rightOutputBuffer; } saveFile.deleteFile(); OutputStream *output = saveFile.createOutputStream(); WavAudioFormat wavformat; AudioFormatWriter *writer = wavformat.createWriterFor(output, 44100.0, num, 16, StringPairArray(), 0); int *destIntBufs[num]; int *leftIntBuffer = (int*)malloc(1024*sizeof(int)); int *rightIntBuffer = (int*)malloc(1024*sizeof(int)); destIntBufs[0] = leftIntBuffer; if (num>1) { destIntBufs[1] = rightIntBuffer; } while (!renderAudioToBuffer(destBufs, num, 1024)) { for (int j=0; j<1024; j++) { leftIntBuffer[j] = (int)(leftOutputBuffer[j] * INT_MAX); rightIntBuffer[j] = (int)(rightOutputBuffer[j] * INT_MAX); } writer->write((const int**)destIntBufs, 1024); } free(leftOutputBuffer); free(rightOutputBuffer); free(leftIntBuffer); free(rightIntBuffer); delete writer; } void MainComponent::playAudioFile(File &audioFile) { // unload the previous file source and delete it.. mTransportSource.stop(); mTransportSource.setSource (0); deleteAndZero (mCurrentAudioFileSource); // get a format manager and set it up with the basic types (wav and aiff). AudioFormatManager formatManager; formatManager.registerBasicFormats(); AudioFormatReader* reader = formatManager.createReaderFor (audioFile); if (reader != 0) { mCurrentAudioFileSource = new AudioFormatReaderSource (reader, true); // ..and plug it into our transport source mTransportSource.setSource (mCurrentAudioFileSource, 32768, // tells it to buffer this many samples ahead reader->sampleRate); mTransportSource.setPosition (0); mTransportSource.start(); } } void MainComponent::playPressed() { if (mLeftBuffer == 0) return; if (mPlaying) { mDeviceManager.removeAudioCallback(this); mPlaying = false; mPlayButton->setButtonText(T("Play")); resetAudioRenderer(); } else { resetAudioRenderer(); mDeviceManager.addAudioCallback(this); mPlaying = true; mPlayButton->setButtonText(T("Stop")); } } void MainComponent::resetAudioRenderer() { for (int i=0; i< NUM_GRAINS; i++) { if (mGranularSlices[i] != 0) { mGranularSlices[i]->resetAudioPlayback(); } } } void MainComponent::audioDeviceAboutToStart (AudioIODevice* device) { zeromem (samples, sizeof (samples)); mPlaying = true; //mPlayButton->setButtonText(T("Stop")); } void MainComponent::audioDeviceStopped() { zeromem (samples, sizeof (samples)); mPlaying = false; //mPlayButton->setButtonText(T("Play")); } void MainComponent::audioDeviceIOCallback (const float** inputChannelData, int numInputChannels, float** outputChannelData, int numOutputChannels, int numSamples) { if (renderAudioToBuffer(outputChannelData, numOutputChannels, numSamples)) { //should be able to loop without bad access, let's not stop! //mDeviceManager.removeAudioCallback(this); } } bool MainComponent::renderAudioToBuffer(float** outputChannelData, int numOutputChannels, int numSamples) { // We need to clear the output buffers, in case they're full of junk.. for (int i = 0; i < numOutputChannels; ++i) { if (outputChannelData[i] != 0) zeromem (outputChannelData[i], sizeof (float) * numSamples); } bool outofbounds = false; for (int i=0; i<NUM_GRAINS; i++) { outofbounds = mGranularSlices[i]->renderAudioBlock(outputChannelData, numOutputChannels, numSamples); if (outofbounds) return true; } return outofbounds; } //[/MiscUserCode] //============================================================================== #if 0 /* -- Jucer information section -- This is where the Jucer puts all of its metadata, so don't change anything in here! BEGIN_JUCER_METADATA <JUCER_COMPONENT documentType="Component" className="MainComponent" componentName="" parentClasses="public Component" constructorParams="" variableInitialisers="" snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330000013" fixedSize="0" initialWidth="600" initialHeight="400"> <BACKGROUND backgroundColour="ffffffff"/> <TEXTBUTTON name="OpenFileButton" id="e02073e0540adda" memberName="mOpenFileButton" virtualName="" explicitFocusOrder="0" pos="24 272 150 24" buttonText="Open File" connectedEdges="0" needsCallback="1" radioGroupId="0"/> <TEXTBUTTON name="SaveFileButton" id="3f9e2515deae5ca9" memberName="mSaveFileButton" virtualName="" explicitFocusOrder="0" pos="216 272 150 24" buttonText="Save File" connectedEdges="0" needsCallback="1" radioGroupId="0"/> </JUCER_COMPONENT> END_JUCER_METADATA */ #endif
[ [ [ 1, 451 ] ] ]
f0ccd063b1d75f022f0b4a20a19b729aa04f20b5
a37df219b4a30e684db85b00dd76d4c36140f3c2
/1.7.1/ext3/stdafx.cpp
bd930f1cfce8091cd3568b14c58d431b1e7b4321
[]
no_license
BlackMoon/bm-net
0f79278f8709cd5d0738a6c3a27369726b0bb793
eb6414bc412a8cfc5c24622977e7fa7203618269
refs/heads/master
2020-12-25T20:20:44.843483
2011-11-29T10:33:17
2011-11-29T10:33:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
204
cpp
// stdafx.cpp : source file that includes just the standard includes // ext3.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
[ "[email protected]@b6168ec3-97fc-df6f-cbe5-288b4f99fbbd" ]
[ [ [ 1, 7 ] ] ]