blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
5
146
content_id
stringlengths
40
40
detected_licenses
listlengths
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
listlengths
1
16
author_lines
listlengths
1
16
435c5d47b8299b587a5820e412b59c2fa8387449
105cc69f4207a288be06fd7af7633787c3f3efb5
/HovercraftUniverse/HovercraftUniverse/EntityRegister.h
0a97ab72eea7fddfcab5b448cb5a86fe2a9519cf
[]
no_license
allenjacksonmaxplayio/uhasseltaacgua
330a6f2751e1d6675d1cf484ea2db0a923c9cdd0
ad54e9aa3ad841b8fc30682bd281c790a997478d
refs/heads/master
2020-12-24T21:21:28.075897
2010-06-09T18:05:23
2010-06-09T18:05:23
56,725,792
0
0
null
null
null
null
UTF-8
C++
false
false
487
h
#ifndef ENTITYREGISTER_H_ #define ENTITYREGISTER_H_ #include "NetworkIDManager.h" namespace HovUni { /** * Class that will register the entity to the network ID manager * * @author Olivier Berghmans */ class EntityRegister { public: /** * Register a set of entity classes * * @param manager the current ID manager */ static void registerAll(NetworkIDManager& manager); private: EntityRegister(void); ~EntityRegister(void); }; } #endif
[ "berghmans.olivier@2d55a33c-0a8f-11df-aac0-2d4c26e34a4c" ]
[ [ [ 1, 30 ] ] ]
68ab851fa9243a6911ce8e84673f68e4d895af32
80d4060395270e164d859b9803e0f40e71968c2b
/util.cpp
637c764e399ed2da3f2e2b062e61c7fed87e9cee
[]
no_license
infamous41md/safeseh-dump
73c4f5af8cc14f618d3b7a3371b947ab1496da1b
141b83720cd2dc767891c0ac6e8645479f82b5df
refs/heads/master
2021-01-25T10:44:20.323134
2011-10-08T01:06:12
2011-10-08T01:06:12
32,612,603
0
0
null
null
null
null
UTF-8
C++
false
false
3,859
cpp
/* * Public Domain getopt - history below * * $Id: getopt.c,v 1.1.1.1 2005/07/06 09:38:37 gully Exp $ * */ /* * From: [email protected] (Doug Gwyn <gwyn>) Newsgroups: net.sources * Subject: getopt library routine Date: 30 Mar 85 04:45:33 GMT */ /* * getopt -- public domain version of standard System V routine * * Strictly enforces the System V Command Syntax Standard; provided by D A * Gwyn of BRL for generic ANSI C implementations * * #define STRICT to prevent acceptance of clustered options with arguments * and ommision of whitespace between option and arg. */ /* * Modified by Manuel Novoa III on 1/5/01 to use weak symbols. * Programs needing long options will link gnu_getopt instead. */ /* * Last public domain version 1.5 downloaded from uclibc CVS: * http://www.uclibc.org/cgi-bin/cvsweb/uClibc/libc/unistd/getopt.c * on 2003-02-18 by Dave Beckett and tidied: * Ran through "indent getopt.c -gnu" then fixed up the mess * Removed register - compilers are smart these days * ANSI-fied the declarations * Prefixed with raptor_ so that it doesn't clash with any getopt * linked in later. */ #include <stdio.h> #include <string.h> int opterr; /* error => print message */ int optind; /* next argv[] index */ int optopt; /* Set for unknown arguments */ char *optarg; /* option parameter if any */ /* * Err: * program name argv[0] * specific message * defective option letter */ static int Err (char *name, char *mess, int c) /* returns '?' */ { optopt = c; if (opterr) { (void) fprintf (stderr, "%s: %s -- %c\n", name, mess, c); } return '?'; /* erroneous-option marker */ } int getopt (int argc, char * const argv[], const char *optstring) { static int sp = 1; /* position within argument */ int osp; /* saved `sp' for param test */ #ifndef STRICT int oind; /* saved `optind' for param test */ #endif int c; /* option letter */ const char *cp; /* -> option in `optstring' */ optarg = NULL; /* initialise getopt vars */ if (optind == 0) { optind = 1; opterr = 1; optopt = 1; optarg = NULL; } if (sp == 1) { /* fresh argument */ if (optind >= argc /* no more arguments */ || argv[optind][0] != '-' /* no more options */ || argv[optind][1] == '\0' /* not option; stdin */ ) return EOF; else if (strcmp (argv[optind], "--") == 0) { ++optind; /* skip over "--" */ return EOF; /* "--" marks end of options */ } } c = argv[optind][sp]; /* option letter */ osp = sp++; /* get ready for next letter */ #ifndef STRICT oind = optind; /* save optind for param test */ #endif if (argv[optind][sp] == '\0') { /* end of argument */ ++optind; /* get ready for next try */ sp = 1; /* beginning of next argument */ } if (c == ':' || c == '?' /* optstring syntax conflict */ || (cp = strchr (optstring, c)) == NULL) /* not found */ { return Err (argv[0], "illegal option", c); } if (cp[1] == ':') { /* option takes parameter */ #ifdef STRICT if (osp != 1) { return Err (argv[0], "option must not be clustered", c); } /* reset by end of argument */ if (sp != 1) { return Err (argv[0], "option must be followed by white space", c); } #else if (oind == optind) { /* argument w/o whitespace */ optarg = &argv[optind][sp]; sp = 1; /* beginning of next argument */ } else #endif if (optind >= argc) { return Err (argv[0], "option requires an argument", c); } else /* argument w/ whitespace */ optarg = argv[optind]; ++optind; /* skip over parameter */ } return c; }
[ "[email protected]@e9da892a-d592-1002-e69b-669708487c85" ]
[ [ [ 1, 158 ] ] ]
7ca84d628fae952448c2845a3aaaebad69a01a24
993635387a5f4868e442df7d4a0d87cc215069c1
/OMV/OMV/MainFrm.cpp
ecf5a47389c5dcde976c6ab49750cdd7d136b771
[]
no_license
windrobin/ogremeshviewer
90475b25f53f9d1aee821c150a8517ee4ee4d37d
679a2979320af09469894a6d99a90ec1adc5f658
refs/heads/master
2021-01-10T02:18:50.523143
2011-02-16T01:06:03
2011-02-16T01:06:03
43,444,741
0
2
null
null
null
null
UTF-8
C++
false
false
24,665
cpp
/* ----------------------------------------------------------------------------- This source file is part of Tiger Viewer(An Ogre Mesh Viewer) For the latest info, see http://code.google.com/p/ogremeshviewer/ Copyright (c) 2010 Zhang Kun([email protected]) This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 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. ----------------------------------------------------------------------------- This software also uses Microsoft Fluent UI. License terms to copy, use or distribute the Fluent UI are available separately. To learn more about our Fluent UI licensing program, please visit http://msdn.microsoft.com/officeui. Generally speaking, Fluent UI is free, if you do not use it make a contest software like Office. ----------------------------------------------------------------------------- */ // MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "OMV.h" #include "MainFrm.h" #include "OgreFramework.h" #include "CameraController.h" #include "Actor.h" using namespace Ogre; #ifdef _DEBUG #define new DEBUG_NEW #endif // CMainFrame IMPLEMENT_DYNCREATE(CMainFrame, CFrameWndEx) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx) ON_WM_CREATE() ON_WM_CLOSE() ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_OFF_2007_AQUA, &CMainFrame::OnApplicationLook) ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_OFF_2007_AQUA, &CMainFrame::OnUpdateApplicationLook) ON_COMMAND_RANGE(ID_VIEW_VIEW_ACTOR_PANEL, ID_VIEW_VIEW_PROPERTY_PANEL, &CMainFrame::OnViewPanels) ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_VIEW_ACTOR_PANEL, ID_VIEW_VIEW_PROPERTY_PANEL, &CMainFrame::OnUpdateViewPanels) ON_COMMAND_RANGE(ID_SCENE_LOOKATMODE, ID_SCENE_WIREFRAME, &CMainFrame::OnSceneOptions) ON_UPDATE_COMMAND_UI_RANGE(ID_SCENE_LOOKATMODE, ID_SCENE_WIREFRAME, &CMainFrame::OnUpdateSceneOptions) END_MESSAGE_MAP() // CMainFrame construction/destruction CMainFrame::CMainFrame() { // TODO: add member initialization code here theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_OFF_2007_BLUE); } CMainFrame::~CMainFrame() { } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWndEx::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return TRUE; } void CMainFrame::InitializeRibbon() { BOOL bNameValid; CString strTemp; bNameValid = strTemp.LoadString(IDS_RIBBON_FILE); ASSERT(bNameValid); // Load panel images: m_PanelImages.SetImageSize(CSize(16, 16)); m_PanelImages.Load(IDB_BUTTONS); // Init main button: m_MainButton.SetImage(IDB_MAIN); m_MainButton.SetText(_T("\nf")); m_MainButton.SetToolTipText(strTemp); m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45)); CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_FILESMALL, IDB_FILELARGE); bNameValid = strTemp.LoadString(IDS_RIBBON_NEW); ASSERT(bNameValid); pMainPanel->Add(new CMFCRibbonButton(ID_FILE_NEW, strTemp, 0, 0)); bNameValid = strTemp.LoadString(IDS_RIBBON_OPEN); ASSERT(bNameValid); pMainPanel->Add(new CMFCRibbonButton(ID_FILE_OPEN, strTemp, 1, 1)); bNameValid = strTemp.LoadString(IDS_RIBBON_SAVE); ASSERT(bNameValid); pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SAVE, strTemp, 2, 2)); bNameValid = strTemp.LoadString(IDS_RIBBON_SAVEAS); ASSERT(bNameValid); pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SAVE_AS, strTemp, 3, 3)); bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT); ASSERT(bNameValid); CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 6, 6); pBtnPrint->SetKeys(_T("p"), _T("w")); bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_LABEL); ASSERT(bNameValid); pBtnPrint->AddSubItem(new CMFCRibbonLabel(strTemp)); bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_QUICK); ASSERT(bNameValid); pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_DIRECT, strTemp, 7, 7, TRUE)); bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_PREVIEW); ASSERT(bNameValid); pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_PREVIEW, strTemp, 8, 8, TRUE)); bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_SETUP); ASSERT(bNameValid); pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_SETUP, strTemp, 11, 11, TRUE)); pMainPanel->Add(pBtnPrint); pMainPanel->Add(new CMFCRibbonSeparator(TRUE)); bNameValid = strTemp.LoadString(IDS_RIBBON_CLOSE); ASSERT(bNameValid); pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, strTemp, 9, 9)); bNameValid = strTemp.LoadString(IDS_RIBBON_RECENT_DOCS); ASSERT(bNameValid); pMainPanel->AddRecentFilesList(strTemp); bNameValid = strTemp.LoadString(IDS_RIBBON_EXIT); ASSERT(bNameValid); pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp, 15)); //------------------------------------------------------- // Add "Home" category with "Clipboard" panel: bNameValid = strTemp.LoadString(IDS_RIBBON_HOME); ASSERT(bNameValid); CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, IDB_WRITESMALL, IDB_WRITELARGE); #if 0 // Create "Clipboard" panel: bNameValid = strTemp.LoadString(IDS_RIBBON_CLIPBOARD); ASSERT(bNameValid); CMFCRibbonPanel* pPanelClipboard = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon(27)); bNameValid = strTemp.LoadString(IDS_RIBBON_PASTE); ASSERT(bNameValid); CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton(ID_EDIT_PASTE, strTemp, 0, 0); pPanelClipboard->Add(pBtnPaste); bNameValid = strTemp.LoadString(IDS_RIBBON_CUT); ASSERT(bNameValid); pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_CUT, strTemp, 1)); bNameValid = strTemp.LoadString(IDS_RIBBON_COPY); ASSERT(bNameValid); pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_COPY, strTemp, 2)); bNameValid = strTemp.LoadString(IDS_RIBBON_SELECTALL); ASSERT(bNameValid); pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, strTemp, -1)); #endif #define M_Add_Ribbon_CheckBox(Panel, IDS, ID) \ { \ bNameValid = strTemp.LoadString(IDS); \ ASSERT(bNameValid); \ CMFCRibbonButton* pTmp = new CMFCRibbonCheckBox(ID, strTemp); \ Panel->Add(pTmp); \ } // Create and add a "Panels" panel: bNameValid = strTemp.LoadString(IDS_RIBBON_VIEW); ASSERT(bNameValid); CMFCRibbonPanel* pPanelView = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon (7)); M_Add_Ribbon_CheckBox(pPanelView, IDS_RIBBON_STATUSBAR, ID_VIEW_STATUS_BAR); M_Add_Ribbon_CheckBox(pPanelView, IDS_VIEW_OUTPUT_PANEL, ID_VIEW_VIEW_OUTPUT_PANEL); M_Add_Ribbon_CheckBox(pPanelView, IDS_VIEW_MESH_PANEL, ID_VIEW_VIEW_MESH_PANEL); M_Add_Ribbon_CheckBox(pPanelView, IDS_VIEW_PROPERTY_PANEL, ID_VIEW_VIEW_PROPERTY_PANEL); M_Add_Ribbon_CheckBox(pPanelView, IDS_VIEW_ACTOR_PANEL, ID_VIEW_VIEW_ACTOR_PANEL); M_Add_Ribbon_CheckBox(pPanelView, IDS_VIEW_ANIMATION_PANEL, ID_VIEW_VIEW_ANIMATION_PANEL); //bNameValid = strTemp.LoadString(IDS_RIBBON_OUTLOOKPANEL); //ASSERT(bNameValid); //CMFCRibbonButton* pBtnOutlookBar = new CMFCRibbonCheckBox(ID_VIEW_OUTLOOK_BAR, strTemp); //pPanelView->Add(pBtnOutlookBar); //------------------------------------------------------- // Create and add a "Scene" panel: bNameValid = strTemp.LoadString(IDS_RIBBON_SCENE); ASSERT(bNameValid); CMFCRibbonPanel* pPanelScene = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon (7)); M_Add_Ribbon_CheckBox(pPanelScene, IDS_RIBBON_SCENE_LOOKATMODE, ID_SCENE_LOOKATMODE); M_Add_Ribbon_CheckBox(pPanelScene, IDS_RIBBON_SCENE_WIREFRAME, ID_SCENE_WIREFRAME); M_Add_Ribbon_CheckBox(pPanelScene, IDS_RIBBON_SCENE_FPS, ID_SCENE_SHOWFPS); M_Add_Ribbon_CheckBox(pPanelScene, IDS_RIBBON_SCENE_AXES, ID_SCENE_SHOWAXES); M_Add_Ribbon_CheckBox(pPanelScene, IDS_RIBBON_SCENE_BOUDINGBOX, ID_SCENE_SHOWBOUNDINGBOX); M_Add_Ribbon_CheckBox(pPanelScene, IDS_RIBBON_SCENE_BONES, ID_SCENE_SHOWBONES); //------------------------------------------------------- // Add elements to the right side of tabs: bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE); ASSERT(bNameValid); CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1); pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* No default command */, TRUE /* Right align */); bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_TIP); ASSERT(bNameValid); pVisualStyleButton->SetToolTipText(strTemp); bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_DESC); ASSERT(bNameValid); pVisualStyleButton->SetDescription(strTemp); m_wndRibbonBar.AddToTabs(pVisualStyleButton); // Add quick access toolbar commands: CList<UINT, UINT> lstQATCmds; lstQATCmds.AddTail(ID_FILE_NEW); lstQATCmds.AddTail(ID_FILE_OPEN); lstQATCmds.AddTail(ID_FILE_SAVE); lstQATCmds.AddTail(ID_FILE_PRINT_DIRECT); m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds); m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon (0))); } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); m_wndRibbonBar.Create(this); InitializeRibbon(); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CString strTitlePane1; CString strTitlePane2; bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1); ASSERT(bNameValid); bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2); ASSERT(bNameValid); m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1); m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // Navigation pane will be created at left, so temporary disable docking at the left side: EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT); // Load menu item image (not placed on any standard toolbars): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); #if 0 // Create and setup "Outlook" navigation bar: if (!CreateOutlookBar(m_wndNavigationBar, ID_VIEW_OUTLOOK_BAR, 250)) //ID_VIEW_NAVIGATION { TRACE0("Failed to create navigation pane\n"); return -1; // fail to create } // Outlook bar is created and docking on the left side should be allowed. EnableDocking(CBRS_ALIGN_LEFT); EnableAutoHidePanes(CBRS_ALIGN_RIGHT); #endif // create docking windows if (!CreateDockingWindows()) { TRACE0("Failed to create docking windows\n"); return -1; } //Right _ActorPanel.EnableDocking(CBRS_ALIGN_ANY); _MeshPanel.EnableDocking(CBRS_ALIGN_ANY); _wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&_MeshPanel); _wndProperties.DockToWindow(&_MeshPanel, CBRS_ALIGN_BOTTOM, CRect(0, 0, 200, 150)); _ActorPanel.DockToWindow(&_wndProperties, CBRS_ALIGN_BOTTOM, CRect(0, 0, 200, 150)); //CDockablePane* pTabbedBar = NULL; //_ActorPanel.AttachToTabWnd(&_MeshPanel, DM_SHOW, FALSE, &pTabbedBar); //Left _AnimationPanel.ShowWindow(SW_SHOW); _AnimationPanel.EnableDocking(CBRS_ALIGN_LEFT/* | CBRS_ALIGN_RIGHT*/); DockPane(&_AnimationPanel); //Bottom _LogPanel.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM); DockPane(&_LogPanel); return 0; } BOOL CMainFrame::CreateDockingWindows() { BOOL bNameValid; // Create mesh panel CString strClassView; bNameValid = strClassView.LoadString(IDS_MESH_VIEW); ASSERT(bNameValid); if (!_MeshPanel.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_VIEW_MESH_PANEL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create mesh panel\n"); return FALSE; // failed to create } bNameValid = strClassView.LoadString(IDS_ACTOR_PANEL); ASSERT(bNameValid); if (!_ActorPanel.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_VIEW_ACTOR_PANEL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create actor panel\n"); return FALSE; // failed to create } // Create animation panel bNameValid = strClassView.LoadString(IDS_ANIMATION_VIEW); ASSERT(bNameValid); if (!_AnimationPanel.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_VIEW_ANIMATION_PANEL, WS_CHILD /*| WS_VISIBLE*/ | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create animation panel\n"); return FALSE; // failed to create } #if 0 // Create file view CString strFileView; bNameValid = strFileView.LoadString(IDS_FILE_VIEW); ASSERT(bNameValid); if (!m_wndFileView.Create(strFileView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_FILEVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI)) { TRACE0("Failed to create File View window\n"); return FALSE; // failed to create } #endif // Create output window CString strOutputWnd; bNameValid = strOutputWnd.LoadString(IDS_OUTPUT_WND); ASSERT(bNameValid); if (!_LogPanel.Create(strOutputWnd, this, CRect(0, 0, 100, 100), TRUE, ID_VIEW_VIEW_OUTPUT_PANEL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create Output window\n"); return FALSE; // failed to create } // Create properties window CString strPropertiesWnd; bNameValid = strPropertiesWnd.LoadString(IDS_PROPERTIES_WND); ASSERT(bNameValid); if (!_wndProperties.Create(strPropertiesWnd, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_VIEW_PROPERTY_PANEL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create Properties window\n"); return FALSE; // failed to create } //HICON hFileViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(theApp.m_bHiColorIcons ? IDI_FILE_VIEW_HC : IDI_FILE_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); //m_wndFileView.SetIcon(hFileViewIcon, FALSE); HICON hClassViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(theApp.m_bHiColorIcons ? IDI_CLASS_VIEW_HC : IDI_CLASS_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); _MeshPanel.SetIcon(hClassViewIcon, FALSE); HICON hActorViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(theApp.m_bHiColorIcons ? IDI_FILE_VIEW_HC : IDI_FILE_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); _ActorPanel.SetIcon(hActorViewIcon, FALSE); HICON hOutputBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(theApp.m_bHiColorIcons ? IDI_OUTPUT_WND_HC : IDI_OUTPUT_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); _LogPanel.SetIcon(hOutputBarIcon, FALSE); HICON hPropertiesBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(theApp.m_bHiColorIcons ? IDI_PROPERTIES_WND_HC : IDI_PROPERTIES_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); _wndProperties.SetIcon(hPropertiesBarIcon, FALSE); return TRUE; } #if 0 BOOL CMainFrame::CreateOutlookBar(CMFCOutlookBar& bar, UINT uiID, int nInitialWidth) { CWindowDC dc(NULL); bar.SetMode2003(); BOOL bNameValid; CString strTemp; bNameValid = strTemp.LoadString(IDS_SHORTCUTS); ASSERT(bNameValid); if (!bar.Create(strTemp, this, CRect(0, 0, nInitialWidth, 32000), uiID, WS_CHILD | WS_VISIBLE | CBRS_LEFT)) { return FALSE; // fail to create } CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*)bar.GetUnderlyingWindow(); if (pOutlookBar == NULL) { ASSERT(FALSE); return FALSE; } pOutlookBar->EnableInPlaceEdit(TRUE); static UINT uiPageID = 1; DWORD dwPaneStyle = AFX_DEFAULT_TOOLBAR_STYLE | CBRS_FLOAT_MULTI; // can float, can auto-hide, can resize, CAN NOT CLOSE DWORD dwStyle = AFX_CBRS_FLOAT | AFX_CBRS_AUTOHIDE | AFX_CBRS_RESIZE; CRect rectDummy(0, 0, 0, 0); const DWORD dwTreeStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS; m_wndTree.Create(dwTreeStyle, rectDummy, &bar, 1200); bNameValid = strTemp.LoadString(IDS_FOLDERS); ASSERT(bNameValid); pOutlookBar->AddControl(&m_wndTree, strTemp, 2, TRUE, dwStyle); m_wndCalendar.Create(rectDummy, &bar, 1201); bNameValid = strTemp.LoadString(IDS_CALENDAR); ASSERT(bNameValid); pOutlookBar->AddControl(&m_wndCalendar, strTemp, 3, TRUE, dwStyle); bar.SetPaneStyle(bar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); pOutlookBar->SetImageList(theApp.m_bHiColorIcons ? IDB_PAGES_HC : IDB_PAGES, 24); pOutlookBar->SetToolbarImageList(theApp.m_bHiColorIcons ? IDB_PAGES_SMALL_HC : IDB_PAGES_SMALL, 16); pOutlookBar->RecalcLayout(); BOOL bAnimation = theApp.GetInt(_T("OutlookAnimation"), TRUE); CMFCOutlookBarTabCtrl::EnableAnimation(bAnimation); bar.SetButtonsFont(&afxGlobalData.fontBold); return TRUE; } #endif // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWndEx::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWndEx::Dump(dc); } #endif //_DEBUG // CMainFrame message handlers void CMainFrame::OnApplicationLook(UINT id) { CWaitCursor wait; theApp.m_nAppLook = id; switch (theApp.m_nAppLook) { case ID_VIEW_APPLOOK_WIN_2000: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager)); break; case ID_VIEW_APPLOOK_OFF_XP: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP)); break; case ID_VIEW_APPLOOK_WIN_XP: CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE; CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); break; case ID_VIEW_APPLOOK_OFF_2003: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003)); CDockingManager::SetDockingMode(DT_SMART); break; case ID_VIEW_APPLOOK_VS_2005: CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005)); CDockingManager::SetDockingMode(DT_SMART); break; default: switch (theApp.m_nAppLook) { case ID_VIEW_APPLOOK_OFF_2007_BLUE: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); break; case ID_VIEW_APPLOOK_OFF_2007_BLACK: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); break; case ID_VIEW_APPLOOK_OFF_2007_SILVER: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); break; case ID_VIEW_APPLOOK_OFF_2007_AQUA: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua); break; } CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode(DT_SMART); } RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook); } void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI) { pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID); } void CMainFrame::OnViewPanels(UINT id) { if (id == ID_VIEW_VIEW_ACTOR_PANEL) { _ActorPanel.ShowPane(!_ActorPanel.IsVisible(), FALSE, !_ActorPanel.IsVisible()); } else if (id == ID_VIEW_VIEW_OUTPUT_PANEL) { _LogPanel.ShowPane(!_LogPanel.IsVisible(), FALSE, !_LogPanel.IsVisible()); } else if (id == ID_VIEW_VIEW_MESH_PANEL) { _MeshPanel.ShowPane(!_MeshPanel.IsVisible(), FALSE, !_MeshPanel.IsVisible()); } else if(id == ID_VIEW_VIEW_PROPERTY_PANEL) { _wndProperties.ShowPane(!_wndProperties.IsVisible(), FALSE, !_wndProperties.IsVisible()); } else if(id == ID_VIEW_VIEW_ANIMATION_PANEL) { _AnimationPanel.ShowPane(!_AnimationPanel.IsVisible(), FALSE, !_AnimationPanel.IsVisible()); } } void CMainFrame::OnUpdateViewPanels(CCmdUI* pCmdUI) { if (pCmdUI->m_nID == ID_VIEW_VIEW_ACTOR_PANEL) { pCmdUI->SetCheck(_ActorPanel.IsVisible()); } else if (pCmdUI->m_nID == ID_VIEW_VIEW_OUTPUT_PANEL) { pCmdUI->SetCheck(_LogPanel.IsVisible()); } else if (pCmdUI->m_nID == ID_VIEW_VIEW_MESH_PANEL) { pCmdUI->SetCheck(_MeshPanel.IsVisible()); } else if(pCmdUI->m_nID == ID_VIEW_VIEW_PROPERTY_PANEL) { pCmdUI->SetCheck(_wndProperties.IsVisible()); } else if(pCmdUI->m_nID == ID_VIEW_VIEW_ANIMATION_PANEL) { pCmdUI->SetCheck(_AnimationPanel.IsVisible()); } } extern bool g_bExisting; void CMainFrame::OnClose() { g_bExisting = true; CFrameWndEx::OnClose(); } void CMainFrame::OnSceneOptions(UINT id) { if (OgreFramework::getSingletonPtr() == NULL) return; if (ID_SCENE_LOOKATMODE == id) { bool b = OgreFramework::getSingleton().GetCameraController()->GetLookAtMode(); OgreFramework::getSingleton().GetCameraController()->SetLookAtMode(!b); if (!b) OgreFramework::getSingleton().GetCameraController()->StartLookAt(); } else if (ID_SCENE_WIREFRAME == id) { OgreFramework::getSingleton().ToggleWireframe(); } else if (ID_SCENE_SHOWFPS == id) { OgreFramework::getSingleton().ToggleFPS(); } else if (ID_SCENE_SHOWAXES == id) { Actor* pActor = OgreFramework::getSingleton().GetCurrentActor(); if (!pActor) { return; } pActor->ToggleAxes(); } else if (ID_SCENE_SHOWBOUNDINGBOX == id) { Actor* pActor = OgreFramework::getSingleton().GetCurrentActor(); if (!pActor) { return; } pActor->ToggleBoundingBox(); } else if (ID_SCENE_SHOWBONES == id) { Actor* pActor = OgreFramework::getSingleton().GetCurrentActor(); if (!pActor) { return; } pActor->ToggleBone(); } } void CMainFrame::OnUpdateSceneOptions(CCmdUI* pCmdUI) { if (OgreFramework::getSingletonPtr() == NULL) return; if (ID_SCENE_LOOKATMODE == pCmdUI->m_nID) { pCmdUI->SetCheck( OgreFramework::getSingleton().GetCameraController()->GetLookAtMode() ); } else if (ID_SCENE_WIREFRAME == pCmdUI->m_nID) { pCmdUI->SetCheck( OgreFramework::getSingleton().IsWireframeEnabled() ); } else if (ID_SCENE_SHOWFPS == pCmdUI->m_nID) { pCmdUI->SetCheck( OgreFramework::getSingleton().IsFPSEnabled() ); } else if (ID_SCENE_SHOWAXES == pCmdUI->m_nID) { Actor* pActor = OgreFramework::getSingleton().GetCurrentActor(); if (!pActor) { pCmdUI->Enable(FALSE); return; } pCmdUI->SetCheck( pActor->IsShowAxes() ); } else if (ID_SCENE_SHOWBOUNDINGBOX == pCmdUI->m_nID) { Actor* pActor = OgreFramework::getSingleton().GetCurrentActor(); if (!pActor) { pCmdUI->Enable(FALSE); return; } pCmdUI->SetCheck( pActor->IsShowBoundingBox() ); } else if (ID_SCENE_SHOWBONES == pCmdUI->m_nID) { Actor* pActor = OgreFramework::getSingleton().GetCurrentActor(); if (!pActor) { pCmdUI->Enable(FALSE); return; } pCmdUI->SetCheck( pActor->IsShowBone() ); } } void CMainFrame::OnResetAllViews() { //MeshPanel _MeshPanel.OnReset(); //AnimationPanel _AnimationPanel.OnReset(); //ActorPanel _ActorPanel.OnReset(); // OgreFramework::getSingleton().OnReset(); }
[ "zhk.tiger@b3cfb0ba-c873-51ca-4d9f-db82523f9d23" ]
[ [ [ 1, 752 ] ] ]
18cc4688c1a2d1bf1976e794f8a365f00b7989c3
bb3a97270bfef3df38aeaf17b4d6a8e33bef3032
/kinect_headtracking/KGlutInput.h
35206927d48d1f829575bed24b9b383330f1d7e4
[]
no_license
amrzagloul/kinect_lab
b10514ccabca4800bcaa9ae45df5c47bc423f5f7
871e3ec00ee035d7d8ad5074d92a63856b20a834
refs/heads/master
2021-01-21T01:33:49.469635
2011-03-22T15:46:47
2011-03-22T15:46:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
753
h
#pragma once #include <cstdlib> #ifdef USE_GLUT #if (XN_PLATFORM == XN_PLATFORM_MACOSX) #include <GLUT/glut.h> #else #include <GL/glut.h> #endif #else #include "opengles.h" #endif #include "KProgram.h" class KGlutInput { private: KGlutInput(void); ~KGlutInput(void); public: static void glutMouse(int button, int state, int x , int y); static void glutKeyboard(unsigned char key, int x, int y); static void glutMouseMotion(int x, int y); static int getMouseDeltaX(); static int getMouseDeltaY(); private: static int ButtonPressed_x; static int ButtonPressed_y; static int Delta_x; static int Delta_y; static int OldDelta_x; static int OldDelta_y; static bool ButtonPressed; };
[ [ [ 1, 39 ] ] ]
ef6ebf00be10556a10cf76730501c33a004ce808
fcdddf0f27e52ece3f594c14fd47d1123f4ac863
/terralib/src/DSDK/include/filters/lti_datatypeTransformer.h
a2dfdcba6e19144f64f31194fe075826828e0788
[]
no_license
radtek/terra-printer
32a2568b1e92cb5a0495c651d7048db6b2bbc8e5
959241e52562128d196ccb806b51fda17d7342ae
refs/heads/master
2020-06-11T01:49:15.043478
2011-12-12T13:31:19
2011-12-12T13:31:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,043
h
/* $Id: lti_datatypeTransformer.h 5124 2006-10-27 11:40:40Z lubia $ */ /* ////////////////////////////////////////////////////////////////////////// // // // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, // // Suite 200, Seattle, WA 98104. Unauthorized use or distribution // // prohibited. Access to and use of this code is permitted only under // // license from LizardTech, Inc. Portions of the code are protected by // // US and foreign patents and other filings. All Rights Reserved. // // // ////////////////////////////////////////////////////////////////////////// */ /* PUBLIC */ #ifndef LTI_DATATYPETRANSFORMER_H #define LTI_DATATYPETRANSFORMER_H // lt_lib_mrsid_imageFilters #include "lti_dynamicRangeFilter.h" LT_BEGIN_NAMESPACE(LizardTech) #if defined(LT_COMPILER_MS) #pragma warning(push,4) #endif // we support only float, uint8, uint16 class LTIReusableBSQBuffer; #if defined LT_COMPILER_GCC #warning "** LTIDataTypeTransformer is deprecated -- use LTIDynamicRangeFilter" #elif defined LT_COMPILER_MS #pragma message( "*******************************************" ) #pragma message( "* LTIDataTypeTransformer is deprecated *" ) #pragma message( "* use LTIDynamicRangeFilter *" ) #pragma message( "*******************************************" ) #endif /** * changes the datatype of the samples of the image * * This class changes the datatype of the samples of the image. * * The values of the samples are scaled as required to meet the range of the * new datatype. */ class LTIDataTypeTransformer : public LTIDynamicRangeFilter { public: /** * constructor * * Creates an image stage with the given datatype. The sample values are * scaled as required to meet the range of the new datatype; that is, a * value of 65535 for a 16-bit datatype will map to a value of 255 for an * 8-bit datatype, and a value of 127 for an 8-bit datatype will map to * a value of 32767 for a 16-bit datatype. * * @note Only uint8, uint16, and float32 datatypes are supported. * * @param sourceImage the base image * @param dstDataType the datatype of the new image stage * @param takeOwnership set to true to have the filter delete the \a sourceImage */ LTIDataTypeTransformer(LTIImageStage* sourceImage, LTIDataType dstDataType, bool takeOwnership) : LTIDynamicRangeFilter(sourceImage, dstDataType, takeOwnership) { } private: // nope LTIDataTypeTransformer(const LTIDataTypeTransformer&); LTIDataTypeTransformer& operator=(const LTIDataTypeTransformer&); }; LT_END_NAMESPACE(LizardTech) #if defined(LT_COMPILER_MS) #pragma warning(pop) #endif #endif // LTI_DATATYPETRANSFORMER_H
[ "[email protected]@58180da6-ba8b-8960-36a5-00cc02a3ddec" ]
[ [ [ 1, 84 ] ] ]
048a9e1fe39782b3336e280b70dde569cd8d155a
ee065463a247fda9a1927e978143186204fefa23
/Src/Depends/ClanLib/ClanLib2.0/Sources/Core/XML/dom_document_type.cpp
f0c828cdb82d9480f0911bef157b5190e7e613ca
[]
no_license
ptrefall/hinsimviz
32e9a679170eda9e552d69db6578369a3065f863
9caaacd39bf04bbe13ee1288d8578ece7949518f
refs/heads/master
2021-01-22T09:03:52.503587
2010-09-26T17:29:20
2010-09-26T17:29:20
32,448,374
1
0
null
null
null
null
UTF-8
C++
false
false
3,812
cpp
/* ** ClanLib SDK ** Copyright (c) 1997-2010 The ClanLib Team ** ** This software is provided 'as-is', without any express or implied ** warranty. In no event will the authors be held liable for any damages ** arising from the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, ** including commercial applications, and to alter it and redistribute it ** freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not ** claim that you wrote the original software. If you use this software ** in a product, an acknowledgment in the product documentation would be ** appreciated but is not required. ** 2. Altered source versions must be plainly marked as such, and must not be ** misrepresented as being the original software. ** 3. This notice may not be removed or altered from any source distribution. ** ** Note: Some of the libraries ClanLib may link to may have additional ** requirements or restrictions. ** ** File Author(s): ** ** Magnus Norddahl */ #include "Core/precomp.h" #include "API/Core/XML/dom_document_type.h" #include "API/Core/XML/dom_document.h" #include "API/Core/XML/dom_named_node_map.h" #include "dom_node_generic.h" #include "dom_document_generic.h" ///////////////////////////////////////////////////////////////////////////// // CL_DomDocumentType construction: CL_DomDocumentType::CL_DomDocumentType() { } CL_DomDocumentType::CL_DomDocumentType( const CL_DomString &qualified_name, const CL_DomString &public_id, const CL_DomString &system_id) : CL_DomNode(CL_DomDocument(), DOCUMENT_TYPE_NODE) { CL_DomDocument_Generic *doc = dynamic_cast<CL_DomDocument_Generic *>(impl->owner_document.get()); doc->qualified_name = qualified_name; doc->public_id = public_id; doc->system_id = system_id; } CL_DomDocumentType::CL_DomDocumentType(CL_DomDocument &doc) : CL_DomNode(doc, DOCUMENT_TYPE_NODE) { } CL_DomDocumentType::CL_DomDocumentType(const CL_SharedPtr<CL_DomNode_Generic> &impl) : CL_DomNode(impl) { } CL_DomDocumentType::~CL_DomDocumentType() { } ///////////////////////////////////////////////////////////////////////////// // CL_DomDocumentType attributes: CL_DomString CL_DomDocumentType::get_name() const { if (impl) { const CL_DomDocument_Generic *doc = dynamic_cast<const CL_DomDocument_Generic *>(impl->owner_document.get()); if (doc) return doc->qualified_name; } return CL_DomString(); } CL_DomNamedNodeMap CL_DomDocumentType::get_entities() const { return CL_DomNamedNodeMap(); } CL_DomNamedNodeMap CL_DomDocumentType::get_notations() const { return CL_DomNamedNodeMap(); } CL_DomString CL_DomDocumentType::get_public_id() const { if (impl) { const CL_DomDocument_Generic *doc = dynamic_cast<const CL_DomDocument_Generic *>(impl->owner_document.get()); if (doc) return doc->public_id; } return CL_DomString(); } CL_DomString CL_DomDocumentType::get_system_id() const { if (impl) { const CL_DomDocument_Generic *doc = dynamic_cast<const CL_DomDocument_Generic *>(impl->owner_document.get()); if (doc) return doc->system_id; } return CL_DomString(); } CL_DomString CL_DomDocumentType::get_internal_subset() const { if (impl) { const CL_DomDocument_Generic *doc = dynamic_cast<const CL_DomDocument_Generic *>(impl->owner_document.get()); if (doc) return doc->internal_subset; } return CL_DomString(); } ///////////////////////////////////////////////////////////////////////////// // CL_DomDocumentType operations: ///////////////////////////////////////////////////////////////////////////// // CL_DomDocumentType implementation:
[ "[email protected]@28a56cb3-1e7c-bc60-7718-65c159e1d2df" ]
[ [ [ 1, 129 ] ] ]
f83ac9e4b7d70264eb65a86085501629ba0e6a83
6e563096253fe45a51956dde69e96c73c5ed3c18
/dhplay/demo/MultiDisplay.cpp
4eaa07f10305dce9b9c71dbdb60cc539a7a8f7da
[]
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
UTF-8
C++
false
false
3,350
cpp
/* ** ************************************************************************ ** VEC ** Video Encoder Card ** ** (c) Copyright 1992-2006, ZheJiang Dahua Technology Stock Co.Ltd. ** All Rights Reserved ** ** File Name : MultiDisplay.cpp ** Modification : 2006/4/28 zhougf Create the file ** ************************************************************************ */ #include "stdafx.h" #include "player264demo.h" #include "MultiDisplay.h" #include "dhplay.h" #include "multilanguage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // MultiDisplay dialog int MultiDisplay::NUM = 1 ; MultiDisplay::MultiDisplay(CWnd* pParent /*=NULL*/) : CDialog(MultiDisplay::IDD, pParent) { //{{AFX_DATA_INIT(MultiDisplay) m_nBottom = 100; m_nLeft = 0; m_nRight = 100; m_nTop = 0; //}}AFX_DATA_INIT if (NUM >= 16) nRegionNum = -1; else nRegionNum = NUM; NUM++; } void MultiDisplay::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(MultiDisplay) DDX_Text(pDX, IDC_EDIT_BOTTOM, m_nBottom); DDX_Text(pDX, IDC_EDIT_LEFT, m_nLeft); DDX_Text(pDX, IDC_EDIT_RIGHT, m_nRight); DDX_Text(pDX, IDC_EDIT_TOP, m_nTop); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(MultiDisplay, CDialog) //{{AFX_MSG_MAP(MultiDisplay) ON_BN_CLICKED(IDC_BUTTON_DISPLAY, OnButtonDisplay) ON_BN_CLICKED(IDC_BUTTON_REFRESH, OnButtonRefresh) ON_WM_CLOSE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // MultiDisplay message handlers void MultiDisplay::OnButtonDisplay() { // TODO: Add your control notification handler code here if (UpdateData(true) == 0) return ; RECT m_rcRect; m_rcRect.left = m_nLeft ; m_rcRect.bottom = m_nBottom ; m_rcRect.right = m_nRight ; m_rcRect.top = m_nTop ; long width,height ; PLAY_GetPictureSize(0,&width,&height) ; if (m_nLeft < 0 || m_nLeft >= m_nRight || m_nRight >= width ||m_nTop < 0 || m_nTop >= m_nBottom || m_nBottom >= height) { AfxMessageBox(ConvertString("Input number error")) ; return ; } if (PLAY_SetDisplayRegion(0,nRegionNum,&m_rcRect,GetDlgItem(IDC_STATIC_PART_DISPLAY)->m_hWnd,TRUE)) { m_bIsplay = TRUE; //20090929 bug: when pause, button display has no effect PLAY_RefreshPlayEx(0,nRegionNum) ; } } void MultiDisplay::OnOK() { CDialog::OnOK(); } void MultiDisplay::OnButtonRefresh() { // TODO: Add your control notification handler code here PLAY_RefreshPlayEx(0,nRegionNum) ; } BOOL MultiDisplay::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_bIsplay = FALSE; SetWndStaticText(this) ; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void MultiDisplay::OnClose() { CDialog::OnClose(); PLAY_SetDisplayRegion(0,nRegionNum,NULL,NULL,FALSE); if (NUM > 1) { NUM-- ; } } void MultiDisplay::OnDestroy() { CDialog::OnDestroy(); OnClose(); }
[ "guoqiao@a83c37f4-16cc-5f24-7598-dca3a346d5dd" ]
[ [ [ 1, 142 ] ] ]
1a0a1861062a2c383cfc9b36f4e298a1e1c18a56
36bf908bb8423598bda91bd63c4bcbc02db67a9d
/WallPaper/include/WallPaperDrawSettingsAlphaDlg.h
ec50214cca57d447bc3b3ac8f7dbf7223b8eaf96
[]
no_license
code4bones/crawlpaper
edbae18a8b099814a1eed5453607a2d66142b496
f218be1947a9791b2438b438362bc66c0a505f99
refs/heads/master
2021-01-10T13:11:23.176481
2011-04-14T11:04:17
2011-04-14T11:04:17
44,686,513
0
1
null
null
null
null
WINDOWS-1252
C++
false
false
3,078
h
/* WallPaperDrawSettingsAlphaDlg.h Dialogo per la pagina relativa alle opzioni per le miniature. Luca Piergentili, 20/09/01 [email protected] WallPaper (alias crawlpaper) - the hardcore of Windows desktop http://www.crawlpaper.com/ copyright © 1998-2004 Luca Piergentili, all rights reserved crawlpaper is a registered name, all rights reserved This is a free software, released under the terms of the BSD license. Do not attempt to use it in any form which violates the license or you will be persecuted and charged for this. 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 "crawlpaper" 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _WALLPAPERDRAWSETTINGSALPHADLG_H #define _WALLPAPERDRAWSETTINGSALPHADLG_H #include "window.h" #include "win32api.h" #include "CWindowsVersion.h" #include "CToolTipCtrlEx.h" #include "WallPaperConfig.h" /* CWallPaperDrawSettingsAlphaDlg */ class CWallPaperDrawSettingsAlphaDlg : public CPropertyPage { DECLARE_DYNCREATE(CWallPaperDrawSettingsAlphaDlg) public: CWallPaperDrawSettingsAlphaDlg() {} ~CWallPaperDrawSettingsAlphaDlg() {} BOOL CreateEx (CWnd* pParent,UINT nID,CWallPaperConfig* pConfig); void DoDataExchange (CDataExchange* pDX); BOOL OnInitDialog (void); BOOL OnSetActive (void) {return(TRUE);} void OnVScroll (UINT nSBCode,UINT nPos,CScrollBar* pScrollBar); void OnCheckLayered (void); void OnEnChangeLayered (void); CToolTipCtrlEx m_Tooltip; CWallPaperConfig* m_pConfig; BOOL m_bLayered; int m_nLayered; CWindowsVersion m_winVer; OSVERSIONTYPE m_enumOsVer; DECLARE_MESSAGE_MAP() }; #endif // _WALLPAPERDRAWSETTINGSALPHADLG_H
[ [ [ 1, 80 ] ] ]
7879d17b10a47962bdf1f1c314f84adbb9a4daa5
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Graphic/Main/ResourceManager.cpp
043a13208d680cf0d19f97def46caa1429377bb2
[]
no_license
daleaddink/flagship3d
4835c223fe1b6429c12e325770c14679c42ae3c6
6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a
refs/heads/master
2021-01-15T16:29:12.196094
2009-11-01T10:18:11
2009-11-01T10:18:11
37,734,654
1
0
null
null
null
null
WINDOWS-1252
C++
false
false
1,983
cpp
#include <Common/Prerequisites.h> #include <Common/LogManager.h> #include "Resource.h" #include "ResourceManager.h" #include "Entity.h" #include "Renderer.h" namespace Flagship { ResourceManager * ResourceManager::m_pResourceManager = NULL; ResourceManager::ResourceManager() { m_pResourceMap.clear(); m_pCacheList.clear(); m_pCacheIterator = m_pCacheList.begin(); } ResourceManager::~ResourceManager() { } ResourceManager * ResourceManager::GetSingleton() { if ( m_pResourceManager == NULL ) { m_pResourceManager = new ResourceManager; } return m_pResourceManager; } Resource * ResourceManager::GetResource( Key& kKey ) { map<Key, Resource *>::iterator it = m_pResourceMap.find( kKey ); if ( it != m_pResourceMap.end() ) { return (*it).second; } return NULL; } void ResourceManager::AddResource( Resource * pResource ) { map<Key, Resource *>::iterator it = m_pResourceMap.find( pResource->GetKey() ); if ( it != m_pResourceMap.end() ) { char szLog[10240]; char szFile[256]; wcstombs( szFile, pResource->GetKey().GetName().c_str(), 256 ); sprintf( szLog, "ResourceManager::AddResource Key Duplicate! Resource:%s", szFile ); LogManager::GetSingleton()->WriteLog( szLog ); return; } m_pResourceMap[pResource->GetKey()] = pResource; } void ResourceManager::DelResource( Resource * pResource ) { m_pResourceMap.erase( pResource->GetKey() ); } void ResourceManager::Update() { if ( m_pCacheIterator != m_pCacheList.end() ) { if ( ( * m_pCacheIterator )->IsOutOfDate() ) { // ×ÊÔ´Òѳ¬Ê± if ( ( * m_pCacheIterator )->IsReady() ) { // ( * m_pCacheIterator )->UnCache(); } m_pCacheIterator = m_pCacheList.erase( m_pCacheIterator ); } else { m_pCacheIterator++; } } else { m_pCacheIterator = m_pCacheList.begin(); } } }
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 91 ] ] ]
5336907c5c5af315ad5fd79ecf22e717aff80ebe
521721c2e095daf757ad62a267b1c0f724561935
/StdAfx.h
b644b2e226f185c4d99eebd48986352ef09bf021
[]
no_license
MichaelSPG/boms
251922d78f2db85ece495e067bd56a1e9fae14b1
23a13010e0aaa79fea3b7cf1b23e2faab02fa5d4
refs/heads/master
2021-01-10T16:23:51.722062
2011-12-08T00:04:33
2011-12-08T00:04:33
48,052,727
1
0
null
null
null
null
UTF-8
C++
false
false
1,351
h
#pragma once //Std lib #include <string> #include <vector> #include <unordered_map> #include <memory> #include <sstream> #include <algorithm> #include <functional> #include <utility> #include <deque> //C std lib #include <stdlib.h> #include <Windows.h> //DirectX #include <d3d11.h> #include <D3DX11.h> #include <xnamath.h> //Havok #include <Common/Base/hkBase.h> #include <Common/Base/Container/Array/hkArray.h> #include <Common/Base/Math/hkMath.h> #include <Physics/Dynamics/hkpDynamics.h> #include <Physics/Collide/hkpCollide.h> #include <Physics/Collide/Agent/ConvexAgent/SphereBox/hkpSphereBoxAgent.h> #include <Physics/Collide/Shape/Convex/Box/hkpBoxShape.h> #include <Physics/Collide/Shape/Convex/Sphere/hkpSphereShape.h> #include <Physics/Collide/Query/CastUtil/hkpWorldRayCastInput.h> #include <Physics/Collide/Query/CastUtil/hkpWorldRayCastOutput.h> #include <Physics/Dynamics/World/hkpWorld.h> #include <Physics/Dynamics/Entity/hkpRigidBody.h> #include <Common/Base/Thread/Job/ThreadPool/Cpu/hkCpuJobThreadPool.h> #include <Common/Base/Thread/JobQueue/hkJobQueue.h> #include <Common/Visualize/hkVisualDebugger.h> #include <Physics/Utilities/VisualDebugger/hkpPhysicsContext.h> //FW1 #include <FW1FontWrapper.h> //OIS #include <OIS.h> //TBB #include <tbb/tbb_thread.h>
[ [ [ 1, 57 ] ] ]
8e72c0cd2142e476dd986b0cae44d1c94e2ddcad
31009164b9c086f008b6196b0af0124c1a451f04
/src/Test/TestRegisteredTake.cpp
0a6c77fcc432f5eb1d809d4938c9e630517ea026
[ "Apache-2.0" ]
permissive
duarten/slimthreading-windows
e8ca8c799e6506fc5c35c63b7e934037688fbcc2
a685d14ca172856f5a329a93aee4d00a4d0dd879
refs/heads/master
2021-01-16T18:58:45.758109
2011-04-19T10:16:38
2011-04-19T10:16:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,192
cpp
// Copyright 2011 Carlos Martins // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include "stdafx.h" // // The number of producer threads. // #define PRODUCERS 10 // // The bounded blocking queue. // static StBoundedBlockingQueue Queue(16); // // The alerter and the count down event used to synchronize shutdown. // static StAlerter Shutdown; static StCountDownEvent Done(PRODUCERS); // // The counters. // static ULONG Productions[PRODUCERS]; static ULONGLONG Consumptions; // // The producer thread. // static ULONG WINAPI ProducerThread ( __in PVOID arg ) { LONG Id = (LONG)arg; printf("+++ p #%d started...\n", Id); ULONG Timeout = 0; do { ULONG WaitStatus = Queue.Add((PVOID)0x12345678, 1); if (WaitStatus == WAIT_OBJECT_0) { Productions[Id]++; } else if (WaitStatus == WAIT_TIMEOUT) { Timeout++; } else if (WaitStatus == WAIT_DISPOSED) { break; } else if (WaitStatus == WAIT_ALERTED) { ; } else { assert(!"this could never happen!"); break; } SwitchToThread(); } while (!Shutdown.IsSet()); printf("+++ p #%d exits, after [%d/%d]\n", Id, Productions[Id], Timeout); Done.Signal(); return 0; } // // The take consumer callback // static VOID CALLBACK TakeCallback ( __in PVOID Ignored, __in PVOID DataItem, __in ULONG WaitStatus ) { if (WaitStatus == WAIT_SUCCESS) { if (DataItem != (PVOID)0x12345678) { printf("***wrong data item: %p\n", DataItem); } else { Consumptions++; } } else if (WaitStatus == WAIT_TIMEOUT) { printf("+++TIMEOUT\n"); } } VOID RunRegisteredTakeTest ( ) { SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST); // // Register... // StRegisteredTake RegTake; StBlockingQueue::RegisterTake(&Queue, &RegTake, TakeCallback, NULL, 250, FALSE); // // Create the threads. // for (int i = 0; i < PRODUCERS; i++) { HANDLE Producer = CreateThread(NULL, 0, ProducerThread, (PVOID)(i), 0, NULL); CloseHandle(Producer); } printf("+++ hit return to terminate the test...\n"); getchar(); Shutdown.Set(); Done.Wait(); ULONGLONG totalProds = 0; for (int i = 0; i < PRODUCERS; i++) { totalProds += Productions[i]; } printf("+++total: prods = %I64d, cons = %I64d\n", totalProds, Consumptions); getchar(); RegTake.Unregister(); }
[ [ [ 1, 140 ] ] ]
0fcdc699ac90dc2ca66a5d33f478b89e1bfcbc04
1736474d707f5c6c3622f1cd370ce31ac8217c12
/Pseudo/ValueType.hpp
ba4a6fd20e42d76b2577124c42e0755fcecaaa0f
[]
no_license
arlm/pseudo
6d7450696672b167dd1aceec6446b8ce137591c0
27153e50003faff31a3212452b1aec88831d8103
refs/heads/master
2022-11-05T23:38:08.214807
2011-02-18T23:18:36
2011-02-18T23:18:36
275,132,368
0
0
null
null
null
null
UTF-8
C++
false
false
667
hpp
// Copyright (c) John Lyon-Smith. All rights reserved. #pragma once #include <Pseudo\Compiler.hpp> typedef WCHAR Char; typedef bool Bool; typedef unsigned __int8 Byte; typedef __int8 SByte; typedef __int16 Short; typedef __int16 Int16; typedef unsigned __int16 UShort; typedef unsigned __int16 UInt16; typedef __int32 Int; typedef __int32 Int32; typedef unsigned __int32 UInt; typedef unsigned __int32 UInt32; typedef __int64 Long; typedef __int64 Int64; typedef unsigned __int64 ULong; typedef unsigned __int64 UInt64; typedef double Double; typedef float Single; typedef INT_PTR IntPtr; typedef UINT_PTR UIntPtr; const int null = 0;
[ [ [ 1, 28 ] ] ]
44c3a80ebcb9cfaaa9405572cf1eafa098a352bf
b5ad65ebe6a1148716115e1faab31b5f0de1b493
/src/pymuscle/core/ConvexHullCapi.cpp
9c72a3909bea915d42f5ac6a72b041eed9662ee3
[]
no_license
gasbank/aran
4360e3536185dcc0b364d8de84b34ae3a5f0855c
01908cd36612379ade220cc09783bc7366c80961
refs/heads/master
2021-05-01T01:16:19.815088
2011-03-01T05:21:38
2011-03-01T05:21:38
1,051,010
1
0
null
null
null
null
UTF-8
C++
false
false
13,127
cpp
#include "PymCorePch.h" #include <iostream> #include <vector> #include <ctime> #include <fstream> #include <algorithm> #include <string> #include <stdio.h> #include <stdlib.h> #include <vector> #include <assert.h> #include "ConvexHullCapi.h" std::ostream &operator <<(std::ostream &s, const std::pair<double,double> &point ) { s << "(" << point.first << "," << point.second << ")"; return s; } class GrahamScan { public : GrahamScan( size_t n, double xmin, double xmax, double ymin, double ymax ) : N( n ) , x_range( xmin, xmax ) , y_range( ymin, ymax ) { // // In this constructor I generate the N random points asked for // by the caller. Their values are randomly assigned in the x/y // ranges specified as arguments // srand( static_cast<unsigned int>( time(NULL) ) ); for ( size_t i = 0 ; i < N ; i++ ) { double x = (double)rand()/RAND_MAX * ( (int)x_range.second - (int)x_range.first + 1 ) + x_range.first; double y = (double)rand()/RAND_MAX * ( (int)y_range.second - (int)y_range.first + 1 ) + y_range.first; raw_points.push_back( std::make_pair( x, y ) ); } } explicit GrahamScan( size_t n ) : N( n ) , x_range( -1, 1) /* not used */ , y_range( -1, 1) /* not used */ , raw_points(n) { } void set_raw_point(int i, double x, double y) { raw_points[i].first = x; raw_points[i].second = y; } // // The initial array of points is stored in vectgor raw_points. I first // sort it, which gives me the far left and far right points of the hull. // These are special values, and they are stored off separately in the left // and right members. // // I then go through the list of raw_points, and one by one determine whether // each point is above or below the line formed by the right and left points. // If it is above, the point is moved into the upper_partition_points sequence. If it // is below, the point is moved into the lower_partition_points sequence. So the output // of this routine is the left and right points, and the sorted points that are in the // upper and lower partitions. // void partition_points() { // // Step one in partitioning the points is to sort the raw data // std::sort( raw_points.begin(), raw_points.end() ); // // The the far left and far right points, remove them from the // sorted sequence and store them in special members // left = raw_points.front(); raw_points.erase( raw_points.begin() ); right = raw_points.back(); raw_points.pop_back(); // // Now put the remaining points in one of the two output sequences // for ( size_t i = 0 ; i < raw_points.size() ; i++ ) { double dir = direction( left, right, raw_points[ i ] ); if ( dir < 0 ) upper_partition_points.push_back( raw_points[ i ] ); else lower_partition_points.push_back( raw_points[ i ] ); } } // // Building the hull consists of two procedures: building the lower and // then the upper hull. The two procedures are nearly identical - the main // difference between the two is the test for convexity. When building the upper // hull, our rull is that the middle point must always be *above* the line formed // by its two closest neighbors. When building the lower hull, the rule is that point // must be *below* its two closest neighbors. We pass this information to the // building routine as the last parameter, which is either -1 or 1. // void build_hull( std::ofstream &f ) { build_half_hull( f, lower_partition_points, lower_hull, 1 ); build_half_hull( f, upper_partition_points, upper_hull, -1 ); } // // This is the method that builds either the upper or the lower half convex // hull. It takes as its input a copy of the input array, which will be the // sorted list of points in one of the two halfs. It produces as output a list // of the points in the corresponding convex hull. // // The factor should be 1 for the lower hull, and -1 for the upper hull. // void build_half_hull( std::ostream &f, std::vector< std::pair<double,double> > input, std::vector< std::pair<double,double> > &output, int factor ) { // // The hull will always start with the left point, and end with the right // point. According, we start by adding the left point as the first point // in the output sequence, and make sure the right point is the last point // in the input sequence. // input.push_back( right ); output.push_back( left ); // // The construction loop runs until the input is exhausted // while ( input.size() != 0 ) { // // Repeatedly add the leftmost point to the null, then test to see // if a convexity violation has occured. If it has, fix things up // by removing the next-to-last point in the output suqeence until // convexity is restored. // output.push_back( input.front() ); plot_hull( f, "adding a new point" ); input.erase( input.begin() ); while ( output.size() >= 3 ) { size_t end = output.size() - 1; if ( factor * direction( output[ end - 2 ], output[ end ], output[ end - 1 ] ) <= 0 ) { output.erase( output.begin() + end - 1 ); plot_hull( f, "backtracking" ); } else break; } } } // // In this program we frequently want to look at three consecutive // points, p0, p1, and p2, and determine whether p2 has taken a turn // to the left or a turn to the right. // // We can do this by by translating the points so that p1 is at the origin, // then taking the cross product of p0 and p2. The result will be positive, // negative, or 0, meaning respectively that p2 has turned right, left, or // is on a straight line. // static double direction( std::pair<double,double> p0, std::pair<double,double> p1, std::pair<double,double> p2 ) { return ( (p0.first - p1.first ) * (p2.second - p1.second ) ) - ( (p2.first - p1.first ) * (p0.second - p1.second ) ); } void log_raw_points( std::ostream &f ) { f << "Creating raw points:\n"; for ( size_t i = 0 ; i < N ; i++ ) f << raw_points[ i ] << " "; f << "\n"; } void log_partitioned_points( std::ostream &f ) { f << "Partitioned set:\n" << "Left : " << left << "\n" << "Right : " << right << "\n" << "Lower partition: "; for ( size_t i = 0 ; i < lower_partition_points.size() ; i++ ) f << lower_partition_points[ i ]; f << "\n"; f << "Upper partition: "; for ( size_t i = 0 ; i < upper_partition_points.size() ; i++ ) f << upper_partition_points[ i ]; f << "\n"; } void log_hull( std::ostream & f ) { f << "Lower hull: "; for ( size_t i = 0 ; i < lower_hull.size() ; i++ ) f << lower_hull[ i ]; f << "\n"; f << "Upper hull: "; for ( size_t i = 0 ; i < upper_hull.size() ; i++ ) f << upper_hull[ i ]; f << "\n"; f << "Convex hull: "; for ( size_t i = 0 ; i < lower_hull.size() ; i++ ) f << lower_hull[ i ] << " "; for ( std::vector< std::pair<double,double> >::reverse_iterator ii = upper_hull.rbegin() + 1 ; ii != upper_hull.rend(); ii ++ ) f << *ii << " "; f << "\n"; } int get_num_hull_points() const { return lower_hull.size() + upper_hull.size() - 1; } void get_hull_points(std::vector<double> &x, std::vector<double> &y) const { int idx = 0; for ( size_t i = 0 ; i < lower_hull.size() ; i++ ) { x[idx] = lower_hull[i].first; y[idx] = lower_hull[i].second; ++idx; } for ( std::vector< std::pair<double,double> >::const_reverse_iterator ii = upper_hull.rbegin() + 1 ; ii != upper_hull.rend(); ii ++ ) { x[idx] = ii->first; y[idx] = ii->second; ++idx; } assert(idx == get_num_hull_points()); } void plot_raw_points( std::ostream &f ) { f << "set xrange [" << x_range.first << ":" << x_range.second << "]\n"; f << "set yrange [" << y_range.first << ":" << y_range.second << "]\n"; f << "unset mouse\n"; f << "set title 'The set of raw points in the set' font 'Arial,12'\n"; f << "set style line 1 pointtype 7 linecolor rgb 'red'\n"; f << "set style line 2 pointtype 7 linecolor rgb 'green'\n"; f << "set style line 3 pointtype 7 linecolor rgb 'black'\n"; f << "plot '-' ls 1 with points notitle\n"; for ( size_t i = 0 ; i < N ; i++ ) f << raw_points[ i ].first << " " << raw_points[ i ].second << "\n"; f << "e\n"; f << "pause -1 'Hit OK to move to the next state'\n"; } void plot_partitioned_points( std::ostream &f ) { f << "set title 'The points partitioned into an upper and lower hull' font 'Arial,12'\n"; f << "plot '-' ls 1 with points notitle, " << "'-' ls 2 with points notitle, " << "'-' ls 3 with linespoints notitle\n"; for ( size_t i = 0 ; i < lower_partition_points.size() ; i++ ) f << lower_partition_points[ i ].first << " " << lower_partition_points[ i ].second << "\n"; f << "e\n"; for ( size_t i = 0 ; i < upper_partition_points.size() ; i++ ) f << upper_partition_points[ i ].first << " " << upper_partition_points[ i ].second << "\n"; f << "e\n"; f << left.first << " " << left.second << "\n"; f << right.first << " " << right.second << "\n"; f << "e\n"; f << "pause -1 'Hit OK to move to the next state'\n"; } void plot_hull( std::ostream &f, std::string text ) { return; f << "set title 'The hull in state: " << text << "' font 'Arial,12'\n"; f << "plot '-' ls 1 with points notitle, "; if ( lower_hull.size() ) f << "'-' ls 3 with linespoints notitle, "; if ( upper_hull.size() ) f << "'-' ls 3 with linespoints notitle, "; f << "'-' ls 2 with points notitle\n"; for ( size_t i = 0 ; i < lower_partition_points.size() ; i++ ) f << lower_partition_points[ i ].first << " " << lower_partition_points[ i ].second << "\n"; f << right.first << " " << right.second << "\n"; f << "e\n"; if ( lower_hull.size() ) { for ( size_t i = 0 ; i < lower_hull.size() ; i++ ) f << lower_hull[ i ].first << " " << lower_hull[ i ].second << "\n"; f << "e\n"; } if ( upper_hull.size() ) { for ( std::vector< std::pair<double,double> >::reverse_iterator ii = upper_hull.rbegin(); ii != upper_hull.rend(); ii++ ) f << ii->first << " " << ii->second << "\n"; f << "e\n"; } for ( size_t i = 0 ; i < upper_partition_points.size() ; i++ ) f << upper_partition_points[ i ].first << " " << upper_partition_points[ i ].second << "\n"; f << "e\n"; f << "pause -1 'Hit OK to move to the next state'\n"; } private : // // These values determine the range of numbers generated to // provide the input data. The values are all passed in as part // of the constructor // const size_t N; const std::pair<double,double> x_range; const std::pair<double,double> y_range; // The raw data points generated by the constructor std::vector< std::pair<double,double> > raw_points; // // These values are used to represent the partitioned set. A special // leftmost and rightmost value, and the sorted set of upper and lower // partitioned points that lie inside those two points. // std::pair<double,double> left; std::pair<double,double> right; std::vector< std::pair<double,double> > upper_partition_points; std::vector< std::pair<double,double> > lower_partition_points; // // After the convex hull is created, the lower hull and upper hull // are stored in these sorted sequences. There is a bit of duplication // between the two, because both sets include the leftmost and rightmost point. // std::vector< std::pair<double,double> > lower_hull; std::vector< std::pair<double,double> > upper_hull; }; int PymConvexHull(Point_C *P, int n, Point_C *H) { assert(n < 1000); if (n < 3) return 0; std::ofstream null_file( "nul" ); GrahamScan g(n); for (int i = 0; i < n; ++i) { g.set_raw_point(i, P[i].x, P[i].y); } g.partition_points(); g.build_hull(null_file); g.log_hull(null_file); int nhull = g.get_num_hull_points(); std::vector<double> out_x(nhull), out_y(nhull); g.get_hull_points(out_x, out_y); for (int i = 0; i < nhull; ++i) { H[i].x = out_x[i]; H[i].y = out_y[i]; } return nhull; }
[ [ [ 1, 376 ] ] ]
03e83bc1734342e2d627aa078b4b047eedf3cc81
073dfce42b384c9438734daa8ee2b575ff100cc9
/RCF/include/RCF/util/Platform/Machine/ppc/ByteOrder.hpp
c5b00dbcbcf053d353236a2865769779395e92c1
[]
no_license
r0ssar00/iTunesSpeechBridge
a489426bbe30ac9bf9c7ca09a0b1acd624c1d9bf
71a27a52e66f90ade339b2b8a7572b53577e2aaf
refs/heads/master
2020-12-24T17:45:17.838301
2009-08-24T22:04:48
2009-08-24T22:04:48
285,393
1
0
null
null
null
null
UTF-8
C++
false
false
759
hpp
//****************************************************************************** // RCF - Remote Call Framework // Copyright (c) 2005 - 2009, Jarl Lindrud. All rights reserved. // Consult your license for conditions of use. // Version: 1.1 // Contact: jarl.lindrud <at> gmail.com //****************************************************************************** #ifndef INCLUDE_UTIL_PLATFORM_MACHINE_PPC_BYTEORDER_HPP #define INCLUDE_UTIL_PLATFORM_MACHINE_PPC_BYTEORDER_HPP namespace Platform { namespace Machine { class BigEndian {}; class LittleEndian {}; typedef BigEndian ByteOrder; } // namespace Machine } // namespace Platform #endif // ! INCLUDE_UTIL_PLATFORM_MACHINE_PPC_BYTEORDER_HPP
[ [ [ 1, 25 ] ] ]
9315533a7a1f7f7d89ea52c22b76718e0f4a6f6f
8ddac2310fb59dfbfb9b19963e3e2f54e063c1a8
/Logiciel_PC/WishBoneMonitor/wbgraphview.h
bd015bb8773eff20ba4dc26be24bf872e3ce974a
[]
no_license
Julien1138/WishBoneMonitor
75efb53585acf4fd63e75fb1ea967004e6caa870
3062132ecd32cd0ffdd89e8a56711ae9a93a3c48
refs/heads/master
2021-01-12T08:25:34.115470
2011-05-02T16:35:54
2011-05-02T16:35:54
76,573,671
0
0
null
null
null
null
UTF-8
C++
false
false
764
h
#ifndef WBGRAPHVIEW_H #define WBGRAPHVIEW_H #include "WishBoneWidgetView.h" #include "WBGraphDoc.h" #include "WBGraphDlg.h" #include <QList> #include <qwt_plot.h> #include <qwt_plot_curve.h> #include <QColor> #include <QTimer> class WBGraphView : public WishBoneWidgetView { Q_OBJECT public: explicit WBGraphView(WBGraphDoc* pDoc, WBGraphDlg* pDlg, QWidget *parent = 0); ~WBGraphView(); signals: public slots: void ModeChanged(); void Refresh(); void UpdateCurve(int Idx); private: QwtPlot* m_pPlot; QList<QwtPlotCurve*> m_CurveList; QTimer* m_Timer; void UpdateWidget(); }; QColor CurveColor(int Idx); #endif // WBGRAPHVIEW_H
[ [ [ 1, 39 ] ] ]
bb4127aab7f52ee30859a03c8c0da323a2481fa5
b03c23324d8f048840ecf50875b05835dedc8566
/engin3d/src/Character/Character.h
ad369f6ac3f4c9a94a9f16a23d3da8c5e32eeaf1
[]
no_license
carlixyz/engin3d
901dc61adda54e6098a3ac6637029efd28dd768e
f0b671b1e75a02eb58a2c200268e539154cd2349
refs/heads/master
2018-01-08T16:49:50.439617
2011-06-16T00:13:26
2011-06-16T00:13:26
36,534,616
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
1,938
h
#ifndef CCHARACTER_H #define CCHARACTER_H #include "../Libraries/MathLib/MathLib.h" #include "Behaviour/BehaviourManager.h" class cCharacter { private: int miId; cVec3 mPosition; cVec3 mColour; float mfYaw; float mfSpeed; float mfAngSpeed; cBehaviourBase* mpActiveBehaviour; public: // initialize vars void Init( int liId ); // empty definition void Deinit(); // empty definition void Update(float lfTimeStep); // Renders a point showing character´s position // and a little line starting from such point that // shows the character´s orientation void Render(); //Getters inline const int &GetId() const { return miId; } inline const cVec3 &GetPosition() const { return mPosition; } inline const float GetYaw() const { return mfYaw; } inline const float GetSpeed() const { return mfSpeed; } inline const float GetAngSpeed() const { return mfAngSpeed; } // Return front Vector of Character inline cVec3 GetFront() const { return cVec3( sinf(mfYaw), 0.0f, cosf(mfYaw) ) ;} // Return Left vector of character inline cVec3 GetLeft() const { return cVec3( sinf(mfYaw + HALF_PI), 0.0f, cosf(mfYaw + HALF_PI) ) ;} // Return Right vector of character inline cVec3 GetRight() const { return -GetLeft(); } inline cBehaviourBase* GetActiveBehaviour() { return mpActiveBehaviour; }// Get a pointer of the current Behaviour // Setters void SetPosition( const cVec3 &lPosition ); void SetColour( const cVec3 &lColour ); void SetYaw( float lfYaw ); void SetSpeed( float lfSpeed ); void SetAngSpeed( float lfAngSpeed ); void SetActiveBehaviour( cBehaviourBase * lpBehaviour ); // Set current behaviour void SetActiveBehaviour( cBehaviourBase * lpBehaviour, float posX, float posY, float posZ ); // Same but with Target }; #endif /* CCHARACTER_H */
[ "[email protected]", "manolopm@8d52fbf8-9d52-835b-178e-190adb01ab0c" ]
[ [ [ 1, 12 ], [ 14, 54 ], [ 56, 64 ] ], [ [ 13, 13 ], [ 55, 55 ] ] ]
040f3162015a17460e3a8d15d61354ba6df4b2bc
9e4a5ffa0cdd3556730f82ffc4fe73c0d360ec8a
/SubdivController.h
217246475c3b7f7a3cb56cfde3a396ba9e2f0d53
[]
no_license
ANorwell/Graphics
fde4e946ab2d6f3cd7ddc6daab1a847a49665475
bbe73045b1fc83c2704a1881a7dd336f94388722
refs/heads/master
2021-01-19T13:53:07.549762
2010-09-06T04:49:02
2010-09-06T04:49:02
890,587
3
0
null
null
null
null
UTF-8
C++
false
false
467
h
#pragma once #include "Controller.h" #include "SubdivScene.h" class SubdivController : public Controller { public: SubdivController(SubdivScene* aScene, ShaderLoader* aShader) : pScene(aScene), pShader(aShader) {}; void handleKey(unsigned char key); void handleSpecialKey(int key); void handleMouse(int key, int state, bool newState, int x, int y); private: SubdivScene* pScene; ShaderLoader* pShader; };
[ [ [ 1, 17 ] ] ]
f3214360db3986c1cb31bb6a8fa9bed0497f51be
b4d726a0321649f907923cc57323942a1e45915b
/CODE/NETWORK/multi_rate.cpp
0966e61180d254d405ecd15cff3ea3ee0eb1b184
[]
no_license
chief1983/Imperial-Alliance
f1aa664d91f32c9e244867aaac43fffdf42199dc
6db0102a8897deac845a8bd2a7aa2e1b25086448
refs/heads/master
2016-09-06T02:40:39.069630
2010-10-06T22:06:24
2010-10-06T22:06:24
967,775
2
0
null
null
null
null
UTF-8
C++
false
false
6,645
cpp
/* * Copyright (C) Volition, Inc. 1999. All rights reserved. * * All source code herein is the property of Volition, Inc. You may not sell * or otherwise commercially exploit the source or things you created based on the * source. * */ /* * $Logfile: /Freespace2/code/Network/multi_rate.cpp $ * $Revision: 1.1.1.1 $ * $Date: 2004/08/13 22:47:42 $ * $Author: Spearhawk $ * * $Log: multi_rate.cpp,v $ * Revision 1.1.1.1 2004/08/13 22:47:42 Spearhawk * no message * * Revision 1.1.1.1 2004/08/13 21:23:35 Darkhill * no message * * Revision 2.3 2004/04/03 06:22:32 Goober5000 * fixed some stub functions and a bunch of compile warnings * --Goober5000 * * Revision 2.2 2004/03/05 09:02:02 Goober5000 * Uber pass at reducing #includes * --Goober5000 * * Revision 2.1 2002/08/01 01:41:08 penguin * The big include file move * * Revision 2.0 2002/06/03 04:02:26 penguin * Warpcore CVS sync * * Revision 1.1 2002/05/02 18:03:11 mharris * Initial checkin - converted filenames and includes to lower case * * * 6 7/15/99 9:20a Andsager * FS2_DEMO initial checkin * * 5 4/25/99 3:02p Dave * Build defines for the E3 build. * * 4 4/09/99 2:21p Dave * Multiplayer beta stuff. CD checking. * * 3 3/20/99 5:09p Dave * Fixed release build fred warnings and unhandled exception. * * 2 3/09/99 6:24p Dave * More work on object update revamping. Identified several sources of * unnecessary bandwidth. * * * $NoKeywords: $ */ // ----------------------------------------------------------------------------------------------------------------------- // MULTI RATE DEFINES/VARS // #include "network/multi_rate.h" #ifdef MULTI_RATE #include "io/timer.h" #include "globalincs/alphacolors.h" // how many records in the past we'll keep track of #define NUM_UPDATE_RECORDS 5 // rate monitoring info typedef struct mr_info { // type char type[MAX_RATE_TYPE_LEN+1]; // all time info int total_bytes; // total bytes alltime // per second info int stamp_second; // stamp for one second int bytes_second; // how many bytes we've sent in the last second int records_second[NUM_UPDATE_RECORDS]; // records int records_second_count; // how many records we have float avg_second; // avg bytes/sec // per frame info int bytes_frame; // how many bytes we've sent this frame int records_frame[NUM_UPDATE_RECORDS]; // records int records_frame_count; // how many records we have float avg_frame; // avg bytes/frame } mr_info; // all records mr_info Multi_rate[MAX_RATE_PLAYERS][MAX_RATE_TYPES]; // ----------------------------------------------------------------------------------------------------------------------- // MULTI RATE FUNCTIONS // // notify of a player join void multi_rate_reset(int np_index) { int idx; // sanity checks if((np_index < 0) || (np_index >= MAX_RATE_PLAYERS)){ return; } // blast the index clear for(idx=0; idx<MAX_RATE_TYPES; idx++){ memset(&Multi_rate[np_index][idx], 0, sizeof(mr_info)); Multi_rate[np_index][idx].stamp_second = -1; } } // add data of the specified type to datarate processing, returns 0 on fail (if we ran out of types, etc, etc) int multi_rate_add(int np_index, char *type, int size) { int idx; mr_info *m; // sanity checks if((np_index < 0) || (np_index >= MAX_RATE_PLAYERS)){ return 0; } if((type == NULL) || (strlen(type) <= 0)){ return 0; } // see if the type already exists for(idx=0; idx<MAX_RATE_TYPES; idx++){ // empty slot if(strlen(Multi_rate[np_index][idx].type) <= 0){ break; } // existing else if(!stricmp(Multi_rate[np_index][idx].type, type)){ break; } } // if we couldn't find a slot if(idx >= MAX_RATE_TYPES){ return 0; } // otherwise add the data m = &Multi_rate[np_index][idx]; // type string strcpy(m->type, type); // alltime m->total_bytes += size; // per-second m->bytes_second += size; // per-frame m->bytes_frame += size; // success return 1; } // process #define R_AVG(ct, ar, avg) do {int av_idx; float av_sum = 0.0f; if(ct == 0){ avg = 0;} else { for(av_idx=0; av_idx<ct; av_idx++){ av_sum += (float)ar[av_idx]; } avg = av_sum / (float)ct; } }while(0) void multi_rate_process() { int idx, s_idx; mr_info *m; // process all active players for(idx=0; idx<MAX_RATE_PLAYERS; idx++){ for(s_idx=0; s_idx<MAX_RATE_TYPES; s_idx++){ m = &Multi_rate[idx][s_idx]; // invalid entries if(strlen(m->type) <= 0){ continue; } // process alltime if(m->stamp_second == -1){ m->stamp_second = timestamp(1000); } else if(timestamp_elapsed(m->stamp_second)){ // if we've reached max records if(m->records_second_count >= NUM_UPDATE_RECORDS){ memmove(m->records_second, m->records_second+1, sizeof(int) * (NUM_UPDATE_RECORDS - 1)); m->records_second[NUM_UPDATE_RECORDS-1] = m->bytes_second; } // haven't reached max records else { m->records_second[m->records_second_count++] = m->bytes_second; } // recalculate the average R_AVG(m->records_second_count, m->records_second, m->avg_second); // reset bytes/second and timestamp m->bytes_second = 0; m->stamp_second = timestamp(1000); } // process per-frame // if we've reached max records if(m->records_frame_count >= NUM_UPDATE_RECORDS){ memmove(m->records_frame, m->records_frame+1, sizeof(int) * (NUM_UPDATE_RECORDS - 1)); m->records_frame[NUM_UPDATE_RECORDS-1] = m->bytes_frame; } // haven't reached max records else { m->records_frame[m->records_frame_count++] = m->bytes_frame; } // recalculate the average R_AVG(m->records_frame_count, m->records_frame, m->avg_frame); // reset bytes/frame m->bytes_frame = 0; } } } // display void multi_rate_display(int np_index, int x, int y) { int idx; mr_info *m; // sanity checks if((np_index < 0) || (np_index >= MAX_RATE_PLAYERS)){ return; } // get info for(idx=0; idx<MAX_RATE_TYPES; idx++){ m = &Multi_rate[np_index][idx]; // if we have a 0 length string, we're done if(strlen(m->type) <= 0){ break; } // display gr_set_color_fast(&Color_red); gr_printf(x, y, "%s %d (%d/s) (%f/f)", m->type, m->total_bytes, (int)m->avg_second, m->avg_frame); y += 10; } } #endif
[ [ [ 1, 258 ] ] ]
e963318a8b3600b9582a4fa9e37b019215fa74c8
5efbd0cc4133aabbf0fa25a55e81bd8efe9040fd
/test_sp_ext_base_class/SharedMutex_example.cpp
5af994b18f3b3ea356971a0be5bc5c55654c0f3d
[]
no_license
electri/spext
b4041dea8e1b3f7f92fa8dd01b038165836b74cb
352809d2fba8f5528cdff7195a3ecdcc08be7ba4
refs/heads/master
2016-09-02T05:56:10.173821
2011-07-18T14:35:58
2011-07-18T14:35:58
35,587,658
0
0
null
null
null
null
GB18030
C++
false
false
4,237
cpp
/** * SharedMutex_example.cpp * @Author Tu Yongce <yongce (at) 126 (dot) com> * @Created 2008-11-17 * @Modified 2008-11-17 * @Version 0.1 */ #include "stdafx.h" #include "SharedMutex_example.h" #include <process.h> #include <iostream> #include "sp_ext_shared_mutex.h" #include "sp_ext_thread.h" using namespace std; sp_ext::shared_mutex g_mutex; const int LOOP_NUM = 2000; volatile __int64 g_data = 0; CRITICAL_SECTION g_cs; unsigned WINAPI ReaderThread(void *pParam) { int id = (int)pParam; ::EnterCriticalSection(&g_cs); cout << "Reader [" << id << "] start" << endl; ::LeaveCriticalSection(&g_cs); __int64 max = 0; __int64 min = 0; for (int i = 0; i < LOOP_NUM; ++i) { { sp_ext::shared_mutex::auto_lock_share s_lock(g_mutex); __int64 data = g_data; if (data > max) max = data; if (data < min) min = data; } Sleep(1); } ::EnterCriticalSection(&g_cs); cout << "Reader [" << id << "] quit, max = " << max << ", min = " << min << endl; ::LeaveCriticalSection(&g_cs); return 0; } unsigned WINAPI WriterThread1(void *pParam) { int id = (int)pParam; ::EnterCriticalSection(&g_cs); cout << "Writer1 [" << id << "] start" << endl; ::LeaveCriticalSection(&g_cs); for (int i = 0; i < LOOP_NUM; ++i) { { sp_ext::shared_mutex::auto_lock e_lock(g_mutex); g_data = g_data + i; } Sleep(1); } ::EnterCriticalSection(&g_cs); cout << "Writer1 [" << id << "] quit" << endl; ::LeaveCriticalSection(&g_cs); return 0; } unsigned WINAPI WriterThread2(void *pParam) { int id = (int)pParam; ::EnterCriticalSection(&g_cs); cout << "Writer2 [" << id << "] start" << endl; ::LeaveCriticalSection(&g_cs); for (int i = 0; i < LOOP_NUM; ++i) { { sp_ext::shared_mutex::auto_lock e_lock(g_mutex); g_data = g_data - i; } Sleep(1); } ::EnterCriticalSection(&g_cs); cout << "Writer2 [" << id << "] quit" << endl; ::LeaveCriticalSection(&g_cs); return 0; } int test_share_mutex() { sp_ext::time_waiter waiter; ::InitializeCriticalSection(&g_cs); // 创建读写工作线程(创建时挂起工作线程) HANDLE readers[20]; for (int i = 0; i < _countof(readers); ++i) { readers[i] = (HANDLE)_beginthreadex(NULL, 0, ReaderThread, (void*)i, CREATE_SUSPENDED, NULL); } HANDLE writers1[5]; for (int i = 0; i < _countof(writers1); ++i) { writers1[i] = (HANDLE)_beginthreadex(NULL, 0, WriterThread1, (void*)i, CREATE_SUSPENDED, NULL); } HANDLE writers2[5]; for (int i = 0; i < _countof(writers2); ++i) { writers2[i] = (HANDLE)_beginthreadex(NULL, 0, WriterThread2, (void*)i, CREATE_SUSPENDED, NULL); } // 恢复工作线程 for (int i = 0; i < _countof(readers); ++i) { ResumeThread(readers[i]); } waiter.wait(20000); // 休眠五秒 for (int i = 0; i < _countof(writers1); ++i) { ResumeThread(writers1[i]); } waiter.wait(5000); // 休眠五秒 for (int i = 0; i < _countof(writers2); ++i) { ResumeThread(writers2[i]); } waiter.wait(5000); // 休眠五秒 // 等待工作线程结束 WaitForMultipleObjects(_countof(readers), readers, TRUE, INFINITE); WaitForMultipleObjects(_countof(writers1), writers1, TRUE, INFINITE); WaitForMultipleObjects(_countof(writers2), writers2, TRUE, INFINITE); // 释放内核对象句柄 for (int i = 0; i < _countof(readers); ++i) { CloseHandle(readers[i]); } for (int i = 0; i < _countof(writers1); ++i) { CloseHandle(writers1[i]); } for (int i = 0; i < _countof(writers2); ++i) { CloseHandle(writers2[i]); } ::DeleteCriticalSection(&g_cs); cout << ">> Expected data value is " << 0 << ", and the real value is " << g_data << endl; return 0; }
[ "[email protected]@01c74763-b75b-5a55-715c-6f18d641bb61" ]
[ [ [ 1, 162 ] ] ]
ec16a09f5227ef07813d1c2e501bc9f2ac09140b
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/_Network/Net/Include/sock.h
6bce240177fc32d60b5d9e8c41a204053258f0ff
[]
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
1,725
h
#ifndef __SOCK_H__ #define __SOCK_H__ #pragma once #include <dplay.h> #include <list> using namespace std; class CSock { public: enum { crcRead = 1, crcWrite = 2, }; protected: SOCKET m_hSocket; private: DPID m_dpid; DPID m_dpidpeer; public: // Constructions CSock(); virtual ~CSock(); // Operations SOCKET GetHandle( void ); void Clear( void ); void SetID( DPID dpid ); DPID GetID( void ); void SetPeerID( DPID dpid ); DPID GetPeerID( void ); virtual BOOL Create( u_short uPort = 0, int type = SOCK_STREAM ); virtual void Attach( SOCKET hSocket ); virtual void Detach( void ); virtual HRESULT GetHostAddr( LPVOID lpAddr, LPDWORD lpdwSize ); virtual HRESULT GetPeerAddr( DPID dpid, LPVOID lpAddr, LPDWORD lpdwSize ) = 0; virtual DWORD GetPeerAddr( DPID dpid ) { return 0; } virtual void Close( void ) = 0; virtual BOOL CloseConnection( SOCKET hSocket ) = 0; virtual BOOL Shutdown( SOCKET hSocket ) = 0; virtual void Send( char* lpData, DWORD dwDataSize, DPID dpidTo ) = 0; virtual CSock* Get( SOCKET hSocket ); #ifdef __PROTOCOL0910 virtual void SetProtocolId( DWORD dwProtocolId ) {} #endif // __PROTOCOL0910 #ifdef __INFO_SOCKLIB0516 virtual DWORD GetDebugInfo( SOCKET hSocket ) { return 0; } #endif // __INFO_SOCKLIB0516 }; inline SOCKET CSock::GetHandle( void ) { return m_hSocket; } inline CSock* CSock::Get( SOCKET hSocket ) { return( m_hSocket == hSocket ? this : NULL ); } inline void CSock::SetID( DPID dpid ) { m_dpid = dpid; } inline DPID CSock::GetID( void ) { return m_dpid; } inline void CSock::SetPeerID( DPID dpid ) { m_dpidpeer = dpid; } inline DPID CSock::GetPeerID( void ) { return m_dpidpeer; } #endif //__SOCK_H__
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 58 ] ] ]
a63480451f4825e5b7007f6c37a502066bbff759
028d6009f3beceba80316daa84b628496a210f8d
/uidesigner/com.nokia.sdt.referenceprojects.test/data2/settings_list_3_0/reference/src/Settings_list_3_0SettingItemList.cpp
c3a0265e5ccf34be3d7e2be3c3410ab7417f2a0c
[]
no_license
JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
fa50cafa69d3e317abf0db0f4e3e557150fd88b3
4420f338bc4e522c563f8899d81201857236a66a
refs/heads/master
2020-12-30T16:45:28.474973
2010-10-20T16:19:31
2010-10-20T16:19:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,740
cpp
// [[[ begin generated region: do not modify [Generated System Includes] #include <avkon.hrh> #include <avkon.rsg> #include <eikmenup.h> #include <aknappui.h> #include <eikcmobs.h> #include <barsread.h> #include <stringloader.h> #include <gdi.h> #include <eikedwin.h> #include <eikenv.h> #include <eikseced.h> #include <aknpopupfieldtext.h> #include <eikmfne.h> #include <eikappui.h> #include <aknviewappui.h> #include <settings_list_3_0.rsg> // ]]] end generated region [Generated System Includes] // [[[ begin generated region: do not modify [Generated User Includes] #include "Settings_list_3_0SettingItemList.h" #include "Settings_list_3_0SettingItemListSettings.h" #include "settings_list_3_0.hrh" #include "Settings_list_3_0SettingItemList.hrh" #include "Settings_list_3_0SettingItemListView.h" // ]]] end generated region [Generated User Includes] // [[[ begin generated region: do not modify [Generated Constants] // ]]] end generated region [Generated Constants] /** * Construct the CSettings_list_3_0SettingItemList instance * @param aCommandObserver command observer */ CSettings_list_3_0SettingItemList::CSettings_list_3_0SettingItemList( TSettings_list_3_0SettingItemListSettings& aSettings, MEikCommandObserver* aCommandObserver ) : iSettings( aSettings ), iCommandObserver( aCommandObserver ) { // [[[ begin generated region: do not modify [Generated Contents] // ]]] end generated region [Generated Contents] } /** * Destroy any instance variables */ CSettings_list_3_0SettingItemList::~CSettings_list_3_0SettingItemList() { // [[[ begin generated region: do not modify [Generated Contents] // ]]] end generated region [Generated Contents] } /** * Handle system notification that the container's size has changed. */ void CSettings_list_3_0SettingItemList::SizeChanged() { if ( ListBox() ) { ListBox()->SetRect( Rect() ); } } /** * Create one setting item at a time, identified by id. * CAknSettingItemList calls this method and takes ownership * of the returned value. The CAknSettingItem object owns * a reference to the underlying data, which EditItemL() uses * to edit and store the value. */ CAknSettingItem* CSettings_list_3_0SettingItemList::CreateSettingItemL( TInt aId ) { switch ( aId ) { // [[[ begin generated region: do not modify [Initializers] case ESettings_list_3_0SettingItemListViewEdit1: { CAknTextSettingItem* item = new ( ELeave ) CAknTextSettingItem( aId, iSettings.Edit1() ); return item; } case ESettings_list_3_0SettingItemListViewSecret1: { CAknPasswordSettingItem* item = new ( ELeave ) CAknPasswordSettingItem( aId, CAknPasswordSettingItem::EAlpha, iSettings.Secret1() ); return item; } case ESettings_list_3_0SettingItemListViewEnumeratedTextPopup1: { CAknEnumeratedTextPopupSettingItem* item = new ( ELeave ) CAknEnumeratedTextPopupSettingItem( aId, iSettings.EnumeratedTextPopup1() ); return item; } case ESettings_list_3_0SettingItemListViewTimeEditor1: { CAknTimeOrDateSettingItem* item = new ( ELeave ) CAknTimeOrDateSettingItem( aId, CAknTimeOrDateSettingItem::ETime, iSettings.TimeEditor1() ); return item; } // ]]] end generated region [Initializers] } return NULL; } /** * Edit the setting item identified by the given id and store * the changes into the store. * @param aIndex the index of the setting item in SettingItemArray() * @param aCalledFromMenu true: a menu item invoked editing, thus * always show the edit page and interactively edit the item; * false: change the item in place if possible, else show the edit page */ void CSettings_list_3_0SettingItemList::EditItemL ( TInt aIndex, TBool aCalledFromMenu ) { CAknSettingItem* item = ( *SettingItemArray() )[aIndex]; switch ( item->Identifier() ) { // [[[ begin generated region: do not modify [Editing Started Invoker] // ]]] end generated region [Editing Started Invoker] } CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); TBool storeValue = ETrue; switch ( item->Identifier() ) { // [[[ begin generated region: do not modify [Editing Stopped Invoker] // ]]] end generated region [Editing Stopped Invoker] } if ( storeValue ) { item->StoreL(); SaveSettingValuesL(); } } /** * Handle the "Change" option on the Options menu. This is an * alternative to the Selection key that forces the settings page * to come up rather than changing the value in place (if possible). */ void CSettings_list_3_0SettingItemList::ChangeSelectedItemL() { if ( ListBox()->CurrentItemIndex() >= 0 ) { EditItemL( ListBox()->CurrentItemIndex(), ETrue ); } } /** * Load the initial contents of the setting items. By default, * the setting items are populated with the default values from * the design. You can override those values here. * <p> * Note: this call alone does not update the UI. * LoadSettingsL() must be called afterwards. */ void CSettings_list_3_0SettingItemList::LoadSettingValuesL() { // load values into iSettings } /** * Save the contents of the setting items. Note, this is called * whenever an item is changed and stored to the model, so it * may be called multiple times or not at all. */ void CSettings_list_3_0SettingItemList::SaveSettingValuesL() { // store values from iSettings } /** * Handle global resource changes, such as scalable UI or skin events (override) */ void CSettings_list_3_0SettingItemList::HandleResourceChange( TInt aType ) { CAknSettingItemList::HandleResourceChange( aType ); SetRect( iAvkonViewAppUi->View( TUid::Uid( ESettings_list_3_0SettingItemListViewId ) )->ClientRect() ); // [[[ begin generated region: do not modify [Generated Contents] // ]]] end generated region [Generated Contents] } /** * Handle key event (override) * @param aKeyEvent key event * @param aType event code * @return EKeyWasConsumed if the event was handled, else EKeyWasNotConsumed */ TKeyResponse CSettings_list_3_0SettingItemList::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) { // [[[ begin generated region: do not modify [Generated Contents] // ]]] end generated region [Generated Contents] if ( aKeyEvent.iCode == EKeyLeftArrow || aKeyEvent.iCode == EKeyRightArrow ) { // allow the tab control to get the arrow keys return EKeyWasNotConsumed; } return CAknSettingItemList::OfferKeyEventL( aKeyEvent, aType ); }
[ [ [ 1, 223 ] ] ]
f83d9eff53f97c3069261f6fe91d35b82bb9fc8b
1a1549ff6795e00349dfc8683a55999e29743506
/src/graph.cpp
64ef0118f0146f02576e15e99b768e38781d1aaf
[]
no_license
ashokbabu/shortestpath
dcf0be4516ee48710d94169a32791fb7ab747ed4
145b30ef03c3089146d29d089c1bf6ad7b79d0e8
refs/heads/master
2021-01-19T14:34:19.796375
2011-08-12T15:19:25
2011-08-12T15:19:25
2,190,337
0
0
null
null
null
null
UTF-8
C++
false
false
1,457
cpp
#include <graph.h> #include <iostream> #include <iterator> Graph::Graph() { } Graph::~Graph() { } Graph* Graph::mInstance =NULL; Graph* Graph::get_Instance() { if(!mInstance) mInstance = new Graph(); return mInstance; } Vertex Graph::get_vertex(node_t node) { map<node_t,Vertex>::iterator itr = mGraphNodes.find(node); if( itr != mGraphNodes.end() ) { return itr->second; } Vertex v(0); return v; } void Graph::add_vertex(Vertex &v) { mGraphNodes[v.get_vertex_id()] = v; } void Graph :: remove_vertex(node_t node) { mGraphNodes.erase(node); } bool Graph:: is_vertex_present(node_t node) const { map<node_t,Vertex>::const_iterator itr = mGraphNodes.find(node); if(itr != mGraphNodes.end()) return true; return false; } unsigned int Graph::get_graph_size() { return mGraphNodes.size(); } map<node_t, Vertex> Graph::get_graph_nodes() { return mGraphNodes; } void Graph::print_graph(DIRECTION dir) const { map<node_t,Vertex>::const_iterator itr = mGraphNodes.begin(); cout<<"****************** "<<endl; cout<<" Graph Data Set "<<endl; cout<<"****************** "<<endl; for(; itr!= mGraphNodes.end() ; ++itr) { cout << (*itr).first<<" :"; (*itr).second.print_vertex_nodes(dir); } cout<<"****************** "<<endl; }
[ [ [ 1, 78 ] ] ]
475f972dea4b81d97288146098ba1218097caf86
fb534078556a0266e8e5b69e14bf0bda1a56d4bb
/BlockFactory.h
a122dd646986c7451c9a818ccc7ff59850f82c05
[]
no_license
jimhester/stonesense
9f6262aa4f4381aa6037e5061f6a3379a643d5f9
428244aab8208effedbc3a60eadf152dfbb8b4cf
refs/heads/master
2020-06-03T22:46:25.866990
2010-02-10T22:47:19
2010-02-10T22:47:19
537,355
1
2
null
null
null
null
UTF-8
C++
false
false
315
h
#pragma once #include "Block.h" class BlockFactory { uint32_t poolSize; vector<Block*> pool; public: BlockFactory(void); ~BlockFactory(void); Block* allocateBlock( ); void deleteBlock( Block* ); uint32_t getPoolSize(){ return poolSize; } }; extern BlockFactory blockFactory;
[ "jonask84@4d48de78-bd66-11de-9616-7b1d4728551e" ]
[ [ [ 1, 20 ] ] ]
a7a9aba0b168db2be86c82fe2f4e542891ef12b7
d01196cdfc4451c4e1c88343bdb1eb4db9c5ac18
/source/client/hud/hud_statusbar.cpp
d85d574ee6d810f9a198a22d039622c3b0c25b7b
[]
no_license
ferhan66h/Xash3D_ancient
7491cd4ff1c7d0b48300029db24d7e08ba96e88a
075e0a6dae12a0952065eb9b2954be4a8827c72f
refs/heads/master
2021-12-10T07:55:29.592432
2010-05-09T00:00:00
2016-07-30T17:37:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,959
cpp
/*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting * object code is restricted to non-commercial enhancements to products from * Valve LLC. All other use, distribution, or modification is prohibited * without written permission from Valve LLC. * ****/ // // statusbar.cpp // // generic text status bar, set by game dll // runs across bottom of screen // #include "extdll.h" #include "utils.h" #include "hud.h" DECLARE_MESSAGE( m_StatusBar, StatusText ); DECLARE_MESSAGE( m_StatusBar, StatusValue ); #define STATUSBAR_ID_LINE 1 int CHudStatusBar :: Init( void ) { gHUD.AddHudElem( this ); HOOK_MESSAGE( StatusText ); HOOK_MESSAGE( StatusValue ); Reset(); CVAR_REGISTER( "hud_centerid", "0", FCVAR_ARCHIVE, "disables center id" ); return 1; } int CHudStatusBar :: VidInit( void ) { // Load sprites here return 1; } void CHudStatusBar :: Reset( void ) { int i = 0; m_iFlags &= ~HUD_ACTIVE; // start out inactive for ( i = 0; i < MAX_STATUSBAR_LINES; i++ ) m_szStatusText[i][0] = 0; memset( m_iStatusValues, 0, sizeof m_iStatusValues ); m_iStatusValues[0] = 1; // 0 is the special index, which always returns true } void CHudStatusBar :: ParseStatusString( int line_num ) { // localise string first char szBuffer[MAX_STATUSTEXT_LENGTH]; memset( szBuffer, 0, sizeof szBuffer ); gHUD.m_TextMessage.LocaliseTextString( m_szStatusText[line_num], szBuffer, MAX_STATUSTEXT_LENGTH ); // parse m_szStatusText & m_iStatusValues into m_szStatusBar memset( m_szStatusBar[line_num], 0, MAX_STATUSTEXT_LENGTH ); char *src = szBuffer; char *dst = m_szStatusBar[line_num]; char *src_start = src, *dst_start = dst; while ( *src != 0 ) { while ( *src == '\n' ) src++; // skip over any newlines if ( ((src - src_start) >= MAX_STATUSTEXT_LENGTH) || ((dst - dst_start) >= MAX_STATUSTEXT_LENGTH) ) break; int index = atoi( src ); // should we draw this line? if ( (index >= 0 && index < MAX_STATUSBAR_VALUES) && (m_iStatusValues[index] != 0) ) { // parse this line and append result to the status bar while ( *src >= '0' && *src <= '9' ) src++; if ( *src == '\n' || *src == 0 ) continue; // no more left in this text line // copy the text, char by char, until we hit a % or a \n while ( *src != '\n' && *src != 0 ) { if ( *src != '%' ) { // just copy the character *dst = *src; dst++, src++; } else { // get the descriptor char valtype = *(++src); // move over % // if it's a %, draw a % sign if ( valtype == '%' ) { *dst = valtype; dst++, src++; continue; } // move over descriptor, then get and move over the index index = atoi( ++src ); while ( *src >= '0' && *src <= '9' ) src++; if ( index >= 0 && index < MAX_STATUSBAR_VALUES ) { int indexval = m_iStatusValues[index]; // get the string to substitute in place of the %XX char szRepString[MAX_PLAYER_NAME_LENGTH]; switch ( valtype ) { case 'p': // player name GetPlayerInfo( indexval, &gHUD.m_Scoreboard.m_PlayerInfoList[indexval] ); if ( gHUD.m_Scoreboard.m_PlayerInfoList[indexval].name != NULL ) { strncpy( szRepString, gHUD.m_Scoreboard.m_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH ); } else { strcpy( szRepString, "******" ); } break; case 'i': // number sprintf( szRepString, "%d", indexval ); break; default: szRepString[0] = 0; } for ( char *cp = szRepString; *cp != 0 && ((dst - dst_start) < MAX_STATUSTEXT_LENGTH); cp++, dst++ ) *dst = *cp; } } } } else { // skip to next line of text while ( *src != 0 && *src != '\n' ) src++; } } } int CHudStatusBar :: Draw( float fTime ) { if ( m_bReparseString ) { for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) ParseStatusString( i ); m_bReparseString = FALSE; } int Y_START = ScreenHeight - YRES(32 + 4); // Draw the status bar lines for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) { int TextHeight, TextWidth; GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight ); int Y_START = ScreenHeight - 45; int x = 4; int y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen // let user set status ID bar centering if ( (i == STATUSBAR_ID_LINE) && CVAR_GET_FLOAT( "hud_centerid" )) { x = max( 0, max( 2, (ScreenWidth - TextWidth)) / 2 ); y = (ScreenHeight / 2) + (TextHeight * CVAR_GET_FLOAT( "hud_centerid" )); } DrawConsoleString( x, y, m_szStatusBar[i] ); } return 1; } // Message handler for StatusText message // accepts two values: // byte: line number of status bar text // string: status bar text // this string describes how the status bar should be drawn // a semi-regular expression: // ( slotnum ([a..z] [%pX] [%iX])*)* // where slotnum is an index into the Value table (see below) // if slotnum is 0, the string is always drawn // if StatusValue[slotnum] != 0, the following string is drawn, upto the next newline - otherwise the text is skipped upto next newline // %pX, where X is an integer, will substitute a player name here, getting the player index from StatusValue[X] // %iX, where X is an integer, will substitute a number here, getting the number from StatusValue[X] int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pszName, iSize, pbuf ); int line = READ_BYTE(); if ( line < 0 || line >= MAX_STATUSBAR_LINES ) return 1; strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH ); m_szStatusText[line][MAX_STATUSTEXT_LENGTH-1] = 0; // ensure it's null terminated ( strncpy() won't null terminate if read string too long) if( m_szStatusText[0] == 0 ) m_iFlags &= ~HUD_ACTIVE; else m_iFlags |= HUD_ACTIVE; // we have status text, so turn on the status bar m_bReparseString = TRUE; END_READ(); return 1; } // Message handler for StatusText message // accepts two values: // byte: index into the status value array // short: value to store int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pszName, iSize, pbuf ); int index = READ_BYTE(); if( index < 1 || index >= MAX_STATUSBAR_VALUES ) return 1; // index out of range m_iStatusValues[index] = READ_SHORT(); m_bReparseString = TRUE; END_READ(); return 1; }
[ [ [ 1, 248 ] ] ]
331293a0405a92775d5da2a8ef7fd7cd04230292
4323418f83efdc8b9f8b8bb1cc15680ba66e1fa8
/Trunk/Battle Cars/Battle Cars/Source/CCamera.h
36899aba637f36aa7b602a4e0e51d9d73ef0bfb7
[]
no_license
FiveFourFive/battle-cars
5f2046e7afe5ac50eeeb9129b87fcb4b2893386c
1809cce27a975376b0b087a96835347069fe2d4c
refs/heads/master
2021-05-29T19:52:25.782568
2011-07-28T17:48:39
2011-07-28T17:48:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,731
h
#ifndef CAMERA_H_ #define CAMERA_H_ #include <Windows.h> class CBase; class CCamera { private: CBase* owner; float camPosX; float camPosY; float offX; float offY; float m_fRenderPosX; float m_fRenderPosY; int m_nWidth; int m_nHeight; public: CCamera(); ~CCamera(); float GetCamX(){ return camPosX;} // Get Camera's X Postition float GetCamY(){ return camPosY;} // Get Camera's Y Position void SetCamX( float posX ) { camPosX = posX; } void SetCamY( float posY ) { camPosY = posY; } void Update(void); void AttachTo( CBase* camera_owner) { owner = camera_owner;} ////////////////////////////////////////////////////////////////// // The offset is how many units to move the cameras intial position over. // ie: if you pass in 300 the camera's top left corner will move over 300 // units in which ever direction you specified. ////////////////////////////////////////////////////////////////// void AttachTo( CBase* camera_owner, float offsetX, float offsetY); ///////////////////////////////////////////////////////////////// // Sets the owner to null nothing special. ////////////////////////////////////////////////////////////////// void RemoveOwner() { owner = NULL;} float GetRenderPosX(){ return m_fRenderPosX; } float GetRenderPosY(){ return m_fRenderPosY; } int GetWidth(){ return m_nWidth;} int GetHeight() { return m_nHeight;} void SetRenderPosX(float xPos){ m_fRenderPosX = xPos; } void SetRenderPosY(float yPos){ m_fRenderPosY = yPos; } void SetWidth(int width){ m_nWidth = width;} void SetHeight(int height){ m_nHeight = height;} CBase* GetOwner() { return owner;} RECT GetRect(); }; #endif
[ "[email protected]@598269ab-7e8a-4bc4-b06e-4a1e7ae79330", "[email protected]@598269ab-7e8a-4bc4-b06e-4a1e7ae79330" ]
[ [ [ 1, 17 ], [ 24, 48 ], [ 60, 65 ] ], [ [ 18, 23 ], [ 49, 59 ] ] ]
94b580a772b97ee7590f45fdde4ce722f56cb4c2
67346d8d188dbf2a958520a7e80637481d15e676
/include/AlarmSystem.h
f859413431e690801e4bd9511ebfe309efffa670
[]
no_license
Alrin77/ndsgameengine
1a137621eb1b32849c179cd7f8c719c600b1a1f6
7afbb847273074ba0f7d3050322d7183c2b2c212
refs/heads/master
2016-09-03T07:30:11.105686
2010-12-04T22:05:16
2010-12-04T22:05:16
33,461,675
0
0
null
null
null
null
UTF-8
C++
false
false
1,902
h
#pragma once #include <string> #include <vector> #include "AlarmObject.h" //An alarm system class allows alarms to be registered and receive alarm events. Inherit this class //to make it an alarm system. Must overwrite the AlarmEvent function to receive the alarm events and //take the necessary actions class AlarmSystem{ friend AlarmObject; #pragma region public public: //Create an alarm in this alarm system void CreateAlarm(int timeLeft, std::string message){ CreateAlarm(new AlarmObject((double)timeLeft, message)); } //Create an alarm in this alarm system void CreateAlarm(float timeLeft, std::string message){ CreateAlarm(new AlarmObject((double)timeLeft, message)); } //Create an alarm in this alarm system void CreateAlarm(double timeLeft, std::string message){ CreateAlarm(new AlarmObject(timeLeft, message)); } //Create an alarm in this alarm system void CreateAlarm(AlarmObject* newAlarm){ newAlarm->SetAlarmSystem(this); _alarms->push_back(newAlarm); } //Update all of the currently active alarms virtual void Update(double timer){ for(std::vector<AlarmObject*>::iterator it = _alarms->begin(); it != _alarms->end();){ if((*it)->Update(timer)){ delete *it; it = _alarms->erase(it); }else it++; } } #pragma endregion #pragma region protected protected: //Constructor AlarmSystem(){ _alarms = new std::vector<AlarmObject*>(); } //Destructor virtual ~AlarmSystem(){ while(!_alarms->empty()){ delete _alarms->back(); _alarms->pop_back(); } delete _alarms; } //Called whenever an alarm timer expires and the alarms' message is passed in virtual void AlarmEvent(std::string message)=0; #pragma endregion #pragma region private private: //Contains all of the active alarms std::vector<AlarmObject*>* _alarms; #pragma endregion };
[ "[email protected]@21144042-5242-e64c-d35b-eb64d47aa59c" ]
[ [ [ 1, 78 ] ] ]
9bde7222dd57ef6bf9290a4c71781a515ebc2ac8
f69b9ae8d4c17d3bed264cefc5a82a0d64046b1c
/src/gui/ImageSelector.cxx
3549eef8bbc673d56baafeeeb9cfaf40055b1b33
[]
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
8,752
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 <gui/ImageSelector.h> #include <string.h> #include <sstream> #include <string> #include <FL/Fl_Box.H> #include <gui/common.h> using std::string; using std::vector; using PT::ImageKey; using PT::ImageLocation; using PT::ImageSeries; using PT::IntRange; using PT::ImageSeriesSet; class LocationData { public: ImageLocation location; std::string name; LocationData(const ImageLocation& loc) : location(loc) { std::stringstream nameStream; nameStream << "W " << location.well << " / P " << location.position << " / S " << location.slide; name = nameStream.str(); } bool operator!=(const LocationData& m) { return location != m.location; } }; ImageSelector::ImageSelector(int x, int y, int width, int height) : Fl_Group(x, y, width, height), imageSeriesSet_(NULL) { // create user interface { static const int COUNTER_WIDTH = 50; static const int INPUT_HEIGHT = 25; static const int LABEL_HEIGHT = 14; static const int SMALL_MARGIN = 5; locationChoice_ = new Fl_Choice( x, y + LABEL_HEIGHT, width - SMALL_MARGIN - COUNTER_WIDTH, INPUT_HEIGHT); locationChoice_->align(FL_ALIGN_LEFT | FL_ALIGN_TOP); locationChoice_->callback(fltk_member_cb<ImageSelector, &ImageSelector::handleSelection>, this); locationChoice_->label("Image Location"); timeCounter_ = new Fl_Counter( locationChoice_->x() + locationChoice_->w() + SMALL_MARGIN, locationChoice_->y(), COUNTER_WIDTH, INPUT_HEIGHT); timeCounter_->align(FL_ALIGN_CENTER | FL_ALIGN_TOP); timeCounter_->callback(fltk_member_cb<ImageSelector, &ImageSelector::handleSelection>, this); timeCounter_->label("Time"); timeCounter_->step(1); timeCounter_->type(FL_SIMPLE_COUNTER); timeCounter_->when(FL_WHEN_RELEASE); this->end(); } setImageSeriesSet(0); } void ImageSelector::setImageSeriesSet(const ImageSeriesSet *imageSeriesSet) { locationDatas_.clear(); imageSeriesSet_ = imageSeriesSet; if (imageSeriesSet != 0) { // fill locationDatas_ { ImageSeriesSet::ImageSeriesConstIterator it = imageSeriesSet->getImageSeriesStart(); ImageSeriesSet::ImageSeriesConstIterator end = imageSeriesSet->getImageSeriesEnd(); for (;it != end; ++it) { const ImageSeries& imageSeries = *it; LocationData locationData(imageSeries.location); locationDatas_.push_back(locationData); } } // create menu items { Fl_Menu_Item* menuItems = new Fl_Menu_Item[locationDatas_.size() + 1]; for (int i = 0; i < locationDatas_.size(); ++i) { LocationData* locationData = &locationDatas_[i]; Fl_Menu_Item* menuItem = &menuItems[i]; menuItem->text = locationData->name.c_str(); menuItem->shortcut_ = 0; menuItem->callback_ = 0; menuItem->user_data_ = locationData; menuItem->flags = FL_MENU_VALUE; menuItem->labeltype_ = FL_NORMAL_LABEL; menuItem->labelfont_ = FL_HELVETICA; menuItem->labelsize_ = 14; menuItem->labelcolor_ = FL_BLACK; } // add closing item menuItems[locationDatas_.size()].text = 0; locationChoice_->copy(menuItems); delete[] menuItems; // just copying the menu items does not cause a redraw locationChoice_->redraw(); } } locationChanged(); } void ImageSelector::setSelection(const ImageKey& key) { LocationData locationData(key.location); const Fl_Menu_Item* menuItem = locationChoice_->find_item(locationData.name.c_str()); assert(menuItem != 0); locationChoice_->value(menuItem); assert(key.time >= timeCounter_->minimum() && key.time <= timeCounter_->maximum()); timeCounter_->value(key.time); } ImageKey ImageSelector::getSelection() const { const Fl_Menu_Item* menuItem = locationChoice_->mvalue(); const LocationData* locationData = (LocationData*) menuItem->user_data_; return ImageKey(locationData->location, (short) timeCounter_->value()); } void ImageSelector::selectFirstImage() { if (this->imageSeriesSet_ == 0) return; ImageKey selection = getSelection(); const PT::ImageSeries& imageSeries = imageSeriesSet_->getImageSeries(selection.location); selection.time = imageSeries.timeRange.min; setSelection(selection); } void ImageSelector::selectNextImage() { if (this->imageSeriesSet_ == 0) return; ImageKey selection = getSelection(); const PT::ImageSeries& imageSeries = imageSeriesSet_->getImageSeries(selection.location); if (selection.time < imageSeries.timeRange.max) selection.time++; setSelection(selection); } void ImageSelector::selectPreviousImage() { if (this->imageSeriesSet_ == 0) return; ImageKey selection = getSelection(); const PT::ImageSeries& imageSeries = imageSeriesSet_->getImageSeries(selection.location); if (selection.time > imageSeries.timeRange.min) selection.time--; setSelection(selection); } void ImageSelector::selectLastImage() { if (this->imageSeriesSet_ == 0) return; ImageKey selection = getSelection(); const PT::ImageSeries& imageSeries = imageSeriesSet_->getImageSeries(selection.location); selection.time = imageSeries.timeRange.max; setSelection(selection); } void ImageSelector::handleSelection() { locationChanged(); if (imageSeriesSet_ != NULL) { ImageSelectorEvent event; event.id = ImageSelectorEvent::IMAGE_SELECTION; event.key = getSelection(); notifyEventHandler(event); } } void ImageSelector::locationChanged() { if (imageSeriesSet_ != NULL) { const Fl_Menu_Item* menuItem = locationChoice_->mvalue(); const LocationData* locationData = (LocationData*) menuItem->user_data_; const ImageSeries& imageSeries = imageSeriesSet_->getImageSeries(locationData->location); const ImageSeries::TimeRange& timeRange = imageSeries.timeRange; short time = (short) timeCounter_->value(); if (time < timeRange.min || time > timeRange.max) time = timeRange.min; timeCounter_->minimum(timeRange.min); timeCounter_->maximum(timeRange.max); timeCounter_->value(time); if (timeRange.min != timeRange.max) timeCounter_->activate(); else timeCounter_->deactivate(); } else { timeCounter_->deactivate(); timeCounter_->minimum(0); timeCounter_->maximum(0); timeCounter_->value(0); } }
[ "andre.homeyer@localhost" ]
[ [ [ 1, 266 ] ] ]
b49b10f5178dfaa0b4f31f4cbcfe9143434bc369
9d6d89a97c85abbfce7e2533d133816480ba8e11
/src/Engine/EventEngine/EventEngine.cpp
d680177fd0b990b1133ebf9f3f06703f9e6b0ed4
[]
no_license
polycraft/Bomberman-like-reseau
1963b79b9cf5d99f1846a7b60507977ba544c680
27361a47bd1aa4ffea972c85b3407c3c97fe6b8e
refs/heads/master
2020-05-16T22:36:22.182021
2011-06-09T07:37:01
2011-06-09T07:37:01
1,564,502
1
2
null
null
null
null
UTF-8
C++
false
false
1,551
cpp
#include <vector> #include "EventEngine.h" using namespace std; namespace Engine { EventEngine::EventEngine() { } EventEngine::~EventEngine() { //Todo libérer les listeners //delete listener; } bool EventEngine::update() { while ( SDL_PollEvent(&(event.event) )) { if(event.event.type==SDL_QUIT) { return false; } switch(event.event.type) { case SDL_KEYDOWN: event.keyState[event.event.key.keysym.sym]=true; break; case SDL_KEYUP: event.keyState[event.event.key.keysym.sym]=false; break; } } callListener(); return true; } void EventEngine::callListener() { vector<IEventListener*>::iterator it; for ( it=listener.begin() ; it < listener.end(); it++ ) { (*it)->executeAction(event); } } void EventEngine::addListener(IEventListener *listener) { this->listener.push_back(listener); } void EventEngine::removeListener(IEventListener *listener) { vector<IEventListener*>::iterator it; for ( it=this->listener.begin() ; it < this->listener.end(); it++ ) { if(listener==*it) { this->listener.erase(it); return; } } } }
[ [ [ 1, 4 ], [ 6, 7 ], [ 15, 15 ], [ 17, 19 ], [ 27, 35 ], [ 37, 37 ], [ 41, 55 ], [ 71, 71 ] ], [ [ 5, 5 ], [ 8, 14 ], [ 16, 16 ], [ 20, 26 ], [ 36, 36 ], [ 38, 40 ], [ 56, 70 ] ] ]
7d267250a045171ebe42d875fc9b9572d70e43c6
c1a2953285f2a6ac7d903059b7ea6480a7e2228e
/deitel/ch06/Fig06_23/fig06_23.cpp
883fe31e60468c70b32bcb5fee20c5bb0e964352
[]
no_license
tecmilenio/computacion2
728ac47299c1a4066b6140cebc9668bf1121053a
a1387e0f7f11c767574fcba608d94e5d61b7f36c
refs/heads/master
2016-09-06T19:17:29.842053
2008-09-28T04:27:56
2008-09-28T04:27:56
50,540
4
3
null
null
null
null
UTF-8
C++
false
false
1,582
cpp
// Fig. 6.23: fig06_23.cpp // Using the unary scope resolution operator. #include <iostream> using std::cout; using std::endl; int number = 7; // global variable named number int main() { double number = 10.5; // local variable named number // display values of local and global variables cout << "Local double value of number = " << number << "\nGlobal int value of number = " << ::number << endl; return 0; // indicates successful termination } // end main /************************************************************************** * (C) Copyright 1992-2008 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * **************************************************************************/
[ [ [ 1, 34 ] ] ]
d3a6fb00e193f79d048fcfb3e3392d78601636ff
08d0c8fae169c869d3c24c7cdfb4cbcde4976658
/IoController.cpp
8c12b8a3f9b6059dd5cbc1b6e6b0430ff405fb28
[]
no_license
anelson/asynciotest
6b24615b69007cb4fa4b1a5e31dd933b638838ff
e79cea40e1595468401488accc27229a4aedd899
refs/heads/master
2016-09-09T19:35:15.153615
2010-11-07T18:40:56
2010-11-07T18:40:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,237
cpp
#include "StdAfx.h" #include "IoController.h" IoController::IoController(Settings& settings) : m_settings(settings) { m_totalBytesWritten = 0; m_totalBytesRead = 0; m_outstandingReads = 0; m_outstandingWrites = 0; } IoController::~IoController(void) { } DWORD IoController::GetNextCompletedOp(AsyncIo*& pio) { DWORD dwBytesTransferred; ULONG_PTR lpCompletionKey; DWORD dwResult = m_iocp.GetQueuedCompletionStatus(&dwBytesTransferred, &lpCompletionKey, reinterpret_cast<LPOVERLAPPED*>(&pio)); if (dwResult == 0) { pio->OnIoComplete(dwBytesTransferred, lpCompletionKey); } return dwResult; } bool IoController::SetSocketBufSizes(SOCKET sock) { int buf = m_settings.getTcpBufSize(); if (::setsockopt(sock, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&buf), sizeof(buf))) { Logger::ErrorWin32(::GetLastError(), _T("Failed to set socket send buffer to %d"), buf); return false; } if (::setsockopt(sock, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<char*>(&buf), sizeof(buf))) { Logger::ErrorWin32(::GetLastError(), _T("Failed to set socket receive buffer to %d"), buf); return false; } return true; }
[ [ [ 1, 57 ] ] ]
0ccaaae0359a12def3e4ead77d28bd187a5053ad
22aae602c91dfb79a865cb9e87b162b58caf5cb8
/modules/applicationmanager/applicationmanager.cpp
3fbb9ea25c411ee7ea1ac5660c686a39bd283aec
[]
no_license
gauravssnl/uikludges
dd026152c63d6b8593787e46cf531dc02d830eef
4338aa88ef02e1bf236d617a030a66e11e0cea43
refs/heads/master
2021-01-10T11:12:45.826674
2008-10-11T11:57:51
2008-10-11T11:57:51
47,822,573
0
0
null
null
null
null
UTF-8
C++
false
false
7,463
cpp
#include <e32std.h> #include <e32base.h> #include <apgtask.h> #include <apgcli.h> #include <eikenv.h> #include <apgwgnam.h> #include <f32file.h> #include "Python.h" #include "unicodeobject.h" #include "symbian_python_ext_util.h" enum TTaskOperations { ETaskForeground, ETaskBackground, ETaskKill, ETaskEnd, }; void GetRunningApplicationTitlesL(CDesCArray& aArray, TBool aIncludeHidden) { // this code is somewhat borrowed from Switcher application RWsSession ws(CEikonEnv::Static()->WsSession()); RApaLsSession rs; CApaWindowGroupName* wgName; TApaAppInfo ai; User::LeaveIfError(rs.Connect()); CleanupClosePushL(rs); CArrayFixFlat<TInt>* wgl = new (ELeave) CArrayFixFlat<TInt>(5); CleanupStack::PushL(wgl); User::LeaveIfError(ws.WindowGroupList(wgl)); wgName = CApaWindowGroupName::NewLC(ws); for(TInt i = 0; i < wgl->Count(); i++) { wgName->ConstructFromWgIdL(wgl->At(i)); if(!aIncludeHidden && wgName->Hidden()) { continue; } TPtrC caption; caption.Set(wgName->Caption()); if(!caption.Length()) { continue; } aArray.AppendL(caption); } CleanupStack::PopAndDestroy(wgName); CleanupStack::PopAndDestroy(wgl); CleanupStack::PopAndDestroy(); // rs } static PyObject* _perform_task_operation(TTaskOperations aTask, PyObject *args) { char* b = NULL; TInt l = 0; if (!PyArg_ParseTuple(args, "u#", &b, &l)) { return 0; } TPtrC caption((TUint16*)b, l); TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task(taskList.FindApp(caption)); if (!task.Exists()) { Py_INCREF(Py_False); return Py_False; } switch (aTask) { case ETaskForeground: task.BringToForeground(); break; case ETaskBackground: task.SendToBackground(); break; case ETaskKill: task.EndTask(); break; case ETaskEnd: task.KillTask(); break; } Py_INCREF(Py_True); return Py_True; } static PyObject* switch_to_fg(PyObject* /*self*/, PyObject *args) { return _perform_task_operation(ETaskForeground, args); } static PyObject* switch_to_bg(PyObject* /*self*/, PyObject *args) { return _perform_task_operation(ETaskBackground, args); } static PyObject* kill_app(PyObject* /*self*/, PyObject *args) { return _perform_task_operation(ETaskKill, args); } static PyObject* end_app(PyObject* /*self*/, PyObject *args) { return _perform_task_operation(ETaskEnd, args); } static PyObject* application_list(PyObject* /*self*/, PyObject * args) { TBool includeHidden; if (!PyArg_ParseTuple(args, "i", &includeHidden)) { return 0; } CDesCArray* array = new (ELeave) CDesCArrayFlat(5); CleanupStack::PushL(array); TRAPD(err, GetRunningApplicationTitlesL(*array, includeHidden)); if (err) { return SPyErr_SetFromSymbianOSErr(err); } PyObject *appstuple; appstuple = PyTuple_New(array->Count()); for (TInt i = 0; i < array->Count(); i++) { PyObject *str = Py_BuildValue("u#", (*array)[i].Ptr(), (*array)[i].Length()); PyTuple_SET_ITEM(appstuple, i, str); } CleanupStack::PopAndDestroy(array); return appstuple; } /* * * Utilities for e32.start_server() and e32.start_exe() * */ class CE32ProcessWait : public CActive { public: CE32ProcessWait():CActive(EPriorityStandard) { CActiveScheduler::Add(this); } #if defined(__WINS__) && !defined(EKA2) TInt Wait(RThread& aProcess) { #else TInt Wait(RProcess& aProcess) { #endif aProcess.Logon(iStatus); aProcess.Resume(); SetActive(); #ifdef HAVE_ACTIVESCHEDULERWAIT iWait.Start(); #else CActiveScheduler::Start(); #endif return iStatus.Int(); } private: void DoCancel() {;} void RunL() { #ifdef HAVE_ACTIVESCHEDULERWAIT iWait.AsyncStop(); #else CActiveScheduler::Stop(); #endif } #ifdef HAVE_ACTIVESCHEDULERWAIT CActiveSchedulerWait iWait; #endif }; static TInt ProcessLaunch(const TDesC& aFileName, const TDesC& aCommand, TInt aWaitFlag=0) { TInt error; Py_BEGIN_ALLOW_THREADS #if defined(__WINS__) && !defined(EKA2) RThread proc; RLibrary lib; HBufC* pcommand = aCommand.Alloc(); error = lib.Load(aFileName); if (error == KErrNone) { TThreadFunction func = (TThreadFunction)(lib.Lookup(1)); error = proc.Create(_L(""), func, 0x1000, (TAny*) pcommand, &lib, RThread().Heap(), 0x1000, 0x100000, EOwnerProcess); lib.Close(); } else delete pcommand; #else RProcess proc; error = proc.Create(aFileName, aCommand); #endif if (error == KErrNone) if (aWaitFlag) { CE32ProcessWait* w = new CE32ProcessWait(); if (w) { error = w->Wait(proc); delete w; } else error = KErrNoMemory; } else proc.Resume(); proc.Close(); Py_END_ALLOW_THREADS return error; } /* * * * */ extern "C" PyObject * launch_py_background(PyObject* /*self*/, PyObject* args) { PyObject* it; PyObject* launcher_obj; if (!PyArg_ParseTuple(args, "OO", &it, &launcher_obj)) return NULL; PyObject* fn = PyUnicode_FromObject(it); if (!fn) return NULL; PyObject* launcher_fn = PyUnicode_FromObject(launcher_obj); TPtrC name(PyUnicode_AsUnicode(fn), PyUnicode_GetSize(fn)); TPtrC launcher_name(PyUnicode_AsUnicode(launcher_fn), PyUnicode_GetSize(launcher_fn)); TParse p; p.Set(name, NULL, NULL); if (!(p.Ext().CompareF(_L(".py")) == 0)) { Py_DECREF(fn); PyErr_SetString(PyExc_TypeError, "Python script name expected"); return NULL; } TInt error; RFs rfs; if ((error = rfs.Connect()) == KErrNone) { TBool f_exists; f_exists = BaflUtils::FileExists(rfs, name); rfs.Close(); if (!f_exists){ Py_DECREF(fn); return SPyErr_SetFromSymbianOSErr(KErrNotFound); } } error = #if defined(__WINS__) && !defined(EKA2) ProcessLaunch(launcher_name, name); #else ProcessLaunch(launcher_name, name); #endif Py_DECREF(fn); Py_DECREF(launcher_fn); RETURN_ERROR_OR_PYNONE(error); } static const PyMethodDef appswitch_methods[] = { {"switch_to_fg", (PyCFunction)switch_to_fg, METH_VARARGS}, {"switch_to_bg", (PyCFunction)switch_to_bg, METH_VARARGS}, {"end_app", (PyCFunction)end_app, METH_VARARGS}, {"kill_app", (PyCFunction)kill_app, METH_VARARGS}, {"application_list", (PyCFunction)application_list, METH_VARARGS}, {"launch_py_background", (PyCFunction)launch_py_background, METH_VARARGS}, {0, 0} /* sentinel */ }; DL_EXPORT(void) init_appswitch() { Py_InitModule("_applicationmanager", (PyMethodDef*) appswitch_methods); } #ifndef EKA2 // DLL entry point is needed only for Series 60 3.0 predecessors (non-EKA2) GLDEF_C TInt E32Dll(TDllReason) { return KErrNone; } #endif // EKA2
[ [ [ 1, 324 ] ] ]
4bdd46ddb8438b53b8e7449d4ace9200bff58576
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/Dependencies/Xerces/include/xercesc/dom/impl/DOMDocumentTypeImpl.hpp
f8a4d33589421a5128820452cf76be27cb3723b3
[]
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
3,578
hpp
#ifndef DOMDocumentTypeImpl_HEADER_GUARD_ #define DOMDocumentTypeImpl_HEADER_GUARD_ /* * Copyright 2001-2002,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: DOMDocumentTypeImpl.hpp 176026 2004-09-08 13:57:07Z peiyongz $ */ // // This file is part of the internal implementation of the C++ XML DOM. // It should NOT be included or used directly by application programs. // // Applications should include the file <xercesc/dom/DOM.hpp> for the entire // DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class // name is substituded for the *. // #include <xercesc/util/XercesDefs.hpp> #include <xercesc/dom/DOMDocumentType.hpp> #include "DOMNodeImpl.hpp" #include "DOMChildNode.hpp" #include "DOMParentNode.hpp" XERCES_CPP_NAMESPACE_BEGIN class DOMNamedNodeMapImpl; class CDOM_EXPORT DOMDocumentTypeImpl: public DOMDocumentType { private: DOMNodeImpl fNode; DOMParentNode fParent; DOMChildNode fChild; const XMLCh * fName; DOMNamedNodeMapImpl* fEntities; DOMNamedNodeMapImpl* fNotations; DOMNamedNodeMapImpl* fElements; const XMLCh * fPublicId; const XMLCh * fSystemId; const XMLCh * fInternalSubset; bool fIntSubsetReading; bool fIsCreatedFromHeap; virtual void setPublicId(const XMLCh * value); virtual void setSystemId(const XMLCh * value); virtual void setInternalSubset(const XMLCh *value); bool isIntSubsetReading() const; friend class AbstractDOMParser; friend class DOMDocumentImpl; public: DOMDocumentTypeImpl(DOMDocument *, const XMLCh *, bool); DOMDocumentTypeImpl(DOMDocument *, const XMLCh *qualifiedName, //DOM Level 2 const XMLCh *publicId, const XMLCh *systemId, bool); DOMDocumentTypeImpl(const DOMDocumentTypeImpl &other, bool heap, bool deep=false); virtual ~DOMDocumentTypeImpl(); // Declare all of the functions from DOMNode. DOMNODE_FUNCTIONS; virtual void setOwnerDocument(DOMDocument *doc); virtual DOMNamedNodeMap * getEntities() const; virtual const XMLCh * getName() const; virtual DOMNamedNodeMap * getNotations() const; virtual DOMNamedNodeMap * getElements() const; virtual void setReadOnly(bool readOnly, bool deep); //Introduced in DOM Level 2 virtual const XMLCh * getPublicId() const; virtual const XMLCh * getSystemId() const; virtual const XMLCh * getInternalSubset() const; private: // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- DOMDocumentTypeImpl & operator = (const DOMDocumentTypeImpl &); }; XERCES_CPP_NAMESPACE_END #endif
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 104 ] ] ]
04ddfb73209acad964a0be52bcdb79ca72e853ba
4d91ca4dcaaa9167928d70b278b82c90fef384fa
/CedeCryptSelfDecryptor/CedeCrypt/CedeCrypt/Diagnostics.cpp
f30685015c3727951554914921df58563e51cbbf
[]
no_license
dannydraper/CedeCryptClassic
13ef0d5f03f9ff3a9a1fe4a8113e385270536a03
5f14e3c9d949493b2831710e0ce414a1df1148ec
refs/heads/master
2021-01-17T13:10:51.608070
2010-10-01T10:09:15
2010-10-01T10:09:15
63,413,327
0
0
null
null
null
null
UTF-8
C++
false
false
3,761
cpp
// This work is dedicated to the Lord our God. King of Heaven, Lord of Heaven's Armies. #include "Diagnostics.h" Diagnostics::Diagnostics () { } Diagnostics::~Diagnostics () { } void Diagnostics::Initialise (HWND hWnd, LPSTR lpCmdLine) { SetParentHWND (hWnd); SetBgColor (RGB (200, 200, 200)); SetParentHWND (hWnd); SetCaption (TEXT ("CedeCrypt Diagnostics")); SetWindowStyle (FS_STYLESTANDARD); CreateAppWindow ("COMMDiagnosticsClass", 30, 30, 600, 350, true); //m_uihandler.SetWindowProperties (0, 70, 40, 443, RGB (200, 200, 200)); //SetWindowPosition (FS_CENTER); ParseCommandLine (lpCmdLine); //Show (); } void Diagnostics::ParseCommandLine (char *pszCmdline) { //MessageBox (NULL, "Hello", "Info", MB_OK); //MessageBox (NULL, pszCmdline, "Command Line", MB_OK); char szAction[SIZE_STRING]; ZeroMemory (szAction, SIZE_STRING); char szPath[SIZE_STRING]; ZeroMemory (szPath, SIZE_STRING); bool bDiagmode = false; strncpy_s (szAction, SIZE_STRING, pszCmdline, 5); if (strcmp (szAction, "/diag") == 0) { OutputInt ("CmdLine length: ", strlen (pszCmdline)); OutputText ("Time to enter diagnostic mode..."); bDiagmode = true; Show (); } } void Diagnostics::OnCreate (HWND hWnd) { HFONT hfDefault = (HFONT) GetStockObject (DEFAULT_GUI_FONT); m_hwnddiaglist = CreateWindow ("listbox", NULL, WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL, 1, 43, 591, 283, hWnd, (HMENU) ID_DIAGLIST, GetModuleHandle (NULL), NULL) ; SendMessage (m_hwnddiaglist, WM_SETFONT, (WPARAM) hfDefault, MAKELPARAM (FALSE, 0)); OutputInt ("Diagnostics Ready: ", 0); } void Diagnostics::OutputInt (LPCSTR lpszText, int iValue) { char szInteger[SIZE_INTEGER]; ZeroMemory (szInteger, SIZE_INTEGER); sprintf_s (szInteger, SIZE_INTEGER, "%d", iValue); char szText[SIZE_STRING]; ZeroMemory (szText, SIZE_STRING); strcpy_s (szText, SIZE_STRING, lpszText); strcat_s (szText, SIZE_STRING, szInteger); SendMessage (m_hwnddiaglist, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) &szText); int lCount = SendMessage (m_hwnddiaglist, LB_GETCOUNT, 0, 0); SendMessage (m_hwnddiaglist, LB_SETCURSEL, lCount-1, 0); } void Diagnostics::OutputText (LPCSTR lpszText) { char szText[SIZE_STRING]; ZeroMemory (szText, SIZE_STRING); if (strlen (lpszText) < SIZE_STRING) { strcpy_s (szText, SIZE_STRING, lpszText); SendMessage (m_hwnddiaglist, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) &szText); int lCount = SendMessage (m_hwnddiaglist, LB_GETCOUNT, 0, 0); SendMessage (m_hwnddiaglist, LB_SETCURSEL, lCount-1, 0); } } void Diagnostics::OutputText (LPCSTR lpszName, LPCSTR lpszValue) { char szText[SIZE_STRING*2]; ZeroMemory (szText, SIZE_STRING*2); if (strlen (lpszValue) < SIZE_STRING) { strcat_s (szText, SIZE_STRING*2, lpszName); strcat_s (szText, SIZE_STRING*2, lpszValue); SendMessage (m_hwnddiaglist, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) &szText); int lCount = SendMessage (m_hwnddiaglist, LB_GETCOUNT, 0, 0); SendMessage (m_hwnddiaglist, LB_SETCURSEL, lCount-1, 0); } } void Diagnostics::OnCommand (HWND hWnd, WPARAM wParam, LPARAM lParam) { } void Diagnostics::OnUICommand (HWND hWnd, WPARAM wParam, LPARAM lParam) { } void Diagnostics::OnTimer (WPARAM wParam) { m_uihandler.NotifyTimer (wParam); } void Diagnostics::OnPaint (HWND hWnd) { m_uihandler.PaintControls (hWnd); } void Diagnostics::OnMouseMove (HWND hWnd, int mouseXPos, int mouseYPos) { m_uihandler.NotifyMouseMove (mouseXPos, mouseYPos); } void Diagnostics::OnLButtonDown (HWND hWnd) { m_uihandler.NotifyMouseDown (); } void Diagnostics::OnLButtonUp (HWND hWnd) { m_uihandler.NotifyMouseUp (); }
[ "ddraper@f12373e4-23ff-6a4a-9817-e77f09f3faef" ]
[ [ [ 1, 145 ] ] ]
956b0d94b0bd6340fe533b70d5eb7f536f80bd67
2982a765bb21c5396587c86ecef8ca5eb100811f
/util/wm5/LibMathematics/Algebra/Wm5HPoint.cpp
2c64459bb9869f3600be81a263dba09fcdc56746
[]
no_license
evanw/cs224final
1a68c6be4cf66a82c991c145bcf140d96af847aa
af2af32732535f2f58bf49ecb4615c80f141ea5b
refs/heads/master
2023-05-30T19:48:26.968407
2011-05-10T16:21:37
2011-05-10T16:21:37
1,653,696
27
9
null
null
null
null
UTF-8
C++
false
false
2,574
cpp
// Geometric Tools, LLC // Copyright (c) 1998-2010 // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt // // File Version: 5.0.0 (2010/01/01) #include "Wm5MathematicsPCH.h" #include "Wm5HPoint.h" using namespace Wm5; //---------------------------------------------------------------------------- HPoint::HPoint () { } //---------------------------------------------------------------------------- HPoint::HPoint (const HPoint& pnt) { mTuple[0] = pnt.mTuple[0]; mTuple[1] = pnt.mTuple[1]; mTuple[2] = pnt.mTuple[2]; mTuple[3] = pnt.mTuple[3]; } //---------------------------------------------------------------------------- HPoint::HPoint (float x, float y, float z, float w) { mTuple[0] = x; mTuple[1] = y; mTuple[2] = z; mTuple[3] = w; } //---------------------------------------------------------------------------- HPoint::~HPoint () { } //---------------------------------------------------------------------------- HPoint& HPoint::operator= (const HPoint& pnt) { mTuple[0] = pnt.mTuple[0]; mTuple[1] = pnt.mTuple[1]; mTuple[2] = pnt.mTuple[2]; mTuple[3] = pnt.mTuple[3]; return *this; } //---------------------------------------------------------------------------- bool HPoint::operator== (const HPoint& pnt) const { return memcmp(mTuple, pnt.mTuple, 4*sizeof(float)) == 0; } //---------------------------------------------------------------------------- bool HPoint::operator!= (const HPoint& pnt) const { return memcmp(mTuple, pnt.mTuple, 4*sizeof(float)) != 0; } //---------------------------------------------------------------------------- bool HPoint::operator< (const HPoint& pnt) const { return memcmp(mTuple, pnt.mTuple, 4*sizeof(float)) < 0; } //---------------------------------------------------------------------------- bool HPoint::operator<= (const HPoint& pnt) const { return memcmp(mTuple, pnt.mTuple, 4*sizeof(float)) <= 0; } //---------------------------------------------------------------------------- bool HPoint::operator> (const HPoint& pnt) const { return memcmp(mTuple, pnt.mTuple, 4*sizeof(float)) > 0; } //---------------------------------------------------------------------------- bool HPoint::operator>= (const HPoint& pnt) const { return memcmp(mTuple, pnt.mTuple, 4*sizeof(float)) >= 0; } //----------------------------------------------------------------------------
[ [ [ 1, 76 ] ] ]
97cada7a8bafcb43ed39fb52f3a6e39567e5feae
cfc474b8274183a4a2f4a4e06f16006f280e9e43
/Sudoku/Sudoku.h
f0133ece4ff186529b6809381018513ae3484dc9
[]
no_license
neilforrest/verysimplesudoku
26b1569e611bbb15cb26a7cf0f80ff042ab78c4c
df225f4b98d2657abc2a895b5d73c7aca8847c6a
refs/heads/master
2020-05-19T20:50:24.132502
2008-01-05T21:58:15
2008-01-05T21:58:15
33,373,791
0
0
null
null
null
null
UTF-8
C++
false
false
504
h
// Sudoku.h : main header file for the PROJECT_NAME application // #pragma once #ifndef __AFXWIN_H__ #error "include 'stdafx.h' before including this file for PCH" #endif #include "resource.h" // main symbols // CSudokuApp: // See Sudoku.cpp for the implementation of this class // class CSudokuApp : public CWinApp { public: CSudokuApp(); // Overrides public: virtual BOOL InitInstance(); // Implementation DECLARE_MESSAGE_MAP() }; extern CSudokuApp theApp;
[ "neil.david.forrest@1c60f1a0-0043-0410-b499-77e8d6643a01" ]
[ [ [ 1, 31 ] ] ]
6727d9e80db174c0967c07154c799c28de2f3e85
d5f525c995dd321375a19a8634a391255f0e5b6f
/graphic_front_end/new_motor/motor/motorDlg.cpp
083058d1bc913af15c3fbebaf84db79ecfb9c193
[]
no_license
shangdawei/cortex-simulator
bac4b8f19be3e2df622ad26e573330642ec97bae
d343b66a88a5b78d5851a3ee5dc2a4888ff00b20
refs/heads/master
2016-09-05T19:45:32.930832
2009-03-19T06:07:47
2009-03-19T06:07:47
42,106,205
1
1
null
null
null
null
GB18030
C++
false
false
3,328
cpp
// motorDlg.cpp : 实现文件 // #include "stdafx.h" #include "motor.h" #include "motorDlg.h" #include "vbus/vbus_interface.h" #include <math.h> #ifdef _DEBUG #define new DEBUG_NEW #endif // CmotorDlg 对话框 CmotorDlg::CmotorDlg(CWnd* pParent /*=NULL*/) : CDialog(CmotorDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); arrow_x = 50; arrow_y = 50; angle = 0; arrow_r = 15; vbAddr[0] = 0; vbAddr[1] = 4; vbAddr[2] = 8; vbLens[0] = 4; vbLens[1] = 4; vbLens[2] = 4; vNew = TRUE; } void CmotorDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_BUTTON1, bArrow); } BEGIN_MESSAGE_MAP(CmotorDlg, CDialog) ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTTON1, &CmotorDlg::OnBnClickedButton1) END_MESSAGE_MAP() // CmotorDlg 消息处理程序 BOOL CmotorDlg::OnInitDialog() { CDialog::OnInitDialog(); // 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 // TODO: 在此添加额外的初始化代码 vb_load("vbus"); //bArrow.SetIcon(m_hIcon); SetTimer(1, 50, NULL); return TRUE; // 除非将焦点设置到控件,否则返回 TRUE } // 如果向对话框添加最小化按钮,则需要下面的代码 // 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序, // 这将由框架自动完成。 void CmotorDlg::OnPaint() { CPaintDC dc(this);// 用于绘制的设备上下文 if (IsIconic()) { SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // 使图标在工作矩形中居中 int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // 绘制图标 dc.DrawIcon(x, y, m_hIcon); } else if(vNew == TRUE) { POINT arrow[3]; dc.Rectangle(0,0,400,300); arrow[0].x = (long)(arrow_x + arrow_r*cos(angle)); arrow[0].y = (long)(arrow_y + arrow_r*sin(angle)); arrow[1].x = (long)(arrow_x + arrow_r*cos(angle + 3.14/2)); arrow[1].y = (long)(arrow_y + arrow_r*sin(angle + 3.14/2)); arrow[2].x = (long)(arrow_x + arrow_r*cos(angle - 3.14/2)); arrow[2].y = (long)(arrow_y + arrow_r*sin(angle - 3.14/2)); dc.Polygon(arrow, 3); vNew = FALSE; } else{ CDialog::OnPaint(); } } //当用户拖动最小化窗口时系统调用此函数取得光标显示。 // HCURSOR CmotorDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } void CmotorDlg::OnTimer(UINT_PTR nIDEvent) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CDialog::OnTimer(nIDEvent); float x,y; vb_nread(vbAddr[0], (char *)(&x), sizeof(x)); vb_nread(vbAddr[1], (char *)(&y), sizeof(y)); vb_nread(vbAddr[2], (char *)(&angle), sizeof(angle)); arrow_x = (long)x + 50; arrow_y = (long)y + 50; vNew = TRUE; Invalidate(); SetTimer(nIDEvent, 50, NULL); } void CmotorDlg::OnBnClickedButton1() { // TODO: 在此添加控件通知处理程序代码 }
[ "yihengw@3e89f612-834b-0410-bb31-dbad55e6f342" ]
[ [ [ 1, 142 ] ] ]
3564b593b547cce3431cade46f0ad4dfe379245d
bfe8eca44c0fca696a0031a98037f19a9938dd26
/libjingle-0.4.0/talk/base/socketpool.h
8e093a20f9dca5c94199a11304b465a38c6efa9e
[ "BSD-3-Clause" ]
permissive
luge/foolject
a190006bc0ed693f685f3a8287ea15b1fe631744
2f4f13a221a0fa2fecab2aaaf7e2af75c160d90c
refs/heads/master
2021-01-10T07:41:06.726526
2011-01-21T10:25:22
2011-01-21T10:25:22
36,303,977
0
0
null
null
null
null
UTF-8
C++
false
false
5,931
h
/* * libjingle * Copyright 2004--2005, Google Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * 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. */ #ifndef TALK_BASE_SOCKETPOOL_H__ #define TALK_BASE_SOCKETPOOL_H__ #include <deque> #include <vector> #include "talk/base/logging.h" #include "talk/base/sigslot.h" namespace talk_base { class AsyncSocket; class LoggingAdapter; class SocketAddress; class SocketFactory; class SocketStream; class StreamInterface; ////////////////////////////////////////////////////////////////////// // StreamPool ////////////////////////////////////////////////////////////////////// class StreamPool { public: virtual ~StreamPool() { } virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote, int* err) = 0; virtual void ReturnConnectedStream(StreamInterface* stream) = 0; }; /////////////////////////////////////////////////////////////////////////////// // StreamCache - Caches a set of open streams, defers creation/destruction to // the supplied StreamPool. /////////////////////////////////////////////////////////////////////////////// class StreamCache : public StreamPool, public sigslot::has_slots<> { public: StreamCache(StreamPool* pool); virtual ~StreamCache(); // StreamPool Interface virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote, int* err); virtual void ReturnConnectedStream(StreamInterface* stream); private: typedef std::pair<SocketAddress, StreamInterface*> ConnectedStream; typedef std::list<ConnectedStream> ConnectedList; void OnStreamEvent(StreamInterface* stream, int events, int err); // We delegate stream creation and deletion to this pool. StreamPool* pool_; // Streams that are in use (returned from RequestConnectedStream). ConnectedList active_; // Streams which were returned to us, but are still open. ConnectedList cached_; }; ////////////////////////////////////////////////////////////////////// // NewSocketPool // /////////////////// // Creates a new PTcpSocket every time ////////////////////////////////////////////////////////////////////// class NewSocketPool : public StreamPool { public: NewSocketPool(SocketFactory* factory); virtual ~NewSocketPool(); // StreamPool Interface virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote, int* err); virtual void ReturnConnectedStream(StreamInterface* stream); private: SocketFactory* factory_; std::vector<StreamInterface*> used_; }; ////////////////////////////////////////////////////////////////////// // ReuseSocketPool // ///////////////////// // Pass a PTcpSocket chain to the constructor, and if the connection // is still open, it will be reused. ////////////////////////////////////////////////////////////////////// class ReuseSocketPool : public StreamPool { public: ReuseSocketPool(SocketFactory* factory, AsyncSocket* socket = 0); virtual ~ReuseSocketPool(); void setSocket(AsyncSocket* socket); // StreamPool Interface virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote, int* err); virtual void ReturnConnectedStream(StreamInterface* stream); private: SocketFactory* factory_; SocketStream* stream_; }; /////////////////////////////////////////////////////////////////////////////// // LoggingPoolAdapter - Adapts a StreamPool to supply streams with attached // LoggingAdapters. /////////////////////////////////////////////////////////////////////////////// class LoggingPoolAdapter : public StreamPool { public: LoggingPoolAdapter(StreamPool* pool, LoggingSeverity level, const std::string& label, bool binary_mode); virtual ~LoggingPoolAdapter(); // StreamPool Interface virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote, int* err); virtual void ReturnConnectedStream(StreamInterface* stream); private: StreamPool* pool_; LoggingSeverity level_; std::string label_; bool binary_mode_; typedef std::deque<LoggingAdapter*> StreamList; StreamList recycle_bin_; }; ////////////////////////////////////////////////////////////////////// } // namespace talk_base #endif // TALK_BASE_SOCKETPOOL_H__
[ "[email protected]@756bb6b0-a119-0410-8338-473b6f1ccd30" ]
[ [ [ 1, 161 ] ] ]
d435763c58aeb540275c8a049590f79d972499b2
668dc83d4bc041d522e35b0c783c3e073fcc0bd2
/fbide-wx/App/include/App.h
1d5af272d8bd5e56ac5c1f48792629483c4063eb
[]
no_license
albeva/fbide-old-svn
4add934982ce1ce95960c9b3859aeaf22477f10b
bde1e72e7e182fabc89452738f7655e3307296f4
refs/heads/master
2021-01-13T10:22:25.921182
2009-11-19T16:50:48
2009-11-19T16:50:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,064
h
/* * This file is part of FBIde project * * FBIde 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. * * FBIde 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 FBIde. If not, see <http://www.gnu.org/licenses/>. * * Author: Albert Varaksin <[email protected]> * Copyright (C) The FBIde development team */ #ifndef APP_H_INCLUDED #define APP_H_INCLUDED #include <wx/app.h> /** * Main application class */ class CApp : public wxApp { public: virtual bool OnInit (); virtual int OnExit (); virtual int OnRun (); }; #endif // FBIDEAPP_H
[ "vongodric@957c6b5c-1c3a-0410-895f-c76cfc11fbc7" ]
[ [ [ 1, 39 ] ] ]
c2bfbc2112d0dc1df465fe1d6d186f67f8da0aeb
b2b5c3694476d1631322a340c6ad9e5a9ec43688
/Baluchon/AnimatedSliding.h
96b0bd7bb688f9e93b30ce131c1173afe12942ce
[]
no_license
jpmn/rough-albatross
3c456ea23158e749b029b2112b2f82a7a5d1fb2b
eb2951062f6c954814f064a28ad7c7a4e7cc35b0
refs/heads/master
2016-09-05T12:18:01.227974
2010-12-19T08:03:25
2010-12-19T08:03:25
32,195,707
1
0
null
null
null
null
UTF-8
C++
false
false
571
h
#pragma once #include <cv.h> #include "AnimatedTransform.h" using namespace baluchon::core::services::positioning; namespace baluchon { namespace core { namespace datas { namespace animation { class AnimatedSliding : public AnimatedTransform { public: AnimatedSliding(CvPoint3D32f vector, CvPoint3D32f limit, CvPoint3D32f increment); virtual ~AnimatedSliding(void); virtual void applyIncrement(void); private: CvPoint3D32f mVector; CvPoint3D32f mLimit; CvPoint3D32f mInitial; CvPoint3D32f mSide; CvPoint3D32f mIncrement; }; }}}};
[ "jpmorin196@bd4f47a5-da4e-a94a-6a47-2669d62bc1a5" ]
[ [ [ 1, 27 ] ] ]
5be4632a3e71d5abc8f81ca9f08010b7796701cc
94c1c7459eb5b2826e81ad2750019939f334afc8
/source/CTaiScreensIndicate.h
952f684d64ac33b0b208d0d9084cd1625750201f
[]
no_license
wgwang/yinhustock
1c57275b4bca093e344a430eeef59386e7439d15
382ed2c324a0a657ddef269ebfcd84634bd03c3a
refs/heads/master
2021-01-15T17:07:15.833611
2010-11-27T07:06:40
2010-11-27T07:06:40
37,531,026
1
3
null
null
null
null
UTF-8
C++
false
false
1,586
h
#if !defined(AFX_SCREENSTOCKSINDICATE_H__62BF6203_63BF_11D4_970B_0080C8D6450E__INCLUDED_) #define AFX_SCREENSTOCKSINDICATE_H__62BF6203_63BF_11D4_970B_0080C8D6450E__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // CTaiScreensIndicate.h : header file // #include "FloatEdit.h" #include "CTaiScreenParent.h" class CTaiShanKlineShowView; class CTaiScreensIndicate : public CTaiScreenParent { public: void SetIndicator(CFormularContent *pJishu); void Calculate(); CTaiShanKlineShowView* pView; bool m_bUseing;// CTaiScreensIndicate(CWnd* pParent = NULL); //{{AFX_DATA(CTaiScreensIndicate) enum { IDD = IDD_6_TJXG_INDICATE }; CButtonST m_button1; CButtonST m_ok; CButtonST m_cancel; CFloatEdit m_floatEdit2; CFloatEdit m_floatEdit1; CButtonST m_buttonExpl; float m_mbly; int m_mbzq; BOOL m_CheckSelect; //}}AFX_DATA //{{AFX_VIRTUAL(CTaiScreensIndicate) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL protected: //{{AFX_MSG(CTaiScreensIndicate) virtual void OnOK(); virtual BOOL OnInitDialog(); afx_msg void OnSetAddCondition(); virtual void OnCancel(); afx_msg void OnClose(); afx_msg void OnButton2(); afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SCREENSTOCKSINDICATE_H__62BF6203_63BF_11D4_970B_0080C8D6450E__INCLUDED_)
[ [ [ 1, 63 ] ] ]
2d8ff321d816b283907fe810d3bcf80251506918
5c4e36054f0752a610ad149dfd81e6f35ccb37a1
/libs/src2.75/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp
32ea0c3f6d941f29fe31f55ae608701927812991
[]
no_license
Akira-Hayasaka/ofxBulletPhysics
4141dc7b6dff7e46b85317b0fe7d2e1f8896b2e4
5e45da80bce2ed8b1f12de9a220e0c1eafeb7951
refs/heads/master
2016-09-15T23:11:01.354626
2011-09-22T04:11:35
2011-09-22T04:11:35
1,152,090
6
0
null
null
null
null
UTF-8
C++
false
false
26,396
cpp
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* 2007-09-09 Refactored by Francisco Le?n email: [email protected] http://gimpact.sf.net */ #include "btGeneric6DofConstraint.h" #include "BulletDynamics/Dynamics/btRigidBody.h" #include "LinearMath/btTransformUtil.h" #include "LinearMath/btTransformUtil.h" #include <new> #define D6_USE_OBSOLETE_METHOD false btGeneric6DofConstraint::btGeneric6DofConstraint() :btTypedConstraint(D6_CONSTRAINT_TYPE), m_useLinearReferenceFrameA(true), m_useSolveConstraintObsolete(D6_USE_OBSOLETE_METHOD) { } btGeneric6DofConstraint::btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA) : btTypedConstraint(D6_CONSTRAINT_TYPE, rbA, rbB) , m_frameInA(frameInA) , m_frameInB(frameInB), m_useLinearReferenceFrameA(useLinearReferenceFrameA), m_useSolveConstraintObsolete(D6_USE_OBSOLETE_METHOD) { } #define GENERIC_D6_DISABLE_WARMSTARTING 1 btScalar btGetMatrixElem(const btMatrix3x3& mat, int index); btScalar btGetMatrixElem(const btMatrix3x3& mat, int index) { int i = index%3; int j = index/3; return mat[i][j]; } ///MatrixToEulerXYZ from http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Matrix3.inl.html bool matrixToEulerXYZ(const btMatrix3x3& mat,btVector3& xyz); bool matrixToEulerXYZ(const btMatrix3x3& mat,btVector3& xyz) { // // rot = cy*cz -cy*sz sy // // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx // // -cx*cz*sy+sx*sz cz*sx+cx*sy*sz cx*cy // btScalar fi = btGetMatrixElem(mat,2); if (fi < btScalar(1.0f)) { if (fi > btScalar(-1.0f)) { xyz[0] = btAtan2(-btGetMatrixElem(mat,5),btGetMatrixElem(mat,8)); xyz[1] = btAsin(btGetMatrixElem(mat,2)); xyz[2] = btAtan2(-btGetMatrixElem(mat,1),btGetMatrixElem(mat,0)); return true; } else { // WARNING. Not unique. XA - ZA = -atan2(r10,r11) xyz[0] = -btAtan2(btGetMatrixElem(mat,3),btGetMatrixElem(mat,4)); xyz[1] = -SIMD_HALF_PI; xyz[2] = btScalar(0.0); return false; } } else { // WARNING. Not unique. XAngle + ZAngle = atan2(r10,r11) xyz[0] = btAtan2(btGetMatrixElem(mat,3),btGetMatrixElem(mat,4)); xyz[1] = SIMD_HALF_PI; xyz[2] = 0.0; } return false; } //////////////////////////// btRotationalLimitMotor //////////////////////////////////// int btRotationalLimitMotor::testLimitValue(btScalar test_value) { if(m_loLimit>m_hiLimit) { m_currentLimit = 0;//Free from violation return 0; } if (test_value < m_loLimit) { m_currentLimit = 1;//low limit violation m_currentLimitError = test_value - m_loLimit; return 1; } else if (test_value> m_hiLimit) { m_currentLimit = 2;//High limit violation m_currentLimitError = test_value - m_hiLimit; return 2; }; m_currentLimit = 0;//Free from violation return 0; } btScalar btRotationalLimitMotor::solveAngularLimits( btScalar timeStep,btVector3& axis,btScalar jacDiagABInv, btRigidBody * body0, btSolverBody& bodyA, btRigidBody * body1, btSolverBody& bodyB) { if (needApplyTorques()==false) return 0.0f; btScalar target_velocity = m_targetVelocity; btScalar maxMotorForce = m_maxMotorForce; //current error correction if (m_currentLimit!=0) { target_velocity = -m_ERP*m_currentLimitError/(timeStep); maxMotorForce = m_maxLimitForce; } maxMotorForce *= timeStep; // current velocity difference btVector3 angVelA; bodyA.getAngularVelocity(angVelA); btVector3 angVelB; bodyB.getAngularVelocity(angVelB); btVector3 vel_diff; vel_diff = angVelA-angVelB; btScalar rel_vel = axis.dot(vel_diff); // correction velocity btScalar motor_relvel = m_limitSoftness*(target_velocity - m_damping*rel_vel); if ( motor_relvel < SIMD_EPSILON && motor_relvel > -SIMD_EPSILON ) { return 0.0f;//no need for applying force } // correction impulse btScalar unclippedMotorImpulse = (1+m_bounce)*motor_relvel*jacDiagABInv; // clip correction impulse btScalar clippedMotorImpulse; ///@todo: should clip against accumulated impulse if (unclippedMotorImpulse>0.0f) { clippedMotorImpulse = unclippedMotorImpulse > maxMotorForce? maxMotorForce: unclippedMotorImpulse; } else { clippedMotorImpulse = unclippedMotorImpulse < -maxMotorForce ? -maxMotorForce: unclippedMotorImpulse; } // sort with accumulated impulses btScalar lo = btScalar(-BT_LARGE_FLOAT); btScalar hi = btScalar(BT_LARGE_FLOAT); btScalar oldaccumImpulse = m_accumulatedImpulse; btScalar sum = oldaccumImpulse + clippedMotorImpulse; m_accumulatedImpulse = sum > hi ? btScalar(0.) : sum < lo ? btScalar(0.) : sum; clippedMotorImpulse = m_accumulatedImpulse - oldaccumImpulse; btVector3 motorImp = clippedMotorImpulse * axis; //body0->applyTorqueImpulse(motorImp); //body1->applyTorqueImpulse(-motorImp); bodyA.applyImpulse(btVector3(0,0,0), body0->getInvInertiaTensorWorld()*axis,clippedMotorImpulse); bodyB.applyImpulse(btVector3(0,0,0), body1->getInvInertiaTensorWorld()*axis,-clippedMotorImpulse); return clippedMotorImpulse; } //////////////////////////// End btRotationalLimitMotor //////////////////////////////////// //////////////////////////// btTranslationalLimitMotor //////////////////////////////////// int btTranslationalLimitMotor::testLimitValue(int limitIndex, btScalar test_value) { btScalar loLimit = m_lowerLimit[limitIndex]; btScalar hiLimit = m_upperLimit[limitIndex]; if(loLimit > hiLimit) { m_currentLimit[limitIndex] = 0;//Free from violation m_currentLimitError[limitIndex] = btScalar(0.f); return 0; } if (test_value < loLimit) { m_currentLimit[limitIndex] = 2;//low limit violation m_currentLimitError[limitIndex] = test_value - loLimit; return 2; } else if (test_value> hiLimit) { m_currentLimit[limitIndex] = 1;//High limit violation m_currentLimitError[limitIndex] = test_value - hiLimit; return 1; }; m_currentLimit[limitIndex] = 0;//Free from violation m_currentLimitError[limitIndex] = btScalar(0.f); return 0; } btScalar btTranslationalLimitMotor::solveLinearAxis( btScalar timeStep, btScalar jacDiagABInv, btRigidBody& body1,btSolverBody& bodyA,const btVector3 &pointInA, btRigidBody& body2,btSolverBody& bodyB,const btVector3 &pointInB, int limit_index, const btVector3 & axis_normal_on_a, const btVector3 & anchorPos) { ///find relative velocity // btVector3 rel_pos1 = pointInA - body1.getCenterOfMassPosition(); // btVector3 rel_pos2 = pointInB - body2.getCenterOfMassPosition(); btVector3 rel_pos1 = anchorPos - body1.getCenterOfMassPosition(); btVector3 rel_pos2 = anchorPos - body2.getCenterOfMassPosition(); btVector3 vel1; bodyA.getVelocityInLocalPointObsolete(rel_pos1,vel1); btVector3 vel2; bodyB.getVelocityInLocalPointObsolete(rel_pos2,vel2); btVector3 vel = vel1 - vel2; btScalar rel_vel = axis_normal_on_a.dot(vel); /// apply displacement correction //positional error (zeroth order error) btScalar depth = -(pointInA - pointInB).dot(axis_normal_on_a); btScalar lo = btScalar(-BT_LARGE_FLOAT); btScalar hi = btScalar(BT_LARGE_FLOAT); btScalar minLimit = m_lowerLimit[limit_index]; btScalar maxLimit = m_upperLimit[limit_index]; //handle the limits if (minLimit < maxLimit) { { if (depth > maxLimit) { depth -= maxLimit; lo = btScalar(0.); } else { if (depth < minLimit) { depth -= minLimit; hi = btScalar(0.); } else { return 0.0f; } } } } btScalar normalImpulse= m_limitSoftness*(m_restitution*depth/timeStep - m_damping*rel_vel) * jacDiagABInv; btScalar oldNormalImpulse = m_accumulatedImpulse[limit_index]; btScalar sum = oldNormalImpulse + normalImpulse; m_accumulatedImpulse[limit_index] = sum > hi ? btScalar(0.) : sum < lo ? btScalar(0.) : sum; normalImpulse = m_accumulatedImpulse[limit_index] - oldNormalImpulse; btVector3 impulse_vector = axis_normal_on_a * normalImpulse; //body1.applyImpulse( impulse_vector, rel_pos1); //body2.applyImpulse(-impulse_vector, rel_pos2); btVector3 ftorqueAxis1 = rel_pos1.cross(axis_normal_on_a); btVector3 ftorqueAxis2 = rel_pos2.cross(axis_normal_on_a); bodyA.applyImpulse(axis_normal_on_a*body1.getInvMass(), body1.getInvInertiaTensorWorld()*ftorqueAxis1,normalImpulse); bodyB.applyImpulse(axis_normal_on_a*body2.getInvMass(), body2.getInvInertiaTensorWorld()*ftorqueAxis2,-normalImpulse); return normalImpulse; } //////////////////////////// btTranslationalLimitMotor //////////////////////////////////// void btGeneric6DofConstraint::calculateAngleInfo() { btMatrix3x3 relative_frame = m_calculatedTransformA.getBasis().inverse()*m_calculatedTransformB.getBasis(); matrixToEulerXYZ(relative_frame,m_calculatedAxisAngleDiff); // in euler angle mode we do not actually constrain the angular velocity // along the axes axis[0] and axis[2] (although we do use axis[1]) : // // to get constrain w2-w1 along ...not // ------ --------------------- ------ // d(angle[0])/dt = 0 ax[1] x ax[2] ax[0] // d(angle[1])/dt = 0 ax[1] // d(angle[2])/dt = 0 ax[0] x ax[1] ax[2] // // constraining w2-w1 along an axis 'a' means that a'*(w2-w1)=0. // to prove the result for angle[0], write the expression for angle[0] from // GetInfo1 then take the derivative. to prove this for angle[2] it is // easier to take the euler rate expression for d(angle[2])/dt with respect // to the components of w and set that to 0. btVector3 axis0 = m_calculatedTransformB.getBasis().getColumn(0); btVector3 axis2 = m_calculatedTransformA.getBasis().getColumn(2); m_calculatedAxis[1] = axis2.cross(axis0); m_calculatedAxis[0] = m_calculatedAxis[1].cross(axis2); m_calculatedAxis[2] = axis0.cross(m_calculatedAxis[1]); m_calculatedAxis[0].normalize(); m_calculatedAxis[1].normalize(); m_calculatedAxis[2].normalize(); } void btGeneric6DofConstraint::calculateTransforms() { calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform()); } void btGeneric6DofConstraint::calculateTransforms(const btTransform& transA,const btTransform& transB) { m_calculatedTransformA = transA * m_frameInA; m_calculatedTransformB = transB * m_frameInB; calculateLinearInfo(); calculateAngleInfo(); } void btGeneric6DofConstraint::buildLinearJacobian( btJacobianEntry & jacLinear,const btVector3 & normalWorld, const btVector3 & pivotAInW,const btVector3 & pivotBInW) { new (&jacLinear) btJacobianEntry( m_rbA.getCenterOfMassTransform().getBasis().transpose(), m_rbB.getCenterOfMassTransform().getBasis().transpose(), pivotAInW - m_rbA.getCenterOfMassPosition(), pivotBInW - m_rbB.getCenterOfMassPosition(), normalWorld, m_rbA.getInvInertiaDiagLocal(), m_rbA.getInvMass(), m_rbB.getInvInertiaDiagLocal(), m_rbB.getInvMass()); } void btGeneric6DofConstraint::buildAngularJacobian( btJacobianEntry & jacAngular,const btVector3 & jointAxisW) { new (&jacAngular) btJacobianEntry(jointAxisW, m_rbA.getCenterOfMassTransform().getBasis().transpose(), m_rbB.getCenterOfMassTransform().getBasis().transpose(), m_rbA.getInvInertiaDiagLocal(), m_rbB.getInvInertiaDiagLocal()); } bool btGeneric6DofConstraint::testAngularLimitMotor(int axis_index) { btScalar angle = m_calculatedAxisAngleDiff[axis_index]; angle = btAdjustAngleToLimits(angle, m_angularLimits[axis_index].m_loLimit, m_angularLimits[axis_index].m_hiLimit); m_angularLimits[axis_index].m_currentPosition = angle; //test limits m_angularLimits[axis_index].testLimitValue(angle); return m_angularLimits[axis_index].needApplyTorques(); } void btGeneric6DofConstraint::buildJacobian() { #ifndef __SPU__ if (m_useSolveConstraintObsolete) { // Clear accumulated impulses for the next simulation step m_linearLimits.m_accumulatedImpulse.setValue(btScalar(0.), btScalar(0.), btScalar(0.)); int i; for(i = 0; i < 3; i++) { m_angularLimits[i].m_accumulatedImpulse = btScalar(0.); } //calculates transform calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform()); // const btVector3& pivotAInW = m_calculatedTransformA.getOrigin(); // const btVector3& pivotBInW = m_calculatedTransformB.getOrigin(); calcAnchorPos(); btVector3 pivotAInW = m_AnchorPos; btVector3 pivotBInW = m_AnchorPos; // not used here // btVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); // btVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition(); btVector3 normalWorld; //linear part for (i=0;i<3;i++) { if (m_linearLimits.isLimited(i)) { if (m_useLinearReferenceFrameA) normalWorld = m_calculatedTransformA.getBasis().getColumn(i); else normalWorld = m_calculatedTransformB.getBasis().getColumn(i); buildLinearJacobian( m_jacLinear[i],normalWorld , pivotAInW,pivotBInW); } } // angular part for (i=0;i<3;i++) { //calculates error angle if (testAngularLimitMotor(i)) { normalWorld = this->getAxis(i); // Create angular atom buildAngularJacobian(m_jacAng[i],normalWorld); } } } #endif //__SPU__ } void btGeneric6DofConstraint::getInfo1 (btConstraintInfo1* info) { if (m_useSolveConstraintObsolete) { info->m_numConstraintRows = 0; info->nub = 0; } else { //prepare constraint calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform()); info->m_numConstraintRows = 0; info->nub = 6; int i; //test linear limits for(i = 0; i < 3; i++) { if(m_linearLimits.needApplyForce(i)) { info->m_numConstraintRows++; info->nub--; } } //test angular limits for (i=0;i<3 ;i++ ) { if(testAngularLimitMotor(i)) { info->m_numConstraintRows++; info->nub--; } } } } void btGeneric6DofConstraint::getInfo1NonVirtual (btConstraintInfo1* info) { if (m_useSolveConstraintObsolete) { info->m_numConstraintRows = 0; info->nub = 0; } else { //pre-allocate all 6 info->m_numConstraintRows = 6; info->nub = 0; } } void btGeneric6DofConstraint::getInfo2 (btConstraintInfo2* info) { getInfo2NonVirtual(info,m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform(), m_rbA.getLinearVelocity(),m_rbB.getLinearVelocity(),m_rbA.getAngularVelocity(), m_rbB.getAngularVelocity()); } void btGeneric6DofConstraint::getInfo2NonVirtual (btConstraintInfo2* info, const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB) { btAssert(!m_useSolveConstraintObsolete); //prepare constraint calculateTransforms(transA,transB); int i; //test linear limits for(i = 0; i < 3; i++) { if(m_linearLimits.needApplyForce(i)) { } } //test angular limits for (i=0;i<3 ;i++ ) { if(testAngularLimitMotor(i)) { } } int row = setLinearLimits(info,transA,transB,linVelA,linVelB,angVelA,angVelB); setAngularLimits(info, row,transA,transB,linVelA,linVelB,angVelA,angVelB); } int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB) { int row = 0; //solve linear limits btRotationalLimitMotor limot; for (int i=0;i<3 ;i++ ) { if(m_linearLimits.needApplyForce(i)) { // re-use rotational motor code limot.m_bounce = btScalar(0.f); limot.m_currentLimit = m_linearLimits.m_currentLimit[i]; limot.m_currentPosition = m_linearLimits.m_currentLinearDiff[i]; limot.m_currentLimitError = m_linearLimits.m_currentLimitError[i]; limot.m_damping = m_linearLimits.m_damping; limot.m_enableMotor = m_linearLimits.m_enableMotor[i]; limot.m_ERP = m_linearLimits.m_restitution; limot.m_hiLimit = m_linearLimits.m_upperLimit[i]; limot.m_limitSoftness = m_linearLimits.m_limitSoftness; limot.m_loLimit = m_linearLimits.m_lowerLimit[i]; limot.m_maxLimitForce = btScalar(0.f); limot.m_maxMotorForce = m_linearLimits.m_maxMotorForce[i]; limot.m_targetVelocity = m_linearLimits.m_targetVelocity[i]; btVector3 axis = m_calculatedTransformA.getBasis().getColumn(i); row += get_limit_motor_info2(&limot, transA,transB,linVelA,linVelB,angVelA,angVelB , info, row, axis, 0); } } return row; } int btGeneric6DofConstraint::setAngularLimits(btConstraintInfo2 *info, int row_offset, const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB) { btGeneric6DofConstraint * d6constraint = this; int row = row_offset; //solve angular limits for (int i=0;i<3 ;i++ ) { if(d6constraint->getRotationalLimitMotor(i)->needApplyTorques()) { btVector3 axis = d6constraint->getAxis(i); row += get_limit_motor_info2( d6constraint->getRotationalLimitMotor(i), transA,transB,linVelA,linVelB,angVelA,angVelB, info,row,axis,1); } } return row; } void btGeneric6DofConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep) { if (m_useSolveConstraintObsolete) { m_timeStep = timeStep; //calculateTransforms(); int i; // linear btVector3 pointInA = m_calculatedTransformA.getOrigin(); btVector3 pointInB = m_calculatedTransformB.getOrigin(); btScalar jacDiagABInv; btVector3 linear_axis; for (i=0;i<3;i++) { if (m_linearLimits.isLimited(i)) { jacDiagABInv = btScalar(1.) / m_jacLinear[i].getDiagonal(); if (m_useLinearReferenceFrameA) linear_axis = m_calculatedTransformA.getBasis().getColumn(i); else linear_axis = m_calculatedTransformB.getBasis().getColumn(i); m_linearLimits.solveLinearAxis( m_timeStep, jacDiagABInv, m_rbA,bodyA,pointInA, m_rbB,bodyB,pointInB, i,linear_axis, m_AnchorPos); } } // angular btVector3 angular_axis; btScalar angularJacDiagABInv; for (i=0;i<3;i++) { if (m_angularLimits[i].needApplyTorques()) { // get axis angular_axis = getAxis(i); angularJacDiagABInv = btScalar(1.) / m_jacAng[i].getDiagonal(); m_angularLimits[i].solveAngularLimits(m_timeStep,angular_axis,angularJacDiagABInv, &m_rbA,bodyA,&m_rbB,bodyB); } } } } void btGeneric6DofConstraint::updateRHS(btScalar timeStep) { (void)timeStep; } btVector3 btGeneric6DofConstraint::getAxis(int axis_index) const { return m_calculatedAxis[axis_index]; } btScalar btGeneric6DofConstraint::getRelativePivotPosition(int axisIndex) const { return m_calculatedLinearDiff[axisIndex]; } btScalar btGeneric6DofConstraint::getAngle(int axisIndex) const { return m_calculatedAxisAngleDiff[axisIndex]; } void btGeneric6DofConstraint::calcAnchorPos(void) { btScalar imA = m_rbA.getInvMass(); btScalar imB = m_rbB.getInvMass(); btScalar weight; if(imB == btScalar(0.0)) { weight = btScalar(1.0); } else { weight = imA / (imA + imB); } const btVector3& pA = m_calculatedTransformA.getOrigin(); const btVector3& pB = m_calculatedTransformB.getOrigin(); m_AnchorPos = pA * weight + pB * (btScalar(1.0) - weight); return; } void btGeneric6DofConstraint::calculateLinearInfo() { m_calculatedLinearDiff = m_calculatedTransformB.getOrigin() - m_calculatedTransformA.getOrigin(); m_calculatedLinearDiff = m_calculatedTransformA.getBasis().inverse() * m_calculatedLinearDiff; for(int i = 0; i < 3; i++) { m_linearLimits.m_currentLinearDiff[i] = m_calculatedLinearDiff[i]; m_linearLimits.testLimitValue(i, m_calculatedLinearDiff[i]); } } int btGeneric6DofConstraint::get_limit_motor_info2( btRotationalLimitMotor * limot, const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB, btConstraintInfo2 *info, int row, btVector3& ax1, int rotational) { int srow = row * info->rowskip; int powered = limot->m_enableMotor; int limit = limot->m_currentLimit; if (powered || limit) { // if the joint is powered, or has joint limits, add in the extra row btScalar *J1 = rotational ? info->m_J1angularAxis : info->m_J1linearAxis; btScalar *J2 = rotational ? info->m_J2angularAxis : 0; J1[srow+0] = ax1[0]; J1[srow+1] = ax1[1]; J1[srow+2] = ax1[2]; if(rotational) { J2[srow+0] = -ax1[0]; J2[srow+1] = -ax1[1]; J2[srow+2] = -ax1[2]; } if((!rotational)) { btVector3 ltd; // Linear Torque Decoupling vector btVector3 c = m_calculatedTransformB.getOrigin() - transA.getOrigin(); ltd = c.cross(ax1); info->m_J1angularAxis[srow+0] = ltd[0]; info->m_J1angularAxis[srow+1] = ltd[1]; info->m_J1angularAxis[srow+2] = ltd[2]; c = m_calculatedTransformB.getOrigin() - transB.getOrigin(); ltd = -c.cross(ax1); info->m_J2angularAxis[srow+0] = ltd[0]; info->m_J2angularAxis[srow+1] = ltd[1]; info->m_J2angularAxis[srow+2] = ltd[2]; } // if we're limited low and high simultaneously, the joint motor is // ineffective if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = 0; info->m_constraintError[srow] = btScalar(0.f); if (powered) { info->cfm[srow] = 0.0f; if(!limit) { btScalar tag_vel = rotational ? limot->m_targetVelocity : -limot->m_targetVelocity; btScalar mot_fact = getMotorFactor( limot->m_currentPosition, limot->m_loLimit, limot->m_hiLimit, tag_vel, info->fps * info->erp); info->m_constraintError[srow] += mot_fact * limot->m_targetVelocity; info->m_lowerLimit[srow] = -limot->m_maxMotorForce; info->m_upperLimit[srow] = limot->m_maxMotorForce; } } if(limit) { btScalar k = info->fps * limot->m_ERP; if(!rotational) { info->m_constraintError[srow] += k * limot->m_currentLimitError; } else { info->m_constraintError[srow] += -k * limot->m_currentLimitError; } info->cfm[srow] = 0.0f; if (limot->m_loLimit == limot->m_hiLimit) { // limited low and high simultaneously info->m_lowerLimit[srow] = -SIMD_INFINITY; info->m_upperLimit[srow] = SIMD_INFINITY; } else { if (limit == 1) { info->m_lowerLimit[srow] = 0; info->m_upperLimit[srow] = SIMD_INFINITY; } else { info->m_lowerLimit[srow] = -SIMD_INFINITY; info->m_upperLimit[srow] = 0; } // deal with bounce if (limot->m_bounce > 0) { // calculate joint velocity btScalar vel; if (rotational) { vel = angVelA.dot(ax1); //make sure that if no body -> angVelB == zero vec // if (body1) vel -= angVelB.dot(ax1); } else { vel = linVelA.dot(ax1); //make sure that if no body -> angVelB == zero vec // if (body1) vel -= linVelB.dot(ax1); } // only apply bounce if the velocity is incoming, and if the // resulting c[] exceeds what we already have. if (limit == 1) { if (vel < 0) { btScalar newc = -limot->m_bounce* vel; if (newc > info->m_constraintError[srow]) info->m_constraintError[srow] = newc; } } else { if (vel > 0) { btScalar newc = -limot->m_bounce * vel; if (newc < info->m_constraintError[srow]) info->m_constraintError[srow] = newc; } } } } } return 1; } else return 0; }
[ [ [ 1, 893 ] ] ]
2b55bbb285ea04beaddceb4d8891e30381c72771
13613feed38f491488f4d5c45e273bc984bff4d9
/c/msnemo/get_topo/prog_cdf.cpp
aa12a4435bae1a883df298057d6ec3dae67ea93e
[]
no_license
guillaume7/griflet
93fb1c2e3d9b600c3391a3b4a0dc52c32326690e
24adda02dd9857b20cbc2984cb010271a28cdbe0
refs/heads/master
2016-08-11T02:09:43.741569
2011-12-09T00:26:59
2011-12-09T00:26:59
44,432,686
0
0
null
null
null
null
UTF-8
C++
false
false
21,020
cpp
#include "stdafx.h" /////////////////////////////////////////////////////////////////////////////////////////// //create and open functions________________________________________________________________ /////////////////////////////////////////////////////////////////////////////////////////// /******************************************************************************************/ //creates the nc_file structure of the topo source //opens the topo source nc_file, ready for reading... void set_topo(s_nc_input_t *topo){ /******************************************************************************************/ fill_file_s(&(topo->file), "earth_topo.nc", READ); fill_var_xy_s(&(topo->r), "ROSE"); fill_att_s(&(topo->r.missing), "missing_value"); fill_att_s(&(topo->r.fill), "_FillValue"); fill_att_s(&(topo->r.units), "units"); fill_dim_s(&(topo->x),"ETOPO05_X"); fill_att_s(&(topo->x.axis), "axis"); fill_att_s(&(topo->x.units), "units"); fill_dim_s(&(topo->y),"ETOPO05_Y1_2160"); fill_att_s(&(topo->y.axis), "axis"); fill_att_s(&(topo->y.units), "units"); return; } /******************************************************************************************/ //creates the nc_file structure of the dims source //opens the dims source nc_file, ready for reading... void set_dims(s_nc_input_d *dims){ /******************************************************************************************/ fill_file_s(&(dims->file), "96_u.cdf", READ); fill_var_txyz_s(&(dims->var), "U"); fill_att_s(&(dims->var.missing), "missing_value"); fill_att_s(&(dims->var.fill), "_FillValue"); fill_att_s(&(dims->var.missing), "units"); fill_dim_s(&(dims->date), "TIME1"); fill_att_s(&(dims->date.axis), "axis"); fill_att_s(&(dims->date.units), "units"); fill_dim_s(&(dims->x), "XU_I180_540"); fill_att_s(&(dims->x.axis), "axis"); fill_att_s(&(dims->x.units), "units"); fill_dim_s(&(dims->y), "YU_J1_199"); fill_att_s(&(dims->y.axis), "axis"); fill_att_s(&(dims->y.units), "units"); fill_dim_s(&(dims->y_edges), "YU_J1_199edges"); fill_dim_s(&(dims->z), "ZT_K1_30"); fill_att_s(&(dims->z.axis), "axis"); fill_att_s(&(dims->z.units), "units"); fill_dim_s(&(dims->z_edges), "ZT_K1_30edges"); return; } /******************************************************************************************/ //creates the target cdf_file; defines the dims (copied from the 98_u.cdf) and the vars. //creates the cdf_file structure of the target; ready for writing... void set_mask(s_nc_result *mask, s_nc_input_d *dims){ /*****************************************************************************************/ int status; int dimshape[3]; //CREATE A NEW .cdf FILE new_file_s(&(mask->file), "topo.cdf"); //DEFINE DIMENSIONS copy_dim(&(mask->x), &(dims->x)); copy_att(&(mask->x.axis),&(dims->x.axis)); copy_att(&(mask->x.units),&(dims->x.units)); copy_dim(&(mask->y), &(dims->y)); copy_att(&(mask->y.axis),&(dims->y.axis)); copy_att(&(mask->y.units),&(dims->y.units)); copy_dim(&(mask->y_edges), &(dims->y_edges)); copy_dim(&(mask->z), &(dims->z)); copy_att(&(mask->z.axis),&(dims->z.axis)); copy_att(&(mask->z.units),&(dims->z.units)); copy_dim(&(mask->z_edges), &(dims->z_edges)); //DEFINE VARIABLE dimshape[0] = mask->z.id; dimshape[1] = mask->y.id; dimshape[2] = mask->x.id; status = nc_def_var(mask->file.ncid, "LANDMASK", NC_SHORT, 3, dimshape, &(mask->m.id)); CDF_ERROR //DEFINE VAR ATTRIBUTES (filling and missing value only) put_fill_att_short(&(mask->m.fill)); copy_att(&(mask->m.missing), &(dims->var.missing)); //LEAVE DEF MODE status = nc_enddef(mask->file.ncid); CDF_ERROR //FILL STRUCTURE (ici, faire inq_dim et inq_var) inq_file_s(&(mask->file)); inq_var_xyz(&(mask->m)); inq_att(&(mask->m.fill)); inq_att(&(mask->m.missing)); inq_dim(&(mask->x)); inq_att(&(mask->x.axis)); inq_att(&(mask->x.units)); inq_dim(&(mask->y)); inq_att(&(mask->y.axis)); inq_att(&(mask->y.units)); inq_dim(&(mask->y_edges)); inq_dim(&(mask->z)); inq_att(&(mask->z.axis)); inq_att(&(mask->z.units)); inq_dim(&(mask->z_edges)); return; } /********************************************************************************************/ /*****************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////// //Construct the nc structures______________________________________________________________ /////////////////////////////////////////////////////////////////////////////////////////// void build_attribute(s_nc_attribute* att_p, int* fid_p, int* vid_p){ att_p->file_id_p = fid_p; att_p->var_id_p = vid_p; return; } void build_dimension(s_nc_dimension* d_p, s_nc_file* f_p){ d_p->file_id_p = &(f_p->ncid); build_attribute( &(d_p->axis), d_p->file_id_p, &(d_p->varid)); build_attribute( &(d_p->units),d_p->file_id_p, &(d_p->varid)); return; } void build_variable_txyz(s_nc_variable_txyz* v_p, s_nc_file* f_p, int* t_p, int* x_p, int* y_p, int* z_p){ v_p->file_id_p = &(f_p->ncid); v_p->t_id_p = t_p; v_p->x_id_p = x_p; v_p->y_id_p = y_p; v_p->z_id_p = z_p; build_attribute( &(v_p->missing), v_p->file_id_p, &(v_p->id)); build_attribute( &(v_p->fill), v_p->file_id_p, &(v_p->id)); build_attribute( &(v_p->units), v_p->file_id_p, &(v_p->id)); return; } void build_variable_xyz(s_nc_variable_xyz* v_p, s_nc_file* f_p, int* x_p, int* y_p, int* z_p){ v_p->file_id_p = &(f_p->ncid); v_p->x_id_p = x_p; v_p->y_id_p = y_p; v_p->z_id_p = z_p; build_attribute( &(v_p->missing), v_p->file_id_p, &(v_p->id)); build_attribute( &(v_p->fill), v_p->file_id_p, &(v_p->id)); build_attribute( &(v_p->units), v_p->file_id_p, &(v_p->id)); return; } void build_variable_xy(s_nc_variable_xy* v_p, s_nc_file* f_p, int* x_p, int* y_p){ v_p->file_id_p = &(f_p->ncid); v_p->x_id_p = x_p; v_p->y_id_p = y_p; build_attribute( &(v_p->missing), v_p->file_id_p, &(v_p->id)); build_attribute( &(v_p->fill), v_p->file_id_p, &(v_p->id)); build_attribute( &(v_p->units), v_p->file_id_p, &(v_p->id)); return; } void build_input_t(s_nc_input_t* topo){ build_variable_xy( &(topo->r), &(topo->file), &(topo->x.id), &(topo->y.id)); build_dimension( &(topo->x), &(topo->file)); build_dimension( &(topo->y), &(topo->file)); return; } void build_input_d(s_nc_input_d* dims){ build_variable_txyz( &(dims->var), &(dims->file), &(dims->date.id), &(dims->x.id), &(dims->y.id), &(dims->z.id)); build_dimension( &(dims->date), &(dims->file)); build_dimension( &(dims->x), &(dims->file)); build_dimension( &(dims->y), &(dims->file)); build_dimension( &(dims->z), &(dims->file)); build_dimension( &(dims->y_edges), &(dims->file)); build_dimension( &(dims->z_edges), &(dims->file)); return; } void build_result( s_nc_result* mask){ build_variable_xyz( &(mask->m), &(mask->file), &(mask->x.id), &(mask->y.id), &(mask->z.id)); build_dimension( &(mask->x), &(mask->file)); build_dimension( &(mask->y), &(mask->file)); build_dimension( &(mask->z), &(mask->file)); build_dimension( &(mask->y_edges), &(mask->file)); build_dimension( &(mask->z_edges), &(mask->file)); return; } /********************************************************************************************/ /********************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////// //create the nc structures________________________________________________________________ /////////////////////////////////////////////////////////////////////////////////////////// /******************************************************************************************/ //creates a new nc_file void new_file_s(s_nc_file* f_p, char* str_p){ /******************************************************************************************/ int status; //CREATE FILE strcpy(f_p->name_p, str_p); status = nc_create(f_p->name_p, NC_CLOBBER, &(f_p->ncid)); CDF_ERROR return; } /******************************************************************************************/ //creates the nc_file structure void fill_file_s(s_nc_file* f_p, char* str_p, byte_t n){ /******************************************************************************************/ int status; //OPEN strcpy(f_p->name_p, str_p); if(n==READ) status = nc_open(f_p->name_p,NC_NOWRITE, &(f_p->ncid)); else status = nc_open(f_p->name_p,NC_WRITE, &(f_p->ncid)); CDF_ERROR //INQ_FILE inq_file_s(f_p); return; } /******************************************************************************************/ //creates the nc_dim structure void fill_dim_s(s_nc_dimension* d_p, char* str_p){ /******************************************************************************************/ int status; //INQ_DIM_ID status = nc_inq_dimid( *(d_p->file_id_p), str_p, &(d_p->id) ); CDF_ERROR //INQ_VARID status = nc_inq_varid( *(d_p->file_id_p), str_p, &(d_p->varid) ); CDF_ERROR //INQ_DIM inq_dim(d_p); return; } /******************************************************************************************/ //creates the nc_var_xy structure void fill_var_xy_s(s_nc_variable_xy* v_p, char* str_p){ /******************************************************************************************/ int status; //INQ_VARID status = nc_inq_varid( *(v_p->file_id_p), str_p, &(v_p->id) ); CDF_ERROR //INQ_VAR inq_var_xy(v_p); return; } /******************************************************************************************/ //creates the nc_var_xyz structure void fill_var_xyz_s(s_nc_variable_xyz* v_p, char* str_p){ /******************************************************************************************/ int status; //INQ_VARID status = nc_inq_varid( *(v_p->file_id_p), str_p, &(v_p->id) ); CDF_ERROR //INQ_VAR inq_var_xyz(v_p); return; } /******************************************************************************************/ //creates the nc_var_txyz structure void fill_var_txyz_s(s_nc_variable_txyz* v_p, char* str_p){ /******************************************************************************************/ int status; //INQ_VARID status = nc_inq_varid( *(v_p->file_id_p), str_p, &(v_p->id) ); CDF_ERROR //INQ_VAR inq_var_txyz(v_p); return; } /******************************************************************************************/ //creates the nc_dim structure void fill_att_s(s_nc_attribute* a_p, char* str_p){ /******************************************************************************************/ int status; //INQ_ATT_ID strcpy(a_p->name_p, str_p); status = nc_inq_attid( *(a_p->file_id_p), *(a_p->var_id_p), a_p->name_p, &(a_p->num)); CDF_ERROR //INQ_ATT inq_att(a_p); return; } /******************************************************************************************/ //Creates the fillvalue attribute for short integers void put_fill_att_short(s_nc_attribute* at_p){ /******************************************************************************************/ int status; byte_t fill; fill = -32767; strcpy(at_p->name_p, "_FillValue"); status = nc_put_att_short( *(at_p->file_id_p), *(at_p->var_id_p), at_p->name_p, NC_SHORT, 1, &fill); CDF_ERROR return; } /********************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////// //Construct the nc copy structures______________________________________________________________ /////////////////////////////////////////////////////////////////////////////////////////// /********************************************************************************************/ //Copies the dimension void copy_dim( s_nc_dimension *target, s_nc_dimension *source){ /********************************************************************************************/ int status; //DEFINE DIMENSION status = nc_def_dim( *(target->file_id_p), source->name_p, source->length, &(target->id)); CDF_ERROR //DEFINE RESPECTIVE VARIABLE status = nc_def_var( *(target->file_id_p), source->name_p, source->type, source->ndims, &(target->id), &(target->varid)); //Ici, un prob? CDF_ERROR return; } /********************************************************************************************/ //Copies the variable void copy_var_txyz( s_nc_variable_txyz *target, s_nc_variable_txyz *source){ /********************************************************************************************/ int status; int dimshape[4]; //DEF VAR INFO dimshape[0] = *(target->t_id_p); //time dimshape[1] = *(target->z_id_p); //z dimshape[2] = *(target->y_id_p); //y dimshape[3] = *(target->x_id_p); //x //DEFINE RESPECTIVE VARIABLE status = nc_def_var( *(target->file_id_p), source->name_p, source->type, source->ndims, dimshape, &(target->id)); CDF_ERROR return; } /********************************************************************************************/ //Copies the variable void copy_var_xyz( s_nc_variable_xyz *target, s_nc_variable_xyz *source){ /********************************************************************************************/ int status; int dimshape[3]; //DEF VAR INFO dimshape[0] = *(target->z_id_p); //z dimshape[1] = *(target->y_id_p); //y dimshape[2] = *(target->x_id_p); //x //DEFINE RESPECTIVE VARIABLE status = nc_def_var( *(target->file_id_p), source->name_p, source->type, source->ndims, dimshape, &(target->id)); CDF_ERROR return; } /********************************************************************************************/ //Copies the variable void copy_var_xy( s_nc_variable_xy *target, s_nc_variable_xy *source){ /********************************************************************************************/ int status; int dimshape[2]; //DEF VAR INFO dimshape[0] = *(target->y_id_p); //y dimshape[1] = *(target->x_id_p); //x //DEFINE RESPECTIVE VARIABLE status = nc_def_var( *(target->file_id_p), source->name_p, source->type, source->ndims, dimshape, &(target->id)); CDF_ERROR return; } /********************************************************************************************/ //Copies the attribute void copy_att( s_nc_attribute *target, s_nc_attribute *source){ /********************************************************************************************/ int status; //DEFINE ATTRIBUTE strcpy(target->name_p, source->name_p); status = nc_copy_att( *(source->file_id_p), *(source->var_id_p), target->name_p, *(target->file_id_p), *(target->var_id_p)); CDF_ERROR return; } /********************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////// //Fill'em with the inq structures__________________________________________________________ /////////////////////////////////////////////////////////////////////////////////////////// /********************************************************************************************/ //Inqs the given file void inq_file_s( s_nc_file* f_p){ /********************************************************************************************/ int status; //INQ_FILE status = nc_inq(f_p->ncid, &(f_p->ndims), &(f_p->nvars),&(f_p->ngatts), &(f_p->unlimdimip)); CDF_ERROR return; } /********************************************************************************************/ //Inqs the given dimension void inq_dim( s_nc_dimension* d_p){ /********************************************************************************************/ int status; //INQ_DIM status = nc_inq_dim( *(d_p->file_id_p), d_p->id, d_p->name_p, &(d_p->length) ); CDF_ERROR; //INQ_VAR status = nc_inq_var( *(d_p->file_id_p), d_p->varid, d_p->name_p, &(d_p->type), &(d_p->ndims), d_p->dimshape_p, &(d_p->natts)); CDF_ERROR return; } /********************************************************************************************/ //Inqs the given variable void inq_var_txyz( s_nc_variable_txyz* v_p){ /********************************************************************************************/ int status; //INQ_VAR status = nc_inq_var( *(v_p->file_id_p), v_p->id, v_p->name_p, &(v_p->type), &(v_p->ndims), v_p->dimshape_p, &(v_p->natts)); CDF_ERROR return; } /********************************************************************************************/ //Inqs the given variable void inq_var_xyz( s_nc_variable_xyz* v_p){ /********************************************************************************************/ int status; //INQ_VAR status = nc_inq_var( *(v_p->file_id_p), v_p->id, v_p->name_p, &(v_p->type), &(v_p->ndims), v_p->dimshape_p, &(v_p->natts)); CDF_ERROR return; } /********************************************************************************************/ //Inqs the given variable void inq_var_xy( s_nc_variable_xy* v_p){ /********************************************************************************************/ int status; //INQ_VAR status = nc_inq_var( *(v_p->file_id_p), v_p->id, v_p->name_p, &(v_p->type), &(v_p->ndims), v_p->dimshape_p, &(v_p->natts)); CDF_ERROR return; } /********************************************************************************************/ //Inqs the given attribute void inq_att( s_nc_attribute* a_p){ /********************************************************************************************/ int status; //INQ_ATT status = nc_inq_att( *(a_p->file_id_p), *(a_p->var_id_p), a_p->name_p, &(a_p->type), &(a_p->length)); CDF_ERROR return; } /********************************************************************************************/ /********************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////// //Close'em_________________________________________________________________________________ /////////////////////////////////////////////////////////////////////////////////////////// /********************************************************************************************/ //close the target files void close(s_nc_result *mask, s_nc_input_d *dims, s_nc_input_t *topo){ /********************************************************************************************/ int status; //Close the result file status = nc_close(mask->file.ncid); CDF_ERROR //Close the dimensions file status = nc_close(dims->file.ncid); CDF_ERROR //Close the source file status = nc_close(topo->file.ncid); CDF_ERROR return; } /********************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////// //Copies'em_________________________________________________________________________________ /////////////////////////////////////////////////////////////////////////////////////////// /***********************************************************************************************/ //Copies the dims (and respective vars) from the dims source to the target. void copy_data(s_nc_input_d* source_p, s_nc_result* target_p){ /***********************************************************************************************/ copy_single_data( &(target_p->x), &(source_p->x)); copy_single_data( &(target_p->y), &(source_p->y)); copy_single_data( &(target_p->y_edges), &(source_p->y_edges)); copy_single_data( &(target_p->z), &(source_p->z)); copy_single_data( &(target_p->z_edges), &(source_p->z_edges)); return; } /***********************************************************************************************/ //Copies the dims (and respective vars) from the dims source to the target. void copy_single_data(s_nc_dimension* target_p, s_nc_dimension* source_p){ /***********************************************************************************************/ int status; double* temp_p; //alloc memory temp_p = (double*) malloc(source_p->length*sizeof(double)); //read status = nc_get_var_double(*(source_p->file_id_p), source_p->varid, temp_p); CDF_ERROR //write status = nc_put_var_double(*(target_p->file_id_p), target_p->varid, temp_p); CDF_ERROR //free memory free(temp_p); return; }
[ [ [ 1, 614 ] ] ]
1637a7ce0b2934e0bfd314868851bdb05d426508
9a48be80edc7692df4918c0222a1640545384dbb
/Libraries/Boost1.40/libs/serialization/test/test_binary.cpp
f95076be1c29fa68ceac77bebafa6bdc83eb305b
[ "BSL-1.0" ]
permissive
fcrick/RepSnapper
05e4fb1157f634acad575fffa2029f7f655b7940
a5809843f37b7162f19765e852b968648b33b694
refs/heads/master
2021-01-17T21:42:29.537504
2010-06-07T05:38:05
2010-06-07T05:38:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,921
cpp
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // test_simple_class.cpp // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // should pass compilation and execution #include <cstdlib> // for rand(), NULL #include <fstream> #include <boost/config.hpp> #include <cstdio> // remove #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ using ::rand; using ::remove; } #endif #include "test_tools.hpp" #include <boost/serialization/nvp.hpp> #include <boost/serialization/binary_object.hpp> class A { friend class boost::serialization::access; char data[150]; // note: from an aesthetic perspective, I would much prefer to have this // defined out of line. Unfortunately, this trips a bug in the VC 6.0 // compiler. So hold our nose and put it her to permit running of tests. template<class Archive> void serialize(Archive & ar, const unsigned int /* file_version */){ ar & boost::serialization::make_nvp( "data", boost::serialization::make_binary_object(data, sizeof(data)) ); } public: A(); bool operator==(const A & rhs) const; }; A::A(){ int i = sizeof(data); while(i-- > 0) data[i] = 0xff & std::rand(); } bool A::operator==(const A & rhs) const { int i = sizeof(data); while(i-- > 0) if(data[i] != rhs.data[i]) return false; return true; } int test_main( int /* argc */, char* /* argv */[] ) { const char * testfile = boost::archive::tmpnam(NULL); BOOST_REQUIRE(NULL != testfile); const A a; char s1[] = "a"; char s2[] = "ab"; char s3[] = "abc"; char s4[] = "abcd"; const int i = 12345; A a1; char s1_1[10]; char s1_2[10]; char s1_3[10]; char s1_4[10]; int i1 = 34790; { test_ostream os(testfile, TEST_STREAM_FLAGS); test_oarchive oa(os, TEST_ARCHIVE_FLAGS); boost::serialization::make_nvp( "s1", boost::serialization::make_binary_object(s1, sizeof(s1)) ); oa << boost::serialization::make_nvp( "s2", boost::serialization::make_binary_object(s2, sizeof(s2)) ); oa << boost::serialization::make_nvp( "s3", boost::serialization::make_binary_object(s3, sizeof(s3)) ); oa << boost::serialization::make_nvp( "s4", boost::serialization::make_binary_object(s4, sizeof(s4)) ); oa << BOOST_SERIALIZATION_NVP(a); // note: add a little bit on the end of the archive to detect // failure of text mode binary. oa << BOOST_SERIALIZATION_NVP(i); } { test_istream is(testfile, TEST_STREAM_FLAGS); test_iarchive ia(is, TEST_ARCHIVE_FLAGS); boost::serialization::make_nvp( "s1", boost::serialization::make_binary_object(s1_1, sizeof(s1)) ); ia >> boost::serialization::make_nvp( "s2", boost::serialization::make_binary_object(s1_2, sizeof(s2)) ); ia >> boost::serialization::make_nvp( "s3", boost::serialization::make_binary_object(s1_3, sizeof(s3)) ); ia >> boost::serialization::make_nvp( "s4", boost::serialization::make_binary_object(s1_4, sizeof(s4)) ); ia >> BOOST_SERIALIZATION_NVP(a1); // note: add a little bit on the end of the archive to detect // failure of text mode binary. ia >> BOOST_SERIALIZATION_NVP(i1); } BOOST_CHECK(i == i1); BOOST_CHECK(a == a1); std::remove(testfile); return EXIT_SUCCESS; } // EOF
[ "metrix@Blended.(none)" ]
[ [ [ 1, 125 ] ] ]
138bd50407e66c7f5f5ba0817631c7f8b885c08b
28a7ffd179897080613df18ceb648b40ad9c5ee4
/CGRambler2.0/Camera.h
97ad51547d7094b8d24b1a4c51327121bd2224e3
[]
no_license
MagnusTiberius/cgrambler
fd9978b600e7fcae0d5d580c316e1ed74739a429
0c1c8e73e6b5d31125b2d2d63d56f546fd1df42a
refs/heads/master
2021-01-19T09:44:57.117749
2011-02-19T06:04:45
2011-02-19T06:04:45
37,160,716
0
0
null
null
null
null
GB18030
C++
false
false
3,353
h
/* .____ ____ ____ __ ___ ___ __ /\ _`\ /\ _`\ /\ _`\ /\ \ /\_ \ /'___`\ /'__`\ \ \ \/\_\\ \ \L\_\ \ \L\ \ __ ___ ___\ \ \____\//\ \ __ _ __ /\_\ /\ \ /\ \/\ \ .\ \ \/_/_\ \ \L_L\ \ , / /'__`\ /' __` __`\ \ '__`\ \ \ \ /'__`\/\`'__\ \/_/// /__ \ \ \ \ \ ..\ \ \L\ \\ \ \/, \ \ \\ \ /\ \L\.\_/\ \/\ \/\ \ \ \L\ \ \_\ \_/\ __/\ \ \/ // /_\ \__\ \ \_\ \ ...\ \____/ \ \____/\ \_\ \_\ \__/.\_\ \_\ \_\ \_\ \_,__/ /\____\ \____\\ \_\ /\______/\_\\ \____/ ....\/___/ \/___/ \/_/\/ /\/__/\/_/\/_/\/_/\/_/\/___/ \/____/\/____/ \/_/ \/_____/\/_/ \/___/ =关于官方网站:= http://code.google.com/p/cgrambler/ 是CGRambler2.0的官方网站,你可以在那下载到本项目的最新源码,高清截图。请统一在官方网站发表评论,以便本人回复。 =项目简介:= CGRambler2.0是继CGRambler1.0之后,于2011年1月18号开始开发的一款基于DirectX 10的图形渲染引擎,关于CGRambler1.0,请浏览http://user.qzone.qq.com/499482794/blog/1285834895 相比CGRambler1.0,CGRambler2.0经过重新架构(几乎是重写),将更加注重引擎构架本身,即“看不见的渲染艺术”,而不是华丽的Shader。另外,本项目采用开源方式,可自由用于商业或非商业用途。 =关于作者:= 华南师范大学 08级 李海全 [email protected] ****************************************************************************************************************************************************************************************************************************************************************************************************** =Brief Introduction to CGRambler2.0:= CGRambler2.0 is a DirectX 10 based rendering engine under developing since 2011/1/18, for the previous version of CGRambler1.0,please see http://user.qzone.qq.com/499482794/blog/1285834895 Compare with CGrambler1.0, CGRambler2.0 have been designed from the very begining. It will focus on the architecture of the engine itself, not the gorgeous shaders. In addition, this project is completely open source, you can use it for commercial or non-commercial without permission. =About the official page:= http://code.google.com/p/cgrambler/ is the official page of CGRambler2.0, you can download the newest source code and screenshots of this project from that site.Please comment this project at the official page, so that I can reply. =About the author:= South China Normal University, Grade 2008, HaiQuan Li, [email protected] */ #pragma once #include "DXUT.h" #include "DXUTcamera.h" #include "SmartPtr.h" #include "Common.h" class Camera: public CFirstPersonCamera { FLOAT mNear; FLOAT mFar; public: Camera( D3DXVECTOR3 &vecEye=D3DXVECTOR3(0.0f,0.0f,-10.0f), D3DXVECTOR3 &vecAt=D3DXVECTOR3(0.0f,0.0f,0.0f),FLOAT fNear=0.1f,FLOAT fFar=1000.0f); virtual ~Camera(); void setPosition( D3DXVECTOR3 & pos); void setLookAt( D3DXVECTOR3 &lookAt); D3DXVECTOR3 getPosition(); D3DXVECTOR3 getLookAt(); void onD3D10SwapChainResized(); }; #ifdef USE_SMART_POINTER typedef SmartPtr<Camera> CameraPtr; #else typedef Camera* CameraPtr; #endif
[ "cgrambler@ae0db8de-29cd-45ee-2585-6d32dff01e80" ]
[ [ [ 1, 59 ] ] ]
0ca511289347e81c14f4b8742aaf7e4cfd61d514
b4d726a0321649f907923cc57323942a1e45915b
/CODE/ImpED/StdAfx.cpp
223ee3d105c2498524a826284fde4baeef9a8281
[]
no_license
chief1983/Imperial-Alliance
f1aa664d91f32c9e244867aaac43fffdf42199dc
6db0102a8897deac845a8bd2a7aa2e1b25086448
refs/heads/master
2016-09-06T02:40:39.069630
2010-10-06T22:06:24
2010-10-06T22:06:24
967,775
2
0
null
null
null
null
UTF-8
C++
false
false
1,278
cpp
/* * Copyright (C) Volition, Inc. 1999. All rights reserved. * * All source code herein is the property of Volition, Inc. You may not sell * or otherwise commercially exploit the source or things you created based on the * source. * */ /* * $Logfile: /Freespace2/code/FRED2/StdAfx.cpp $ * $Revision: 1.1.1.1 $ * $Date: 2002/07/15 03:11:03 $ * $Author: inquisitor $ * // stdafx.cpp : source file that includes just the standard includes // FRED.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information * * Above is the MFC generated notes on this file. Basically, you don't need * do touch anything here. * * $Log: StdAfx.cpp,v $ * Revision 1.1.1.1 2002/07/15 03:11:03 inquisitor * Initial FRED2 Checking * * * 2 10/07/98 6:28p Dave * Initial checkin. Renamed all relevant stuff to be Fred2 instead of * Fred. Globalized mission and campaign file extensions. Removed Silent * Threat specific code. * * 1 10/07/98 3:01p Dave * * 1 10/07/98 3:00p Dave * * 2 2/17/97 5:28p Hoffoss * Checked RCS headers, added them were missing, changing description to * something better, etc where needed. * * $NoKeywords: $ */ #include "stdafx.h"
[ [ [ 1, 45 ] ] ]
af44c4a89c343c4a91c0b812aa9a9daa89405df1
580738f96494d426d6e5973c5b3493026caf8b6a
/Include/Vcl/xmlschema99.hpp
d88cb7034d1ff2248d1539f222c98d593ff62f35
[]
no_license
bravesoftdz/cbuilder-vcl
6b460b4d535d17c309560352479b437d99383d4b
7b91ef1602681e094a6a7769ebb65ffd6f291c59
refs/heads/master
2021-01-10T14:21:03.726693
2010-01-11T11:23:45
2010-01-11T11:23:45
48,485,606
2
1
null
null
null
null
UTF-8
C++
false
false
4,886
hpp
// Borland C++ Builder // Copyright (c) 1995, 2002 by Borland Software Corporation // All rights reserved // (DO NOT EDIT: machine generated header) 'XMLSchema99.pas' rev: 6.00 #ifndef XMLSchema99HPP #define XMLSchema99HPP #pragma delphiheader begin #pragma option push -w- #pragma option push -Vx #include <Classes.hpp> // Pascal unit #include <XMLIntf.hpp> // Pascal unit #include <XMLDoc.hpp> // Pascal unit #include <xmldom.hpp> // Pascal unit #include <XMLSchema.hpp> // Pascal unit #include <SysUtils.hpp> // Pascal unit #include <SysInit.hpp> // Pascal unit #include <System.hpp> // Pascal unit //-- user supplied ----------------------------------------------------------- namespace Xmlschema99 { //-- type declarations ------------------------------------------------------- class DELPHICLASS TXMLSchema1999TranslatorFactory; class PASCALIMPLEMENTATION TXMLSchema1999TranslatorFactory : public Xmlschema::TXMLSchemaTranslatorFactory { typedef Xmlschema::TXMLSchemaTranslatorFactory inherited; protected: virtual bool __fastcall CanImportFile(const WideString FileName); public: #pragma option push -w-inl /* TXMLSchemaTranslatorFactory.Create */ inline __fastcall TXMLSchema1999TranslatorFactory(TMetaClass* ImportClass, TMetaClass* ExportClass, const WideString Extension, const WideString Description) : Xmlschema::TXMLSchemaTranslatorFactory(ImportClass, ExportClass, Extension, Description) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~TXMLSchema1999TranslatorFactory(void) { } #pragma option pop }; class DELPHICLASS TXMLSchema1999Translator; class PASCALIMPLEMENTATION TXMLSchema1999Translator : public Xmlschema::TXMLSchemaTranslator { typedef Xmlschema::TXMLSchemaTranslator inherited; private: Xmlschema::_di_IXMLSchemaDef FOldSchema; protected: void __fastcall CopyAttrNodes(const Xmlintf::_di_IXMLNode SourceNode, const Xmlintf::_di_IXMLNode DestNode); void __fastcall CopyChildNodes(const Xmlintf::_di_IXMLNode SourceNode, const Xmlintf::_di_IXMLNode DestNode); void __fastcall CopyComplexType(const Xmlschema::_di_IXMLComplexTypeDef ComplexTypeDef, const Xmlintf::_di_IXMLNode DestNode); void __fastcall CopySimpleType(const Xmlschema::_di_IXMLSimpleTypeDef SimpleTypeDef, const Xmlintf::_di_IXMLNode DestNode); __property Xmlschema::_di_IXMLSchemaDef OldSchema = {read=FOldSchema}; public: virtual void __fastcall Translate(const WideString FileName, const Xmlschema::_di_IXMLSchemaDef SchemaDef); public: #pragma option push -w-inl /* TObject.Create */ inline __fastcall TXMLSchema1999Translator(void) : Xmlschema::TXMLSchemaTranslator() { } #pragma option pop #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~TXMLSchema1999Translator(void) { } #pragma option pop }; class DELPHICLASS TXMLComplexTypeDef99; class PASCALIMPLEMENTATION TXMLComplexTypeDef99 : public Xmlschema::TXMLComplexTypeDef { typedef Xmlschema::TXMLComplexTypeDef inherited; public: virtual void __fastcall AfterConstruction(void); public: #pragma option push -w-inl /* TXMLNode.Create */ inline __fastcall TXMLComplexTypeDef99(const Xmldom::_di_IDOMNode ADOMNode, const Xmldoc::TXMLNode* AParentNode, const Xmldoc::TXMLDocument* OwnerDoc) : Xmlschema::TXMLComplexTypeDef(ADOMNode, AParentNode, OwnerDoc) { } #pragma option pop #pragma option push -w-inl /* TXMLNode.CreateHosted */ inline __fastcall TXMLComplexTypeDef99(Xmldoc::TXMLNode* HostNode) : Xmlschema::TXMLComplexTypeDef(HostNode) { } #pragma option pop #pragma option push -w-inl /* TXMLNode.Destroy */ inline __fastcall virtual ~TXMLComplexTypeDef99(void) { } #pragma option pop }; class DELPHICLASS TXMLSchemaDoc99; class PASCALIMPLEMENTATION TXMLSchemaDoc99 : public Xmlschema::TXMLSchemaDoc { typedef Xmlschema::TXMLSchemaDoc inherited; protected: virtual TMetaClass* __fastcall GetChildNodeClass(const Xmldom::_di_IDOMNode Node); virtual void __fastcall CheckSchemaVersion(void); DYNAMIC void __fastcall LoadData(void); public: virtual void __fastcall AfterConstruction(void); public: #pragma option push -w-inl /* TXMLDocument.Create */ inline __fastcall TXMLSchemaDoc99(const WideString AFileName)/* overload */ : Xmlschema::TXMLSchemaDoc(AFileName) { } #pragma option pop #pragma option push -w-inl /* TXMLDocument.Destroy */ inline __fastcall virtual ~TXMLSchemaDoc99(void) { } #pragma option pop }; //-- var, const, procedure --------------------------------------------------- } /* namespace Xmlschema99 */ using namespace Xmlschema99; #pragma option pop // -w- #pragma option pop // -Vx #pragma delphiheader end. //-- end unit ---------------------------------------------------------------- #endif // XMLSchema99
[ "bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b" ]
[ [ [ 1, 128 ] ] ]
af92a5c9943317d59ee3bc0ed21a120405f6eafd
ad80c85f09a98b1bfc47191c0e99f3d4559b10d4
/code/src/node/ntexarraynode_cmds.cc
a162b2d7706a5c7f5b39dd97039ae2cbf7622309
[]
no_license
DSPNerd/m-nebula
76a4578f5504f6902e054ddd365b42672024de6d
52a32902773c10cf1c6bc3dabefd2fd1587d83b3
refs/heads/master
2021-12-07T18:23:07.272880
2009-07-07T09:47:09
2009-07-07T09:47:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,768
cc
#define N_IMPLEMENTS nTexArrayNode //------------------------------------------------------------------- // ntexarraynode_cmds.cc // (C) 2000 RadonLabs GmbH -- A.Weissflog //------------------------------------------------------------------- #include "node/ntexarraynode.h" #include "kernel/npersistserver.h" static void n_settexture(void *, nCmd *); static void n_gettexture(void *, nCmd *); static void n_setgenmipmaps(void *, nCmd *); static void n_getgenmipmaps(void *, nCmd *); static void n_sethighquality(void*, nCmd*); static void n_gethighquality(void*, nCmd*); //------------------------------------------------------------------------------ /** @scriptclass ntexarraynode @superclass nvisnode @classinfo Define textures for nshadernode. Holds all textures for the multitexture stage. MUST be used if working with nshadernode, instead of ntexnode. */ void n_initcmds(nClass *cl) { cl->BeginCmds(); cl->AddCmd("v_settexture_iss", 'STXT', n_settexture); cl->AddCmd("ss_gettexture_i", 'GTXT', n_gettexture); cl->AddCmd("v_setgenmipmaps_ib", 'SGMM', n_setgenmipmaps); cl->AddCmd("b_getgenmipmaps_i", 'GGMM', n_getgenmipmaps); cl->AddCmd("v_sethighquality_ib", 'SHQL', n_sethighquality); cl->AddCmd("b_gethighquality_i", 'GHQL', n_gethighquality); cl->EndCmds(); } //------------------------------------------------------------------------------ /** @cmd settexture @input i(TextureStage), s(PixelFileName), s(AlphaFileName) @output v @info Define filenames for textures of a stage. A 'none' filename is allowed for both the pixel and alpha channel files. The files must currently be 8 or 24 bpp uncompressed BMP files, or any image format supported by the version and build of DevIL that your application is using. Also note that if you supply an alpha channel file both the pixel and alpha file have to be BMPs. */ static void n_settexture(void *o, nCmd *cmd) { nTexArrayNode* self = (nTexArrayNode*) o; int i0 = cmd->In()->GetI(); const char* s0 = cmd->In()->GetS(); const char* s1 = cmd->In()->GetS(); if (strcmp(s0,"none")==0) s0=NULL; if (strcmp(s1,"none")==0) s1=NULL; self->SetTexture(i0, s0, s1); } //------------------------------------------------------------------------------ /** @cmd gettexture @input i(TextureStage) @output s(PixelFileName), s(AlphaFileName) @info Return filenames for given texture stage, a 'none' filename can be returned for both strings. */ static void n_gettexture(void *o, nCmd *cmd) { nTexArrayNode *self = (nTexArrayNode *) o; int i0 = cmd->In()->GetI(); const char *s0,*s1; self->GetTexture(i0,s0,s1); if (!s0) s0="none"; if (!s1) s1="none"; cmd->Out()->SetS(s0); cmd->Out()->SetS(s1); } //------------------------------------------------------------------------------ /** @cmd setgenmipmaps @input i(TextureStage), b(GenMipMaps) @output v @info Turn automatic mipmap generation for a stage on/off. Default is 'true', mipmap generation on. */ static void n_setgenmipmaps(void *o, nCmd *cmd) { nTexArrayNode *self = (nTexArrayNode *) o; int i0 = cmd->In()->GetI(); bool b0 = cmd->In()->GetB(); self->SetGenMipMaps(i0,b0); } //------------------------------------------------------------------------------ /** @cmd getgenmipmaps @input i(TextureStage) @output b(GenMipMaps) @info Return automatic mipmaps generation flag of given texture stage. */ static void n_getgenmipmaps(void *o, nCmd *cmd) { nTexArrayNode *self = (nTexArrayNode *) o; int i0 = cmd->In()->GetI(); cmd->Out()->SetB(self->GetGenMipMaps(i0)); } //------------------------------------------------------------------------------ /** @cmd sethighquality @input i(TextureStage), b(HighQuality) @output v @info Set the high quality flag for this texture stage. This may especially be useful for textures with alpha channel, where full 32 bit resolution is needed. */ static void n_sethighquality(void *o, nCmd *cmd) { nTexArrayNode *self = (nTexArrayNode *) o; int i0 = cmd->In()->GetI(); bool b0 = cmd->In()->GetB(); self->SetHighQuality(i0,b0); } //------------------------------------------------------------------------------ /** @cmd gethighquality @input i(TextureStage) @output b(HighQuality) @info Get high quality flag for given texture stage. */ static void n_gethighquality(void *o, nCmd *cmd) { nTexArrayNode *self = (nTexArrayNode *) o; int i0 = cmd->In()->GetI(); cmd->Out()->SetB(self->GetHighQuality(i0)); } //------------------------------------------------------------------- // SaveCmds() // 16-Nov-00 floh created //------------------------------------------------------------------- bool nTexArrayNode::SaveCmds(nPersistServer *fs) { bool retval = false; if (nVisNode::SaveCmds(fs)) { nCmd *cmd; int i; bool AbsolutPath = ( fs->GetSaveMode() == nPersistServer::SAVEMODE_CLONE ); //--- settexture --- for (i=0; i<N_MAXNUM_TEXSTAGES; i++) { const char *s0,*s1; this->GetTexture(i,s0,s1,AbsolutPath); if (s0) { if (!s1) s1="none"; cmd = fs->GetCmd(this,'STXT'); cmd->In()->SetI(i); cmd->In()->SetS(s0); cmd->In()->SetS(s1); fs->PutCmd(cmd); } } //--- setgenmipmaps --- for (i=0; i<N_MAXNUM_TEXSTAGES; i++) { if (!this->GetGenMipMaps(i)) { cmd = fs->GetCmd(this,'SGMM'); cmd->In()->SetI(i); cmd->In()->SetB(this->GetGenMipMaps(i)); fs->PutCmd(cmd); } } //--- sethighquality --- for (i = 0; i < N_MAXNUM_TEXSTAGES; i++) { if (this->GetHighQuality(i)) { cmd = fs->GetCmd(this, 'SHQL'); cmd->In()->SetI(i); cmd->In()->SetB(this->GetHighQuality(i)); fs->PutCmd(cmd); } } retval = true; } return retval; } //------------------------------------------------------------------- // EOF //-------------------------------------------------------------------
[ "plushe@411252de-2431-11de-b186-ef1da62b6547" ]
[ [ [ 1, 244 ] ] ]
9f801fd8f8d441059dfbd8916772a527f7c061ab
6fa6532d530904ba3704da72327072c24adfc587
/SCoder/SCoder/coders/lsbcoder.cpp
3734230b3a0ca85eea7dbad85d46e2dceed542f4
[]
no_license
photoguns/code-hnure
277b1c0a249dae75c66e615986fb1477e6e0f938
92d6ab861a9de3f409c5af0a46ed78c2aaf13c17
refs/heads/master
2020-05-20T08:56:07.927168
2009-05-29T16:49:34
2009-05-29T16:49:34
35,911,792
0
0
null
null
null
null
UTF-8
C++
false
false
9,838
cpp
//////////////////////////////////////////////////////////////////////////////// #include "lsbcoder.h" //////////////////////////////////////////////////////////////////////////////// LSBCoder::LSBCoder() { } //////////////////////////////////////////////////////////////////////////////// LSBCoder::~LSBCoder() { } //////////////////////////////////////////////////////////////////////////////// std::string LSBCoder::GetMessage( const Container* _container, const Key* _key ) { // Must be a BMP container if ( _container->IsBMPContainer() ) { // Get container const BMPContainer* container = static_cast<const BMPContainer*>(_container); // Setup BMP container SetupContainer(container); // Get message length first unsigned long messageLength = GetMessageLength(); // Get message text return GetMessageText(messageLength); } // Error, not a BMP container return ""; } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetMessage( Container* _container, const std::string& _message, const Key* _key ) { // Must be BMP container if ( _container->IsBMPContainer() ) { // Get container const BMPContainer* container = static_cast<const BMPContainer*>(_container); // Setup BMP container SetupContainer(container); //Hide message length first SetMessageLength( _message.length() ); // Hide message text SetMessageText(_message); } } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetupContainer( const BMPContainer* _container ) { // Set current container SetContainer(_container); // Set default colour and position SetCurrColour(Red); SetCurrPixelPosition(-1,0); } //////////////////////////////////////////////////////////////////////////////// const BMPContainer* LSBCoder::GetContainer() const { return static_cast<const BMPContainer*>(m_Container); } //////////////////////////////////////////////////////////////////////////////// BMPContainer* LSBCoder::GetContainer() { return m_Container; } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetContainer( const BMPContainer* _container ) { m_Container = const_cast<BMPContainer*>(_container); } //////////////////////////////////////////////////////////////////////////////// unsigned long LSBCoder::GetMessageLength() { // Binary message size SizeTBitset messageLength; // Read message length for (size_t bitsRead = 0; bitsRead < bitsInSizeT; ++bitsRead) { // Bit bool bit; // If no space left to read bits - break if ( !GetBit(&bit) ) break; // Save bit messageLength[bitsRead] = bit; } // Return message length return messageLength.to_ulong(); } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetMessageLength( size_t _length ) { // Prepare message length for hiding - convert it to binary SizeTBitset length(_length); // Write all the bits for (size_t bitsWritten = 0; bitsWritten < bitsInSizeT; ++bitsWritten) { // If no space left to write bits - break if ( !SetBit( length[bitsWritten] ) ) break; } } //////////////////////////////////////////////////////////////////////////////// std::string LSBCoder::GetMessageText( size_t _length ) { // Binary message BinaryString message; size_t bitsInMessage = _length * bitsInChar; // Read message for (size_t bitsRead = 0; bitsRead < bitsInMessage; ++bitsRead ) { // Add new char to message to write bits in if (bitsRead % bitsInChar == 0) message.push_back( CharBitset() ); // Bit bool bit; // If no space left to read bits - break if ( !GetBit(&bit) ) break; // Save bit message.back()[bitsRead % bitsInChar] = bit; } // Result string std::string str; // Convert from binary to char for (size_t i = 0; i < message.size(); ++i) str += static_cast<char>( message[i].to_ulong() ); return str; } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetMessageText( const std::string& _message ) { // Prepare message for hiding - convert it to binary BinaryString message; // Convert message to binary for (size_t byteN = 0; byteN < _message.length(); ++byteN) // Save each letter message.push_back(_message[byteN]); // Get container dimensions const size_t bitsInMessage = _message.size() * bitsInChar; // Hide message for (size_t bitsWritten = 0; bitsWritten < bitsInMessage; ++bitsWritten) { // If no space left to write bits - break if ( !SetBit( message[bitsWritten / bitsInChar] [bitsWritten % bitsInChar] ) ) break; } } //////////////////////////////////////////////////////////////////////////////// bool LSBCoder::GetBit( bool* _bit ) { // Byte unsigned char byte; // Get next byte if ( !GetByte(&byte) ) return false; // Read its LSB *_bit = byte & 1; // Read is OK return true; } //////////////////////////////////////////////////////////////////////////////// bool LSBCoder::SetBit( bool _bit ) { // Get next byte for writing unsigned char byte; if ( !GetByte(&byte) ) // Bit has not been written return false; // Max byte unsigned char maxByte = std::numeric_limits<unsigned char>::max() - 1; unsigned char bit = _bit; // Write bit to byte byte &= bit | maxByte; byte |= bit; // Write pixel SetByte(byte); // Bit has been successfully written return true; } //////////////////////////////////////////////////////////////////////////////// bool LSBCoder::GetByte( unsigned char* _byte ) { // Which color to choose? switch ( GetCurrColour() ) { case Red: // Take a new pixel if ( !JumpToNextPixel() ) return false; // Green SetCurrColour(Green); *_byte = GetCurrPixel().Green; break; case Green: // Blue SetCurrColour(Blue); *_byte = GetCurrPixel().Blue; break; case Blue: // Red SetCurrColour(Red); *_byte = GetCurrPixel().Red; break; } return true; } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetByte( unsigned char _byte ) { RGBApixel pixel = GetCurrPixel(); switch ( GetCurrColour() ) { case Red: // Save in red pixel.Red = _byte; break; case Green: // Save in green pixel.Green = _byte; break; case Blue: // Save in blue pixel.Blue = _byte; break; } // Save pixel SetCurrPixel(pixel); } //////////////////////////////////////////////////////////////////////////////// bool LSBCoder::JumpToNextPixel() { // Get container dimensions const int height = GetContainer()->TellHeight(); const int width = GetContainer()->TellWidth(); int currHeight, currWidth; GetCurrPixelPosition(&currHeight, &currWidth); // Lowest pixel in a column if ( ++currHeight == height ) { // Jump to highest pixel currHeight = 0; ++currWidth; // Rightmost pixel if (currWidth == width) //No pixels left return false; } // Jump to next pixel SetCurrPixelPosition(currHeight, currWidth); // Next pixel is OK return true; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// RGBApixel LSBCoder::GetCurrPixel() const { return GetContainer()->GetPixel(m_CurrHeight, m_CurrWidth); } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetCurrPixel( const RGBApixel& _pixel ) { GetContainer()->SetPixel(m_CurrHeight, m_CurrWidth, _pixel); } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::GetCurrPixelPosition( int* _i, int* _j ) const { *_i = m_CurrHeight; *_j = m_CurrWidth; } //////////////////////////////////////////////////////////////////////////////// bool LSBCoder::SetCurrPixelPosition( int _i, int _j ) { if ( _i < m_Container->TellHeight() && _j < m_Container->TellWidth() ) { m_CurrHeight = _i; m_CurrWidth = _j; return true; } else return false; } //////////////////////////////////////////////////////////////////////////////// LSBCoder::Colour LSBCoder::GetCurrColour() const { return m_Colour; } //////////////////////////////////////////////////////////////////////////////// void LSBCoder::SetCurrColour( Colour _colour ) { m_Colour = _colour; } ////////////////////////////////////////////////////////////////////////////////
[ "[email protected]@8592428e-0b6d-11de-9036-69e38a880166" ]
[ [ [ 1, 440 ] ] ]
e8f3c2b2ca9bcd098e2cbdf39dae91bae961ff37
09ea547305ed8be9f8aa0dc6a9d74752d660d05d
/example/LinkedInAuthApp/ui_progressbar.h
8873d22a506b7f2942e836be4c1d26270c2bdb27
[]
no_license
SymbianSource/oss.FCL.sf.mw.socialmobilefw
3c49e1d1ae2db8703e7c6b79a4c951216c9c5019
7020b195cf8d1aad30732868c2ed177e5459b8a8
refs/heads/master
2021-01-13T13:17:24.426946
2010-10-12T09:53:52
2010-10-12T09:53:52
72,676,540
0
0
null
null
null
null
UTF-8
C++
false
false
2,822
h
/******************************************************************************** ** Form generated from reading UI file 'progressbar.ui' ** ** Created: Mon Sep 27 15:45:02 2010 ** by: Qt User Interface Compiler version 4.6.2 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_PROGRESSBAR_H #define UI_PROGRESSBAR_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QHeaderView> #include <QtGui/QLabel> #include <QtGui/QProgressBar> #include <QtGui/QVBoxLayout> #include <QtGui/QWidget> QT_BEGIN_NAMESPACE class Ui_progressbarClass { public: QVBoxLayout *verticalLayout; QLabel *label; QProgressBar *progressBar; void setupUi(QWidget *progressbarClass) { if (progressbarClass->objectName().isEmpty()) progressbarClass->setObjectName(QString::fromUtf8("progressbarClass")); verticalLayout = new QVBoxLayout(progressbarClass); verticalLayout->setSpacing(6); verticalLayout->setContentsMargins(11, 11, 11, 11); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); label = new QLabel(progressbarClass); label->setObjectName(QString::fromUtf8("label")); verticalLayout->addWidget(label); progressBar = new QProgressBar(progressbarClass); progressBar->setObjectName(QString::fromUtf8("progressBar")); progressBar->setValue(24); verticalLayout->addWidget(progressBar); retranslateUi(progressbarClass); QMetaObject::connectSlotsByName(progressbarClass); } // setupUi void retranslateUi(QWidget *progressbarClass) { progressbarClass->setWindowTitle(QApplication::translate("progressbarClass", "progressbar", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("progressbarClass", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">Loading,Please wait.....</span></p></body></html>", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; namespace Ui { class progressbarClass: public Ui_progressbarClass {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_PROGRESSBAR_H
[ "none@none" ]
[ [ [ 1, 75 ] ] ]
0dd802b39a561207783ab75da00c996184752030
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Scada/SysCADMarshal/SetValuesDlg.h
b4de6b9a8331fc308d7695dbbf8db322f7ddd729
[]
no_license
abcweizhuo/Test3
0f3379e528a543c0d43aad09489b2444a2e0f86d
128a4edcf9a93d36a45e5585b70dee75e4502db4
refs/heads/master
2021-01-17T01:59:39.357645
2008-08-20T00:00:29
2008-08-20T00:00:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
829
h
#pragma once #include "afxwin.h" // CSetValuesDlg dialog class CSysCADMarshalDoc; class CSetValuesDlg : public CDialog { DECLARE_DYNAMIC(CSetValuesDlg) public: CSetValuesDlg(CSysCADMarshalDoc * pDoc, CWnd* pParent = NULL); // standard constructor virtual ~CSetValuesDlg(); // Dialog Data enum { IDD = IDD_SETVALUES }; static bool OpenIt(CWnd * pParent, CSysCADMarshalDoc * pDoc); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog( ); void SaveState(); virtual void OnOK(); virtual void OnCancel(); afx_msg void OnBnClickedRead(); afx_msg void OnBnClickedWrite(); static CSetValuesDlg * sm_pTheOne; CSysCADMarshalDoc * m_pDoc; CButton m_DoWhich; };
[ [ [ 1, 28 ], [ 31, 36 ] ], [ [ 29, 30 ] ] ]
fdeeb750eb32424e6071453e1a6e8e8a022e4aca
4aadb120c23f44519fbd5254e56fc91c0eb3772c
/Source/src/OpenSteerUT/AbstractEntityQuery.cpp
7e96cffc14903699cdf885be076330670edb43c9
[]
no_license
janfietz/edunetgames
d06cfb021d8f24cdcf3848a59cab694fbfd9c0ba
04d787b0afca7c99b0f4c0692002b4abb8eea410
refs/heads/master
2016-09-10T19:24:04.051842
2011-04-17T11:00:09
2011-04-17T11:00:09
33,568,741
0
0
null
null
null
null
UTF-8
C++
false
false
1,812
cpp
//----------------------------------------------------------------------------- // Copyright (c) 2009, Jan Fietz, Cyrus Preuss // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of EduNetGames nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //----------------------------------------------------------------------------- #include "OpenSteerUT/AbstractEntityQuery.h"
[ "janfietz@localhost" ]
[ [ [ 1, 29 ] ] ]
782c522fd92bec0ae6e7827d10008455674bcc9d
9dad473629c94d45041d51ae6c21ca2b477bd913
/headers/union.h
7c47acb60170513c744706ca14741f88f153abca
[]
no_license
Mefteg/cheshire-csg
26ed5682277beb6993f60da1604ddfe298f8caae
b12daf345c22065f5b30247d4b6c3395372849fb
refs/heads/master
2021-01-10T20:13:34.474876
2011-10-03T21:57:49
2011-10-03T21:57:49
32,360,524
0
0
null
null
null
null
UTF-8
C++
false
false
1,366
h
/** * \file union.h * \brief class Union header * \author Gimenez Tom, Roumier Vincent, Matéo Camille * \version 1.0 * \date 01 octobre 2011 * * Containing Union class * */ #ifndef __Union__ #define __Union__ #include "opbin.h" /*! * \class Union * \brief Union class * * Union is a binary operand of the CSG * */ class Union : public OpBin { public: Union(void); Union(Node* , Node*); ~Union(void); /*! * \brief Intersecting function * * Compute the intersection between a union and a ray * * \param ray : the ray * \param t : the intersection */ int Intersect(const Ray&, Intersection&); /*! * \brief Intersecting function * * Compute the intersections between a union and a ray * * \param ray : the ray * \param t1 : the first intersection * \param t2 : the second intersection */ int Intersect(const Ray&, Intersection&, Intersection&); /*! * \brief Containing function * * Checks if a point is inside the instance * * \param u : the point */ int PMC(const Vector&); Vector getEmission() { return Vector(); }; Vector getColor() { return Vector(); }; Vector getPosition() { return (0.5 * left->getPosition() + 0.5 * right->getPosition()); }; int getRefl() { return 0; }; double getF() { return 0; }; }; #endif
[ "[email protected]@3040dc66-f2c5-6624-7679-62bdbddada0d", "[email protected]@3040dc66-f2c5-6624-7679-62bdbddada0d" ]
[ [ [ 1, 12 ], [ 18, 24 ], [ 27, 28 ], [ 30, 30 ], [ 33, 40 ], [ 42, 51 ], [ 53, 61 ], [ 65, 65 ] ], [ [ 13, 17 ], [ 25, 26 ], [ 29, 29 ], [ 31, 32 ], [ 41, 41 ], [ 52, 52 ], [ 62, 64 ], [ 66, 70 ] ] ]
ccb17e41682809a675d2bae62405756965ebeeef
98bc9ad50143aa5b3e4d0cf79ca9f1fbe9877935
/CUDA/Global/Logging.cpp
0fb2a80d7021aca9d7e325715bd04b70a73235d4
[]
no_license
liu3xing3long/cnl
11c348d2587d0c2e4535ee5db3138951dfed7f65
307be2d860425b72669cbf3f67bd3f60dc0c3e40
refs/heads/master
2021-01-10T08:11:56.311074
2010-06-30T06:26:50
2010-06-30T06:26:50
48,257,267
0
0
null
null
null
null
UTF-8
C++
false
false
2,926
cpp
#include "stdafx.h" FILE *Logging::m_pLoggingFile; unsigned int g_uiAllowedTypesConsole = 0xFFFFFFFF; // all logging types allowed unsigned int g_uiAllowedTypesFile = 0xFFFFFFFF; // all logging types allowed void Logging::makeSureLoggingFileExists() { if(m_pLoggingFile == NULL) { Str sLogFileName("LoggingCNL.txt"); m_pLoggingFile = TiXmlFOpen(sLogFileName.c_str(),"a"); if(m_pLoggingFile == NULL) { printf("Could not open log file %s, exiting\n", sLogFileName.c_str()); exit(1); } // We put some text at the beginning of session fputs("\n",m_pLoggingFile); logTextFileLine(LT_INFORMATION,"Started session","============","============================",0); } } void Logging::logTextFileLine(LoggingType p_eLoggingType, const char *p_sLoggingText,const char *p_sFileName,const char *p_sFunctionName,long p_lLineNumber) { // we check if this logging type is logged either by file or console if(!((g_uiAllowedTypesConsole & (unsigned int)p_eLoggingType) || (g_uiAllowedTypesFile & (unsigned int)p_eLoggingType))) return; makeSureLoggingFileExists(); static Str sLogging; Str sLoggingType; switch(p_eLoggingType) { case LT_INFORMATION: sLoggingType = "INFORMATION"; break; case LT_WARNING: sLoggingType = "WARNING "; break; case LT_ERROR: sLoggingType = "ERROR "; break; case LT_DEBUG: sLoggingType = "DEBUG "; break; case LT_MEMORY: sLoggingType = "MEMORY "; break; } Str sFileName(p_sFileName); size_t iFound = sFileName.rfind('\\'); if(iFound != -1) sFileName = sFileName.substring(iFound+1); else if((iFound = sFileName.rfind('/')) != -1) sFileName = sFileName.substring(iFound+1); #ifdef _MSC_VER // Identifies Microsoft compilers SYSTEMTIME now; GetLocalTime(&now); sLogging.format("%d.%02d.%02d %02d:%02d:%02d:%03d %s%25s%50s%5d %s\n", now.wYear,now.wMonth,now.wDay, now.wHour,now.wMinute,now.wSecond,now.wMilliseconds, sLoggingType.c_str(),sFileName.c_str(),p_sFunctionName, p_lLineNumber,p_sLoggingText); #else timeval now1; gettimeofday(&now1, NULL); time_t now = now1.tv_sec; localtime(&now); sLogging.format("%d.%02d.%02d %02d:%02d:%02d:%03d %s%25s%50s%5d %s\n", now.tm_year+1900,now.tm_mon+1,now.tm_mday, now.tm_hour,now.tm_min,now.tm_sec,now1.tv_usec, sLoggingType.c_str(),sFileName.c_str(),p_sFunctionName, p_lLineNumber,p_sLoggingText); #endif if(g_uiAllowedTypesFile & (unsigned int)p_eLoggingType) { fputs(sLogging.c_str(),m_pLoggingFile); fflush(m_pLoggingFile); } if(g_uiAllowedTypesConsole & (unsigned int)p_eLoggingType) printf("%s",sLogging.c_str()); } void Logging::setAllowedLoggingTypes(unsigned int p_uiNewAllowedTypesConsole, unsigned int p_uiNewAllowedTypesFile) { g_uiAllowedTypesConsole = p_uiNewAllowedTypesConsole; g_uiAllowedTypesFile = p_uiNewAllowedTypesFile; }
[ [ [ 1, 88 ] ] ]
e67aabe4fc94f03e592e097509695bbb4b313f25
105cc69f4207a288be06fd7af7633787c3f3efb5
/HovercraftUniverse/HovercraftUniverse/HavokEntityType.h
3b36071349ae259ea5a5e72fffee7049a657a9f9
[]
no_license
allenjacksonmaxplayio/uhasseltaacgua
330a6f2751e1d6675d1cf484ea2db0a923c9cdd0
ad54e9aa3ad841b8fc30682bd281c790a997478d
refs/heads/master
2020-12-24T21:21:28.075897
2010-06-09T18:05:23
2010-06-09T18:05:23
56,725,792
0
0
null
null
null
null
UTF-8
C++
false
false
1,088
h
#ifndef HAVOKENTITYTYPE_H #define HAVOKENTITYTYPE_H class hkpWorldObject; namespace HovUni { /** * Class used to annotate havoc world objects with an object type. */ class HavokEntityType { private: static int ENITYTYPEPROPERTY; public: enum Type { NOTSET, PLANET, CHARACTER, STATIC }; /** * Get the entity type * @param object * @return EntityType */ static Type getEntityType( const hkpWorldObject * object ); /** * Update the entity type, this should be done only when propery already set * @param object * @param type */ static void updateEntityType( hkpWorldObject * object, Type type ); /** * Check if object is given type * @param object * @param type * @return true if object is of given type, false otherwise */ static bool isEntityType( const hkpWorldObject * object, Type type ); /** * Set the entity type, this should be done only once * @param object * @param type */ static void setEntityType( hkpWorldObject * object, Type type ); }; } #endif
[ "[email protected]", "pintens.pieterjan@2d55a33c-0a8f-11df-aac0-2d4c26e34a4c" ]
[ [ [ 1, 2 ], [ 11, 11 ] ], [ [ 3, 10 ], [ 12, 58 ] ] ]
ddce64158550dc02b58c98a94b7c11ea7d4d4bee
629e4fdc23cb90c0144457e994d1cbb7c6ab8a93
/lib/entity/components/physicswork.cpp
19e86e012c0aebe68b68f1dec3bffbf761429581
[]
no_license
akin666/ice
4ed846b83bcdbd341b286cd36d1ef5b8dc3c0bf2
7cfd26a246f13675e3057ff226c17d95a958d465
refs/heads/master
2022-11-06T23:51:57.273730
2011-12-06T22:32:53
2011-12-06T22:32:53
276,095,011
0
0
null
null
null
null
UTF-8
C++
false
false
2,538
cpp
/* * physicswork.cpp * * Created on: 1.11.2011 * Author: akin */ #include "physicswork.h" #include "physicscomponent.h" #include <iostream> namespace ice { PhysicsWork::PhysicsWork( Component& parent ) : ComponentWork( parent ) { } PhysicsWork::~PhysicsWork() { } bool PhysicsWork::begin() { // nothing is holding back. return true; } void PhysicsWork::run() { // Do Blody Physics.. PhysicsComponent *tcparent = dynamic_cast<PhysicsComponent*>( &parent ); if( tcparent == NULL || tcparent->timeProperty == NULL || tcparent->forceProperty == NULL || tcparent->positionProperty == NULL || tcparent->weightProperty == NULL ) { return; } TimeProperty *timeProperty = tcparent->timeProperty; ForceProperty *forceProperty = tcparent->forceProperty; PositionProperty *positionProperty = tcparent->positionProperty; WeightProperty *weightProperty = tcparent->weightProperty; std::deque<EntityKey>& entities = tcparent->entities; Time step = timeProperty->getDiff(); if( step == 0 ) { return; } float seconds = step * 0.001f; float gravity = tcparent->gravity; float drag = tcparent->drag; // Do physics! float gravityEffect; for( int i = entities.size() - 1 ; i >= 0 ; --i ) { // Get data references.. EntityKey entity = entities.at( i ); //Time& time = timeProperty->get( entity ); float& weight = weightProperty->get( entity ); ForceProperty::Data& forceData = forceProperty->get( entity ); PositionProperty::Data& positionData = positionProperty->get( entity ); //seconds = time * 0.001f; // convert ms to s. // Now using time, weight, forces, and position.. update position and other datas. forceData.position.y -= gravity * weight * seconds; // flip if( positionData.position.y < 0.0f && forceData.position.y < 0 ) { forceData.position.y = (-forceData.position.y * 0.5f); } // Add forces to positions. positionData.position += forceData.position * seconds; // std::cout << "------------------" << std::endl; // std::cout << "gravity:" << gravity << " seconds:" << seconds << " weight:" << weight << std::endl; // std::cout << "FORCES to X:" << forceData.position.x << " Y:" << forceData.position.y << " Z:" << forceData.position.z << std::endl; // std::cout << "ID:" << entity << "\tUpdated to X:" << positionData.position.x << " Y:" << positionData.position.y << " Z:" << positionData.position.z << std::endl; } } } /* namespace ice */
[ "akin@lich", "akin@localhost" ]
[ [ [ 1, 14 ], [ 16, 50 ], [ 60, 68 ], [ 70, 73 ], [ 75, 81 ], [ 83, 87 ], [ 92, 95 ] ], [ [ 15, 15 ], [ 51, 59 ], [ 69, 69 ], [ 74, 74 ], [ 82, 82 ], [ 88, 91 ] ] ]
77185777741b8793da7952cdf3000dd4f12548d0
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/mpl/preprocessed/list/list50.cpp
313ef49aa7e4420002a685cd308d77bf0c2d8ade
[ "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
512
cpp
// Copyright Aleksey Gurtovoy 2002-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/boost/boost/libs/mpl/preprocessed/list/list50.cpp,v $ // $Date: 2006/06/12 05:11:54 $ // $Revision: 1.3.8.1 $ #define BOOST_MPL_PREPROCESSING_MODE #include <boost/config.hpp> #include <boost/mpl/list/list50.hpp>
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 16 ] ] ]
78429b00cd669a0d74b6c5bdf2f21d2f9decfc00
da2575b50a44f20ef52d6f271e73ff15dd54682f
/projects/SimpleDemo/stdafx.h
b294b0545a485a72f615428d4b7957aabf24d37b
[]
no_license
lqianlong/lincodelib
0ef622bc988d6cf981a0aaf9da42b82fbd0b14cf
27e71716f3279c02a90c213470b4c52cd8e86b60
refs/heads/master
2020-08-29T17:02:45.005037
2010-05-03T20:17:20
2010-05-03T20:17:20
null
0
0
null
null
null
null
GB18030
C++
false
false
208
h
// stdafx.h : 标准系统包含文件的包含文件, // 或是常用但不常更改的项目特定的包含文件 // #pragma once #include <iostream> #include <tchar.h> #include "LnBase.h"
[ "linzhenqun@785468e8-de65-11dd-a893-8d7ce9fbef62" ]
[ [ [ 1, 11 ] ] ]
f65f051aa044b4206100d9a1efe3aab3f868ef18
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/iostreams/test/write_output_iterator_test.hpp
98ba54d9b29b946c276b0143d8483e4775af5ac3
[ "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,736
hpp
// (C) Copyright Jonathan Turkanis 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/iostreams for documentation. #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_ITERATOR_HPP_INCLUDED #define BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_ITERATOR_HPP_INCLUDED #include <fstream> #include <iterator> // Back inserter. #include <vector> #include <boost/iostreams/filtering_stream.hpp> #include <boost/test/test_tools.hpp> #include "detail/sequence.hpp" #include "detail/temp_file.hpp" #include "detail/verification.hpp" // Note: adding raw inserter iterators to chains is not supported // on VC6. void write_output_iterator_test() { using namespace std; using namespace boost; using namespace boost::iostreams; using namespace boost::iostreams::test; test_file test; { vector<char> first; filtering_ostream out; out.push(std::back_inserter(first), 0); write_data_in_chars(out); ifstream second(test.name().c_str()); BOOST_CHECK_MESSAGE( compare_container_and_stream(first, second), "failed writing to filtering_ostream based on an " "output iterator in chars with no buffer" ); } { vector<char> first; filtering_ostream out; out.push(std::back_inserter(first), 0); write_data_in_chunks(out); ifstream second(test.name().c_str()); BOOST_CHECK_MESSAGE( compare_container_and_stream(first, second), "failed writing to filtering_ostream based on an " "output iterator in chunks with no buffer" ); } { vector<char> first; filtering_ostream out; out.push(std::back_inserter(first)); write_data_in_chars(out); ifstream second(test.name().c_str()); BOOST_CHECK_MESSAGE( compare_container_and_stream(first, second), "failed writing to filtering_ostream based on an " "output iterator in chars with large buffer" ); } { vector<char> first; filtering_ostream out; out.push(std::back_inserter(first)); write_data_in_chunks(out); ifstream second(test.name().c_str()); BOOST_CHECK_MESSAGE( compare_container_and_stream(first, second), "failed writing to filtering_ostream based on an " "output iterator in chunks with large buffer" ); } } #endif // #ifndef BOOST_IOSTREAMS_TEST_WRITE_OUTPUT_ITERATOR_HPP_INCLUDED
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 84 ] ] ]
ef107a75cc90994318da766e39b7ecc425d27050
f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0
/Depend/MyGUI/Tools/LayoutEditor/PanelControllers.h
bafbbcc471f12aa559efef0e478814ab47e4e735
[]
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,530
h
/*! @file @author Georgiy Evmenov @date 12/2009 */ #ifndef __PANEL_CONTROLLERS_H__ #define __PANEL_CONTROLLERS_H__ #include "BaseLayout/BaseLayout.h" #include "PanelView/BasePanelViewItem.h" namespace tools { class PanelControllers : public wraps::BasePanelViewItem { public: PanelControllers(); virtual void initialise(); virtual void shutdown(); void update(MyGUI::Widget* _currentWidget); typedef MyGUI::delegates::CDelegate5<MyGUI::Widget*, const std::string&, const std::string&, const std::string&, int> EventHandle_EventCreatePair; EventHandle_EventCreatePair eventCreatePair; typedef MyGUI::delegates::CDelegate1<MyGUI::Widget*> EventHandle_WidgetVoid; EventHandle_WidgetVoid eventHidePairs; private: virtual void notifyChangeWidth(int _width); void notifyAdd(MyGUI::Widget* _sender = 0); void notifyDelete(MyGUI::Widget* _sender); void notifySelectItem(MyGUI::List* _sender, size_t _index); void loadControllerTypes(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version); private: MyGUI::ComboBox* mControllerName; MyGUI::Button* mButtonAdd; MyGUI::Button* mButtonDelete; MyGUI::List* mList; MyGUI::Widget* mCurrentWidget; int mButtonLeft; int mButtonRight; int mButtonSpace; typedef std::map<std::string, MyGUI::MapString> MapMapString; MapMapString mControllersProperties; int mPropertyItemHeight; }; } // namespace tools #endif // __PANEL_CONTROLLERS_H__
[ "albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c" ]
[ [ [ 1, 60 ] ] ]
5362724d3de4958b22fc47fe9812de9f9f1dcf40
bdb1e38df8bf74ac0df4209a77ddea841045349e
/CapsuleSortor/Version 1.0 -2.0/CapsuleSortor-10-11-14/ToolSrc/TThread.h
fc1dcbdb5b01bb7703dd7e0de47d4fe1ad9e7af8
[]
no_license
Strongc/my001project
e0754f23c7818df964289dc07890e29144393432
07d6e31b9d4708d2ef691d9bedccbb818ea6b121
refs/heads/master
2021-01-19T07:02:29.673281
2010-12-17T03:10:52
2010-12-17T03:10:52
49,062,858
0
1
null
2016-01-05T11:53:07
2016-01-05T11:53:07
null
UTF-8
C++
false
false
2,872
h
// TThread.h : Interface of the TThread class // // Copyright (c) 2006 zhao_fsh Zibo Creative Computor CO.,LTD ////////////////////////////////////////////////////////////////////////// // // Last update Date : 2007.05.07 // // Example Begin /* // First method: class myClass :public TThread { public: virtual void Thread () { std::cout << "with virtual thread!" << std::endl; } }; // Second method: void TheadContain(void* param) { std::cout << "with callback function!" <<std::endl; } int main() { myClass my; my.Start(); bool ok = my.Wait(); TThread threadobj; threadobj.SetThreadFunc(TheadContain,NULL); threadobj.Start(); threadobj.Wait(); } */ // Example end // // Simple thread control tool #ifndef TTHREAD_H #define TTHREAD_H // We want this to be compatible with MFC and non-MFC apps #ifdef _AFXDLL #include <afx.h> #else #include <windows.h> #endif typedef void ThreadFunc(void* param); class TThread { public: typedef enum { CRITICAL = THREAD_PRIORITY_TIME_CRITICAL, HIGHEST = THREAD_PRIORITY_HIGHEST, ABOVE = THREAD_PRIORITY_ABOVE_NORMAL, NORMAL = THREAD_PRIORITY_NORMAL, BELOW = THREAD_PRIORITY_BELOW_NORMAL, LOWEST = THREAD_PRIORITY_LOWEST, IDLE = THREAD_PRIORITY_IDLE } EnumPriority; public: TThread(); ~TThread (); public: bool Start (EnumPriority ePriority = NORMAL); // Start the thread running bool Stop (); // Stop the thread. bool Suspend (); // Suspend the thread. bool Resume (); // Resume the thread. bool Wait (unsigned int ms = -1); // Wait for thread to complete void Sleep (unsigned int ms); // Sleep for ms milliseconds void SetThreadFunc(ThreadFunc* proc, void* param); // Set Callback Function and it's param EnumPriority GetPriority(); // Get thread priority. bool SetPriority (EnumPriority ePriority); // Set thread priority. protected: TThread(const TThread& src); TThread& operator = (const TThread& src); static unsigned int __stdcall StaticThread (void* obj); virtual void Thread (); // Thread function, Override this in derived classes. private: HANDLE m_hThread; ThreadFunc *ThreadProc; void *m_param; EnumPriority m_ePriority; public: class CritSect { public: CritSect () { InitializeCriticalSection (&m_critsect); } ~CritSect () { DeleteCriticalSection (&m_critsect); } void Enter () { EnterCriticalSection (&m_critsect); } void Leave () { LeaveCriticalSection (&m_critsect); } private: CRITICAL_SECTION m_critsect; }; class Lock { public: Lock(CritSect *pLocker) { m_pLocker = pLocker; m_pLocker->Enter(); } ~Lock() { m_pLocker->Leave(); } private: CritSect *m_pLocker; }; private: CritSect m_lock; }; #endif // TTHREAD_H
[ "vincen.cn@66f52ff4-a261-11de-b161-9f508301ba8e" ]
[ [ [ 1, 123 ] ] ]
0ef42e7ce4fa132fdfe4e82a6638c2a84a0f73b7
e8c9bfda96c507c814b3378a571b56de914eedd4
/engineTest/AgentStates.h
db421ae52b23a9488a05a78a4fa70dc5627ed597
[]
no_license
VirtuosoChris/quakethecan
e2826f832b1a32c9d52fb7f6cf2d972717c4275d
3159a75117335f8e8296f699edcfe87f20d97720
refs/heads/master
2021-01-18T09:20:44.959838
2009-04-20T13:32:36
2009-04-20T13:32:36
32,121,382
0
0
null
null
null
null
UTF-8
C++
false
false
3,896
h
#ifndef AGENT_STATES_H_ #define AGENT_STATES_H_ #include "State.h" class Agent; //Defend state class Defend : public State<Agent>{ private: Defend(){} //copy constructor and assignment operator //Defend(const Defend &); //Defend & operator=(const Defend &); public: static Defend* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer*); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *); }; //Patrol state class Patrol : public State<Agent>{ private: Patrol(){} //copy constructor and assignment operator //Patrol(const Patrol &); //Patrol & operator=(const Patrol &); public: static Patrol* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer*); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *); }; //Pursue state class Pursue : public State<Agent>{ private: Pursue(){} //copy constructor and assignment operator //Pursue(const Pursue &); //Pursue & operator=(const Pursue &); public: static Pursue* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer*); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *); }; //Hide state class Hide : public State<Agent>{ private: Hide(){} //copy constructor and assignment operator //Hide(const Hide &); //Hide & operator=(const Hide &); public: static Hide* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer*); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *); }; //Flee state class Flee : public State<Agent>{ private: Flee(){} //copy constructor and assignment operator //Flee(const Flee &); //Flee & operator=(const Flee &); public: static Flee* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer*); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *); }; //Activating Orb state class Act_Orb : public State<Agent>{ private: Act_Orb(){} //copy constructor and assignment operator //Act_Orb(const Act_Orb &); //Act_Orb & operator=(const Act_Orb &); public: static Act_Orb* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer* timer); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *msg); }; //Die state class Die : public State<Agent>{ private: Die(){} public: static Die* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer*); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message*); }; //Wait state class Wait : public State<Agent>{ private: Wait(){} public: static Wait* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer* timer); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *msg); }; //Start state class Start : public State<Agent>{ private: int start; int finish; Start(){} public: static Start* GetInstance(); virtual void Enter(Agent & agt); virtual void Execute(Agent & agt, const irr::ITimer* timer); virtual void Exit(Agent & agt); virtual bool ExecuteMessage(Agent &, const Message *msg); }; #endif
[ "cthomas.mail@f96ad80a-2d29-11de-ba44-d58fe8a9ce33", "javidscool@f96ad80a-2d29-11de-ba44-d58fe8a9ce33", "chrispugh666@f96ad80a-2d29-11de-ba44-d58fe8a9ce33" ]
[ [ [ 1, 151 ], [ 171, 190 ], [ 214, 214 ] ], [ [ 152, 170 ] ], [ [ 191, 213 ] ] ]
1ccf49f9caf0f46ba4aa00e1de699c6359d242f3
854ee643a4e4d0b7a202fce237ee76b6930315ec
/arcemu_svn/src/arcemu-logonserver/AccountCache.cpp
804abefefd78ac327f95ace0487cbdc2616c8cb0
[]
no_license
miklasiak/projekt
df37fa82cf2d4a91c2073f41609bec8b2f23cf66
064402da950555bf88609e98b7256d4dc0af248a
refs/heads/master
2021-01-01T19:29:49.778109
2008-11-10T17:14:14
2008-11-10T17:14:14
34,016,391
2
0
null
null
null
null
UTF-8
C++
false
false
15,185
cpp
/* * ArcEmu MMORPG Server * Copyright (C) 2008 <http://www.ArcEmu.org/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #include "LogonStdAfx.h" initialiseSingleton(AccountMgr); initialiseSingleton(IPBanner); initialiseSingleton(InformationCore); void AccountMgr::ReloadAccounts(bool silent) { setBusy.Acquire(); if(!silent) sLog.outString("[AccountMgr] Reloading Accounts..."); // Load *all* accounts. QueryResult * result = sLogonSQL->Query("SELECT acct, login, password, encrypted_password, gm, flags, banned, forceLanguage, muted FROM accounts"); Field * field; string AccountName; set<string> account_list; Account * acct; if(result) { do { field = result->Fetch(); AccountName = field[1].GetString(); // transform to uppercase arcemu_TOUPPER(AccountName); //Use private __GetAccount, for locks acct = __GetAccount(AccountName); if(acct == 0) { // New account. AddAccount(field); } else { // Update the account with possible changed details. UpdateAccount(acct, field); } // add to our "known" list account_list.insert(AccountName); } while(result->NextRow()); delete result; } // check for any purged/deleted accounts #ifdef WIN32 HM_NAMESPACE::hash_map<string, Account*>::iterator itr = AccountDatabase.begin(); HM_NAMESPACE::hash_map<string, Account*>::iterator it2; #else std::map<string, Account*>::iterator itr = AccountDatabase.begin(); std::map<string, Account*>::iterator it2; #endif for(; itr != AccountDatabase.end();) { it2 = itr; ++itr; if(account_list.find(it2->first) == account_list.end()) { delete it2->second; AccountDatabase.erase(it2); } else { it2->second->UsernamePtr = (std::string*)&it2->first; } } if(!silent) sLog.outString("[AccountMgr] Found %u accounts.", AccountDatabase.size()); setBusy.Release(); IPBanner::getSingleton().Reload(); } void AccountMgr::AddAccount(Field* field) { Account * acct = new Account; Sha1Hash hash; string Username = field[1].GetString(); string Password = field[2].GetString(); string EncryptedPassword = field[3].GetString(); string GMFlags = field[4].GetString(); acct->AccountId = field[0].GetUInt32(); acct->AccountFlags = field[5].GetUInt8(); acct->Banned = field[6].GetUInt32(); if ( (uint32)UNIXTIME > acct->Banned && acct->Banned != 0 && acct->Banned != 1) //1 = perm ban? { //Accounts should be unbanned once the date is past their set expiry date. acct->Banned = 0; //me go boom :( //printf("Account %s's ban has expired.\n",acct->UsernamePtr->c_str()); sLogonSQL->Execute("UPDATE accounts SET banned = 0 WHERE acct=%u",acct->AccountId); } acct->SetGMFlags(GMFlags.c_str()); acct->Locale[0] = 'e'; acct->Locale[1] = 'n'; acct->Locale[2] = 'U'; acct->Locale[3] = 'S'; if(strcmp(field[7].GetString(), "enUS")) { // non-standard language forced memcpy(acct->Locale, field[7].GetString(), 4); acct->forcedLocale = true; } else acct->forcedLocale = false; acct->Muted = field[8].GetUInt32(); if ( (uint32)UNIXTIME > acct->Muted && acct->Muted != 0 && acct->Muted != 1) //1 = perm ban? { //Accounts should be unbanned once the date is past their set expiry date. acct->Muted= 0; //sLog.outDebug("Account %s's mute has expired.",acct->UsernamePtr->c_str()); sLogonSQL->Execute("UPDATE accounts SET muted = 0 WHERE acct=%u",acct->AccountId); } // Convert username/password to uppercase. this is needed ;) arcemu_TOUPPER(Username); arcemu_TOUPPER(Password); // prefer encrypted passwords over nonencrypted if( EncryptedPassword.size() > 0 ) { if ( EncryptedPassword.size() == 40 ) { BigNumber bn; bn.SetHexStr( EncryptedPassword.c_str() ); if( bn.GetNumBytes() < 20 ) { // Hacky fix memcpy(acct->SrpHash, bn.AsByteArray(), bn.GetNumBytes()); for (int n=bn.GetNumBytes(); n<=19; n++) acct->SrpHash[n] = (uint8)0; reverse_array(acct->SrpHash, 20); } else { memcpy(acct->SrpHash, bn.AsByteArray(), 20); reverse_array(acct->SrpHash, 20); } } else { printf("Account `%s` has incorrect number of bytes in encrypted password! Disabling.\n", Username.c_str()); memset(acct->SrpHash, 0, 20); } } else { // Prehash the I value. hash.UpdateData((Username + ":" + Password)); hash.Finalize(); memcpy(acct->SrpHash, hash.GetDigest(), 20); } AccountDatabase[Username] = acct; } void AccountMgr::UpdateAccount(Account * acct, Field * field) { uint32 id = field[0].GetUInt32(); Sha1Hash hash; string Username = field[1].GetString(); string Password = field[2].GetString(); string EncryptedPassword = field[3].GetString(); string GMFlags = field[4].GetString(); if(id != acct->AccountId) { //printf("Account %u `%s` is a duplicate.\n", id, acct->Username.c_str()); sLog.outColor(TYELLOW, " >> deleting duplicate account %u [%s]...", id, Username.c_str()); sLog.outColor(TNORMAL, "\n"); sLogonSQL->Execute("DELETE FROM accounts WHERE acct=%u", id); return; } acct->AccountId = field[0].GetUInt32(); acct->AccountFlags = field[5].GetUInt8(); acct->Banned = field[6].GetUInt32(); if ((uint32)UNIXTIME > acct->Banned && acct->Banned != 0 && acct->Banned != 1) //1 = perm ban? { //Accounts should be unbanned once the date is past their set expiry date. acct->Banned = 0; sLog.outDebug("Account %s's ban has expired.",acct->UsernamePtr->c_str()); sLogonSQL->Execute("UPDATE accounts SET banned = 0 WHERE acct=%u",acct->AccountId); } acct->SetGMFlags(GMFlags.c_str()); if(strcmp(field[7].GetString(), "enUS")) { // non-standard language forced memcpy(acct->Locale, field[7].GetString(), 4); acct->forcedLocale = true; } else acct->forcedLocale = false; acct->Muted = field[8].GetUInt32(); if ((uint32)UNIXTIME > acct->Muted && acct->Muted != 0 && acct->Muted != 1) //1 = perm ban? { //Accounts should be unbanned once the date is past their set expiry date. acct->Muted= 0; sLog.outDebug("Account %s's mute has expired.",acct->UsernamePtr->c_str()); sLogonSQL->Execute("UPDATE accounts SET muted = 0 WHERE acct=%u",acct->AccountId); } // Convert username/password to uppercase. this is needed ;) arcemu_TOUPPER(Username); arcemu_TOUPPER(Password); // prefer encrypted passwords over nonencrypted if( EncryptedPassword.size() > 0 ) { if ( EncryptedPassword.size() == 40 ) { BigNumber bn; bn.SetHexStr( EncryptedPassword.c_str() ); if( bn.GetNumBytes() < 20 ) { // Hacky fix memcpy(acct->SrpHash, bn.AsByteArray(), bn.GetNumBytes()); for (int n=bn.GetNumBytes(); n<=19; n++) acct->SrpHash[n] = (uint8)0; reverse_array(acct->SrpHash, 20); } else { memcpy(acct->SrpHash, bn.AsByteArray(), 20); reverse_array(acct->SrpHash, 20); } } else { printf("Account `%s` has incorrect number of bytes in encrypted password! Disabling.\n", Username.c_str()); memset(acct->SrpHash, 0, 20); } } else { // Prehash the I value. hash.UpdateData((Username + ":" + Password)); hash.Finalize(); memcpy(acct->SrpHash, hash.GetDigest(), 20); } } void AccountMgr::ReloadAccountsCallback() { ReloadAccounts(true); } BAN_STATUS IPBanner::CalculateBanStatus(in_addr ip_address) { Guard lguard(listBusy); list<IPBan>::iterator itr; list<IPBan>::iterator itr2 = banList.begin(); for(; itr2 != banList.end();) { itr = itr2; ++itr2; if( ParseCIDRBan(ip_address.s_addr, itr->Mask, itr->Bytes) ) { // ban hit if( itr->Expire == 0 ) return BAN_STATUS_PERMANENT_BAN; if( (uint32)UNIXTIME >= itr->Expire ) { sLogonSQL->Execute("DELETE FROM ipbans WHERE expire = %u AND ip = \"%s\"", itr->Expire, sLogonSQL->EscapeString(itr->db_ip).c_str()); banList.erase(itr); } else { return BAN_STATUS_TIME_LEFT_ON_BAN; } } } return BAN_STATUS_NOT_BANNED; } bool IPBanner::Add(const char * ip, uint32 dur) { string sip = string(ip); string::size_type i = sip.find("/"); if( i == string::npos ) return false; string stmp = sip.substr(0, i); string smask = sip.substr(i+1); unsigned int ipraw = MakeIP(stmp.c_str()); unsigned int ipmask = atoi(smask.c_str()); if( ipraw == 0 || ipmask == 0 ) return false; IPBan ipb; ipb.db_ip = sip; ipb.Bytes = ipmask; ipb.Mask = ipraw; listBusy.Acquire(); banList.push_back(ipb); listBusy.Release(); return true; } InformationCore::~InformationCore() { for( map<uint32, Realm*>::iterator itr = m_realms.begin(); itr != m_realms.end(); ++itr ) delete itr->second; } bool IPBanner::Remove(const char * ip) { listBusy.Acquire(); for(list<IPBan>::iterator itr = banList.begin(); itr != banList.end(); ++itr) { if( !strcmp(ip, itr->db_ip.c_str()) ) { banList.erase(itr); listBusy.Release(); return true; } } listBusy.Release(); return false; } void IPBanner::Reload() { listBusy.Acquire(); banList.clear(); QueryResult * result = sLogonSQL->Query("SELECT ip, expire FROM ipbans"); if( result != NULL ) { do { IPBan ipb; string smask= "32"; string ip = result->Fetch()[0].GetString(); string::size_type i = ip.find("/"); string stmp = ip.substr(0, i); if( i == string::npos ) { printf("IP ban \"%s\" netmask not specified. assuming /32 \n", ip.c_str()); } else smask = ip.substr(i+1); unsigned int ipraw = MakeIP(stmp.c_str()); unsigned int ipmask = atoi(smask.c_str()); if( ipraw == 0 || ipmask == 0 ) { printf("IP ban \"%s\" could not be parsed. Ignoring\n", ip.c_str()); continue; } ipb.Bytes = ipmask; ipb.Mask = ipraw; ipb.Expire = result->Fetch()[1].GetUInt32(); ipb.db_ip = ip; banList.push_back(ipb); } while (result->NextRow()); delete result; } listBusy.Release(); } Realm * InformationCore::AddRealm(uint32 realm_id, Realm * rlm) { realmLock.Acquire(); m_realms.insert( make_pair( realm_id, rlm ) ); map<uint32, Realm*>::iterator itr = m_realms.find(realm_id); realmLock.Release(); return rlm; } Realm * InformationCore::GetRealm(uint32 realm_id) { Realm * ret = 0; realmLock.Acquire(); map<uint32, Realm*>::iterator itr = m_realms.find(realm_id); if(itr != m_realms.end()) { ret = itr->second; } realmLock.Release(); return ret; } int32 InformationCore::GetRealmIdByName(string Name) { map<uint32, Realm*>::iterator itr = m_realms.begin(); for(; itr != m_realms.end(); ++itr) if (itr->second->Name == Name) { return itr->first; } return -1; } void InformationCore::RemoveRealm(uint32 realm_id) { realmLock.Acquire(); map<uint32, Realm*>::iterator itr = m_realms.find(realm_id); if(itr != m_realms.end()) { Log.Notice("InfoCore","Removing realm id:(%u) due to socket close.",realm_id); delete itr->second; m_realms.erase(itr); } realmLock.Release(); } void InformationCore::UpdateRealmStatus(uint32 realm_id, uint8 Color) { realmLock.Acquire(); map<uint32, Realm*>::iterator itr = m_realms.find(realm_id); if(itr != m_realms.end()) { itr->second->Colour = Color; } realmLock.Release(); } void InformationCore::SendRealms(AuthSocket * Socket) { realmLock.Acquire(); // packet header ByteBuffer data(m_realms.size() * 150 + 20); data << uint8(0x10); data << uint16(0); // Size Placeholder // dunno what this is.. data << uint32(0); //sAuthLogonChallenge_C * client = Socket->GetChallenge(); data << uint16(m_realms.size()); // loop realms :/ map<uint32, Realm*>::iterator itr = m_realms.begin(); HM_NAMESPACE::hash_map<uint32, uint8>::iterator it; for(; itr != m_realms.end(); ++itr) { // data << uint8(itr->second->Icon); // data << uint8(0); // Locked Flag // data << uint8(itr->second->Colour); data << uint8(itr->second->Icon); data << uint8(itr->second->Lock); // delete when using data << itr->second->Lock; data << uint8(itr->second->Colour); // This part is the same for all. data << itr->second->Name; data << itr->second->Address; // data << uint32(0x3fa1cac1); data << float(itr->second->Population); /* Get our character count */ it = itr->second->CharacterMap.find(Socket->GetAccountID()); data << uint8( (it == itr->second->CharacterMap.end()) ? 0 : it->second ); // data << uint8(1); // time zone // data << uint8(6); data << uint8( itr->second->TimeZone ); data << uint8( GetRealmIdByName( itr->second->Name ) ); //Realm ID } data << uint8(0x17); data << uint8(0); realmLock.Release(); // Re-calculate size. #ifdef USING_BIG_ENDIAN *(uint16*)&data.contents()[1] = swap16(uint16(data.size() - 3)); #else *(uint16*)&data.contents()[1] = uint16(data.size() - 3); #endif // Send to the socket. Socket->Send((const uint8*)data.contents(), uint32(data.size())); } void InformationCore::TimeoutSockets() { if(!usepings) return; /* burlex: this is vulnerable to race conditions, adding a mutex to it. */ serverSocketLock.Acquire(); uint32 t = uint32(time(NULL)); // check the ping time set<LogonCommServerSocket*>::iterator itr, it2; LogonCommServerSocket * s; for(itr = m_serverSockets.begin(); itr != m_serverSockets.end();) { s = *itr; it2 = itr; ++itr; if(s->last_ping < t && ((t - s->last_ping) > 300)) { // ping timeout printf("Closing socket due to ping timeout.\n"); s->removed = true; set<uint32>::iterator itr = s->server_ids.begin(); for(; itr != s->server_ids.end(); ++itr) // RemoveRealm(*itr); UpdateRealmStatus((*itr), 2); m_serverSockets.erase(it2); s->Disconnect(); } } serverSocketLock.Release(); } void InformationCore::CheckServers() { serverSocketLock.Acquire(); set<LogonCommServerSocket*>::iterator itr, it2; LogonCommServerSocket * s; for(itr = m_serverSockets.begin(); itr != m_serverSockets.end();) { s = *itr; it2 = itr; ++itr; if(!IsServerAllowed(s->GetRemoteAddress().s_addr)) { printf("Disconnecting socket: %s due to it no longer being on an allowed IP.\n", s->GetRemoteIP().c_str()); s->Disconnect(); } } serverSocketLock.Release(); }
[ "[email protected]@3074cc92-8d2b-11dd-8ab4-67102e0efeef", "[email protected]@3074cc92-8d2b-11dd-8ab4-67102e0efeef" ]
[ [ [ 1, 1 ], [ 4, 44 ], [ 46, 141 ], [ 144, 144 ], [ 146, 147 ], [ 165, 167 ], [ 170, 229 ], [ 232, 232 ], [ 234, 235 ], [ 253, 255 ], [ 258, 331 ], [ 338, 418 ], [ 430, 435 ], [ 437, 442 ], [ 454, 473 ], [ 477, 477 ], [ 480, 483 ], [ 486, 489 ], [ 494, 497 ], [ 500, 528 ], [ 530, 533 ], [ 538, 567 ] ], [ [ 2, 3 ], [ 45, 45 ], [ 142, 143 ], [ 145, 145 ], [ 148, 164 ], [ 168, 169 ], [ 230, 231 ], [ 233, 233 ], [ 236, 252 ], [ 256, 257 ], [ 332, 337 ], [ 419, 429 ], [ 436, 436 ], [ 443, 453 ], [ 474, 476 ], [ 478, 479 ], [ 484, 485 ], [ 490, 493 ], [ 498, 499 ], [ 529, 529 ], [ 534, 537 ] ] ]
e0e2d5140128d99612a903fa01691347b4dc928a
611fc0940b78862ca89de79a8bbeab991f5f471a
/src/Stage/SpecialScreens/TGSThanksForPlaying.cpp
1f1c0b9c54aa3a807054ebb3c0c0ceb64cd77406
[]
no_license
LakeIshikawa/splstage2
df1d8f59319a4e8d9375b9d3379c3548bc520f44
b4bf7caadf940773a977edd0de8edc610cd2f736
refs/heads/master
2021-01-10T21:16:45.430981
2010-01-29T08:57:34
2010-01-29T08:57:34
37,068,575
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
760
cpp
#include "TGSThanksForPlaying.h" #include "..\\..\\Management\\GameControl.h" #include "..\\..\\Event\\StageClearEvt.h" TGSThanksForPlaying::TGSThanksForPlaying() { mTimer = 0.0f; mFading = false; } TGSThanksForPlaying::~TGSThanksForPlaying() {} /* 画像の表示 */ void TGSThanksForPlaying::Process(){ if( !mFading ){ if( GAMECONTROL->GetFader()->FadeIn() ){ WAIT_TIMER(mTimer, 5.0f) mFading = true; WAIT_END } } else{ if( GAMECONTROL->GetFader()->FadeOut() ) GAMECONTROL->GetEventManager()->Request(new StageClearEvt()); } //描画 DX_DRAW("graphics\\screen\\TGS.png", 0, 0, 0, 0, SP->SCRSZX, SP->SCRSZY); } void TGSThanksForPlaying::Load() {} void TGSThanksForPlaying::UnLoad() {}
[ "lakeishikawa@c9935178-01ba-11df-8f7b-bfe16de6f99b" ]
[ [ [ 1, 39 ] ] ]
269c6ffdbc7711658025f3304c74272f6081cc77
29e87c19d99b77d379b2f9760f5e7afb3b3790fa
/src/audio/decoder_interface.cpp
98e934d573d6ee04c48ac00ff12de1838fff3e42
[]
no_license
wilcobrouwer/dmplayer
c0c63d9b641a0f76e426ed30c3a83089166d0000
9f767a15e25016f6ada4eff6a1cdd881ad922915
refs/heads/master
2021-05-30T17:23:21.889844
2011-03-29T08:51:52
2011-03-29T08:51:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,633
cpp
#include "decoder_interface.h" #include "../error-handling.h" #include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/utility/result_of.hpp> namespace { namespace ns_reghelper { std::vector<boost::function<IDecoderRef (IDataSourceRef)> > decoderlist; std::vector<std::string> decodernamelist; //#ifdef debug etc... /* template<typename T, class F> int doregister(F f); */ template<typename T> int doregister(IDecoderRef f(IDataSourceRef), std::string name) { decoderlist.push_back( boost::bind(& T::tryDecode, _1 ) ); decodernamelist.push_back(name); return 1; } template<typename T> int doregister(IDecoderRef (T::*f)(IDataSourceRef), std::string name) { decoderlist.push_back( boost::bind(& T::tryDecode, boost::shared_ptr<T>(new T()), _1 ) ); decodernamelist.push_back(name); return 2; } //template<typename T, class F> //static int doregister(F f) //{ // assert(false); //} } } //namespace { namespace nshelper { #define REGISTER_DECODER_CLASS(cls) namespace { \ namespace ns_cls_ ## cls { \ int x = ns_reghelper::doregister<cls>(&cls ::tryDecode, #cls); \ } \ } #include <decoder_linker.inc> #undef REGISTER_DECODER_CLASS IDecoderRef IDecoder::findDecoder(IDataSourceRef ds) { IDecoderRef decoder; if(ds) { for (unsigned int i = 0; i < ns_reghelper::decoderlist.size(); ++i) { ds->reset(); decoder = ns_reghelper::decoderlist[i](ds); if (decoder) { dcerr("Found a decoder: " << ns_reghelper::decodernamelist[i]); break; } } } return decoder; }
[ "simon.sasburg@e69229e2-1541-0410-bedc-87cb2d1b0d4b", "daniel.geelen@e69229e2-1541-0410-bedc-87cb2d1b0d4b", "daan.wissing@e69229e2-1541-0410-bedc-87cb2d1b0d4b" ]
[ [ [ 1, 8 ], [ 10, 10 ], [ 12, 12 ], [ 14, 14 ], [ 16, 21 ], [ 23, 26 ], [ 28, 34 ], [ 36, 45 ], [ 51, 58 ], [ 68, 70 ] ], [ [ 9, 9 ], [ 15, 15 ], [ 22, 22 ], [ 27, 27 ], [ 35, 35 ], [ 46, 50 ], [ 59, 67 ] ], [ [ 11, 11 ], [ 13, 13 ] ] ]
9e1cb55d9f9b615dc0aa763701ad069c73d73081
c508f45952a5900ef1d79503fc1051a2d4b7c71d
/darwinia/contrib/netlib/net_lib.h
904768fbb6659b871d7c46c6b48c74b94c32d243
[]
no_license
Minimalist-GameForks/Darwinia-and-Multiwinia-Source-Code
6a990a7c4e5e0c854ce3eaef2868682281c20e06
f909630267a320c8f8de5e30bbb2dbf5f3a68acf
refs/heads/master
2023-03-06T10:02:54.699906
2010-06-20T09:58:10
2010-06-20T09:58:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
990
h
// **************************************************************************** // Top level include file for NetLib // // NetLib - A very thin portable UDP network library // **************************************************************************** #ifndef INCLUDED_NET_LIB_H #define INCLUDED_NET_LIB_H #ifdef __APPLE__ #include "net_lib_apple.h" #endif #ifdef WIN32 #include "net_lib_win32.h" #endif #if (defined __linux__) #include "net_lib_linux.h" #endif #if (!defined MIN) #define MIN(a,b) ((a < b) ? a : b) #endif void NetDebugOut(char *fmt, ...); #define MAX_HOSTNAME_LEN 256 #define MAX_PACKET_SIZE 512 typedef struct sockaddr_in NetIpAddress; enum NetRetCode { NetFailed = -1, NetOk, NetTimedout, NetBadArgs, NetMoreData, NetClientDisconnect, NetNotSupported }; class NetLib { public: NetLib(); ~NetLib(); bool Initialise(); // Returns false on failure }; #endif
[ "root@9244cb4f-d52e-49a9-a756-7d4e53ad8306" ]
[ [ [ 1, 60 ] ] ]
0fae72e0e7adf864854a15added94f13fe09d126
5ac13fa1746046451f1989b5b8734f40d6445322
/minimangalore/Nebula2/code/UrbanExtreme/src/physics/boxentity.cc
a79bedf38aac91a8187df5c6b7d6949728359770
[]
no_license
moltenguy1/minimangalore
9f2edf7901e7392490cc22486a7cf13c1790008d
4d849672a6f25d8e441245d374b6bde4b59cbd48
refs/heads/master
2020-04-23T08:57:16.492734
2009-08-01T09:13:33
2009-08-01T09:13:33
35,933,330
0
0
null
null
null
null
UTF-8
C++
false
false
1,064
cc
//---------------------------------------------------------------------------- // (c) 2009 //---------------------------------------------------------------------------- #include "physics/boxentity.h" #include "physics/server.h" #include "physics/rigidbody.h" #include "physics/shape.h" #include "physics/boxshape.h" #include "physics/composite.h" #include "physics/level.h" #include "physics/physicsutil.h" #include "physics/compositeloader.h" namespace Physics { ImplementRtti(Physics::BoxEntity, Physics::Entity); ImplementFactory(Physics::BoxEntity); //---------------------------------------------------------------------------- /** */ BoxEntity::BoxEntity() : radius(0.3f), height(1.75f), hover(0.2f), nebCharacter(0) { } //---------------------------------------------------------------------------- /** */ BoxEntity::~BoxEntity() { } //---------------------------------------------------------------------------- // EOF //---------------------------------------------------------------------------- }
[ "ldw9981@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 43 ] ] ]
2867546f7eb4c695e740c437e9a1f2e8fdd23733
cb453e7f704363305d3190c2a6ea1ef8ace7adae
/VC6.0/CBMIRDoc.cpp
da13fc705f6ba835120a73f04ecdabbcc48707f1
[]
no_license
xidiandaily/cbmir
6d7b2fe7f35f8bc810283632f65564bcb03d9120
6c94dc3bf19bfd599cf092da5516361967969580
refs/heads/master
2021-01-22T23:16:23.147495
2010-08-20T13:12:55
2010-08-20T13:12:55
32,128,753
0
0
null
null
null
null
UTF-8
C++
false
false
2,387
cpp
// CBMIRDoc.cpp : implementation of the CCBMIRDoc class // #include "stdafx.h" #include "CBMIR.h" #include "CBMIRDoc.h" #include "SearchSetting.h" #include "CBMIRView.h" #include "MainFrm.h" #include "TestAlg.h" #include "JpegAlg.h" #include "KeyImageView.h" #include "IlView.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCBMIRDoc IMPLEMENT_DYNCREATE(CCBMIRDoc, CDocument) BEGIN_MESSAGE_MAP(CCBMIRDoc, CDocument) //{{AFX_MSG_MAP(CCBMIRDoc) ON_COMMAND(IDD_RETRIEVE_SETTING, OnRetrieveSetting) ON_COMMAND(IDD_RETRIEVE_START, OnRetrieveStart) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCBMIRDoc construction/destruction CCBMIRDoc::CCBMIRDoc(): pCBMIRView(NULL) , pIllView(NULL) , pImageView(NULL) , pKeyImageView(NULL) { m_algMgr.RegAlg(new CTestAlg("Test")); m_algMgr.RegAlg(new CJpegAlg("Jpeg")); } CCBMIRDoc::~CCBMIRDoc() { m_algMgr.UnRegAlgAll(); } BOOL CCBMIRDoc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CCBMIRDoc serialization void CCBMIRDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { } else { } } ///////////////////////////////////////////////////////////////////////////// // CCBMIRDoc diagnostics #ifdef _DEBUG void CCBMIRDoc::AssertValid() const { CDocument::AssertValid(); } void CCBMIRDoc::Dump(CDumpContext& dc) const { CDocument::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CCBMIRDoc commands void CCBMIRDoc::OnRetrieveSetting() { SearchSetting m_dlgSetting; if(m_dlgSetting.DoModal()==IDOK) { m_strImagePath=m_dlgSetting.m_strImagePath; m_strKeyImage=m_dlgSetting.m_strKeyImage; m_iImageNo=m_dlgSetting.m_ImageNum; if(pKeyImageView) { pKeyImageView->ShowKeyImage(m_strKeyImage); } if(pCBMIRView) { pCBMIRView->SetCell(m_iImageNo); } } } void CCBMIRDoc::OnRetrieveStart() { m_algMgr.RunAlg(pCBMIRView->m_hWnd,"Jpeg",m_strImagePath,m_strKeyImage,m_iImageNo); }
[ "xidiandaily@e93b7ebc-b7fa-8553-4986-dc886d89061e" ]
[ [ [ 1, 117 ] ] ]
26558e5737a703f6ec569cfa7af876a60d684688
cb4e269b5e2e963f84ef7c2e9fb5e2ba0352e4ea
/src/graphics/graphics_rasterizer.h
c74cbef28287cdde33e5362c7b5e74d062012d5f
[]
no_license
dasch/graphics
e0ce22bf0cf205989127cd9be9c3036502d66be2
ef5b90225623058de15c5332608cf0f41d0110e6
refs/heads/master
2020-05-19T19:22:55.136427
2010-04-05T19:33:01
2010-04-05T19:33:01
567,095
0
1
null
null
null
null
UTF-8
C++
false
false
5,559
h
#ifndef GRAPHICS_RASTERIZER_H #define GRAPHICS_RASTERIZER_H // // Graphics Framework. // Copyright (C) 2008 Department of Computer Science, University of Copenhagen // #include <stdexcept> namespace graphics { /** * This class describes an interface class for implementing a rasterizer. * One needs to make an inherited class like: * * template<typename math_types> * class MyRasterizer : public Rasterizer<math_types> * { * // add your implementation here * }; * * An instance of this new implementation can be passed to render pipeline * using the load_rasterizer-method. * */ template<typename math_types> class Rasterizer { public: typedef typename math_types::vector3_type vector3_type; typedef typename math_types::real_type real_type; public: Rasterizer(){} public: /** * Initialize the Point Rasterizer. * The rasterizer is specialized to scan-conversion of points only. It * is passed vertex data as its argument. * * Colors can be given in whatever coordinate system that one * pleases, but they should be linearly interpolated in screen-space. * * Vertex coordinates is implicitly assumed to have been transformed * into screen-space prior to invocation. * * @param in_vertex1 * @param in_color1 * */ virtual void init(vector3_type const& in_vertex1, vector3_type const& in_color1) { throw std::logic_error("No Point Rasterizer loaded."); } /** * Initialize the Line Rasterizer. * The rasterizer is specialized to scan-conversion of lines only. It * is passed vertex data as its argument. * * Colors can be given in whatever coordinate system that one * pleases, but they should be linearly interpolated in screen-space. * * Vertex coordinates is implicitly assumed to have been transformed * into screen-space prior to invocation. * * @param in_vertex1 * @param in_color1 * @param in_vertex2 * @param in_color2 * */ virtual void init(vector3_type const& in_vertex1, vector3_type const& in_color1, vector3_type const& in_vertex2, vector3_type const& in_color2) { throw std::logic_error("No Line Rasterizer loaded."); } /** * Initialize the Triangle Rasterizer. * The rasterizer is specialized to scan-conversion of triangles only. It * is passed vertex data as its argument. * * Normals and colors can be given in whatever coordinate system that one * pleases, but they should be linearly interpolated in screen-space. * * Vertex coordinates is implicitly assumed to have been transformed * into screen-space prior to invocation. * * @param in_vertex1 * @param in_normal1 * @param in_color1 * @param in_vertex2 * @param in_normal2 * @param in_color2 * @param in_vertex3 * @param in_normal3 * @param in_color3 * */ virtual void init(vector3_type const& in_vertex1, vector3_type const& in_world1, vector3_type const& in_normal1, vector3_type const& in_color1, vector3_type const& in_vertex2, vector3_type const& in_world2, vector3_type const& in_normal2, vector3_type const& in_color2, vector3_type const& in_vertex3, vector3_type const& in_world3, vector3_type const& in_normal3, vector3_type const& in_color3) { throw std::logic_error("No Triangle Rasterizer loaded."); } virtual bool DebugOn() = 0; virtual bool DebugOff() = 0; /** * Current x position of rasterizer position. * * @return The x-coordinate of the current ``pixel''. */ virtual int x() const = 0; /** * Current y position of rasterizer position. * * @return The y-coordinate of the current ``pixel''. */ virtual int y() const = 0; /** * Retrive the current z-value (depth). * * @return This method should return the current z-value of the current fragment. The z-value should ideally be computed in the canonical view-volume. */ virtual real_type depth() const = 0; /** * Get Position. * * @return The current (world coordinate) position of the current fragment. */ virtual vector3_type position() const = 0; /** * Get Normal. * * @return The current (world coordinate) normal of the current fragment. */ virtual vector3_type const& normal() const = 0; /** * Get Color. * * @return The current vertex color of the fragment. */ virtual vector3_type const& color() const = 0; /** * Rasterization Finished Query. * * @return If the current triangle that is being rasterized has more fragments then the return value is true otherwise it is false. */ virtual bool more_fragments() const = 0; /** * This method will ask the rastersizer to rasterize the next fragment. */ virtual void next_fragment() = 0; }; }// end namespace graphics // GRAPHICS_RASTERIZER_H #endif
[ [ [ 1, 187 ] ] ]
b71dec87ab007fe8284cd7e8415d9c9878142281
27bde5e083cf5a32f75de64421ba541b3a23dd29
/source/State_StartScreen.h
b13f59ebfae2662b9e2c2e4391350e19769c0614
[]
no_license
jbsheblak/fatal-inflation
229fc6111039aff4fd00bb1609964cf37e4303af
5d6c0a99e8c4791336cf529ed8ce63911a297a23
refs/heads/master
2021-03-12T19:22:31.878561
2006-10-20T21:48:17
2006-10-20T21:48:17
32,184,096
0
0
null
null
null
null
UTF-8
C++
false
false
979
h
//--------------------------------------------------- // Name: Game : StartScreen // Desc: the game start screen // Author: John Sheblak // Contact: [email protected] //--------------------------------------------------- #ifndef _GAME_STATE_STARTSCREEN_H_ #define _GAME_STATE_STARTSCREEN_H_ #include "StateMachine.h" #include "Types.h" #include "gamex.hpp" #include "MasterFile.h" #include "FileIO.h" #include "Gui.h" namespace Game { class State_StartScreen : public State { public: void Enter(); void Exit(); void Handle(); private: class StartButton : public GuiButtonControl { public: void OnClick( const jbsCommon::Vec2i& pos ); }; class EditButton : public GuiButtonControl { public: void OnClick( const jbsCommon::Vec2i& pos ); }; private: GuiElement* mGui; GameSaveFile::SaveFile mSaveFile; }; }; //end Game #endif // end _GAME_STATE_STARTSCREEN_H_
[ "jbsheblak@5660b91f-811d-0410-8070-91869aa11e15" ]
[ [ [ 1, 52 ] ] ]
3db64d1bda11da32f43d00b2f7913c2328cf7350
d37a1d5e50105d82427e8bf3642ba6f3e56e06b8
/DVR/HaohanITPlayer/public/Common/SysUtils/Windows/WinFilePathUtils.h
12d6bd981800f944321efba89a09e44b912bade3
[]
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
872
h
//----------------------------------------------------------------------------- // WinFilePathUtils.h // Eduard Kegulskiy // Copyright (c) 2004, Haohanit. All rights reserved. //----------------------------------------------------------------------------- //SR FS: Reviewed [wwt 20040914] //SR FS: Reviewed [DDT 20040928] Second pass. //SR FS: Reviewed [JAW 20040928] #if defined _WIN32 // this file will return a name that is guaranteed to be valid in the current code page // it will use short name if the full name contains Unicode characters not supported by the code page bool GetCodePageFilePath(const std::wstring& unicodePath, std::wstring& codePagePath); // this will determine if the file name (or any string) contains Unicode characters // not supported by System code page bool IsUnicodePath( const std::wstring& pathToCheck ); #endif
[ "[email protected]@27769579-7047-b306-4d6f-d36f87483bb3" ]
[ [ [ 1, 19 ] ] ]
3c37496cd6cd1ac846ee91346468830c13e79ba2
f8b364974573f652d7916c3a830e1d8773751277
/emulator/allegrex/instructions/VASIN.h
cf61257509a3874293d723f182d0a2b8be5789b4
[]
no_license
lemmore22/pspe4all
7a234aece25340c99f49eac280780e08e4f8ef49
77ad0acf0fcb7eda137fdfcb1e93a36428badfd0
refs/heads/master
2021-01-10T08:39:45.222505
2009-08-02T11:58:07
2009-08-02T11:58:07
55,047,469
0
0
null
null
null
null
UTF-8
C++
false
false
1,042
h
template< > struct AllegrexInstructionTemplate< 0xd0170000, 0xffff0000 > : AllegrexInstructionUnknown { static AllegrexInstructionTemplate &self() { static AllegrexInstructionTemplate insn; return insn; } static AllegrexInstruction *get_instance() { return &AllegrexInstructionTemplate::self(); } virtual AllegrexInstruction *instruction(u32 opcode) { return this; } virtual char const *opcode_name() { return "VASIN"; } virtual void interpret(Processor &processor, u32 opcode); virtual void disassemble(u32 address, u32 opcode, char *opcode_name, char *operands, char *comment); protected: AllegrexInstructionTemplate() {} }; typedef AllegrexInstructionTemplate< 0xd0170000, 0xffff0000 > AllegrexInstruction_VASIN; namespace Allegrex { extern AllegrexInstruction_VASIN &VASIN; } #ifdef IMPLEMENT_INSTRUCTION AllegrexInstruction_VASIN &Allegrex::VASIN = AllegrexInstruction_VASIN::self(); #endif
[ [ [ 1, 41 ] ] ]
4ef0670d180bd18978eee2d8d68cc51dc8301bc6
83ed25c6e6b33b2fabd4f81bf91d5fae9e18519c
/code/fast_atof.h
90b67725dbf843c2dfe34a070e4195a2158a7ddc
[ "BSD-3-Clause" ]
permissive
spring/assimp
fb53b91228843f7677fe8ec18b61d7b5886a6fd3
db29c9a20d0dfa9f98c8fd473824bba5a895ae9e
refs/heads/master
2021-01-17T23:19:56.511185
2011-11-08T12:15:18
2011-11-08T12:15:18
2,017,841
1
1
null
null
null
null
UTF-8
C++
false
false
8,331
h
// Copyright (C) 2002-2007 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h // ------------------------------------------------------------------------------------ // Original description: (Schrompf) // Adapted to the ASSIMP library because the builtin atof indeed takes AGES to parse a // float inside a large string. Before parsing, it does a strlen on the given point. // Changes: // 22nd October 08 (Aramis_acg): Added temporary cast to double, added strtoul10_64 // to ensure long numbers are handled correctly // ------------------------------------------------------------------------------------ #ifndef __FAST_A_TO_F_H_INCLUDED__ #define __FAST_A_TO_F_H_INCLUDED__ #include <math.h> namespace Assimp { const float fast_atof_table[16] = { // we write [16] here instead of [] to work around a swig bug 0.f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f, 0.0000000001f, 0.00000000001f, 0.000000000001f, 0.0000000000001f, 0.00000000000001f, 0.000000000000001f }; // ------------------------------------------------------------------------------------ // Convert a string in decimal format to a number // ------------------------------------------------------------------------------------ inline unsigned int strtoul10( const char* in, const char** out=0) { unsigned int value = 0; bool running = true; while ( running ) { if ( *in < '0' || *in > '9' ) break; value = ( value * 10 ) + ( *in - '0' ); ++in; } if (out)*out = in; return value; } // ------------------------------------------------------------------------------------ // Convert a string in octal format to a number // ------------------------------------------------------------------------------------ inline unsigned int strtoul8( const char* in, const char** out=0) { unsigned int value = 0; bool running = true; while ( running ) { if ( *in < '0' || *in > '7' ) break; value = ( value << 3 ) + ( *in - '0' ); ++in; } if (out)*out = in; return value; } // ------------------------------------------------------------------------------------ // Convert a string in hex format to a number // ------------------------------------------------------------------------------------ inline unsigned int strtoul16( const char* in, const char** out=0) { unsigned int value = 0; bool running = true; while ( running ) { if ( *in >= '0' && *in <= '9' ) { value = ( value << 4u ) + ( *in - '0' ); } else if (*in >= 'A' && *in <= 'F') { value = ( value << 4u ) + ( *in - 'A' ) + 10; } else if (*in >= 'a' && *in <= 'f') { value = ( value << 4u ) + ( *in - 'a' ) + 10; } else break; ++in; } if (out)*out = in; return value; } // ------------------------------------------------------------------------------------ // Convert just one hex digit // Return value is UINT_MAX if the input character is not a hex digit. // ------------------------------------------------------------------------------------ inline unsigned int HexDigitToDecimal(char in) { unsigned int out = UINT_MAX; if (in >= '0' && in <= '9') out = in - '0'; else if (in >= 'a' && in <= 'f') out = 10u + in - 'a'; else if (in >= 'A' && in <= 'F') out = 10u + in - 'A'; // return value is UINT_MAX if the input is not a hex digit return out; } // ------------------------------------------------------------------------------------ // Convert a hex-encoded octet (2 characters, i.e. df or 1a). // ------------------------------------------------------------------------------------ inline uint8_t HexOctetToDecimal(const char* in) { return ((uint8_t)HexDigitToDecimal(in[0])<<4)+(uint8_t)HexDigitToDecimal(in[1]); } // ------------------------------------------------------------------------------------ // signed variant of strtoul10 // ------------------------------------------------------------------------------------ inline int strtol10( const char* in, const char** out=0) { bool inv = (*in=='-'); if (inv || *in=='+') ++in; int value = strtoul10(in,out); if (inv) { value = -value; } return value; } // ------------------------------------------------------------------------------------ // Parse a C++-like integer literal - hex and oct prefixes. // 0xNNNN - hex // 0NNN - oct // NNN - dec // ------------------------------------------------------------------------------------ inline unsigned int strtoul_cppstyle( const char* in, const char** out=0) { if ('0' == in[0]) { return 'x' == in[1] ? strtoul16(in+2,out) : strtoul8(in+1,out); } return strtoul10(in, out); } // ------------------------------------------------------------------------------------ // Special version of the function, providing higher accuracy and safety // It is mainly used by fast_atof to prevent ugly and unwanted integer overflows. // ------------------------------------------------------------------------------------ inline uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int* max_inout=0) { unsigned int cur = 0; uint64_t value = 0; bool running = true; while ( running ) { if ( *in < '0' || *in > '9' ) break; const uint64_t new_value = ( value * 10 ) + ( *in - '0' ); if (new_value < value) /* numeric overflow, we rely on you */ return value; value = new_value; ++in; ++cur; if (max_inout && *max_inout == cur) { if (out) { /* skip to end */ while (*in >= '0' && *in <= '9') ++in; *out = in; } return value; } } if (out) *out = in; if (max_inout) *max_inout = cur; return value; } // Number of relevant decimals for floating-point parsing. #define AI_FAST_ATOF_RELAVANT_DECIMALS 10 // ------------------------------------------------------------------------------------ //! Provides a fast function for converting a string into a float, //! about 6 times faster than atof in win32. // If you find any bugs, please send them to me, niko (at) irrlicht3d.org. // ------------------------------------------------------------------------------------ inline const char* fast_atof_move( const char* c, float& out) { float f; bool inv = (*c=='-'); if (inv || *c=='+') ++c; f = (float) strtoul10_64 ( c, &c); if (*c == '.' || (c[0] == ',' && (c[1] >= '0' || c[1] <= '9'))) // allow for commas, too { ++c; // NOTE: The original implementation is highly unaccurate here. The precision of a single // IEEE 754 float is not high enough, everything behind the 6th digit tends to be more // inaccurate than it would need to be. Casting to double seems to solve the problem. // strtol_64 is used to prevent integer overflow. // Another fix: this tends to become 0 for long numbers if we don't limit the maximum // number of digits to be read. AI_FAST_ATOF_RELAVANT_DECIMALS can be a value between // 1 and 15. unsigned int diff = AI_FAST_ATOF_RELAVANT_DECIMALS; double pl = (double) strtoul10_64 ( c, &c, &diff ); pl *= fast_atof_table[diff]; f += (float)pl; } // A major 'E' must be allowed. Necessary for proper reading of some DXF files. // Thanks to Zhao Lei to point out that this if() must be outside the if (*c == '.' ..) if (*c == 'e' || *c == 'E') { ++c; bool einv = (*c=='-'); if (einv || *c=='+') ++c; float exp = (float)strtoul10_64(c, &c); if (einv) exp *= -1.0f; f *= pow(10.0f, exp); } if (inv) f *= -1.0f; out = f; return c; } // ------------------------------------------------------------------------------------ // The same but more human. inline float fast_atof(const char* c) { float ret; fast_atof_move(c, ret); return ret; } inline float fast_atof( const char* c, const char** cout) { float ret; *cout = fast_atof_move(c, ret); return ret; } inline float fast_atof( const char** inout) { float ret; *inout = fast_atof_move(*inout, ret); return ret; } } // end of namespace Assimp #endif
[ "kimmi@67173fc5-114c-0410-ac8e-9d2fd5bffc1f", "aramis_acg@67173fc5-114c-0410-ac8e-9d2fd5bffc1f" ]
[ [ [ 1, 3 ], [ 7, 8 ], [ 14, 41 ], [ 47, 58 ], [ 60, 62 ], [ 70, 71 ], [ 90, 91 ], [ 181, 182 ], [ 221, 223 ], [ 225, 228 ], [ 231, 232 ], [ 235, 237 ], [ 252, 252 ], [ 260, 261 ], [ 265, 265 ], [ 267, 275 ], [ 278, 284 ], [ 302, 305 ] ], [ [ 4, 6 ], [ 9, 13 ], [ 42, 46 ], [ 59, 59 ], [ 63, 69 ], [ 72, 89 ], [ 92, 180 ], [ 183, 220 ], [ 224, 224 ], [ 229, 230 ], [ 233, 234 ], [ 238, 251 ], [ 253, 259 ], [ 262, 264 ], [ 266, 266 ], [ 276, 277 ], [ 285, 301 ] ] ]
698e69d339125b61451eaf68eb8fe20f8d8bbdd9
0813282678cb6bb52cd0001a760cfbc24663cfca
/TerranCommand.cpp
15a0e598ab3563e658886a8fe0c78cc8351df11e
[]
no_license
mannyzhou5/scbuildorder
e3850a86baaa33d1c549c7b89ddab7738b79b3c0
2396293ee483e40495590782b652320db8adf530
refs/heads/master
2020-04-29T01:01:04.504099
2011-04-12T10:00:54
2011-04-12T10:00:54
33,047,073
0
0
null
null
null
null
UTF-8
C++
false
false
26,581
cpp
#include "stdafx.h" #include "TerranCommand.h" const WCHAR *tostring(EOutputFormat format, ETerranCommand command) { switch(format) { case eOutputFormatSimple: case eOutputFormatHaploid: case eOutputFormatSC2Gears: switch(command) { case eTerranCommandBuildCommandCenter: return L"Command Center"; case eTerranCommandBuildRefinery: return L"Refinery"; case eTerranCommandBuildSupplyDepot: return L"Supply Depot"; case eTerranCommandBuildBarracksNaked: return L"Barracks (Naked)"; case eTerranCommandBuildBarracksOnTechLab: return L"Barracks (on Tech Lab)"; case eTerranCommandBuildBarracksOnReactor: return L"Barracks (on Reactor)"; case eTerranCommandBuildOrbitalCommand: return L"Orbital Command"; case eTerranCommandBuildEngineeringBay: return L"Engineering Bay"; case eTerranCommandBuildBunker: return L"Bunker"; case eTerranCommandBuildMissileTurret: return L"Missile Turret"; case eTerranCommandBuildSensorTower: return L"Sensor Tower"; case eTerranCommandBuildPlanetaryFortress: return L"Planetary Fortress"; case eTerranCommandBuildGhostAcademy: return L"Ghost Academy"; case eTerranCommandBuildFactoryNaked: return L"Factory (Naked)"; case eTerranCommandBuildFactoryOnTechLab: return L"Factory (on Tech Lab)"; case eTerranCommandBuildFactoryOnReactor: return L"Factory (on Reactor)"; case eTerranCommandBuildArmory: return L"Armory"; case eTerranCommandBuildStarportNaked: return L"Starport (Naked)"; case eTerranCommandBuildStarportOnTechLab: return L"Starport (on Tech Lab)"; case eTerranCommandBuildStarportOnReactor: return L"Starport (on Reactor)"; case eTerranCommandBuildFusionCore: return L"Fusion Core"; case eTerranCommandBuildBarracksTechLab: return L"Barracks Tech Lab"; case eTerranCommandBuildBarracksReactor: return L"Barracks Reactor"; case eTerranCommandBuildFactoryTechLab: return L"Factory Tech Lab"; case eTerranCommandBuildFactoryReactor: return L"Factory Reactor"; case eTerranCommandBuildStarportTechLab: return L"Starport Tech Lab"; case eTerranCommandBuildStarportReactor: return L"Starport Reactor"; case eTerranCommandLiftBarracksTechLab: return L"Lift Barracks (Tech Lab)"; case eTerranCommandLiftBarracksReactor: return L"Lift Barracks (Reactor)"; case eTerranCommandLiftBarracksNaked: return L"Lift Barracks (Naked)"; case eTerranCommandLiftFactoryTechLab: return L"Lift Factory (Tech Lab)"; case eTerranCommandLiftFactoryReactor: return L"Lift Factory (Reactor)"; case eTerranCommandLiftFactoryNaked: return L"Lift Factory (Naked)"; case eTerranCommandLiftStarportTechLab: return L"Lift Starport (Tech Lab)"; case eTerranCommandLiftStarportReactor: return L"Lift Starport (Reactor)"; case eTerranCommandLiftStarportNaked: return L"Lift Starport (Naked)"; case eTerranCommandLandBarracksTechLab: return L"Land Barracks (Tech Lab)"; case eTerranCommandLandBarracksReactor: return L"Land Barracks (Reactor)"; case eTerranCommandLandBarracksNaked: return L"Land Barracks (Naked)"; case eTerranCommandLandFactoryTechLab: return L"Land Factory (Tech Lab)"; case eTerranCommandLandFactoryReactor: return L"Land Factory (Reactor)"; case eTerranCommandLandFactoryNaked: return L"Land Factory (Naked)"; case eTerranCommandLandStarportTechLab: return L"Land Starport (Tech Lab)"; case eTerranCommandLandStarportReactor: return L"Land Starport (Reactor)"; case eTerranCommandLandStarportNaked: return L"Land Starport (Naked)"; case eTerranCommandBuildSCV: return L"SCV"; case eTerranCommandBuildMarine: return L"Marine"; case eTerranCommandBuildMarineNaked: return L"Marine (@ Naked Barracks)"; case eTerranCommandBuildMarineReactor: return L"Marine (@ Reactor Barracks)"; case eTerranCommandBuildMarineTechLab: return L"Marine (@ Tech Lab Barracks)"; case eTerranCommandBuildMarauder: return L"Marauder"; case eTerranCommandBuildReaper: return L"Reaper"; case eTerranCommandBuildGhost: return L"Ghost"; case eTerranCommandBuildHellion: return L"Hellion"; case eTerranCommandBuildHellionNaked: return L"Hellion (@ Naked Factory)"; case eTerranCommandBuildHellionReactor: return L"Hellion (@ Reactor Factory)"; case eTerranCommandBuildHellionTechLab: return L"Hellion (@ Tech Lab Factory)"; case eTerranCommandBuildSiegeTank: return L"Siege Tank"; case eTerranCommandBuildThor: return L"Thor"; case eTerranCommandBuildViking: return L"Viking"; case eTerranCommandBuildVikingNaked: return L"Viking (@ Naked Starport)"; case eTerranCommandBuildVikingReactor: return L"Viking (@ Reactor Starport)"; case eTerranCommandBuildVikingTechLab: return L"Viking (@ Tech Lab Starport)"; case eTerranCommandBuildMedivac: return L"Medivac"; case eTerranCommandBuildMedivacNaked: return L"Medivac (@ Naked Starport)"; case eTerranCommandBuildMedivacReactor: return L"Medivac (@ Reactor Starport)"; case eTerranCommandBuildMedivacTechLab: return L"Medivac (@ Tech Lab Starport)"; case eTerranCommandBuildRaven: return L"Raven"; case eTerranCommandBuildBanshee: return L"Banshee"; case eTerranCommandBuildBattleCruiser: return L"Battle Cruiser"; case eTerranCommandCalldownMULE: return L"Calldown MULE"; case eTerranCommandCalldownExtraSupplies: return L"Calldown Extra Supplies"; case eTerranCommandScannerSweep: return L"Scanner Sweep"; case eTerranCommandResearchStimpack: return L"Stimpack"; case eTerranCommandResearchCombatShield: return L"Combat Shield"; case eTerranCommandResearchNitroPacks: return L"Nitro Packs"; case eTerranCommandResearchConcussiveShells: return L"Concussive Shells"; case eTerranCommandResearchInfantryWeapons1: return L"Infantry Weapons 1"; case eTerranCommandResearchInfantryWeapons2: return L"Infantry Weapons 2"; case eTerranCommandResearchInfantryWeapons3: return L"Infantry Weapons 3"; case eTerranCommandResearchInfantryArmor1: return L"Infantry Armor 1"; case eTerranCommandResearchInfantryArmor2: return L"Infantry Armor 2"; case eTerranCommandResearchInfantryArmor3: return L"Infantry Armor 3"; case eTerranCommandResearchBuildingArmor: return L"Building Armor"; case eTerranCommandResearchHiSecAutoTracking: return L"Hi-Sec Auto Tracking"; case eTerranCommandResearchNeoSteelFrame: return L"Neo-steel Frame"; case eTerranCommandResearchMoebiusReactor: return L"Moebius Reactor"; case eTerranCommandResearchPersonalCloaking: return L"Personal Cloaking"; case eTerranCommandArmNuke: return L"Arm Nuke"; case eTerranCommandResearchInfernalPreIgniter: return L"Infernal Pre-igniter"; case eTerranCommandResearchSiegeTech: return L"Siege Tech"; case eTerranCommandResearch250mmStrikeCannons: return L"250mm Strike Cannons"; case eTerranCommandResearchVehicleWeapons1: return L"Vehicle Weapons 1"; case eTerranCommandResearchVehicleWeapons2: return L"Vehicle Weapons 2"; case eTerranCommandResearchVehicleWeapons3: return L"Vehicle Weapons 3"; case eTerranCommandResearchVehiclePlating1: return L"Vehicle Plating 1"; case eTerranCommandResearchVehiclePlating2: return L"Vehicle Plating 2"; case eTerranCommandResearchVehiclePlating3: return L"Vehicle Plating 3"; case eTerranCommandResearchShipWeapons1: return L"Ship Weapons 1"; case eTerranCommandResearchShipWeapons2: return L"Ship Weapons 2"; case eTerranCommandResearchShipWeapons3: return L"Ship Weapons 3"; case eTerranCommandResearchShipPlating1: return L"Ship Plating 1"; case eTerranCommandResearchShipPlating2: return L"Ship Plating 2"; case eTerranCommandResearchShipPlating3: return L"Ship Plating 3"; case eTerranCommandResearchDurableMaterials: return L"Durable Materials"; case eTerranCommandResearchCorvidReactor: return L"Corvid Reactor"; case eTerranCommandResearchCaduceusReactor: return L"Caduceus Reactor"; case eTerranCommandResearchSeekerMissile: return L"Seeker Missile"; case eTerranCommandResearchCloakingField: return L"Cloaking Field"; case eTerranCommandResearchBehemothReactor: return L"Behemoth Reactor"; case eTerranCommandResearchWeaponRefit: return L"Weapon Refit"; case eTerranCommandMoveSCVToGas: if(eOutputFormatHaploid == format) return L"+1 on gas"; else return L"Move SCV To Gas"; case eTerranCommandMoveSCVToMinerals: if(eOutputFormatHaploid == format) return L"+1 off gas"; else return L"Move SCV To Minerals"; } break; case eOutputFormatDetailed: case eOutputFormatFull: switch(command) { case eTerranCommandBuildCommandCenter: return L"Build Command Center"; case eTerranCommandBuildRefinery: return L"Build Refinery"; case eTerranCommandBuildSupplyDepot: return L"Build Supply Depot"; case eTerranCommandBuildBarracksNaked: return L"Build Barracks (Naked)"; case eTerranCommandBuildBarracksOnTechLab: return L"Build Barracks (on Tech Lab)"; case eTerranCommandBuildBarracksOnReactor: return L"Build Barracks (on Reactor)"; case eTerranCommandBuildOrbitalCommand: return L"Build Orbital Command"; case eTerranCommandBuildEngineeringBay: return L"Build Engineering Bay"; case eTerranCommandBuildBunker: return L"Build Bunker"; case eTerranCommandBuildMissileTurret: return L"Build Missile Turret"; case eTerranCommandBuildSensorTower: return L"Build Sensor Tower"; case eTerranCommandBuildPlanetaryFortress: return L"Build Planetary Fortress"; case eTerranCommandBuildGhostAcademy: return L"Build Ghost Academy"; case eTerranCommandBuildFactoryNaked: return L"Build Factory (Naked)"; case eTerranCommandBuildFactoryOnTechLab: return L"Build Factory (on Tech Lab)"; case eTerranCommandBuildFactoryOnReactor: return L"Build Factory (on Reactor)"; case eTerranCommandBuildArmory: return L"Build Armory"; case eTerranCommandBuildStarportNaked: return L"Build Starport (Naked)"; case eTerranCommandBuildStarportOnTechLab: return L"Build Starport (on Tech Lab)"; case eTerranCommandBuildStarportOnReactor: return L"Build Starport (on Reactor)"; case eTerranCommandBuildFusionCore: return L"Build Fusion Core"; case eTerranCommandBuildBarracksTechLab: return L"Build Barracks Tech Lab"; case eTerranCommandBuildBarracksReactor: return L"Build Barracks Reactor"; case eTerranCommandBuildFactoryTechLab: return L"Build Factory Tech Lab"; case eTerranCommandBuildFactoryReactor: return L"Build Factory Reactor"; case eTerranCommandBuildStarportTechLab: return L"Build Starport Tech Lab"; case eTerranCommandBuildStarportReactor: return L"Build Starport Reactor"; case eTerranCommandLiftBarracksTechLab: return L"Lift Barracks (Tech Lab)"; case eTerranCommandLiftBarracksReactor: return L"Lift Barracks (Reactor)"; case eTerranCommandLiftBarracksNaked: return L"Lift Barracks (Naked)"; case eTerranCommandLiftFactoryTechLab: return L"Lift Factory (Tech Lab)"; case eTerranCommandLiftFactoryReactor: return L"Lift Factory (Reactor)"; case eTerranCommandLiftFactoryNaked: return L"Lift Factory (Naked)"; case eTerranCommandLiftStarportTechLab: return L"Lift Starport (Tech Lab)"; case eTerranCommandLiftStarportReactor: return L"Lift Starport (Reactor)"; case eTerranCommandLiftStarportNaked: return L"Lift Starport (Naked)"; case eTerranCommandLandBarracksTechLab: return L"Land Barracks (Tech Lab)"; case eTerranCommandLandBarracksReactor: return L"Land Barracks (Reactor)"; case eTerranCommandLandBarracksNaked: return L"Land Barracks (Naked)"; case eTerranCommandLandFactoryTechLab: return L"Land Factory (Tech Lab)"; case eTerranCommandLandFactoryReactor: return L"Land Factory (Reactor)"; case eTerranCommandLandFactoryNaked: return L"Land Factory (Naked)"; case eTerranCommandLandStarportTechLab: return L"Land Starport (Tech Lab)"; case eTerranCommandLandStarportReactor: return L"Land Starport (Reactor)"; case eTerranCommandLandStarportNaked: return L"Land Starport (Naked)"; case eTerranCommandBuildSCV: return L"Build SCV"; case eTerranCommandBuildMarine: return L"Build Marine"; case eTerranCommandBuildMarineNaked: return L"Build Marine (@ Naked Barracks)"; case eTerranCommandBuildMarineReactor: return L"Build Marine (@ Reactor Barracks)"; case eTerranCommandBuildMarineTechLab: return L"Build Marine (@ Tech Lab Barracks)"; case eTerranCommandBuildMarauder: return L"Build Marauder"; case eTerranCommandBuildReaper: return L"Build Reaper"; case eTerranCommandBuildGhost: return L"Build Ghost"; case eTerranCommandBuildHellion: return L"Build Hellion"; case eTerranCommandBuildHellionNaked: return L"Build Hellion (@ Naked Factory)"; case eTerranCommandBuildHellionReactor: return L"Build Hellion (@ Reactor Factory)"; case eTerranCommandBuildHellionTechLab: return L"Build Hellion (@ Tech Lab Factory)"; case eTerranCommandBuildSiegeTank: return L"Build Siege Tank"; case eTerranCommandBuildThor: return L"Build Thor"; case eTerranCommandBuildViking: return L"Build Viking"; case eTerranCommandBuildVikingNaked: return L"Build Viking (@ Naked Starport)"; case eTerranCommandBuildVikingReactor: return L"Build Viking (@ Reactor Starport)"; case eTerranCommandBuildVikingTechLab: return L"Build Viking (@ Tech Lab Starport)"; case eTerranCommandBuildMedivac: return L"Build Medivac"; case eTerranCommandBuildMedivacNaked: return L"Build Medivac (@ Naked Starport)"; case eTerranCommandBuildMedivacReactor: return L"Build Medivac (@ Reactor Starport)"; case eTerranCommandBuildMedivacTechLab: return L"Build Medivac (@ Tech Lab Starport)"; case eTerranCommandBuildRaven: return L"Build Raven"; case eTerranCommandBuildBanshee: return L"Build Banshee"; case eTerranCommandBuildBattleCruiser: return L"Build Battle Cruiser"; case eTerranCommandCalldownMULE: return L"Calldown MULE"; case eTerranCommandCalldownExtraSupplies: return L"Calldown Extra Supplies"; case eTerranCommandScannerSweep: return L"Scanner Sweep"; case eTerranCommandResearchStimpack: return L"Research Stimpack"; case eTerranCommandResearchCombatShield: return L"Research Combat Shield"; case eTerranCommandResearchNitroPacks: return L"Research Nitro Packs"; case eTerranCommandResearchConcussiveShells: return L"Research Concussive Shells"; case eTerranCommandResearchInfantryWeapons1: return L"Research Infantry Weapons 1"; case eTerranCommandResearchInfantryWeapons2: return L"Research Infantry Weapons 2"; case eTerranCommandResearchInfantryWeapons3: return L"Research Infantry Weapons 3"; case eTerranCommandResearchInfantryArmor1: return L"Research Infantry Armor 1"; case eTerranCommandResearchInfantryArmor2: return L"Research Infantry Armor 2"; case eTerranCommandResearchInfantryArmor3: return L"Research Infantry Armor 3"; case eTerranCommandResearchBuildingArmor: return L"Research Building Armor"; case eTerranCommandResearchHiSecAutoTracking: return L"Research Hi-Sec Auto Tracking"; case eTerranCommandResearchNeoSteelFrame: return L"Research Neo-steel Frame"; case eTerranCommandResearchMoebiusReactor: return L"Research Moebius Reactor"; case eTerranCommandResearchPersonalCloaking: return L"Research Personal Cloaking"; case eTerranCommandArmNuke: return L"Arm Nuke"; case eTerranCommandResearchInfernalPreIgniter: return L"Research Infernal Pre-igniter"; case eTerranCommandResearchSiegeTech: return L"Research Siege Tech"; case eTerranCommandResearch250mmStrikeCannons: return L"Research 250mm Strike Cannons"; case eTerranCommandResearchVehicleWeapons1: return L"Research Vehicle Weapons 1"; case eTerranCommandResearchVehicleWeapons2: return L"Research Vehicle Weapons 2"; case eTerranCommandResearchVehicleWeapons3: return L"Research Vehicle Weapons 3"; case eTerranCommandResearchVehiclePlating1: return L"Research Vehicle Plating 1"; case eTerranCommandResearchVehiclePlating2: return L"Research Vehicle Plating 2"; case eTerranCommandResearchVehiclePlating3: return L"Research Vehicle Plating 3"; case eTerranCommandResearchShipWeapons1: return L"Research Ship Weapons 1"; case eTerranCommandResearchShipWeapons2: return L"Research Ship Weapons 2"; case eTerranCommandResearchShipWeapons3: return L"Research Ship Weapons 3"; case eTerranCommandResearchShipPlating1: return L"Research Ship Plating 1"; case eTerranCommandResearchShipPlating2: return L"Research Ship Plating 2"; case eTerranCommandResearchShipPlating3: return L"Research Ship Plating 3"; case eTerranCommandResearchDurableMaterials: return L"Research Durable Materials"; case eTerranCommandResearchCorvidReactor: return L"Research Corvid Reactor"; case eTerranCommandResearchCaduceusReactor: return L"Research Caduceus Reactor"; case eTerranCommandResearchSeekerMissile: return L"Research Seeker Missile"; case eTerranCommandResearchCloakingField: return L"Research Cloaking Field"; case eTerranCommandResearchBehemothReactor: return L"Research Behemoth Reactor"; case eTerranCommandResearchWeaponRefit: return L"Research Weapon Refit"; case eTerranCommandMoveSCVToGas: return L"Move SCV To Gas"; case eTerranCommandMoveSCVToMinerals: return L"Move SCV To Minerals"; } break; case eOutputFormatYABOT: switch(command) { case eTerranCommandBuildCommandCenter: return L"0 3 0"; case eTerranCommandBuildRefinery: return L"0 12 0"; case eTerranCommandBuildSupplyDepot: return L"0 15 0"; case eTerranCommandBuildBarracksNaked: case eTerranCommandBuildBarracksOnTechLab: case eTerranCommandBuildBarracksOnReactor: return L"0 1 0"; case eTerranCommandBuildOrbitalCommand: return L"2 0 0"; case eTerranCommandBuildEngineeringBay: return L"0 4 0"; case eTerranCommandBuildBunker: return L"0 2 0"; case eTerranCommandBuildMissileTurret: return L"0 8 0"; case eTerranCommandBuildSensorTower: return L"0 13 0"; case eTerranCommandBuildPlanetaryFortress: return L"2 1 0"; case eTerranCommandBuildGhostAcademy: return L"0 7 0"; case eTerranCommandBuildFactoryNaked: case eTerranCommandBuildFactoryOnTechLab: case eTerranCommandBuildFactoryOnReactor: return L"0 5 0"; case eTerranCommandBuildArmory: return L"0 0 0"; case eTerranCommandBuildStarportNaked: case eTerranCommandBuildStarportOnTechLab: case eTerranCommandBuildStarportOnReactor: return L"0 14 0"; case eTerranCommandBuildFusionCore: return L"0 6 0"; case eTerranCommandBuildBarracksTechLab: return L"0 16 0"; case eTerranCommandBuildFactoryTechLab: return L"0 17 0"; case eTerranCommandBuildStarportTechLab: return L"0 18 0"; case eTerranCommandBuildBarracksReactor: return L"0 9 0"; case eTerranCommandBuildFactoryReactor: return L"0 10 0"; case eTerranCommandBuildStarportReactor: return L"0 11 0"; case eTerranCommandLiftBarracksTechLab: case eTerranCommandLiftBarracksReactor: case eTerranCommandLiftBarracksNaked: case eTerranCommandLiftFactoryTechLab: case eTerranCommandLiftFactoryReactor: case eTerranCommandLiftFactoryNaked: case eTerranCommandLiftStarportTechLab: case eTerranCommandLiftStarportReactor: case eTerranCommandLiftStarportNaked: return L""; case eTerranCommandLandBarracksTechLab: case eTerranCommandLandBarracksReactor: case eTerranCommandLandBarracksNaked: case eTerranCommandLandFactoryTechLab: case eTerranCommandLandFactoryReactor: case eTerranCommandLandFactoryNaked: case eTerranCommandLandStarportTechLab: case eTerranCommandLandStarportReactor: case eTerranCommandLandStarportNaked: return L""; case eTerranCommandBuildSCV: return L"1 9 0"; case eTerranCommandBuildMarine: case eTerranCommandBuildMarineNaked: case eTerranCommandBuildMarineReactor: case eTerranCommandBuildMarineTechLab: return L"1 5 0"; case eTerranCommandBuildMarauder: return L"1 4 0"; case eTerranCommandBuildReaper: return L"1 8 0"; case eTerranCommandBuildGhost: return L"1 2 0"; case eTerranCommandBuildHellion: case eTerranCommandBuildHellionNaked: case eTerranCommandBuildHellionReactor: case eTerranCommandBuildHellionTechLab: return L"1 3 0"; case eTerranCommandBuildSiegeTank: return L"1 10 0"; case eTerranCommandBuildThor: return L"1 11 0"; case eTerranCommandBuildViking: case eTerranCommandBuildVikingNaked: case eTerranCommandBuildVikingReactor: case eTerranCommandBuildVikingTechLab: return L"1 12 0"; case eTerranCommandBuildMedivac: case eTerranCommandBuildMedivacNaked: case eTerranCommandBuildMedivacReactor: case eTerranCommandBuildMedivacTechLab: return L"1 6 0"; case eTerranCommandBuildRaven: return L"1 7 0"; case eTerranCommandBuildBanshee: return L"1 0 0"; case eTerranCommandBuildBattleCruiser: return L"1 1 0"; case eTerranCommandCalldownMULE: return L""; case eTerranCommandCalldownExtraSupplies: return L""; case eTerranCommandScannerSweep: return L""; case eTerranCommandResearchStimpack: return L"3 11 0"; case eTerranCommandResearchCombatShield: return L"3 16 0"; case eTerranCommandResearchNitroPacks: return L"3 17 0"; case eTerranCommandResearchConcussiveShells: return L"3 15 0"; case eTerranCommandResearchInfantryWeapons1: return L"3 2 0"; case eTerranCommandResearchInfantryWeapons2: return L"3 2 0"; case eTerranCommandResearchInfantryWeapons3: return L"3 2 0"; case eTerranCommandResearchInfantryArmor1: return L"3 1 0"; case eTerranCommandResearchInfantryArmor2: return L"3 1 0"; case eTerranCommandResearchInfantryArmor3: return L"3 1 0"; case eTerranCommandResearchBuildingArmor: return L"3 0 0"; case eTerranCommandResearchHiSecAutoTracking: return L""; case eTerranCommandResearchNeoSteelFrame: return L"3 14 0"; case eTerranCommandResearchMoebiusReactor: return L"3 46 0"; case eTerranCommandResearchPersonalCloaking: return L"3 9 0"; case eTerranCommandArmNuke: return L""; case eTerranCommandResearchInfernalPreIgniter: return L"3 10 0"; case eTerranCommandResearchSiegeTech: return L"3 13 0"; case eTerranCommandResearch250mmStrikeCannons: return L"3 7 0"; case eTerranCommandResearchVehicleWeapons1: return L"3 6 0"; case eTerranCommandResearchVehicleWeapons2: return L"3 6 0"; case eTerranCommandResearchVehicleWeapons3: return L"3 6 0"; case eTerranCommandResearchVehiclePlating1: return L"3 5 0"; case eTerranCommandResearchVehiclePlating2: return L"3 5 0"; case eTerranCommandResearchVehiclePlating3: return L"3 5 0"; case eTerranCommandResearchShipWeapons1: return L"3 4 0"; case eTerranCommandResearchShipWeapons2: return L"3 4 0"; case eTerranCommandResearchShipWeapons3: return L"3 4 0"; case eTerranCommandResearchShipPlating1: return L"3 3 0"; case eTerranCommandResearchShipPlating2: return L"3 3 0"; case eTerranCommandResearchShipPlating3: return L"3 3 0"; case eTerranCommandResearchDurableMaterials: return L""; case eTerranCommandResearchCorvidReactor: return L""; case eTerranCommandResearchCaduceusReactor: return L""; case eTerranCommandResearchSeekerMissile: return L""; case eTerranCommandResearchCloakingField: return L"3 8 0"; case eTerranCommandResearchBehemothReactor: return L""; case eTerranCommandResearchWeaponRefit: return L""; case eTerranCommandMoveSCVToGas: return L""; case eTerranCommandMoveSCVToMinerals: return L""; } break; } return L""; } bool DisplayCommand(EOutputFormat format, ETerranCommand command) { switch(format) { case eOutputFormatSimple: return eTerranCommandBuildSCV != command; case eOutputFormatDetailed: return true; case eOutputFormatFull: return true; case eOutputFormatHaploid: return eTerranCommandBuildSCV != command; case eOutputFormatYABOT: switch(command) { case eTerranCommandLiftBarracksTechLab: case eTerranCommandLiftBarracksReactor: case eTerranCommandLiftBarracksNaked: case eTerranCommandLiftFactoryTechLab: case eTerranCommandLiftFactoryReactor: case eTerranCommandLiftFactoryNaked: case eTerranCommandLiftStarportTechLab: case eTerranCommandLiftStarportReactor: case eTerranCommandLiftStarportNaked: case eTerranCommandLandBarracksTechLab: case eTerranCommandLandBarracksReactor: case eTerranCommandLandBarracksNaked: case eTerranCommandLandFactoryTechLab: case eTerranCommandLandFactoryReactor: case eTerranCommandLandFactoryNaked: case eTerranCommandLandStarportTechLab: case eTerranCommandLandStarportReactor: case eTerranCommandLandStarportNaked: case eTerranCommandBuildSCV: case eTerranCommandCalldownMULE: case eTerranCommandCalldownExtraSupplies: case eTerranCommandScannerSweep: case eTerranCommandResearchNitroPacks: case eTerranCommandArmNuke: case eTerranCommandResearchHiSecAutoTracking: case eTerranCommandResearchDurableMaterials: case eTerranCommandResearchCorvidReactor: case eTerranCommandResearchCaduceusReactor: case eTerranCommandResearchSeekerMissile: case eTerranCommandResearchBehemothReactor: case eTerranCommandResearchWeaponRefit: case eTerranCommandMoveSCVToGas: case eTerranCommandMoveSCVToMinerals: return false; default: return true; } case eOutputFormatSC2Gears: return eTerranCommandBuildSCV != command; } return false; }
[ "CarbonTwelve.Developer@a0245358-5b9e-171e-63e1-2316ddff5996" ]
[ [ [ 1, 768 ] ] ]
03588b5605befef9786fd8be0c2f049601de41e0
7b4e708809905ae003d0cb355bf53e4d16c9cbbc
/JuceLibraryCode/modules/juce_graphics/native/juce_linux_Fonts.cpp
b42df9b3d517547edb6c5104f9a60151b04a1038
[]
no_license
sonic59/JulesText
ce6507014e4cba7fb0b67597600d1cee48a973a5
986cbea68447ace080bf34ac2b94ac3ab46faca4
refs/heads/master
2016-09-06T06:10:01.815928
2011-11-18T01:19:26
2011-11-18T01:19:26
2,796,827
0
0
null
null
null
null
UTF-8
C++
false
false
18,121
cpp
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ struct FTLibWrapper : public ReferenceCountedObject { FTLibWrapper() : library (0) { if (FT_Init_FreeType (&library) != 0) { library = 0; DBG ("Failed to initialize FreeType"); } } ~FTLibWrapper() { if (library != 0) FT_Done_FreeType (library); } FT_Library library; typedef ReferenceCountedObjectPtr <FTLibWrapper> Ptr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FTLibWrapper); }; //============================================================================== struct FTFaceWrapper : public ReferenceCountedObject { FTFaceWrapper (const FTLibWrapper::Ptr& ftLib, const File& file, int faceIndex) : face (0), library (ftLib) { if (FT_New_Face (ftLib->library, file.getFullPathName().toUTF8(), faceIndex, &face) != 0) face = 0; } ~FTFaceWrapper() { if (face != 0) FT_Done_Face (face); } FT_Face face; FTLibWrapper::Ptr library; typedef ReferenceCountedObjectPtr <FTFaceWrapper> Ptr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FTFaceWrapper); }; //============================================================================== class LinuxFontFileIterator { public: LinuxFontFileIterator() : index (0) { fontDirs.addTokens (CharPointer_UTF8 (getenv ("JUCE_FONT_PATH")), ";,", String::empty); fontDirs.removeEmptyStrings (true); if (fontDirs.size() == 0) { const ScopedPointer<XmlElement> fontsInfo (XmlDocument::parse (File ("/etc/fonts/fonts.conf"))); if (fontsInfo != nullptr) { forEachXmlChildElementWithTagName (*fontsInfo, e, "dir") { fontDirs.add (e->getAllSubText().trim()); } } } if (fontDirs.size() == 0) fontDirs.add ("/usr/X11R6/lib/X11/fonts"); fontDirs.removeEmptyStrings (true); } bool next() { if (iter != nullptr) { while (iter->next()) if (getFile().hasFileExtension ("ttf;pfb;pcf")) return true; } if (index >= fontDirs.size()) return false; iter = new DirectoryIterator (fontDirs [index++], true); return next(); } File getFile() const { jassert (iter != nullptr); return iter->getFile(); } private: StringArray fontDirs; int index; ScopedPointer<DirectoryIterator> iter; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LinuxFontFileIterator); }; //============================================================================== class FTTypefaceList : public DeletedAtShutdown { public: FTTypefaceList() : library (new FTLibWrapper()) { LinuxFontFileIterator fontFileIterator; while (fontFileIterator.next()) { int faceIndex = 0; int numFaces = 0; do { FTFaceWrapper face (library, fontFileIterator.getFile(), faceIndex); if (face.face != 0) { if (faceIndex == 0) numFaces = face.face->num_faces; if ((face.face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) faces.add (new KnownTypeface (fontFileIterator.getFile(), faceIndex, face)); } ++faceIndex; } while (faceIndex < numFaces); } } ~FTTypefaceList() { clearSingletonInstance(); } //============================================================================== struct KnownTypeface { KnownTypeface (const File& file_, const int faceIndex_, const FTFaceWrapper& face) : file (file_), family (face.face->family_name), faceIndex (faceIndex_), isBold ((face.face->style_flags & FT_STYLE_FLAG_BOLD) != 0), isItalic ((face.face->style_flags & FT_STYLE_FLAG_ITALIC) != 0), isMonospaced ((face.face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0), isSansSerif (isFaceSansSerif (family)) { } const File file; const String family; const int faceIndex; const bool isBold, isItalic, isMonospaced, isSansSerif; JUCE_DECLARE_NON_COPYABLE (KnownTypeface); }; //============================================================================== FTFaceWrapper::Ptr createFace (const String& fontName, const bool bold, const bool italic) { const KnownTypeface* ftFace = matchTypeface (fontName, bold, italic); if (ftFace == nullptr) { ftFace = matchTypeface (fontName, ! bold, italic); if (ftFace == nullptr) { ftFace = matchTypeface (fontName, bold, ! italic); if (ftFace == nullptr) ftFace = matchTypeface (fontName, ! bold, ! italic); } } if (ftFace != nullptr) { FTFaceWrapper::Ptr face (new FTFaceWrapper (library, ftFace->file, ftFace->faceIndex)); if (face->face != 0) { // If there isn't a unicode charmap then select the first one. if (FT_Select_Charmap (face->face, ft_encoding_unicode) != 0) FT_Set_Charmap (face->face, face->face->charmaps[0]); return face; } } return nullptr; } //============================================================================== void getFamilyNames (StringArray& familyNames) const { for (int i = 0; i < faces.size(); i++) familyNames.addIfNotAlreadyThere (faces.getUnchecked(i)->family); } void getMonospacedNames (StringArray& monoSpaced) const { for (int i = 0; i < faces.size(); i++) if (faces.getUnchecked(i)->isMonospaced) monoSpaced.addIfNotAlreadyThere (faces.getUnchecked(i)->family); } void getSerifNames (StringArray& serif) const { for (int i = 0; i < faces.size(); i++) if (! faces.getUnchecked(i)->isSansSerif) serif.addIfNotAlreadyThere (faces.getUnchecked(i)->family); } void getSansSerifNames (StringArray& sansSerif) const { for (int i = 0; i < faces.size(); i++) if (faces.getUnchecked(i)->isSansSerif) sansSerif.addIfNotAlreadyThere (faces.getUnchecked(i)->family); } juce_DeclareSingleton_SingleThreaded_Minimal (FTTypefaceList); private: FTLibWrapper::Ptr library; OwnedArray<KnownTypeface> faces; const KnownTypeface* matchTypeface (const String& familyName, const bool wantBold, const bool wantItalic) const noexcept { for (int i = 0; i < faces.size(); ++i) { const KnownTypeface* const face = faces.getUnchecked(i); if (face->family == familyName && face->isBold == wantBold && face->isItalic == wantItalic) return face; } return nullptr; } static bool isFaceSansSerif (const String& family) { const char* sansNames[] = { "Sans", "Verdana", "Arial", "Ubuntu" }; for (int i = 0; i < numElementsInArray (sansNames); ++i) if (family.containsIgnoreCase (sansNames[i])) return true; return false; } JUCE_DECLARE_NON_COPYABLE (FTTypefaceList); }; juce_ImplementSingleton_SingleThreaded (FTTypefaceList) //============================================================================== class FreeTypeTypeface : public CustomTypeface { public: FreeTypeTypeface (const Font& font) : faceWrapper (FTTypefaceList::getInstance() ->createFace (font.getTypefaceName(), font.isBold(), font.isItalic())) { if (faceWrapper != nullptr) { setCharacteristics (font.getTypefaceName(), faceWrapper->face->ascender / (float) (faceWrapper->face->ascender - faceWrapper->face->descender), font.isBold(), font.isItalic(), L' '); } else { DBG ("Failed to create typeface: " << font.getTypefaceName() << " " << (font.isBold() ? 'B' : ' ') << (font.isItalic() ? 'I' : ' ')); } } bool loadGlyphIfPossible (const juce_wchar character) { if (faceWrapper != nullptr) { FT_Face face = faceWrapper->face; const unsigned int glyphIndex = FT_Get_Char_Index (face, character); if (FT_Load_Glyph (face, glyphIndex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM) == 0 && face->glyph->format == ft_glyph_format_outline) { const float scale = 1.0f / (float) (face->ascender - face->descender); Path destShape; if (getGlyphShape (destShape, face->glyph->outline, scale)) { addGlyph (character, destShape, face->glyph->metrics.horiAdvance * scale); if ((face->face_flags & FT_FACE_FLAG_KERNING) != 0) addKerning (face, character, glyphIndex); return true; } } } return false; } private: FTFaceWrapper::Ptr faceWrapper; bool getGlyphShape (Path& destShape, const FT_Outline& outline, const float scaleX) { const float scaleY = -scaleX; const short* const contours = outline.contours; const char* const tags = outline.tags; const FT_Vector* const points = outline.points; for (int c = 0; c < outline.n_contours; ++c) { const int startPoint = (c == 0) ? 0 : contours [c - 1] + 1; const int endPoint = contours[c]; for (int p = startPoint; p <= endPoint; ++p) { const float x = scaleX * points[p].x; const float y = scaleY * points[p].y; if (p == startPoint) { if (FT_CURVE_TAG (tags[p]) == FT_Curve_Tag_Conic) { float x2 = scaleX * points [endPoint].x; float y2 = scaleY * points [endPoint].y; if (FT_CURVE_TAG (tags[endPoint]) != FT_Curve_Tag_On) { x2 = (x + x2) * 0.5f; y2 = (y + y2) * 0.5f; } destShape.startNewSubPath (x2, y2); } else { destShape.startNewSubPath (x, y); } } if (FT_CURVE_TAG (tags[p]) == FT_Curve_Tag_On) { if (p != startPoint) destShape.lineTo (x, y); } else if (FT_CURVE_TAG (tags[p]) == FT_Curve_Tag_Conic) { const int nextIndex = (p == endPoint) ? startPoint : p + 1; float x2 = scaleX * points [nextIndex].x; float y2 = scaleY * points [nextIndex].y; if (FT_CURVE_TAG (tags [nextIndex]) == FT_Curve_Tag_Conic) { x2 = (x + x2) * 0.5f; y2 = (y + y2) * 0.5f; } else { ++p; } destShape.quadraticTo (x, y, x2, y2); } else if (FT_CURVE_TAG (tags[p]) == FT_Curve_Tag_Cubic) { const int next1 = p + 1; const int next2 = (p == (endPoint - 1)) ? startPoint : (p + 2); if (p >= endPoint || FT_CURVE_TAG (tags[next1]) != FT_Curve_Tag_Cubic || FT_CURVE_TAG (tags[next2]) != FT_Curve_Tag_On) return false; const float x2 = scaleX * points [next1].x; const float y2 = scaleY * points [next1].y; const float x3 = scaleX * points [next2].x; const float y3 = scaleY * points [next2].y; destShape.cubicTo (x, y, x2, y2, x3, y3); p += 2; } } destShape.closeSubPath(); } return true; } void addKerning (FT_Face face, const uint32 character, const uint32 glyphIndex) { const float height = (float) (face->ascender - face->descender); uint32 rightGlyphIndex; uint32 rightCharCode = FT_Get_First_Char (face, &rightGlyphIndex); while (rightGlyphIndex != 0) { FT_Vector kerning; if (FT_Get_Kerning (face, glyphIndex, rightGlyphIndex, ft_kerning_unscaled, &kerning) == 0 && kerning.x != 0) addKerningPair (character, rightCharCode, kerning.x / height); rightCharCode = FT_Get_Next_Char (face, rightCharCode, &rightGlyphIndex); } } JUCE_DECLARE_NON_COPYABLE (FreeTypeTypeface); }; //============================================================================== Typeface::Ptr Typeface::createSystemTypefaceFor (const Font& font) { return new FreeTypeTypeface (font); } StringArray Font::findAllTypefaceNames() { StringArray s; FTTypefaceList::getInstance()->getFamilyNames (s); s.sort (true); return s; } //============================================================================== struct DefaultFontNames { DefaultFontNames() : defaultSans (getDefaultSansSerifFontName()), defaultSerif (getDefaultSerifFontName()), defaultFixed (getDefaultMonospacedFontName()) { } String defaultSans, defaultSerif, defaultFixed; private: static String pickBestFont (const StringArray& names, const char* const* choicesArray) { const StringArray choices (choicesArray); int j; for (j = 0; j < choices.size(); ++j) if (names.contains (choices[j], true)) return choices[j]; for (j = 0; j < choices.size(); ++j) for (int i = 0; i < names.size(); ++i) if (names[i].startsWithIgnoreCase (choices[j])) return names[i]; for (j = 0; j < choices.size(); ++j) for (int i = 0; i < names.size(); ++i) if (names[i].containsIgnoreCase (choices[j])) return names[i]; return names[0]; } static String getDefaultSansSerifFontName() { StringArray allFonts; FTTypefaceList::getInstance()->getSansSerifNames (allFonts); const char* targets[] = { "Verdana", "Bitstream Vera Sans", "Luxi Sans", "Sans", 0 }; return pickBestFont (allFonts, targets); } static String getDefaultSerifFontName() { StringArray allFonts; FTTypefaceList::getInstance()->getSerifNames (allFonts); const char* targets[] = { "Bitstream Vera Serif", "Times", "Nimbus Roman", "Serif", 0 }; return pickBestFont (allFonts, targets); } static String getDefaultMonospacedFontName() { StringArray allFonts; FTTypefaceList::getInstance()->getMonospacedNames (allFonts); const char* targets[] = { "Bitstream Vera Sans Mono", "Courier", "Sans Mono", "Mono", 0 }; return pickBestFont (allFonts, targets); } JUCE_DECLARE_NON_COPYABLE (DefaultFontNames); }; Typeface::Ptr Font::getDefaultTypefaceForFont (const Font& font) { static DefaultFontNames defaultNames; String faceName (font.getTypefaceName()); if (faceName == getDefaultSansSerifFontName()) faceName = defaultNames.defaultSans; else if (faceName == getDefaultSerifFontName()) faceName = defaultNames.defaultSerif; else if (faceName == getDefaultMonospacedFontName()) faceName = defaultNames.defaultFixed; Font f (font); f.setTypefaceName (faceName); return Typeface::createSystemTypefaceFor (f); }
[ [ [ 1, 544 ] ] ]
f739df6a594b168fdb45d1f6f73eb5f8b9610090
0c62a303659646fa06db4d5d09c44ecb53ce619a
/Kickapoo/Audio.cpp
08def6bca0e1d1832683615e46c08990d2b6f998
[]
no_license
gosuwachu/igk-game
60dcdd8cebf7a25faf60a5cc0f5acd6f698c1c25
faf2e6f3ec6cfe8ddc7cb1f3284f81753f9745f5
refs/heads/master
2020-05-17T21:51:18.433505
2010-04-12T12:42:01
2010-04-12T12:42:01
32,650,596
0
0
null
null
null
null
UTF-8
C++
false
false
1,121
cpp
#include "Common.h" #include "Audio.h" void Audio::create() { unsigned int version; FMOD::System_Create(&system); system->getVersion(&version); if (version < FMOD_VERSION) return; system->init(32, FMOD_INIT_NORMAL, 0); } void Audio::release() { system->close(); system->release(); } FMOD::Sound* Audio::loadSound(const char* filePath, bool loop) { FMOD::Sound* sound; system->createSound(filePath, FMOD_SOFTWARE, 0, &sound); if(loop) sound->setMode(FMOD_LOOP_NORMAL); return sound; } FMOD::Sound* Audio::loadStream(const char* filePath) { FMOD::Sound* sound; system->createStream(filePath, FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D, 0, &sound); return sound; } void Audio::update() { system->update(); } void Audio::play(FMOD::Sound* sound, float volume, bool stop) { channel->setVolume(volume); //channel->setLoopCount(100000); system->playSound(FMOD_CHANNEL_FREE, sound, stop, &channel); //sound->setLoopCount(1000); } void Audio::stopSoud( FMOD::Sound* sound ) { system->playSound(FMOD_CHANNEL_FREE, sound, true, &channel); }
[ "[email protected]@d16c65a5-d515-2969-3ec5-0ec16041161d", "konrad.rodzik@d16c65a5-d515-2969-3ec5-0ec16041161d" ]
[ [ [ 1, 21 ], [ 23, 25 ], [ 28, 42 ], [ 44, 45 ], [ 54, 54 ] ], [ [ 22, 22 ], [ 26, 27 ], [ 43, 43 ], [ 46, 53 ] ] ]
dfc146a257e671498ea67e42e74f545e852a07c6
fa134e5f64c51ccc1c2cac9b9cb0186036e41563
/GT/TextureTGA.h
d5108829ce461da75dfc7ec2dcee5c16ed5703bf
[]
no_license
dlsyaim/gradthes
70b626f08c5d64a1d19edc46d67637d9766437a6
db6ba305cca09f273e99febda4a8347816429700
refs/heads/master
2016-08-11T10:44:45.165199
2010-07-19T05:44:40
2010-07-19T05:44:40
36,058,688
0
1
null
null
null
null
UTF-8
C++
false
false
779
h
#pragma once class Texture; class TextureTGA { public: TextureTGA(void); ~TextureTGA(void); inline void setImageData(GLubyte* imageData){this->imageData = imageData;} inline GLubyte* getImageData(void){return imageData;} inline void setBpp(GLuint bpp){this->bpp = bpp;} inline GLuint getBpp(void){return bpp;} inline void setWidth(GLuint width){this->width = width;} inline GLuint getWidth(void){return width;} inline void setHeight(GLuint height){this->height = height;} inline GLuint getHeight(void){return height;} inline void setTexID(GLuint texID){this->texID = texID;} inline GLuint getTexID(void){return texID;} private: GLubyte* imageData; GLuint bpp; GLuint width; GLuint height; GLuint texID; friend class Texture; };
[ "[email protected]@3a95c3f6-2b41-11df-be6c-f52728ce0ce6" ]
[ [ [ 1, 29 ] ] ]
b6a801f0a79578886ca94b469068a1f46dd285a4
be77a86176ebc9919c1b5366ac5d8ce579f06fbe
/C++/OpenCV/ImageProcessing/ImageProcessing/ImageProcessing.cpp
6e0b8b6d6b0bbde8bece4c379df49e417ee4f76b
[]
no_license
MrChuCong/dvbao
505c3510f73ad9fbe0cb44883a0109921b8ef317
7ca4b47fb7bc8fa4bea3962b3cee73aea3d0b40a
refs/heads/master
2021-01-15T22:52:03.692972
2008-12-09T18:49:52
2008-12-09T18:49:52
33,026,621
1
0
null
null
null
null
UTF-8
C++
false
false
3,009
cpp
#include <cv.h> #include <cxcore.h> #include <highgui.h> #include <stdio.h> #define SOURCE_WINDOW_ID "Source Image" #define DESTINATION_WINDOW_ID "Destination Image" int main (int argc, char* argv[]) { if (argc < 2) { // No input file name printf("Usage: main source_image [destination_image]\n"); return 0; } char* srcFilename = argv[1]; char* dstFilename; // Load the image with number of channels in the file IplImage* srcImage = cvLoadImage(srcFilename, -1); IplImage* dstImage; if (argc < 3) { // No output filename if (srcImage->nChannels == 1) { // 8-bit --> 24-bit : OUTPUT PPM FORMAT dstFilename = "output.ppm"; } else { // 24-bit --> 8-bit : OUTPUT PGM FORMAT dstFilename = "output.pgm"; } } else { dstFilename = argv[2]; } // Show the source image cvNamedWindow(SOURCE_WINDOW_ID, CV_WINDOW_AUTOSIZE); cvMoveWindow(SOURCE_WINDOW_ID, 100, 100); cvShowImage(SOURCE_WINDOW_ID, srcImage); // Show the source image information printf("Source Image: %s\n", srcFilename); printf("Channels: %d\n", srcImage->nChannels); printf("Width: %d\n", srcImage->width); printf("Height: %d\n", srcImage->height); printf("Width Step: %d\n", srcImage->widthStep); // Convert the image printf("\nConverting ...\n\n"); if (srcImage->nChannels == 1) { // 8-bit --> 24-bit dstImage = cvCreateImage(cvGetSize(srcImage), IPL_DEPTH_8U, 3); // Get the pointers unsigned char* srcPointer = (unsigned char*)srcImage->imageData; unsigned char* dstPointer = (unsigned char*)dstImage->imageData; for (int i=0; i<srcImage->imageSize; i++) { // B = G = R = Gray Intensity dstPointer[0] = dstPointer[1] = dstPointer[2] = srcPointer[0]; dstPointer += 3; srcPointer += 1; } } else { // 24-bit --> 8-bit dstImage = cvCreateImage(cvGetSize(srcImage), IPL_DEPTH_8U, 1); // Get the pointers unsigned char* srcPointer = (unsigned char*)srcImage->imageData; unsigned char* dstPointer = (unsigned char*)dstImage->imageData; for (int i=0; i<dstImage->imageSize; i++) { // Gray Intensity = B * 0.114 + G * 0.587 + R * 0.299 dstPointer[0] = srcPointer[0] * 0.114 + srcPointer[1] * 0.587 + srcPointer[2] * 0.299; dstPointer += 1; srcPointer += 3; } } // Save the result image cvSaveImage(dstFilename, dstImage); // Show the result image cvNamedWindow(DESTINATION_WINDOW_ID, CV_WINDOW_AUTOSIZE); cvMoveWindow(DESTINATION_WINDOW_ID, 200, 200); cvShowImage(DESTINATION_WINDOW_ID, dstImage); // Show the destination image information printf("Destination Image: %s\n", dstFilename); printf("Channels: %d\n", dstImage->nChannels); printf("Width: %d\n", dstImage->width); printf("Height: %d\n", dstImage->height); printf("Width Step: %d\n", dstImage->widthStep); // Wait for a key cvWaitKey(0); // Release all images cvReleaseImage(&srcImage); cvReleaseImage(&dstImage); return 0; }
[ "[email protected]@21bdbfa0-87e6-11dd-9299-37fd5bf03096" ]
[ [ [ 1, 116 ] ] ]
db57a54e9032726e5b965ac8a78fc6f5a023d020
68cfffb549ab1cb32e02db4f80ed001a912e455b
/reference/GreedySnake/GreedySnake/GreedySnakeDoc.h
8e3d63e7aac74d68762be5dc2817aa600d9512e5
[]
no_license
xhbang/Console-snake
e462d6c206dc1dd071640f0ad203eb367460b2c8
a61cf9d91744f084741e2c29b930d9646256479b
refs/heads/master
2016-09-10T20:18:10.598179
2011-12-05T10:33:51
2011-12-05T10:33:51
2,902,986
0
0
null
null
null
null
GB18030
C++
false
false
894
h
/* //////////////////////////////////////////////////////// Team member: 聂森 莫小琪 彭云波 陈飞宇 尹伦琴 陈沁茜 李朝朝 Date: 3.2008 ~ 5.2008 所有权限归 cqu. mstc. Team Satan 所有. //////////////////////////////////////////////////////// */ // GreedySnakeDoc.h : CGreedySnakeDoc 类的接口 // #pragma once class CGreedySnakeDoc : public CDocument { protected: // 仅从序列化创建 CGreedySnakeDoc(); DECLARE_DYNCREATE(CGreedySnakeDoc) // 属性 public: // 操作 public: // 重写 public: virtual BOOL OnNewDocument(); virtual void Serialize(CArchive& ar); // 实现 public: virtual ~CGreedySnakeDoc(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // 生成的消息映射函数 protected: DECLARE_MESSAGE_MAP() };
[ [ [ 1, 54 ] ] ]
91401f3019c8f33736e82b11e8392f44953bed34
940a846f0685e4ca0202897a60c58c4f77dd94a8
/demo/FireFox/plugin/test/nprt/nprt/ScriptablePluginObjectBase.cpp
56eadf886303efbc5d0158a6adfa79e49850a1fd
[]
no_license
grharon/tpmbrowserplugin
be33fbe89e460c9b145e86d7f03be9c4e3b73c14
53a04637606f543012c0d6d18fa54215123767f3
refs/heads/master
2016-09-05T15:46:55.064258
2010-09-04T12:05:31
2010-09-04T12:05:31
35,827,176
0
0
null
null
null
null
UTF-8
C++
false
false
4,040
cpp
#include "ScriptablePluginObjectBase.h" void ScriptablePluginObjectBase::Invalidate() { } bool ScriptablePluginObjectBase::HasMethod(NPIdentifier name) { return false; } bool ScriptablePluginObjectBase::Invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result) { return false; } bool ScriptablePluginObjectBase::InvokeDefault(const NPVariant *args, uint32_t argCount, NPVariant *result) { return false; } bool ScriptablePluginObjectBase::HasProperty(NPIdentifier name) { return false; } bool ScriptablePluginObjectBase::GetProperty(NPIdentifier name, NPVariant *result) { return false; } bool ScriptablePluginObjectBase::SetProperty(NPIdentifier name, const NPVariant *value) { return false; } bool ScriptablePluginObjectBase::RemoveProperty(NPIdentifier name) { return false; } bool ScriptablePluginObjectBase::Enumerate(NPIdentifier **identifier, uint32_t *count) { return false; } bool ScriptablePluginObjectBase::Construct(const NPVariant *args, uint32_t argCount, NPVariant *result) { return false; } // static void ScriptablePluginObjectBase::_Deallocate(NPObject *npobj) { // Call the virtual destructor. delete (ScriptablePluginObjectBase *)npobj; } // static void ScriptablePluginObjectBase::_Invalidate(NPObject *npobj) { ((ScriptablePluginObjectBase *)npobj)->Invalidate(); } // static bool ScriptablePluginObjectBase::_HasMethod(NPObject *npobj, NPIdentifier name) { return ((ScriptablePluginObjectBase *)npobj)->HasMethod(name); } // static bool ScriptablePluginObjectBase::_Invoke(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result) { return ((ScriptablePluginObjectBase *)npobj)->Invoke(name, args, argCount, result); } // static bool ScriptablePluginObjectBase::_InvokeDefault(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { return ((ScriptablePluginObjectBase *)npobj)->InvokeDefault(args, argCount, result); } // static bool ScriptablePluginObjectBase::_HasProperty(NPObject * npobj, NPIdentifier name) { return ((ScriptablePluginObjectBase *)npobj)->HasProperty(name); } // static bool ScriptablePluginObjectBase::_GetProperty(NPObject *npobj, NPIdentifier name, NPVariant *result) { return ((ScriptablePluginObjectBase *)npobj)->GetProperty(name, result); } // static bool ScriptablePluginObjectBase::_SetProperty(NPObject *npobj, NPIdentifier name, const NPVariant *value) { return ((ScriptablePluginObjectBase *)npobj)->SetProperty(name, value); } // static bool ScriptablePluginObjectBase::_RemoveProperty(NPObject *npobj, NPIdentifier name) { return ((ScriptablePluginObjectBase *)npobj)->RemoveProperty(name); } // static bool ScriptablePluginObjectBase::_Enumerate(NPObject *npobj, NPIdentifier **identifier, uint32_t *count) { return ((ScriptablePluginObjectBase *)npobj)->Enumerate(identifier, count); } // static bool ScriptablePluginObjectBase::_Construct(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { return ((ScriptablePluginObjectBase *)npobj)->Construct(args, argCount, result); }
[ "stlt1sean@aa5d9edc-7c6f-d5c9-3e23-ee20326b5c4f" ]
[ [ [ 1, 155 ] ] ]
49cbc7e91a61edec9197a0d66488ea20f39329ef
ce262ae496ab3eeebfcbb337da86d34eb689c07b
/SETools/SESceneEditor/AssemblyInfo.cpp
af8d9fd3b236537ff535065d600fbcd774b1ddcb
[]
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
3,482
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 "SESceneEditorPCH.h" using namespace System::Reflection; using namespace System::Runtime::CompilerServices; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly:AssemblyTitleAttribute("Swing Engine Scene Editor")]; [assembly:AssemblyDescriptionAttribute("Swing Engine Scene Editor")]; [assembly:AssemblyConfigurationAttribute("")]; [assembly:AssemblyCompanyAttribute("")]; [assembly:AssemblyProductAttribute("Swing Engine Scene Editor")]; [assembly:AssemblyCopyrightAttribute("")]; [assembly:AssemblyTrademarkAttribute("")]; [assembly:AssemblyCultureAttribute("")]; // Public types are CLS-compliant unless otherwise stated. [assembly:CLSCompliantAttribute(true)]; // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the value or you can default the Revision and // Build Numbers // by using the '*' as shown below: [assembly:AssemblyVersionAttribute("1.0.*")]; // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly // signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which // contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) // utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project directory. // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly:AssemblyDelaySignAttribute(false)]; [assembly:AssemblyKeyFileAttribute("")]; [assembly:AssemblyKeyNameAttribute("")];
[ "[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac" ]
[ [ [ 1, 85 ] ] ]
58de20961bd944e99377d9e83c2353d475eee2d5
36bf908bb8423598bda91bd63c4bcbc02db67a9d
/Include/CRegistry.h
3cc40b042a6960f6b2892e9fc7eeb504943e353e
[]
no_license
code4bones/crawlpaper
edbae18a8b099814a1eed5453607a2d66142b496
f218be1947a9791b2438b438362bc66c0a505f99
refs/heads/master
2021-01-10T13:11:23.176481
2011-04-14T11:04:17
2011-04-14T11:04:17
44,686,513
0
1
null
null
null
null
UTF-8
C++
false
false
3,060
h
/* CRegistry.h Classe base per l'accesso al registro (SDK/MFC). Luca Piergentili, 07/08/00 [email protected] */ #ifndef _CREGISTRY_H #define _CREGISTRY_H 1 #include "window.h" // id per le icone predefinite (windows.h) enum IDI_PREDEFINED_ICON { IDI_APPLICATION_ICON, IDI_ASTERISK_ICON, IDI_EXCLAMATION_ICON, IDI_HAND_ICON, IDI_QUESTION_ICON, IDI_WINLOGO_ICON }; // struttura per la registrazione del tipo file struct REGISTERFILETYPE { char extension[_MAX_EXT+1]; // estensione (.gzw) char name[_MAX_PATH+1]; // nome del tipo (gzwfile) char description[_MAX_PATH+1]; // descrizione (GZW compressed data) char shell[_MAX_PATH+1]; // comando associato (c:\bin\gzwshell.exe) char shellopenargs[_MAX_PATH+1]; // argomenti (%1) int defaulticon; // indice (base 0) per l'icona di default (0) HICON hicon; // handle all'icona di default char contenttype[_MAX_PATH+1]; // tipo mime (application/x-gzw-compressed) }; typedef REGISTERFILETYPE* LPREGISTERFILETYPE; /* CRegistry */ class CRegistry { public: #if defined(_AFX) || defined(_AFX_DLL) CRegistry(HINSTANCE hInstance = AfxGetInstanceHandle()) #else CRegistry(HINSTANCE hInstance) #endif { m_hInstance = hInstance; } virtual ~CRegistry() {} // tipo BOOL RegisterFileType (LPREGISTERFILETYPE lpRegFileType); BOOL UnregisterFileType (LPCSTR lpcszExtension); BOOL GetRegisteredFileType (LPCSTR lpcszExtension,LPREGISTERFILETYPE pFileType,BOOL bExtractIcon = FALSE); // icone per il tipo BOOL SetIconForRegisteredFileType (LPREGISTERFILETYPE lpRegFileType); HICON GetIconForRegisteredFileType (LPCSTR lpcszExtension,LPREGISTERFILETYPE pFileType = NULL,UINT nID = 0); HICON GetSafeIconForRegisteredFileType (LPCSTR lpcszExtension,LPREGISTERFILETYPE pFileType = NULL,UINT nID = 0); HICON GetSystemIcon (IDI_PREDEFINED_ICON id); // programma per il tipo (solo eseguibile, senza parametri ne opzioni) BOOL GetProgramForRegisteredFileType (LPCSTR lpcszFileName,LPSTR lpszProgram,int nSize); BOOL ExecuteFileType (LPCSTR lpcszFileName); // programma per il tipo e operazioni basiche BOOL GetCommandForRegisteredFileType (LPCSTR lpcszCommand,LPCSTR lpcszFileName,LPSTR lpszProgram,int nSize); BOOL ShellFileType (LPCSTR lpcszCommand,LPCSTR lpcszFileName); #if 0 inline BOOL OpenFileType (LPCSTR lpcszFileName) {return((int)::ShellExecute(NULL,"open",lpcszFileName,NULL,NULL,SW_SHOW) > 32);} #else inline BOOL OpenFileType (LPCSTR lpcszFileName) {return(ShellFileType("open",lpcszFileName));} #endif // estensione relativa al tipo mime LPSTR GetContentTypeExtension (LPCSTR lpcszContentType,LPSTR lpszExt,UINT nExtSize); // menu contestuale della shell BOOL AddMenuEntryForRegisteredFileType (LPCSTR lpcszExtension,LPCSTR lpcszMenuText,LPCSTR lpcszCommand); BOOL RemoveMenuEntryForRegisteredFileType(LPCSTR lpcszExtension,LPCSTR lpcszMenuText); private: HINSTANCE m_hInstance; }; #endif // _CREGISTRY_H
[ [ [ 1, 86 ] ] ]
27b8c819a9389d8534c847cc0a53983a2c0926b1
5c3ae0d061432533efe7b777c8205cf00db72be6
/ spacerenegade/src/material.cpp
db23640052cfc66ef66a2f1324512f60bdf65c90
[]
no_license
jamoozy/spacerenegade
6da0abbcdc86a9edb3a1a9c4e7224d5a1121423c
4240a4b6418cb7b03d22a42de65e800277cfc889
refs/heads/master
2016-09-06T17:24:11.028035
2007-08-12T07:19:14
2007-08-12T07:19:14
41,124,730
0
0
null
null
null
null
UTF-8
C++
false
false
772
cpp
#include <iostream> #include "GL/glut.h" #include "ship.h" #include "material.h" using std::cout; using std::cerr; using std::endl; extern PShip *playerShip; void Material::update() { position += velocity; if (killNextTick) delete this; } void Material::draw(int pass) { if (pass == 1) { glDisable(GL_TEXTURE_2D); glPushMatrix(); glColor3f(1,1,1); glTranslated(position.x(), position.y(), position.z()); glutSolidSphere(1,10,4); glPopMatrix(); } } void Material::hits(Object *o) { if (o == playerShip) { // Add in the "you get this resource" part. Later this should be // an object parameter or be loosely based on the type this is. playerShip->addToCBay(0.1); } killNextTick = true; }
[ "jamoozy@d98d4265-742f-0410-abd1-c3b8cf015911", "paulbobba@d98d4265-742f-0410-abd1-c3b8cf015911" ]
[ [ [ 1, 4 ], [ 6, 33 ], [ 35, 46 ] ], [ [ 5, 5 ], [ 34, 34 ] ] ]
af297543db38a433ccb089fcbfd293a748d022b8
b8fbe9079ce8996e739b476d226e73d4ec8e255c
/src/engine/rb_physics/colcylinder.cpp
c547fa65875c76723199214f3aae8ea4275ac461
[]
no_license
dtbinh/rush
4294f84de1b6e6cc286aaa1dd48cf12b12a467d0
ad75072777438c564ccaa29af43e2a9fd2c51266
refs/heads/master
2021-01-15T17:14:48.417847
2011-06-16T17:41:20
2011-06-16T17:41:20
41,476,633
1
0
null
2015-08-27T09:03:44
2015-08-27T09:03:44
null
UTF-8
C++
false
false
2,039
cpp
/***********************************************************************************/ // File: ColCylinder.cpp // Date: 25.08.2005 // Author: Ruslan Shestopalyuk /***********************************************************************************/ #include "stdafx.h" #include "ColCylinder.h" #include "PhysicsServer.h" #include "OdeUtil.h" /***********************************************************************************/ /* ColCylinder implementation /***********************************************************************************/ decl_class(ColCylinder); ColCylinder::ColCylinder() { m_Height = 200.0f; m_Radius = 50.0f; } // ColCylinder::ColCapsule void ColCylinder::Synchronize( bool bFromSolver ) { ColGeom::Synchronize( bFromSolver ); if (!bFromSolver) { float scale = GetBodyScale()*PhysicsServer::s_pInstance->GetWorldScale(); dGeomCylinderSetParams( GetID(), m_Radius*scale, m_Height*scale ); } } // ColCylinder::Synchronize void ColCylinder::DrawBounds() { DWORD geomColor = PhysicsServer::s_pInstance->GetGeomColor(); DWORD linesColor = PhysicsServer::s_pInstance->GetGeomLinesColor(); Mat4 tm = GetTM(); g_pDrawServer->SetWorldTM( tm ); float hf = m_Height*0.5f; g_pDrawServer->SetZEnable( true ); g_pDrawServer->DrawCylinder( Vec3( 0.0f, 0.0f, -hf ), m_Radius, m_Height, linesColor, geomColor, true ); g_pDrawServer->SetZEnable( false ); g_pDrawServer->Flush(); } // ColCylinder::DrawBounds dGeomID ColCylinder::CreateGeom( dSpaceID spaceID ) { float scale = PhysicsServer::s_pInstance->GetWorldScale(); return dCreateCylinder( spaceID, m_Radius*scale, m_Height*scale ); } // ColCylinder::CreateGeom dMass ColCylinder::GetMass() const { dMass m; Convert( m.c, Vec4( 0, 0, 0, 1 ) ); float scale = PhysicsServer::s_pInstance->GetWorldScale(); dMassSetCylinder( &m, GetDensity(), 3, m_Radius*scale, m_Height*scale ); return m; }
[ [ [ 1, 58 ] ] ]
8f848e773b0ad0aceeeea0fc0e98ffc970f4daae
3472e587cd1dff88c7a75ae2d5e1b1a353962d78
/ytk_bak/test/TestVSQt/testvsqt.h
9707c880d8808f5efb3ca32a593d1c29fdd5e7e8
[]
no_license
yewberry/yewtic
9624d05d65e71c78ddfb7bd586845e107b9a1126
2468669485b9f049d7498470c33a096e6accc540
refs/heads/master
2021-01-01T05:40:57.757112
2011-09-14T12:32:15
2011-09-14T12:32:15
32,363,059
0
0
null
null
null
null
UTF-8
C++
false
false
473
h
#ifndef TESTVSQT_H #define TESTVSQT_H #include <QtGui/QDialog> #include "ui_testvsqt.h" class TestVSQt : public QDialog { Q_OBJECT public: TestVSQt(QWidget *parent = 0, Qt::WFlags flags = 0); ~TestVSQt(); private slots: void testLogClicked(); void testWebKitClicked(); void testDbusClicked(); void testDataViewClicked(); void testLayoutClicked(); private: void testLog(); private: Ui::TestVSQtClass ui; }; #endif // TESTVSQT_H
[ "yew1998@5ddc4e96-dffd-11de-b4b3-6d349e4f6f86" ]
[ [ [ 1, 29 ] ] ]
c5950c4844de6d041e1937dc57418fa4ee8a94b8
c4001da8f012dfbc46fef0d9c11f8412f4ad9c6f
/allegro/demos/a5teroids/src/LargeBullet.cpp
6de612ac61347fe7d2cfa17da03fa789b63bbf56
[ "Zlib", "BSD-3-Clause" ]
permissive
sesc4mt/mvcdecoder
4602fdfe42ab39706cfa3c749282782ca9da73c9
742a5c0d9cad43f0b01aa6e9169d96a286458e72
refs/heads/master
2021-01-01T17:56:47.666505
2010-11-02T12:36:52
2010-11-02T12:36:52
40,896,775
1
0
null
null
null
null
UTF-8
C++
false
false
337
cpp
#include "a5teroids.hpp" void LargeBullet::render(int offx, int offy) { al_draw_rotated_bitmap(bitmap, radius, radius, offx + x, offy + y, angle+(ALLEGRO_PI/2), 0); } LargeBullet::LargeBullet(float x, float y, float angle, Entity *shooter) : Bullet(x, y, 6, 0.6f, angle, 600, 2, RES_LARGEBULLET, shooter) { }
[ "edwardtoday@34199c9c-95aa-5eba-f35a-9ba8a8a04cd7" ]
[ [ [ 1, 13 ] ] ]
a29be4c32850d32bc642c05282d08b84c849dd4c
58ef4939342d5253f6fcb372c56513055d589eb8
/CloverDemo/inc/AnimationFrame.h
f5188e34ca788bfce0f5a2db198a4e71a11f82cc
[]
no_license
flaithbheartaigh/lemonplayer
2d77869e4cf787acb0aef51341dc784b3cf626ba
ea22bc8679d4431460f714cd3476a32927c7080e
refs/heads/master
2021-01-10T11:29:49.953139
2011-04-25T03:15:18
2011-04-25T03:15:18
50,263,327
0
0
null
null
null
null
UTF-8
C++
false
false
1,097
h
/* ============================================================================ Name : AnimationFrame.h Author : zengcity Version : 1.0 Copyright : Your copyright notice Description : CAnimationFrame declaration ============================================================================ */ #ifndef ANIMATIONFRAME_H #define ANIMATIONFRAME_H // INCLUDES #include <e32std.h> #include <e32base.h> // CLASS DECLARATION /** * CAnimationFrame * */ class MAnimationNofity { public: virtual void AnimationCallback() = 0; }; class CAnimationFrame { public: // Constructors and destructor virtual ~CAnimationFrame(); CAnimationFrame(MAnimationNofity& aNotify); public: TInt AppendAnimation(TCallBack* aFunc); void RemoveAnimation(const TInt& aIndex); void RemoveAnimation(TCallBack* aFunc); void StartTimer(); TInt Animation(); private: static TInt Callback( TAny* aThis ); protected: MAnimationNofity& iNotify; CPeriodic* iAnimer; RPointerArray<TCallBack>* iFuncs; }; #endif // ANIMATIONFRAME_H
[ "zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494" ]
[ [ [ 1, 56 ] ] ]
5d7c7b12a8d81ce1895a97c2d9790a5558915702
bf19f77fdef85e76a7ebdedfa04a207ba7afcada
/NewAlpha/TMNT Tactics Tech Demo/Source/OptionsMenuState.cpp
8d9dada638df6cbb4d54f79da667b50f2b682097
[]
no_license
marvelman610/tmntactis
2aa3176d913a72ed985709843634933b80d7cb4a
a4e290960510e5f23ff7dbc1e805e130ee9bb57d
refs/heads/master
2020-12-24T13:36:54.332385
2010-07-12T08:08:12
2010-07-12T08:08:12
39,046,976
0
0
null
null
null
null
UTF-8
C++
false
false
7,192
cpp
////////////////////////////////////////////////////////////////////////// // Filename : COptionsMenuState.cpp // // Author : Ramon Johannessen (RJ) // // Purpose : The Options Menu will allow the user to customize the // game settings, such as music volume, sound effects, etc. ////////////////////////////////////////////////////////////////////////// #include "OptionsMenuState.h" #include "MainMenuState.h" #include "CSGD_TextureManager.h" #include "CSGD_DirectInput.h" #include "CSGD_FModManager.h" #include "Game.h" #include "GamePlayState.h" #include "BitmapFont.h" #include "Assets.h" #include <fstream> #define VOLUME_ADJUST_SPEED 80.0f enum {MUSIC_VOLUME, SFX_VOLUME, BACK, NULL_END}; COptionsMenuState::COptionsMenuState() { } COptionsMenuState::~COptionsMenuState() { } COptionsMenuState* COptionsMenuState::GetInstance() { static COptionsMenuState menuState; return &menuState; } void COptionsMenuState::Enter() { CBaseMenuState::Enter(); m_bHasASettingChanged = false; SetBGImageID(GetAssets()->aOMbgID); SetBGWidth(GetTM()->GetTextureWidth(GetAssets()->aOMbgID)); SetBGHeight(GetTM()->GetTextureHeight(GetAssets()->aOMbgID)); // m_fmsBGMusicID = GetAssets()->m_fmsOMBGmusic; SetMenuX(300); SetMenuY(350); SetCursorX(GetMenuX()-80); SetCursorY(GetMenuY()-15); SetCurrMenuSelection( MUSIC_VOLUME ); m_nSFXVolume = (int)(GetGame()->GetSFXVolume() * 100.0f); m_nMusicVolume = (int)(GetGame()->GetMusicVolume() * 100.0f); //m_pFMODsys->Play(FMOD_CHANNEL_FREE, m_fmsBGMusicID, false, FMOD_CHANNEL_REUSE); GetFMOD()->PlaySound(GetAssets()->aOMmusicSnd); GetFMOD()->SetVolume(GetAssets()->aOMmusicSnd, GetGame()->GetMusicVolume()); } bool COptionsMenuState::Input(float fElapsedTime, POINT mousePt) { CBaseMenuState::Input(fElapsedTime, mousePt); if (mousePt.y != m_nMouseY) { int oldSelection = GetCurrMenuSelection(); int newSelection = (mousePt.y - GetMenuY()) / GetMenuItemSpacing(); if (newSelection < 0) newSelection = 0; else if (newSelection > NULL_END-1) newSelection = NULL_END-1; if ( oldSelection != newSelection ) { SetCurrMenuSelection( newSelection ); if (GetCurrMenuSelection() < 0) SetCurrMenuSelection(MUSIC_VOLUME); else if (GetCurrMenuSelection() > NULL_END-1) SetCurrMenuSelection(NULL_END-1); if (GetFMOD()->IsSoundPlaying(GetAssets()->aMMmenuMoveSnd)) { GetFMOD()->StopSound(GetAssets()->aMMmenuMoveSnd); GetFMOD()->ResetSound(GetAssets()->aMMmenuMoveSnd); } GetFMOD()->PlaySound(GetAssets()->aMMmenuMoveSnd); if(!GetFMOD()->SetVolume(GetAssets()->aMMmenuMoveSnd, GetGame()->GetSFXVolume()*0.6f)) MessageBox(0, "VOLUME NOT SET", "ERROR", MB_OK); } } m_nMouseX = mousePt.x; m_nMouseY = mousePt.y; if (GetDI()->KeyPressed(DIK_DOWN) || GetDI()->JoystickDPadPressed(3,0)) { SetCurrMenuSelection(GetCurrMenuSelection()+1); if (GetCurrMenuSelection() == NULL_END) SetCurrMenuSelection(MUSIC_VOLUME); } else if (GetDI()->KeyPressed(DIK_UP) || GetDI()->JoystickDPadPressed(2,0)) { SetCurrMenuSelection(GetCurrMenuSelection()-1);; if (GetCurrMenuSelection() < MUSIC_VOLUME) SetCurrMenuSelection(NULL_END-1); } else if (GetDI()->KeyDown(DIK_LEFT) || GetDI()->JoystickDPadPressed(0,0) || GetDI()->MouseButtonDown(MOUSE_LEFT)) { switch(GetCurrMenuSelection()) { case MUSIC_VOLUME: if (m_nMusicVolume > 0) { m_nMusicVolume -= (int)(VOLUME_ADJUST_SPEED * fElapsedTime); GetGame()->SetMusicVolume((float)m_nMusicVolume/100.0f); GetFMOD()->SetVolume(GetAssets()->aOMmusicSnd, GetGame()->GetMusicVolume()); m_bHasASettingChanged = true; } break; case SFX_VOLUME: if (m_nSFXVolume > 0) { m_nSFXVolume -= (int)(VOLUME_ADJUST_SPEED * fElapsedTime); GetGame()->SetSFXVolume((float)m_nSFXVolume/100.0f); if (!GetFMOD()->IsSoundPlaying(GetAssets()->aMMmenuClickSnd)) { GetFMOD()->PlaySound(GetAssets()->aMMmenuClickSnd); GetFMOD()->SetVolume(GetAssets()->aMMmenuClickSnd, GetGame()->GetSFXVolume()); } m_bHasASettingChanged = true; } break; } } else if (GetDI()->KeyDown(DIK_RIGHT) || GetDI()->JoystickDPadPressed(1,0) || GetDI()->MouseButtonDown(MOUSE_RIGHT)) { switch(GetCurrMenuSelection()) { case MUSIC_VOLUME: if (m_nMusicVolume < 100) { m_nMusicVolume += (int)(VOLUME_ADJUST_SPEED * fElapsedTime); GetGame()->SetMusicVolume((float)m_nMusicVolume/100.0f); m_bHasASettingChanged = true; GetFMOD()->SetVolume(GetAssets()->aOMmusicSnd, GetGame()->GetMusicVolume()); } break; case SFX_VOLUME: if (m_nSFXVolume < 100) { m_nSFXVolume += (int)(VOLUME_ADJUST_SPEED * fElapsedTime); GetGame()->SetSFXVolume((float)m_nSFXVolume/100.0f); if (!GetFMOD()->IsSoundPlaying(GetAssets()->aMMmenuClickSnd)) { GetFMOD()->PlaySound(GetAssets()->aMMmenuClickSnd); GetFMOD()->SetVolume(GetAssets()->aMMmenuClickSnd, GetGame()->GetSFXVolume()); } m_bHasASettingChanged = true; } } } if (GetDI()->KeyPressed(DIK_RETURN) || GetDI()->JoystickButtonPressed(0,0) || GetDI()->MouseButtonPressed(MOUSE_LEFT) || GetDI()->KeyPressed(DIK_ESCAPE)) { switch(GetCurrMenuSelection()) { case BACK: GetGame()->ChangeState(CMainMenuState::GetInstance()); } } return true; } void COptionsMenuState::Render() { CBaseMenuState::Render(); GetTM()->DrawWithZSort(GetAssets()->aMousePointerID, m_nMouseX-10, m_nMouseY-3, 0.0f); // TODO:: finish options rendering here char szText[64]; sprintf_s(szText, "MUSIC VOLUME (%i)", m_nMusicVolume); GetBitmapFont()->DrawString(szText, GetMenuX(), GetMenuY(), 0.05f, 1.0f, D3DCOLOR_ARGB(255,0,255,0)); GetBitmapFont()->DrawString(szText, GetMenuX()+4, GetMenuY()+4, 0.051f, 1.0f, D3DCOLOR_ARGB(255,255,0,0)); sprintf_s(szText, "SFX VOLUME (%i)", m_nSFXVolume); GetBitmapFont()->DrawString(szText, GetMenuX(), GetMenuY() + GetMenuItemSpacing(), 0.05f, 1.0f, D3DCOLOR_ARGB(255,0,255,0)); GetBitmapFont()->DrawString(szText, GetMenuX()+4, GetMenuY() + GetMenuItemSpacing()+4, 0.051f, 1.0f, D3DCOLOR_ARGB(255,255,0,0)); GetBitmapFont()->DrawString("EXIT", GetMenuX(), GetMenuY() + (2*GetMenuItemSpacing()), 0.05f, 1.0f, D3DCOLOR_ARGB(255,0,255,0)); GetBitmapFont()->DrawString("EXIT", GetMenuX()+4, GetMenuY() + (2*GetMenuItemSpacing())+4, 0.051f, 1.0f, D3DCOLOR_ARGB(255,255,0,0)); // Draw menu cursor GetTM()->DrawWithZSort(GetAssets()->aMenuCursorImageID, GetCursorX(), GetCursorY() + (GetCurrMenuSelection()*GetMenuItemSpacing()), 0); } void COptionsMenuState::SaveSettings() { ofstream ofs("Resources/SavedGames/SoundSettings.txt", ios_base::trunc); float x = GetGame()->GetSFXVolume(); float xx = GetGame()->GetMusicVolume(); ofs << GetGame()->GetMusicVolume() << '\n'; ofs << GetGame()->GetSFXVolume() << '\n'; ofs.close(); } void COptionsMenuState::Exit() { GetFMOD()->StopSound(GetAssets()->aOMmusicSnd); GetFMOD()->ResetSound(GetAssets()->aOMmusicSnd); if (m_bHasASettingChanged) SaveSettings(); CBaseMenuState::Exit(); }
[ "AllThingsCandid@7dc79cba-3e6d-11de-b8bc-ddcf2599578a", "jsierra099@7dc79cba-3e6d-11de-b8bc-ddcf2599578a", "marvelman610@7dc79cba-3e6d-11de-b8bc-ddcf2599578a" ]
[ [ [ 1, 12 ], [ 14, 42 ], [ 48, 53 ], [ 56, 56 ], [ 58, 93 ], [ 95, 97 ], [ 99, 113 ], [ 115, 122 ], [ 124, 141 ], [ 143, 150 ], [ 152, 177 ], [ 182, 191 ], [ 199, 208 ] ], [ [ 13, 13 ], [ 43, 47 ], [ 54, 55 ], [ 57, 57 ], [ 94, 94 ], [ 114, 114 ], [ 123, 123 ], [ 142, 142 ], [ 151, 151 ], [ 178, 181 ], [ 192, 198 ] ], [ [ 98, 98 ] ] ]
4e68e52db6f10a3e270460d95cd1ab9e701dcf4d
3856c39683bdecc34190b30c6ad7d93f50dce728
/server/UI.h
4b5576695fd3754e2baab0d2cd1131fad0e50980
[]
no_license
yoonhada/nlinelast
7ddcc28f0b60897271e4d869f92368b22a80dd48
5df3b6cec296ce09e35ff0ccd166a6937ddb2157
refs/heads/master
2021-01-20T09:07:11.577111
2011-12-21T22:12:36
2011-12-21T22:12:36
34,231,967
0
0
null
null
null
null
UTF-8
C++
false
false
141
h
#ifndef _UI_H_ #define _UI_H_ class CUI { private: public: CUI(); virtual ~CUI(); virtual VOID Draw()=0; }; #endif
[ "[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0" ]
[ [ [ 1, 18 ] ] ]
3208527d83cd1a206746193886af3fe9806e9b94
222bc22cb0330b694d2c3b0f4b866d726fd29c72
/src/brookbox/wm2/WmlDistVec2Elp2.h
394673b25e16afb79cedb0d48ed33e93c4d4db8b
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference" ]
permissive
darwin/inferno
02acd3d05ca4c092aa4006b028a843ac04b551b1
e87017763abae0cfe09d47987f5f6ac37c4f073d
refs/heads/master
2021-03-12T22:15:47.889580
2009-04-17T13:29:39
2009-04-17T13:29:39
178,477
2
0
null
null
null
null
UTF-8
C++
false
false
1,273
h
// Magic Software, Inc. // http://www.magic-software.com // http://www.wild-magic.com // Copyright (c) 2003. All Rights Reserved // // The Wild Magic Library (WML) source code is supplied under the terms of // the license agreement http://www.magic-software.com/License/WildMagic.pdf // and may not be copied or disclosed except in accordance with the terms of // that agreement. #ifndef WMLDISTVEC2ELP2_H #define WMLDISTVEC2ELP2_H // Input: Ellipse (x/a)^2+(y/b)^2 = 1, point (u,v). // rkExtent = (a,b) // Output: Closest point (x,y) on ellipse to (u,v), function returns // the distance sqrt((x-u)^2+(y-v)^2). // rkPoint = (u,v), rkClosest = (x,y) // // Method sets up the distance as the maximum root to a fourth degree // polynomial. The root is found by Newton's method. If the return value // is -1, then the iterates failed to converge. #include "WmlEllipse2.h" namespace Wml { template <class Real> WML_ITEM Real SqrDistance (const EllipseStandard2<Real>& rkEllipse, const Vector2<Real>& rkPoint, Vector2<Real>& rkClosest); template <class Real> WML_ITEM Real Distance (const EllipseStandard2<Real>& rkEllipse, const Vector2<Real>& rkPoint, Vector2<Real>& rkClosest); } #endif
[ [ [ 1, 39 ] ] ]
fb5209cedf26d0c6bf5591f0f5d0523ff01d45f1
7f6fe18cf018aafec8fa737dfe363d5d5a283805
/samples/ted/editwindow.h
af5d3f11efd1f86ed4204467b164e6e446f356c1
[]
no_license
snori/ntk
4db91d8a8fc836ca9a0dc2bc41b1ce767010d5ba
86d1a32c4ad831e791ca29f5e7f9e055334e8fe7
refs/heads/master
2020-05-18T05:28:49.149912
2009-08-04T16:47:12
2009-08-04T16:47:12
268,861
2
0
null
null
null
null
UTF-8
C++
false
false
645
h
#ifndef __EDITWINDOW_H__ #define __EDITWINDOW_H__ #include <ntk/interface/window.h> #include <ntk/interface/scintilla.h> class edit_window_t : public ntk_window { public: // // methods // edit_window_t(); ~edit_window_t(); bool quit_requested(); void message_received(const ntk_message& message); LRESULT system_command_received(uint id); private: // // data // ntk_string m_file_name; ntk_scintilla* m_edit; // // functions // void load_file_(const ntk_string& file_name); void save_file_(const ntk_string& file_name, bool over_write = false); };// class edit_window_t #endif//EOH
[ [ [ 1, 37 ] ] ]
f116760861a9eef018c87e97d2964175973330b0
be2e23022d2eadb59a3ac3932180a1d9c9dee9c2
/NpcServer/NpcKernel/GameObj.h
b9bc9435a9d0b0553dfb2b7f42fea88fe46f242b
[]
no_license
cronoszeu/revresyksgpr
78fa60d375718ef789042c452cca1c77c8fa098e
5a8f637e78f7d9e3e52acdd7abee63404de27e78
refs/heads/master
2020-04-16T17:33:10.793895
2010-06-16T12:52:45
2010-06-16T12:52:45
35,539,807
0
2
null
null
null
null
UTF-8
C++
false
false
478
h
#pragma once #include <windows.h> #include <stdio.h> #include "define.h" #include "basefunc.h" char szID[]; class CGameObj { public: CGameObj(); virtual ~CGameObj(); virtual OBJID GetID() {::LogSave("Fatal error in CGameObj::GetID()."); return ID_NONE;}//=0; virtual int GetObjType() {return m_nObjType;} virtual void SetObjType(int nType) {m_nObjType=nType;} static BOOL SafeCheck (CGameObj* pObj); private: int m_nObjType; };
[ "rpgsky.com@cc92e6ba-efcf-11de-bf31-4dec8810c1c1" ]
[ [ [ 1, 29 ] ] ]
f5e5c17cc8350f4c046c8fa6ad2db411683b40ea
867f5533667cce30d0743d5bea6b0c083c073386
/EchoServer/EchoServer_Cxx/client.h
b45486a2c522a18f96916e7133e205a4126cf0e4
[]
no_license
mei-rune/jingxian-project
32804e0fa82f3f9a38f79e9a99c4645b9256e889
47bc7a2cb51fa0d85279f46207f6d7bea57f9e19
refs/heads/master
2022-08-12T18:43:37.139637
2009-12-11T09:30:04
2009-12-11T09:30:04
null
0
0
null
null
null
null
GB18030
C++
false
false
824
h
#pragma once #include "server.h" class client : public micro_task { public: client(server& task, SOCKET handle ) : micro_task( task) , _svr( &task ) , _socket( handle ) { std::cout << "client[" << _socket << "]连接到来!" << std::endl; } ~client() { ::closesocket( _socket ); std::cout << "client[" << _socket << "]连接断开!" << std::endl; } void run() { char buffer[1024]; while( true ) { _svr->register_read( _socket, *this ); yield(); int l = ::recv( _socket, buffer, 1024, 0 ); if( 0 >= l ) return; _svr->register_write( _socket, *this ); yield(); if( 0 >= ::send( _socket, buffer, l, 0 ) ) return; } } virtual void on_exit() { _svr->stop( this ); } private: server* _svr; SOCKET _socket; };
[ "runner.mei@0dd8077a-353d-11de-b438-597f59cd7555" ]
[ [ [ 1, 47 ] ] ]
74e63ed79f05c8a6cbcf47ca3bab0b6338ad566e
7acbb1c1941bd6edae0a4217eb5d3513929324c0
/GLibrary-CPP/sources/GMouse.h
3b7eb0fa3f921623d0da3e3746a22b7cbd203299
[]
no_license
hungconcon/geofreylibrary
a5bfc96e0602298b5a7b53d4afe7395a993498f1
3abf3e1c31a245a79fa26b4bcf2e6e86fa258e4d
refs/heads/master
2021-01-10T10:11:51.535513
2009-11-30T15:29:34
2009-11-30T15:29:34
46,771,895
1
1
null
null
null
null
UTF-8
C++
false
false
291
h
#ifndef __GMOUSE_H__ # define __GMOUSE_H__ #include "GExport.h" #if defined (GWIN) #define OEMRESOURCE # include "windows.h" # include "winuser.h" #endif class GEXPORTED GMouse { public: static void HideCursor(void); static void ShowCursor(void); }; #endif
[ "mvoirgard@34e8d5ee-a372-11de-889f-a79cef5dd62c", "[email protected]" ]
[ [ [ 1, 4 ], [ 7, 7 ], [ 9, 13 ], [ 15, 17 ], [ 19, 21 ] ], [ [ 5, 6 ], [ 8, 8 ], [ 14, 14 ], [ 18, 18 ] ] ]
36db472523971ce349e3bd81bbc45be9f23ab720
b47e38256ce41d17fa8cbc7cbb46f8c4394b1e79
/ptr.h
431ef92cabec3c2a95b2203f6e1c213d7c39d780
[]
no_license
timothyha/ppc-bq
b54162c6e117d6df9849054e75bc7da06d630c1a
144c3a00bd130fc34831f530e2c7207edaa8ee7e
refs/heads/master
2020-05-16T14:25:31.426285
2010-09-04T06:03:47
2010-09-04T06:03:47
32,114,289
0
0
null
null
null
null
UTF-8
C++
false
false
3,871
h
/* * Copyright (c) 2001,2002,2003 Mike Matsnev. 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 immediately at the beginning of the file, without modification, * this list of conditions, and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Absolutely no warranty of function or purpose is made by the author * Mike Matsnev. * * 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. * * $Id: ptr.h,v 1.11.4.1 2003/04/12 22:52:34 mike Exp $ * */ #if !defined(AFX_PTR_H__DE473C69_8A68_4943_B3D7_EE059BE4EB0F__INCLUDED_) #define AFX_PTR_H__DE473C69_8A68_4943_B3D7_EE059BE4EB0F__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 template <class T> class auto_ptr1 { private: T* m_ptr; public: explicit auto_ptr1(T* p = 0) : m_ptr(p) {} auto_ptr1(auto_ptr1& a) : m_ptr(a.release()) {} auto_ptr1& operator=(auto_ptr1& a) { if (&a != this) { delete m_ptr; m_ptr = a.release(); } return *this; } auto_ptr1& operator=(T *p) { if (p != m_ptr) { delete m_ptr; m_ptr=p; } return *this; } ~auto_ptr1() { delete m_ptr; } T& operator*() const { return *m_ptr; } T* operator->() const { return m_ptr; } T* get() const { return m_ptr; } T* release() { T* tmp = m_ptr; m_ptr = 0; return tmp; } void reset(T* p = 0) { delete m_ptr; m_ptr = p; } }; template<class T> class Buffer { struct Buf { int m_refs; //T *m_data; }; T *m_data; Buf *buf() const { return ((Buf*)m_data)-1; } int m_size; void grab() const { if (m_data) ++buf()->m_refs; } void release() { if (m_data) { if (--buf()->m_refs==0) delete[] buf(); m_data=0; } } public: Buffer() : m_data(0), m_size(0) { } Buffer(const Buffer& b) : m_data(b.m_data), m_size(b.m_size) { grab(); } Buffer(int n) : m_size(n), m_data(0) { if (n) { m_data=(T*)(new Buf[(sizeof(T)*n+sizeof(Buf)-1)/sizeof(Buf)+1]+1); buf()->m_refs=1; } } Buffer(const T *p,int n) : m_size(n), m_data(0) { if (n) { m_data=(T*)(new Buf[(sizeof(T)*n+sizeof(Buf)-1)/sizeof(Buf)+1]+1); buf()->m_refs=1; memcpy(m_data,p,sizeof(T)*n); } } ~Buffer() { release(); } Buffer<T>& operator=(const Buffer<T>& b) { b.grab(); release(); m_data=b.m_data; m_size=b.m_size; return *this; } operator T*() { return m_data; } operator const T*() const { return m_data; } int size() const { return m_size; } void setsize(int ns) { m_size=ns; } void Zero() { memset(m_data,0,m_size*sizeof(T)); } }; #endif // !defined(AFX_PTR_H__DE473C69_8A68_4943_B3D7_EE059BE4EB0F__INCLUDED_)
[ "nuh.ubf@e3e9064e-3af0-11de-9146-fdf1833cc731" ]
[ [ [ 1, 121 ] ] ]
0b47ee2453e5cf10f9394ceaf8fb9e18f0d10606
ebabb4ffbc7ac85d4121e69c978dfdf9be7613cb
/main.cpp
14fc7e0fb0a8380dcd5a5cb044fcb7d45488af06
[]
no_license
eluqm/compiladores11
1ca69832a8732e4171c326b6bf2082042c7a83aa
b17c927b0805b7559bfaa4bd473df37739f0a2c1
refs/heads/master
2020-12-31T05:09:35.087238
2011-09-06T02:08:59
2011-09-06T02:08:59
57,864,377
0
0
null
null
null
null
UTF-8
C++
false
false
847
cpp
#include<iostream> #include<fstream> #include<map> #include"Scanner.h" #include"symbolTable.h" #include "globals.h" using namespace std; int main(int argc,char*argv[]) { if(argc < 2){cout<<"introduzca un archivo para leer"<<endl;} else{ if(argc > 2){cout<<"muchos parametros"<<endl;} else{ Scanner *Sca; Sca = new Scanner(argv[1]); //Sca = new Scanner("archivo.txt"); Sca->init_reservadas(); Sca->init_tok(); Token t=Sca->getToken(); //cout<<'\\'<<endl; while(ENDFILE!=t.getTok()&&ERROR!=t.getTok()) { t=Sca->getToken(); } if(t.getTok()==ERROR) { cout<<"No se pudo completar reconocimiento"<<endl; cout<<t.getLexema()<<"en la linea :"<<Sca->get_nrolinea()<<endl; } //cout<<t.getLexema()<<endl; Sca->printTable_ID(); } } return 0; }
[ [ [ 1, 5 ], [ 7, 48 ] ], [ [ 6, 6 ] ] ]
69b87e9bcc25dba7acbc6e067a64d52e3767582a
5ff30d64df43c7438bbbcfda528b09bb8fec9e6b
/tests/graphics/step02/Texture.h
1fb3ee086401693828672751be5bfef18ad1765c
[]
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
336
h
#pragma once #include <d3d9.h> namespace gfx { /** * @class Texture */ class Texture { public: Texture( IDirect3DTexture9* tex ); ~Texture(); IDirect3DTexture9* GetTex(); private: IDirect3DTexture9* m_tex; }; inline IDirect3DTexture9* Texture::GetTex() { return m_tex; } } // namespace gfx
[ "darkface@localhost" ]
[ [ [ 1, 29 ] ] ]
40d46e85fbf43bf10857a12b5c29150250e2cff3
4d5ee0b6f7be0c3841c050ed1dda88ec128ae7b4
/src/nvimage/openexr/src/IexTest/testBaseExc.cpp
dd67528b6e86af38acfc79e8e5e2e9877c4fee22
[]
no_license
saggita/nvidia-mesh-tools
9df27d41b65b9742a9d45dc67af5f6835709f0c2
a9b7fdd808e6719be88520e14bc60d58ea57e0bd
refs/heads/master
2020-12-24T21:37:11.053752
2010-09-03T01:39:02
2010-09-03T01:39:02
56,893,300
0
1
null
null
null
null
UTF-8
C++
false
false
3,830
cpp
/////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // 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 Industrial Light & Magic 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 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// #include <testBaseExc.h> #include "Iex.h" #include <iostream> #include <stdexcept> #include <assert.h> namespace { void throwArgExc () { throw Iex::ArgExc ("ArgExc"); } void throwLogicError () { throw std::logic_error("logic_error"); } void throwInt () { throw 3; } void throwNested() { try { throwArgExc(); } catch (const Iex::ArgExc &) { try { throwInt(); } catch (...) { } throw; } } void test1 () { std::cout << "1" << std::endl; try { throwArgExc(); } catch (const Iex::ArgExc &) { return; } catch (std::exception &) { assert (false); } catch (...) { assert (false); } assert (false); } void test2 () { std::cout << "2" << std::endl; try { throwLogicError(); } catch (const Iex::ArgExc &) { assert (false); } catch (std::exception &) { return; } catch (...) { assert (false); } assert (false); } void test3 () { std::cout << "3" << std::endl; try { throwArgExc(); } catch (std::exception &) { return; } catch (...) { assert (false); } assert (false); } void test4 () { std::cout << "4" << std::endl; try { throwInt(); } catch (const Iex::ArgExc &) { assert (false); } catch (std::exception &) { assert (false); } catch (...) { return; } assert (false); } void test5() { std::cout << "5" << std::endl; try { throwNested(); } catch (const Iex::ArgExc &e) { assert (e == "ArgExc"); } } } // namespace void testBaseExc() { std::cout << "See if throw and catch work:" << std::endl; test1(); test2(); test3(); test4(); test5(); std::cout << "ok\n" << std::endl; }
[ "castano@0f2971b0-9fc2-11dd-b4aa-53559073bf4c" ]
[ [ [ 1, 210 ] ] ]
4e6627788ebf9301af047feb067da51fc1d27bfb
5236606f2e6fb870fa7c41492327f3f8b0fa38dc
/nsrpc/src/ReactorSession.cpp
f5c2dd6116c9ddffd2a6e6b957bbdbef272d72e4
[]
no_license
jcloudpld/srpc
aa8ecf4ffc5391b7183b19d217f49fb2b1a67c88
f2483c8177d03834552053e8ecbe788e15b92ac0
refs/heads/master
2021-01-10T08:54:57.140800
2010-02-08T07:03:00
2010-02-08T07:03:00
44,454,693
0
0
null
null
null
null
UTF-8
C++
false
false
12,356
cpp
#include "stdafx.h" #include <nsrpc/ReactorSession.h> #include <nsrpc/detail/PacketCoderFactory.h> #include <nsrpc/detail/PacketCoder.h> #include <nsrpc/detail/CsProtocol.h> #include <nsrpc/utility/MessageBlockManager.h> #include <nsrpc/utility/Logger.h> #ifdef _MSC_VER # pragma warning( push ) # pragma warning( disable : 4127 4251 4541 4511 4512 4800 ) #endif #include <ace/INET_Addr.h> #include <ace/SOCK_Connector.h> #include <ace/Connector.h> #include <ace/Reactor.h> #ifdef _MSC_VER # pragma warning( pop ) #endif #include <cassert> namespace nsrpc { namespace { InitAce initAce; enum { /// high watermark (128 K). hwmMessageQueue = 128 * 1024, /// low watermark (same as high water mark). lwmMessageQueue = 128 * 1024 }; } // namespace // = ReactorSession #ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable: 4355 ) #endif ReactorSession::ReactorSession(ACE_Reactor* reactor, PacketCoderFactory* packetCoderFactory) : ACE_Event_Handler(reactor), msgQueue_(hwmMessageQueue, lwmMessageQueue), notifier_(reactor, this, ACE_Event_Handler::WRITE_MASK), disconnectReserved_(false), fireEventAfterFlush_(false), lastLogTime_(time(0)), prevQueueSize_(0) { if (packetCoderFactory != 0) { packetCoder_.reset(packetCoderFactory->create()); } else { packetCoder_.reset(PacketCoderFactory().create()); } packetHeaderSize_ = packetCoder_->getHeaderSize(); messageBlockManager_.reset(new SynchMessageBlockManager( packetCoder_->getDefaultPacketPoolSize(), packetCoder_->getDefaultPacketSize())); recvBlock_.reset( messageBlockManager_->create(packetCoder_->getMaxPacketSize())); msgBlock_.reset( messageBlockManager_->create(packetCoder_->getMaxPacketSize())); } #ifdef _MSC_VER # pragma warning ( pop ) #endif ReactorSession::~ReactorSession() { disconnect(); reactor(0); releaseMessageQueue(); } bool ReactorSession::connect(const srpc::String& ip, u_short port, size_t timeout) { const ACE_INET_Addr address(port, ip.c_str()); const ACE_Time_Value connectionTimeout(makeTimeValue(timeout)); ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, monitor, lock_, false); if (isConnected()) { assert(false && "Already connected. Disconnect first."); return false; } ACE_SOCK_Connector connector; if (connector.connect(peer(), address, &connectionTimeout) == -1) { NSRPC_LOG_ERROR4(ACE_TEXT("ReactorSession::connect(%s:%u) ") ACE_TEXT("FAILED!!!(%d,%m)\n"), ip.c_str(), port, ACE_OS::last_error()); disconnect_i(false); return false; } if (! initSession()) { disconnect_i(false); return false; } onConnected(); return true; } void ReactorSession::disconnect(bool fireEvent) { ACE_GUARD(ACE_Recursive_Thread_Mutex, monitor, lock_); disconnect_i(fireEvent); } void ReactorSession::disconnectGracefully(bool fireEvent) { ACE_GUARD(ACE_Recursive_Thread_Mutex, monitor, lock_); if (! msgQueue_.is_empty()) { disconnectReserved_ = true; fireEventAfterFlush_ = fireEvent; } else { disconnect_i(fireEvent); } } bool ReactorSession::sendMessage(ACE_Message_Block& mblock, CsMessageType messageType) { ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, monitor, lock_, false); if (! isConnected()) { return false; } if (disconnectReserved_) { return false; } AceMessageBlockGuard block(&mblock); if (packetCoder_->isValidPacket(*block)) { CsPacketHeader header(messageType); if (packetCoder_->encode(*block, header)) { const int result = msgQueue_.enqueue_tail(block.get()); if (result != -1) { block.release(); return true; // success } NSRPC_LOG_ERROR3(ACE_TEXT("ReactorSession::sendMessage() - ") ACE_TEXT("enqueue_tail(%d,%m,%d queued) FAILED."), ACE_OS::last_error(), msgQueue_.message_count()); } else { NSRPC_LOG_ERROR(ACE_TEXT("ReactorSession::sendMessage() - ") ACE_TEXT("Packet encoding FAILED.")); } } else { NSRPC_LOG_ERROR2(ACE_TEXT("ReactorSession::sendMessage() - ") ACE_TEXT("Too short message(%d)."), block->length()); } disconnect_i(true); return false; } bool ReactorSession::initSession() { packetCoder_->reset(); // turn off nagle-algorithm long nagle = 1; stream_.set_option(IPPROTO_TCP, TCP_NODELAY, &nagle, sizeof(nagle)); stream_.enable(ACE_NONBLOCK); (void)setMaximumSocketBufferSize(get_handle()); const ACE_Reactor_Mask masks = ACE_Event_Handler::READ_MASK; if (reactor()->register_handler(this, masks) == -1) { NSRPC_LOG_ERROR2( ACE_TEXT("ACE_Reactor::register_handler() FAILED!!!(%d,%m)"), ACE_OS::last_error()); return false; } notifier_.reactor(reactor()); msgQueue_.notification_strategy(&notifier_); headerForReceive_.reset(); assert(false == disconnectReserved_); assert(false == fireEventAfterFlush_); return true; } void ReactorSession::disconnect_i(bool fireEvent) { if (peer().get_handle() != ACE_INVALID_HANDLE) { const ACE_Reactor_Mask masks = ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL; reactor()->remove_handler(this, masks); disconnectReserved_ = false; fireEventAfterFlush_ = false; msgQueue_.flush(); closeSocket(); if (fireEvent) { onDisconnected(); } } } void ReactorSession::closeSocket() { peer().close(); peer().set_handle(ACE_INVALID_HANDLE); } bool ReactorSession::read() { if (recvBlock_->space() <= 0) { const size_t spare = recvBlock_->capacity() / 50; assert(spare > 0); recvBlock_->size(recvBlock_->size() + spare); } const ssize_t recvSize = peer().recv(recvBlock_->wr_ptr(), recvBlock_->space()); if (recvSize < 0) { if (ACE_OS::last_error() == EWOULDBLOCK) { return true; } NSRPC_LOG_ERROR2( ACE_TEXT("ReactorSession::read() FAILED!!!(%d,%m)"), ACE_OS::last_error()); return false; } else if (recvSize == 0) { NSRPC_LOG_DEBUG2(ACE_TEXT("Disconnected from server(%d,%m)."), ACE_OS::last_error()); return false; } recvBlock_->wr_ptr(recvSize); return true; } bool ReactorSession::write() { int queueSize = -1; { ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, monitor, lock_, false); ACE_Message_Block* mblock; ACE_Time_Value immediate(ACE_Time_Value::zero); if (msgQueue_.dequeue_head(mblock, &immediate) == -1) { return true; } AceMessageBlockGuard block(mblock); const ssize_t sentSize = peer().send(block->rd_ptr(), block->length()); if (sentSize == -1) { if (ACE_OS::last_error() != EWOULDBLOCK) { NSRPC_LOG_DEBUG2( ACE_TEXT("ReactorSession::write() ") ACE_TEXT("FAILED!!!(%d,%m)"), ACE_OS::last_error()); return false; } } else { block->rd_ptr(sentSize); } if (block->length() > 0) { const int result = msgQueue_.enqueue_head(block.get()); if (result == -1) { NSRPC_LOG_ERROR2( ACE_TEXT("ReactorSession::write() - ") ACE_TEXT("enqueue_head(%d, %m) FAILED!!!"), ACE_OS::last_error()); return false; } else { block.release(); // success } } queueSize = getWriteQueueSize(); } if (queueSize >= 0) { NSRPC_LOG_INFO2("ReactorSession: current write queue size = %u.", queueSize); } return true; } void ReactorSession::releaseMessageQueue() { ACE_Message_Block* mblock; ACE_Time_Value immediate(ACE_Time_Value::zero); while (! msgQueue_.is_empty()) { if (msgQueue_.dequeue_head(mblock) != -1) { mblock->release(); } else { assert(false); break; } } assert(msgQueue_.is_empty()); } bool ReactorSession::parseHeader() { if (headerForReceive_.isValid()) { return true; } assert(recvBlock_->length() >= packetHeaderSize_); return packetCoder_->readHeader(headerForReceive_, *recvBlock_); } bool ReactorSession::parseMessage() { const size_t messageSize = packetHeaderSize_ + headerForReceive_.bodySize_; msgBlock_->reset(); msgBlock_->size(messageSize); msgBlock_->copy(recvBlock_->base(), messageSize); recvBlock_->rd_ptr(messageSize); recvBlock_->crunch(); if (! packetCoder_->decode(*msgBlock_)) { return false; } packetCoder_->advanceToBody(*msgBlock_); if (! isValidCsMessageType(headerForReceive_.messageType_)) { NSRPC_LOG_ERROR(ACE_TEXT("ReactorSession::handle_input() - ") ACE_TEXT("Invalid Message Type.")); return false; } return true; } bool ReactorSession::isPacketHeaderArrived() const { return recvBlock_->length() >= packetHeaderSize_; } bool ReactorSession::isMessageArrived() const { return recvBlock_->length() >= (packetHeaderSize_ + headerForReceive_.bodySize_); } int ReactorSession::getWriteQueueSize() { const time_t logInterval = 3; const size_t queueThreshold = 3; const time_t currentTime = time(0); if ((currentTime - lastLogTime_) <= logInterval) { const size_t currentQueueSize = msgQueue_.message_count(); const size_t queueSizeDiff = (currentQueueSize > prevQueueSize_) ? currentQueueSize : prevQueueSize_; if (queueSizeDiff > 0) { lastLogTime_ = currentTime; if (queueSizeDiff > queueThreshold) { prevQueueSize_ = currentQueueSize; return static_cast<int>(currentQueueSize); } } } return -1; } // = ACE_Event_Handler overriding int ReactorSession::handle_input(ACE_HANDLE) { ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, monitor, lock_, -1); if (! read()) { return -1; } while (isPacketHeaderArrived()) { if (! parseHeader()) { return -1; } if (! isMessageArrived()) { break; } if (! parseMessage()) { return -1; } onMessageArrived(headerForReceive_.messageType_); headerForReceive_.reset(); } return 0; } int ReactorSession::handle_output(ACE_HANDLE) { if (! write()) { return -1; } if (! msgQueue_.is_empty()) { reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK); } else { reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK); if (disconnectReserved_) { ACE_OS::shutdown(stream_.get_handle(), ACE_SHUTDOWN_WRITE); disconnect(fireEventAfterFlush_); } } return 0; } int ReactorSession::handle_close(ACE_HANDLE, ACE_Reactor_Mask) { disconnect(true); return 0; } // = MessageBlockProvider overriding ACE_Message_Block& ReactorSession::acquireSendBlock() { ACE_Message_Block* mblock = messageBlockManager_->create(packetCoder_->getDefaultPacketSize()); packetCoder_->reserveHeader(*mblock); return *mblock; } ACE_Message_Block& ReactorSession::acquireRecvBlock() { return *msgBlock_; } } // namespace nsrpc
[ "kcando@6d7ccee0-1a3b-0410-bfa1-83648d9ec9a4" ]
[ [ [ 1, 489 ] ] ]
9c647f5b258d798d9794d06178ef58d4d626ba2e
fcdddf0f27e52ece3f594c14fd47d1123f4ac863
/TeCom/src/Tdk/Source Files/TdkConvertLayerToOdLayer.cpp
3410252d64f360be147f3328bc8db87eb20b8192
[]
no_license
radtek/terra-printer
32a2568b1e92cb5a0495c651d7048db6b2bbc8e5
959241e52562128d196ccb806b51fda17d7342ae
refs/heads/master
2020-06-11T01:49:15.043478
2011-12-12T13:31:19
2011-12-12T13:31:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,773
cpp
#include <TdkConvertLayerToOdLayer.h> #include <TeOdaExport.h> #include <TeDatabase.h> #include <TdkAbstractProcessEvent.h> #include <TdkGeometrySettings.h> TdkConvertLayerToOdLayer::TdkConvertLayerToOdLayer(TeOdaExport *odExport, TeDatabase *database, TdkAbstractProcessEvent *process) { _database=database; _odExport=odExport; _layer=NULL; _process=process; _iProcess=0; _maxProcess=0; _cancel=NULL; } TdkConvertLayerToOdLayer::~TdkConvertLayerToOdLayer() { _layer=NULL; } TeLayer* TdkConvertLayerToOdLayer::getLayer(const std::string &layerName) { TeLayerMap layerMap; TeLayerMap::iterator it; if(_database == NULL) throw "Invalid null database pointer"; else if(layerName.empty()) throw "Invalid null layer name"; layerMap=_database->layerMap(); for(it=layerMap.begin();it!=layerMap.end();it++) { if(TeConvertToUpperCase((*it).second->name()) == TeConvertToUpperCase(layerName)) { return (*it).second; } } TeLayer *layer=new TeLayer(); layer->name(layerName); if(!_database->loadLayer(layer)) { delete layer; layer=NULL; } return layer; } bool TdkConvertLayerToOdLayer::convert(const std::string &layerName, const short &rep,const std::string &restriction, \ const TeColor &color, TdkGeometrySettings* settings) { bool status=true; if(!(_layer=getLayer(layerName))) throw "Impossible load layer"; if( _odExport == NULL ) throw "Invalid null ODA pointer"; _odExport->createLayer(layerName); _maxProcess=getTotalItemsfromLayer(_layer,rep,restriction); if(rep & TePOLYGONS & _layer->geomRep()) status=convertPolygons(_layer,color,restriction,settings); if(_cancel) { if(*_cancel==true) return false; } if(rep & TeLINES & _layer->geomRep()) status&=convertLines(_layer,color,restriction,settings); if(_cancel) { if(*_cancel==true) return false; } if(rep & TeTEXT & _layer->geomRep()) status&=convertTexts(_layer,color,restriction,settings); return status; } unsigned int TdkConvertLayerToOdLayer::getTotalItems(const std::string &tableName,const std::string &restriction) { std::string sql; TeDatabasePortal *dbPortal=NULL; unsigned int total; sql="select count(*) from " + tableName; if(!restriction.empty()) sql+= " " + restriction; dbPortal=_database->getPortal(); if(dbPortal->query(sql) && dbPortal->fetchRow()) total=(unsigned int)dbPortal->getInt(0); dbPortal->freeResult(); delete dbPortal; return total; } unsigned TdkConvertLayerToOdLayer::getTotalItemsfromLayer(TeLayer *layer, const short &rep,const std::string &restriction) { unsigned int total=0; if(_process) { if(layer->geomRep() & rep & TePOLYGONS) total+=getTotalItems(layer->tableName(TePOLYGONS),restriction); if(layer->geomRep() & rep & TeLINES) total+=getTotalItems(layer->tableName(TeLINES),restriction); if(layer->geomRep() & rep & TePOINTS) total+=getTotalItems(layer->tableName(TePOINTS),restriction); if(layer->geomRep() & rep & TeTEXT) total+=getTotalItems(layer->tableName(TeTEXT),restriction); } return total; } bool TdkConvertLayerToOdLayer::convertLines(TeLayer * layer, const TeColor &tcolor,const std::string &restriction, \ TdkGeometrySettings *settings) { std::string tableName; std::string sql; TeDatabasePortal *dbPortal=NULL; bool flag; OdCmColor color; color.setRGB(tcolor.red_, tcolor.green_, tcolor.blue_); if(layer == NULL) throw "Invalid null layer pointer"; tableName=layer->tableName(TeLINES); sql="select * from " + tableName; if(!restriction.empty()) sql+= " " + restriction; dbPortal=_database->getPortal(); if(!dbPortal->query(sql) || !dbPortal->fetchRow()) { dbPortal->freeResult(); delete dbPortal; return false; } do { TeLine2D lneRead; flag=dbPortal->fetchGeometry(lneRead); if(_process) _process->buildingGeometryEvent(TeLINES,lneRead.geomId(),lneRead.objectId()); if(settings) settings->setIsPolygon(false); _odExport->addLine2D(lneRead,color,settings); _iProcess++; if(_process) _process->processStatusEvent(_maxProcess,_iProcess); if(_cancel) { if(*_cancel==true) break; } }while(flag); dbPortal->freeResult(); delete dbPortal; return true; } bool TdkConvertLayerToOdLayer::convertPolygons(TeLayer * layer,const TeColor &tcolor,const std::string &restriction, \ TdkGeometrySettings* settings) { std::string tableName; std::string sql; TeDatabasePortal *dbPortal=NULL; bool flag; unsigned int i; OdCmColor color; color.setRGB(tcolor.red_, tcolor.green_, tcolor.blue_); if(layer == NULL) throw "Invalid null layer pointer"; tableName=layer->tableName(TePOLYGONS); sql="select * from " + tableName; if(!restriction.empty()) sql+= " " + restriction; dbPortal=_database->getPortal(); if(!dbPortal->query(sql) || !dbPortal->fetchRow()) { dbPortal->freeResult(); delete dbPortal; return false; } do { TePolygon polRead; flag=dbPortal->fetchGeometry(polRead); if(_process) _process->buildingGeometryEvent(TePOLYGONS,polRead.geomId(),polRead.objectId()); for(i=0;i<polRead.size();i++) { TeLine2D lneRead; lneRead.copyElements(polRead[i]); if(settings) settings->setIsPolygon(true); _odExport->addLine2D(lneRead,color,settings); _iProcess++; if(_process) _process->processStatusEvent(_maxProcess,_iProcess); } if(_cancel) { if(*_cancel==true) break; } }while(flag); dbPortal->freeResult(); delete dbPortal; return true; } bool TdkConvertLayerToOdLayer::convertTexts(TeLayer * layer, const TeColor &tcolor,const std::string &restriction, \ TdkGeometrySettings *settings) { std::string tableName; std::string sql; TeDatabasePortal *dbPortal=NULL; bool flag; OdCmColor color; color.setRGB(tcolor.red_, tcolor.green_, tcolor.blue_); if(layer == NULL) throw "Invalid null layer pointer"; tableName=layer->tableName(TeTEXT); sql="select * from " + tableName; if(!restriction.empty()) sql+= " " + restriction; dbPortal=_database->getPortal(); if(!dbPortal->query(sql) || !dbPortal->fetchRow()) { dbPortal->freeResult(); delete dbPortal; return false; } do { TeText txtRead; flag=dbPortal->fetchGeometry(txtRead); if(_process) _process->buildingGeometryEvent(TeTEXT,txtRead.geomId(),txtRead.objectId()); _odExport->addTeText(txtRead,color,settings); _iProcess++; if(_process) _process->processStatusEvent(_maxProcess,_iProcess); if(_cancel) { if(*_cancel==true) break; } }while(flag); dbPortal->freeResult(); delete dbPortal; return true; }
[ "[email protected]@58180da6-ba8b-8960-36a5-00cc02a3ddec" ]
[ [ [ 1, 241 ] ] ]
5b3af887c396602f74ba347515217c169104e5b1
e41ff1b15d54fc77dd0b86abc83bcbefa0ff6c07
/src/WSGame.cpp
31f66b389dd6bfe825f14a1ac2034a8a4db361c4
[]
no_license
zerotri/WynterStorm_old
8dd9c6e3932b5883bce6f4fa6709159e8ca46ed8
dd289ed3419a7eaff8e824d7f818b31b03075f21
refs/heads/master
2020-12-24T13:44:58.837251
2010-03-22T10:21:56
2010-03-22T10:21:56
570,788
2
0
null
null
null
null
UTF-8
C++
false
false
2,304
cpp
#include <WSGame.h> #include <SDL.h> #include <algorithm> WSGame::WSGame() { m_dDeltaFramesPerSecond = 0; m_pCore = allocate<SRCore>(); m_pWindow = allocate<SRWindow>(); } WSGame::~WSGame() { m_pWindow->destroy(); delete m_pWindow; delete m_pCore; } void WSGame::Run() { m_pCore->Initialize(); m_dLastFrameTime = m_dDeltaFramesPerSecond = m_pCore->getTime(); m_bGameEnding = false; m_pWindow->create(640, 480); m_pWindow->setTitle(std::string("WynterStorm Engine")); SDL_Event event; //SDL_bool done=SDL_FALSE; Initialize(); do { // handle the events in the queue while (SDL_PollEvent(&event)) { switch(event.type) { case SDL_USEREVENT: onUserEvent(event.user.code, event.user.data1, event.user.data2); break; case SDL_MOUSEMOTION: onMouseMove(event.motion.x, event.motion.y); break; case SDL_MOUSEBUTTONDOWN: onMousePress((MouseButtons)event.button.button, event.button.x, event.button.y); break; case SDL_MOUSEBUTTONUP: onMouseRelease((MouseButtons)event.button.button, event.button.x, event.button.y); break; case SDL_MOUSEWHEEL: onMouseWheel(event.wheel.x, event.wheel.y); break; case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_CLOSE: m_bGameEnding = true; break; case SDL_WINDOWEVENT_RESIZED: //resize(event.window.data1, event.window.data2); break; } break; case SDL_KEYDOWN: onKeyPress(event.key.keysym.sym, event.key.keysym.mod, event.key.keysym.scancode); break; case SDL_KEYUP: if(event.key.keysym.sym == SDLK_ESCAPE) m_bGameEnding = true; else onKeyRelease(event.key.keysym.sym, event.key.keysym.mod, event.key.keysym.scancode); break; case SDL_QUIT: m_bGameEnding = true; break; } } double dFrameTime = m_pCore->getTime(); m_dDeltaFramesPerSecond = (dFrameTime - m_dLastFrameTime); m_dLastFrameTime = dFrameTime; Render(); m_pWindow->swap(); } while(m_bGameEnding == false); Shutdown(); m_pCore->Shutdown(); } fp64 WSGame::getFramesPerSecond() { return 1.0 / m_dDeltaFramesPerSecond; }
[ [ [ 1, 86 ] ] ]