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
7931b35d8bb4571b74a0ec1bc6bdc251ba326b90
5dfa2f8acf81eb653df4a35a76d6be973b10a62c
/trunk/Community_Core_Vision/addons/ofxNCore/src/Calibration/Calibration.h
2d8f0b548f764d0a5997c27941df85fb4728e18b
[]
no_license
guozanhua/ccv-multicam
d69534ff8592f7984a5eadc83ed8b20b9d3df949
31206f0de7f73b3d43f2a910fdcdffb7ed1bf2c2
refs/heads/master
2021-01-22T14:24:52.321877
2011-08-31T14:18:44
2011-08-31T14:18:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,955
h
/* * Calibration.h * * * Created on 2/2/09. * Copyright 2009 NUI Group. All rights reserved. * */ #ifndef CALIBRATION_H #define CALIBRATION_H #include "ofMain.h" #include "CalibrationUtils.h" #include "../Events/TouchMessenger.h" #include "../Tracking/ContourFinder.h" #include "../Tracking/Tracking.h" //#include "ofxMultiplexer.h" class Calibration : public TouchListener { public: Calibration(); //Basic Methods void setup(unsigned int stitchedFrameWidth,unsigned int stitchedFrameHeight,unsigned int cameraGridWidth,unsigned int cameraGridHeight,unsigned int calibrationGridWidth,unsigned int calibrationGridHeight,unsigned int* cameraWidth,unsigned int* cameraHeight,bool isInterleaveMode); void SetTracker(BlobTracker *trackerIn); //Key Events void _keyPressed(ofKeyEventArgs &e); void _keyReleased(ofKeyEventArgs &e); //Touch Events void RAWTouchDown( Blob b ); void RAWTouchMoved( Blob b ); void RAWTouchUp( Blob b ); void RAWTouchHeld( Blob b); //other void doCalibration(); void passInContourFinder(int numBlobs, vector<Blob> blobs); void passInTracker(BlobTracker *trackerIn); bool calibrating; static Calibration* getInstance(); CalibrationUtils calibrate; private: void drawFingerOutlines(); void drawCalibrationBlobs(); void drawCalibrationPointsAndBox(); void saveConfiguration(); void DrawCircleLoader(double xctr, double yctr, double radius, double startAngle, double endAngle); bool bW; bool bS; bool bA; bool bD; bool bShowTargets; int camWidth; int camHeight; float arcAngle; float targetColor; //Fonts ofTrueTypeFont verdana; ofTrueTypeFont calibrationText; //Draw Particle Image ofImage calibrationParticle; //Blob Tracker BlobTracker* tracker; ContourFinder contourFinder; }; #endif
[ "[email protected]@da66ed7f-4d6a-8cb4-a557-1474cfe16edc" ]
[ [ [ 1, 69 ] ] ]
4d8fd3bfb37f0dc5c7c1a31018497985743d4a71
cb6bc528c9f07375cdd93de4eab1ae963bd9d4ac
/Xedithor/ui_editwindow.h
d9a78f1f9dd1fa6fa7c7b20c991328151eab7efb
[]
no_license
xedixermawan/xedithor
9a867b975e6bea5a42a3bc2a9196e82ff9bbb14c
73ea074c2c06a9ea4f1e6305a58dcb7b54b04a4b
refs/heads/master
2016-09-06T14:26:44.552920
2011-12-14T06:18:57
2011-12-14T06:18:57
2,930,606
0
0
null
null
null
null
UTF-8
C++
false
false
3,869
h
/******************************************************************************** ** Form generated from reading UI file 'editwindow.ui' ** ** Created: Mon Dec 12 22:52:30 2011 ** by: Qt User Interface Compiler version 4.7.4 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_EDITWINDOW_H #define UI_EDITWINDOW_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QDockWidget> #include <QtGui/QHBoxLayout> #include <QtGui/QHeaderView> #include <QtGui/QMainWindow> #include <QtGui/QMenuBar> #include <QtGui/QStatusBar> #include <QtGui/QVBoxLayout> #include <QtGui/QWidget> QT_BEGIN_NAMESPACE class Ui_EditWindow { public: QWidget *centralwidget; QHBoxLayout *horizontalLayout; QVBoxLayout *verticalLayout; QMenuBar *menubar; QStatusBar *statusbar; QDockWidget *dockWidget; QWidget *dockWidgetContents; QHBoxLayout *horizontalLayout_3; QHBoxLayout *horizontalLayout_2; void setupUi(QMainWindow *EditWindow) { if (EditWindow->objectName().isEmpty()) EditWindow->setObjectName(QString::fromUtf8("EditWindow")); EditWindow->resize(800, 600); EditWindow->setStyleSheet(QString::fromUtf8("background-color: rgb(172, 172, 172);")); centralwidget = new QWidget(EditWindow); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); horizontalLayout = new QHBoxLayout(centralwidget); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); verticalLayout = new QVBoxLayout(); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); horizontalLayout->addLayout(verticalLayout); EditWindow->setCentralWidget(centralwidget); menubar = new QMenuBar(EditWindow); menubar->setObjectName(QString::fromUtf8("menubar")); menubar->setGeometry(QRect(0, 0, 800, 18)); EditWindow->setMenuBar(menubar); statusbar = new QStatusBar(EditWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); EditWindow->setStatusBar(statusbar); dockWidget = new QDockWidget(EditWindow); dockWidget->setObjectName(QString::fromUtf8("dockWidget")); dockWidget->setMinimumSize(QSize(180, 121)); dockWidget->setStyleSheet(QString::fromUtf8("")); dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidgetContents = new QWidget(); dockWidgetContents->setObjectName(QString::fromUtf8("dockWidgetContents")); horizontalLayout_3 = new QHBoxLayout(dockWidgetContents); horizontalLayout_3->setSpacing(0); horizontalLayout_3->setContentsMargins(0, 0, 0, 0); horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); horizontalLayout_2->setContentsMargins(-1, 0, -1, -1); horizontalLayout_3->addLayout(horizontalLayout_2); dockWidget->setWidget(dockWidgetContents); EditWindow->addDockWidget(static_cast<Qt::DockWidgetArea>(1), dockWidget); retranslateUi(EditWindow); QMetaObject::connectSlotsByName(EditWindow); } // setupUi void retranslateUi(QMainWindow *EditWindow) { EditWindow->setWindowTitle(QApplication::translate("EditWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; namespace Ui { class EditWindow: public Ui_EditWindow {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_EDITWINDOW_H
[ [ [ 1, 102 ] ] ]
abca368154268fbc5729885be6e10303982acea9
55196303f36aa20da255031a8f115b6af83e7d11
/private/external/gameswf/gameswf/gameswf_character.cpp
bfe8838031e03f0f8ee07452e914e5153a4e8609
[]
no_license
Heartbroken/bikini
3f5447647d39587ffe15a7ae5badab3300d2a2ff
fe74f51a3a5d281c671d303632ff38be84d23dd7
refs/heads/master
2021-01-10T19:48:40.851837
2010-05-25T19:58:52
2010-05-25T19:58:52
37,190,932
0
0
null
null
null
null
UTF-8
C++
false
false
9,768
cpp
// gameswf_character.cpp -- Thatcher Ulrich <[email protected]> 2003 // This source code has been donated to the Public Domain. Do // whatever you want with it. // Some implementation code for the gameswf SWF player library. #include "gameswf/gameswf_character.h" #include "gameswf/gameswf_render.h" namespace gameswf { character::character(player* player, character* parent, int id) : as_object(player), m_id(id), m_parent(parent), m_depth(0), m_ratio(0.0f), m_clip_depth(0), m_visible(true), m_display_callback(NULL), m_display_callback_user_ptr(NULL) { // loadMovieClip() requires that the following will be commented out // assert((parent == NULL && m_id == -1) || (parent != NULL && m_id >= 0)); } bool character::get_member(const tu_stringi& name, as_value* val) // Set *val to the value of the named member and // return true, if we have the named member. // Otherwise leave *val alone and return false. { // first try character members as_standard_member std_member = get_standard_member(name); switch (std_member) { default: break; case M_GLOBAL: val->set_as_object(get_global()); return true; case M_ROOT: case M_LEVEL0: val->set_as_object(get_root_movie()); return true; case M_THIS: case MDOT: val->set_as_object(this); return true; case M_X: { const matrix& m = get_matrix(); val->set_double(TWIPS_TO_PIXELS(m.m_[0][2])); return true; } case M_Y: { const matrix& m = get_matrix(); val->set_double(TWIPS_TO_PIXELS(m.m_[1][2])); return true; } case M_XSCALE: { const matrix& m = get_matrix(); // @@ or get_world_matrix()? Test this. float xscale = m.get_x_scale(); val->set_double(xscale * 100); // result in percent return true; } case M_YSCALE: { const matrix& m = get_matrix(); // @@ or get_world_matrix()? Test this. float yscale = m.get_y_scale(); val->set_double(yscale * 100); // result in percent return true; } case M_ALPHA: { // Alpha units are in percent. val->set_double(get_cxform().m_[3][0] * 100.f); return true; } case M_VISIBLE: { val->set_bool(get_visible()); return true; } case M_WIDTH: { val->set_double((int) TWIPS_TO_PIXELS(get_width())); return true; } case M_HEIGHT: { val->set_double((int) TWIPS_TO_PIXELS(get_height())); return true; } case M_ROTATION: { // Verified against Macromedia player using samples/test_rotation.swf float angle = get_matrix().get_rotation(); // Result is CLOCKWISE DEGREES, [-180,180] angle *= 180.0f / float(M_PI); val->set_double(angle); return true; } case M_TARGET: { // Full path to this object; e.g. "/_level0/sprite1/sprite2/ourSprite" character* parent = get_parent(); if (parent == NULL) // root { val->set_tu_string("/"); return true; } as_value target; parent->get_member("_target", &target); // if s != "/"(root) add "/" tu_string s = target.to_tu_string(); s += s == "/" ? "" : "/"; // add own name if (get_name().length() == 0) { s += "noname"; } else { s += get_name(); } val->set_tu_string(s); return true; } case M_NAME: { val->set_tu_string(get_name()); return true; } case M_DROPTARGET: { // Absolute path in slash syntax where we were last dropped (?) // @@ TODO val->set_string("/_root"); return true; } case M_URL: { // our URL. val->set_string("gameswf"); return true; } case M_HIGHQUALITY: { // Whether we're in high quality mode or not. val->set_bool(true); return true; } case M_FOCUSRECT: { // Is a yellow rectangle visible around a focused movie clip (?) val->set_bool(false); return true; } case M_SOUNDBUFTIME: { // Number of seconds before sound starts to stream. val->set_double(0.0); return true; } case M_XMOUSE: { // Local coord of mouse IN PIXELS. int x, y, buttons; get_mouse_state(&x, &y, &buttons); matrix m = get_world_matrix(); point a(PIXELS_TO_TWIPS(x), PIXELS_TO_TWIPS(y)); point b; m.transform_by_inverse(&b, a); val->set_double(TWIPS_TO_PIXELS(b.m_x)); return true; } case M_YMOUSE: { // Local coord of mouse IN PIXELS. int x, y, buttons; get_mouse_state(&x, &y, &buttons); matrix m = get_world_matrix(); point a(PIXELS_TO_TWIPS(x), PIXELS_TO_TWIPS(y)); point b; m.transform_by_inverse(&b, a); val->set_double(TWIPS_TO_PIXELS(b.m_y)); return true; } case M_PARENT: case MDOT2: { val->set_as_object(cast_to<as_object>(m_parent.get_ptr())); return true; } } // end switch return as_object::get_member(name, val); } bool character::set_member(const tu_stringi& name, const as_value& val) { // first try character members as_standard_member std_member = get_standard_member(name); switch (std_member) { default: break; case M_X: { matrix m = get_matrix(); m.m_[0][2] = (float) PIXELS_TO_TWIPS(val.to_number()); set_matrix(m); return true; } case M_Y: { matrix m = get_matrix(); m.m_[1][2] = (float) PIXELS_TO_TWIPS(val.to_number()); set_matrix(m); return true; } case M_XSCALE: { matrix m = get_matrix(); // Decompose matrix and insert the desired value. float x_scale = val.to_float() / 100.f; // input is in percent float y_scale = m.get_y_scale(); float rotation = m.get_rotation(); m.set_scale_rotation(x_scale, y_scale, rotation); set_matrix(m); return true; } case M_YSCALE: { matrix m = get_matrix(); // Decompose matrix and insert the desired value. float x_scale = m.get_x_scale(); float y_scale = val.to_float() / 100.f; // input is in percent float rotation = m.get_rotation(); m.set_scale_rotation(x_scale, y_scale, rotation); set_matrix(m); return true; } case M_ALPHA: { // Set alpha modulate, in percent. cxform cx = get_cxform(); cx.m_[3][0] = val.to_float() / 100.f; set_cxform(cx); return true; } case M_VISIBLE: { set_visible(val.to_bool()); return true; } case M_WIDTH: { if (val.to_float() > 0) { matrix m = get_matrix(); // Decompose matrix and insert the desired value. float x_scale = m.get_x_scale(); float y_scale = m.get_y_scale(); float rotation = m.get_rotation(); // get current width float current_width = TWIPS_TO_PIXELS(get_width()); // set new scale x_scale /= current_width / val.to_float(); m.set_scale_rotation(x_scale, y_scale, rotation); set_matrix(m); } return true; } case M_HEIGHT: { if (val.to_float() > 0) { matrix m = get_matrix(); // Decompose matrix and insert the desired value. float x_scale = m.get_x_scale(); float y_scale = m.get_y_scale(); float rotation = m.get_rotation(); // get current height float current_height = TWIPS_TO_PIXELS(get_height()); // set new scale y_scale /= current_height / val.to_float(); m.set_scale_rotation(x_scale, y_scale, rotation); set_matrix(m); } return true; } case M_ROTATION: { matrix m = get_matrix(); // Decompose matrix and insert the desired value. float x_scale = m.get_x_scale(); float y_scale = m.get_y_scale(); float rotation = val.to_float() * float(M_PI) / 180.f; // input is in degrees m.set_scale_rotation(x_scale, y_scale, rotation); set_matrix(m); return true; } case M_NAME: { set_name(val.to_tu_string()); return true; } case M_HIGHQUALITY: { // @@ global { 0, 1, 2 } // // Whether we're in high quality mode or not. // val->set(true); return true; } case M_FOCUSRECT: { // // Is a yellow rectangle visible around a focused movie clip (?) // val->set(false); return true; } case M_SOUNDBUFTIME: { // @@ global // // Number of seconds before sound starts to stream. // val->set(0.0); return true; } } // end switch return as_object::set_member(name, val); } float character::get_width() { rect bound; get_bound(&bound); float w = bound.m_x_max - bound.m_x_min; return w >= FLT_MIN ? w : 0; } float character::get_height() { rect bound; get_bound(&bound); float h = bound.m_y_max - bound.m_y_min; return h >= FLT_MIN ? h : 0; } void character::get_bound(rect* bound) { character_def* def = get_character_def(); assert(def); def->get_bound(bound); get_matrix().transform(bound); } bool character::is_visible() { // The increase of performance that gives the skipping of invisible characters // less than expenses for performance of test of visibility // get_bound() & get_world_matrix() are heavy recursive operations return true; rect bound; get_bound(&bound); matrix m; m.set_inverse(get_matrix()); m.transform(&bound); m = get_world_matrix(); m.transform(&bound); return render::is_visible(bound); } void character::enumerate(as_environment* env) { as_object::enumerate(env); } }
[ "viktor.reutskyy@68c2588f-494f-0410-aecb-65da31d84587" ]
[ [ [ 1, 421 ] ] ]
e05c6efc12972131abeb51c500150eef21fad7a8
672d939ad74ccb32afe7ec11b6b99a89c64a6020
/TLM/branches/tlm_3d/tlm/tlm.cpp
3cc17519a1fd1064bb718e2cd481e9a901484e34
[]
no_license
cloudlander/legacy
a073013c69e399744de09d649aaac012e17da325
89acf51531165a29b35e36f360220eeca3b0c1f6
refs/heads/master
2022-04-22T14:55:37.354762
2009-04-11T13:51:56
2009-04-11T13:51:56
256,939,313
1
0
null
null
null
null
UTF-8
C++
false
false
3,662
cpp
// tlm.cpp : Defines the entry point for the console application. // #include "stdafx.h" #ifdef PARALLEL_OMP #include <omp.h> #endif #define DIMENSION 5 #define MAX_VALUE 250 #define MAX_CUBE MAX_VALUE*MAX_VALUE*MAX_VALUE #define MAX_LINE 255 #define long double DOUBLE DOUBLE SB[DIMENSION+1][DIMENSION+1]; DOUBLE RVB[DIMENSION+1][MAX_CUBE]; DOUBLE IVB[DIMENSION+1][MAX_CUBE]; void SBL(DOUBLE Y,DOUBLE G) { int i,j; for(i=1;i<=DIMENSION;i++) for(j=1;j<=DIMENSION;j++) { if(DIMENSION==j) SB[i][j]=Y; else SB[i][j]=1; SB[i][j]=SB[i][j]*2/(4+Y+G); if(i==j) SB[i][j]=SB[i][j]-1; } } DOUBLE EJ(DOUBLE Y,DOUBLE G,UINT32 I,UINT32 J,UINT32 K,UINT32 L) { DOUBLE E=0.0; for(int i=1;i<=4;i++) E+=IVB[i][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; E+=Y*IVB[DIMENSION][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; E=E*2/(L*(4+Y+G)); return E; } int main(int argc, char* argv[]) { INT32 SX,SY,SZ,ENDX,ENDY,ENDZ,X,Y,Z,T,NT,BL; INT32 I,J,K,M,N; DOUBLE H,ER,UR,SGM; UINT32 U,V,W; DOUBLE EY; char line[MAX_LINE]=""; FILE* input=fopen("twotlme.in","r"); fscanf(input,"%d %d %d %d %d %d %d %d %d %d %d %d %lf %lf %lf %lf %d %d",&SX,&SY,&SZ,&ENDX,&ENDY,&ENDZ,&X,&Y,&Z,&U,&V,&W,&H,&ER,&UR,&SGM,&NT,&BL); fclose(input); DOUBLE U0=12566.3706144; DOUBLE E0=8.854187818E-2; DOUBLE Z0=sqrt(U0/E0); DOUBLE YY=2*(U*W*sqrt(H)*ER/V-2); DOUBLE GY=SGM*U*W*Z0/V; J=1; for(I=SX;I<=ENDX;I++) for(K=SZ;K<=ENDZ;K++) for(T=1;T<=DIMENSION;T++) IVB[T][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=0; I=1; IVB[I][X*MAX_VALUE*MAX_VALUE+Y*MAX_VALUE+Z]=1; SBL(YY,GY); #ifdef PARALLEL_OMP omp_set_num_threads(2); #endif for(T=1;T<=NT;T++) { #pragma omp parallel for private(I) for(I=SX;I<=ENDX;I++) { for(K=SZ;K<=ENDZ;K++) { for(M=1;M<=DIMENSION;M++) { RVB[M][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=0; for(N=1;N<=DIMENSION;N++) RVB[M][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=IVB[N][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]*SB[M][N]+RVB[M][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; } } } for(I=SX;I<=ENDX;I++) { for(K=SZ;K<=ENDZ;K++) { IVB[1][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=RVB[3][(I-1)*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; IVB[2][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=RVB[4][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K-1]; IVB[3][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=RVB[1][(I+1)*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; IVB[4][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=RVB[2][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K+1]; IVB[5][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=RVB[5][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; if(1==BL) { if(K==SZ) IVB[2][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=-RVB[2][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; if(K==ENDZ) IVB[4][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=-RVB[4][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; if(I==SX) IVB[1][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=-RVB[1][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; if(I==ENDX) IVB[3][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=-RVB[3][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]; } else if(0==BL) { if(K==SZ) IVB[2][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=0; if(K==ENDZ) IVB[4][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=0; if(I==SX) IVB[1][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=0; if(I==ENDX) IVB[3][I*MAX_VALUE*MAX_VALUE+J*MAX_VALUE+K]=0; } } } if(0==T%10) { fprintf(stderr,"%d\n",T); } EY=EJ(YY,GY,X,Y,Z,V); printf(" % #.8f\n",EY); } return 0; }
[ "xmzhang@5428276e-be0b-f542-9301-ee418ed919ad" ]
[ [ [ 1, 147 ] ] ]
d79d7b08f129cc8b179a8316af4054c1c7d50723
2c1e5a69ca68fe185cc04c5904aa104b0ba42e32
/src/common/ResourceManager.cpp
796fee975af0bcf3449b275909735a9e1b1207e5
[]
no_license
dogtwelve/newsiderpg
e3f8284a7cd9938156ef8d683dca7bcbd928c593
303566a034dca3e66cf0f29cf9eaea1d54d63e4a
refs/heads/master
2021-01-10T13:03:31.986204
2010-06-27T05:36:33
2010-06-27T05:36:33
46,550,247
0
1
null
null
null
null
UTF-8
C++
false
false
1,509
cpp
// Copyright (C) 2005 GameWG. All rights reserved. // GAMELOFT PROPRIETARY/CONFIDENTIAL. // // Author: Qiu Wei Min #include "resourcemanager.h" #include "Memory.h" CResourceManager::CResourceManager() { MEMSET(m_files, 0, sizeof(m_files)); } CResourceManager::~CResourceManager() { #if DEBUG_LEVEL > 0 //make sure all files are removed for(int i = 0; i < MAX_RESOURCE_FILE; i++) ASSERT(m_files[i] == NULL); #endif } void CResourceManager::AddResFile(CResFile *file) { int i; for(i = 0; i < MAX_RESOURCE_FILE; i++) { if(m_files[i] == file) { ASSERT(false); return; } if(m_files[i] == NULL) { m_files[i] = file; return; } } //too much resource files have been added ASSERT(false); } void CResourceManager::RemoveResFile(CResFile *file) { int i; for(i = 0; i < MAX_RESOURCE_FILE; i++) { if(m_files[i] == file) { m_files[i] = NULL; return; } } } CStream* CResourceManager::GetResourceAsStream(const char *name, MemoryType memType) { void* hRecord; CResFile *file; for(int i = 0; i < MAX_RESOURCE_FILE; i++) { file = m_files[i]; hRecord = file->FindRecord(name); if(hRecord) break; } if(!hRecord) { //record does not exist ASSERT(false); return NULL; } unsigned int len = file->GetRecordSize(hRecord); CMemoryStream *stream = (GL_NEW/*(memType)*/ CMemoryStream(len, memType)); file->ReadRecord(hRecord, stream->GetBuffer(), len); return stream; }
[ [ [ 1, 80 ] ] ]
0f0c1d8f6a20fec8c13177f6c722afccb6cc35d4
fd4f996b64c1994c5e6d8c8ff78a2549255aacb7
/ nicolinorochetaller --username adrianachelotti/trunk/tp2/Graficador/Rectangulo.cpp
4e3f3aaeed7ab4dd95069ad991c75bbcf1c402d5
[]
no_license
adrianachelotti/nicolinorochetaller
026f32476e41cdc5ac5c621c483d70af7b397fb0
d3215dfdfa70b6226b3616c78121f36606135a5f
refs/heads/master
2021-01-10T19:45:15.378823
2009-08-05T14:54:42
2009-08-05T14:54:42
32,193,619
0
0
null
null
null
null
UTF-8
C++
false
false
4,561
cpp
// Rectangulo.cpp: implementation of the Rectangulo class. // ////////////////////////////////////////////////////////////////////// #include "Rectangulo.h" #include "Graficador.h" #include "Escenario.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// Rectangulo::Rectangulo() { } Rectangulo::Rectangulo(string identificador, int base, int altura,Punto posicionVertice):Figura(identificador) { this->base = base; this->altura = altura; this->posicionVerticeInferiorIzquierdo = posicionVertice; } Rectangulo::~Rectangulo() { } void Rectangulo::setBase(int base) { this->base = base; } int Rectangulo::getBase() { return this->base; } void Rectangulo::setAltura(int altura) { this->altura = altura; } int Rectangulo::getAltura() { return this->altura; } void Rectangulo::setPosicionVerticeInferiorIzquierdo(Punto vertice) { this->posicionVerticeInferiorIzquierdo = vertice; } Punto Rectangulo::getPosicionVerticeInferiorIzquierdo() { return this->posicionVerticeInferiorIzquierdo; } int Rectangulo::dibujar() { Graficador* graficador = Graficador::obtenerInstancia(); SDL_Surface* imagen = NULL; Textura* text = NULL; bool contieneTextura = false; Escenario* escenario = Escenario::obtenerInstancia(); this->establecerColores(); if(!this->getIdTextura().empty()) { text = escenario->getTextura(this->getIdTextura()); if(text==NULL) { string mensajeError = GRAF_WARN1; mensajeError+= this->getIdTextura(); mensajeError+= " - "; string contextoError = MSG_CTX_FIGURA; contextoError+= this->getId(); escenario->imprimirError(contextoError,escenario->getArchivoErrores(),mensajeError); } else contieneTextura = true; } if(contieneTextura) { imagen = SDL_LoadBMP(text->getPath().c_str()); if(imagen == NULL) { string mensajeError = GRAF_WARN2; mensajeError+= this->getIdTextura(); mensajeError+= " - "; string contextoError = MSG_CTX_FIGURA; contextoError+= this->getId(); escenario->imprimirError(contextoError,escenario->getArchivoErrores(),mensajeError); //Se intenta cargar la textura del escenario if((!Escenario::getTexturaFigura().empty()) && (!this->esColorPropio())&&(Escenario::getTexturaFigura().compare(this->getIdTextura())!=0)) { text = escenario->getTextura(Escenario::getTexturaFigura()); if(text==NULL) { string contextoError = MSG_CTX_FIGURA; contextoError+= this->getId(); string mensajeError = GRAF_WARN1; mensajeError+= Escenario::getTexturaFigura(); mensajeError+= " - "; escenario->imprimirError(contextoError,escenario->getArchivoErrores(),mensajeError); } else { imagen = SDL_LoadBMP(text->getPath().c_str()); if(imagen==NULL) { string contextoError = MSG_CTX_FIGURA; contextoError+= this->getId(); string mensajeError = GRAF_WARN2; mensajeError+= Escenario::getTexturaFigura(); mensajeError+= " - "; escenario->imprimirError(contextoError,escenario->getArchivoErrores(),mensajeError); } } } } } if(imagen==NULL) { if((this->getColorFondo()!=COLOR_VACIO)) { graficador->rellenarRectangulo(Escenario::screen,this->getPosicionVerticeInferiorIzquierdo(),this->base,this->altura,this->getColorFondo()); if(this->getColorLinea()!=COLOR_VACIO) { graficador->dibujarRectangulo(Escenario::screen,this->getPosicionVerticeInferiorIzquierdo(),this->base,this->altura,this->getColorLinea()); } } else { //TODO: cuando no le paso nada graficador->dibujarRectangulo(Escenario::screen,this->getPosicionVerticeInferiorIzquierdo(),this->base,this->altura,this->getColorLinea()); } if(contieneTextura) return RES_ERROR_CARGANDO_TEXTURA; return RES_OK; }else { //dibujar Textura SDL_Surface* imagenResized = graficador->getImageResized(text,this->base, this->altura); graficador->rellenarRectanguloConTextura(Escenario::screen,imagenResized ,this->getPosicionVerticeInferiorIzquierdo()); if(this->getColorLinea()!=COLOR_VACIO) { graficador->dibujarRectangulo(Escenario::screen,this->getPosicionVerticeInferiorIzquierdo(),this->base,this->altura,this->getColorLinea()); } } return RES_OK; }
[ "dmpstaltari@0b808588-0f27-11de-aab3-ff745001d230", "[email protected]@0b808588-0f27-11de-aab3-ff745001d230" ]
[ [ [ 1, 5 ], [ 8, 65 ], [ 73, 83 ], [ 85, 91 ], [ 96, 140 ], [ 144, 144 ], [ 169, 169 ], [ 180, 180 ], [ 184, 186 ] ], [ [ 6, 7 ], [ 66, 72 ], [ 84, 84 ], [ 92, 95 ], [ 141, 143 ], [ 145, 168 ], [ 170, 179 ], [ 181, 183 ], [ 187, 188 ] ] ]
eeefaec5b33bbcb65a87049d43e8ab94fcd31b47
c3ae23286c2e8268355241f8f06cd1309922a8d6
/rateracerlib/Camera.h
60f2a442a855bd4a29da6c4cc4a1462c87c212cf
[]
no_license
BackupTheBerlios/rateracer-svn
2f43f020ecdd8a3528880d474bec1c0464879597
838ad3f326962028ce8d493d2c06f6af6ea4664c
refs/heads/master
2020-06-04T03:31:51.633612
2005-05-30T06:38:01
2005-05-30T06:38:01
40,800,078
0
0
null
null
null
null
UTF-8
C++
false
false
328
h
#pragma once #include <windows.h> #include <GL/gl.h> #include <GL/glu.h> #include "mathlib.h" class Camera { public: /* Camera( Vec3 Position = Vec3(0,0,0), Vec3 Color = Vec3(0.5f,0.5f,0.5f) ) { position = Position; color = Color; } virtual ~Camera() {} */ Vec3 position; Vec3 color; };
[ "gweronimo@afd64b18-8dda-0310-837d-b02fe5df315d" ]
[ [ [ 1, 24 ] ] ]
bc0cb53e1b1c1e2606cfc542b7680310b72ebe24
2fdbf2ba994ba3ed64f0e2dc75cd2dfce4936583
/spectre/editlistincludesdialog.cpp
570347c7f11e3110dc088cdd925b4b5cfcd92e97
[]
no_license
TERRANZ/terragraph
36219a4e512e15a925769512a6b60637d39830bf
ea8c36070f532ad0a4af08e46b19f4ee1b85f279
refs/heads/master
2020-05-25T10:31:26.994233
2011-01-29T21:23:04
2011-01-29T21:23:04
1,047,237
0
0
null
null
null
null
UTF-8
C++
false
false
659
cpp
#include "editlistvaluesdialog.h" #include "ui_editlistvaluesdialog.h" EditListValuesDialog::EditListValuesDialog(QWidget *parent) : QDialog(parent), ui(new Ui::EditListValuesDialog) { ui->setupUi(this); m_Model = new BaseWithParamListModel(this); ui->tableView->setModel(m_Model); connect(ui->create, SIGNAL(clicked()), this, SLOT(create())); } EditListValuesDialog::~EditListValuesDialog() { delete ui; } void EditListValuesDialog::setData(BaseWithParamList value) { m_Model->setData(value); } void EditListValuesDialog::create() { m_Model->addParam(ui->id->text(), ui->value->text()); }
[ [ [ 1, 28 ] ] ]
905d26ad444ccc009775ced64dbf63880cdcbf64
216398e30aca5f7874edfb8b72a13f95c22fbb5a
/AITerm/src/ProgramUI/stdafx.h
2fff7b1932ca2689cea3a6192aa7af67de0146cc
[]
no_license
markisme/healthcare
791813ac6ac811870f3f28d1d31c3d5a07fb2fa2
7ab5a959deba02e7637da02a3f3c681548871520
refs/heads/master
2021-01-10T07:18:42.195610
2009-09-09T13:00:10
2009-09-09T13:00:10
35,987,767
0
0
null
null
null
null
UHC
C++
false
false
3,327
h
// stdafx.h : 자주 사용하지만 자주 변경되지는 않는 // 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이 // 들어 있는 포함 파일입니다. #pragma once #ifndef _SECURE_ATL #define _SECURE_ATL 1 #endif #ifndef VC_EXTRALEAN #define VC_EXTRALEAN // 거의 사용되지 않는 내용은 Windows 헤더에서 제외합니다. #endif // 아래 지정된 플랫폼에 우선하는 플랫폼을 대상으로 하는 경우 다음 정의를 수정하십시오. // 다른 플랫폼에 사용되는 해당 값의 최신 정보는 MSDN을 참조하십시오. #ifndef WINVER // Windows XP 이상에서만 기능을 사용할 수 있습니다. #define WINVER 0x0501 // 다른 버전의 Windows에 맞도록 적합한 값으로 변경해 주십시오. #endif #ifndef _WIN32_WINNT // Windows XP 이상에서만 기능을 사용할 수 있습니다. #define _WIN32_WINNT 0x0501 // 다른 버전의 Windows에 맞도록 적합한 값으로 변경해 주십시오. #endif #ifndef _WIN32_WINDOWS // Windows 98 이상에서만 기능을 사용할 수 있습니다. #define _WIN32_WINDOWS 0x0410 // Windows Me 이상에 맞도록 적합한 값으로 변경해 주십시오. #endif #ifndef _WIN32_IE // IE 6.0 이상에서만 기능을 사용할 수 있습니다. #define _WIN32_IE 0x0600 // 다른 버전의 IE에 맞도록 적합한 값으로 변경해 주십시오. #endif #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 일부 CString 생성자는 명시적으로 선언됩니다. // MFC의 공통 부분과 무시 가능한 경고 메시지에 대한 숨기기를 해제합니다. #define _AFX_ALL_WARNINGS #include <afxwin.h> // MFC 핵심 및 표준 구성 요소입니다. #include <afxext.h> // MFC 확장입니다. #include <stdio.h> #include <tchar.h> #include <memory.h> #include <string.h> #include <string> #include <vector> #include "DBConnector.h" #include "SimpleMinipar.h" #include "wn.h" #include "XMLLib.h" #pragma comment(linker, "/entry:WinMainCRTStartup /subsystem:console" ) #ifndef _AFX_NO_OLE_SUPPORT #include <afxdtctl.h> // Internet Explorer 4 공용 컨트롤에 대한 MFC 지원입니다. #endif #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // Windows 공용 컨트롤에 대한 MFC 지원입니다. #endif // _AFX_NO_AFXCMN_SUPPORT #ifdef _UNICODE #if defined _M_IX86 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_IA64 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_X64 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") #else #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #endif #endif
[ "naidzzang@cc586c1e-b153-0410-8069-cfc9d6f95ec9" ]
[ [ [ 1, 77 ] ] ]
20e4e2016d0a4bc22031736b07c9fb3edf7a12be
8cf9b251e0f4a23a6ef979c33ee96ff4bdb829ab
/src-ginga-editing/gingancl-cpp/src/gingancl/model/link/LinkAction.cpp
8cfb687fc5d35717a5bc9ae9bedeaf768ca407e1
[]
no_license
BrunoSSts/ginga-wac
7436a9815427a74032c9d58028394ccaac45cbf9
ea4c5ab349b971bd7f4f2b0940f2f595e6475d6c
refs/heads/master
2020-05-20T22:21:33.645904
2011-10-17T12:34:32
2011-10-17T12:34:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,180
cpp
/****************************************************************************** Este arquivo eh parte da implementacao do ambiente declarativo do middleware Ginga (Ginga-NCL). Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob os termos da Licen�a Publica Geral GNU versao 2 conforme publicada pela Free Software Foundation. Este programa eh distribu�do na expectativa de que seja util, porem, SEM NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do GNU versao 2 para mais detalhes. Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto com este programa; se nao, escreva para a Free Software Foundation, Inc., no endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. Para maiores informacoes: ncl @ telemidia.puc-rio.br http://www.ncl.org.br http://www.ginga.org.br http://www.telemidia.puc-rio.br ****************************************************************************** This file is part of the declarative environment of middleware Ginga (Ginga-NCL) Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details. You should have received a copy of the GNU General Public License version 2 along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA For further information contact: ncl @ telemidia.puc-rio.br http://www.ncl.org.br http://www.ginga.org.br http://www.telemidia.puc-rio.br *******************************************************************************/ #include "../../../include/LinkAction.h" namespace br { namespace pucrio { namespace telemidia { namespace ginga { namespace ncl { namespace model { namespace link { LinkAction::LinkAction() : Thread::Thread() { this->delay = 0; progressionListeners = new vector<LinkActionProgressionListener*>; typeSet.insert("LinkAction"); } LinkAction::LinkAction(double delay) : Thread::Thread() { this->delay = delay; progressionListeners = new vector<LinkActionProgressionListener*>; typeSet.insert("LinkAction"); } LinkAction::~LinkAction() { wclog << "LinkAction::~LinkAction" << endl; if (progressionListeners != NULL) { delete progressionListeners; progressionListeners = NULL; } } bool LinkAction::instanceOf(string s) { if(typeSet.empty()) return false; else return (typeSet.find(s) != typeSet.end()); } double LinkAction::getWaitDelay() { return this->delay; } void LinkAction::run() { if (hasDelay()) { ::usleep((long)(delay*1000)); } } void LinkAction::setWaitDelay(double delay) { this->delay = delay; } bool LinkAction::hasDelay() { if (this->delay > 0) { return true; } return false; } void LinkAction::addActionProgressionListener( LinkActionProgressionListener* listener) { progressionListeners->push_back(listener); } void LinkAction::removeActionProgressionListener( LinkActionProgressionListener* listener) { vector<LinkActionProgressionListener*>::iterator i; for (i = progressionListeners->begin(); i != progressionListeners->end(); ++i) { if (*i == listener) { progressionListeners->erase(i); break; } } } void LinkAction::notifyProgressionListeners(bool start) { int i, size; LinkActionProgressionListener* listener; size = progressionListeners->size(); for (i = 0; i < size; i++) { listener = (*progressionListeners)[i]; listener->actionProcessed(start); } } } } } } } } }
[ [ [ 1, 144 ] ] ]
17c6bded9951e48d7801d9b419dc59102cab02bd
fc4946d917dc2ea50798a03981b0274e403eb9b7
/gentleman/gentleman/WindowsAPICodePack/WindowsAPICodePack/DirectX/DirectX/Direct3D10/D3D10Debug.cpp
b6979b18441d278366ac5c22c7ca4145c226a7b8
[]
no_license
midnite8177/phever
f9a55a545322c9aff0c7d0c45be3d3ddd6088c97
45529e80ebf707e7299887165821ca360aa1907d
refs/heads/master
2020-05-16T21:59:24.201346
2010-07-12T23:51:53
2010-07-12T23:51:53
34,965,829
3
2
null
null
null
null
UTF-8
C++
false
false
1,459
cpp
// Copyright (c) Microsoft Corporation. All rights reserved. #include "stdafx.h" #include "D3D10Debug.h" #include "DXGI/DXGISwapChain.h" using namespace Microsoft::WindowsAPICodePack::DirectX::Direct3D10; using namespace Microsoft::WindowsAPICodePack::DirectX::DXGI; DebugFeature D3DDebug::FeatureMask::get() { return static_cast<DebugFeature>(GetInterface<ID3D10Debug>()->GetFeatureMask()); } UInt32 D3DDebug::PresentPerRenderOpDelay::get() { return GetInterface<ID3D10Debug>()->GetPresentPerRenderOpDelay(); } SwapChain^ D3DDebug::RuntimeSwapChain::get() { IDXGISwapChain* tempoutSwapChain = NULL; CommonUtils::VerifyResult(GetInterface<ID3D10Debug>()->GetSwapChain(&tempoutSwapChain)); return tempoutSwapChain == NULL ? nullptr : gcnew SwapChain(tempoutSwapChain); } void D3DDebug::FeatureMask::set(DebugFeature value) { CommonUtils::VerifyResult(GetInterface<ID3D10Debug>()->SetFeatureMask(static_cast<UINT>(value))); } void D3DDebug::PresentPerRenderOpDelay::set(UInt32 value) { CommonUtils::VerifyResult(GetInterface<ID3D10Debug>()->SetPresentPerRenderOpDelay(static_cast<UINT>(value))); } void D3DDebug::RuntimeSwapChain::set(SwapChain^ value) { CommonUtils::VerifyResult(GetInterface<ID3D10Debug>()->SetSwapChain(value->GetInterface<IDXGISwapChain>())); } void D3DDebug::Validate() { CommonUtils::VerifyResult(GetInterface<ID3D10Debug>()->Validate()); }
[ "lucemia@9e708c16-f4dd-11de-aa3c-59de0406b4f5" ]
[ [ [ 1, 46 ] ] ]
325be84f7039de0a1d7d682fb8742aacb4db583d
c495b752e23e5879cddd6714a015aab5c67f09e0
/ProjectSin/DXProject/GOTemplate.h
0b0edf9a505c426ef09e31ebafacb2d8f19d1de7
[]
no_license
zeno60/projectsin
2c0d136995388de014ebaa6d70c0136b6ab43327
a0d80a3da85cfeb683891eec0c9515a664cb4ce0
refs/heads/master
2021-01-02T23:06:37.648101
2008-08-09T07:39:51
2008-08-09T07:39:51
40,305,207
0
0
null
null
null
null
UTF-8
C++
false
false
563
h
#include "GCTemplate.h" #include <list> class GOTemplate { public: typedef std::list<GCTemplate*> gct_list_t;; ~GOTemplate(); void clear(); const std::string& name() const { return mName; } void setName(const std::string& name) { mName = name; } gct_list_t& getTemplates() { return mTemplates; } void addGCTemplate(GCTemplate* gcTemplate); GCTemplate* getGCTemplate(const GOComponent::goc_id_type& id) const; GOTemplate(const std::string& name):mName(name){ } protected: std::string mName; gct_list_t mTemplates; };
[ "zeno60@5ee530d3-e753-0410-9a95-d5c3cf57bbea" ]
[ [ [ 1, 27 ] ] ]
d314fe06d9c69a0f7a9f58c81dfb4cfa064ab63a
fac8de123987842827a68da1b580f1361926ab67
/src/transporter/physics/physicsLandscapeRepository.cpp
2edb64504f800cd556a76a97d8d26609ff79ba92
[]
no_license
blockspacer/transporter-game
23496e1651b3c19f6727712a5652f8e49c45c076
083ae2ee48fcab2c7d8a68670a71be4d09954428
refs/heads/master
2021-05-31T04:06:07.101459
2009-02-19T20:59:59
2009-02-19T20:59:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,608
cpp
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ //#include <Demos/demos.h> //#include <Demos/DemoCommon/Utilities/GameUtils/Landscape/LandscapeRepository.h> #include "transporter/physics/physicsLandscapeRepository.h" // We will need these shapes #include <Physics/Collide/Shape/Compound/Tree/Mopp/hkpMoppBvTreeShape.h> #include <Physics/Collide/Shape/Compound/Collection/ExtendedMeshShape/hkpExtendedMeshShape.h> #include <Physics/Collide/Shape/Compound/Tree/Mopp/hkpMoppUtility.h> #include <Common/Serialize/Packfile/hkPackfileData.h> #include <Common/Serialize/Packfile/Binary/hkBinaryPackfileWriter.h> #include <Common/Serialize/Packfile/Binary/hkBinaryPackfileReader.h> #include <Common/Serialize/Util/hkRootLevelContainer.h> #include <Physics/Utilities/Serialize/hkpHavokSnapshot.h> #include <Common/Base/System/Io/IStream/hkIStream.h> LandscapeContainer::LandscapeContainer() { m_cameraFrom.set(-10, 2, -10); m_cameraTo.set(0,0,0); m_shape = HK_NULL; m_packfileData = HK_NULL; } LandscapeContainer::~LandscapeContainer() { HK_ASSERT(0, m_shape != HK_NULL); if (m_shape) { m_shape->removeReference(); } if ( m_packfileData ) { m_packfileData->removeReference(); } } LandscapeRepository::LandscapeRepository() { m_currentLandscape = 0; LandscapeEntryRegister* e = s_landscapeList; while(e) { LandscapeEntry newEntry; newEntry.m_createFunc = e->m_createFunc; newEntry.m_name = e->m_name ; newEntry.m_param = e->m_param; m_landscapeEntries.pushBack( newEntry ); e = e->m_next; } m_cachedLandscapes.setSize(m_landscapeEntries.getSize(), HK_NULL); } LandscapeRepository::~LandscapeRepository() { for ( int i = 0; i < m_cachedLandscapes.getSize(); ++i) { if (m_cachedLandscapes[i] != HK_NULL ) { m_cachedLandscapes[i]->removeReference(); } } } int LandscapeRepository::getNumLandscapes() { return m_landscapeEntries.getSize(); } void LandscapeRepository::setCurrentLandscapeIndex( int i ) { HK_ASSERT(0, i >=0 && i < getNumLandscapes() ); m_currentLandscape = i; } int LandscapeRepository::getCurrentLandscapeIndex() { return m_currentLandscape; } LandscapeContainer* LandscapeRepository::getCurrentLandscape() { return getLandscape( m_currentLandscape ); } int LandscapeRepository::getLandscapeIndexByName( const char* name ) { for( int i = 0; i < m_landscapeEntries.getSize(); i++ ) { if( hkString::strCmp(m_landscapeEntries[i].m_name, name ) == 0 ) { return i; } } HK_WARN( 0x9420823a, "Couldn't find landscape repository " << name << ". Using landscape 0, " << m_landscapeEntries[0].m_name ); return 0; } LandscapeContainer* LandscapeRepository::getLandscape( int i ) { if (m_cachedLandscapes[i] != HK_NULL ) { return m_cachedLandscapes[i]; } LandscapeContainer* landscapeContainer = m_landscapeEntries[i].m_createFunc( m_landscapeEntries[i].m_param ); m_cachedLandscapes[i] = landscapeContainer; return landscapeContainer; /* // Version which saves out landscape hkString fileName("resources/landscape/"); fileName += m_landscapeEntries[i].m_name; hkIstream infile( fileName.cString() ); hkpMoppBvTreeShape* preLoadedMopp = HK_NULL; hkPackfileReader* reader; if (infile.isOk()) { reader = new hkBinaryPackfileReader(); reader->loadEntireFile(infile.getStreamReader()); // XXX - this currently doesnt work // if( hkVersionUtil::updateToCurrentVersion( *reader, hkVersionRegistry::getInstance() ) != HK_SUCCESS ) //{ // HK_ASSERT2(0, 0, "Couldn't update version."); //} hkRootLevelContainer* container = static_cast<hkRootLevelContainer*>( reader->getContents( hkRootLevelContainerClass.getName() ) ); HK_ASSERT2(0xa6451543, container != HK_NULL, "Could not load root level obejct" ); preLoadedMopp = static_cast<hkpMoppBvTreeShape*>( container->findObjectByType( hkpMoppBvTreeShapeClass.getName() ) ); HK_ASSERT2(0xa6451544, preLoadedMopp != HK_NULL, "Could not find mopp in root level object" ); } LandscapeContainer* landscapeContainer = m_landscapeEntries[i].m_createFunc( m_landscapeEntries[i].m_param, preLoadedMopp ); if ( preLoadedMopp != HK_NULL ) { landscapeContainer->m_packfileData = reader->getPackfileData(); landscapeContainer->m_packfileData->addReference(); } else { hkOstream outfile( fileName.cString() ); hkRootLevelContainer::NamedVariant genericData(const_cast<char *>(hkpMoppBvTreeShapeClass.getName()), (void*)(landscapeContainer->m_shape), &hkpMoppBvTreeShapeClass); hkRootLevelContainer container; container.m_numNamedVariants = 1; container.m_namedVariants = &genericData; // Save landscape for next time hkpHavokSnapshot::ConvertListener convertListener; hkPackfileWriter* pw; pw = new hkBinaryPackfileWriter(); pw->setContents( (const void*)&container, hkRootLevelContainerClass, &convertListener ); hkPackfileWriter::Options o; pw->save( outfile.getStreamWriter(), o ); pw->removeReference(); } return landscapeContainer; */ } AabbSpawnUtil::AabbSpawnUtil( hkArray<hkAabb>& spawnVolumes ) : m_spawnVolumes( spawnVolumes ), m_pseudoRandomGenerator(1098) { m_spawnedAabbs.setSize(m_spawnVolumes.getSize()); m_currentSpawnVolume = 0; m_allowOverlaps = false; } void AabbSpawnUtil::getNewSpawnPosition(const hkVector4& aabbDims, hkVector4& positionOut) { // Try each volume in turn while (1) { hkVector4 avaliableDiag; avaliableDiag.setSub4( m_spawnVolumes[m_currentSpawnVolume].m_max, m_spawnVolumes[m_currentSpawnVolume].m_min ); avaliableDiag.sub4(aabbDims); if ( avaliableDiag(0) < 0 || avaliableDiag(2) < 0 ) { HK_ASSERT2(0, 0, "No spawn space large enough for requested aabb"); return; } // Try 100 random positions in the volume int numTries = m_allowOverlaps ? 1 : 100; for (int j = 0; j < numTries; ++j) { hkVector4 minPos(m_pseudoRandomGenerator.getRandReal01(), m_pseudoRandomGenerator.getRandReal01(), m_pseudoRandomGenerator.getRandReal01() ); if (avaliableDiag(1) < 0) { minPos(1) = 0; } minPos.mul4(avaliableDiag); minPos.add4(m_spawnVolumes[m_currentSpawnVolume].m_min); hkVector4 maxPos; maxPos.setAdd4( minPos, aabbDims ); hkAabb candidate( minPos, maxPos ); bool aabbCollides = false; if (!m_allowOverlaps) { for ( int k = 0; k < m_spawnedAabbs[m_currentSpawnVolume].getSize(); k++ ) { if ( m_spawnedAabbs[m_currentSpawnVolume][k].overlaps(candidate)) { aabbCollides = true; break; } } } if ( !aabbCollides ) { m_spawnedAabbs[m_currentSpawnVolume].pushBack(candidate); hkVector4 position; positionOut.setInterpolate4( candidate.m_min, candidate.m_max, .5f ); // If we allow penetrations, take each spawn volume in turn if ( m_allowOverlaps ) { m_currentSpawnVolume++; if (m_currentSpawnVolume == m_spawnVolumes.getSize()) { m_currentSpawnVolume = 0; } } return; } } // If we couldn't find a space, try the next volume m_currentSpawnVolume++; if (m_currentSpawnVolume == m_spawnVolumes.getSize()) { m_currentSpawnVolume = 0; m_allowOverlaps = true; } } } LandscapeEntryRegister* LandscapeRepository::s_landscapeList = HK_NULL; HK_SINGLETON_IMPLEMENTATION(LandscapeRepository); /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529) * * Confidential Information of Havok. (C) Copyright 1999-2008 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at * www.havok.com/tryhavok * */
[ "uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4" ]
[ [ [ 1, 287 ] ] ]
1baf58c82f6059799e0bb2954d7c4b58ebea9bcb
3c0d7fc6c0187a8a0eae01b15a77e8e302e524e8
/server/src/sprite/spriteManager.cpp
2488042129afacffb3cd1c4d675418f03cb11b06
[ "Artistic-2.0" ]
permissive
klusark/mdpr
0342bea08e9585a46d8d1c5ada29a662875d9d6f
da2b2287e4ed7eab302255221381a9bcbc5e5dcd
refs/heads/master
2021-01-01T15:30:10.633491
2009-08-23T05:14:36
2009-08-23T05:14:36
32,649,940
0
0
null
null
null
null
UTF-8
C++
false
false
1,545
cpp
#include <Poco/SharedPtr.h> #include <map> #include "helpers.hpp" #include "genericSprite.hpp" #include "player.hpp" #include "spriteCollision.hpp" #include "spriteManager.hpp" SpriteManager sprite; SpriteManager::SpriteManager(): active(false), collision(Sprites), myEffectManager(&sprite) { } SpriteManager::~SpriteManager() { } void SpriteManager::registerSprite(Poco::SharedPtr<GenericSprite> sprite) { Sprites[stringToCRC(sprite->name)] = sprite; } void SpriteManager::update() { collision.before(); spriteContainer::iterator iter; for(iter = Sprites.begin(); iter != Sprites.end(); ++iter){ iter->second->update(); if (iter->second->currentState == readyToSpawnState){ spawn(iter->second); } collision.update(iter->first); } } void SpriteManager::removeSprite(unsigned int spriteID) { spriteContainer::iterator spriteToErase = Sprites.find(spriteID); if (spriteToErase != Sprites.end()){ Sprites.erase(spriteToErase); } } void SpriteManager::removeSprite(std::string spriteID) { removeSprite(stringToCRC(spriteID)); } void SpriteManager::spawn(Poco::SharedPtr<GenericSprite> spriteToSpawn) { spriteToSpawn->currentState = aliveState; spriteToSpawn->SetX(50); spriteToSpawn->SetY(76); Position pos = spriteToSpawn->GetPosition(); myEffectManager.addEffect(spriteToSpawn->spawnEffect, pos.x, pos.y); } bool SpriteManager::isActive() { return active; } void SpriteManager::setActive(bool toggle) { active = toggle; }
[ "joelteichroeb@localhost" ]
[ [ [ 1, 78 ] ] ]
91be3343f295e4dd9d173b50ea153650525b91dc
709cd826da3ae55945fd7036ecf872ee7cdbd82a
/Term/WildMagic2/Applications/Miscellaneous/ClodPolyline/VertexCollapse.cpp
29ac131e8869fa81868261e5787532bf7be3c95b
[]
no_license
argapratama/kucgbowling
20dbaefe1596358156691e81ccceb9151b15efb0
65e40b6f33c5511bddf0fa350c1eefc647ace48a
refs/heads/master
2018-01-08T15:27:44.784437
2011-06-19T15:23:39
2011-06-19T15:23:39
36,738,655
0
0
null
null
null
null
UTF-8
C++
false
false
12,306
cpp
// 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. #include <cassert> #include <cfloat> #include "WmlDistVec3Lin3.h" #include "VertexCollapse.h" //---------------------------------------------------------------------------- VertexCollapse::VertexCollapse (int iVQuantity, Vector3f*& rakVertex, bool bClosed, int*& raiMap, int& riEQuantity, int*& raiEdge) { raiMap = new int[iVQuantity]; if ( bClosed ) { riEQuantity = iVQuantity; raiEdge = new int[2*riEQuantity]; if ( iVQuantity == 3 ) { raiMap[0] = 0; raiMap[1] = 1; raiMap[2] = 3; raiEdge[0] = 0; raiEdge[1] = 1; raiEdge[2] = 1; raiEdge[3] = 2; raiEdge[4] = 2; raiEdge[5] = 0; return; } } else { riEQuantity = iVQuantity-1; raiEdge = new int[2*riEQuantity]; if ( iVQuantity == 2 ) { raiMap[0] = 0; raiMap[1] = 1; raiEdge[0] = 0; raiEdge[1] = 1; return; } } // create the heap of records InitializeHeap(iVQuantity,rakVertex,bClosed); BuildHeap(); assert( IsValid() ); // create the level of detail information for the polyline int* aiCollapse = new int[iVQuantity]; CollapseVertices(iVQuantity,rakVertex,aiCollapse); ComputeEdges(iVQuantity,bClosed,aiCollapse,raiMap,riEQuantity,raiEdge); ReorderVertices(iVQuantity,rakVertex,aiCollapse,riEQuantity,raiEdge); delete[] aiCollapse; } //---------------------------------------------------------------------------- VertexCollapse::~VertexCollapse () { delete[] m_akRecord; delete[] m_apkHeap; } //---------------------------------------------------------------------------- float VertexCollapse::GetWeight (int iM, int iZ, int iP, Vector3f* akVertex) { Segment3f kSegment; kSegment.Origin() = akVertex[iM]; kSegment.Direction() = akVertex[iP] - akVertex[iM]; float fSqrDist = SqrDistance(akVertex[iZ],kSegment); float fSqrLen = kSegment.Direction().SquaredLength(); return ( fSqrLen > 0.0f ? fSqrDist/fSqrLen : FLT_MAX ); } //---------------------------------------------------------------------------- void VertexCollapse::InitializeHeap (int iVQuantity, Vector3f* akVertex, bool bClosed) { // Build the initial heap of weights, a max heap. The weights are set // to negative values so that we get a min heap. TO DO: Modify the // code to directly implement a min heap. m_iHQuantity = iVQuantity; m_akRecord = new Record[m_iHQuantity]; m_apkHeap = new Record*[m_iHQuantity]; int i; for (i = 0; i < m_iHQuantity; i++) { m_akRecord[i].m_iVIndex = i; m_akRecord[i].m_iHIndex = i; m_akRecord[i].m_pkLAdj = &m_akRecord[(m_iHQuantity+i-1)%m_iHQuantity]; m_akRecord[i].m_pkRAdj = &m_akRecord[(i+1)%m_iHQuantity]; m_apkHeap[i] = &m_akRecord[i]; } int iQm1 = m_iHQuantity - 1; if ( bClosed ) { int iQm2 = m_iHQuantity - 2; m_akRecord[0].m_fWeight = GetWeight(iQm1,0,1,akVertex); m_akRecord[iQm1].m_fWeight = GetWeight(iQm2,iQm1,0,akVertex); } else { m_akRecord[0].m_fWeight = FLT_MAX; m_akRecord[iQm1].m_fWeight = FLT_MAX; } for (int iM = 0, iZ = 1, iP = 2; iZ < iQm1; iM++, iZ++, iP++) m_akRecord[iZ].m_fWeight = GetWeight(iM,iZ,iP,akVertex); } //---------------------------------------------------------------------------- void VertexCollapse::BuildHeap () { int iLast = m_iHQuantity - 1; for (int iLeft = iLast/2; iLeft >= 0; iLeft--) { Record* pkRecord = m_apkHeap[iLeft]; int iPa = iLeft, iCh = 2*iLeft + 1; while ( iCh <= iLast ) { if ( iCh < iLast ) { if ( m_apkHeap[iCh]->m_fWeight > m_apkHeap[iCh+1]->m_fWeight ) iCh++; } if ( m_apkHeap[iCh]->m_fWeight >= pkRecord->m_fWeight ) break; m_apkHeap[iCh]->m_iHIndex = iPa; m_apkHeap[iPa] = m_apkHeap[iCh]; iPa = iCh; iCh = 2*iCh + 1; } pkRecord->m_iHIndex = iPa; m_apkHeap[iPa] = pkRecord; } } //---------------------------------------------------------------------------- int VertexCollapse::RemoveRoot (Vector3f* akVertex) { Record* pkRoot = m_apkHeap[0]; int iLast = m_iHQuantity - 1; Record* pkRecord = m_apkHeap[iLast]; int iPa = 0, iCh = 1; while ( iCh <= iLast ) { if ( iCh < iLast ) { if ( m_apkHeap[iCh]->m_fWeight > m_apkHeap[iCh+1]->m_fWeight ) iCh++; } if ( m_apkHeap[iCh]->m_fWeight >= pkRecord->m_fWeight ) break; m_apkHeap[iCh]->m_iHIndex = iPa; m_apkHeap[iPa] = m_apkHeap[iCh]; iPa = iCh; iCh = 2*iCh + 1; } pkRecord->m_iHIndex = iPa; m_apkHeap[iPa] = pkRecord; m_iHQuantity--; // remove root from the doubly-linked list Record* pkLAdj = pkRoot->m_pkLAdj; Record* pkRAdj = pkRoot->m_pkRAdj; pkLAdj->m_pkRAdj = pkRAdj; pkRAdj->m_pkLAdj = pkLAdj; // update the weights of the vertices affected by the removal int iM, iZ, iP; float fWeight; if ( pkLAdj->m_fWeight != FLT_MAX ) { iZ = pkLAdj->m_iVIndex; iM = pkLAdj->m_pkLAdj->m_iVIndex; iP = pkLAdj->m_pkRAdj->m_iVIndex; fWeight = GetWeight(iM,iZ,iP,akVertex); Update(pkLAdj->m_iHIndex,fWeight); assert( IsValid() ); } if ( pkRAdj->m_fWeight != FLT_MAX ) { iZ = pkRAdj->m_iVIndex; iM = pkRAdj->m_pkLAdj->m_iVIndex; iP = pkRAdj->m_pkRAdj->m_iVIndex; fWeight = GetWeight(iM,iZ,iP,akVertex); Update(pkRAdj->m_iHIndex,fWeight); assert( IsValid() ); } return pkRoot->m_iVIndex; } //---------------------------------------------------------------------------- void VertexCollapse::Update (int iHIndex, float fWeight) { Record* pkRecord = m_apkHeap[iHIndex]; int iPa, iCh, iChP, iMaxCh; if ( fWeight > pkRecord->m_fWeight ) { pkRecord->m_fWeight = fWeight; // new weight larger than old, propagate it towards the leaves iPa = iHIndex; iCh = 2*iPa+1; while ( iCh < m_iHQuantity ) { // at least one child exists if ( iCh < m_iHQuantity-1 ) { // two children exist iChP = iCh+1; if ( m_apkHeap[iCh]->m_fWeight <= m_apkHeap[iChP]->m_fWeight ) iMaxCh = iCh; else iMaxCh = iChP; } else { // one child exists iMaxCh = iCh; } if ( m_apkHeap[iMaxCh]->m_fWeight >= fWeight ) break; m_apkHeap[iMaxCh]->m_iHIndex = iPa; m_apkHeap[iPa] = m_apkHeap[iMaxCh]; pkRecord->m_iHIndex = iMaxCh; m_apkHeap[iMaxCh] = pkRecord; iPa = iMaxCh; iCh = 2*iPa+1; } } else if ( fWeight < pkRecord->m_fWeight ) { pkRecord->m_fWeight = fWeight; // new weight smaller than old, propagate it towards the root iCh = iHIndex; while ( iCh > 0 ) { // a parent exists iPa = (iCh-1)/2; if ( m_apkHeap[iPa]->m_fWeight <= fWeight ) break; m_apkHeap[iPa]->m_iHIndex = iCh; m_apkHeap[iCh] = m_apkHeap[iPa]; pkRecord->m_iHIndex = iPa; pkRecord->m_fWeight = fWeight; m_apkHeap[iPa] = pkRecord; iCh = iPa; } } } //---------------------------------------------------------------------------- void VertexCollapse::CollapseVertices (int iVQuantity, Vector3f* akVertex, int* aiCollapse) { for (int i = iVQuantity-1; i >= 0; i--) aiCollapse[i] = RemoveRoot(akVertex); } //---------------------------------------------------------------------------- void VertexCollapse::ComputeEdges (int iVQuantity, bool bClosed, int* aiCollapse, int* aiMap, int iEQuantity, int* aiEdge) { // Compute the edges (first to collapse is last in array). Do not // collapse last line segment of open polyline. Do not collapse last // triangle of closed polyline. int i, iVIndex, iEIndex = 2*iEQuantity-1; if ( bClosed ) { for (i = iVQuantity-1; i >= 0; i--) { iVIndex = aiCollapse[i]; aiEdge[iEIndex--] = (iVIndex+1) % iVQuantity; aiEdge[iEIndex--] = iVIndex; } } else { for (i = iVQuantity-1; i >= 2; i--) { iVIndex = aiCollapse[i]; aiEdge[iEIndex--] = iVIndex+1; aiEdge[iEIndex--] = iVIndex; } iVIndex = aiCollapse[0]; aiEdge[0] = iVIndex; aiEdge[1] = iVIndex+1; } // In the given edge order, find the index in the edge array that // corresponds to a collapse vertex and save the index for the dynamic // change in level of detail. This relies on the assumption that a // vertex is shared by at most two edges. iEIndex = 2*iEQuantity-1; for (i = iVQuantity-1; i >= 0; i--) { iVIndex = aiCollapse[i]; for (int iE = 0; iE < 2*iEQuantity; iE++) { if ( iVIndex == aiEdge[iE] ) { aiMap[i] = iE; aiEdge[iE] = aiEdge[iEIndex]; break; } } iEIndex -= 2; if ( bClosed ) { if ( iEIndex == 5 ) break; } else { if ( iEIndex == 1 ) break; } } // restore the edge array to full level of detail if ( bClosed ) { for (i = 3; i < iVQuantity; i++) { iVIndex = aiCollapse[i]; aiEdge[aiMap[i]] = iVIndex; } } else { for (i = 2; i < iVQuantity; i++) { iVIndex = aiCollapse[i]; aiEdge[aiMap[i]] = iVIndex; } } } //---------------------------------------------------------------------------- void VertexCollapse::ReorderVertices (int iVQuantity, Vector3f*& rakVertex, int* aiCollapse, int iEQuantity, int* aiEdge) { int* aiPermute = new int[iVQuantity]; Vector3f* akPVertex = new Vector3f[iVQuantity]; int i; for (i = 0; i < iVQuantity; i++) { int iVIndex = aiCollapse[i]; aiPermute[iVIndex] = i; akPVertex[i] = rakVertex[iVIndex]; } for (i = 0; i < 2*iEQuantity; i++) aiEdge[i] = aiPermute[aiEdge[i]]; delete[] rakVertex; rakVertex = akPVertex; delete[] aiPermute; } //---------------------------------------------------------------------------- bool VertexCollapse::IsValid (int iStart, int iFinal) { for (int iC = iStart; iC <= iFinal; iC++) { int iP = (iC-1)/2; if ( iP > iStart ) { if ( m_apkHeap[iP]->m_fWeight > m_apkHeap[iC]->m_fWeight ) return false; if ( m_apkHeap[iP]->m_iHIndex != iP ) return false; } } return true; } //---------------------------------------------------------------------------- bool VertexCollapse::IsValid () { return IsValid(0,m_iHQuantity-1); } //----------------------------------------------------------------------------
[ [ [ 1, 409 ] ] ]
8ec38cbef91f8ff0e4b51c12de0ef74f026c190f
234a9bca80cac2aff7ad92dcd0c308dcb790e8d4
/v7ui/ControlBarContext.cpp
5468ce80e4856a05f0c2effd0b9785db56d85a6c
[]
no_license
ste6an/v7ui
a15e529db7defa0930a7b950ac7d3ec2d8e11eeb
5b04049377cf9691d490322a0fae0ccf7a1a2dac
refs/heads/master
2021-01-10T03:28:26.659178
2008-08-14T16:01:49
2008-08-14T16:01:49
50,845,135
0
0
null
null
null
null
UTF-8
C++
false
false
3,002
cpp
// ControlBarContext.cpp: implementation of the CControlBarContext class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "ControlBarContext.h" #include "WndDirectUI.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// void DispatchToValue(IUnknown** ppUnk, CValue* pVal) { pVal->Reset(); IDispatchPtr pDisp = ppUnk[0]; if(pDisp != NULL) { VARIANT var; var.vt = VT_DISPATCH; var.pdispVal = pDisp; DISPPARAMS disp = {&var, NULL, 1, 0}; UINT ui; static_cast<CBLMyEx*>(NULL)->DispParamToValueEx(&pVal, &disp, &ui); pDisp->Release(); } } BL_INIT_CONTEXT(CControlBarContext); CControlBarContext::CControlBarContext() { m_pCBar = new CMyControlBar(); m_pCBar->Create(pMainFrame,_T("")); m_pCBar->EnableDocking(CBRS_ALIGN_ANY); pMainFrame->FloatControlBar(m_pCBar, CPoint(100,100),0); } CControlBarContext::~CControlBarContext() { delete m_pCBar; } BOOL CControlBarContext::Dock(CValue** ppParams) { UINT dockSide; switch(ppParams[0]->GetNumeric()) { case 0: dockSide=AFX_IDW_DOCKBAR_TOP; break; case 1: dockSide=AFX_IDW_DOCKBAR_BOTTOM; break; case 2: dockSide=AFX_IDW_DOCKBAR_LEFT; break; case 3: dockSide=AFX_IDW_DOCKBAR_RIGHT; break; case 4: dockSide=AFX_IDW_DOCKBAR_FLOAT; break; } if (dockSide==AFX_IDW_DOCKBAR_FLOAT) pMainFrame->FloatControlBar(m_pCBar, CPoint(100,100),0); else pMainFrame->DockControlBarEx(m_pCBar, dockSide, 0, 0, (float)0.75, 100); return TRUE; } BOOL CControlBarContext::CreateControl(CValue& rValue, CValue** ppValues) { m_pCBar->CreateControl(ppValues[0]->GetString()); LPUNKNOWN iUnkControl=m_pCBar->m_pChild->GetControlUnknown(); iUnkControl->AddRef(); DispatchToValue(reinterpret_cast<IUnknown**>(&iUnkControl), &rValue); return TRUE; } BOOL CControlBarContext::CreateExplorerBar(CValue& rValue, CValue** ppValues) { CExpBarContext* pEB=new CExpBarContext(); pEB->CreateControlWndEx(m_pCBar); m_pCBar->m_pChild=pEB->m_pExpBar; rValue.AssignContext(pEB); m_pCBar->CalcFixedLayout(TRUE,0); return TRUE; } BOOL CControlBarContext::Get_Visible(CValue& value) const { value=m_pCBar->IsWindowVisible(); return TRUE; } BOOL CControlBarContext::Set_Visible(CValue const& value) { int v = value.GetNumeric(); pMainFrame->ShowControlBar(m_pCBar,v?TRUE:FALSE,FALSE); return TRUE; } BOOL CControlBarContext::Get_Caption(CValue& value) const { value.SetType(CType(2)); m_pCBar->GetWindowText(value.m_String); return TRUE; } BOOL CControlBarContext::Set_Caption(CValue const& value) { m_pCBar->SetWindowText(value.GetString()); pMainFrame->ForceCaptionRedraw(); pMainFrame->RedrawWindow(); return TRUE; }
[ "steban.r@localhost" ]
[ [ [ 1, 119 ] ] ]
091f7237fa5a37c47adfe80b7799c50d643be905
45c0d7927220c0607531d6a0d7ce49e6399c8785
/GlobeFactory/src/ui/ui_loader/combo_box_loader.cc
b660348acee581b7b144a817055174733774fcab
[]
no_license
wavs/pfe-2011-scia
74e0fc04e30764ffd34ee7cee3866a26d1beb7e2
a4e1843239d9a65ecaa50bafe3c0c66b9c05d86a
refs/heads/master
2021-01-25T07:08:36.552423
2011-01-17T20:23:43
2011-01-17T20:23:43
39,025,134
0
0
null
null
null
null
UTF-8
C++
false
false
1,127
cc
#include "combo_box_loader.hh" //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ UIComboBoxLoader::UIComboBoxLoader() : UILoader("combo_box") { } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ UIComboBoxLoader::~UIComboBoxLoader() { } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ UIComboBox* UIComboBoxLoader::LoadComponent(XmlNode* parNode) { Vector2f pos, sz; if (!ExtractBase(parNode, pos, sz)) return NULL; bool state = false; if (parNode->GetAttribute("state", state)) return new UIComboBox(pos, sz, state); else return new UIComboBox(pos, sz); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
[ "creteur.c@8e971d8e-9cf3-0c36-aa0f-a7c54ab41ffc" ]
[ [ [ 1, 36 ] ] ]
18e73c62e22f61f19bccfe7e181c8807d4eea05a
021e8c48a44a56571c07dd9830d8bf86d68507cb
/build/vtk/metrics.hpp
230a77983f25913940e83b51117c2345ddf96f3f
[ "BSD-3-Clause" ]
permissive
Electrofire/QdevelopVset
c67ae1b30b0115d5c2045e3ca82199394081b733
f88344d0d89beeec46f5dc72c20c0fdd9ef4c0b5
refs/heads/master
2021-01-18T10:44:01.451029
2011-05-01T23:52:15
2011-05-01T23:52:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,736
hpp
#ifndef PLOTTER_METRICS_HPP #define PLOTTER_METRICS_HPP #include "verdict.h" #include <qobject.h> #include <qtimer.h> #include <math.h> class QMouseEvent; #define NUM_POINTS 20000 #define NUM_Z_PLANES 20 class Metric : public QObject { Q_OBJECT public: Metric( VerdictFunction fun, int xrange, int yrange) : func(fun), xRange(xrange), yRange(yrange) {} virtual ~Metric(){} struct metric_funcs { const char* name; VerdictFunction func; }; struct element_types { const char* name; const metric_funcs* functions; }; static const element_types ElementTypes[]; static const metric_funcs tri_metric_funcs[]; static const metric_funcs quad_metric_funcs[]; static const metric_funcs tet_metric_funcs[]; static void set_color_factor(int val) { colorFactor = val; } static double curr_metric_val( ) { return currMetricVal; } virtual void mouseEvent(QMouseEvent* e, int xmax, int ymax, bool flag = false) = 0; virtual void generate_plot() = 0; virtual void draw(int,int) = 0; virtual float setZVal(int){ return 0.; } void set_metric(VerdictFunction fun) { func = fun; } virtual double x_range_min() = 0; virtual double x_range_max() = 0; virtual double y_range_min() = 0; virtual double y_range_max() = 0; virtual double z_range_min() { return -1; } virtual double z_range_max() { return 1; } protected: static int colorFactor; VerdictFunction func; static double currMetricVal; double xRange; double yRange; signals: void current_val_changed( ); void redraw(); }; class Metric2D : public Metric { public: Metric2D(VerdictFunction fun, int x_range, int y_range) : Metric(fun, x_range, y_range), drawingList(0), currX(0), currY(0){} virtual ~Metric2D(){} protected: int drawingList; double currX; double currY; }; class Metric3D : public Metric { Q_OBJECT public: Metric3D(VerdictFunction fun, int x_range, int y_range) : Metric(fun, x_range, y_range), drawingListBase(0), currZPlane(0), currX(0), currY(0), zPlane(0), animator(0) {} virtual ~Metric3D(){} double z_range_min() { return -xRange; } double z_range_max() { return xRange; } float setZVal(int val) { currZPlane = val; emit redraw(); return (float)val/(float)NUM_Z_PLANES * 2 * xRange - xRange; } public slots: void animateStep() { currZPlane++; if(currZPlane >= NUM_Z_PLANES) currZPlane = 0; emit redraw(); } protected: int drawingListBase; int currZPlane; double currX; double currY; double zPlane; QTimer* animator; }; #endif
[ "ganondorf@ganondorf-VirtualBox.(none)" ]
[ [ [ 1, 129 ] ] ]
13f3a8afb5d2ac6425246de9d8ec6f7dc9ff2b8c
5236606f2e6fb870fa7c41492327f3f8b0fa38dc
/nsrpc/src/p2p/RelayServiceHandler.h
23b3736c20b3b4e33f88e0934a122e3b967da8de
[]
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
UHC
C++
false
false
1,018
h
#ifndef NSRPC_RELAYSERVICEHANDLER_H #define NSRPC_RELAYSERVICEHANDLER_H #ifdef _MSC_VER # pragma once #endif #include <nsrpc/p2p/detail/P2pProtocol.h> #include <nsrpc/p2p/PeerId.h> #include <srpc/RpcPacketType.h> #include <boost/noncopyable.hpp> class ACE_Message_Block; namespace nsrpc { namespace detail { /** @addtogroup p2p * @{ */ /** * @class RelayServiceHandler * * P2P relay service handler */ class RelayServiceHandler : public boost::noncopyable { public: virtual ~RelayServiceHandler() {} /// 메세지 블럭을 얻는다. virtual ACE_Message_Block* acquire(size_t blockSize) = 0; /// 패킷 릴레이 virtual void relayed(PeerId peerId, const ACE_INET_Addr& peerAddress, ACE_Message_Block* mblock, srpc::RpcPacketType packetType, SequenceNumber sequenceNumber, srpc::UInt32 sentTime) = 0; }; /** @} */ // addtogroup p2p } // namespace detail } // namespace nsrpc #endif // NSRPC_RELAYSERVICEHANDLER_H
[ "kcando@6d7ccee0-1a3b-0410-bfa1-83648d9ec9a4" ]
[ [ [ 1, 50 ] ] ]
d5867af67de5e0de306723e8fa13baccf54a1438
2f43a19a5c96acfe8d6aed786dd57e092ac1f35f
/Classes/Trap/Experiment.cpp
427e4b3f00af3763bd28651b58e6b4929c954cdd
[]
no_license
NERDSstack/Trap
c89b123d765e696f36c9029816177fa746784fdf
78db7626ada289f4a4a6a7a3532e209608025c7f
refs/heads/master
2020-08-28T04:57:22.655861
2010-12-20T17:33:37
2010-12-20T17:33:37
null
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
8,025
cpp
#include "Experiment.h" //----------------------------------------------------------------------------- Experiment :: Experiment(const string inputFileName, const char *defaultDir) { defaultDirectory = defaultDir+string("/"); inputFile = inputFileName; if (!conf.ReadSettings(inputFile)) if (!conf.ReadSettings(defaultDirectory + string("Main.xml"))) { console.warning("Can't open the main input file!"); printf("%s", defaultDirectory.c_str()); } cameraL = conf.cameraL; cameraD = conf.cameraD; isRunning = false; shouldStop = false; BField = new MagneticField(); EField = new ElectricField(); particles = new Particles(); } //----------------------------------------------------------------------------- Experiment :: ~Experiment() { delete BField; delete EField; delete particles; } //----------------------------------------------------------------------------- void Experiment :: start() { console.message("Starting"); console.printInt("Particles count: ", particles->getNumber()); isRunning = true; shouldStop = false; // Determinate parameters cameraD = conf.cameraD; cameraL = conf.cameraL; dz = cameraL / float(conf.BFieldSizeZ-1); dx = cameraD / float(conf.BFieldSizeX-1); invDx = 1.0/dx; invDz = 1.0/dz; fi = conf.fi/180.0*pi; v0 = sqrt(1.-1./sqr(1.+conf.W0/511000.0)); // начальная скорость электрона в единицах С u0 = v0/sqrt(1.0-sqr(v0)); // начальный импульс электрона с единицах mc w00 = 511000.0*( sqrt(1.0+sqr(u0)) -1.0); // тест для начальной энергии om = 2.0*pi*conf.f; rl = c/om; // релятивистский радиус циклотронного вращения invDxRl = invDx*rl; invDyRl = invDx*rl; invDzRl = invDz*rl; halfCameraLDivRl = 0.5 * cameraL / rl; piDivRl = pi / rl; piDivRlPow2 = piDivRl*piDivRl; E = conf.E * 1.0e05/3.0e04; // Амплитуда СВЧ поля в СГСЭ g0 = ez*E/(me*c*om); b0 = me*c*om/ez; // Резонансное значение индукции магнитного поля wmax = 511.0*2.0 * pow(g0,real(2.0/3.0)); particlesNumber = particles->getNumber(); halfX = (conf.BFieldSizeX)/2; halfY=halfX; halfZ = (conf.BFieldSizeZ)/2; console.printReal("U0 = ", u0); console.printReal("B0 = ", b0); console.printReal("w_max = ", 2.0 * pow(g0,real(2.0/3.0)) * 511.0); // Magnetic fields loading and mixing console.message("Reading magnetic fields"); if (!BField->readFromFileCoilsField(defaultDirectory+conf.coilsFilename)) console.warning("Can't read the coils magnetic field"); if (!BField->readFromFileHexField(defaultDirectory+conf.hexFilename)) console.warning("Can't read the hexapole magnetic field"); console.message("Mixing magnetic fields"); BField->mixMagneticFields(b0); // Electric fields creation console.message("Creation electric fields"); EField->createMultiMode(g0); // Initial distribution of particles console.message("Generate the initial distribution of particles"); particles->generateDistribution(rl, u0); // Perform experiment prevProcessed = -1; //real kp = 0, km = 0; kd = conf.kd; b00 = conf.B00; kt = conf.kt; dt = EField->getDt(); maxDumpTime = kt / kd; currentDumpTime = 0; prepareExperiment(); beginTime = clock(); processExperiment(); endTime = clock(); finishExperiment(); console.printTime(endTime-beginTime); } //----------------------------------------------------------------------------- void Experiment :: processExperiment() { for (sint k=0; k<kt; k++) { sint processed = sint(real(k)/real(kt-1)*100); if (processed != prevProcessed) console.printProcessed("Experiment processing", processed); prevProcessed = processed; sint l = k % EField->getPeriod(); // Расчет индекса СВЧ поля //real tm = (k+1) * dt; // Текущее время real tp = -(1.0+b00)*dt*0.5; // Базовое магнитное поле motion(l, tp); if (k%kd==0) { particles -> calculateEnergy(); particles -> findMinMaxEnergy(); currentDumpTime++; } if (shouldStop) { return; } } } //----------------------------------------------------------------------------- void Experiment :: finishExperiment() { particles -> calculateEnergy(); particles -> findMinMaxEnergy(); currentDumpTime++; isRunning = false; } //----------------------------------------------------------------------------- void Experiment :: prepareExperiment() { /*for (int i=0; i<particlesNumber; i++) { printf("%f :: %f :: %f \n", particles->x[ particles -> index[i].x ], particles->x[ particles -> index[i].y ], particles->x[ particles -> index[i].z ]); }*/ } //----------------------------------------------------------------------------- void Experiment :: motion(const sint l, const real tp) { real *x = &particles->x[0], *u = &particles->u[0], *gm = &particles->gm[0]; const real ex = EField->g[l].x, ey = EField->g[l].y, ez = EField->g[l].z; #pragma omp parallel for for (sint m=0; m<particlesNumber; m++) { if (particles->index[m].dead==1) continue; const sint ix=particles->index[m].x, iy=particles->index[m].y, iz=particles->index[m].z; real bp[3], t[3], sum; const real xn = x[ix]*invDxRl + halfX, yn = x[iy]*invDyRl + halfY, zn = x[iz]*invDzRl + halfZ; const sint i = xn, j = yn, k = zn, i1 = i+1, j1 = j+1, k1 = k+1; const real dx0 = xn-i, dy0 = yn-j, dz0 = zn-k, dx1 = 1.0-dx0, dy1 = 1.0-dy0, dz1 = 1.0-dz0; const real dy0dz0 = dy0*dz0, dy1dz0 = dy1*dz0, dy0dz1 = dy0*dz1, dy1dz1 = dy1*dz1; const real v1=dx0*dy0dz0, v2=dx1*dy0dz0, v3=dx0*dy1dz0, v4=dx1*dy1dz0, v5=dx0*dy0dz1, v6=dx1*dy0dz1, v7=dx0*dy1dz1, v8=dx1*dy1dz1; // bxp, byp, bzp - поля в точках расположения частиц bp[0] = BField->bx[i][j][k]*v8+BField->bx[i1][j][k]*v7+ BField->bx[i][j1][k]*v6+BField->bx[i1][j1][k]*v5+ BField->bx[i][j][k1]*v4+BField->bx[i][j1][k1]*v2+ BField->bx[i1][j][k1]*v3+BField->bx[i1][j1][k1]*v1; bp[1] = BField->by[i][j][k]*v8+BField->by[i1][j][k]*v7+ BField->by[i][j1][k]*v6+BField->by[i1][j1][k]*v5+ BField->by[i][j][k1]*v4+BField->by[i][j1][k1]*v2+ BField->by[i1][j][k1]*v3+BField->by[i1][j1][k1]*v1; bp[2] = BField->bz[i][j][k]*v8+BField->bz[i1][j][k]*v7+ BField->bz[i][j1][k]*v6+BField->bz[i1][j1][k]*v5+ BField->bz[i][j][k1]*v4+BField->bz[i][j1][k1]*v2+ BField->bz[i1][j][k1]*v3+BField->bz[i1][j1][k1]*v1; // Схема Бориса интегрированиня ур-ний движения const real uxm = u[ix] + ex, uym = u[iy] + ey, uzm = u[iz] + ez; const real gmn = sqrt(1.0 + uxm*uxm + uym*uym + uzm*uzm), tg = tp/gmn; for (sint q=0; q<3; q++) t[q] = tg * bp[q]; sum = 1.0; for(sint q=0; q<3; q++) sum += sqr(t[q]); const real inv_txyzr = 2.0/(sum), sx = t[0] * inv_txyzr, sy = t[1] * inv_txyzr, sz = t[2] * inv_txyzr; const real uxr = uxm + uym*t[2] - uzm*t[1], uyr = uym + uzm*t[0] - uxm*t[2], uzr = uzm + uxm*t[1] - uym*t[0]; const real uxp = uxm + uyr*sz - uzr*sy, uyp = uym + uzr*sx - uxr*sz, uzp = uzm + uxr*sy - uyr*sx; u[ix] = uxp + ex; u[iy] = uyp + ey; u[iz] = uzp + ez; gm[m] = sqrt(1.0 + sqr(u[ix]) + sqr(u[iy]) + sqr(u[iz])); const real gt = dt/gm[m]; x[ix] += u[ix]*gt; x[iy] += u[iy]*gt; x[iz] += u[iz]*gt; if (fabsf(x[iz]) >= halfCameraLDivRl || sqr(x[ix])+sqr(x[iy]) >= piDivRlPow2) { particles->index[m].dead = 1; } } // for } void Experiment :: getExperimentDump() { currentDumpTime++; }
[ [ [ 1, 283 ] ] ]
7238441479747697da1019783e4c6b688fedb902
5927f0908f05d3f58fe0adf4d5d20c27a4756fbe
/library/base/pickle.cpp
1c2fa03774a68d1bf0d3ab0422d6e5827917dfed
[]
no_license
seasky013/x-framework
b5585505a184a7d00d229da8ab0f556ca0b4b883
575e29de5840ede157e0348987fa188b7205f54d
refs/heads/master
2016-09-16T09:41:26.994686
2011-09-16T06:16:22
2011-09-16T06:16:22
41,719,436
0
1
null
null
null
null
GB18030
C++
false
false
12,169
cpp
#include "pickle.h" #include <limits> // static const int Pickle::kPayloadUnit = 64; // 特殊的capacity_标记只读对象. static const size_t kCapacityReadOnly = std::numeric_limits<size_t>::max(); // Payload是uint32对齐. Pickle::Pickle() : header_(NULL), header_size_(sizeof(Header)), capacity_(0), variable_buffer_offset_(0) { Resize(kPayloadUnit); header_->payload_size = 0; } Pickle::Pickle(int header_size) : header_(NULL), header_size_(AlignInt(header_size, sizeof(uint32))), capacity_(0), variable_buffer_offset_(0) { DCHECK(static_cast<size_t>(header_size) >= sizeof(Header)); DCHECK(header_size <= kPayloadUnit); Resize(kPayloadUnit); header_->payload_size = 0; } Pickle::Pickle(const char* data, int data_len) : header_(reinterpret_cast<Header*>(const_cast<char*>(data))), header_size_(data_len - header_->payload_size), capacity_(kCapacityReadOnly), variable_buffer_offset_(0) { if(data_len >= static_cast<int>(sizeof(Header))) { header_size_ = data_len - header_->payload_size; } if(header_size_ > static_cast<unsigned int>(data_len)) { header_size_ = 0; } if(header_size_ != AlignInt(header_size_, sizeof(uint32))) { header_size_ = 0; } // 如果数据有问题, 不会继续使用. if(!header_size_) { header_ = NULL; } } Pickle::Pickle(const Pickle& other) : header_(NULL), header_size_(other.header_size_), capacity_(0), variable_buffer_offset_(other.variable_buffer_offset_) { size_t payload_size = header_size_ + other.header_->payload_size; bool resized = Resize(payload_size); CHECK(resized); // realloc失败. memcpy(header_, other.header_, payload_size); } Pickle::~Pickle() { if(capacity_ != kCapacityReadOnly) { free(header_); } } Pickle& Pickle::operator=(const Pickle& other) { if(this == &other) { NOTREACHED(); return *this; } if(capacity_ == kCapacityReadOnly) { header_ = NULL; capacity_ = 0; } if(header_size_ != other.header_size_) { free(header_); header_ = NULL; header_size_ = other.header_size_; } bool resized = Resize(other.header_size_+other.header_->payload_size); CHECK(resized); // realloc失败. memcpy(header_, other.header_, other.header_size_+other.header_->payload_size); variable_buffer_offset_ = other.variable_buffer_offset_; return *this; } bool Pickle::ReadBool(void** iter, bool* result) const { DCHECK(iter); int tmp; if(!ReadInt(iter, &tmp)) { return false; } DCHECK(0==tmp || 1==tmp); *result = tmp ? true : false; return true; } bool Pickle::ReadInt(void** iter, int* result) const { DCHECK(iter); if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, sizeof(*result))) { return false; } // TODO: http://crbug.com/13108 Pickle需要清理, 不应该依赖对齐. // 下面这行等同于: memcpy(result, *iter, sizeof(*result)); *result = *reinterpret_cast<int*>(*iter); UpdateIter(iter, sizeof(*result)); return true; } bool Pickle::ReadLong(void** iter, long* result) const { DCHECK(iter); if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, sizeof(*result))) { return false; } // TODO: http://crbug.com/13108 Pickle需要清理, 不应该依赖对齐. // 下面这行等同于: memcpy(result, *iter, sizeof(*result)); memcpy(result, *iter, sizeof(*result)); UpdateIter(iter, sizeof(*result)); return true; } bool Pickle::ReadLength(void** iter, int* result) const { if(!ReadInt(iter, result)) { return false; } return ((*result) >= 0); } bool Pickle::ReadSize(void** iter, size_t* result) const { DCHECK(iter); if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, sizeof(*result))) { return false; } // TODO: http://crbug.com/13108 Pickle需要清理, 不应该依赖对齐. // 下面这行等同于: memcpy(result, *iter, sizeof(*result)); *result = *reinterpret_cast<size_t*>(*iter); UpdateIter(iter, sizeof(*result)); return true; } bool Pickle::ReadUInt16(void** iter, uint16* result) const { DCHECK(iter); if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, sizeof(*result))) { return false; } memcpy(result, *iter, sizeof(*result)); UpdateIter(iter, sizeof(*result)); return true; } bool Pickle::ReadUInt32(void** iter, uint32* result) const { DCHECK(iter); if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, sizeof(*result))) { return false; } memcpy(result, *iter, sizeof(*result)); UpdateIter(iter, sizeof(*result)); return true; } bool Pickle::ReadInt64(void** iter, int64* result) const { DCHECK(iter); if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, sizeof(*result))) { return false; } memcpy(result, *iter, sizeof(*result)); UpdateIter(iter, sizeof(*result)); return true; } bool Pickle::ReadUInt64(void** iter, uint64* result) const { DCHECK(iter); if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, sizeof(*result))) { return false; } memcpy(result, *iter, sizeof(*result)); UpdateIter(iter, sizeof(*result)); return true; } bool Pickle::ReadString(void** iter, std::string* result) const { DCHECK(iter); int len; if(!ReadLength(iter, &len)) { return false; } if(!IteratorHasRoomFor(*iter, len)) { return false; } char* chars = reinterpret_cast<char*>(*iter); result->assign(chars, len); UpdateIter(iter, len); return true; } bool Pickle::ReadWString(void** iter, std::wstring* result) const { DCHECK(iter); int len; if(!ReadLength(iter, &len)) { return false; } // 避免整数溢出. if(len > INT_MAX/static_cast<int>(sizeof(wchar_t))) { return false; } if(!IteratorHasRoomFor(*iter, len*sizeof(wchar_t))) { return false; } wchar_t* chars = reinterpret_cast<wchar_t*>(*iter); result->assign(chars, len); UpdateIter(iter, len*sizeof(wchar_t)); return true; } bool Pickle::ReadString16(void** iter, string16* result) const { DCHECK(iter); int len; if(!ReadLength(iter, &len)) { return false; } if(!IteratorHasRoomFor(*iter, len*sizeof(char16))) { return false; } char16* chars = reinterpret_cast<char16*>(*iter); result->assign(chars, len); UpdateIter(iter, len*sizeof(char16)); return true; } bool Pickle::ReadBytes(void** iter, const char** data, int length) const { DCHECK(iter); DCHECK(data); *data = 0; if(!*iter) { *iter = const_cast<char*>(payload()); } if(!IteratorHasRoomFor(*iter, length)) { return false; } *data = reinterpret_cast<const char*>(*iter); UpdateIter(iter, length); return true; } bool Pickle::ReadData(void** iter, const char** data, int* length) const { DCHECK(iter); DCHECK(data); DCHECK(length); *length = 0; *data = 0; if(!ReadLength(iter, length)) { return false; } return ReadBytes(iter, data, *length); } char* Pickle::BeginWrite(size_t length) { // uint32对齐位置开始写. size_t offset = AlignInt(header_->payload_size, sizeof(uint32)); size_t new_size = offset + length; size_t needed_size = header_size_ + new_size; if(needed_size>capacity_ && !Resize(std::max(capacity_*2, needed_size))) { return NULL; } #ifdef ARCH_CPU_64_BITS DCHECK_LE(length, std::numeric_limits<uint32>::max()); #endif header_->payload_size = static_cast<uint32>(new_size); return payload() + offset; } void Pickle::EndWrite(char* dest, int length) { // 用0填充避免类似valgrind这种内存工具报错. if(length % sizeof(uint32)) { memset(dest+length, 0, sizeof(uint32)-(length%sizeof(uint32))); } } bool Pickle::WriteBytes(const void* data, int data_len) { DCHECK(capacity_ != kCapacityReadOnly) << "oops: pickle is readonly"; char* dest = BeginWrite(data_len); if(!dest) { return false; } memcpy(dest, data, data_len); EndWrite(dest, data_len); return true; } bool Pickle::WriteString(const std::string& value) { if(!WriteInt(static_cast<int>(value.size()))) { return false; } return WriteBytes(value.data(), static_cast<int>(value.size())); } bool Pickle::WriteWString(const std::wstring& value) { if(!WriteInt(static_cast<int>(value.size()))) { return false; } return WriteBytes(value.data(), static_cast<int>(value.size()*sizeof(wchar_t))); } bool Pickle::WriteString16(const string16& value) { if(!WriteInt(static_cast<int>(value.size()))) { return false; } return WriteBytes(value.data(), static_cast<int>(value.size())*sizeof(char16)); } bool Pickle::WriteData(const char* data, int length) { return length>=0 && WriteInt(length) && WriteBytes(data, length); } char* Pickle::BeginWriteData(int length) { DCHECK_EQ(variable_buffer_offset_, 0U) << "There can only be one variable buffer in a Pickle"; if(length<0 || !WriteInt(length)) { return NULL; } char* data_ptr = BeginWrite(length); if(!data_ptr) { return NULL; } variable_buffer_offset_ = data_ptr - reinterpret_cast<char*>(header_) - sizeof(int); // 数据写入后不必要再调用EndWrite, 所以在这里调用进行数据对齐. EndWrite(data_ptr, length); return data_ptr; } void Pickle::TrimWriteData(int new_length) { DCHECK_NE(variable_buffer_offset_, 0U); // 获取变长缓冲区大小. int* cur_length = reinterpret_cast<int*>( reinterpret_cast<char*>(header_) + variable_buffer_offset_); if(new_length<0 || new_length>*cur_length) { NOTREACHED() << "Invalid length in TrimWriteData."; return; } // 更新有效数据长度和变长缓冲区大小. header_->payload_size -= (*cur_length - new_length); *cur_length = new_length; } bool Pickle::Resize(size_t new_capacity) { new_capacity = AlignInt(new_capacity, kPayloadUnit); CHECK_NE(capacity_, kCapacityReadOnly); void* p = realloc(header_, new_capacity); if(!p) { return false; } header_ = reinterpret_cast<Header*>(p); capacity_ = new_capacity; return true; } // static const char* Pickle::FindNext(size_t header_size, const char* start, const char* end) { DCHECK(header_size == AlignInt(header_size, sizeof(uint32))); DCHECK(header_size <= static_cast<size_t>(kPayloadUnit)); if(static_cast<size_t>(end-start) < sizeof(Header)) { return NULL; } const Header* hdr = reinterpret_cast<const Header*>(start); const char* payload_base = start + header_size; const char* payload_end = payload_base + hdr->payload_size; if(payload_end < payload_base) { return NULL; } return (payload_end>end) ? NULL : payload_end; }
[ [ [ 1, 532 ] ] ]
95e5d219e7bef3920c6539e0d372b0bc08bf22ee
8aa65aef3daa1a52966b287ffa33a3155e48cc84
/Source/Terrain/QuadTree.cpp
f49c22601becb5d7f4f62ccf236deaf6c8ac6483
[]
no_license
jitrc/p3d
da2e63ef4c52ccb70023d64316cbd473f3bd77d9
b9943c5ee533ddc3a5afa6b92bad15a864e40e1e
refs/heads/master
2020-04-15T09:09:16.192788
2009-06-29T04:45:02
2009-06-29T04:45:02
37,063,569
1
0
null
null
null
null
UTF-8
C++
false
false
1,029
cpp
#include "Includes.h" #include "QuadTree.h" namespace P3D { namespace World { const Sphere& QuadTreeNodeBase::CalculateBoundingSphere() { // get bounding sphere from bounding box Vector diag = BoundingBox.Max() - BoundingBox.Min(); BoundingSphere.SetCenter((BoundingBox.Max() + BoundingBox.Min()) * 0.5f); BoundingSphere.SetRadius(diag.Length() * 0.5f); return BoundingSphere; } const AABB& QuadTreeNode::CalculateBoundingBox() { BoundingBox.SetImpossible(); for (int i = 0; i < 4; i++) if (Childs[i]) BoundingBox.Enlarge(Childs[i]->CalculateBoundingBox()); CalculateBoundingSphere(); return BoundingBox; } void QuadTreeNode::DeleteQuadNode() { for (int i = 0; i < 4; i++) if (Childs[i]) Childs[i]->DeleteQuadNode(); delete this; // kill me } } }
[ "vadun87@6320d0be-1f75-11de-b650-e715bd6d7cf1" ]
[ [ [ 1, 33 ] ] ]
797d92be7f07689ccf13c0f7b6f4c3e0978a6001
b4bff7f61d078e3dddeb760e21174a781ed7f985
/Examples/Tutorial/ParticleSystem/02DynamicDistributions.cpp
062d1500881e9680181e32df8a20d3d7b71d07d9
[]
no_license
Langkamp/OpenSGToolbox
8283edb6074dffba477c2c4d632e954c3c73f4e3
5a4230441e68f001cdf3e08e9f97f9c0f3c71015
refs/heads/master
2021-01-16T18:15:50.951223
2010-05-19T20:24:52
2010-05-19T20:24:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,457
cpp
// General OpenSG configuration, needed everywhere #include "OSGConfig.h" // A little helper to simplify scene management and interaction #include "OSGSimpleSceneManager.h" #include "OSGNode.h" #include "OSGGroup.h" #include "OSGViewport.h" #include "OSGWindowUtils.h" // Input #include "OSGKeyListener.h" #include "OSGBlendChunk.h" #include "OSGLineChunk.h" #include "OSGChunkMaterial.h" #include "OSGMaterialChunk.h" #include "OSGParticleSystem.h" #include "OSGParticleSystemCore.h" #include "OSGPointParticleSystemDrawer.h" #include "OSGLineParticleSystemDrawer.h" #include "OSGGaussianNormalDistribution1D.h" #include "OSGLineDistribution3D.h" #include "OSGBoxDistribution3D.h" #include "OSGDiscDistribution3D.h" #include "OSGCylinderDistribution3D.h" #include "OSGSphereDistribution3D.h" #include "OSGGaussianNormalDistribution3D.h" #include "OSGTriDistribution3D.h" // Activate the OpenSG namespace OSG_USING_NAMESPACE // The SimpleSceneManager to manage simple applications SimpleSceneManager *mgr; WindowEventProducerRefPtr TutorialWindow; // Forward declaration so we can have the interesting stuff upfront void display(void); void reshape(Vec2f Size); // Create a class to allow for the use of the Ctrl+q class TutorialKeyListener : public KeyListener { public: virtual void keyPressed(const KeyEventUnrecPtr e) { if(e->getKey() == KeyEvent::KEY_Q && e->getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL) { TutorialWindow->closeWindow(); } } virtual void keyReleased(const KeyEventUnrecPtr e) { } virtual void keyTyped(const KeyEventUnrecPtr e) { } }; class TutorialMouseListener : public MouseListener { public: virtual void mouseClicked(const MouseEventUnrecPtr e) { } virtual void mouseEntered(const MouseEventUnrecPtr e) { } virtual void mouseExited(const MouseEventUnrecPtr e) { } virtual void mousePressed(const MouseEventUnrecPtr e) { mgr->mouseButtonPress(e->getButton(), e->getLocation().x(), e->getLocation().y()); } virtual void mouseReleased(const MouseEventUnrecPtr e) { mgr->mouseButtonRelease(e->getButton(), e->getLocation().x(), e->getLocation().y()); } }; class TutorialMouseMotionListener : public MouseMotionListener { public: virtual void mouseMoved(const MouseEventUnrecPtr e) { mgr->mouseMove(e->getLocation().x(), e->getLocation().y()); } virtual void mouseDragged(const MouseEventUnrecPtr e) { mgr->mouseMove(e->getLocation().x(), e->getLocation().y()); } }; Distribution3DRefPtr createPositionDistribution(void); Distribution3DRefPtr createNormalDistribution(void); Distribution3DRefPtr createColorDistribution(void); Distribution3DRefPtr createSizeDistribution(void); Distribution1DRefPtr createLifespanDistribution(void); Distribution3DRefPtr createVelocityDistribution(void); Distribution3DRefPtr createAccelerationDistribution(void); int main(int argc, char **argv) { // OSG init osgInit(argc,argv); // Set up Window TutorialWindow = createNativeWindow(); TutorialWindow->initWindow(); TutorialWindow->setDisplayCallback(display); TutorialWindow->setReshapeCallback(reshape); TutorialKeyListener TheKeyListener; TutorialWindow->addKeyListener(&TheKeyListener); TutorialMouseListener TheTutorialMouseListener; TutorialMouseMotionListener TheTutorialMouseMotionListener; TutorialWindow->addMouseListener(&TheTutorialMouseListener); TutorialWindow->addMouseMotionListener(&TheTutorialMouseMotionListener); // Create the SimpleSceneManager helper mgr = new SimpleSceneManager; // Tell the Manager what to manage mgr->setWindow(TutorialWindow); //Particle System Material LineChunkRefPtr PSLineChunk = LineChunk::create(); PSLineChunk->setWidth(1.0f); BlendChunkRefPtr PSBlendChunk = BlendChunk::create(); PSBlendChunk->setSrcFactor(GL_SRC_ALPHA); PSBlendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA); MaterialChunkRefPtr PSMaterialChunk = MaterialChunk::create(); PSMaterialChunk->setAmbient(Color4f(0.3f,0.3f,0.3f,1.0f)); PSMaterialChunk->setDiffuse(Color4f(0.7f,0.7f,0.7f,1.0f)); PSMaterialChunk->setSpecular(Color4f(0.9f,0.9f,0.9f,1.0f)); PSMaterialChunk->setColorMaterial(GL_AMBIENT_AND_DIFFUSE); PSMaterialChunk->setLit(false); ChunkMaterialRefPtr PSMaterial = ChunkMaterial::create(); PSMaterial->addChunk(PSLineChunk); PSMaterial->addChunk(PSMaterialChunk); PSMaterial->addChunk(PSBlendChunk); //Particle System ParticleSystemRefPtr ExampleParticleSystem = ParticleSystem::create(); ExampleParticleSystem->attachUpdateListener(TutorialWindow); //Create the particles UInt32 NumParticlesToGenerate(2500); Distribution3DRefPtr PositionDistribution = createPositionDistribution(); Distribution3DRefPtr NormalDistribution = createNormalDistribution(); Distribution3DRefPtr ColorDistribution = createColorDistribution(); Distribution3DRefPtr SizeDistribution = createSizeDistribution(); Distribution1DRefPtr LifespanDistribution = createLifespanDistribution(); Distribution3DRefPtr VelocityDistribution = createVelocityDistribution(); Distribution3DRefPtr AccelerationDistribution = createAccelerationDistribution(); Pnt3f PositionReturnValue; Vec3f NormalReturnValue = Vec3f(0.0,0.0f,1.0f); Color4f ColorReturnValue = Color4f(1.0,1.0f,1.0f, 1.0f); Vec3f SizeReturnValue; Time LifespanReturnValue = -1; Vec3f VelocityReturnValue; Vec3f AccelerationReturnValue; for(UInt32 i(0) ; i< NumParticlesToGenerate ; ++i) { if(PositionDistribution != NULL) { PositionReturnValue.setValue(PositionDistribution->generate().getValues()); } if(ColorDistribution != NULL) { Vec3f ColorRGB = ColorDistribution->generate(); ColorReturnValue.setValuesRGBA(ColorRGB[0],ColorRGB[1],ColorRGB[2],1.0f); } if(SizeDistribution != NULL) { SizeReturnValue = SizeDistribution->generate(); } if(LifespanDistribution != NULL) { LifespanReturnValue = LifespanDistribution->generate(); } if(VelocityDistribution != NULL) { VelocityReturnValue = VelocityDistribution->generate(); } ExampleParticleSystem->addParticle(PositionReturnValue, NormalReturnValue, ColorReturnValue, SizeReturnValue, LifespanReturnValue, VelocityReturnValue, AccelerationReturnValue ); } //Particle System Drawer LineParticleSystemDrawerRefPtr ExampleParticleSystemDrawer = LineParticleSystemDrawer::create(); ExampleParticleSystemDrawer->setLineDirectionSource(LineParticleSystemDrawer::DIRECTION_VELOCITY); ExampleParticleSystemDrawer->setLineLengthSource(LineParticleSystemDrawer::LENGTH_SIZE_X); ExampleParticleSystemDrawer->setEndPointFading(Vec2f(0.0f,1.0f)); //Particle System Node ParticleSystemCoreRefPtr ParticleNodeCore = ParticleSystemCore::create(); ParticleNodeCore->setSystem(ExampleParticleSystem); ParticleNodeCore->setDrawer(ExampleParticleSystemDrawer); ParticleNodeCore->setMaterial(PSMaterial); NodeRefPtr ParticleNode = Node::create(); ParticleNode->setCore(ParticleNodeCore); // Make Main Scene Node and add the Torus NodeRefPtr scene = Node::create(); scene->setCore(Group::create()); scene->addChild(ParticleNode); mgr->setRoot(scene); // Show the whole Scene mgr->showAll(); //Open Window Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f); Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5); TutorialWindow->openWindow(WinPos, WinSize, "02DynamicDistribution"); //Enter main Loop TutorialWindow->mainLoop(); osgExit(); return 0; } // Callback functions // Redraw the window void display(void) { mgr->redraw(); } // React to size changes void reshape(Vec2f Size) { mgr->resize(Size.x(), Size.y()); } Distribution3DRefPtr createPositionDistribution(void) { //Make The Distribution //Box Distribution /*BoxDistribution3DRefPtr TheBoxDistribution = BoxDistribution3D::create(); TheBoxDistribution->setMinPoint(Pnt3f(-10.0,-10.0,-10.0)); TheBoxDistribution->setMaxPoint(Pnt3f(10.0,10.0,10.0)); TheBoxDistribution->setSurfaceOrVolume(BoxDistribution3D::SURFACE); //Disc Distribution DiscDistribution3DRefPtr TheDiscDistribution = DiscDistribution3D::create(); TheDiscDistribution->setCenter(Pnt3f(0.0,0.0,0.0)); TheDiscDistribution->setInnerRadius(10.0); TheDiscDistribution->setOuterRadius(20.0); TheDiscDistribution->setMinTheta(0.0); TheDiscDistribution->setMaxTheta(6.283185307); TheDiscDistribution->setNormal(Vec3f(0.0,0.0,1.0)); TheDiscDistribution->setSurfaceOrEdge(DiscDistribution3D::SURFACE); //Cylinder Distribution CylinderDistribution3DRefPtr TheCylinderDistribution = CylinderDistribution3D::create(); TheCylinderDistribution->setCenter(Pnt3f(0.0,0.0,0.0)); TheCylinderDistribution->setInnerRadius(30.0); TheCylinderDistribution->setOuterRadius(100.0); TheCylinderDistribution->setMinTheta(0.0); TheCylinderDistribution->setMaxTheta(6.283185); TheCylinderDistribution->setHeight(400.0); TheCylinderDistribution->setNormal(Vec3f(0.0,0.0,1.0)); TheCylinderDistribution->setSurfaceOrVolume(CylinderDistribution3D::VOLUME); //Tri Distribution TriDistribution3DRefPtr TheTriDistribution = TriDistribution3D::create(); TheTriDistribution->setPoint1(Pnt3f(0.0,0.0,0.0)); TheTriDistribution->setPoint2(Pnt3f(-50.0,1000.0,0.0)); TheTriDistribution->setPoint3(Pnt3f(50.0,1000.0,0.0)); TheTriDistribution->setPoint3(Pnt3f(50.0,1000.0,0.0)); TheTriDistribution->setSurfaceOrEdge(TriDistribution3D::SURFACE); //GaussianNormal Distribution GaussianNormalDistribution3DRefPtr TheGaussianNormalDistribution = GaussianNormalDistribution3D::create(); TheGaussianNormalDistribution->setMean(Pnt3f(0.0,0.0,0.0)); TheGaussianNormalDistribution->setStandardDeviationX(100.0); TheGaussianNormalDistribution->setStandardDeviationY(100.0); TheGaussianNormalDistribution->setStandardDeviationZ(100.0);*/ //Sphere Distribution SphereDistribution3DRefPtr TheSphereDistribution = SphereDistribution3D::create(); TheSphereDistribution->setCenter(Pnt3f(0.0,0.0,0.0)); TheSphereDistribution->setInnerRadius(0.0); TheSphereDistribution->setOuterRadius(3.0); TheSphereDistribution->setMinTheta(0.0); TheSphereDistribution->setMaxTheta(6.283185); TheSphereDistribution->setMinZ(-1.0); TheSphereDistribution->setMaxZ(1.0); TheSphereDistribution->setSurfaceOrVolume(SphereDistribution3D::SURFACE); return TheSphereDistribution; } Distribution3DRefPtr createNormalDistribution(void) { //Sphere Distribution SphereDistribution3DRefPtr TheSphereDistribution = SphereDistribution3D::create(); TheSphereDistribution->setCenter(Pnt3f(0.0,0.0,0.0)); TheSphereDistribution->setInnerRadius(500.0); TheSphereDistribution->setOuterRadius(5000.0); TheSphereDistribution->setMinTheta(0.0); TheSphereDistribution->setMaxTheta(6.283185); TheSphereDistribution->setMinZ(-1.0); TheSphereDistribution->setMaxZ(1.0); TheSphereDistribution->setSurfaceOrVolume(SphereDistribution3D::VOLUME); return TheSphereDistribution; } Distribution3DRefPtr createColorDistribution(void) { //Line Distribution LineDistribution3DRefPtr TheLineDistribution = LineDistribution3D::create(); TheLineDistribution->setPoint1(Pnt3f(1.0,1.0,1.0)); TheLineDistribution->setPoint2(Pnt3f(1.0,1.0,0.1)); return TheLineDistribution; } Distribution3DRefPtr createSizeDistribution(void) { LineDistribution3DRefPtr TheLineDistribution = LineDistribution3D::create(); TheLineDistribution->setPoint1(Pnt3f(3.0,3.0,3.0)); TheLineDistribution->setPoint2(Pnt3f(1.0,1.0,1.0)); return TheLineDistribution; } Distribution1DRefPtr createLifespanDistribution(void) { GaussianNormalDistribution1DRefPtr TheLifespanDistribution = GaussianNormalDistribution1D::create(); TheLifespanDistribution->setMean(30.0f); TheLifespanDistribution->setStandardDeviation(3.0); return TheLifespanDistribution; } Distribution3DRefPtr createVelocityDistribution(void) { //Sphere Distribution SphereDistribution3DRefPtr TheSphereDistribution = SphereDistribution3D::create(); TheSphereDistribution->setCenter(Pnt3f(0.0,0.0,0.0)); TheSphereDistribution->setInnerRadius(10.0); TheSphereDistribution->setOuterRadius(15.0); TheSphereDistribution->setMinTheta(0.0); TheSphereDistribution->setMaxTheta(6.283185); TheSphereDistribution->setMinZ(-1.0); TheSphereDistribution->setMaxZ(1.0); TheSphereDistribution->setSurfaceOrVolume(SphereDistribution3D::VOLUME); return TheSphereDistribution; } Distribution3DRefPtr createAccelerationDistribution(void) { return NULL; }
[ [ [ 1, 1 ], [ 3, 4 ], [ 10, 11 ], [ 32, 36 ], [ 38, 47 ], [ 49, 51 ], [ 53, 55 ], [ 57, 59 ], [ 61, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 80 ], [ 82, 89 ], [ 91, 94 ], [ 96, 100 ], [ 108, 114 ], [ 117, 117 ], [ 120, 121 ], [ 123, 124 ], [ 127, 131 ], [ 133, 134 ], [ 136, 137 ], [ 139, 141 ], [ 143, 148 ], [ 150, 154 ], [ 157, 159 ], [ 161, 161 ], [ 169, 171 ], [ 173, 180 ], [ 182, 186 ], [ 188, 193 ], [ 195, 198 ], [ 200, 202 ], [ 204, 219 ], [ 224, 225 ], [ 227, 230 ], [ 232, 235 ], [ 238, 246 ], [ 250, 253 ], [ 255, 277 ], [ 279, 282 ], [ 284, 288 ], [ 290, 298 ], [ 300, 309 ], [ 311, 317 ], [ 319, 321 ], [ 335, 338 ], [ 340, 341 ], [ 343, 354 ], [ 356, 357 ], [ 359, 364 ], [ 366, 366 ], [ 368, 372 ], [ 374, 374 ], [ 376, 380 ], [ 382, 383 ], [ 385, 396 ], [ 398, 398 ], [ 401, 401 ] ], [ [ 2, 2 ], [ 5, 9 ], [ 12, 31 ], [ 37, 37 ], [ 48, 48 ], [ 52, 52 ], [ 56, 56 ], [ 60, 60 ], [ 68, 68 ], [ 71, 71 ], [ 74, 74 ], [ 77, 77 ], [ 81, 81 ], [ 90, 90 ], [ 95, 95 ], [ 101, 107 ], [ 115, 116 ], [ 118, 119 ], [ 122, 122 ], [ 125, 126 ], [ 132, 132 ], [ 135, 135 ], [ 138, 138 ], [ 142, 142 ], [ 149, 149 ], [ 155, 156 ], [ 162, 168 ], [ 181, 181 ], [ 187, 187 ], [ 194, 194 ], [ 199, 199 ], [ 203, 203 ], [ 220, 220 ], [ 223, 223 ], [ 226, 226 ], [ 231, 231 ], [ 236, 237 ], [ 247, 249 ], [ 254, 254 ], [ 278, 278 ], [ 283, 283 ], [ 289, 289 ], [ 299, 299 ], [ 310, 310 ], [ 318, 318 ], [ 322, 322 ], [ 326, 326 ], [ 339, 339 ], [ 342, 342 ], [ 355, 355 ], [ 358, 358 ], [ 365, 365 ], [ 367, 367 ], [ 373, 373 ], [ 375, 375 ], [ 381, 381 ], [ 384, 384 ], [ 397, 397 ], [ 400, 400 ] ], [ [ 160, 160 ], [ 172, 172 ], [ 221, 222 ], [ 323, 325 ], [ 327, 334 ], [ 399, 399 ] ] ]
53accb3eb9dd3954d71b77c14d3ae0a0191b2d31
0b1111e870b496aae0d6210806eebf1c942c9d3a
/LinearAlgebra/ToeplitzTest.cpp
8f6f6fc448d99b5c0af8590fb09d0c8a6e62e243
[ "WTFPL" ]
permissive
victorliu/Templated-Numerics
8ca3fabd79435fa40e95e9c8c944ecba42a0d8db
35ca6bb719615d5498a450a2d58e2aa2bb7ef5f9
refs/heads/master
2016-09-05T16:32:22.250276
2009-12-30T07:48:03
2009-12-30T07:48:03
318,857
3
1
null
null
null
null
UTF-8
C++
false
false
1,874
cpp
#include "ToeplitzMatrix.h" #include <complex> #include <iostream> //typedef std::complex<double> value_type; typedef double value_type; typedef ToeplitzMatrix<value_type> Matrix; void print_matrix(const Matrix &M){ std::cout << "{"; for(int i = 0; i < M.size(); ++i){ std::cout << "{"; std::cout << M(i,0); for(int j = 1; j < M.size(); ++j){ std::cout << ", " << M(i,j); } std::cout << "}," << std::endl; } std::cout << "}" << std::endl; } void print_matrix_inverse(const Matrix::InverseMatrix &M){ std::cout << "{"; for(int i = 0; i < M.size(); ++i){ std::cout << "{"; std::cout << M(i,0); for(int j = 1; j < M.size(); ++j){ std::cout << ", " << M(i,j); } std::cout << "}," << std::endl; } std::cout << "}" << std::endl; } void print_matrix_prim(const value_type *M, size_t N){ std::cout << "{"; for(int i = 0; i < N; ++i){ std::cout << "{"; std::cout << M[i+0*N]; for(int j = 1; j < N; ++j){ std::cout << ", " << M[i+j*N]; } std::cout << "}," << std::endl; } std::cout << "}" << std::endl; } int main(){ const int N = 4; Matrix M(N); for(int i = 0; i < N; ++i){ M(i,0) = M(0,i) = 1/value_type(i+1); } M(2,0) = 0.125; value_type *invraw = new value_type[N*N]; value_type *orig = new value_type[N*N]; M.Fill(orig, N); Matrix::InverseMatrix inv(M); inv.Fill(invraw, N); std::cout << "Original matrix:" << std::endl; print_matrix(M); print_matrix_prim(orig,N); std::cout << "Inverse matrix:" << std::endl; print_matrix_prim(invraw, N); print_matrix_inverse(inv); value_type *scratch = new value_type[N*N];memset(scratch,0,N*N*sizeof(value_type)); inv.MultAdd(N, orig, N, scratch, N); std::cout << "Inverse*Original:" << std::endl; print_matrix_prim(scratch, N); delete [] invraw; delete [] scratch; return 0; }
[ "victor@onyx.(none)", "[email protected]" ]
[ [ [ 1, 20 ], [ 33, 47 ], [ 49, 53 ], [ 58, 60 ], [ 63, 63 ], [ 71, 71 ], [ 74, 76 ] ], [ [ 21, 32 ], [ 48, 48 ], [ 54, 57 ], [ 61, 62 ], [ 64, 70 ], [ 72, 73 ] ] ]
9a731010d0264067ba490b38d114671e84105de2
cd7d7b53a9764fc4b06d835cc645e2150ded21d5
/Tmp/ptree.cpp
1b913d8f7df125577bc52bb7fa02a0eaf8cbab49
[ "MIT" ]
permissive
sobolxxx/FraDIA
9f50e9abee6339b8fd41cc92db685cf76884cc75
5c2c7e31f9eb8911a001c3c8243b24aebda9b7f5
refs/heads/master
2021-01-18T05:22:06.819959
2010-07-08T20:24:09
2010-07-11T10:17:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,578
cpp
// ---------------------------------------------------------------------------- // Copyright (C) 2002-2006 Marcin Kalicinski // // 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) // // For more information, see www.boost.org // ---------------------------------------------------------------------------- #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> #include <boost/foreach.hpp> #include <string> #include <set> #include <exception> #include <iostream> struct debug_settings { std::string m_file; // log filename int m_level; // debug level std::set<std::string> m_modules; // modules where logging is enabled void load(const std::string &filename); void save(const std::string &filename); }; using boost::property_tree::ptree; void debug_settings::load(const std::string &filename) { // Create empty property tree object using boost::property_tree::ptree; ptree pt; // Load XML file and put its contents in property tree. // No namespace qualification is needed, because of Koenig // lookup on the second argument. If reading fails, exception // is thrown. read_xml(filename, pt); // Get filename and store it in m_file variable. Note that // we specify a path to the value using notation where keys // are separated with dots (different separator may be used // if keys themselves contain dots). If debug.filename key is // not found, exception is thrown. m_file = pt.get<std::string>("debug.filename"); std::cout << m_file << std::endl; // Get debug level and store it in m_level variable. This is // another version of get method: if debug.level key is not // found, it will return default value (specified by second // parameter) instead of throwing. Type of the value extracted // is determined by type of second parameter, so we can simply // write get(...) instead of get<int>(...). m_level = pt.get("debug.level", 0.0); std::cout << m_level << std::endl; // Iterate over debug.modules section and store all found // modules in m_modules set. get_child() function returns a // reference to child at specified path; if there is no such // child, it throws. Property tree iterator can be used in // the same way as standard container iterator. Category // is bidirectional_iterator. BOOST_FOREACH(ptree::value_type &v, pt.get_child("debug.modules")) { m_modules.insert(v.second.data()); std::cout << v.second.data() << std::endl; } } void debug_settings::save(const std::string &filename) { // Create empty property tree object using boost::property_tree::ptree; ptree pt; // Put log filename in property tree pt.put("debug.filename", m_file); // Put debug level in property tree pt.put("debug.level", m_level); // Iterate over modules in set and put them in property // tree. Note that put function places new key at the // end of list of keys. This is fine in most of the // situations. If you want to place item at some other // place (i.e. at front or somewhere in the middle), // this can be achieved using combination of insert // and put_value functions //BOOST_FOREACH(const std::string &name, m_modules) // pt.put("debug.modules.module", name); // Write property tree to XML file write_xml(filename, pt); } typedef std::pair<std::string, ptree> sp; void printTree(const ptree & pt, int lvl) { BOOST_FOREACH( sp p, pt) { for (int i = 0; i < lvl; ++i) std::cout << " "; std::cout << p.first << std::endl; printTree(p.second, lvl+1); } } void iterate(const std::string &filename) { // Create empty property tree object using boost::property_tree::ptree; ptree pt; // Load XML file and put its contents in property tree. // No namespace qualification is needed, because of Koenig // lookup on the second argument. If reading fails, exception // is thrown. read_xml(filename, pt); printTree(pt, 0); } int main(int argc, const char * argv[]) { if (argc < 2) { std::cout << "Supply filename.\n"; return 1; } try { iterate(argv[1]); } catch (std::exception &e) { std::cout << "Error: " << e.what() << "\n"; } return 0; }
[ [ [ 1, 141 ] ] ]
ee9247d9f111d67ea6149e9b27d7963d2c276f94
8403411fa78af2109c30e7c33ad9bc860d12ed83
/src/tools/collapse_edge_tool.h
e18c61d733062f48900c03c7ad01805262b8b50d
[]
no_license
virtualritz/topmod
7676b10e24f95547ccbb2e42cdb8b787a1461d59
95717591fc11afa67551a72e6824043887f971ba
refs/heads/master
2020-04-01T21:00:55.192983
2008-11-01T23:45:41
2008-11-01T23:45:41
60,533,319
0
0
null
null
null
null
UTF-8
C++
false
false
539
h
/* * collapse_edge_tool.h * * Created on: Sep 12, 2008 * Author: david.morris */ #ifndef COLLAPSE_EDGE_TOOL_H_ #define COLLAPSE_EDGE_TOOL_H_ #include <QtGui> #include <QWidget> #include "topmod_tool.h" // Declaration of the class CollapseEdgeTool. class CollapseEdgeTool: public TopModTool { Q_OBJECT // does it have to be a Q_OBJECT? public: CollapseEdgeTool(QWidget *parent); void RetranslateUi(); protected: public slots: void Activate(); }; #endif /* COLLAPSE_EDGE_TOOL_H_ */
[ "dvmorris@e0e46c49-be69-4f5a-ad62-21024a331aea" ]
[ [ [ 1, 31 ] ] ]
3b1a9971260bb1c6bb7b668fc3a4bc1e75a03bc3
f177993b13e97f9fecfc0e751602153824dfef7e
/ImProSln/MaskFilter/MaskFilterReg.cpp
bf94b72987bb4bc80b09de7678eba3dded3ae1cc
[]
no_license
svn2github/imtophooksln
7bd7412947d6368ce394810f479ebab1557ef356
bacd7f29002135806d0f5047ae47cbad4c03f90e
refs/heads/master
2020-05-20T04:00:56.564124
2010-09-24T09:10:51
2010-09-24T09:10:51
11,787,598
1
0
null
null
null
null
UTF-8
C++
false
false
3,057
cpp
#include "stdafx.h" #include "MaskFilterReg.h" #include "ImProGUID.h" static WCHAR g_wszName[] = L"Mask Filter"; const AMOVIESETUP_PIN psudMaskFilterPins[] = { { L"input" // strName , FALSE // bRendered , FALSE // bOutput , FALSE // bZero , FALSE // bMany , &CLSID_NULL // clsConnectsToFilter , L"" // strConnectsToPin , 0 // nTypes , NULL // lpTypes }, { L"AR conf" // strName , FALSE // bRendered , FALSE // bOutput , FALSE // bZero , FALSE // bMany , &CLSID_NULL // clsConnectsToFilter , L"" // strConnectsToPin , 0 // nTypes , NULL // lpTypes } , { L"output" // strName , FALSE // bRendered , TRUE // bOutput , FALSE // bZero , FALSE // bMany , &CLSID_NULL // clsConnectsToFilter , L"" // strConnectsToPin , 0 // nTypes , NULL // lpTypes } }; const REGFILTER2 sudMaskFilter = { 1, // Version number. MERIT_DO_NOT_USE, // Merit. 2, // Number of pins. psudMaskFilterPins }; // lpPin STDAPI DllRegisterServer(void) { #ifdef _AFXDLL AFX_MANAGE_STATE(AfxGetStaticModuleState()); #endif HRESULT hr = AMovieDllRegisterServer2(TRUE); if (FAILED(hr)) { return hr; } IFilterMapper2 *pFM2 = NULL; hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&pFM2); if (SUCCEEDED(hr)) { hr = pFM2->CreateCategory(GUID_ImProFilter_Category, MERIT_NORMAL, L"ImPro Filters"); hr = pFM2->RegisterFilter( CLSID_MaskFilter, // Filter CLSID. g_wszName, // Filter name. NULL , // Device moniker. &GUID_ImProFilter_Category, // Video compressor category. g_wszName, // Instance data. &sudMaskFilter // Filter information. ); pFM2->Release(); } return hr; } STDAPI DllUnregisterServer() { #ifdef _AFXDLL AFX_MANAGE_STATE(AfxGetStaticModuleState()); #endif HRESULT hr = AMovieDllRegisterServer2(FALSE); if (FAILED(hr)) { return hr; } IFilterMapper2 *pFM2 = NULL; hr = CoCreateInstance(CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, IID_IFilterMapper2, (void **)&pFM2); if (SUCCEEDED(hr)) { hr = pFM2->UnregisterFilter(&GUID_ImProFilter_Category, g_wszName, CLSID_MaskFilter); pFM2->Release(); } return hr; } CFactoryTemplate g_Templates[] = { { g_wszName, &CLSID_MaskFilter, MaskFilter::CreateInstance, NULL, NULL }, { L"Mask Property Page", &CLSID_MaskFilterProp, MaskFilterPropPage::CreateInstance, NULL, NULL } }; int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
[ "ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a" ]
[ [ [ 1, 120 ] ] ]
e596c4969799153b7475c2d4fdc30ce0291223db
956e0201a3627226744a63075ea7b45dbf05208b
/GumShot/src/CBGumGumResponse.cpp
c954e3e5c3a87e9e0319243d8166ea0e50aa5128
[]
no_license
bogba1/gumshot
acd0e0f6aab5f7f8898e65dbafd924c0f3aded43
d7f13866044f2d1a63566a3d3a5f9bae089ee746
refs/heads/master
2021-01-18T15:08:42.685134
2010-03-08T03:29:50
2010-03-08T03:29:50
40,660,288
0
0
null
null
null
null
UTF-8
C++
false
false
267
cpp
#include "..\include\CBGumGumResponse.h" CBGumGumResponse::CBGumGumResponse(void) { } CBGumGumResponse::~CBGumGumResponse(void) { } void CBGumGumResponse::contactsProcess(OgreNewt::ContactJoint &contactJoint, Ogre::Real timeStep, int threadIndex) { }
[ [ [ 1, 14 ] ] ]
326500a5bc65034d554103df1749238ee43894b7
25fd79ea3a1f2c552388420c5a02433d9cdf855d
/Pool/Billiards/HolePhantom.h
d29ab942d8fc3206653df92b30ae33f197030df2
[]
no_license
k-l-lambda/klspool
084cbe99a1dc3b9703233fccea3f2f6570df9d63
b57703169828f9d406e7d0a6cd326063832b12c6
refs/heads/master
2021-01-23T07:03:59.086914
2009-09-06T09:14:51
2009-09-06T09:14:51
32,123,777
0
0
null
null
null
null
UTF-8
C++
false
false
995
h
/* ** This source file is part of Pool. ** ** Copyright (c) 2009 K.L.<[email protected]>, Lazy<[email protected]> ** This program is free software without any warranty. */ #ifndef _HOLEPHANTOM_H_ #define _HOLEPHANTOM_H_ #include "Billiards.h" #include "HavokRef.h" // This class implementation a hole phantom to dectetion falling balls. namespace Billiards { class HolePhantom : public hkpSimpleShapePhantom { public: HolePhantom( const hkpShape *shape, const hkTransform &transform, hkUint32 m_collisionFilterInfo=0 ); //bool isBallFalling(); // Callback implementation virtual void addOverlappingCollidable( hkpCollidable* c ); virtual void removeOverlappingCollidable( hkpCollidable* c ); static void setBallList(std::vector<BallPtr>* balls); private: static std::vector<BallPtr>* m_AllBalls; std::list<BallPtr> m_collidingList; hkVector4 m_position; }; } #endif
[ "[email protected]@64c72148-2b1e-11de-874f-bb9810f3bc79" ]
[ [ [ 1, 42 ] ] ]
334d4b40866c14d365f0740b10cf2f192f333b50
580738f96494d426d6e5973c5b3493026caf8b6a
/Include/Vcl/teengine.hpp
74dad82632ab81f16348960b25b22c5e9b4137d1
[]
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
53,944
hpp
// Borland C++ Builder // Copyright (c) 1995, 2002 by Borland Software Corporation // All rights reserved // (DO NOT EDIT: machine generated header) 'TeEngine.pas' rev: 6.00 #ifndef TeEngineHPP #define TeEngineHPP #pragma delphiheader begin #pragma option push -w- #pragma option push -Vx #include <ExtCtrls.hpp> // Pascal unit #include <TeCanvas.hpp> // Pascal unit #include <TeeProcs.hpp> // Pascal unit #include <Classes.hpp> // Pascal unit #include <SysUtils.hpp> // Pascal unit #include <Controls.hpp> // Pascal unit #include <Graphics.hpp> // Pascal unit #include <Windows.hpp> // Pascal unit #include <SysInit.hpp> // Pascal unit #include <System.hpp> // Pascal unit //-- user supplied ----------------------------------------------------------- namespace Teengine { //-- type declarations ------------------------------------------------------- #pragma option push -b- enum TSeriesMarksStyle { smsValue, smsPercent, smsLabel, smsLabelPercent, smsLabelValue, smsLegend, smsPercentTotal, smsLabelPercentTotal, smsXValue }; #pragma option pop typedef double *PChartValue; typedef double TChartValue; #pragma option push -b- enum TChartListOrder { loNone, loAscending, loDescending }; #pragma option pop class DELPHICLASS TChartValueList; class DELPHICLASS TChartSeries; class DELPHICLASS TChartAxis; class DELPHICLASS TCustomChartAxis; class DELPHICLASS TChartAxisTitle; class PASCALIMPLEMENTATION TChartAxisTitle : public Teeprocs::TChartFontObject { typedef Teeprocs::TChartFontObject inherited; private: int FAngle; TCustomChartAxis* FAxis; AnsiString FCaption; bool __fastcall IsAngleStored(void); void __fastcall SetAngle(int Value); void __fastcall SetCaption(const AnsiString Value); public: virtual void __fastcall Assign(Classes::TPersistent* Source); __published: __property int Angle = {read=FAngle, write=SetAngle, stored=IsAngleStored, nodefault}; __property AnsiString Caption = {read=FCaption, write=SetCaption}; __property Font ; public: #pragma option push -w-inl /* TChartFontObject.Create */ inline __fastcall TChartAxisTitle(Teeprocs::TCustomTeePanel* AOwner) : Teeprocs::TChartFontObject(AOwner) { } #pragma option pop #pragma option push -w-inl /* TChartFontObject.Destroy */ inline __fastcall virtual ~TChartAxisTitle(void) { } #pragma option pop }; #pragma option push -b- enum TAxisLabelStyle { talAuto, talNone, talValue, talMark, talText }; #pragma option pop class DELPHICLASS TCustomAxisPanel; class DELPHICLASS TChartSeriesList; class PASCALIMPLEMENTATION TChartSeriesList : public Classes::TList { typedef Classes::TList inherited; public: TChartSeries* operator[](int Index) { return Series[Index]; } private: TCustomAxisPanel* FOwner; void __fastcall SetSeries(int Index, TChartSeries* Series); TChartSeries* __fastcall GetSeries(int Index); public: int __fastcall CountActive(void); __property TCustomAxisPanel* Owner = {read=FOwner}; __property TChartSeries* Series[int Index] = {read=GetSeries, write=SetSeries/*, default*/}; public: #pragma option push -w-inl /* TList.Destroy */ inline __fastcall virtual ~TChartSeriesList(void) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Create */ inline __fastcall TChartSeriesList(void) : Classes::TList() { } #pragma option pop }; class DELPHICLASS TChartDepthAxis; class PASCALIMPLEMENTATION TCustomChartAxis : public Classes::TPersistent { typedef Classes::TPersistent inherited; private: bool FAutomatic; bool FAutomaticMaximum; bool FAutomaticMinimum; double FDesiredIncrement; double FMaximumValue; double FMinimumValue; bool FLogarithmic; int FLogarithmicBase; Tecanvas::TChartAxisPen* FAxis; int FPosAxis; TChartAxisTitle* FAxisTitle; int FTitleSize; int FPosTitle; Tecanvas::TDottedGrayPen* FGrid; bool FGridCentered; bool FLabels; int FLabelsAngle; Graphics::TFont* FLabelsFont; bool FLabelsOnAxis; int FLabelsSeparation; int FLabelsSize; TAxisLabelStyle FLabelStyle; int FPosLabels; AnsiString FAxisValuesFormat; AnsiString FDateTimeFormat; bool FExactDateTime; bool FRoundFirstLabel; bool FLabelsMultiLine; Tecanvas::TChartHiddenPen* FMinorGrid; int FMinorTickCount; int FMinorTickLength; Tecanvas::TDarkGrayPen* FMinorTicks; Tecanvas::TDarkGrayPen* FTicks; Tecanvas::TDarkGrayPen* FTicksInner; int FTickInnerLength; int FTickLength; bool FTickOnLabelsOnly; bool FInverted; bool FHorizontal; bool FOtherSide; TCustomAxisPanel* FParentChart; bool FVisible; double FStartPosition; double FEndPosition; double FPositionPercent; double IMaximum; double IMinimum; double IRange; bool IAxisDateTime; int ICenterPos; int IDefaultTitleAngle; void __fastcall SetAutomatic(bool Value); void __fastcall SetAutomaticMinimum(bool Value); void __fastcall SetAutomaticMaximum(bool Value); void __fastcall SetAxis(Tecanvas::TChartAxisPen* Value); void __fastcall SetAxisTitle(TChartAxisTitle* Value); void __fastcall SetDateTimeFormat(const AnsiString Value); void __fastcall SetDesiredIncrement(const double Value); void __fastcall SetExactDateTime(bool Value); void __fastcall SetGrid(Tecanvas::TDottedGrayPen* Value); void __fastcall SetGridCentered(bool Value); void __fastcall SetInverted(bool Value); void __fastcall SetLabels(bool Value); void __fastcall SetLabelsFont(Graphics::TFont* Value); void __fastcall SetLabelStyle(TAxisLabelStyle Value); void __fastcall SetLabelsOnAxis(bool Value); void __fastcall SetLabelsAngle(int Value); void __fastcall SetLabelsMultiLine(bool Value); void __fastcall SetLabelsSeparation(int Value); void __fastcall SetLabelsSize(int Value); void __fastcall SetLogarithmic(bool Value); void __fastcall SetLogarithmicBase(int Value); void __fastcall SetMaximum(const double Value); void __fastcall SetMinimum(const double Value); void __fastcall SetMinorGrid(Tecanvas::TChartHiddenPen* Value); void __fastcall SetMinorTickCount(int Value); void __fastcall SetMinorTickLength(int Value); void __fastcall SetMinorTicks(Tecanvas::TDarkGrayPen* Value); void __fastcall SetStartPosition(const double Value); void __fastcall SetEndPosition(const double Value); void __fastcall SetPositionPercent(const double Value); void __fastcall SetRoundFirstLabel(bool Value); void __fastcall SetTickLength(int Value); void __fastcall SetTickInnerLength(int Value); void __fastcall SetTicks(Tecanvas::TDarkGrayPen* Value); void __fastcall SetTicksInner(Tecanvas::TDarkGrayPen* Value); void __fastcall SetTickOnLabelsOnly(bool Value); void __fastcall SetTitleSize(int Value); void __fastcall SetValuesFormat(const AnsiString Value); void __fastcall SetVisible(bool Value); int __fastcall ApplyPosition(int APos, const Types::TRect &R); double __fastcall CalcDateTimeIncrement(int MaxNumLabels); double __fastcall CalcLabelsIncrement(int MaxNumLabels); int __fastcall GetRectangleEdge(const Types::TRect &R); int __fastcall InternalCalcLogPosValue(bool IsX, const double Value); int __fastcall InternalCalcDepthPosValue(const double Value); double __fastcall InternalCalcLog(double &LogMax, double &LogMin); int __fastcall InternalCalcPosValue(const double Value, bool FromEnd); bool __fastcall IsAxisValuesFormatStored(void); bool __fastcall IsFontStored(void); bool __fastcall IsMaxStored(void); bool __fastcall IsMinStored(void); bool __fastcall IsPosStored(void); bool __fastcall IsStartStored(void); bool __fastcall IsEndStored(void); public: int IStartPos; int IEndPos; int IAxisSize; bool IsDepthAxis; void __fastcall InternalCalcPositions(void); int __fastcall InternalCalcSize(Graphics::TFont* tmpFont, int tmpAngle, const AnsiString tmpText, int tmpSize); void __fastcall InternalSetInverted(bool Value); void __fastcall CalcRect(Types::TRect &R, bool InflateChartRectangle); void __fastcall InternalSetMaximum(const double Value); void __fastcall InternalSetMinimum(const double Value); int __fastcall SizeTickAxis(void); int __fastcall SizeTitle(void); int __fastcall SizeLabels(void); void __fastcall RecalcSizeCenter(void); __fastcall TCustomChartAxis(TCustomAxisPanel* AOwner); __fastcall virtual ~TCustomChartAxis(void); int __fastcall MaxLabelsWidth(void); int __fastcall LabelWidth(const double Value); int __fastcall LabelHeight(const double Value); AnsiString __fastcall LabelValue(const double Value); TAxisLabelStyle __fastcall CalcLabelStyle(void); void __fastcall DrawTitle(int x, int y); void __fastcall DrawAxisLabel(int x, int y, int Angle, const AnsiString St); int __fastcall CalcPosValue(const double Value); int __fastcall CalcXPosValue(const double Value); int __fastcall CalcYPosValue(const double Value); int __fastcall CalcSizeValue(const double Value); double __fastcall CalcPosPoint(int Value); void __fastcall CustomDrawMinMax(int APosLabels, int APosTitle, int APosAxis, bool GridVisible, const double AMinimum, const double AMaximum, const double AIncrement); void __fastcall CustomDraw(int APosLabels, int APosTitle, int APosAxis, bool GridVisible); void __fastcall CustomDrawStartEnd(int APosLabels, int APosTitle, int APosAxis, bool GridVisible, int AStartPos, int AEndPos); void __fastcall CustomDrawMinMaxStartEnd(int APosLabels, int APosTitle, int APosAxis, bool GridVisible, const double AMinimum, const double AMaximum, const double AIncrement, int AStartPos, int AEndPos); void __fastcall Draw(bool CalcPosAxis); virtual void __fastcall Assign(Classes::TPersistent* Source); void __fastcall AdjustMaxMin(void); void __fastcall CalcMinMax(double &AMin, double &AMax); void __fastcall Scroll(const double Offset, bool CheckLimits); bool __fastcall Clicked(int x, int y); bool __fastcall IsDateTime(void); void __fastcall SetMinMax(double AMin, double AMax); double __fastcall CalcXYIncrement(int MaxLabelSize); double __fastcall CalcIncrement(void); void __fastcall AdjustMaxMinRect(const Types::TRect &Rect); void __fastcall IncDecDateTime(bool Increment, double &Value, const double AnIncrement, Teeprocs::TDateTimeStep tmpWhichDateTime); __property bool Horizontal = {read=FHorizontal, write=FHorizontal, nodefault}; __property bool OtherSide = {read=FOtherSide, write=FOtherSide, nodefault}; __property int PosAxis = {read=FPosAxis, nodefault}; __property int PosLabels = {read=FPosLabels, nodefault}; __property int PosTitle = {read=FPosTitle, nodefault}; __property TCustomAxisPanel* ParentChart = {read=FParentChart}; __property bool Automatic = {read=FAutomatic, write=SetAutomatic, default=1}; __property bool AutomaticMaximum = {read=FAutomaticMaximum, write=SetAutomaticMaximum, default=1}; __property bool AutomaticMinimum = {read=FAutomaticMinimum, write=SetAutomaticMinimum, default=1}; __property Tecanvas::TChartAxisPen* Axis = {read=FAxis, write=SetAxis}; __property AnsiString AxisValuesFormat = {read=FAxisValuesFormat, write=SetValuesFormat, stored=IsAxisValuesFormatStored}; __property AnsiString DateTimeFormat = {read=FDateTimeFormat, write=SetDateTimeFormat}; __property bool ExactDateTime = {read=FExactDateTime, write=SetExactDateTime, default=1}; __property Tecanvas::TDottedGrayPen* Grid = {read=FGrid, write=SetGrid}; __property bool GridCentered = {read=FGridCentered, write=SetGridCentered, default=0}; __property double Increment = {read=FDesiredIncrement, write=SetDesiredIncrement}; __property bool Inverted = {read=FInverted, write=SetInverted, default=0}; __property bool Labels = {read=FLabels, write=SetLabels, default=1}; __property int LabelsAngle = {read=FLabelsAngle, write=SetLabelsAngle, default=0}; __property Graphics::TFont* LabelsFont = {read=FLabelsFont, write=SetLabelsFont, stored=IsFontStored}; __property bool LabelsMultiLine = {read=FLabelsMultiLine, write=SetLabelsMultiLine, default=0}; __property bool LabelsOnAxis = {read=FLabelsOnAxis, write=SetLabelsOnAxis, default=1}; __property int LabelsSeparation = {read=FLabelsSeparation, write=SetLabelsSeparation, default=10}; __property int LabelsSize = {read=FLabelsSize, write=SetLabelsSize, default=0}; __property TAxisLabelStyle LabelStyle = {read=FLabelStyle, write=SetLabelStyle, default=0}; __property bool Logarithmic = {read=FLogarithmic, write=SetLogarithmic, default=0}; __property int LogarithmicBase = {read=FLogarithmicBase, write=SetLogarithmicBase, default=10}; __property double Maximum = {read=FMaximumValue, write=SetMaximum, stored=IsMaxStored}; __property double Minimum = {read=FMinimumValue, write=SetMinimum, stored=IsMinStored}; __property Tecanvas::TChartHiddenPen* MinorGrid = {read=FMinorGrid, write=SetMinorGrid}; __property int MinorTickCount = {read=FMinorTickCount, write=SetMinorTickCount, default=3}; __property int MinorTickLength = {read=FMinorTickLength, write=SetMinorTickLength, default=2}; __property Tecanvas::TDarkGrayPen* MinorTicks = {read=FMinorTicks, write=SetMinorTicks}; __property double StartPosition = {read=FStartPosition, write=SetStartPosition, stored=IsStartStored}; __property double EndPosition = {read=FEndPosition, write=SetEndPosition, stored=IsEndStored}; __property double PositionPercent = {read=FPositionPercent, write=SetPositionPercent, stored=IsPosStored}; __property bool RoundFirstLabel = {read=FRoundFirstLabel, write=SetRoundFirstLabel, default=1}; __property int TickInnerLength = {read=FTickInnerLength, write=SetTickInnerLength, default=0}; __property int TickLength = {read=FTickLength, write=SetTickLength, default=4}; __property Tecanvas::TDarkGrayPen* Ticks = {read=FTicks, write=SetTicks}; __property Tecanvas::TDarkGrayPen* TicksInner = {read=FTicksInner, write=SetTicksInner}; __property bool TickOnLabelsOnly = {read=FTickOnLabelsOnly, write=SetTickOnLabelsOnly, default=1}; __property TChartAxisTitle* Title = {read=FAxisTitle, write=SetAxisTitle}; __property int TitleSize = {read=FTitleSize, write=SetTitleSize, default=0}; __property bool Visible = {read=FVisible, write=SetVisible, default=1}; }; class PASCALIMPLEMENTATION TChartDepthAxis : public TCustomChartAxis { typedef TCustomChartAxis inherited; __published: __property Automatic = {default=1}; __property AutomaticMaximum = {default=1}; __property AutomaticMinimum = {default=1}; __property Axis ; __property AxisValuesFormat ; __property DateTimeFormat ; __property ExactDateTime = {default=1}; __property Grid ; __property Increment ; __property Inverted = {default=0}; __property Labels = {default=1}; __property LabelsAngle = {default=0}; __property LabelsFont ; __property LabelsMultiLine = {default=0}; __property LabelsOnAxis = {default=1}; __property LabelsSeparation = {default=10}; __property LabelsSize = {default=0}; __property LabelStyle = {default=0}; __property Logarithmic = {default=0}; __property LogarithmicBase = {default=10}; __property Maximum ; __property Minimum ; __property MinorGrid ; __property MinorTickCount = {default=3}; __property MinorTickLength = {default=2}; __property MinorTicks ; __property RoundFirstLabel = {default=1}; __property TickInnerLength = {default=0}; __property TickLength = {default=4}; __property TickOnLabelsOnly = {default=1}; __property Ticks ; __property TicksInner ; __property Title ; __property TitleSize = {default=0}; __property Visible = {default=0}; public: #pragma option push -w-inl /* TCustomChartAxis.Create */ inline __fastcall TChartDepthAxis(TCustomAxisPanel* AOwner) : TCustomChartAxis(AOwner) { } #pragma option pop #pragma option push -w-inl /* TCustomChartAxis.Destroy */ inline __fastcall virtual ~TChartDepthAxis(void) { } #pragma option pop }; typedef void __fastcall (__closure *TAxisOnGetLabel)(TChartAxis* Sender, TChartSeries* Series, int ValueIndex, AnsiString &LabelText); typedef void __fastcall (__closure *TAxisOnGetNextLabel)(TChartAxis* Sender, int LabelIndex, double &LabelValue, bool &Stop); class PASCALIMPLEMENTATION TCustomAxisPanel : public Teeprocs::TCustomTeePanelExtended { typedef Teeprocs::TCustomTeePanelExtended inherited; public: TChartSeries* operator[](int Index) { return Series[Index]; } private: TChartSeriesList* FSeriesList; TChartDepthAxis* FDepthAxis; TChartAxis* FTopAxis; TChartAxis* FBottomAxis; TChartAxis* FLeftAxis; TChartAxis* FRightAxis; bool FView3DWalls; bool FClipPoints; bool FAxisVisible; TAxisOnGetLabel FOnGetAxisLabel; TAxisOnGetNextLabel FOnGetNextAxisLabel; Classes::TNotifyEvent FOnPageChange; Classes::TNotifyEvent FOnBeforeDrawAxes; Classes::TNotifyEvent FOnBeforeDrawSeries; int FPage; int FMaxPointsPerPage; bool FScaleLastPage; int FMaxZOrder; int FSeriesWidth3D; int FSeriesHeight3D; void __fastcall CheckOtherSeries(TChartSeries* Dest, TChartSeries* Source); TChartSeries* __fastcall GetSeries(int Index); void __fastcall InternalAddSeries(TChartSeries* ASeries); double __fastcall InternalMinMax(TCustomChartAxis* AAxis, bool IsMin, bool IsX); bool __fastcall NoActiveSeries(TCustomChartAxis* AAxis); void __fastcall SetAxisVisible(bool Value); void __fastcall SetBottomAxis(TChartAxis* Value); void __fastcall SetClipPoints(bool Value); void __fastcall SetDepthAxis(TChartDepthAxis* Value); void __fastcall SetLeftAxis(TChartAxis* Value); void __fastcall SetMaxPointsPerPage(int Value); void __fastcall SetRightAxis(TChartAxis* Value); void __fastcall SetScaleLastPage(bool Value); void __fastcall SetTopAxis(TChartAxis* Value); void __fastcall SetView3DWalls(bool Value); protected: Classes::TList* FAxes; virtual void __fastcall CalcAxisRect(void) = 0 ; virtual void __fastcall CalcSeriesRect(void) = 0 ; virtual int __fastcall CalcWallSize(TCustomChartAxis* Axis) = 0 ; virtual void __fastcall DrawTitlesAndLegend(void) = 0 ; virtual void __fastcall DrawWalls(void) = 0 ; bool __fastcall IsAxisVisible(TCustomChartAxis* Axis); DYNAMIC void __fastcall RemovedDataSource(TChartSeries* ASeries, Classes::TComponent* AComponent); virtual void __fastcall SetPage(int Value); DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root); public: Graphics::TColor LegendColor; __fastcall virtual TCustomAxisPanel(Classes::TComponent* AOwner); __fastcall virtual ~TCustomAxisPanel(void); virtual void __fastcall Assign(Classes::TPersistent* Source); TChartSeries* __fastcall ActiveSeriesLegend(int ItemIndex); void __fastcall AddSeries(TChartSeries* ASeries); void __fastcall CalcSize3DWalls(void); virtual void __fastcall CheckDatasource(TChartSeries* ASeries); virtual AnsiString __fastcall FormattedValueLegend(TChartSeries* ASeries, int ValueIndex); void __fastcall FreeAllSeries(void); TChartSeries* __fastcall GetAxisSeries(TCustomChartAxis* Axis); Graphics::TColor __fastcall GetFreeSeriesColor(bool CheckBackground); int __fastcall GetMaxValuesCount(void); virtual void __fastcall InternalDraw(const Types::TRect &UserRectangle); virtual bool __fastcall IsFreeSeriesColor(Graphics::TColor AColor, bool CheckBackground) = 0 ; virtual bool __fastcall IsValidDataSource(TChartSeries* ASeries, Classes::TComponent* AComponent); double __fastcall MaxXValue(TChartAxis* AAxis); double __fastcall MaxYValue(TChartAxis* AAxis); double __fastcall MinXValue(TChartAxis* AAxis); double __fastcall MinYValue(TChartAxis* AAxis); int __fastcall MaxMarkWidth(void); int __fastcall MaxTextWidth(void); DYNAMIC int __fastcall NumPages(void); void __fastcall RemoveSeries(TChartSeries* ASeries); __property TChartSeries* Series[int Index] = {read=GetSeries/*, default*/}; int __fastcall SeriesCount(void); AnsiString __fastcall SeriesTitleLegend(int SeriesIndex); __property Classes::TList* AxesList = {read=FAxes}; __property int MaxZOrder = {read=FMaxZOrder, write=FMaxZOrder, nodefault}; __property int SeriesWidth3D = {read=FSeriesWidth3D, nodefault}; __property int SeriesHeight3D = {read=FSeriesHeight3D, nodefault}; __property bool AxisVisible = {read=FAxisVisible, write=SetAxisVisible, default=1}; __property TChartAxis* BottomAxis = {read=FBottomAxis, write=SetBottomAxis}; __property bool ClipPoints = {read=FClipPoints, write=SetClipPoints, default=1}; __property Color = {default=-2147483633}; __property TChartDepthAxis* DepthAxis = {read=FDepthAxis, write=SetDepthAxis}; __property TChartAxis* LeftAxis = {read=FLeftAxis, write=SetLeftAxis}; __property int MaxPointsPerPage = {read=FMaxPointsPerPage, write=SetMaxPointsPerPage, default=0}; __property int Page = {read=FPage, write=SetPage, default=1}; __property TChartAxis* RightAxis = {read=FRightAxis, write=SetRightAxis}; __property bool ScaleLastPage = {read=FScaleLastPage, write=SetScaleLastPage, default=1}; __property TChartSeriesList* SeriesList = {read=FSeriesList}; __property TChartAxis* TopAxis = {read=FTopAxis, write=SetTopAxis}; __property bool View3DWalls = {read=FView3DWalls, write=SetView3DWalls, default=1}; __property Classes::TNotifyEvent OnBeforeDrawAxes = {read=FOnBeforeDrawAxes, write=FOnBeforeDrawAxes}; __property Classes::TNotifyEvent OnBeforeDrawSeries = {read=FOnBeforeDrawSeries, write=FOnBeforeDrawSeries}; __property TAxisOnGetLabel OnGetAxisLabel = {read=FOnGetAxisLabel, write=FOnGetAxisLabel}; __property TAxisOnGetNextLabel OnGetNextAxisLabel = {read=FOnGetNextAxisLabel, write=FOnGetNextAxisLabel}; __property Classes::TNotifyEvent OnPageChange = {read=FOnPageChange, write=FOnPageChange}; public: #pragma option push -w-inl /* TWinControl.CreateParented */ inline __fastcall TCustomAxisPanel(HWND ParentWindow) : Teeprocs::TCustomTeePanelExtended(ParentWindow) { } #pragma option pop }; class PASCALIMPLEMENTATION TChartAxis : public TCustomChartAxis { typedef TCustomChartAxis inherited; __published: __property Automatic = {default=1}; __property AutomaticMaximum = {default=1}; __property AutomaticMinimum = {default=1}; __property Axis ; __property AxisValuesFormat ; __property DateTimeFormat ; __property ExactDateTime = {default=1}; __property Grid ; __property GridCentered = {default=0}; __property Increment ; __property Inverted = {default=0}; __property Labels = {default=1}; __property LabelsAngle = {default=0}; __property LabelsFont ; __property LabelsMultiLine = {default=0}; __property LabelsOnAxis = {default=1}; __property LabelsSeparation = {default=10}; __property LabelsSize = {default=0}; __property LabelStyle = {default=0}; __property Logarithmic = {default=0}; __property LogarithmicBase = {default=10}; __property Maximum ; __property Minimum ; __property MinorGrid ; __property MinorTickCount = {default=3}; __property MinorTickLength = {default=2}; __property MinorTicks ; __property StartPosition ; __property EndPosition ; __property PositionPercent ; __property RoundFirstLabel = {default=1}; __property TickInnerLength = {default=0}; __property TickLength = {default=4}; __property TickOnLabelsOnly = {default=1}; __property Ticks ; __property TicksInner ; __property Title ; __property TitleSize = {default=0}; __property Visible = {default=1}; public: #pragma option push -w-inl /* TCustomChartAxis.Create */ inline __fastcall TChartAxis(TCustomAxisPanel* AOwner) : TCustomChartAxis(AOwner) { } #pragma option pop #pragma option push -w-inl /* TCustomChartAxis.Destroy */ inline __fastcall virtual ~TChartAxis(void) { } #pragma option pop }; class DELPHICLASS TSeriesMarks; class DELPHICLASS TSeriesMarksPositions; class DELPHICLASS TSeriesMarkPosition; class PASCALIMPLEMENTATION TSeriesMarksPositions : public Classes::TList { typedef Classes::TList inherited; public: TSeriesMarkPosition* operator[](int Index) { return Position[Index]; } private: void __fastcall SetPosition(int Index, TSeriesMarkPosition* APosition); TSeriesMarkPosition* __fastcall GetPosition(int Index); public: void __fastcall Automatic(int Index); __property TSeriesMarkPosition* Position[int Index] = {read=GetPosition, write=SetPosition/*, default*/}; public: #pragma option push -w-inl /* TList.Destroy */ inline __fastcall virtual ~TSeriesMarksPositions(void) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Create */ inline __fastcall TSeriesMarksPositions(void) : Classes::TList() { } #pragma option pop }; class PASCALIMPLEMENTATION TSeriesMarks : public Classes::TPersistent { typedef Classes::TPersistent inherited; private: Tecanvas::TChartArrowPen* FArrow; int FArrowLength; Graphics::TColor FBackColor; bool FBackTransparent; bool FClip; Tecanvas::TChartPen* FFrame; Graphics::TFont* FFont; TSeriesMarksStyle FMarkerStyle; TChartSeries* FParent; TSeriesMarksPositions* FPositions; bool FVisible; int FZPosition; void __fastcall SetStyle(TSeriesMarksStyle Value); void __fastcall SetFont(Graphics::TFont* Value); void __fastcall SetClip(bool Value); void __fastcall SetFrame(Tecanvas::TChartPen* Value); void __fastcall SetArrow(Tecanvas::TChartArrowPen* Value); void __fastcall SetArrowLength(int Value); bool __fastcall IsFontStored(void); void __fastcall SetVisible(bool Value); void __fastcall SetBackColor(Graphics::TColor Value); void __fastcall SetBackTransparent(bool Value); protected: void __fastcall ClearPositions(void); void __fastcall UsePosition(int Index, TSeriesMarkPosition* &MarkPosition); public: __fastcall TSeriesMarks(TChartSeries* AOwner); __fastcall virtual ~TSeriesMarks(void); virtual void __fastcall Assign(Classes::TPersistent* Source); int __fastcall Clicked(int X, int Y); void __fastcall Draw(int Index, Graphics::TColor AColor, const AnsiString St, TSeriesMarkPosition* APosition); __property TChartSeries* ParentSeries = {read=FParent}; __property TSeriesMarksPositions* Positions = {read=FPositions}; __property int ZPosition = {read=FZPosition, write=FZPosition, nodefault}; __published: __property Tecanvas::TChartArrowPen* Arrow = {read=FArrow, write=SetArrow}; __property int ArrowLength = {read=FArrowLength, write=SetArrowLength, nodefault}; __property Graphics::TColor BackColor = {read=FBackColor, write=SetBackColor, default=8454143}; __property bool Clip = {read=FClip, write=SetClip, default=0}; __property Graphics::TFont* Font = {read=FFont, write=SetFont, stored=IsFontStored}; __property Tecanvas::TChartPen* Frame = {read=FFrame, write=SetFrame}; __property TSeriesMarksStyle Style = {read=FMarkerStyle, write=SetStyle, default=2}; __property bool Transparent = {read=FBackTransparent, write=SetBackTransparent, default=0}; __property bool Visible = {read=FVisible, write=SetVisible, nodefault}; }; class DELPHICLASS TChartValueLists; class PASCALIMPLEMENTATION TChartValueLists : public Classes::TList { typedef Classes::TList inherited; public: TChartValueList* operator[](int Index) { return ValueList[Index]; } private: TChartValueList* __fastcall GetValueList(int Index); public: __property TChartValueList* ValueList[int Index] = {read=GetValueList/*, default*/}; public: #pragma option push -w-inl /* TList.Destroy */ inline __fastcall virtual ~TChartValueLists(void) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Create */ inline __fastcall TChartValueLists(void) : Classes::TList() { } #pragma option pop }; #pragma option push -b- enum THorizAxis { aTopAxis, aBottomAxis, aBothHorizAxis, aCustomHorizAxis }; #pragma option pop #pragma option push -b- enum TVertAxis { aLeftAxis, aRightAxis, aBothVertAxis, aCustomVertAxis }; #pragma option pop #pragma option push -b- enum TeEngine__21 { rOnDelete, rOnModify, rOnInsert, rOnClear }; #pragma option pop typedef Set<TeEngine__21, rOnDelete, rOnClear> TSeriesRecalcOptions; class DELPHICLASS TTeeFunction; #pragma option push -b- enum TFunctionPeriodStyle { psNumPoints, psRange }; #pragma option pop #pragma option push -b- enum TFunctionPeriodAlign { paFirst, paCenter, paLast }; #pragma option pop class PASCALIMPLEMENTATION TTeeFunction : public Classes::TComponent { typedef Classes::TComponent inherited; private: double FPeriod; TFunctionPeriodStyle FPeriodStyle; TFunctionPeriodAlign FPeriodAlign; TChartSeries* FParent; bool FUpdating; void __fastcall SetPeriod(const double Value); void __fastcall SetParentSeries(TChartSeries* AParent); void __fastcall SetPeriodAlign(TFunctionPeriodAlign Value); void __fastcall SetPeriodStyle(TFunctionPeriodStyle Value); protected: bool CanUsePeriod; DYNAMIC void __fastcall SetParentComponent(Classes::TComponent* Value); void __fastcall InternalSetPeriod(const double APeriod); void __fastcall AddFunctionXY(bool YMandatorySource, double tmpX, double tmpY); virtual void __fastcall CalculatePeriod(TChartSeries* Source, const double tmpX, int FirstIndex, int LastIndex); virtual void __fastcall CalculateAllPoints(TChartSeries* Source, TChartValueList* NotMandatorySource); virtual void __fastcall CalculateByPeriod(TChartSeries* Source, TChartValueList* NotMandatorySource); TChartValueList* __fastcall ValueList(TChartSeries* ASeries); public: bool MovingFunction; __fastcall virtual TTeeFunction(Classes::TComponent* AOwner); virtual void __fastcall Assign(Classes::TPersistent* Source); void __fastcall BeginUpdate(void); void __fastcall EndUpdate(void); void __fastcall ReCalculate(void); virtual double __fastcall Calculate(TChartSeries* Series, int First, int Last); virtual double __fastcall CalculateMany(Classes::TList* SeriesList, int ValueIndex); virtual void __fastcall AddPoints(TChartSeries* Source); DYNAMIC Classes::TComponent* __fastcall GetParentComponent(void); DYNAMIC bool __fastcall HasParent(void); __property TChartSeries* ParentSeries = {read=FParent, write=SetParentSeries}; __published: __property double Period = {read=FPeriod, write=SetPeriod}; __property TFunctionPeriodAlign PeriodAlign = {read=FPeriodAlign, write=SetPeriodAlign, default=1}; __property TFunctionPeriodStyle PeriodStyle = {read=FPeriodStyle, write=SetPeriodStyle, default=0}; public: #pragma option push -w-inl /* TComponent.Destroy */ inline __fastcall virtual ~TTeeFunction(void) { } #pragma option pop }; #pragma option push -b- enum TeEngine__51 { tssIsTemplate, tssDenyChangeType, tssDenyDelete, tssDenyClone, tssIsPersistent, tssHideDataSource }; #pragma option pop typedef Set<TeEngine__51, tssIsTemplate, tssHideDataSource> TChartSeriesStyle; typedef void __fastcall (__closure *TSeriesOnAfterAdd)(TChartSeries* Sender, int ValueIndex); typedef bool __fastcall (__closure *TSeriesOnBeforeAdd)(TChartSeries* Sender); typedef void __fastcall (__closure *TSeriesOnClear)(TChartSeries* Sender); typedef void __fastcall (__closure *TSeriesClick)(TChartSeries* Sender, int ValueIndex, Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); typedef void __fastcall (__closure *TSeriesOnGetMarkText)(TChartSeries* Sender, int ValueIndex, AnsiString &MarkText); #pragma option push -b- enum TValueEvent { veClear, veAdd, veDelete, veRefresh, veModify }; #pragma option pop #pragma option push -b- enum TLegendTextStyle { ltsPlain, ltsLeftValue, ltsRightValue, ltsLeftPercent, ltsRightPercent, ltsXValue }; #pragma option pop class PASCALIMPLEMENTATION TChartSeries : public Classes::TComponent { typedef Classes::TComponent inherited; private: bool FActive; Graphics::TColor FColor; bool FColorEachPoint; Classes::TList* FColors; AnsiString FColorSource; Controls::TCursor FCursor; Classes::TList* FDataSources; int FFirstVisibleIndex; TChartAxis* FGetHorizAxis; TChartAxis* FGetVertAxis; AnsiString FLabelsSource; int FLastVisibleIndex; Classes::TList* FLinkedSeries; TSeriesMarks* FMarks; TCustomAxisPanel* FParent; AnsiString FPercentFormat; bool FShowInLegend; Classes::TStringList* FTempDataSources; AnsiString FTitle; AnsiString FValueFormat; TChartValueLists* FValuesList; TChartValueList* FX; Classes::TList* FXLabels; TChartValueList* FY; THorizAxis FHorizAxis; TChartAxis* FCustomHorizAxis; TChartAxis* FCustomVertAxis; int FZOrder; TVertAxis FVertAxis; TSeriesRecalcOptions FRecalcOptions; TTeeFunction* FTeeFunction; TChartSeriesStyle FStyle; Classes::TNotifyEvent FAfterDrawValues; Classes::TNotifyEvent FBeforeDrawValues; TSeriesOnAfterAdd FOnAfterAdd; TSeriesOnBeforeAdd FOnBeforeAdd; TSeriesOnClear FOnClearValues; TSeriesClick FOnClick; TSeriesClick FOnDblClick; TSeriesOnGetMarkText FOnGetMarkText; AnsiString FIdentifier; void __fastcall InsertLabel(int ValueIndex, const AnsiString ALabel); char * __fastcall GetMemLabel(const AnsiString ALabel); void __fastcall FreeXLabel(int ValueIndex); double __fastcall GetValue(bool IsX, int ValueIndex); void __fastcall ReadData(Classes::TReader* Reader); void __fastcall WriteData(Classes::TWriter* Writer); void __fastcall ReadIdentifier(Classes::TReader* Reader); void __fastcall WriteIdentifier(Classes::TWriter* Writer); void __fastcall ReadStyle(Classes::TReader* Reader); void __fastcall WriteStyle(Classes::TWriter* Writer); void __fastcall InternalAddDataSource(Classes::TComponent* Value); void __fastcall RemoveAllLinkedSeries(void); void __fastcall SetTitle(AnsiString Value); void __fastcall SetValueFormat(const AnsiString Value); void __fastcall SetPercentFormat(const AnsiString Value); bool __fastcall IsValueFormatStored(void); bool __fastcall IsPercentFormatStored(void); void __fastcall SetHorizAxis(THorizAxis Value); void __fastcall SetVertAxis(TVertAxis Value); void __fastcall SetColorSource(const AnsiString Value); void __fastcall SetLabelsSource(const AnsiString Value); void __fastcall SetShowInLegend(bool Value); void __fastcall SetCustomHorizAxis(TChartAxis* Value); void __fastcall SetCustomVertAxis(TChartAxis* Value); int __fastcall GetZOrder(void); void __fastcall SetZOrder(int Value); void __fastcall RecalcGetAxis(void); protected: int IZOrder; virtual int __fastcall AddChartValue(TChartSeries* Source, int ValueIndex); virtual void __fastcall AddedValue(TChartSeries* Source, int ValueIndex); virtual void __fastcall AddValues(TChartSeries* Source); virtual void __fastcall ClearLists(void); virtual void __fastcall DefineProperties(Classes::TFiler* Filer); virtual void __fastcall DeletedValue(TChartSeries* Source, int ValueIndex); virtual void __fastcall DoAfterDrawValues(void); virtual void __fastcall DoBeforeDrawChart(void); virtual void __fastcall DoBeforeDrawValues(void); virtual void __fastcall DrawAllValues(void); virtual void __fastcall DrawMark(int ValueIndex, const AnsiString St, TSeriesMarkPosition* APosition); void __fastcall DrawMarks(void); virtual void __fastcall DrawValue(int ValueIndex); bool __fastcall FirstInZOrder(void); Classes::TComponent* __fastcall GetDataSource(void); AnsiString __fastcall GetMarkText(int ValueIndex); virtual Graphics::TColor __fastcall GetValueColor(int ValueIndex); virtual AnsiString __fastcall GetXLabel(int Index); virtual double __fastcall GetxValue(int Index); virtual double __fastcall GetyValue(int Index); virtual void __fastcall Loaded(void); virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); virtual void __fastcall NotifyNewValue(TChartSeries* Sender, int ValueIndex); void __fastcall NotifyValue(TValueEvent ValueEvent, int ValueIndex); virtual bool __fastcall MoreSameZOrder(void); virtual void __fastcall SetActive(bool Value); void __fastcall SetChartValueList(TChartValueList* &AValueList, TChartValueList* Value); virtual void __fastcall SetColorEachPoint(bool Value); void __fastcall SetDataSource(Classes::TComponent* Value); void __fastcall SetMarks(TSeriesMarks* Value); virtual void __fastcall SetParentChart(TCustomAxisPanel* Value); void __fastcall SetRecalcOptions(TSeriesRecalcOptions Value); virtual void __fastcall SetSeriesColor(Graphics::TColor AColor); void __fastcall SetValueColor(int ValueIndex, Graphics::TColor AColor); void __fastcall SetXLabel(int Index, const AnsiString AXLabel); void __fastcall SetXValue(int Index, const double Value); void __fastcall SetYValue(int Index, const double Value); void __fastcall SetXValues(TChartValueList* Value); void __fastcall SetYValues(TChartValueList* Value); DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root); DYNAMIC void __fastcall SetParentComponent(Classes::TComponent* AParent); public: bool CalcVisiblePoints; bool DrawBetweenPoints; bool AllowSinglePoint; bool HasZValues; int StartZ; int MiddleZ; int EndZ; __fastcall virtual TChartSeries(Classes::TComponent* AOwner); __fastcall virtual ~TChartSeries(void); virtual int __fastcall Add(const double AValue, const AnsiString ALabel = "", Graphics::TColor AColor = (Graphics::TColor)(0x20000000)); int __fastcall AddArray(const double * Values, const int Values_Size); void __fastcall AddLinkedSeries(TChartSeries* ASeries); virtual int __fastcall AddNull(const AnsiString ALabel = ""); virtual int __fastcall AddNullXY(const double X, const double Y, const AnsiString ALabel); int __fastcall AddX(const double AXValue, const AnsiString ALabel = "", Graphics::TColor AColor = (Graphics::TColor)(0x20000000)); virtual int __fastcall AddXY(const double AXValue, const double AYValue, const AnsiString ALabel = "", Graphics::TColor AColor = (Graphics::TColor)(0x20000000)); int __fastcall AddY(const double AYValue, const AnsiString ALabel = "", Graphics::TColor AColor = (Graphics::TColor)(0x20000000)); virtual void __fastcall Assign(Classes::TPersistent* Source); virtual bool __fastcall AssociatedToAxis(TCustomChartAxis* Axis); void __fastcall CalcRandomBounds(int NumValues, double &tmpX, double &StepX, double &tmpY, double &MinY, double &DifY); virtual void __fastcall Clear(void); int __fastcall Count(void); virtual int __fastcall CountLegendItems(void); virtual void __fastcall Delete(int ValueIndex); virtual void __fastcall FillSampleValues(int NumValues); virtual void __fastcall GalleryChanged3D(bool Is3D); DYNAMIC Classes::TComponent* __fastcall GetParentComponent(void); DYNAMIC bool __fastcall HasParent(void); bool __fastcall IsNull(int ValueIndex); virtual bool __fastcall IsValidSourceOf(TChartSeries* Value); virtual bool __fastcall IsValidSeriesSource(TChartSeries* Value); virtual int __fastcall LegendToValueIndex(int LegendIndex); virtual Graphics::TColor __fastcall LegendItemColor(int LegendIndex); virtual AnsiString __fastcall LegendString(int LegendIndex, TLegendTextStyle LegendTextStyle); __property Classes::TList* LinkedSeries = {read=FLinkedSeries}; virtual double __fastcall MaxXValue(void); virtual double __fastcall MaxYValue(void); virtual double __fastcall MaxZValue(void); virtual double __fastcall MinXValue(void); virtual double __fastcall MinYValue(void); virtual double __fastcall MinZValue(void); virtual int __fastcall NumSampleValues(void); virtual void __fastcall PrepareForGallery(bool IsEnabled); void __fastcall RemoveDataSource(Classes::TComponent* Value); void __fastcall RemoveLinkedSeries(TChartSeries* ASeries); void __fastcall Repaint(void); int __fastcall VisibleCount(void); __property TChartValueLists* ValuesLists = {read=FValuesList}; __property double XValue[int Index] = {read=GetxValue, write=SetXValue}; __property double YValue[int Index] = {read=GetyValue, write=SetYValue}; __property int ZOrder = {read=GetZOrder, write=SetZOrder, default=-1}; int __fastcall MaxMarkWidth(void); virtual AnsiString __fastcall GetEditorClass(); virtual int __fastcall CalcXPos(int ValueIndex); int __fastcall CalcXPosValue(const double Value); int __fastcall CalcXSizeValue(const double Value); virtual int __fastcall CalcYPos(int ValueIndex); int __fastcall CalcYPosValue(const double Value); int __fastcall CalcYSizeValue(const double Value); int __fastcall CalcPosValue(const double Value); double __fastcall XScreenToValue(int ScreenPos); double __fastcall YScreenToValue(int ScreenPos); AnsiString __fastcall XValueToText(const double AValue); AnsiString __fastcall YValueToText(const double AValue); void __fastcall ColorRange(TChartValueList* AValueList, const double FromValue, const double ToValue, Graphics::TColor AColor); void __fastcall CheckDataSource(void); virtual void __fastcall AddValue(int ValueIndex); __property Classes::TList* Labels = {read=FXLabels}; __property AnsiString XLabel[int Index] = {read=GetXLabel, write=SetXLabel}; __property AnsiString ValueMarkText[int Index] = {read=GetMarkText}; __property Graphics::TColor ValueColor[int Index] = {read=GetValueColor, write=SetValueColor}; __property TChartValueList* XValues = {read=FX, write=SetXValues}; __property TChartValueList* YValues = {read=FY, write=SetYValues}; virtual TChartValueList* __fastcall GetYValueList(AnsiString AListName); __property TChartAxis* GetVertAxis = {read=FGetVertAxis}; __property TChartAxis* GetHorizAxis = {read=FGetHorizAxis}; AnsiString __fastcall MarkPercent(int ValueIndex, bool AddTotal); virtual int __fastcall Clicked(int x, int y); void __fastcall RefreshSeries(void); __property int FirstValueIndex = {read=FFirstVisibleIndex, nodefault}; __property int LastValueIndex = {read=FLastVisibleIndex, nodefault}; virtual double __fastcall GetOriginValue(int ValueIndex); virtual double __fastcall GetMarkValue(int ValueIndex); void __fastcall AssignValues(TChartSeries* Source); bool __fastcall SameClass(TChartSeries* tmpSeries); virtual double __fastcall PointOrigin(int ValueIndex, bool SumAll); bool __fastcall YMandatory(void); virtual TChartValueList* __fastcall MandatoryValueList(void); virtual bool __fastcall DrawValuesForward(void); virtual bool __fastcall DrawSeriesForward(int ValueIndex); virtual void __fastcall SwapValueIndex(int a, int b); __property TSeriesRecalcOptions RecalcOptions = {read=FRecalcOptions, write=SetRecalcOptions, default=15}; virtual void __fastcall CalcZOrder(void); virtual void __fastcall DoSeriesMouseMove(Classes::TShiftState Shift, int X, int Y); virtual bool __fastcall DoSeriesClick(TChartSeries* Sender, int ValueIndex, Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); virtual void __fastcall DoSeriesMouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y); int __fastcall GetCursorValueIndex(void); void __fastcall GetCursorValues(double &x, double &y); virtual void __fastcall ClearTempValue(TChartValueList* ValueList); virtual void __fastcall DrawLegend(int ValueIndex, const Types::TRect &Rect); virtual void __fastcall DrawLegendShape(int ValueIndex, const Types::TRect &Rect); virtual void __fastcall PrepareLegendCanvas(int ValueIndex, Graphics::TColor &BackColor, Graphics::TBrushStyle &BrushStyle); virtual void __fastcall CalcHorizMargins(int &LeftMargin, int &RightMargin); virtual void __fastcall CalcVerticalMargins(int &TopMargin, int &BottomMargin); virtual bool __fastcall UseAxis(void); virtual void __fastcall SetFunction(TTeeFunction* AFunction); void __fastcall CalcFirstLastVisibleIndex(void); Tecanvas::TChartPen* __fastcall CreateChartPen(void); virtual void __fastcall CanvasChanged(System::TObject* Sender); __property Classes::TList* DataSources = {read=FDataSources}; __property TTeeFunction* FunctionType = {read=FTeeFunction}; void __fastcall SetLongintProperty(int &Variable, int Value); void __fastcall SetIntegerProperty(int &Variable, int Value); void __fastcall SetStringProperty(AnsiString &Variable, const AnsiString Value); void __fastcall SetBooleanProperty(bool &Variable, bool Value); void __fastcall SetColorProperty(Graphics::TColor &Variable, Graphics::TColor Value); void __fastcall SetDoubleProperty(double &Variable, const double Value); void __fastcall CheckOtherSeries(TChartSeries* Source); virtual void __fastcall GetBitmapEditor(Graphics::TBitmap* ABitmap); void __fastcall ReplaceList(TChartValueList* OldList, TChartValueList* NewList); __property AnsiString Identifier = {read=FIdentifier, write=FIdentifier}; __property TChartSeriesStyle Style = {read=FStyle, write=FStyle, default=0}; __property TChartAxis* CustomHorizAxis = {read=FCustomHorizAxis, write=SetCustomHorizAxis}; __property TChartAxis* CustomVertAxis = {read=FCustomVertAxis, write=SetCustomVertAxis}; __published: __property bool Active = {read=FActive, write=SetActive, default=1}; __property bool ColorEachPoint = {read=FColorEachPoint, write=SetColorEachPoint, default=0}; __property AnsiString ColorSource = {read=FColorSource, write=SetColorSource}; __property Controls::TCursor Cursor = {read=FCursor, write=FCursor, default=0}; __property THorizAxis HorizAxis = {read=FHorizAxis, write=SetHorizAxis, default=1}; __property TSeriesMarks* Marks = {read=FMarks, write=SetMarks}; __property TCustomAxisPanel* ParentChart = {read=FParent, write=SetParentChart, stored=false}; __property Classes::TComponent* DataSource = {read=GetDataSource, write=SetDataSource}; __property AnsiString PercentFormat = {read=FPercentFormat, write=SetPercentFormat, stored=IsPercentFormatStored}; __property Graphics::TColor SeriesColor = {read=FColor, write=SetSeriesColor, default=536870912}; __property bool ShowInLegend = {read=FShowInLegend, write=SetShowInLegend, default=1}; __property AnsiString Title = {read=FTitle, write=SetTitle}; __property AnsiString ValueFormat = {read=FValueFormat, write=SetValueFormat, stored=IsValueFormatStored}; __property TVertAxis VertAxis = {read=FVertAxis, write=SetVertAxis, default=0}; __property AnsiString XLabelsSource = {read=FLabelsSource, write=SetLabelsSource}; __property Classes::TNotifyEvent AfterDrawValues = {read=FAfterDrawValues, write=FAfterDrawValues}; __property Classes::TNotifyEvent BeforeDrawValues = {read=FBeforeDrawValues, write=FBeforeDrawValues}; __property TSeriesOnAfterAdd OnAfterAdd = {read=FOnAfterAdd, write=FOnAfterAdd}; __property TSeriesOnBeforeAdd OnBeforeAdd = {read=FOnBeforeAdd, write=FOnBeforeAdd}; __property TSeriesOnClear OnClearValues = {read=FOnClearValues, write=FOnClearValues}; __property TSeriesClick OnClick = {read=FOnClick, write=FOnClick}; __property TSeriesClick OnDblClick = {read=FOnDblClick, write=FOnDblClick}; __property TSeriesOnGetMarkText OnGetMarkText = {read=FOnGetMarkText, write=FOnGetMarkText}; }; class PASCALIMPLEMENTATION TChartValueList : public Classes::TPersistent { typedef Classes::TPersistent inherited; public: double operator[](int Index) { return Value[Index]; } private: bool FDateTime; Classes::TList* FList; double FMaxValue; double FMinValue; double FMultiplier; AnsiString FName; TChartListOrder FOrder; TChartSeries* FOwner; double FTempValue; double FTotal; double FTotalABS; AnsiString FValueSource; double __fastcall GetMaxValue(void); double __fastcall GetMinValue(void); double __fastcall GetTotal(void); double __fastcall GetTotalABS(void); void __fastcall SetDateTime(bool Value); void __fastcall SetMultiplier(const double Value); void __fastcall SetValueSource(const AnsiString Value); protected: bool IDirtyStats; virtual double __fastcall GetValue(int ValueIndex); virtual void __fastcall SetValue(int ValueIndex, const double AValue); virtual void __fastcall ClearValues(void); void __fastcall RecalcStats(void); virtual int __fastcall AddChartValue(const double Value); virtual void __fastcall InsertChartValue(int ValueIndex, const double Value); public: __fastcall virtual TChartValueList(TChartSeries* AOwner, const AnsiString AName); __fastcall virtual ~TChartValueList(void); virtual void __fastcall Assign(Classes::TPersistent* Source); virtual int __fastcall Count(void); virtual void __fastcall Delete(int ValueIndex); void __fastcall FillSequence(void); double __fastcall First(void); double __fastcall Last(void); int __fastcall Locate(const double Value); virtual void __fastcall Scroll(void); void __fastcall Sort(void); __property double MaxValue = {read=GetMaxValue}; __property double MinValue = {read=GetMinValue}; __property TChartSeries* Owner = {read=FOwner}; __property double TempValue = {read=FTempValue, write=FTempValue}; __property double Total = {read=GetTotal}; __property double TotalABS = {read=GetTotalABS, write=FTotalABS}; __property double Value[int Index] = {read=GetValue, write=SetValue/*, default*/}; __published: __property bool DateTime = {read=FDateTime, write=SetDateTime, nodefault}; __property AnsiString Name = {read=FName, write=FName}; __property double Multiplier = {read=FMultiplier, write=SetMultiplier}; __property TChartListOrder Order = {read=FOrder, write=FOrder, nodefault}; __property AnsiString ValueSource = {read=FValueSource, write=SetValueSource}; }; class DELPHICLASS AxisException; class PASCALIMPLEMENTATION AxisException : public Sysutils::Exception { typedef Sysutils::Exception inherited; public: #pragma option push -w-inl /* Exception.Create */ inline __fastcall AxisException(const AnsiString Msg) : Sysutils::Exception(Msg) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmt */ inline __fastcall AxisException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateRes */ inline __fastcall AxisException(int Ident)/* overload */ : Sysutils::Exception(Ident) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmt */ inline __fastcall AxisException(int Ident, const System::TVarRec * Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateHelp */ inline __fastcall AxisException(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateFmtHelp */ inline __fastcall AxisException(const AnsiString Msg, const System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResHelp */ inline __fastcall AxisException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { } #pragma option pop #pragma option push -w-inl /* Exception.CreateResFmtHelp */ inline __fastcall AxisException(System::PResStringRec ResStringRec, const System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { } #pragma option pop public: #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~AxisException(void) { } #pragma option pop }; typedef void __fastcall (__closure *TSeriesMouseMove)(TChartSeries* Sender, Classes::TShiftState Shift, int X, int Y); typedef void __fastcall (__closure *TSeriesDblClick)(TChartSeries* Sender, int ValueIndex); #pragma option push -b- enum TChartClickedPartStyle { cpNone, cpLegend, cpAxis, cpSeries, cpTitle, cpFoot, cpChartRect }; #pragma option pop #pragma pack(push, 1) struct TChartClickedPart { TChartClickedPartStyle Part; int PointIndex; TChartSeries* ASeries; TCustomChartAxis* AAxis; } ; #pragma pack(pop) class PASCALIMPLEMENTATION TSeriesMarkPosition : public System::TObject { typedef System::TObject inherited; public: #pragma pack(push, 1) Types::TPoint ArrowFrom; #pragma pack(pop) #pragma pack(push, 1) Types::TPoint ArrowTo; #pragma pack(pop) bool Custom; int Height; #pragma pack(push, 1) Types::TPoint LeftTop; #pragma pack(pop) int Width; void __fastcall Assign(TSeriesMarkPosition* Source); Types::TRect __fastcall Bounds(); public: #pragma option push -w-inl /* TObject.Create */ inline __fastcall TSeriesMarkPosition(void) : System::TObject() { } #pragma option pop #pragma option push -w-inl /* TObject.Destroy */ inline __fastcall virtual ~TSeriesMarkPosition(void) { } #pragma option pop }; typedef TMetaClass*TChartSeriesClass; typedef TMetaClass*TTeeFunctionClass; //-- var, const, procedure --------------------------------------------------- static const int ChartMarkColor = 0x80ffff; static const Shortint TeeAllValues = 0xffffffff; static const int clTeeColor = 0x20000000; static const Word ChartSamplesMax = 0x3e8; static const Shortint TeeAutoZOrder = 0xffffffff; static const Shortint TeeNoPointClicked = 0xffffffff; static const Word TeeMaxAxisTicks = 0x7d0; extern PACKAGE bool TeeDrawAxisBeforeSeries; extern PACKAGE bool TeeCheckMarkArrowColor; extern PACKAGE int TeeAxisClickGap; extern PACKAGE int TeeDefaultCapacity; } /* namespace Teengine */ using namespace Teengine; #pragma option pop // -w- #pragma option pop // -Vx #pragma delphiheader end. //-- end unit ---------------------------------------------------------------- #endif // TeEngine
[ "bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b" ]
[ [ [ 1, 1201 ] ] ]
8adcbe625caf9a0f8e86d694c02bdcf08e8ca1f4
550e17ad61efc7bea2066db5844663c8b5835e4f
/Source/Base/Field/OSGStringToUInt32MapType.cpp
1e675905c337d77a06e3afff5e3ef23f480a296a
[]
no_license
danguilliams/OpenSGToolbox
9287424c66c9c4b38856cf749a311f15d8aac4f0
102a9fb02ad1ceeaf5784e6611c2862c4ba84d61
refs/heads/master
2021-01-17T23:02:36.528911
2010-11-01T16:56:31
2010-11-01T16:56:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,040
cpp
/*---------------------------------------------------------------------------*\ * OpenSG ToolBox Toolbox * * * * * * * * * * Authors: David Kabala * * * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * License * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as published * * by the Free Software Foundation, version 2. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * \*---------------------------------------------------------------------------*/ // Source file for new Field type // This define is only set in this source file. It switches the // Windows-specific declarations in the header for compiling the Field, // not for using it. #define OSG_COMPILESTRINGTOUINT32MAPTYPEINST // You need this in every OpenSG file #include "OSGField.h" #include "OSGSField.h" #include "OSGSField.ins" #include "OSGMField.h" #include "OSGMField.ins" // The new field type include #include "OSGStringToUInt32MapType.h" OSG_BEGIN_NAMESPACE // This is where the DataType for the new Fieldtype is defined. // The parameters are the name of the type and the name of the parent type DataType FieldTraits<StringToUInt32Map>::_type("StringToUInt32Map", "BaseType"); // These macros instantiate the necessary template methods for the fields OSG_FIELD_DLLEXPORT_DEF1(SField, StringToUInt32Map ) OSG_FIELD_DLLEXPORT_DEF1(MField, StringToUInt32Map ) OSG_END_NAMESPACE
[ [ [ 1, 35 ], [ 37, 37 ], [ 43, 50 ], [ 52, 53 ], [ 56, 58 ] ], [ [ 36, 36 ], [ 38, 42 ], [ 51, 51 ], [ 54, 55 ] ] ]
6a3ceb4aa0fd5f87facebd71d10cedfbfdb0ae54
20c74d83255427dd548def97f9a42112c1b9249a
/src/libsrc/game/game-class.h
de95852672652862b4e7d39da2f89fd3e5e211f6
[]
no_license
jonyzp/roadfighter
70f5c7ff6b633243c4ac73085685595189617650
d02cbcdcfda1555df836379487953ae6206c0703
refs/heads/master
2016-08-10T15:39:09.671015
2011-05-05T12:00:34
2011-05-05T12:00:34
54,320,171
0
0
null
null
null
null
UTF-8
C++
false
false
883
h
#ifndef GAME_CLASS_H #define GAME_CLASS_H class Game { virtual void init() = 0; virtual void initSounds() = 0; virtual void processNextFrame() = 0; virtual void updateGameLogic(unsigned int ms) = 0; virtual void processUserInput(double milliseconds) = 0; virtual void applyGameLogic(double milliseconds) = 0; virtual void applyGameAI(double milliseconds) = 0; virtual void applyCollisionDetection() = 0; virtual void applyGamePhysics(double milliseconds) = 0; virtual void renderFrame() = 0; virtual void processPlayerState() = 0; virtual Logical paint() = 0; virtual Logical draw() = 0; virtual Logical present() = 0; // void startGame() = 0; // void exitGame() = 0; // void pauseGame() = 0; // void showTitle() = 0; // void showGameover() = 0; // void showContinue() = 0; // void showCredits() = 0; // void showDemo() = 0; }; #endif
[ [ [ 1, 31 ] ] ]
6b2974c69651e28eac9b05b27600fd1bac04e815
90aa2eebb1ab60a2ac2be93215a988e3c51321d7
/castor/branches/boost/libs/castor/test/test_item_set.cpp
52577fdaade10723f40d2ea997944b329c49af50
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
roshannaik/castor
b9f4ea138a041fe8bccf2d8fc0dceeb13bcca5a6
e86e2bf893719bf3164f9da9590217c107cbd913
refs/heads/master
2021-04-18T19:24:38.612073
2010-08-18T05:10:39
2010-08-18T05:10:39
126,150,539
0
0
null
null
null
null
UTF-8
C++
false
false
1,509
cpp
#include <boost/castor.h> #include <boost/test/minimal.hpp> using namespace castor; int test_main(int, char * []) { int ai[] = {1,2,3,4,2}; lref<std::multiset<int> > mi = std::multiset<int>(ai+0, ai+5); lref<std::set<int> > si = std::set<int>(ai+0, ai+5); { // test mode - std::multiset #ifdef __GNUG__ relation r = item_set<std::multiset<int> >(2, mi); #else relation r = item_set(2,mi); #endif int j=0; while(r()) ++j; BOOST_CHECK(j==2); #ifdef __GNUG__ BOOST_CHECK(!item_set<std::multiset<int> >(-1,mi)()); #else BOOST_CHECK(!item_set(-1,mi)()); #endif } { // test mode - std::set lref<const int> i=2; relation r = item_set(i,si); int j=0; while(r()) ++j; BOOST_CHECK(j==1); #ifdef __GNUG__ BOOST_CHECK(!item_set<std::set<int> >(-1,si)()); #else BOOST_CHECK(!item_set(-1,si)()); #endif } { // gen mode - std::multiset BOOST_CHECK(mi->size()>si->size()); // require duplicates in mi lref<const int> i; relation r = item_set(i,mi); std::size_t j=0; while(r()) ++j; BOOST_CHECK(j==mi->size()); } { // gen mode - std::set lref<const int> i; relation r = item_set(i,si); std::size_t j=0; while(r()) ++j; BOOST_CHECK(j==si->size()); } return 0; }
[ [ [ 1, 1 ], [ 5, 25 ], [ 27, 40 ], [ 42, 50 ], [ 52, 58 ], [ 60, 65 ] ], [ [ 2, 4 ], [ 26, 26 ], [ 41, 41 ], [ 51, 51 ], [ 59, 59 ] ] ]
8b361c125c49f60de1ecb1cbc06cf8f12a173cf9
8ad5d6836fe4ad3349929802513272db86d15bc3
/lib/Scorpion/Exceptions/SSL/AcceptSocketAllocationError.h
acaf05c0eed389c27daad387c1eefb32183088f8
[]
no_license
blytkerchan/arachnida
90a72c27f0c650a6fbde497896ef32186c0219e5
468f4ef6c35452de3ca026af42b8eedcef6e4756
refs/heads/master
2021-01-10T21:43:51.505486
2010-03-12T04:02:19
2010-03-12T04:02:42
2,203,393
0
1
null
null
null
null
UTF-8
C++
false
false
650
h
#ifndef _scorpion_exceptions_ssl_acceptsocketallocationerror_h #define _scorpion_exceptions_ssl_acceptsocketallocationerror_h namespace Scorpion { namespace Exceptions { namespace SSL { //! Thrown when the accept socket could not be allocated struct AcceptSocketAllocationError : public SSLProtocolError { AcceptSocketAllocationError(int error_code, const char * filename, int line, const char * error_line_data, int error_line_data_flags) : SSLProtocolError("Error allocating accept socket", error_code, filename, line, error_line_data, error_line_data_flags) { /* no-op */ } }; } } } #endif
[ [ [ 1, 21 ] ] ]
173cc673ab6e9f61b06d82eb73ecb589861bd816
8f5d0d23e857e58ad88494806bc60c5c6e13f33d
/Core/cFactory.h
c364d5458f5268bb88f3442fd16148a0e4800a6a
[]
no_license
markglenn/projectlife
edb14754118ec7b0f7d83bd4c92b2e13070dca4f
a6fd3502f2c2713a8a1a919659c775db5309f366
refs/heads/master
2021-01-01T15:31:30.087632
2011-01-30T16:03:41
2011-01-30T16:03:41
1,704,290
1
1
null
null
null
null
UTF-8
C++
false
false
1,497
h
#pragma once #include <string> #include <map> #include "../Core/cSingleton.h" #define REGISTER_CLASS(base, object, id) \ namespace \ { \ cRegisterInFactory<base, object> registerMe(id); \ } typedef std::string defaultIDKeyType; template < class ancestorType, class manufacturedObject, typename classIDKey=defaultIDKeyType> class cRegisterInFactory { public: static ancestorType* createInstance() { return new manufacturedObject; } cRegisterInFactory(const classIDKey &id) { cFactory<ancestorType>::Instance().Register(id, createInstance); } }; template <class manufactoredObject, typename classIDKey = defaultIDKeyType> class cFactory { typedef manufactoredObject* (*tFnPointer)(); typedef std::map<classIDKey, tFnPointer> tFnRegistry; tFnRegistry m_registry; public: cFactory(void) {}; ~cFactory(void) {}; void Register (std::string identifier, tFnPointer fn) { m_registry[identifier] = fn; }; static cFactory& Instance(); manufactoredObject* Create (const classIDKey &identifier) const { tFnRegistry::const_iterator regEntry = m_registry.find(identifier); if (regEntry != m_registry.end()) return (*regEntry).second(); return NULL; } }; template <class manufactoredObject, typename classIDKey> cFactory<manufactoredObject, classIDKey> &cFactory<manufactoredObject, classIDKey>::Instance() { static cFactory theInstance; return theInstance; }
[ [ [ 1, 67 ] ] ]
485635be3647bb899c06e0aea9d2c6973c072b08
bfdfb7c406c318c877b7cbc43bc2dfd925185e50
/engine/hyClosure.cpp
3b8901aec277c9505fcfb17ed2adba84406b6ffb
[ "MIT" ]
permissive
ysei/Hayat
74cc1e281ae6772b2a05bbeccfcf430215cb435b
b32ed82a1c6222ef7f4bf0fc9dedfad81280c2c0
refs/heads/master
2020-12-11T09:07:35.606061
2011-08-01T12:38:39
2011-08-01T12:38:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,159
cpp
/* -*- coding: sjis-dos; -*- */ /* * copyright 2010 FUKUZAWA Tadashi. All rights reserved. */ #include "hyClosure.h" #include "hyContext.h" #include "hyDebug.h" using namespace Hayat::Common; using namespace Hayat::Engine; size_t Closure::needSize(hys32 numSharedLocal) { return sizeof(Closure) + sizeof(SharedLocal_st) * (numSharedLocal - 1); } Closure* Closure::create(hyu8 numSharedLocal) { Object* obj = Object::create(HC_Closure, needSize(numSharedLocal) + sizeof(hyu32)); return obj->cppObj<Closure>(); } void Closure::initialize(const MethodPtr& methodPtr, hyu8 numSharedlocal, hyu16 creatorMethodID) { HMD_ASSERT(needSize(numSharedlocal) <= getObj()->size()); m_methodPtr = methodPtr; m_numSharedLocal = numSharedlocal; m_numSharedSet = 0; m_creatorMethodID = creatorMethodID; for (hyu32 i = 0; i < numSharedlocal; i++) { m_shareInfo[i].localIdx = (hyu8)-1; m_shareInfo[i].sharedLocalVar = NULL; } } void Closure::setSharedLocal(hyu8 localIdx, Object* sharedLocalVar) { HMD_ASSERT(m_numSharedSet < m_numSharedLocal); HMD_ASSERT(m_shareInfo[m_numSharedSet].sharedLocalVar == NULL); //HMD__PRINTF_FK("Closure::setSharedLocal(localIdx=%d, sharedLocalVar=%x)\n",localIdx,sharedLocalVar); m_shareInfo[m_numSharedSet].localIdx = localIdx; m_shareInfo[m_numSharedSet].sharedLocalVar = sharedLocalVar; ++ m_numSharedSet; } void Closure::call(Context* context, hyu8 numArgs, bool bAway) { HMD_DEBUG_ASSERT(m_numSharedSet == m_numSharedLocal); Signature sig(numArgs, context); const Signature::Sig_t* sigBytes; hyu16 defValOffs; const HClass* klass = m_methodPtr.lexicalScope(); klass->getMethodSignatureBytes(m_methodPtr.getMethodID()-1, &sigBytes, &defValOffs); if (! sig.canSubstTo(sigBytes, klass, defValOffs)) { context->throwException(HSym_signature_mismatch, M_M("closure call signature mismatch")); #if 0 HMD_PRINTF("closure call signature mismatch\n"); HMD_PRINTF("numArgs = %d\nsignature = ", numArgs); Signature::printSig(sigBytes); HMD_PRINTF("\nmethodID = ", m_methodPtr.getMethodID()); #endif return; } context->routineCall(m_methodPtr, sig.getNumOnStack()); if (bAway) context->curFrame->r.creatorMethodID = m_creatorMethodID; hyu32 fp = context->curFrame->framePos; for (int i = 0; i < m_numSharedLocal; i++) { //HMD__PRINTF_FK("Closure::call : i=%d,localIdx=%d,sharedLocalVar=%x\n",i,m_shareInfo[i].localIdx,m_shareInfo[i].sharedLocalVar); Value* pLocalVar = context->stack.addrAt(fp + m_shareInfo[i].localIdx); pLocalVar->type = HC_INDIRECT_REF; pLocalVar->ptrData = m_shareInfo[i].sharedLocalVar; } } void Closure::m_GC_mark(void) { Debug::incMarkTreeLevel(); for (int i = 0; i < m_numSharedLocal; i++) { //HMD_PRINTF("mark shared obj %x\n",m_shareInfo[i].sharedLocalVar); GC::markObjP(&(m_shareInfo[i].sharedLocalVar)); } m_methodPtr.m_GC_mark(); Debug::decMarkTreeLevel(); }
[ [ [ 1, 91 ] ] ]
20f34bcc49adf5a5a1e4da9c229b83889e8de41c
4ac19e8642b3005d702a1112a722811c8b3cc7c6
/src/a_base.cpp
dcb20d80e0d053c4734b2122be4e8f63876052ac
[ "BSD-3-Clause" ]
permissive
amreisa/freeCGI
5ab00029e86fad79a2580262c04afa3ae442e127
84c047c4790eaabbc9d2284242a44c204fe674ea
refs/heads/master
2022-04-27T19:51:11.690512
2011-02-28T22:33:34
2011-02-28T22:33:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
502
cpp
#include "freeCGI.h" #ifdef WIN32 #pragma message( "Compiling " __FILE__ ) #endif #ifdef _DEBUG_DUMP_ void ABase::dump(void) { cout << endl << "---START: ABase::dump()---" << endl; cout << "this = " << (void *)this; cout << endl << "---END: ABase::dump()---" << endl; } void ABaseElement::dump(void) { cout << endl << "---START: ABaseElement::dump()---" << endl; cout << "this = " << (void *)this; cout << endl << "---END: ABaseElement::dump()---" << endl; } #endif
[ [ [ 1, 21 ] ] ]
67134199c5e7a8cef316a1dfcf36e88902403e01
95244a5f4a3be9ba6cd690a48395f995c2dd8800
/app_test/src/testApp.cpp
77a5df362909c9f8530d40367b7bc75df663ed83
[]
no_license
JoshAshby/C---Openframeworks
ee123502e956736c2ef963c71d5fd3178d8d4817
8873ae8abe9a2ebe2ced0b475ba26d970c4052e7
refs/heads/master
2021-01-01T15:35:50.654446
2009-12-27T20:28:43
2009-12-27T20:28:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,950
cpp
#include "testApp.h" #include <string.h> //-------------------------------------------------------------- void testApp::setup(){ //color of the background ofBackground(200,200,200); //window title ofSetWindowTitle("Navigation"); ofSetFrameRate(60); //these are for whether the circles are dark blue or light blue forwardcolor = false; backcolor = false; leftcolor = false; rightcolor = false; ofSetCircleResolution(500); //the counter used to test the colored bars counter = 0; //load the font for debuging in app font.loadFont("DIN.otf",12); //set the serial port serial.setup("/dev/ttyUSB0", 9600); } //-------------------------------------------------------------- void testApp::update(){ //everytime update is called counter will increase by .05 counter = counter + 0.05; if (bSendSerialMessage){ // (1) write the letter "a" to serial: serial.writeByte('a'); // (2) read // now we try to read 3 bytes // since we might not get them all the time 3 - but sometimes 0, 6, or something else, // we will try to read three bytes, as much as we can // otherwise, we may have a "lag" if we don't read fast enough // or just read three every time. now, we will be sure to // read as much as we can in groups of three... nTimesRead = 0; nBytesRead = 0; int nRead = 0; // a temp variable to keep count per read unsigned char bytesReturned[3]; memset(bytesReadString, 0, 4); memset(bytesReturned, 0, 3); while( (nRead = serial.readBytes( bytesReturned, 3)) > 0){ nTimesRead++; nBytesRead = nRead; }; memcpy(bytesReadString, bytesReturned, 3); bSendSerialMessage = false; readTime = ofGetElapsedTimef(); } //button(); } //-------------------------------------------------------------- void testApp::draw(){ //these if (color) then sets are for the circles //basically they say "if the color is set to true, //the circle will be light blue/grey //if it's anything else besides true, it is dark blue if (forwardcolor){ ofSetColor(0x456456); } else { ofSetColor(0x092345); } ofFill(); ofCircle(200,75,50); ofSetColor(0x000000); //drew the circle, and now to draw the text ofDrawBitmapString("Forward",175,75); if (leftcolor){ ofSetColor(0x456456); } else { ofSetColor(0x092345); } ofFill(); ofCircle(100,125,50); ofSetColor(0x000000); ofDrawBitmapString("Left",75,125); if (backcolor){ ofSetColor(0x456456); } else { ofSetColor(0x092345); } ofFill(); ofCircle(200,175,50); ofSetColor(0x000000); ofDrawBitmapString("Back",175,175); if (rightcolor){ ofSetColor(0x456456); } else { ofSetColor(0x092345); } ofFill(); ofCircle(300,125,50); ofSetColor(0x000000); ofDrawBitmapString("Right",275,125); //these two rectangles are the colored bars background ofSetColor(0x092345); ofFill(); ofRect(50, 200, 50, 255); ofSetColor(0x092345); ofFill(); ofRect(300, 200, 50, 255); //give the height float a value //in this case, 100 times the sin of counter (see update) //if height is within the proper range, then draw the colored bars //if not, draw them, but do not change their height //printf("got: %i \n", bytesReadString[1]); if (ofInRange(bytesReadString[1],0,255)){ ofSetColor(0x456456); ofFill(); ofRect(50, 200, 50, bytesReadString[1]); } else { ofSetColor(0x456456); ofFill(); ofRect(50, 200, 50, 10); } if (ofInRange(bytesReadString[2],0,255)){ ofSetColor(0x456456); ofFill(); ofRect(300, 200, 50, bytesReadString[2]); } else { ofSetColor(0x456456); ofFill(); ofRect(300, 200, 50, 10); } char tempStr[1024]; sprintf(tempStr, "Left: %i", bytesReadString[1]); font.drawString(tempStr,50,190); sprintf(tempStr, "Right: %i", bytesReadString[2]); font.drawString(tempStr,300,190); } //-------------------------------------------------------------- //All of the code down here is to process the keyboard events, //and the mouse events, and tell the above code what to do //when those events happen, such as change the circle color //-------------------------------------------------------------- void testApp::keyPressed(int key){ if (key == 'w'){ forwardcolor = !forwardcolor; serial.writeByte('w'); bSendSerialMessage = true; } if (key == 's'){ backcolor = !backcolor; serial.writeByte('s'); bSendSerialMessage = true; } if (key == 'a'){ leftcolor = !leftcolor; serial.writeByte('a'); bSendSerialMessage = true; } if (key == 'd'){ rightcolor = !rightcolor; serial.writeByte('d'); bSendSerialMessage = true; } if (key == 'r'){ bSendSerialMessage = true; } } //-------------------------------------------------------------- void testApp::keyReleased(int key){ if (key == 'w'){ forwardcolor = !forwardcolor; } if (key == 's'){ backcolor = !backcolor; } if (key == 'a'){ leftcolor = !leftcolor; button(); } if (key == 'd'){ rightcolor = !rightcolor; roundButton(100,100,50,"test","red"); } } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y){ } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ } void testApp::serialData(char x){ serial.writeByte(x); /* nBytesRead = 0; int nRead = 0; // a temp variable to keep count per read unsigned char bytesReturned[3]; memset(bytesReadString, 0, 4); memset(bytesReturned, 0, 3); while( (nRead = serial.readBytes( bytesReturned, 3)) > 0){ nBytesRead = nRead; }; memcpy(bytesReadString, bytesReturned, 3); */ } void testApp::roundButton(int x, int y, int h, char srt[15], char color[15]){ //printf("got:\n x: %i \n y: %i \n h: %i \n text: %s \n if-then: %s \n", x, y, h, srt, color); /*if (color){ ofSetColor(0x456456); } else { ofSetColor(0x092345); } ofFill(); ofCircle(x,y,h);*/ ofSetColor(0x000000); ofDrawBitmapString("hello",100,100); } void testApp::button(){ printf("hello\n"); ofSetColor(0x000000); ofDrawBitmapString("hello",100,100); } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ //printf("x = %i \n", x); //printf("y = %i \n", y); //printf("button = %i \n", button); if (ofInRange(x,150,250) && ofInRange(y,25,125)){ forwardcolor = !forwardcolor; serial.writeByte('w'); bSendSerialMessage = true; } if (ofInRange(x,50,150) && ofInRange(y,75,170)){ leftcolor = !leftcolor; serial.writeByte('a'); bSendSerialMessage = true; } if (ofInRange(x,250,350) && ofInRange(y,75,170)){ rightcolor = !rightcolor; serial.writeByte('d'); bSendSerialMessage = true; } if (ofInRange(x,150,250) && ofInRange(y,125,225)){ backcolor = !backcolor; serial.writeByte('s'); bSendSerialMessage = true; } } //-------------------------------------------------------------- void testApp::mouseReleased(int x, int y, int button){ //printf("x = %i \n", x); //printf("y = %i \n", y); //printf("button = %i \n", button); if (ofInRange(x,150,250) && ofInRange(y,25,125)){ forwardcolor = !forwardcolor; } if (ofInRange(x,50,150) && ofInRange(y,75,170)){ leftcolor = !leftcolor; } if (ofInRange(x,250,350) && ofInRange(y,75,170)){ rightcolor = !rightcolor; } if (ofInRange(x,150,250) && ofInRange(y,125,225)){ backcolor = !backcolor; } } //-------------------------------------------------------------- void testApp::windowResized(int w, int h){ }
[ [ [ 1, 307 ] ] ]
c30aafbc48be3d6a6fc97a0527c75ce0ca87e5f3
ad80c85f09a98b1bfc47191c0e99f3d4559b10d4
/code/src/particle/nprender_main.cc
0d16b1745c59c1741eaba25561d6a01cd6c76c1b
[]
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
4,367
cc
#define N_IMPLEMENTS nPRender //------------------------------------------------------------------- // nprender_main.cc // (C) 2000 A.Weissflog //------------------------------------------------------------------- #include "particle/npemitter.h" #include "particle/nprender.h" #include "gfx/ngfxtypes.h" nNebulaScriptClass(nPRender, "nanimnode"); //------------------------------------------------------------------- // ~nPRender() // 20-Mar-00 floh created //------------------------------------------------------------------- nPRender::~nPRender() { if (this->keys) n_free(this->keys); } //------------------------------------------------------------------- // BeginKeys() // 20-Mar-00 floh created //------------------------------------------------------------------- void nPRender::BeginKeys(int num) { if (this->keys) { n_free(this->keys); this->keys = NULL; } this->i_num_keys = num; this->f_num_keys = (float) num; int size = num * sizeof(nPAttrs); this->keys = (nPAttrs *) n_malloc(size); n_memset(this->keys,0,size); } //------------------------------------------------------------------- // EndKeys() // 20-Mar-00 floh created //------------------------------------------------------------------- void nPRender::EndKeys(void) { n_assert(this->keys); } //------------------------------------------------------------------- // SetKey() // 20-Mar-00 floh created // 18-Oct-00 floh + convert color to ulong in rgba and bgra // format //------------------------------------------------------------------- void nPRender::SetKey(int i, float size, float bounce, float r, float g, float b, float a) { n_assert(i<this->i_num_keys); n_assert(this->keys); this->keys[i].f[nPAttrs::N_SIZE] = size; this->keys[i].f[nPAttrs::N_BOUNCE] = bounce; this->keys[i].f[nPAttrs::N_RED] = r; this->keys[i].f[nPAttrs::N_GREEN] = g; this->keys[i].f[nPAttrs::N_BLUE] = b; this->keys[i].f[nPAttrs::N_ALPHA] = a; this->keys[i].rgba = n_f2rgba(r,g,b,a); this->keys[i].bgra = n_f2bgra(r,g,b,a); } //------------------------------------------------------------------- // GetNumKeys() // 20-Mar-00 floh created //------------------------------------------------------------------- int nPRender::GetNumKeys(void) { return this->i_num_keys; } //------------------------------------------------------------------- // GetKey() // 20-Mar-00 floh created //------------------------------------------------------------------- void nPRender::GetKey(int i, float& size, float& bounce, float& r, float& g, float& b, float& a) { n_assert(i < this->i_num_keys); n_assert(this->keys); size = this->keys[i].f[nPAttrs::N_SIZE]; bounce = this->keys[i].f[nPAttrs::N_BOUNCE]; r = this->keys[i].f[nPAttrs::N_RED]; g = this->keys[i].f[nPAttrs::N_GREEN]; b = this->keys[i].f[nPAttrs::N_BLUE]; a = this->keys[i].f[nPAttrs::N_ALPHA]; } //------------------------------------------------------------------- // SetEmitter() // 20-Mar-00 floh created // 28-Sep-00 floh + PushCwd()/PopCwd() //------------------------------------------------------------------- void nPRender::SetEmitter(const char *n) { n_assert(n); kernelServer->PushCwd(this); this->ref_emitter = (nPEmitter *) kernelServer->Lookup(n); // exists? if (!this->ref_emitter.isvalid()) { n_error("Could not find npemitter object '%s'\n",n); } // of class nPEmitter? if (!this->ref_emitter->IsA(kernelServer->FindClass("npemitter"))) { n_error("Emitter object '%s' not of class 'npemitter'\n",n); } kernelServer->PopCwd(); } //------------------------------------------------------------------- // GetEmitter() // 20-Mar-00 floh created //------------------------------------------------------------------- const char* nPRender::GetEmitter(stl_string& relpath) { return this->ref_emitter.isvalid() ? this->GetRelPath((nRoot *)this->ref_emitter.get(), relpath) : 0; } //------------------------------------------------------------------- // EOF //-------------------------------------------------------------------
[ "plushe@411252de-2431-11de-b186-ef1da62b6547" ]
[ [ [ 1, 128 ] ] ]
4d283bb1915c24b9d42ccb0f81d73ddc62c19b79
119ba245bea18df8d27b84ee06e152b35c707da1
/unreal/branches/robots/qrgui/interpreters/robots/details/robotImplementations/sensorImplementations/unrealTouchSensorImplementation.cpp
128f91ab7a2df31f09bf5c07f26b77f95e98bfa3
[]
no_license
nfrey/qreal
05cd4f9b9d3193531eb68ff238d8a447babcb3d2
71641e6c5f8dc87eef9ec3a01cabfb9dd7b0e164
refs/heads/master
2020-04-06T06:43:41.910531
2011-05-30T19:30:09
2011-05-30T19:30:09
1,634,768
0
0
null
null
null
null
UTF-8
C++
false
false
427
cpp
#include "unrealTouchSensorImplementation.h" using namespace qReal::interpreters::robots; using namespace details::robotImplementations::sensorImplementations; UnrealTouchSensorImplementation::UnrealTouchSensorImplementation(inputPort::InputPortEnum const &port, d2Model::D2RobotModel *d2Model) : UnrealSensorImplementation(port, d2Model) { } void UnrealTouchSensorImplementation::read() { emit response(0); }
[ [ [ 1, 13 ] ] ]
6d6f32528fb8a45a53f26b48e31f661f25eef3da
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Depend/Foundation/Mathematics/Wm4Polyhedron3.inl
884cafb3ec892cc32abfb2b71dbb63f4f9338f69
[]
no_license
daleaddink/flagship3d
4835c223fe1b6429c12e325770c14679c42ae3c6
6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a
refs/heads/master
2021-01-15T16:29:12.196094
2009-11-01T10:18:11
2009-11-01T10:18:11
37,734,654
1
0
null
null
null
null
UTF-8
C++
false
false
5,628
inl
// Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // The Wild Magic Version 4 Foundation Library source code is supplied // under the terms of the license agreement // http://www.geometrictools.com/License/Wm4FoundationLicense.pdf // and may not be copied or disclosed except in accordance with the terms // of that agreement. //---------------------------------------------------------------------------- template <class Real> Polyhedron3<Real>::Polyhedron3 (int iVQuantity, Vector3<Real>* akVertex, int iTQuantity, int* aiIndex, bool bOwner) { // The polyhedron must be at least a tetrahedron. assert(iVQuantity >= 4 && akVertex); assert(iTQuantity >= 4 && aiIndex); m_iVQuantity = iVQuantity; m_akVertex = akVertex; m_iTQuantity = iTQuantity; m_aiIndex = aiIndex; m_bOwner = bOwner; } //---------------------------------------------------------------------------- template <class Real> Polyhedron3<Real>::Polyhedron3 (const Polyhedron3& rkPoly) { m_akVertex = 0; m_aiIndex = 0; m_bOwner = false; *this = rkPoly; } //---------------------------------------------------------------------------- template <class Real> Polyhedron3<Real>::~Polyhedron3 () { if (m_bOwner) { WM4_DELETE[] m_akVertex; WM4_DELETE[] m_aiIndex; } } //---------------------------------------------------------------------------- template <class Real> Polyhedron3<Real>& Polyhedron3<Real>::operator= (const Polyhedron3& rkPoly) { if (m_bOwner) { WM4_DELETE[] m_akVertex; WM4_DELETE[] m_aiIndex; } m_iVQuantity = rkPoly.m_iVQuantity; m_iTQuantity = rkPoly.m_iTQuantity; m_bOwner = rkPoly.m_bOwner; if (m_bOwner) { m_akVertex = WM4_NEW Vector3<Real>[m_iVQuantity]; size_t uiSize = m_iVQuantity*sizeof(Vector3<Real>); System::Memcpy(m_akVertex,uiSize,rkPoly.m_akVertex,uiSize); m_aiIndex = WM4_NEW int[3*m_iTQuantity]; uiSize = 3*m_iTQuantity*sizeof(int); System::Memcpy(m_aiIndex,uiSize,rkPoly.m_aiIndex,uiSize); } else { m_akVertex = rkPoly.m_akVertex; m_aiIndex = rkPoly.m_aiIndex; } return *this; } //---------------------------------------------------------------------------- template <class Real> int Polyhedron3<Real>::GetVQuantity () const { return m_iVQuantity; } //---------------------------------------------------------------------------- template <class Real> const Vector3<Real>* Polyhedron3<Real>::GetVertices () const { return m_akVertex; } //---------------------------------------------------------------------------- template <class Real> const Vector3<Real>& Polyhedron3<Real>::GetVertex (int i) const { assert(0 <= i && i < m_iVQuantity); return m_akVertex[i]; } //---------------------------------------------------------------------------- template <class Real> int Polyhedron3<Real>::GetTQuantity () const { return m_iTQuantity; } //---------------------------------------------------------------------------- template <class Real> const int* Polyhedron3<Real>::GetIndices () const { return m_aiIndex; } //---------------------------------------------------------------------------- template <class Real> const int* Polyhedron3<Real>::GetTriangle (int i) const { assert(0 <= i && i < m_iTQuantity); return &m_aiIndex[3*i]; } //---------------------------------------------------------------------------- template <class Real> void Polyhedron3<Real>::SetVertex (int i, const Vector3<Real>& rkV) { assert(0 <= i && i < m_iVQuantity); m_akVertex[i] = rkV; } //---------------------------------------------------------------------------- template <class Real> Vector3<Real>* Polyhedron3<Real>::GetVertices () { return m_akVertex; } //---------------------------------------------------------------------------- template <class Real> Vector3<Real> Polyhedron3<Real>::ComputeVertexAverage () const { Vector3<Real> kAverage = m_akVertex[0]; for (int i = 1; i < m_iVQuantity; i++) { kAverage += m_akVertex[i]; } kAverage /= (Real)m_iVQuantity; return kAverage; } //---------------------------------------------------------------------------- template <class Real> Real Polyhedron3<Real>::ComputeSurfaceArea () const { Real fSurfaceArea = (Real)0.0; const int* piIndex = m_aiIndex; for (int i = 0; i < m_iTQuantity; i++) { int iV0 = *piIndex++; int iV1 = *piIndex++; int iV2 = *piIndex++; Vector3<Real> kEdge0 = m_akVertex[iV1] - m_akVertex[iV0]; Vector3<Real> kEdge1 = m_akVertex[iV2] - m_akVertex[iV0]; Vector3<Real> kCross = kEdge0.Cross(kEdge1); fSurfaceArea += kCross.Length(); } fSurfaceArea *= (Real)0.5; return fSurfaceArea; } //---------------------------------------------------------------------------- template <class Real> Real Polyhedron3<Real>::ComputeVolume () const { Real fVolume = (Real)0.0; const int* piIndex = m_aiIndex; for (int i = 0; i < m_iTQuantity; i++) { int iV0 = *piIndex++; int iV1 = *piIndex++; int iV2 = *piIndex++; fVolume += m_akVertex[iV0].Dot(m_akVertex[iV1].Cross(m_akVertex[iV2])); } fVolume /= (Real)6.0; return fVolume; } //----------------------------------------------------------------------------
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 180 ] ] ]
abfba276e2c64b85166e972fef71b36b80945ffd
2dbbca065b62a24f47aeb7ec5cd7a4fd82083dd4
/OUAN/OUAN/Src/Logic/LogicComponent/LogicComponent.h
3e50b908fd835d29efc510511b11592d5593a307
[]
no_license
juanjmostazo/once-upon-a-night
9651dc4dcebef80f0475e2e61865193ad61edaaa
f8d5d3a62952c45093a94c8b073cbb70f8146a53
refs/heads/master
2020-05-28T05:45:17.386664
2010-10-06T12:49:50
2010-10-06T12:49:50
38,101,059
1
1
null
null
null
null
UTF-8
C++
false
false
2,568
h
#ifndef LogicComponentH_H #define LogicComponentH_H #include "../../Component/Component.h" namespace OUAN { const double MAX_TIME_SPENT=100; class LogicComponent: public Component { public: LogicComponent(const std::string& type=""); ~LogicComponent(); bool existsInDreams() const; void setExistsInDreams(bool existsInDreams); bool existsInNightmares() const; void setExistsInNightmares(bool existsInNightmares); int getState() const; virtual void setState(int state); int getOldState(int index=0) const; std::string getScriptFilename() const; void setScriptFilename(const std::string& scriptFilename); std::string getScriptFunction() const; void setScriptFunction(const std::string& scriptFunction); virtual void update(double elapsedTime); double getTimeSpent() const; void setTimeSpent(double timeSpent); bool isStateChanged() const; void setStateChanged(bool stateChanged); bool isOnWater() const; void setOnWater(bool onWater); int getLastFrameState() const; void initStateHistory(); virtual void processCollision(GameObjectPtr pGameObject, Ogre::Vector3 pNormal); virtual void processEnterTrigger(GameObjectPtr pGameObject); virtual void processExitTrigger(GameObjectPtr pGameObject); virtual void changeAnimation(const std::string& animationName); virtual bool isLoopingAnimation(const std::string& animationName) const; virtual bool hasFinishedAnimation(const std::string& animationName) const; void printMessage(const std::string& msg,double time=DEFAULT_DISPLAY_LIFETIME); bool isEnabled() const; void setCurrentWorldVisibility(bool visibility); protected: int mState; int mLastFrameState; bool mOnWater; /// Size of the number of states int stateHistory[GAMESTATE_HISTORY_SIZE]; bool mStateChanged; double mTimeSpent; private: /// Filename of the script that'll be executed by the logic subsystem /// to update this component's parent game object std::string mScriptFilename; /// Name of the script function that'll handle the state update std::string mScriptFunction; bool mExistsInDreams; bool mExistsInNightmares; }; class TLogicComponentParameters: public TComponentParameters { public: TLogicComponentParameters(); ~TLogicComponentParameters(); /// Existence in each world bool existsInDreams; bool existsInNightmares; std::string scriptFilename; std::string scriptFunction; int defaultState; }; } #endif
[ "wyern1@1610d384-d83c-11de-a027-019ae363d039", "ithiliel@1610d384-d83c-11de-a027-019ae363d039", "juanj.mostazo@1610d384-d83c-11de-a027-019ae363d039" ]
[ [ [ 1, 13 ], [ 22, 22 ], [ 31, 31 ], [ 33, 35 ], [ 39, 41 ], [ 45, 45 ], [ 47, 49 ], [ 60, 61 ], [ 67, 68 ], [ 82, 86 ], [ 94, 94 ], [ 96, 99 ] ], [ [ 14, 21 ], [ 23, 30 ], [ 32, 32 ], [ 36, 38 ], [ 42, 44 ], [ 50, 59 ], [ 62, 66 ], [ 69, 81 ], [ 87, 93 ], [ 95, 95 ] ], [ [ 46, 46 ] ] ]
378a32c1476b94ece0e0def6f916d08c356d9e83
222bc22cb0330b694d2c3b0f4b866d726fd29c72
/src/brookbox/wm2/WmlVETMesh.h
f5153c5f5dd0148d4e531f6f50f9af0edab600a2
[ "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
9,662
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 WMLVETMESH_H #define WMLVETMESH_H #include "WmlMath.h" #include "WmlSmallSet.h" #include <map> #include <set> #include <vector> namespace Wml { class WML_ITEM VETMesh { public: // vertex is <v> // edge is <v0,v1> where v0 = min(v0,v1) // triangle is <v0,v1,v2> where v0 = min(v0,v1,v2) class WML_ITEM Edge { public: Edge (); Edge (int iV0, int iV1); bool operator< (const Edge& rkE) const; bool operator== (const Edge& rkE) const; bool operator!= (const Edge& rkE) const; int m_aiV[2]; }; class WML_ITEM Triangle { public: Triangle (); Triangle (int iV0, int iV1, int iV2); bool operator< (const Triangle& rkT) const; bool operator== (const Triangle& rkT) const; bool operator!= (const Triangle& rkT) const; int m_aiV[3]; }; class WML_ITEM VertexAttribute { public: VertexAttribute () : m_kESet(8,8), m_kTSet(8,8) { m_pvData = NULL; } void* m_pvData; SmallSet<Edge> m_kESet; SmallSet<Triangle> m_kTSet; }; class WML_ITEM EdgeAttribute { public: EdgeAttribute () : m_kTSet(2,2) { m_pvData = NULL; } void* m_pvData; SmallSet<Triangle> m_kTSet; }; class WML_ITEM TriangleAttribute { public: TriangleAttribute () { m_pvData = NULL; } void* m_pvData; }; // for readability of the code typedef std::map<int,VertexAttribute> VMap; typedef VMap::iterator MVIter; typedef VMap::const_iterator MVCIter; typedef std::map<Edge,EdgeAttribute> EMap; typedef EMap::iterator MEIter; typedef EMap::const_iterator MECIter; typedef std::map<Triangle,TriangleAttribute> TMap; typedef TMap::iterator MTIter; typedef TMap::const_iterator MTCIter; // construction and destruction VETMesh (); virtual ~VETMesh (); // accessors for sizes int GetVertexQuantity () const; int GetEdgeQuantity () const; int GetTriangleQuantity () const; // Used for operations that create new meshes from the current one. This // allows derived class construction within the base class operations. virtual VETMesh* Create () const; // Callbacks that are executed when vertices, edges, or triangles are // inserted or removed during triangle insertion, triangle removal, or // edge collapsing. The default behavior for the creation is to return // NULL pointers. A derived class may override the creation and return // data to be attached to the specific mesh component. The default // behavior for the destruction is to do nothing. A derived class may // override the destruction and handle the data that was detached from // the specific mesh component before its destruction. virtual void OnVertexInsert (int iV, bool bCreate, void*& rpvData); virtual void OnVertexRemove (int iV, bool bDestroy, void* pvData); virtual void OnEdgeInsert (const Edge& rkE, bool bCreate, void*& rpvData); virtual void OnEdgeRemove (const Edge& rkE, bool bDestroy, void* pvData); virtual void OnTriangleInsert (const Triangle& rkT, bool bCreate, void*& rpvData); virtual void OnTriangleRemove (const Triangle& rkT, bool bDestroy, void* pvData); // Insert and remove triangles. The functions are virtual in case a // derived class wants to implement pre- and post-operation semantics. virtual void InsertTriangle (int iV0, int iV1, int iV2); virtual void InsertTriangle (const Triangle& rkT); virtual void RemoveTriangle (int iV0, int iV1, int iV2); virtual void RemoveTriangle (const Triangle& rkT); // This should be called before Mesh destruction if a derived class has // allocated vertex, edge, or triangle data and attached it to the mesh // components. Since the creation and destruction callbacks are virtual, // any insert/remove operations in the base Mesh destructor will only // call the base virtual callbacks, not any derived-class ones. An // alternative to calling this is that the derived class maintain enough // information to know which data objects to destroy during its own // destructor call. virtual void RemoveAllTriangles (); // write the mesh to an ASCII file void Print (const char* acFilename) const; // vertex attributes const VMap& GetVertexMap () const; void GetVertices (std::set<int>& rkVSet) const; void* GetData (int iV); const SmallSet<Edge>* GetEdges (int iV) const; const SmallSet<Triangle>* GetTriangles (int iV) const; // edge attributes const EMap& GetEdgeMap () const; void GetEdges (std::set<Edge>& rkESet) const; void* GetData (int iV0, int iV1); void* GetData (const Edge& rkE); const SmallSet<Triangle>* GetTriangles (int iV0, int iV1) const; // triangle attributes const TMap& GetTriangleMap () const; void GetTriangles (std::set<Triangle>& rkTSet) const; void* GetData (int iV0, int iV1, int iV2); void* GetData (const Triangle& rkT); // The mesh is manifold if each edge has at most two adjacent triangles. // It is possible that the mesh has multiple connected components. bool IsManifold () const; // The mesh is closed if each edge has exactly two adjacent triangles. // It is possible that the mesh has multiple connected components. bool IsClosed () const; // The mesh is connected if each triangle can be reached from any other // triangle by a traversal. bool IsConnected () const; // Extract the connected components from the mesh. For large data sets, // the array of VETMesh can use a lot of memory. Instead use the // second form that just stores a sorted connectivity array. Let N be // the number of components. The value Index[i] indicates the starting // index for component i with 0 <= i < N, so it is always the case that // Index[0] = 0. The value Index[N] is the total number of indices in // the raiConnect array. The quantity of indices for component i is // Q(i) = Index[i+1]-Index[i] for 0 <= i < N. The application is // responsible for deleting raiConnect. void GetComponents (std::vector<VETMesh*>& rkComponents); void GetComponents (std::vector<int>& rkIndex, int*& raiConnect); // Extract a connected component from the mesh and remove all the // triangles of the component from the mesh. This is useful for computing // the components in a very large mesh that uses a lot of memory. The // intention is that the function is called until all components are // found. The typical code is // // VETMesh kMesh = <some mesh>; // int iITotalQuantity = 3*kMesh.GetTriangleQuantity(); // int* aiConnect = new int[iITotalQuantity]; // for (int iIQuantity = 0; iIQuantity < iITotalQuantity; /**/ ) // { // int iCurrentIQuantity; // int* aiCurrentConnect = aiConnect + iIQuantity; // kMesh.RemoveComponent(iCurrentIQuantity,aiCurrentConnect); // iIQuantity += iCurrentIQuantity; // } void RemoveComponent (int& riIQuantity, int* aiConnect); // Extract the connected components from the mesh, but each component has // a consistent ordering across all triangles of that component. The // mesh must be manifold. The return value is 'true' if and only if the // mesh is manifold. If the mesh has multiple components, each component // will have a consistent ordering. However, the mesh knows nothing about // the mesh geometry, so it is possible that ordering across components is // not consistent. For example, if the mesh has two disjoint closed // manifold components, one of them could have an ordering that implies // outward pointing normals and the other inward pointing normals. // // NOTE. It is possible to create a nonorientable mesh such as a Moebius // strip. In this case, GetConsistentComponents will return connected // components, but in fact the triangles will not (and can not) be // consistently ordered. bool GetConsistentComponents (std::vector<VETMesh*>& rkComponents); // Reverse the ordering of all triangles in the mesh. VETMesh* GetReversedOrderMesh () const; // statistics void GetStatistics (int& riVQuantity, int& riEQuantity, int& riTQuantity, float& rfAverageEdgesPerVertex, float& rfAverageTrianglesPerVertex, float& rfAverageTrianglesPerEdge, int& riMaximumEdgesPerVertex, int& riMaximumTrianglesPerVertex, int& riMaximumTrianglesPerEdge); protected: std::map<int,VertexAttribute> m_kVMap; std::map<Edge,EdgeAttribute> m_kEMap; std::map<Triangle,TriangleAttribute> m_kTMap; }; #include "WmlVETMesh.inl" } #endif
[ [ [ 1, 254 ] ] ]
70f366612c4ac158f79c6258bbae0bc9022029d3
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/zombie/ngeomipmap/src/ngeomipmap/ngmmindexlodnbuilder.cc
79f229b09ac35d111703b600a1c2b8660b7922ca
[]
no_license
ugozapad/TheZombieEngine
832492930df28c28cd349673f79f3609b1fe7190
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
refs/heads/master
2020-04-30T11:35:36.258363
2011-02-24T14:18:43
2011-02-24T14:18:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
17,323
cc
//------------------------------------------------------------------------------ // ngmmindexlodnbuilder.cc // (C) 2006 Conjurer Services, S.A. //------------------------------------------------------------------------------ #include "precompiled/pchngeomipmap.h" #include "ngeomipmap/ngmmindexlodnbuilder.h" #include "ngeomipmap/ngmmgeometrystorage.h" #include "ngeomipmap/ngmmvertexlodsorting.h" #include "kernel/nlogclass.h" //------------------------------------------------------------------------------ /** */ void nGMMIndexLODNBuilder::FillIndicesBlock(int lod, int lodN, int lodE, int lodS, int lodW) { n_assert(lod >= 0 && lod < this->numLODLevels); n_assert(lodN >= 0 && lod < this->numLODLevels); n_assert(lodS >= 0 && lod < this->numLODLevels); n_assert(lodE >= 0 && lod < this->numLODLevels); n_assert(lodW >= 0 && lod < this->numLODLevels); // setup positions int inix = 0; int iniz = 0; int endz = (iniz + this->blockSize - 1); int endx = (inix + this->blockSize - 1); bool upwards = true; // calculate increments for each LOD int lodstep = (1 << lod); int lodstepN = (1 << lodN); int lodstepE = (1 << lodE); int lodstepS = (1 << lodS); int lodstepW = (1 << lodW); // calculate if there is crack or not bool crackN = (lodstep > lodstepN); bool crackE = (lodstep > lodstepE); bool crackS = (lodstep > lodstepS); bool crackW = (lodstep > lodstepW); // adjust the initial positions of the center block depending on neighbor lod if (crackN) { iniz += lodstep; } if (crackE) { endx -= lodstep; } if (crackS) { endz -= lodstep; } if (crackW) { inix += lodstep; } // get and lock index buffer this->geometryStorage->LockIndicesGroup( max(0, 6 * (endx - inix) * (endz - iniz) / (lodstep * lodstep)) ); // calculate triangles indices for the center block for(int z = iniz; z < endz; z += lodstep) { // x in upwards direction if (upwards) { // triangle strips (left to right) for(int x = inix;x < endx; x += lodstep) { // ordering as / / / / this->AddTriangle( x, z, x, z + lodstep, x + lodstep, z); this->AddTriangle( x, z + lodstep, x + lodstep, z + lodstep, x + lodstep, z); } } else { // triangle lists (right to left) for (int x = endx; x > inix; x -= lodstep) { // ordering as / / / / this->AddTriangle( x, z, x - lodstep, z + lodstep, x, z + lodstep); this->AddTriangle( x, z, x - lodstep, z, x - lodstep, z + lodstep); } } upwards = !upwards; } this->geometryStorage->UnlockIndicesGroup(); // generate triangles to fix the cracks in each direction if (crackN) { FillIndicesNorth(lod, lodN, lodE, lodS, lodW); } if (crackE) { FillIndicesEast(lod, lodN, lodE, lodS, lodW); } if (crackS) { FillIndicesSouth(lod, lodN, lodE, lodS, lodW); } if (crackW) { FillIndicesWest(lod, lodN, lodE, lodS, lodW); } } //------------------------------------------------------------------------------ int nGMMIndexLODNBuilder::CountIndices(int lod) { // calculate number of verices int numVertices = 1 << (numLODLevels - lod); // calculate number of triangles for current LOD int numTriangles = numVertices * numVertices * 2; // add enough triangles to connect with higher LOD numTriangles += 4 * 3 * (1 << (lod)); // calculate the number of different variations //int numVariations = (lod + 1) * (lod + 1) * (lod + 1) * (lod + 1); // calculate the number of indices //return numVariations * numTriangles * 3; return numTriangles * 3; } //------------------------------------------------------------------------------ int nGMMIndexLODNBuilder::CountGroups(int lod) { n_assert(lod >= 0 && lod <= this->numLODLevels); // calculate the group int group = (lod + 1) * (lod + 1) * (lod + 1) * (lod + 1); return group; } //------------------------------------------------------------------------------ void nGMMIndexLODNBuilder::ParseIndexGroup(int lod, int group, int & lodN, int & lodE, int & lodS, int & lodW) { n_assert(lod >= 0 && lod <= this->numLODLevels); int lod1 = lod + 1; int val = group; lodN = val / (lod1 * lod1 * lod1); val = val % (lod1 * lod1 * lod1); lodE = val / (lod1 * lod1); val = val % (lod1 * lod1); lodS = val / (lod1); lodW = val % (lod1); n_assert(lodN >= 0 && lod <= this->numLODLevels); n_assert(lodE >= 0 && lod <= this->numLODLevels); n_assert(lodS >= 0 && lod <= this->numLODLevels); n_assert(lodW >= 0 && lod <= this->numLODLevels); n_assert(group == this->CalcIndexGroup(lod, lodN, lodE, lodS, lodW)); } //------------------------------------------------------------------------------ int nGMMIndexLODNBuilder::CalcIndexGroup(int lod, int lodN, int lodE, int lodS, int lodW) { n_assert(lod >= 0 && lod <= this->numLODLevels); n_assert(lodN >= 0 && lod <= this->numLODLevels); n_assert(lodE >= 0 && lod <= this->numLODLevels); n_assert(lodS >= 0 && lod <= this->numLODLevels); n_assert(lodW >= 0 && lod <= this->numLODLevels); // adjust the LOD to take into account in relation with the cell LOD lodN = min(lod, lodN); lodE = min(lod, lodE); lodS = min(lod, lodS); lodW = min(lod, lodW); // calculate the group int lod1 = lod + 1; int group = 0; group += lodN * (lod1) * (lod1) * (lod1); group += lodE * (lod1) * (lod1); group += lodS * (lod1); group += lodW; return group; } //------------------------------------------------------------------------------ /** */ void nGMMIndexLODNBuilder::FillIndicesNorth( int lod, int lodN, int lodE, int lodS, int lodW) { // calculate steps int step = (1 << lod); int stepN = (1 << lodN); int stepW = (1 << lodW); int stepE = (1 << lodE); int max = this->blockSize - 1; // 3 indices per triangle * 2 triangles per quad * max. as many quads as levels this->geometryStorage->LockIndicesGroup( 3 * 2 * (1 << (this->numLODLevels)) ); // first part, colliding west cell, goal is connect all edges from N // the first triangle collides with both edges N and W int z = stepW; int xn = 0; while(xn < step) { this->AddTriangle( 0, z, xn + stepN, 0, xn, 0); xn += stepN; z = min(z + stepW,step); } // intermediate parts (not colliding west or east cell) while(xn < max) { // extra triangle for first part not colliding neither W nor N if (xn <= (max - step)) { this->AddTriangle( xn - step, step, xn, step, xn, 0); } // generate one triangle for each N edge int x = 0; while(x < step) { this->AddTriangle( xn + x + stepN, 0, xn + x, 0, xn, step); x += stepN; } xn += step; } // if west band crack-fix band is not generated, we must add some triangles // for the northest part of the west edge if (this->HasNotCrackFixBand(lod, lodW, lodN)) { // generate one triangle for each W edge int x = stepN; int zw = stepW; while(zw < step) { this->AddTriangle( 0, zw, 0, zw + stepW, x, 0); x = min(x + stepN, step); zw += stepW; } } // if east band crack-fix band is not done, we must add some triangles // for the northest part of the east edge if (this->HasNotCrackFixBand(lod, lodE, lodS)) { // generate one triangle for each E edge int x0 = max - step; int x1 = max; int z = 0; while(z < step) { this->AddTriangle( x0, step, x1, z + stepE, x1, z); z += stepE; } } this->geometryStorage->UnlockIndicesGroup(); } //------------------------------------------------------------------------------ /** */ void nGMMIndexLODNBuilder::FillIndicesWest( int lod, int lodN, int lodE, int lodS, int lodW) { // calculate steps int step = (1 << lod); int stepN = (1 << lodN); int stepW = (1 << lodW); int stepS = (1 << lodS); int max = this->blockSize - 1; // 3 indices per triangle * 2 triangles per quad * max. as many quads as levels this->geometryStorage->LockIndicesGroup( 3 * 2 * (1 << (this->numLODLevels)) ); // first part, colliding north cell, goal is connect all edges from W // we generate only one triangle with common edge W and N (upper left) int x = min(stepN, step); int zw = 0; while(zw < step) { this->AddTriangle( 0, zw, 0, zw + stepW, x, 0); if (zw != 0) { x = min(x + stepN, step); } zw += stepW; } // intermediate parts (not colliding north or south cell) while(zw < max) { // extra triangle for first part not colliding neither W nor N this->AddTriangle( 0, zw, step, zw, step, zw - step); // generate one triangle for each W edge int z = 0; while(z < step) { this->AddTriangle( 0, zw + z, 0, zw + z + stepW, step, zw); z += stepW; } zw += step; } // if north band crack-fix band is not generated, we must add some triangles // for the west-most part of the north edge if (this->HasNotCrackFixBand(lod, lodN, lodW)) { int z = stepW; int xn = 0; while(xn < step) { this->AddTriangle( 0, z, xn + stepN, 0, xn, 0); xn += stepN; z = min(z + stepW, step); } } // if south band crack-fix band is not generated, we must add some triangles // for the west-most part of the south edge if (this->HasNotCrackFixBand(lod, lodS, lodE)) { int x = 0; while(x < step) { this->AddTriangle( x, max, x + stepS, max, step, max - step); x += stepS; } } this->geometryStorage->UnlockIndicesGroup(); } //------------------------------------------------------------------------------ /** */ void nGMMIndexLODNBuilder::FillIndicesEast( int lod, int lodN, int lodE, int lodS, int lodW) { // calculate steps int step = (1 << lod); int stepN = (1 << lodN); int stepE = (1 << lodE); int stepS = (1 << lodS); int max = this->blockSize - 1; // 3 indices per triangle * 2 triangles per quad * max. as many quads as levels this->geometryStorage->LockIndicesGroup( 3 * 2 * (1 << (this->numLODLevels)) ); // intermediate parts (not colliding neither north nor south cell) int x0 = max - step; int ze = 0; while(ze < (max - step)) { // generate one triangle for each E edge int z = 0; while(z < step) { this->AddTriangle( x0, ze + step, max, ze + z + stepE, max, ze + z); z += stepE; } ze += step; // extra triangle for part not colliding neither external E, N, S edges this->AddTriangle( x0, ze + step, max, ze, x0, ze); } // last part, colliding south cell, goal is connect all edges from E // we generate only one triangle with common edge E and S (bottom left) int x = max(max - stepS, max - step); ze = max; while(ze > (max - step)) { this->AddTriangle( max, ze, max, ze - stepE, x, max); x = max(x - stepS, max - step); ze -= stepE; } // if north band crack-fix band is not generated, we must add some triangles // for the east-most part of the north edge if (this->HasNotCrackFixBand(lod, lodN, lodW)) { // generate one triangle for each N edge int x = 0; while(x < step) { this->AddTriangle( x0 + x + stepN, 0, x0 + x, 0, x0, step); x += stepN; } } // if south band crack-fix band is not generated, we must add some triangles // for the east-most part of the south edge if (this->HasNotCrackFixBand(lod, lodS, lodE)) { int z = max - stepE; int xs = max; while(xs > max - step) { this->AddTriangle( xs - stepS, max, xs, max, max, z); xs -= stepS; z = max(z - stepE, max - step); } } this->geometryStorage->UnlockIndicesGroup(); } //------------------------------------------------------------------------------ /** */ void nGMMIndexLODNBuilder::FillIndicesSouth( int lod, int lodN, int lodE, int lodS, int lodW) { // calculate steps int step = (1 << lod); int stepE = (1 << lodE); int stepW = (1 << lodW); int stepS = (1 << lodS); int max = this->blockSize - 1; // 3 indices per triangle * 2 triangles per quad * max. as many quads as levels this->geometryStorage->LockIndicesGroup( 3 * 2 * (1 << (this->numLODLevels)) ); // intermediate parts (not colliding neither west nor east cells) int xs = 0; while(xs < max - step) { // generate one triangle for each S edge int x = 0; while(x < step) { this->AddTriangle( xs + x, max, xs + x + stepS, max, xs + step, max - step); x += stepS; } xs += step; // extra triangle for part not colliding neither external cells this->AddTriangle( xs + step, max - step, xs, max - step, xs, max); } // last part, colliding east cell, goal is connect all edges from S // we generate only one triangle with common edge E and S (bottom right) int z = max - stepE; xs = max; while(xs > max - step) { this->AddTriangle( xs - stepS, max, xs, max, max, z); if (xs != max) { z = max(z - stepE, max - step); } xs -= stepS; } // if west band crack-fix band is not generated, we must add some triangles // for the west-most part of the south edge if (this->HasNotCrackFixBand(lod, lodW, lodN)) { // generate one triangle for each W edge int zw = max - stepW; int z = 0; while(z < step) { this->AddTriangle( 0, zw + z, 0, zw + z + stepW, step, zw); z += stepW; } } // if west band crack-fix band is not generated, we must add some triangles // for the west-most part of the south edge if (this->HasNotCrackFixBand(lod, lodE, lodS)) { // last part, colliding south cell, goal is connect all edges from E // we generate only one triangle with common edge E and S (bottom left) int x = max; int ze = max; while(ze > max - step) { this->AddTriangle( max, ze, max, ze - stepE, x, max); x = max(x - stepS, max - step); ze -= stepE; } } this->geometryStorage->UnlockIndicesGroup(); } //------------------------------------------------------------------------------ /** */ bool nGMMIndexLODNBuilder::HasNotCrackFixBand(int lod, int lodSide1, int lodSide2) { //return (lod < lodSide || (lod == lodSide && lod < (this->numLODLevels - 1))); return (lod < lodSide1) || (lod == lodSide1 && (lod < (this->numLODLevels - 1) || lod <= lodSide2)); //return (lod <= lodSide1); }
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
[ [ [ 1, 604 ] ] ]
cc690ee68a331b66f5d7e053c5eec3c6bc605d75
b8fbe9079ce8996e739b476d226e73d4ec8e255c
/src/engine/rb_render8/renderstate.h
d1c889ea3e23fd04df1f5105079674b33386e9a0
[]
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
9,566
h
/***********************************************************************************/ // File: RenderState.h // Date: 16.09.2005 // Author: Ruslan Shestopalyuk /***********************************************************************************/ #ifndef __RENDERSTATE_H__ #define __RENDERSTATE_H__ /***********************************************************************************/ /* Enum: CmpFunc // Desc: /***********************************************************************************/ enum CmpFunc { cfUnknown = 0, cfNever = 1, cfLess = 2, cfEqual = 3, cfLessEqual = 4, cfGreater = 5, cfNotEqual = 6, cfGreaterEqual = 7, cfAlways = 8, }; // enum CmpFunc enum_beg(CmpFunc) enum_val( "Unknown", cfUnknown ), enum_val( "Never", cfNever ), enum_val( "Less", cfLess ), enum_val( "Equal", cfEqual ), enum_val( "LessEqual", cfLessEqual ), enum_val( "Greater", cfGreater ), enum_val( "NotEqual", cfNotEqual ), enum_val( "GreaterEqual",cfGreaterEqual ), enum_val( "Always", cfAlways ) enum_end(CmpFunc) /***********************************************************************************/ /* Enum: FillMode // Desc: /***********************************************************************************/ enum FillMode { fmUnknown = 0, fmPoint = 1, fmWireframe = 2, fmSolid = 3, }; // enum FillMode enum_beg(FillMode) enum_val( "Unknown", fmUnknown ), enum_val( "Point", fmPoint ), enum_val( "Wireframe", fmWireframe ), enum_val( "Solid", fmSolid ) enum_end(FillMode) /***********************************************************************************/ /* Enum: CullMode // Desc: /***********************************************************************************/ enum CullMode { cmUnknown = 0, cmNone = 1, cmCW = 2, cmCCW = 3, }; // enum CullMode enum_beg(CullMode) enum_val( "Unknown", cmUnknown ), enum_val( "None", cmNone ), enum_val( "CW", cmCW ), enum_val( "CCW", cmCCW ) enum_end(CullMode) /***********************************************************************************/ /* Enum: BlendMode // Desc: /***********************************************************************************/ enum BlendMode { bmUnknown = 0, bmZero = 1, bmOne = 2, bmSrcColor = 3, bmInvSrcColor = 4, bmSrcAlpha = 5, bmInvSrcAlpha = 6, bmDestAlpha = 7, bmInvDestAlpha = 8, bmDestColor = 9, bmInvDestColor = 10, bmSrcAlphaSat = 11, bmBothSrcAlpha = 12, bmBothInvSrcAlpha = 13, bmBlendFactor = 14, bmInvBlendFactor = 15, }; // enum BlendMode enum_beg(BlendMode) enum_val( "Unknown", bmUnknown ), enum_val( "Zero", bmZero ), enum_val( "One", bmOne ), enum_val( "SrcColor", bmSrcColor ), enum_val( "InvSrcColor", bmInvSrcColor ), enum_val( "SrcAlpha", bmSrcAlpha ), enum_val( "InvSrcAlpha", bmInvSrcAlpha ), enum_val( "DestAlpha", bmDestAlpha ), enum_val( "InvDestAlpha", bmInvDestAlpha ), enum_val( "DestColor", bmDestColor ), enum_val( "InvDestColor", bmInvDestColor ), enum_val( "SrcAlphaSat", bmSrcAlphaSat ), enum_val( "BothSrcAlpha", bmBothSrcAlpha ), enum_val( "BothInvSrcAlpha", bmBothInvSrcAlpha ), enum_val( "BlendFactor", bmBlendFactor ), enum_val( "InvBlendFactor", bmInvBlendFactor ) enum_end(BlendMode) /***********************************************************************************/ /* Enum: bool3 // Desc: /***********************************************************************************/ enum bool3 { bUnknown = 0, bTrue = 1, bFalse = 2, }; // enum bool3 enum_beg(bool3) enum_val( "Unknown", bUnknown ), enum_val( "True", bTrue ), enum_val( "False", bFalse ) enum_end(bool3) /***********************************************************************************/ // Class: RenderState // Desc: /***********************************************************************************/ enum FogVertexMode { fvmUnknown = 0, fvmNone = 1, fvmExp = 2, fvmExp2 = 3, fvmLinear = 4, }; // enum FogVertexMode enum_beg(FogVertexMode) enum_val( "Unknown", fvmUnknown ), enum_val( "None", fvmNone ), enum_val( "Exp", fvmExp ), enum_val( "Exp2", fvmExp2 ), enum_val( "Linear", fvmLinear ) enum_end(FogVertexMode) /***********************************************************************************/ /* Enum: ShadeMode // Desc: /***********************************************************************************/ enum ShadeMode { ShadeMode_Unknown = 0, ShadeMode_Flat = 1, ShadeMode_Gouraud = 2, ShadeMode_Phong = 3, }; // enum ShadeMode enum_beg(ShadeMode) enum_val( "Unknown", ShadeMode_Unknown ), enum_val( "Flat", ShadeMode_Flat ), enum_val( "Gouraud", ShadeMode_Gouraud ), enum_val( "Phong", ShadeMode_Phong ) enum_end(ShadeMode) /***********************************************************************************/ /* Enum: MaterialSource // Desc: /***********************************************************************************/ enum MaterialSource { msUnknown = 0, msMaterial = 1, msColor1 = 2, msColor2 = 3, }; // enum MaterialSource enum_beg(MaterialSource) enum_val( "Unknown", msUnknown ), enum_val( "Material", msMaterial ), enum_val( "Color1", msColor1 ), enum_val( "Color2", msColor2 ) enum_end(MaterialSource) /***********************************************************************************/ // Class: RenderState // Desc: /***********************************************************************************/ class RenderState : public JObject { bool3 m_bAlphaBlendEnable; BlendMode m_SrcBlend; BlendMode m_DestBlend; bool3 m_bAlphaTestEnable; CmpFunc m_AlphaFunc; DWORD m_AlphaRef; bool3 m_bDitherEnable; bool3 m_bLighting; bool3 m_bZEnable; bool3 m_bZWriteEnable; bool3 m_bSpecularEnable; CmpFunc m_ZFunc; CullMode m_CullMode; DWORD m_TextureFactor; FillMode m_FillMode; bool3 m_bNormalizeNormals; ShadeMode m_ShadeMode; bool3 m_ColorVertex; MaterialSource m_DiffuseMaterialSource; MaterialSource m_SpecularMaterialSource; MaterialSource m_AmbientMaterialSource; MaterialSource m_EmissiveMaterialSource; bool3 m_bFogEnable; DWORD m_FogColor; FogVertexMode m_FogVertexMode; float m_FogStart; float m_FogEnd; bool3 m_bRangeFogEnable; public: RenderState (); virtual void Render (); expose(RenderState) { parent(JObject); field( "alphablendenable", m_bAlphaBlendEnable ); field( "srcblend", m_SrcBlend ); field( "destblend", m_DestBlend ); field( "alphatestenable", m_bAlphaTestEnable ); field( "alphafunc", m_AlphaFunc ); field( "alpharef", m_AlphaRef ); field( "ditherenable", m_bDitherEnable ); field( "lighting", m_bLighting ); field( "zenable", m_bZEnable ); field( "zwriteenable", m_bZWriteEnable ); field( "zfunc", m_ZFunc ); field( "cullmode", m_CullMode ); field( "texturefactor", m_TextureFactor ); field( "fogenable", m_bFogEnable ); field( "specularenable", m_bSpecularEnable ); field( "fogcolor", m_FogColor ); field( "fogvertexmode", m_FogVertexMode ); field( "fogstart", m_FogStart ); field( "fogend", m_FogEnd ); field( "rangefogenable", m_bRangeFogEnable ); field( "fillmode", m_FillMode ); field( "NormalizeNormals", m_bNormalizeNormals ); field( "ShadeMode", m_ShadeMode ); field( "ColorVertex", m_ColorVertex ); field( "DiffuseMaterialSource", m_DiffuseMaterialSource ); field( "SpecularMaterialSource", m_SpecularMaterialSource ); field( "AmbientMaterialSource", m_AmbientMaterialSource ); field( "EmissiveMaterialSource", m_EmissiveMaterialSource ); } }; // class RenderState #endif //__RENDERSTATE_H__
[ [ [ 1, 274 ] ] ]
611f2953282f58556b988078caf80c28d86aaf7c
c1a2953285f2a6ac7d903059b7ea6480a7e2228e
/deitel/ch10/Fig10_24_27/Interface.h
076853097a971bd74490a26210339cc8c71b8c48
[]
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,665
h
// Fig. 10.25: Interface.h // Proxy class Interface definition. // Client sees this source code, but the source code does not reveal // the data layout of class Implementation. class Implementation; // forward class declaration required by line 17 class Interface { public: Interface( int ); // constructor void setValue( int ); // same public interface as int getValue() const; // class Implementation has ~Interface(); // destructor private: // requires previous forward declaration (line 6) Implementation *ptr; }; // end class Interface /************************************************************************** * (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, 33 ] ] ]
7e662ccba48469e08e93e962f65dab818cd89415
a352572bc22d863f72020118d8f5b94c69521f3f
/cs4620/src/Random.cpp
92291d1277cdea68afa8e70aee83daf765299ba7
[]
no_license
mjs513/cs4620-1
63345a9a7774279d8d6ab63b1af64d65b14b0ae3
419da5df73c5a9c34387b3cd2f7f3c542e0a3c3e
refs/heads/master
2021-01-10T06:45:47.809907
2010-12-10T20:59:46
2010-12-10T20:59:46
46,994,144
0
0
null
null
null
null
UTF-8
C++
false
false
806
cpp
/* * Random.cpp * * Created on: Sep 25, 2010 * Author: Roberto */ #include "Random.h" #include <cstdlib> #include <cmath> RandomDouble::RandomDouble() : _min(0), _max(1) { } RandomDouble::RandomDouble(double min, double max) : _min(min), _max(max) { } double RandomDouble::rand() const { double alpha = double(std::rand())/RAND_MAX; return alpha*_min + (1 - alpha)*_max; } RandomNormal::RandomNormal() : _mean(0), _deviance(1) { } RandomNormal::RandomNormal(double mean, double variance) : _mean(mean), _deviance(std::sqrt(variance)) { } double RandomNormal::rand() const { RandomDouble drand(0.001,1); double u = drand.rand(),v = drand.rand(); double z = std::sqrt(-2*std::log(u))*std::cos(2*M_PI*v); return _deviance*z + _mean; }
[ "robertorfischer@ebbd4279-5267-bd07-7df5-4dafc36418f6" ]
[ [ [ 1, 40 ] ] ]
b64b49acd613e867cbc17659601fcef0a735a4ca
0813282678cb6bb52cd0001a760cfbc24663cfca
/GAChromosome.h
6935af0ad68814932efdd03b99d7e463c6435430
[]
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
2,464
h
#pragma once #include "stdafx.h" #include "MemoryPool.h" #include "FastString.h" #include "Vector.h" template<typename TGene, typename TFitness> class CGAChromosome : public CMemPoolNode<CGAChromosome<TGene, TFitness>> { public: CGAChromosome(const CVector<TGene> &init) : m_value(init) {} CGAChromosome(const CGAChromosome<TGene, TFitness> &chromosome) : m_value(chromosome.GetValue()) { SetFitness(chromosome.GetFitness()); } void SetFitness(TFitness fitness) { m_fitness = fitness; } TFitness GetFitness() const { return m_fitness; } void SetValue(const CVector<TGene> &value) { m_value = value; } CVector<TGene> &GetValue() { return m_value; } const CVector<TGene> &GetValue() const { return m_value; } CGAChromosome<TGene, TFitness> *Clone() const { return new CGAChromosome<TGene, TFitness>(*this); } CGAChromosome<TGene, TFitness> *Breed(const CGAChromosome<TGene, TFitness> *spouse, double crossover) const; protected: CVector<TGene> m_value; TFitness m_fitness; }; template<typename TGene, typename TFitness> CGAChromosome<TGene, TFitness> *CGAChromosome<TGene, TFitness>::Breed(const CGAChromosome<TGene, TFitness> *spouse, double crossover) const { CVector<TGene> value; value.append(m_value.data(), (size_t)(crossover * m_value.size())); size_t crossoverPoint = (size_t)(crossover * spouse->GetValue().size()); value.append(spouse->GetValue().data() + crossoverPoint, spouse->GetValue().size() - crossoverPoint); return new CGAChromosome<TGene, TFitness>(value); } template<typename TGene, typename TFitness> int CompareChromosome(const void *p1, const void *p2) { const CGAChromosome<TGene, TFitness> *chromosome1 = *(const CGAChromosome<TGene, TFitness> **)(p1); const CGAChromosome<TGene, TFitness> *chromosome2 = *(const CGAChromosome<TGene, TFitness> **)(p2); if(!chromosome1) return 1; else if(!chromosome2) return -1; else if(chromosome2->GetFitness() < chromosome1->GetFitness()) return -1; else if(chromosome1->GetFitness() < chromosome2->GetFitness()) return 1; else { if(chromosome1->GetValue().size() < chromosome2->GetValue().size()) return -1; else if(chromosome2->GetValue().size() < chromosome1->GetValue().size()) return 1; else { if(chromosome1->GetValue() < chromosome2->GetValue()) return -1; else if(chromosome2->GetValue() < chromosome1->GetValue()) return 1; else return 0; } } }
[ "[email protected]@a0245358-5b9e-171e-63e1-2316ddff5996", "CarbonTwelve.Developer@a0245358-5b9e-171e-63e1-2316ddff5996" ]
[ [ [ 1, 6 ], [ 9, 11 ], [ 13, 13 ], [ 16, 17 ], [ 19, 20 ], [ 22, 22 ], [ 24, 26 ], [ 28, 29 ], [ 32, 37 ], [ 39, 40 ], [ 42, 43 ], [ 46, 70 ] ], [ [ 7, 8 ], [ 12, 12 ], [ 14, 15 ], [ 18, 18 ], [ 21, 21 ], [ 23, 23 ], [ 27, 27 ], [ 30, 31 ], [ 38, 38 ], [ 41, 41 ], [ 44, 45 ] ] ]
edce9416530692126657046b36f13b9bbcce7ce7
7b2e060c400c31fb440b5c0ee7658ddaf8839ddc
/libopenJaus/src/nodeManager/JausCommunicationManager.cpp
ffb54f527f1a4c5d2c2721a0cdbbe1ed8f699fb3
[ "BSD-3-Clause" ]
permissive
autoMaxter/openjaus.version33c
495ba9c04782f3d545e36813f93c5fdda9e72b58
b3722c13c3a9286ec41eb43c47a8559acd3ba2ab
refs/heads/master
2021-01-01T03:32:59.251382
2010-11-19T17:12:43
2010-11-19T17:12:43
56,123,285
0
0
null
null
null
null
UTF-8
C++
false
false
3,821
cpp
/***************************************************************************** * Copyright (c) 2009, OpenJAUS.com * All rights reserved. * * This file is part of OpenJAUS. OpenJAUS is distributed under the BSD * license. See the LICENSE file for details. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the University of Florida 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. ****************************************************************************/ // File Name: JausCommunicationManager.cpp // // Written By: Danny Kent (jaus AT dannykent DOT com) // // Version: 3.3.0b // // Date: 09/08/09 // // Description: This file defines a JausCommunicationManager interface. // This class is a virtual class which supports the common fuctionality of // comminication managers. #include "nodeManager/JausCommunicationManager.h" #include "nodeManager/JausTransportInterface.h" JausCommunicationManager::JausCommunicationManager(void) {} JausCommunicationManager::~JausCommunicationManager(void) {} unsigned long JausCommunicationManager::getInterfaceCount(void) { return (unsigned long) this->interfaces.size(); } JausTransportInterface *JausCommunicationManager::getJausInterface(unsigned long index) { if(index < this->interfaces.size()) { return this->interfaces[index]; } else { return NULL; } } JausTransportInterface *JausCommunicationManager::getJausInterface(std::string interfaceName) { for(unsigned long i = 0; i < this->interfaces.size(); i++) { if(this->interfaces.at(i)->getName() == interfaceName) { return this->interfaces.at(i); } } return NULL; } bool JausCommunicationManager::interfaceExists(std::string interfaceName) { for(unsigned long i = 0; i < this->interfaces.size(); i++) { if(this->interfaces.at(i)->getName() == interfaceName) { return true; } } return false; } void JausCommunicationManager::enable(void) { enabled = true; } void JausCommunicationManager::disable(void) { enabled = false; } bool JausCommunicationManager::isEnabled(void) { return enabled; } SystemTree *JausCommunicationManager::getSystemTree() { return this->systemTree; } MessageRouter *JausCommunicationManager::getMessageRouter() { return this->msgRouter; }
[ "danny@localhost" ]
[ [ [ 1, 119 ] ] ]
d1f58f41bae085fa983cfcca13a82c4ba745d59f
2982a765bb21c5396587c86ecef8ca5eb100811f
/util/wm5/LibCore/ObjectSystems/Wm5InStream.inl
4d7aeacd460c1b361251641a2832a99d4c9d826a
[]
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
8,721
inl
// 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.1 (2010/07/01) //---------------------------------------------------------------------------- template <typename T> bool InStream::Read (T& datum) { return mSource.Read(sizeof(T), &datum); } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadVV (int numElements, T* data) { if (numElements > 0) { return mSource.Read(sizeof(T), numElements, data); } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadVR (int numElements, T*& data) { if (numElements > 0) { data = new1<T>(numElements); return mSource.Read(sizeof(T), numElements, data); } data = 0; return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadRR (int& numElements, T*& data) { if (!mSource.Read(sizeof(int), &numElements)) { numElements = 0; data = 0; return false; } if (numElements > 0) { data = new1<T>(numElements); return mSource.Read(sizeof(T), numElements, data); } data = 0; return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadEnum (T& datum) { int value; if (!mSource.Read(sizeof(int), &value)) { return false; } datum = (T)value; return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadEnumVV (int numElements, T* data) { if (numElements > 0) { for (int i = 0; i < numElements; ++i) { if (!ReadEnum(data[i])) { return false; } } } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadEnumVR (int numElements, T*& data) { if (numElements > 0) { data = new1<T>(numElements); for (int i = 0; i < numElements; ++i) { if (!ReadEnum(data[i])) { return false; } } } else { data = 0; } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadEnumRR (int& numElements, T*& data) { if (!mSource.Read(sizeof(int), &numElements)) { numElements = 0; data = 0; return false; } if (numElements > 0) { data = new1<T>(numElements); for (int i = 0; i < numElements; ++i) { if (!ReadEnum(data[i])) { return false; } } } else { data = 0; } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointer (T*& object) { unsigned int uniqueID; mSource.Read(sizeof(unsigned int), &uniqueID); object = reinterpret_cast<T*>(uniqueID); return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointerVV (int numElements, T** objects) { if (numElements > 0) { for (int i = 0; i < numElements; ++i) { if (!ReadPointer(objects[i])) { return false; } } } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointerVR (int numElements, T**& objects) { if (numElements > 0) { objects = new1<T*>(numElements); for (int i = 0; i < numElements; ++i) { if (!ReadPointer(objects[i])) { return false; } } } else { objects = 0; } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointerRR (int& numElements, T**& objects) { if (!mSource.Read(sizeof(int), &numElements)) { numElements = 0; objects = 0; return false; } if (numElements > 0) { objects = new1<T*>(numElements); for (int i = 0; i < numElements; ++i) { if (!ReadPointer(objects[i])) { return false; } } } else { objects = 0; } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointer (Pointer0<T>& object) { unsigned int uniqueID; mSource.Read(sizeof(unsigned int), &uniqueID); unsigned int* data = reinterpret_cast<unsigned int*>(&object); *data = uniqueID; return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointerVV (int numElements, Pointer0<T>* objects) { if (numElements > 0) { for (int i = 0; i < numElements; ++i) { if (!ReadPointer(objects[i])) { return false; } } } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointerVR (int numElements, Pointer0<T>*& objects) { if (numElements > 0) { objects = new1<Pointer0<T> >(numElements); for (int i = 0; i < numElements; ++i) { if (!ReadPointer(objects[i])) { return false; } } } else { objects = 0; } return true; } //---------------------------------------------------------------------------- template <typename T> bool InStream::ReadPointerRR (int& numElements, Pointer0<T>*& objects) { if (!mSource.Read(sizeof(int), &numElements)) { numElements = 0; objects = 0; return false; } if (numElements > 0) { objects = new1<Pointer0<T> >(numElements); for (int i = 0; i < numElements; ++i) { if (!ReadPointer(objects[i])) { return false; } } } else { objects = 0; } return true; } //---------------------------------------------------------------------------- template <typename T> void InStream::ResolveLink (T*& object) { if (object) { uint64_t uniqueID = reinterpret_cast<uint64_t>((void*)object); LinkMap::iterator iter = mLinked.find(uniqueID); if (iter != mLinked.end()) { object = (T*)iter->second; } else { assertion(false, "Unexpected link failure.\n"); object = 0; } } } //---------------------------------------------------------------------------- template <typename T> void InStream::ResolveLink (int numElements, T** objects) { for (int i = 0; i < numElements; ++i) { ResolveLink(objects[i]); } } //---------------------------------------------------------------------------- template <class T> void InStream::ResolveLink (Pointer0<T>& object) { if (object) { uint64_t uniqueID = reinterpret_cast<uint64_t>((void*)object); LinkMap::iterator iter = mLinked.find(uniqueID); *(T**)&object = 0; if (iter != mLinked.end()) { object = (T*)iter->second; } else { assertion(false, "Unexpected link failure.\n"); object = 0; } } } //---------------------------------------------------------------------------- template <typename T> void InStream::ResolveLink (int numElements, Pointer0<T>* objects) { for (int i = 0; i < numElements; ++i) { ResolveLink(objects[i]); } } //----------------------------------------------------------------------------
[ [ [ 1, 347 ] ] ]
38ecc7f2e6d965ea4329834c78d63f2bf4a75969
96e96a73920734376fd5c90eb8979509a2da25c0
/C3DE/VideoMesh.h
b0a1532e35affcbd9d6de940444feecb8c769432
[]
no_license
lianlab/c3de
9be416cfbf44f106e2393f60a32c1bcd22aa852d
a2a6625549552806562901a9fdc083c2cacc19de
refs/heads/master
2020-04-29T18:07:16.973449
2009-11-15T10:49:36
2009-11-15T10:49:36
32,124,547
0
0
null
null
null
null
UTF-8
C++
false
false
493
h
#ifndef VIDEO_MESH_H #define VIDEO_MESH_H #include "D3DMesh.h" #include "ResourceManager.h" #include <vfw.h> class VideoMesh : public D3DMesh { public: VideoMesh(VideoStructure *a_video); ~VideoMesh(); void Update(int deltaTime); void SetShaderHandlers(); protected: VideoStructure *m_video; long m_currentFrame; IDirect3DTexture9 *m_currentFrameTexture; D3DXHANDLE m_hTex; D3DXHANDLE m_shaderAlpha;//galpha //PGETFRAME * m_video; }; #endif
[ "caiocsabino@7e2be596-0d54-0410-9f9d-cf4183935158" ]
[ [ [ 1, 31 ] ] ]
72d377abdeaa015ae5981bbe704444c1260913f2
14b1a8bce788af0a3f3479a3e5323ce1729e2084
/CoreApp/src/VisualizationManager.h
a71f481649fb7c0182a7d5978f46833913970fdf
[]
no_license
PedroLopes/MtDjing
0d0aae75690944685e17779d9c6c9d2c17def17e
6a19b73cf4897cd6f7ab581ebd0bbf19dbb69e24
refs/heads/master
2020-05-29T12:54:00.972977
2010-05-23T18:53:55
2010-05-23T18:53:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
516
h
/* * VisualizationManager.h * * Created on: Apr 19, 2010 * Author: PedroLopes */ #ifndef VISUALIZATIONMANAGER_H_ #define VISUALIZATIONMANAGER_H_ #include "BasicManager.h" #include <string> namespace MtDjing { class VisualizationManager: public MtDjing::BasicManager { public: VisualizationManager(string _name, int _id, bool _stupid); virtual ~VisualizationManager(); bool getStupid() const; protected: bool stupid; }; } #endif /* VISUALIZATIONMANAGER_H_ */
[ [ [ 1, 32 ] ] ]
95cac168be750cdd6a317afd52e2cc3b4cab8580
f25e9e8fd224f81cefd6d900f6ce64ce77abb0ae
/Exercises/OpenGL6/DDEngine/mutexManager.h
98a68fbd1f7c599d453b2d9c580aecd15799b667
[]
no_license
giacomof/gameengines2010itu
8407be66d1aff07866d3574a03804f2f5bcdfab1
bc664529a429394fe5743d5a76a3d3bf5395546b
refs/heads/master
2016-09-06T05:02:13.209432
2010-12-12T22:18:19
2010-12-12T22:18:19
35,165,366
0
0
null
null
null
null
UTF-8
C++
false
false
439
h
#ifdef __DDEngine # define MutexManager_D __declspec(dllexport) #else # define MutexManager_D __declspec(dllimport) #endif #ifndef MutexManager__H #define MutexManager__H #include <SDL_mutex.h> class MutexManager_D MutexManager { public: MutexManager(void); ~MutexManager(void); static void MutexManager::lockMutex( SDL_mutex * m ); static void MutexManager::unlockMutex( SDL_mutex * m ); }; #endif
[ "[email protected]@1a5f623d-5e27-cfcb-749e-01bf3eb0ad9d" ]
[ [ [ 1, 24 ] ] ]
e7270a257068dcdf12b011b0597a9edd809aee6b
1bd75b9c45c3d5d5af3a9c9ba84ab0d4ec1bfd8f
/SndCardServices.h
e7c2b075bfcd2e78f3c3645590af1d1e1fb33e5f
[]
no_license
nadernt/whistle-recognizer
168634eda147752fada31d1b4e073971a053b4bf
7f260f7ee38d9445e2f0806566bbc0ceb45d3986
refs/heads/master
2020-04-06T04:26:13.138539
2010-01-12T17:11:08
2017-02-23T12:22:25
82,922,754
1
0
null
null
null
null
UTF-8
C++
false
false
528
h
#pragma once #include <mmsystem.h> #pragma comment ( lib, "winmm.lib") class SndCard { public: SndCard(void); ~SndCard(void); void nSetVolume(char *SrcName,int ControlTypeID,DWORD VolSize); // ControlTypeID-> 0:Speaker 1:Input 2:OutPut DWORD nGetVolume(char *SrcName,int ControlTypeID); // ControlTypeID-> 0:Speaker 1:Input 2:OutPut void nSourceSelector(char *SrcName); void nMuteUnMute(char *SrcName,BOOL MuteState); int nMuteGetState(char *SrcName); private: DWORD nGetDevType(char *SrcName); };
[ [ [ 1, 18 ] ] ]
f5dd91b6f215d5703f5c25e4a00abb6265d9b564
4797c7058b7157e3d942e82cf8ad94b58be488ae
/EnemyShipBig.cpp
85408c3a745ccf98f8ed476468757c46ba38af9b
[]
no_license
koguz/DirectX-Space-Game
2d1d8179439870fd1427beb9624f1c5452546c39
be672051fd0009cbd5851c92bd344d3b23645474
refs/heads/master
2020-05-18T02:11:47.963185
2011-05-25T14:35:26
2011-05-25T14:35:26
1,799,267
0
0
null
null
null
null
UTF-8
C++
false
false
522
cpp
#include "EnemyShipBig.h" EnemyShipBig::EnemyShipBig():EnemyShipBase() { speed = 0.0f; lastShot = 0; } bool EnemyShipBig::Init(IDirect3DDevice9* d, IDirectSound8 *s) { ((MyMesh*)(this))->Init(d, "shuttle02.x"); Sound = s; Engine.Init(Sound, "EnemyBigEngine.wav"); Fire.Init(Sound, "EnemyAFire.wav"); Fire.SetLoop(false); HitSound.Init(Sound, "hitship.wav"); HitSound.SetLoop(false); Engine.Play(); state = HOLD; type = TYPEBIG; health = 5000; rotAngle = 0.1f; return true; }
[ [ [ 1, 27 ] ] ]
ad08eb86b6af87e9cdbcc9e67911a3a0e6613bd9
00a4dc4a9ea1fc6657a81607e285055fc29bda29
/Learn/source/Learn.cpp
5eaecb5755103281a20d4177f40c09a681d921ae
[]
no_license
etgarcia/AS3-for-Airplay-SDK
d5d5e2443879b37aff7486d8f07453769568cbfc
470f2cc49d19642128f49dcc5618702671a1f851
refs/heads/master
2016-09-05T10:21:56.570562
2011-01-27T06:25:13
2011-01-27T06:25:13
1,380,021
0
0
null
null
null
null
UTF-8
C++
false
false
1,022
cpp
// Alright, just learning how to use AirPlay SDK #include "Iw2D.h" // Attempt to lock to 30 frames per second #define MS_PER_FRAME (1000 / 25) int main() { Iw2DInit(); CIw2DImage* g_AirplayLogo = Iw2DCreateImage("largeAirplayLogo.bmp"); while (1) { int64 start = s3eTimerGetMs(); if (s3eDeviceCheckQuitRequest()) break; // Clear the screen Iw2DSurfaceClear(0xffffffff); CIwSVec2 topLeft = CIwSVec2((int16)(Iw2DGetSurfaceWidth() / 2 - g_AirplayLogo->GetWidth() / 2), (int16)(Iw2DGetSurfaceHeight() / 2 - g_AirplayLogo->GetHeight() / 2)); CIwSVec2 size = CIwSVec2((int16)g_AirplayLogo->GetWidth(), (int16)g_AirplayLogo->GetHeight()); Iw2DDrawImage(g_AirplayLogo, topLeft, size); Iw2DSurfaceShow(); // Attempt frame rate while ((s3eTimerGetMs() - start) < MS_PER_FRAME) { int32 yield = (int32) (MS_PER_FRAME - (s3eTimerGetMs() - start)); if (yield<0) break; s3eDeviceYield(yield); } } delete g_AirplayLogo; Iw2DTerminate(); return 0; }
[ "etgarcia@d6d0176c-4ec9-df4c-96f2-63634c7079df" ]
[ [ [ 1, 36 ] ] ]
bea21591b09a5b92e98aa410acea674d43badced
2dbbca065b62a24f47aeb7ec5cd7a4fd82083dd4
/OUAN/OUAN/Src/Game/GameObject/GameObjectHeart.cpp
4808f9d354a63a22e0736855cf7e1474d3b9b934
[]
no_license
juanjmostazo/once-upon-a-night
9651dc4dcebef80f0475e2e61865193ad61edaaa
f8d5d3a62952c45093a94c8b073cbb70f8146a53
refs/heads/master
2020-05-28T05:45:17.386664
2010-10-06T12:49:50
2010-10-06T12:49:50
38,101,059
1
1
null
null
null
null
UTF-8
C++
false
false
9,556
cpp
#include "OUAN_Precompiled.h" #include "GameObjectHeart.h" #include "../GameWorldManager.h" #include "../../Graphics/RenderComponent/RenderComponentParticleSystem.h" #include "../../Audio/AudioComponent/AudioComponent.h" using namespace OUAN; GameObjectHeart::GameObjectHeart(const std::string& name) :GameObject(name,GAME_OBJECT_TYPE_HEART) { } GameObjectHeart::~GameObjectHeart() { } void GameObjectHeart::reset() { GameObject::reset(); //mLogicComponentItem->setState(STATE_ITEM_NOT_TAKEN); mLogicComponentItem->setIsTaken(false); } void GameObjectHeart::disable() { GameObject::disable(); mRenderComponentEntity->setVisible(false); if (mPhysicsComponentVolumeBox.get() && mPhysicsComponentVolumeBox->isInUse()) { mPhysicsComponentVolumeBox->destroy(); } mLogicComponentItem->setIsTaken(false); } RenderComponentEntityPtr GameObjectHeart::getRenderComponentEntity() const { return mRenderComponentEntity; } AudioComponentPtr GameObjectHeart::getAudioComponent() const { return mAudioComponent; } void GameObjectHeart::setAudioComponent(AudioComponentPtr audioComponent) { mAudioComponent=audioComponent; } void GameObjectHeart::setRenderComponentEntity(RenderComponentEntityPtr pRenderComponentEntity) { mRenderComponentEntity=pRenderComponentEntity; } void GameObjectHeart::setRenderComponentPositional(RenderComponentPositionalPtr pRenderComponentPositional) { mRenderComponentPositional=pRenderComponentPositional; } void GameObjectHeart::setRenderComponentInitial(RenderComponentInitialPtr pRenderComponentInitial) { mRenderComponentInitial=pRenderComponentInitial; } RenderComponentPositionalPtr GameObjectHeart::getRenderComponentPositional() const { return mRenderComponentPositional; } RenderComponentInitialPtr GameObjectHeart::getRenderComponentInitial() const { return mRenderComponentInitial; } void GameObjectHeart::setRenderComponentParticleSystemStarsCloud(RenderComponentParticleSystemPtr pRenderComponentParticleSystemStarsCloud) { mRenderComponentParticleSystemStarsCloud = pRenderComponentParticleSystemStarsCloud; } RenderComponentParticleSystemPtr GameObjectHeart::getRenderComponentParticleSystemStarsCloud() const { return mRenderComponentParticleSystemStarsCloud; } void GameObjectHeart::setPhysicsComponentVolumeBox(PhysicsComponentVolumeBoxPtr pPhysicsComponentVolumeBox) { mPhysicsComponentVolumeBox=pPhysicsComponentVolumeBox; } PhysicsComponentVolumeBoxPtr GameObjectHeart::getPhysicsComponentVolumeBox() const { return mPhysicsComponentVolumeBox; } void GameObjectHeart::setDreamsRender() { if (!isEnabled()) return; if(mLogicComponentItem->existsInDreams()) { mRenderComponentEntity->setVisible(true); mRenderComponentEntity->setDreamsMaterials(); } else { mRenderComponentEntity->setVisible(false); } } void GameObjectHeart::setNightmaresRender() { if (!isEnabled()) return; if(mLogicComponentItem->existsInDreams()) { mRenderComponentEntity->setVisible(false); } else { mRenderComponentEntity->setVisible(true); mRenderComponentEntity->setNightmaresMaterials(); } } void GameObjectHeart::enable() { mRenderComponentEntity->setVisible(true); if (mPhysicsComponentVolumeBox.get() && !mPhysicsComponentVolumeBox->isInUse()) mPhysicsComponentVolumeBox->create(); } void GameObjectHeart::setChangeWorldFactor(double factor) { if (!isEnabled()) return; mRenderComponentEntity->setChangeWorldFactor(factor); } void GameObjectHeart::setChangeWorldRender() { if (!isEnabled()) return; mRenderComponentEntity->setVisible(true); mRenderComponentEntity->setChangeWorldMaterials(); } void GameObjectHeart::changeWorldFinished(int newWorld) { if (!isEnabled()) return; switch(newWorld) { case DREAMS: setDreamsRender(); break; case NIGHTMARES: setNightmaresRender(); break; default: break; } switch(newWorld) { case DREAMS: if(mLogicComponentItem->existsInDreams()) { if (mPhysicsComponentVolumeBox.get() && !mPhysicsComponentVolumeBox->isInUse()) { mPhysicsComponentVolumeBox->create(); } } else { if (mPhysicsComponentVolumeBox.get() && mPhysicsComponentVolumeBox->isInUse()) { mPhysicsComponentVolumeBox->destroy(); } } break; case NIGHTMARES: if(mLogicComponentItem->existsInNightmares()) { if (mPhysicsComponentVolumeBox.get() && !mPhysicsComponentVolumeBox->isInUse()) { mPhysicsComponentVolumeBox->create(); } } else { if (mPhysicsComponentVolumeBox.get() && mPhysicsComponentVolumeBox->isInUse()) { mPhysicsComponentVolumeBox->destroy(); } } break; default: break; } } void GameObjectHeart::changeWorldStarted(int newWorld) { if (!isEnabled()) return; //if(mLogicComponentItem->existsInDreams()&& !mLogicComponentItem->existsInNightmares()) //{ // mRenderComponentEntity->setChangeWorldMaterials(); // mRenderComponentEntity->randomizeChangeWorldMaterials(); //} //if(mLogicComponentItem->existsInNightmares()&& !mLogicComponentItem->existsInNightmares()) //{ // mRenderComponentEntity->setChangeWorldMaterials(); // mRenderComponentEntity->randomizeChangeWorldMaterials(); //} switch(newWorld) { case DREAMS: break; case NIGHTMARES: break; default: break; } } void GameObjectHeart::changeToWorld(int newWorld, double perc) { if (!isEnabled()) return; switch(newWorld) { case DREAMS: break; case NIGHTMARES: break; default: break; } } void GameObjectHeart::calculateChangeWorldTotalTime(double changeWorldTotalTime) { mChangeWorldTotalTime=changeWorldTotalTime*0.25f; } void GameObjectHeart::calculateChangeWorldDelay(double totalElapsedTime,double totalTime,int newWorld,double delay_factor,double intersection) { double fraction=0.25f; switch(newWorld) { case DREAMS: if(mLogicComponentItem->existsInDreams()) { mChangeWorldDelay=(fraction+intersection)*totalTime*delay_factor+(2*fraction-intersection)*totalTime; } else if(mLogicComponentItem->existsInNightmares()) { mChangeWorldDelay=(fraction+intersection)*totalTime*delay_factor; } break; case NIGHTMARES: if(mLogicComponentItem->existsInDreams()) { mChangeWorldDelay=(fraction+intersection)*totalTime*delay_factor; } else if(mLogicComponentItem->existsInNightmares()) { mChangeWorldDelay=(fraction+intersection)*totalTime*delay_factor+(2*fraction-intersection)*totalTime; } break; default: break; } } /// Set logic component void GameObjectHeart::setLogicComponentItem(LogicComponentItemPtr logicComponentItem) { mLogicComponentItem=logicComponentItem; } /// return logic component LogicComponentItemPtr GameObjectHeart::getLogicComponentItem() { return mLogicComponentItem; } bool GameObjectHeart::hasPositionalComponent() const { return true; } RenderComponentPositionalPtr GameObjectHeart::getPositionalComponent() const { return getRenderComponentPositional(); } bool GameObjectHeart::hasPhysicsComponent() const { return true; } PhysicsComponentPtr GameObjectHeart::getPhysicsComponent() const { return getPhysicsComponentVolumeBox(); } void GameObjectHeart::processCollision(GameObjectPtr pGameObject, Ogre::Vector3 pNormal) { if (isEnabled() && mLogicComponentItem.get()&& !mLogicComponentItem->getIsTaken()) { mLogicComponentItem->processCollision(pGameObject, pNormal); } } void GameObjectHeart::processEnterTrigger(GameObjectPtr pGameObject) { if (mLogicComponentItem.get()) { mLogicComponentItem->processEnterTrigger(pGameObject); } } void GameObjectHeart::processExitTrigger(GameObjectPtr pGameObject) { if (mLogicComponentItem.get()) { mLogicComponentItem->processExitTrigger(pGameObject); } } void GameObjectHeart::update(double elapsedSeconds) { GameObject::update(elapsedSeconds); if (mLogicComponentItem->isStateChanged()) { if (mLogicComponentItem->getState()==STATE_ITEM_TAKEN) { mRenderComponentEntity->setVisible(false); mPhysicsComponentVolumeBox->destroy(); mLogicComponentItem->setStateChanged(false); } } if (isEnabled()) { if (isFirstUpdate()) { mRenderComponentEntity->changeAnimation("idle01"); } else { mRenderComponentEntity->update(elapsedSeconds); } } } bool GameObjectHeart::hasRenderComponentEntity() const { return true; } void GameObjectHeart::setVisible(bool visible) { switch(mWorld) { case DREAMS: if(mLogicComponentItem->existsInDreams()) { mRenderComponentEntity->setVisible(visible); } break; case NIGHTMARES: if(mLogicComponentItem->existsInNightmares()) { mRenderComponentEntity->setVisible(visible); } break; default: break; } } RenderComponentEntityPtr GameObjectHeart::getEntityComponent() const { return mRenderComponentEntity; } bool GameObjectHeart::hasLogicComponent() const { return true; } LogicComponentPtr GameObjectHeart::getLogicComponent() const { return mLogicComponentItem; } void GameObjectHeart::startCollisionEffects() { mRenderComponentParticleSystemStarsCloud->start(); mAudioComponent->playSound("heart"); } TGameObjectHeartParameters::TGameObjectHeartParameters() : TGameObjectParameters() { } TGameObjectHeartParameters::~TGameObjectHeartParameters() { }
[ "ithiliel@1610d384-d83c-11de-a027-019ae363d039", "wyern1@1610d384-d83c-11de-a027-019ae363d039", "juanj.mostazo@1610d384-d83c-11de-a027-019ae363d039" ]
[ [ [ 1, 2 ], [ 20, 29 ], [ 31, 31 ], [ 33, 33 ], [ 36, 37 ], [ 102, 102 ], [ 116, 116 ], [ 127, 132 ], [ 286, 286 ], [ 295, 298 ], [ 300, 303 ], [ 316, 316 ], [ 348, 348 ], [ 351, 351 ], [ 353, 360 ], [ 363, 366 ], [ 388, 391 ], [ 393, 396 ], [ 399, 401 ] ], [ [ 3, 4 ], [ 6, 12 ], [ 14, 19 ], [ 38, 64 ], [ 70, 74 ], [ 91, 91 ], [ 93, 96 ], [ 98, 101 ], [ 103, 115 ], [ 117, 126 ], [ 133, 147 ], [ 151, 163 ], [ 165, 165 ], [ 167, 167 ], [ 169, 169 ], [ 171, 171 ], [ 173, 176 ], [ 178, 186 ], [ 188, 188 ], [ 190, 193 ], [ 195, 195 ], [ 198, 279 ], [ 282, 285 ], [ 288, 292 ], [ 305, 313 ], [ 315, 315 ], [ 317, 317 ], [ 319, 347 ], [ 349, 350 ], [ 352, 352 ], [ 361, 362 ], [ 367, 386 ], [ 398, 398 ], [ 403, 403 ], [ 406, 408 ], [ 411, 419 ] ], [ [ 5, 5 ], [ 13, 13 ], [ 30, 30 ], [ 32, 32 ], [ 34, 35 ], [ 65, 69 ], [ 75, 90 ], [ 92, 92 ], [ 97, 97 ], [ 148, 150 ], [ 164, 164 ], [ 166, 166 ], [ 168, 168 ], [ 170, 170 ], [ 172, 172 ], [ 177, 177 ], [ 187, 187 ], [ 189, 189 ], [ 194, 194 ], [ 196, 197 ], [ 280, 281 ], [ 287, 287 ], [ 293, 294 ], [ 299, 299 ], [ 304, 304 ], [ 314, 314 ], [ 318, 318 ], [ 387, 387 ], [ 392, 392 ], [ 397, 397 ], [ 402, 402 ], [ 404, 405 ], [ 409, 410 ] ] ]
363f4eed0fbd8a1f303a6db82a085529cedb6068
61352a7371397524fe7dcfab838de40d502c3c9a
/server/Sources/DataBase/Record.cpp
5b9082984aa980577f5771626b5b7ccc5b0277e1
[]
no_license
ustronieteam/emmanuelle
fec6b6ccfa1a9a6029d8c3bb5ee2b9134fccd004
68d639091a781795d2e8ce95c3806ce6ae9f36f6
refs/heads/master
2021-01-21T13:04:29.965061
2009-01-28T04:07:01
2009-01-28T04:07:01
32,144,524
2
0
null
null
null
null
UTF-8
C++
false
false
1,109
cpp
#include "Record.h" int Record::_newId = 1; boost::mutex Record::_mutex; Record::Record() { // Mozliwosc otrzymania jednakowego identyfikatora. _mutex.lock(); _recordId = _newId++; _mutex.unlock(); } Record::Record(const Record & arg) { this->_recordId = arg._recordId; this->_address = arg._address; this->_broker = arg._broker; } Record & Record::operator =(const Record & arg) { /// Jesli sa to rozne obiekty. if (this != &arg) { this->_recordId = arg._recordId; this->_address = arg._address; this->_broker = arg._broker; } return *this; } Record::~Record() { } const int & Record::GetRecordId() const { return this->_recordId; } const struct DomainData::Address & Record::GetAddress() const { return this->_address; } void Record::SetAddress(const struct DomainData::Address & address) { this->_address = address; } const CORBA::ORB_var & Record::GetBroker() const { return this->_broker; } void Record::SetBroker(const CORBA::ORB_var & broker) { this->_broker = broker; }
[ "coutoPL@c118a9a8-d993-11dd-9042-6d746b85d38b", "w.grzeskowiak@c118a9a8-d993-11dd-9042-6d746b85d38b" ]
[ [ [ 1, 2 ], [ 7, 8 ], [ 15, 16 ], [ 18, 18 ], [ 22, 25 ], [ 27, 28 ], [ 32, 33 ], [ 35, 38 ], [ 40, 41 ], [ 43, 43 ], [ 45, 46 ] ], [ [ 3, 6 ], [ 9, 14 ], [ 17, 17 ], [ 19, 21 ], [ 26, 26 ], [ 29, 31 ], [ 34, 34 ], [ 39, 39 ], [ 42, 42 ], [ 44, 44 ], [ 47, 65 ] ] ]
bd88dd824abe47bfd07871740df19d88188a71e8
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/_Network/Mcl/Src/CMclAutoLock.cpp
5046737995e86dc6dd95f8d980c8d6c46fe03b8e
[]
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,492
cpp
// // FILE: CMclAutoLock.cpp // // Copyright (c) 1997 by Aaron Michael Cohen // ///////////////////////////////////////////////////////////////////////// #include "CMclAutoLock.h" // constructors... CMclAutoLock::CMclAutoLock( HANDLE hMutexHandle) { m_pCritSec = NULL; m_pcCritSec = NULL; m_pcMutex = NULL; m_hMutexHandle = hMutexHandle; ::WaitForSingleObject( m_hMutexHandle, INFINITE); } CMclAutoLock::CMclAutoLock( CMclMutex & rCMclMutex) { m_pCritSec = NULL; m_pcCritSec = NULL; m_hMutexHandle = NULL; m_pcMutex = &rCMclMutex; m_pcMutex->Wait(INFINITE); } CMclAutoLock::CMclAutoLock( CRITICAL_SECTION * pCritSec) { m_hMutexHandle = NULL; m_pcMutex = NULL; m_pcCritSec = NULL; m_pCritSec = pCritSec; ::EnterCriticalSection(m_pCritSec); } CMclAutoLock::CMclAutoLock( CMclCritSec & rCMclCritSec) { m_hMutexHandle = NULL; m_pcMutex = NULL; m_pCritSec = NULL; m_pcCritSec = &rCMclCritSec; m_pcCritSec->Enter(); } // destructor... CMclAutoLock::~CMclAutoLock(void) { BOOL bStatus = TRUE; if (m_hMutexHandle) { bStatus = ::ReleaseMutex(m_hMutexHandle); } else if (m_pcMutex) { bStatus = m_pcMutex->Release(); } else if (m_pCritSec) { ::LeaveCriticalSection(m_pCritSec); } else { m_pcCritSec->Leave(); } if (!bStatus) { CMclThrowError( ::GetLastError()); } }
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 64 ] ] ]
77422d0e5f90222e2a7f43f7c1fe5b95a319aa5a
3e69b159d352a57a48bc483cb8ca802b49679d65
/tags/release-2005-10-27/cvpcb/visumod.cpp
1863245c9ffe98c8866ccb7aae507358deff4209
[]
no_license
BackupTheBerlios/kicad-svn
4b79bc0af39d6e5cb0f07556eb781a83e8a464b9
4c97bbde4b1b12ec5616a57c17298c77a9790398
refs/heads/master
2021-01-01T19:38:40.000652
2006-06-19T20:01:24
2006-06-19T20:01:24
40,799,911
0
0
null
null
null
null
UTF-8
C++
false
false
3,604
cpp
/************************************************/ /* Routines de visualisation du module courant */ /************************************************/ #include "fctsys.h" #include "common.h" #include "cvpcb.h" #include "macros.h" #include "pcbnew.h" #include "protos.h" /* defines locaux */ /* Variables locales */ /*******************************************************************/ void WinEDA_DisplayFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg) /*******************************************************************/ /* Affiche le module courant */ { if (! m_Pcb ) return; MODULE * Module= m_Pcb->m_Modules; ActiveScreen = (PCB_SCREEN *) GetScreen(); if ( EraseBg ) DrawPanel->EraseScreen(DC); DrawPanel->DrawBackGround(DC); if( Module ) { Module->Draw(DrawPanel, DC, wxPoint(0,0), GR_COPY); Module->Display_Infos(this); } Affiche_Status_Box(); } /***********************************************/ void DeleteStructure( void * GenericStructure ) /***********************************************/ /* Supprime de la liste chainee la stucture pointee par GenericStructure et libere la memoire correspondante */ { EDA_BaseStruct * PtStruct, *PtNext, *PtBack; int IsDeleted; int typestruct; char Line[256]; PtStruct = (EDA_BaseStruct *) GenericStructure; if( PtStruct == NULL) return ; typestruct = (int)PtStruct->m_StructType; IsDeleted = PtStruct->GetState(DELETED); PtNext = PtStruct->Pnext; PtBack = PtStruct->Pback; switch( typestruct ) { case TYPE_NOT_INIT: DisplayError(NULL, "DeleteStruct: Type Structure Non Initialise"); break; case PCB_EQUIPOT_STRUCT_TYPE: #undef Struct #define Struct ((EQUIPOT*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEMODULE: #undef Struct #define Struct ((MODULE*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEPAD: #undef Struct #define Struct ((D_PAD*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPECOTATION: #undef Struct #define Struct ((COTATION*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEMIRE: #undef Struct #define Struct ((MIREPCB*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEDRAWSEGMENT: #undef Struct #define Struct ((DRAWSEGMENT*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPETEXTE: #undef Struct #define Struct ((TEXTE_PCB*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPETEXTEMODULE: #undef Struct #define Struct ((TEXTE_MODULE*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEEDGEMODULE: #undef Struct #define Struct ((EDGE_MODULE*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPETRACK: #undef Struct #define Struct ((TRACK*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEVIA: #undef Struct #define Struct ((SEGVIA*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEZONE: #undef Struct #define Struct ((SEGZONE*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEMARQUEUR: #undef Struct #define Struct ((MARQUEUR*)PtStruct) Struct->UnLink(); delete Struct; break; case TYPEPCB: default: sprintf(Line," DeleteStructure: Type %d Inattendu", PtStruct->m_StructType); DisplayError(NULL, Line); break; } }
[ "bokeoa@244deca0-f506-0410-ab94-f4f3571dea26" ]
[ [ [ 1, 175 ] ] ]
ff7f140668acd022aa6e5feba9600c5e3aa66234
709cd826da3ae55945fd7036ecf872ee7cdbd82a
/Term/WildMagic2/Source/Curves/WmlTCBSpline3.cpp
e8b016174fa94cce7e9c257bcec7fe5fb2a8f782
[]
no_license
argapratama/kucgbowling
20dbaefe1596358156691e81ccceb9151b15efb0
65e40b6f33c5511bddf0fa350c1eefc647ace48a
refs/heads/master
2018-01-08T15:27:44.784437
2011-06-19T15:23:39
2011-06-19T15:23:39
36,738,655
0
0
null
null
null
null
UTF-8
C++
false
false
8,554
cpp
// 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. #include "WmlTCBSpline3.h" #include "WmlIntegrate1.h" #include "WmlPolynomial1.h" using namespace Wml; //---------------------------------------------------------------------------- template <class Real> TCBSpline3<Real>::TCBSpline3 (int iSegments, Real* afTime, Vector3<Real>* akPoint, Real* afTension, Real* afContinuity, Real* afBias) : MultipleCurve3<Real>(iSegments,afTime) { // TO DO. Add 'boundary type' just as in natural splines. assert( m_iSegments >= 3 ); // all four of these arrays have m_iSegments+1 elements m_akPoint = akPoint; m_afTension = afTension; m_afContinuity = afContinuity; m_afBias = afBias; m_akA = new Vector3<Real>[m_iSegments]; m_akB = new Vector3<Real>[m_iSegments]; m_akC = new Vector3<Real>[m_iSegments]; m_akD = new Vector3<Real>[m_iSegments]; // For now, treat the first point as if it occurred twice. ComputePoly(0,0,1,2); for (int i = 1; i < m_iSegments-1; i++) ComputePoly(i-1,i,i+1,i+2); // For now, treat the last point as if it occurred twice. ComputePoly(m_iSegments-2,m_iSegments-1,m_iSegments,m_iSegments); } //---------------------------------------------------------------------------- template <class Real> TCBSpline3<Real>::~TCBSpline3 () { delete[] m_akPoint; delete[] m_afTension; delete[] m_afContinuity; delete[] m_afBias; delete[] m_akA; delete[] m_akB; delete[] m_akC; delete[] m_akD; } //---------------------------------------------------------------------------- template <class Real> const Vector3<Real>* TCBSpline3<Real>::GetPoints () const { return m_akPoint; } //---------------------------------------------------------------------------- template <class Real> const Real* TCBSpline3<Real>::GetTensions () const { return m_afTension; } //---------------------------------------------------------------------------- template <class Real> const Real* TCBSpline3<Real>::GetContinuities () const { return m_afContinuity; } //---------------------------------------------------------------------------- template <class Real> const Real* TCBSpline3<Real>::GetBiases () const { return m_afBias; } //---------------------------------------------------------------------------- template <class Real> void TCBSpline3<Real>::ComputePoly (int i0, int i1, int i2, int i3) { Vector3<Real> kDiff = m_akPoint[i2] - m_akPoint[i1]; Real fDt = m_afTime[i2] - m_afTime[i1]; // build multipliers at P1 Real fOmt0 = (Real)1.0 - m_afTension[i1]; Real fOmc0 = (Real)1.0 - m_afContinuity[i1]; Real fOpc0 = (Real)1.0 + m_afContinuity[i1]; Real fOmb0 = (Real)1.0 - m_afBias[i1]; Real fOpb0 = (Real)1.0 + m_afBias[i1]; Real fAdj0 = ((Real)2.0)*fDt/(m_afTime[i2]-m_afTime[i0]); Real fOut0 = ((Real)0.5)*fAdj0*fOmt0*fOpc0*fOpb0; Real fOut1 = ((Real)0.5)*fAdj0*fOmt0*fOmc0*fOmb0; // build outgoing tangent at P1 Vector3<Real> kTOut = fOut1*kDiff + fOut0*(m_akPoint[i1] - m_akPoint[i0]); // build multipliers at point P2 Real fOmt1 = (Real)1.0 - m_afTension[i2]; Real fOmc1 = (Real)1.0 - m_afContinuity[i2]; Real fOpc1 = (Real)1.0 + m_afContinuity[i2]; Real fOmb1 = (Real)1.0 - m_afBias[i2]; Real fOpb1 = (Real)1.0 + m_afBias[i2]; Real fAdj1 = ((Real)2.0)*fDt/(m_afTime[i3] - m_afTime[i1]); Real fIn0 = ((Real)0.5)*fAdj1*fOmt1*fOmc1*fOpb1; Real fIn1 = ((Real)0.5)*fAdj1*fOmt1*fOpc1*fOmb1; // build incoming tangent at P2 Vector3<Real> kTIn = fIn1*(m_akPoint[i3] - m_akPoint[i2]) + fIn0*kDiff; m_akA[i1] = m_akPoint[i1]; m_akB[i1] = kTOut; m_akC[i1] = ((Real)3.0)*kDiff - ((Real)2.0)*kTOut - kTIn; m_akD[i1] = ((Real)-2.0)*kDiff + kTOut + kTIn; } //---------------------------------------------------------------------------- template <class Real> Vector3<Real> TCBSpline3<Real>::GetPosition (Real fTime) const { int iKey; Real fDt; GetKeyInfo(fTime,iKey,fDt); fDt /= (m_afTime[iKey+1] - m_afTime[iKey]); Vector3<Real> kResult = m_akA[iKey] + fDt*(m_akB[iKey] + fDt*(m_akC[iKey] + fDt*m_akD[iKey])); return kResult; } //---------------------------------------------------------------------------- template <class Real> Vector3<Real> TCBSpline3<Real>::GetFirstDerivative (Real fTime) const { int iKey; Real fDt; GetKeyInfo(fTime,iKey,fDt); fDt /= (m_afTime[iKey+1] - m_afTime[iKey]); Vector3<Real> kResult = m_akB[iKey] + fDt*(((Real)2.0)*m_akC[iKey] + ((Real)3.0)*fDt*m_akD[iKey]); return kResult; } //---------------------------------------------------------------------------- template <class Real> Vector3<Real> TCBSpline3<Real>::GetSecondDerivative (Real fTime) const { int iKey; Real fDt; GetKeyInfo(fTime,iKey,fDt); fDt /= (m_afTime[iKey+1] - m_afTime[iKey]); Vector3<Real> kResult = ((Real)2.0)*m_akC[iKey] + ((Real)6.0)*fDt*m_akD[iKey]; return kResult; } //---------------------------------------------------------------------------- template <class Real> Vector3<Real> TCBSpline3<Real>::GetThirdDerivative (Real fTime) const { int iKey; Real fDt; GetKeyInfo(fTime,iKey,fDt); fDt /= (m_afTime[iKey+1] - m_afTime[iKey]); Vector3<Real> kResult = ((Real)6.0)*m_akD[iKey]; return kResult; } //---------------------------------------------------------------------------- template <class Real> Real TCBSpline3<Real>::GetSpeedKey (int iKey, Real fTime) const { Vector3<Real> kVelocity = m_akB[iKey] + fTime*(((Real)2.0)*m_akC[iKey] + ((Real)3.0)*fTime*m_akD[iKey]); return kVelocity.Length(); } //---------------------------------------------------------------------------- template <class Real> Real TCBSpline3<Real>::GetLengthKey (int iKey, Real fT0, Real fT1) const { ThisPlusKey kData(this,iKey); return Integrate1<Real>::RombergIntegral(fT0,fT1,GetSpeedWithData, (void*)&kData); } //---------------------------------------------------------------------------- template <class Real> Real TCBSpline3<Real>::GetVariationKey (int iKey, Real fT0, Real fT1, const Vector3<Real>& rkA, const Vector3<Real>& rkB) const { Polynomial1<Real> kXPoly(3); kXPoly[0] = m_akA[iKey].X(); kXPoly[1] = m_akB[iKey].X(); kXPoly[2] = m_akC[iKey].X(); kXPoly[3] = m_akD[iKey].X(); Polynomial1<Real> kYPoly(3); kYPoly[0] = m_akA[iKey].Y(); kYPoly[1] = m_akB[iKey].Y(); kYPoly[2] = m_akC[iKey].Y(); kYPoly[3] = m_akD[iKey].Y(); Polynomial1<Real> kZPoly(3); kZPoly[0] = m_akA[iKey].Z(); kZPoly[1] = m_akB[iKey].Z(); kZPoly[2] = m_akC[iKey].Z(); kZPoly[3] = m_akD[iKey].Z(); // construct line segment A + t*B Polynomial1<Real> kLx(1), kLy(1), kLz(1); kLx[0] = rkA.X(); kLx[1] = rkB.X(); kLy[0] = rkA.Y(); kLy[1] = rkB.Y(); kLz[0] = rkA.Z(); kLz[1] = rkB.Z(); // compute |X(t) - L(t)|^2 Polynomial1<Real> kDx = kXPoly - kLx; Polynomial1<Real> kDy = kYPoly - kLy; Polynomial1<Real> kDz = kZPoly - kLz; Polynomial1<Real> kNormSqr = kDx*kDx + kDy*kDy + kDz*kDz; // compute indefinite integral of |X(t)-L(t)|^2 Polynomial1<Real> kIntegral(kNormSqr.GetDegree()+1); kIntegral[0] = (Real)0.0; for (int i = 1; i <= kIntegral.GetDegree(); i++) kIntegral[i] = kNormSqr[i-1]/i; // compute definite Integral(t0,t1,|X(t)-L(t)|^2) Real fResult = kIntegral(fT1) - kIntegral(fT0); return fResult; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // explicit instantiation //---------------------------------------------------------------------------- namespace Wml { template class WML_ITEM TCBSpline3<float>; template class WML_ITEM TCBSpline3<double>; } //----------------------------------------------------------------------------
[ [ [ 1, 255 ] ] ]
6caa2ee37feaa2e1b15adf7f0bc5fcb9d82a03bd
65c92f6c171a0565fe5275ecc48033907090d69d
/Client/Plugins/Mail/Implementation/Mail.cpp
870e659bdf9e0d8f6361087f5bbffea8d32a54fb
[]
no_license
freakyzoidberg/horus-edu
653ac573887d83a803ddff1881924ab82b46f5f6
2757766a6cb8c1f1a1b0a8e209700e6e3ccea6bc
refs/heads/master
2020-05-20T03:08:15.276939
2010-01-07T14:34:51
2010-01-07T14:34:51
32,684,226
0
0
null
null
null
null
UTF-8
C++
false
false
3,528
cpp
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Horus 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. * * * * Horus 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 Horus. If not, see <http://www.gnu.org/licenses/>. * * * * The orginal content of this material was realized as part of * * 'Epitech Innovative Project' www.epitech.eu * * * * You are required to preserve the names of the original authors * * of this content in every copy of this material * * * * Authors : * * - BERTHOLON Romain * * - GRANDEMANGE Adrien * * - LACAVE Pierre * * - LEON-BONNET Valentin * * - NANOUCHE Abderrahmane * * - THORAVAL Gildas * * - VIDAL Jeremy * * * * You are also invited but not required to send a mail to the original * * authors of this content in case of modification of this material * * * * Contact: [email protected] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "Mail.h" #include "MailPanel.h" #include "../../../../Common/PluginManager.h" #include <QIcon> const QString Mail::pluginName() const { return ("Mail"); } const QString Mail::pluginVersion() const { return ("0.1"); } QWidget *Mail::getWidget() { return new MailPanel(MailPlugin); } const QString Mail::getDisplayableName() const { return("Mailbox"); } int Mail::getOrder() const { return (100); } bool Mail::canLoad() const { return (true); } void Mail::load() { MailPlugin = pluginManager->findPlugin<MailDataPlugin *>(); Plugin::load(); } QIcon Mail::getIcon() const { return (QIcon(":/mail.png")); }
[ "git@cb2ab776-01a4-11df-b136-7f7962f7bc17", "val@cb2ab776-01a4-11df-b136-7f7962f7bc17", "[email protected]" ]
[ [ [ 1, 34 ], [ 59, 59 ] ], [ [ 35, 35 ], [ 39, 50 ], [ 52, 52 ] ], [ [ 36, 38 ], [ 51, 51 ], [ 53, 58 ], [ 60, 80 ] ] ]
74eafd4a25c0b949d2b81f48a93660b5ca147fc6
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctesteikbctrl/src/bctesteikbctrlview.cpp
b07ed30e63b574a7af944f7cf7edad0d487dcc54
[]
no_license
SymbianSource/oss.FCL.sftools.ana.compatanamdw
a6a8abf9ef7ad71021d43b7f2b2076b504d4445e
1169475bbf82ebb763de36686d144336fcf9d93b
refs/heads/master
2020-12-24T12:29:44.646072
2010-11-11T14:03:20
2010-11-11T14:03:20
72,994,432
0
0
null
null
null
null
UTF-8
C++
false
false
4,350
cpp
/* * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: view class * */ #include <aknviewappui.h> #include "bctesteikbctrl.hrh" #include <bctesteikbctrl.rsg> #include "bctesteikbctrlview.h" #include "bctesteikbctrlcontainer.h" #include "bctestutil.h" #include "bctesteikbctrlcase.h" #include "bctesteikbdialgcase.h" #include "bctesteikaligncase.h" // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- // Symbian 2nd static Constructor // --------------------------------------------------------------------------- // CBCTesteikbctrlView* CBCTesteikbctrlView::NewL() { CBCTesteikbctrlView* self = new( ELeave ) CBCTesteikbctrlView(); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); return self; } // --------------------------------------------------------------------------- // C++ default Constructor // --------------------------------------------------------------------------- CBCTesteikbctrlView::CBCTesteikbctrlView() { } // --------------------------------------------------------------------------- // Symbian 2nd Constructor // --------------------------------------------------------------------------- // void CBCTesteikbctrlView::ConstructL() { BaseConstructL( R_BCTESTEIKBCTRL_VIEW ); _LIT(CtrlCase,"eikbctrl test case"); _LIT(DialgCase,"eikdialg test case"); _LIT(AlignCase, "align test case" ); iContainer = new( ELeave ) CBCTesteikbctrlContainer(); iContainer->SetMopParent( this ); iContainer->ConstructL( ClientRect() ); AppUi()->AddToStackL( *this, iContainer ); iContainer->MakeVisible( ETrue ); iTestUtil = CBCTestUtil::NewL(); // Add test case here. iTestUtil->AddTestCaseL( CBCTesteikbctrlCase::NewL( iContainer ), CtrlCase); iTestUtil->AddTestCaseL( CBCTesteikalignCase::NewL( iContainer), AlignCase); iTestUtil->AddTestCaseL( CBCTesteikbdialgCase::NewL( iContainer ), DialgCase); } // --------------------------------------------------------------------------- // Destructor // --------------------------------------------------------------------------- // CBCTesteikbctrlView::~CBCTesteikbctrlView() { if ( iContainer ) { AppUi()->RemoveFromStack( iContainer ); } delete iContainer; delete iTestUtil; } // --------------------------------------------------------------------------- // CBCTesteikbctrlView::Id // --------------------------------------------------------------------------- // TUid CBCTesteikbctrlView::Id() const { return KBCTesteikbctrlViewId; } // --------------------------------------------------------------------------- // CBCTesteikbctrlView::DoActivateL // --------------------------------------------------------------------------- // void CBCTesteikbctrlView::DoActivateL( const TVwsViewId&, TUid, const TDesC8& ) { } // --------------------------------------------------------------------------- // CBCTesteikbctrlView::DoDeactivate // --------------------------------------------------------------------------- // void CBCTesteikbctrlView::DoDeactivate() { } // --------------------------------------------------------------------------- // CBCTesteikbctrlView::HandleCommandL // --------------------------------------------------------------------------- // void CBCTesteikbctrlView::HandleCommandL( TInt aCommand ) { switch ( aCommand ) { case EProgCmdAutoTest: iTestUtil->RunL(); break; default: if ( aCommand > EBCTestCmdEmptyOutline && aCommand < EBCTestCmdMaxOutline ) { iTestUtil->RunL( aCommand ); } break; } }
[ "none@none" ]
[ [ [ 1, 139 ] ] ]
e4ad308f2afb48c20f9773b54e539b862e4ab923
aae033068204d7d25f33088bf772f47e1f68466d
/001_dtprintf/src/main.cpp
591f77411542ad36d9962d8deeab738eb186ce09
[]
no_license
43x2/Dx11Studies
1e67d11eb8b7daf8408e889e0d74ddd3f9e411fe
6651381463229f20b36824d68065ffe7ce5940e7
refs/heads/master
2021-05-26T18:23:27.355104
2011-11-15T16:36:39
2011-11-15T16:36:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
135
cpp
#include <dtprintf.h> int main( int argc, char * argv[] ) { dtprintf( _T( "すみすみは俺の嫁\n" ) ); return 0; }
[ [ [ 1, 8 ] ] ]
87e267f5ad0331d8c06f1d81013391751123ae09
f177993b13e97f9fecfc0e751602153824dfef7e
/ImProSln/BGMappingFilter/BGMappingFilter.h
61cb4be5b68b465ef9779cef901914fe4199373b
[]
no_license
svn2github/imtophooksln
7bd7412947d6368ce394810f479ebab1557ef356
bacd7f29002135806d0f5047ae47cbad4c03f90e
refs/heads/master
2020-05-20T04:00:56.564124
2010-09-24T09:10:51
2010-09-24T09:10:51
11,787,598
1
0
null
null
null
null
UTF-8
C++
false
false
3,250
h
#pragma once #include "IBGMappingFilter.h" #include "dshow.h" #include "Streams.h" #include <initguid.h> #include "combase.h" #include "CMuxTransformFilter.h" #include "BGMapping.h" #include "MyMediaSample.h" #include "MyARTagMediaSample.h" // {D9CC776C-18CC-41f3-98EE-4F897B7350E3} DEFINE_GUID(CLSID_BGMappingFilter, 0xd9cc776c, 0x18cc, 0x41f3, 0x98, 0xee, 0x4f, 0x89, 0x7b, 0x73, 0x50, 0xe3); class BGMappingFilter : public CMuxTransformFilter, public IBGMappingFilter ,public ISpecifyPropertyPages { public: static CUnknown *WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); //for COM interface STDMETHODIMP NonDelegatingQueryInterface(REFIID iid, void **ppv); DECLARE_IUNKNOWN; //implement CMuxTransformFilter Interface virtual HRESULT Receive(IMediaSample *pSample, const IPin* pReceivePin); virtual HRESULT CreatePins(); virtual HRESULT CheckInputType(const CMediaType* mtIn, const IPin* pPin); virtual HRESULT CheckOutputType(const CMediaType* mtOut, const IPin* pPin); virtual HRESULT DecideBufferSize(IMemAllocator * pAllocator, const IPin* pOutPin, __inout ALLOCATOR_PROPERTIES *pprop); virtual HRESULT GetMediaType(int iPosition, const IPin* pOutPin, __inout CMediaType *pMediaType); virtual HRESULT CompleteConnect(PIN_DIRECTION direction, const IPin* pMyPin, const IPin* pOtherPin); virtual HRESULT BreakConnect(PIN_DIRECTION dir, const IPin* pPin); //implement DShow Property Page STDMETHODIMP GetPages(CAUUID *pPages); protected: HRESULT Transform( IMediaSample *pIn, IMediaSample *pOut); HRESULT ChangeBG(); protected: virtual bool IsAcceptedType(const CMediaType *pMT); private: virtual HRESULT ReceiveCameraImg(IMediaSample *pSample, const IPin* pReceivePin); virtual HRESULT ReceiveBackground(IMediaSample *pSample, const IPin* pReceivePin); virtual HRESULT ReceiveARLayout(IMediaSample *pSample, const IPin* pReceivePin); virtual CMuxTransformOutputPin* GetConnectedOutputPin(); vector <ARLayoutConfigData*> tagConfigVec ; public: BGMappingFilter(IUnknown * pOuter, HRESULT * phr, BOOL ModifiesData); virtual ~BGMappingFilter(); public: virtual HRESULT setBGThreshold(int BGthres) ; virtual int getBGThreshold(); virtual HRESULT setErodeValue(int eValue) ; virtual int getErodeValue(); virtual HRESULT setSubValue(int sValue) ; virtual int getSubValue(); virtual HRESULT setCamFlip(bool value) ; virtual bool getCamFlip(); virtual HRESULT setLayoutFlip(bool value) ; virtual bool getLayoutFlip(); virtual HRESULT setOutputFlip(bool value) ; virtual bool getOutputFlip(); virtual HRESULT setUsingMask(bool value) ; virtual bool getUsingMask(); HRESULT SendForegroundRect(); void setLayoutVisible(); private: void setIsReceiveBG(bool bRecBG) ; bool getIsReceiveBG(); private: CCritSec m_csRecBG; CCritSec m_csBGSetting; CCritSec locMarkerInfo; CCritSec m_cSharedState; // Protects our internal state BackGroundMapping* BG ; IplImage* backgroundIplImg; IplImage* foregroundIplImg; IplImage* cameraInputIplImg; int cameraW ; int cameraH ; int layoutW ; int layoutH ; int camChannel; int layoutChannel; bool isReceiveBG; };
[ "claire3kao@fa729b96-8d43-11de-b54f-137c5e29c83a" ]
[ [ [ 1, 104 ] ] ]
da377d4892c97e8bfff940f20bfc5e9264a68940
27c6eed99799f8398fe4c30df2088f30ae317aff
/rtt-tool/qdoc3/quoter.cpp
19c79f3c7c4a3c273c60196f6da649b3ccf56e36
[]
no_license
lit-uriy/ysoft
ae67cd174861e610f7e1519236e94ffb4d350249
6c3f077ff00c8332b162b4e82229879475fc8f97
refs/heads/master
2021-01-10T08:16:45.115964
2009-07-16T00:27:01
2009-07-16T00:27:01
51,699,806
0
0
null
null
null
null
UTF-8
C++
false
false
11,129
cpp
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information ([email protected]) ** ** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at [email protected]. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <qfileinfo.h> #include <qregexp.h> #include <qdebug.h> #include "quoter.h" QT_BEGIN_NAMESPACE static void replaceMultipleNewlines(QString &s) { const int n = s.size(); bool slurping = false; int j = -1; const QChar newLine = QLatin1Char('\n'); QChar *d = s.data(); for (int i = 0; i != n; ++i) { const QChar c = d[i]; bool hit = (c == newLine); if (slurping && hit) continue; d[++j] = c; slurping = hit; } s.resize(++j); } // This is equivalent to line.split( QRegExp("\n(?!\n|$)") ) but much faster static QStringList splitLines(const QString &line) { QStringList result; int i = line.size(); while (true) { int j = i - 1; while (j >= 0 && line.at(j) == QLatin1Char('\n')) --j; while (j >= 0 && line.at(j) != QLatin1Char('\n')) --j; result.prepend(line.mid(j + 1, i - j - 1)); if (j < 0) break; i = j; } return result; } /* Transforms 'int x = 3 + 4' into 'int x=3+4'. A white space is kept between 'int' and 'x' because it is meaningful in C++. */ static void trimWhiteSpace( QString& str ) { enum { Normal, MetAlnum, MetSpace } state = Normal; const int n = str.length(); int j = -1; QChar *d = str.data(); for ( int i = 0; i != n; ++i ) { const QChar c = d[i]; if ( c.isLetterOrNumber() ) { if ( state == Normal ) { state = MetAlnum; } else { if ( state == MetSpace ) str[++j] = c; state = Normal; } str[++j] = c; } else if ( c.isSpace() ) { if ( state == MetAlnum ) state = MetSpace; } else { state = Normal; str[++j] = c; } } str.resize(++j); } Quoter::Quoter() : silent( false ) { /* We're going to hard code these delimiters: * C++, Qt, Qt Script, Java: //! [<id>] * .pro files: #! [<id>] * .xq, .xml, .html files: <!-- [<id>] --> */ commentHash["pro"] = "#!"; commentHash["py"] = "#!"; commentHash["html"] = "<!--"; commentHash["qrc"] = "<!--"; commentHash["ui"] = "<!--"; commentHash["xml"] = "<!--"; commentHash["xq"] = "<!--"; } void Quoter::reset() { silent = false; plainLines.clear(); markedLines.clear(); codeLocation = Location::null; } void Quoter::quoteFromFile( const QString& userFriendlyFilePath, const QString& plainCode, const QString& markedCode ) { silent = false; /* Split the source code into logical lines. Empty lines are treated specially. Before: p->alpha(); p->beta(); p->gamma(); p->delta(); After: p->alpha(); p->beta();\n p->gamma();\n\n p->delta(); Newlines are preserved because they affect codeLocation. */ codeLocation = Location( userFriendlyFilePath ); plainLines = splitLines(plainCode); markedLines = splitLines(markedCode); if (markedLines.count() != plainLines.count()) { codeLocation.warning(tr("Something is wrong with qdoc's handling of marked code")); markedLines = plainLines; } /* Squeeze blanks (cat -s). */ QStringList::Iterator m = markedLines.begin(); while ( m != markedLines.end() ) { replaceMultipleNewlines( *m ); ++m; } codeLocation.start(); } QString Quoter::quoteLine( const Location& docLocation, const QString& command, const QString& pattern ) { if ( plainLines.isEmpty() ) { failedAtEnd( docLocation, command ); return QString(); } if ( pattern.isEmpty() ) { docLocation.warning( tr("Missing pattern after '\\%1'").arg(command) ); return QString(); } if ( match(docLocation, pattern, plainLines.first()) ) return getLine(); if ( !silent ) { docLocation.warning( tr("Command '\\%1' failed").arg(command) ); codeLocation.warning( tr("Pattern '%1' didn't match here") .arg(pattern) ); silent = true; } return QString(); } QString Quoter::quoteSnippet(const Location &docLocation, const QString &identifier) { QString comment = commentForCode(); QString delimiter = comment + QString(" [%1]").arg(identifier); QString t; while (!plainLines.isEmpty()) { if (match(docLocation, delimiter, plainLines.first())) { getLine(); break; } getLine(); } while (!plainLines.isEmpty()) { QString line = plainLines.first(); if (match(docLocation, delimiter, line)) { QString lastLine = getLine(); int dIndex = lastLine.indexOf(delimiter); if (dIndex > 0) { QString leading = lastLine.left(dIndex); dIndex = leading.indexOf(comment); if (dIndex != -1) leading = leading.left(dIndex); if (!leading.trimmed().isEmpty()) t += leading; } return t; } // Remove special macros to support Qt namespacing. if (line.startsWith("QT_BEGIN_NAMESPACE")) { getLine(); } else if (line.startsWith("QT_END_NAMESPACE")) { getLine(); t += QLatin1Char('\n'); } else if (!line.startsWith(comment)) { // Ordinary code t += getLine(); } else { // Normal comments if (line.contains(QLatin1Char('\n'))) t += QLatin1Char('\n'); getLine(); } } failedAtEnd(docLocation, QString("snippet (%1)").arg(delimiter)); return t; } QString Quoter::quoteTo( const Location& docLocation, const QString& command, const QString& pattern ) { QString t; QString comment = commentForCode(); if ( pattern.isEmpty() ) { while ( !plainLines.isEmpty() ) { QString line = plainLines.first(); // Remove special macros to support Qt namespacing. if (line.startsWith("QT_BEGIN_NAMESPACE")) { getLine(); } else if (line.startsWith("QT_END_NAMESPACE")) { getLine(); t += QLatin1Char('\n'); } else if (!line.startsWith(comment)) // Ordinary code t += getLine(); else { // Normal comments if (line.contains(QLatin1Char('\n'))) t += QLatin1Char('\n'); getLine(); } } } else { while ( !plainLines.isEmpty() ) { if ( match(docLocation, pattern, plainLines.first()) ) { return t; } t += getLine(); } failedAtEnd( docLocation, command ); } return t; } QString Quoter::quoteUntil( const Location& docLocation, const QString& command, const QString& pattern ) { QString t = quoteTo( docLocation, command, pattern ); t += getLine(); return t; } QString Quoter::getLine() { if ( plainLines.isEmpty() ) return QString(); plainLines.removeFirst(); QString t = markedLines.takeFirst(); t += QLatin1Char('\n'); codeLocation.advanceLines( t.count( QLatin1Char('\n') ) ); return t; } bool Quoter::match( const Location& docLocation, const QString& pattern0, const QString& line ) { QString str = line; while ( str.endsWith(QLatin1Char('\n')) ) str.truncate( str.length() - 1 ); QString pattern = pattern0; if ( pattern.startsWith(QLatin1Char('/')) && pattern.endsWith(QLatin1Char('/')) && pattern.length() > 2 ) { QRegExp rx( pattern.mid(1, pattern.length() - 2) ); if ( !silent && !rx.isValid() ) { docLocation.warning( tr("Invalid regular expression '%1'") .arg(rx.pattern()) ); silent = true; } return str.indexOf( rx ) != -1; } trimWhiteSpace(str); trimWhiteSpace(pattern); return str.indexOf(pattern) != -1; } void Quoter::failedAtEnd( const Location& docLocation, const QString& command ) { if (!silent && !command.isEmpty()) { if ( codeLocation.filePath().isEmpty() ) { docLocation.warning( tr("Unexpected '\\%1'").arg(command) ); } else { docLocation.warning( tr("Command '\\%1' failed at end of file '%2'") .arg(command).arg(codeLocation.filePath()) ); } silent = true; } } QString Quoter::commentForCode() const { QString suffix = QFileInfo(codeLocation.fileName()).suffix(); return commentHash.value(suffix, "//!"); } QT_END_NAMESPACE
[ "lit-uriy@d7ba3245-3e7b-42d0-9cd4-356c8b94b330" ]
[ [ [ 1, 369 ] ] ]
c769a6e6e5ffaafebebd5aa283157ce056c46fb5
975e3cacad2b513dff73ddd5ce3d449ad40c293b
/babel-2014-minett_a/trunk/portaudio/Exception.h
3a25ff224b142bf0d9a9f06223b259106e7ccd2d
[]
no_license
alex-min/babelroxor
08a2babfbd1cf51dcfcba589d9acc7afcebee6e3
53cbdedd7d4b68943fe99d74dbb5443b799cca05
refs/heads/master
2021-01-10T14:24:12.257931
2011-12-13T10:57:30
2011-12-13T10:57:30
46,981,346
0
0
null
null
null
null
UTF-8
C++
false
false
679
h
#ifndef UTILS_EXCEPTION_H_ #define UTILS_EXCEPTION_H_ #include <exception> #include <string> #include "Config.h" namespace Utils { class LINK_OPTION_UTILS Exception : public std::exception { public: Exception(const std::string &msg) throw() {_msg = msg;} Exception(const std::string &name, const std::string &msg) throw() {_msg = name + ": " + msg;} virtual ~Exception() throw() {}; const char *what() const throw() {return _msg.c_str();} private: std::string _msg; }; } #endif
[ [ [ 1, 26 ] ] ]
99ff62aa231131875b67150779ef57f6bd8ae8d2
c95a83e1a741b8c0eb810dd018d91060e5872dd8
/Game/Libs/LTGUIMgr/ltguicommandhandler.cpp
d802a1e35b7bff4d7b5f1351a351d51f34547eac
[]
no_license
rickyharis39/nolf2
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
refs/heads/master
2021-01-01T17:21:00.678517
2011-07-23T12:11:19
2011-07-23T12:11:19
38,495,312
1
0
null
null
null
null
UTF-8
C++
false
false
693
cpp
// ----------------------------------------------------------------------- // // // MODULE : LTGUICommandHandler.cpp // // PURPOSE : Base clase for objects that receive messages from controls // // (c) 2001 Monolith Productions, Inc. All Rights Reserved // // ----------------------------------------------------------------------- // #include "ltguimgr.h" #include "ltguicommandhandler.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CLTGUICommandHandler::CLTGUICommandHandler() { } CLTGUICommandHandler::~CLTGUICommandHandler() { }
[ [ [ 1, 26 ] ] ]
47765be454cbe9ea5262dc37e1a57856e780e546
d6a28d9d845a20463704afe8ebe644a241dc1a46
/include/ITexture.h
227fbf37665d60f9f417716cbfd45c500b45e73e
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-other-permissive", "Zlib" ]
permissive
marky0720/irrlicht-android
6932058563bf4150cd7090d1dc09466132df5448
86512d871eeb55dfaae2d2bf327299348cc5202c
refs/heads/master
2021-04-30T08:19:25.297407
2010-10-08T08:27:33
2010-10-08T08:27:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,307
h
// Copyright (C) 2002-2009 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __I_TEXTURE_H_INCLUDED__ #define __I_TEXTURE_H_INCLUDED__ #include "IReferenceCounted.h" #include "IImage.h" #include "dimension2d.h" #include "EDriverTypes.h" #include "path.h" #include "matrix4.h" namespace irr { namespace video { //! Enumeration flags telling the video driver in which format textures should be created. enum E_TEXTURE_CREATION_FLAG { /** Forces the driver to create 16 bit textures always, independent of which format the file on disk has. When choosing this you may lose some color detail, but gain much speed and memory. 16 bit textures can be transferred twice as fast as 32 bit textures and only use half of the space in memory. When using this flag, it does not make sense to use the flags ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED at the same time. */ ETCF_ALWAYS_16_BIT = 0x00000001, /** Forces the driver to create 32 bit textures always, independent of which format the file on disk has. Please note that some drivers (like the software device) will ignore this, because they are only able to create and use 16 bit textures. When using this flag, it does not make sense to use the flags ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED at the same time. */ ETCF_ALWAYS_32_BIT = 0x00000002, /** Lets the driver decide in which format the textures are created and tries to make the textures look as good as possible. Usually it simply chooses the format in which the texture was stored on disk. When using this flag, it does not make sense to use the flags ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_SPEED at the same time. */ ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004, /** Lets the driver decide in which format the textures are created and tries to create them maximizing render speed. When using this flag, it does not make sense to use the flags ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY, at the same time. */ ETCF_OPTIMIZED_FOR_SPEED = 0x00000008, /** Automatically creates mip map levels for the textures. */ ETCF_CREATE_MIP_MAPS = 0x00000010, /** Discard any alpha layer and use non-alpha color format. */ ETCF_NO_ALPHA_CHANNEL = 0x00000020, //! Allow the Driver to use Non-Power-2-Textures /** BurningVideo can handle Non-Power-2 Textures in 2D (GUI), but not in 3D. */ ETCF_ALLOW_NON_POWER_2 = 0x00000040, /** This flag is never used, it only forces the compiler to compile these enumeration values to 32 bit. */ ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff }; //! Interface of a Video Driver dependent Texture. /** An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture or IVideoDriver::getTexture. After that, the texture may only be used by this VideoDriver. As you can imagine, textures of the DirectX and the OpenGL device will, e.g., not be compatible. An exception is the Software device and the NULL device, their textures are compatible. If you try to use a texture created by one device with an other device, the device will refuse to do that and write a warning or an error message to the output buffer. */ class ITexture : public virtual IReferenceCounted { public: //! constructor ITexture(const io::path& name) : NamedPath(name) { } //! Lock function. /** Locks the Texture and returns a pointer to access the pixels. After lock() has been called and all operations on the pixels are done, you must call unlock(). Locks are not accumulating, hence one unlock will do for an arbitrary number of previous locks. You should avoid locking different levels without unlocking inbetween, though, because only the last level locked will be unlocked. The size of the i-th mipmap level is defined as max(getSize().Width>>i,1) and max(getSize().Height>>i,1) \param readOnly Specifies that no changes to the locked texture are made. Unspecified behavior will arise if still write access happens. \param mipmapLevel Number of the mipmapLevel to lock. 0 is main texture. Non-existing levels will silently fail and return 0. \return Returns a pointer to the pixel data. The format of the pixel can be determined by using getColorFormat(). 0 is returned, if the texture cannot be locked. */ virtual void* lock(bool readOnly = false, u32 mipmapLevel=0) = 0; //! Unlock function. Must be called after a lock() to the texture. /** One should avoid to call unlock more than once before another lock. The last locked mip level will be unlocked. */ virtual void unlock() = 0; //! Get original size of the texture. /** The texture is usually scaled, if it was created with an unoptimal size. For example if the size was not a power of two. This method returns the size of the texture it had before it was scaled. Can be useful when drawing 2d images on the screen, which should have the exact size of the original texture. Use ITexture::getSize() if you want to know the real size it has now stored in the system. \return The original size of the texture. */ virtual const core::dimension2d<u32>& getOriginalSize() const = 0; //! Get dimension (=size) of the texture. /** \return The size of the texture. */ virtual const core::dimension2d<u32>& getSize() const = 0; //! Get driver type of texture. /** This is the driver, which created the texture. This method is used internally by the video devices, to check, if they may use a texture because textures may be incompatible between different devices. \return Driver type of texture. */ virtual E_DRIVER_TYPE getDriverType() const = 0; //! Get the color format of texture. /** \return The color format of texture. */ virtual ECOLOR_FORMAT getColorFormat() const = 0; //! Get pitch of the main texture (in bytes). /** The pitch is the amount of bytes used for a row of pixels in a texture. \return Pitch of texture in bytes. */ virtual u32 getPitch() const = 0; //! Check whether the texture has MipMaps /** \return True if texture has MipMaps, else false. */ virtual bool hasMipMaps() const { return false; } //! Returns if the texture has an alpha channel virtual bool hasAlpha() const { return getColorFormat () == video::ECF_A8R8G8B8 || getColorFormat () == video::ECF_A1R5G5B5; } //! Regenerates the mip map levels of the texture. /** Required after modifying the texture, usually after calling unlock(). \param mipmapData Optional parameter to pass in image data which will be used instead of the previously stored or automatically generated mipmap data. The data has to be a continuous pixel data for all mipmaps until 1x1 pixel. Each mipmap has to be half the width and height of the previous level. At least one pixel will be always kept.*/ virtual void regenerateMipMapLevels(void* mipmapData=0) = 0; //! Check whether the texture is a render target /** Render targets can be set as such in the video driver, in order to render a scene into the texture. Once unbound as render target, they can be used just as usual textures again. \return True if this is a render target, otherwise false. */ virtual bool isRenderTarget() const { return false; } //! Get name of texture (in most cases this is the filename) const io::SNamedPath& getName() const { return NamedPath; } protected: //! Helper function, helps to get the desired texture creation format from the flags. /** \return Either ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED. */ inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags) { if (flags & ETCF_OPTIMIZED_FOR_SPEED) return ETCF_OPTIMIZED_FOR_SPEED; if (flags & ETCF_ALWAYS_16_BIT) return ETCF_ALWAYS_16_BIT; if (flags & ETCF_ALWAYS_32_BIT) return ETCF_ALWAYS_32_BIT; if (flags & ETCF_OPTIMIZED_FOR_QUALITY) return ETCF_OPTIMIZED_FOR_QUALITY; return ETCF_OPTIMIZED_FOR_SPEED; } io::SNamedPath NamedPath; }; } // end namespace video } // end namespace irr #endif
[ "hybrid@dfc29bdd-3216-0410-991c-e03cc46cb475", "cutealien@dfc29bdd-3216-0410-991c-e03cc46cb475" ]
[ [ [ 1, 87 ], [ 89, 172 ], [ 174, 192 ], [ 194, 201 ] ], [ [ 88, 88 ], [ 173, 173 ], [ 193, 193 ] ] ]
adc7fa38b08626e7fc511ca59ca0bf9f7347cb26
5236606f2e6fb870fa7c41492327f3f8b0fa38dc
/nsrpc/examples/SimpleRelayServer/stdafx.cpp
864208437031a81849229779289b0d979616b176
[]
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
213
cpp
// stdafx.cpp : source file that includes just the standard includes // SimpleRelayServer.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
[ "kcando@6d7ccee0-1a3b-0410-bfa1-83648d9ec9a4" ]
[ [ [ 1, 5 ] ] ]
3c8953f250435e2104823001ba760ead26c85f86
4a266d6931aa06a2343154cab99d8d5cfdac6684
/csci3081/project-phase2/WaterHeater.cpp
8086dd285e5fc42402bee716f8641dea20e6db36
[]
no_license
Magneticmagnum/robotikdude-school
f0185feb6839ad5c5324756fc86f984fce7abdc1
cb39138b500c8bbc533e796225588439dcfa6555
refs/heads/master
2021-01-10T19:01:39.479621
2011-05-17T04:44:47
2011-05-17T04:44:47
35,382,573
0
0
null
null
null
null
UTF-8
C++
false
false
2,093
cpp
#include "WaterHeater.h" #include "Scheduler.h" log4cxx::LoggerPtr WaterHeater::log_(log4cxx::Logger::getLogger("WaterHeater")); WaterHeater::WaterHeater() : running_(false), waterTemperature_(WATERHEATER_TEMP_OFF), timeRunning_(0.0) { } WaterHeater::WaterHeater(double temperature) : running_(false), waterTemperature_(temperature), timeRunning_(0.0) { } void WaterHeater::tick() { if (running_ && waterTemperature_ > WATERHEATER_TEMP_OFF) { running_ = false; LOG4CXX_INFO(log_, " At time " << Scheduler::getInstance()->getTimeStr() << " the water heater was turned off. Total energy used: " << getEnergy() << "."); } else if (running_ || waterTemperature_ < WATERHEATER_TEMP_ON) { timeRunning_++; waterTemperature_ += WATERHEATER_HEAT_GAIN + WATERHEATER_HEAT_LOSS; if (!running_) { LOG4CXX_INFO(log_, " At time " << Scheduler::getInstance()->getTimeStr() << " the water heater was turned on."); } running_ = true; } waterTemperature_ -= WATERHEATER_HEAT_LOSS; } double WaterHeater::getPower() const { return WATERHEATER_POWER; } double WaterHeater::getEnergy() const { return getPower() * timeRunning_; } double WaterHeater::getWater(double amount, double temperature) { if (amount > WATERHEATER_CAPACITY) { double extraAmount = amount - WATERHEATER_CAPACITY; double maxTemp = (waterTemperature_ * WATERHEATER_CAPACITY + WATERHEATER_TEMP_INCOMING * extraAmount) / amount; waterTemperature_ = WATERHEATER_TEMP_INCOMING; return (temperature >= maxTemp ? maxTemp : temperature); } else { if (temperature > waterTemperature_) { temperature = waterTemperature_; } waterTemperature_ = (WATERHEATER_TEMP_INCOMING * amount + waterTemperature_ * (WATERHEATER_CAPACITY - amount)) / WATERHEATER_CAPACITY; return temperature; } } double WaterHeater::getWaterTemperature() const { return waterTemperature_; } bool WaterHeater::isRunning() const { return running_; }
[ "robotikdude@e80761d0-8fc2-79d0-c9d0-3546e327c268" ]
[ [ [ 1, 76 ] ] ]
f517ff6bfa4c98c57029bf2ddca9254b7e9f358d
f177993b13e97f9fecfc0e751602153824dfef7e
/ImPro/ImProFilters/TouchLibFilter/Touchlib/src/filterbrightnesscontrast.cpp
e54210957c8579a791d278f7046c647e7462d47b
[]
no_license
svn2github/imtophooksln
7bd7412947d6368ce394810f479ebab1557ef356
bacd7f29002135806d0f5047ae47cbad4c03f90e
refs/heads/master
2020-05-20T04:00:56.564124
2010-09-24T09:10:51
2010-09-24T09:10:51
11,787,598
1
0
null
null
null
null
UTF-8
C++
false
false
2,424
cpp
#include "filterbrightnesscontrast.h" BrightnessContrastFilter::BrightnessContrastFilter(char* s) : Filter(s) { _brightness = (float) DEFAULT_BRIGHTNESS; _contrast = (float) DEFAULT_CONTRAST; // mapping from input to output values via lookup table, recalculated when brightness or contrast changed _lutmat = cvCreateMatHeader( 1, 256, CV_8UC1 ); updateLUT(); } BrightnessContrastFilter::~BrightnessContrastFilter() { } void BrightnessContrastFilter::updateLUT( void ) { int i; float max_value = 0; uchar lut[256*4]; /* * The algorithm is by Werner D. Streidt * (http://visca.com/ffactory/archives/5-99/msg00021.html) */ if( _contrast > 0 ) { double delta = 127.*_contrast; double a = 255./(255. - delta*2); double b = a*(_brightness*100 - delta); for( i = 0; i < 256; i++ ) { int v = cvRound(a*i + b); if( v < 0 ) v = 0; if( v > 255 ) v = 255; lut[i] = (uchar)v; } } else { double delta = -128.*_contrast; double a = (256.-delta*2)/255.; double b = a*_brightness*100. + delta; for( i = 0; i < 256; i++ ) { int v = cvRound(a*i + b); if( v < 0 ) v = 0; if( v > 255 ) v = 255; lut[i] = (uchar)v; } } cvSetData( _lutmat, lut, 0 ); } void BrightnessContrastFilter::kernel() { // derived class responsible for allocating storage for filtered image if( !destination ) { destination = cvCreateImage(cvSize(source->width,source->height), source->depth, source->nChannels); destination->origin = source->origin; // same vertical flip as source } cvLUT( source, destination, _lutmat ); } void BrightnessContrastFilter::kernelWithROI() { // derived class responsible for allocating storage for filtered image if( !destination ) { destination = cvCreateImage(cvSize(source->width,source->height), source->depth, source->nChannels); destination->origin = source->origin; // same vertical flip as source } cvZero(destination); CvRect roiRECT = cvGetImageROI(source); cvSetImageROI(destination, roiRECT); cvLUT( source, destination, _lutmat ); }
[ "ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a" ]
[ [ [ 1, 93 ] ] ]
0e153f8997b1fc7b2b8f6f4628f2ab15d43c4675
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/nebula2/src/entity/nobjectmagicinstancer_cmds.cc
5cd69ad839ce48f040c9e1ed9076c8a2386ad6f1
[]
no_license
ugozapad/TheZombieEngine
832492930df28c28cd349673f79f3609b1fe7190
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
refs/heads/master
2020-04-30T11:35:36.258363
2011-02-24T14:18:43
2011-02-24T14:18:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,836
cc
//------------------------------------------------------------------------------ // nobjectmagicinstancer_cmds.cc // (c) 2005 Conjurer Services, S.A. //------------------------------------------------------------------------------ #include "precompiled/pchnentity.h" #include "entity/nobjectmagicinstancer.h" #include "zombieentity/ncsubentity.h" //------------------------------------------------------------------------------ /** @brief save object to persistent stream */ bool nObjectMagicInstancer::SaveCmds(nPersistServer* ps) { bool retval = true; if (this->objs) { for ( unsigned int magicNumber = 0; magicNumber < ( 1 << nEntityObjectServer::IDHIGHBITS ) ; magicNumber++ ) { // put magic number command nCmd * cmd = ps->GetCmd(this, 'JSMN'); cmd->Rewind(); cmd->In()->SetI( magicNumber ); ps->PutCmd( cmd ); // save all objects for(int i = 0;i < this->Size();i++) { // get object nObject * obj = this->At(i); n_assert( obj ); // get object id if ( ! obj->IsA("nentityobject") ) { // Object which are not entity objects are saved in the magic 0 section if ( magicNumber != 0 ) { continue; } } else { nEntityObjectId objId = 0; nEntityObject* entObj = static_cast<nEntityObject*>( obj ); ncSubentity* subEntComp = entObj->GetComponent<ncSubentity>(); if ( subEntComp ) { // Subentities have special oid's objId = subEntComp->GetPersistenceOID(); } else { // Get normal entity oid entObj->GetId(); } nEntityObjectId objectMagic = ( objId & ( nEntityObjectServer::IDHIGHMASK >> nEntityObjectServer::IDHIGHBITS )) >> nEntityObjectServer::IDSUBENTITYBITS; // save objects of current magic only if ( objectMagic != magicNumber ) { continue; } } // get constructor cmd (begin new object) nCmd * cmd = ps->GetCmd(this, 'BENO'); bool objNamed = false; // fill the cmd cmd->Rewind(); cmd->In()->SetS(obj->GetClass()->GetName()); if (obj->GetClass()->IsA("nroot")) { objNamed = true; nRoot * objroot = static_cast<nRoot *> (obj); cmd->In()->SetS(objroot->GetFullName().Get()); } else { objNamed = false; cmd->In()->SetS(""); } // save the object cmd->Rewind(); if (ps->BeginObjectWithCmd(obj, cmd)) { if (!obj->SaveCmds(ps)) { retval = false; } ps->EndObject(objNamed); } } } } return retval; } //------------------------------------------------------------------------------ NSCRIPT_INITCMDS_BEGIN(nObjectMagicInstancer) NSCRIPT_ADDCMD('JSMN', void, SetMagicNumber, 1, (unsigned int), 0, ()); NSCRIPT_INITCMDS_END()
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
[ [ [ 1, 108 ] ] ]
7ede28ff9cde2049400947cd85bca49170a3c664
22d9640edca14b31280fae414f188739a82733e4
/Code/VTK/include/vtk-5.2/vtkDelimitedTextReader.h
9c8f2e17f6a3ad31744ddb258ffd5ef17bfa72b7
[]
no_license
tack1/Casam
ad0a98febdb566c411adfe6983fcf63442b5eed5
3914de9d34c830d4a23a785768579bea80342f41
refs/heads/master
2020-04-06T03:45:40.734355
2009-06-10T14:54:07
2009-06-10T14:54:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,514
h
/*========================================================================= Program: Visualization Toolkit Module: $RCSfile: vtkDelimitedTextReader.h,v $ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /*------------------------------------------------------------------------- Copyright 2008 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. -------------------------------------------------------------------------*/ // .NAME vtkDelimitedTextReader - reader for pulling in flat text files // // .SECTION Description // vtkDelimitedTextReader is an interface for pulling in data from a // flat, delimited text file (delimiter can be any character). // // This class emits ProgressEvent for every 100 lines it reads. // // .SECTION Thanks // Thanks to Andy Wilson and Brian Wylie from Sandia National Laboratories // for implementing this class. // // .SECTION Caveats // // This reader assumes that the first line in the file (whether that's // headers or the first document) contains at least as many fields as // any other line in the file. #ifndef __vtkDelimitedTextReader_h #define __vtkDelimitedTextReader_h #include "vtkTableAlgorithm.h" class vtkTable; //BTX struct vtkDelimitedTextReaderInternals; //ETX class VTK_INFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm { public: static vtkDelimitedTextReader* New(); vtkTypeRevisionMacro(vtkDelimitedTextReader,vtkTableAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); vtkGetStringMacro(FileName); vtkSetStringMacro(FileName); // Description: // Get/set the characters that will be used to separate fields. For // example, set this to "," for a comma-separated value file. Set // it to ".:;" for a file where columns can be separated by a // period, colon or semicolon. The order of the characters in the // string does not matter. Defaults to a comma. vtkSetStringMacro(FieldDelimiterCharacters); vtkGetStringMacro(FieldDelimiterCharacters); // Description: // Get/set the character that will begin and end strings. Microsoft // Excel, for example, will export the following format: // // "First Field","Second Field","Field, With, Commas","Fourth Field" // // The third field has a comma in it. By using a string delimiter, // this will be correctly read. The delimiter defaults to '"'. vtkGetMacro(StringDelimiter, char); vtkSetMacro(StringDelimiter, char); // Description: // Set/get whether to use the string delimiter. Defaults to on. vtkSetMacro(UseStringDelimiter, bool); vtkGetMacro(UseStringDelimiter, bool); vtkBooleanMacro(UseStringDelimiter, bool); // Description: // Set/get whether to treat the first line of the file as headers. vtkGetMacro(HaveHeaders,bool); vtkSetMacro(HaveHeaders,bool); // Description: // Set/get whether to merge successive delimiters. Use this if (for // example) your fields are separated by spaces but you don't know // exactly how many. vtkSetMacro(MergeConsecutiveDelimiters, bool); vtkGetMacro(MergeConsecutiveDelimiters, bool); vtkBooleanMacro(MergeConsecutiveDelimiters, bool); // Description: // Set/get the maximum number of records to read from the file (zero = unlimited) vtkGetMacro(MaxRecords, int); vtkSetMacro(MaxRecords, int); protected: vtkDelimitedTextReader(); ~vtkDelimitedTextReader(); vtkDelimitedTextReaderInternals* Internals; int RequestData( vtkInformation*, vtkInformationVector**, vtkInformationVector*); void OpenFile(); char* FileName; char *FieldDelimiterCharacters; char StringDelimiter; bool UseStringDelimiter; bool HaveHeaders; bool MergeConsecutiveDelimiters; char *ReadBuffer; int MaxRecords; private: vtkDelimitedTextReader(const vtkDelimitedTextReader&); // Not implemented void operator=(const vtkDelimitedTextReader&); // Not implemented }; #endif
[ "nnsmit@9b22acdf-97ab-464f-81e2-08fcc4a6931f" ]
[ [ [ 1, 131 ] ] ]
12f5bf0560a168118587530e2bb24fb97ecf2153
28aa891f07cc2240c771b5fb6130b1f4025ddc84
/eop/shuffle2d.cpp
bf283550c3d2c5840734999f854916601c76d5fb
[]
no_license
Hincoin/mid-autumn
e7476d8c9826db1cc775028573fc01ab3effa8fe
5271496fb820f8ab1d613a1c2355504251997fef
refs/heads/master
2021-01-10T19:17:01.479703
2011-12-19T14:32:51
2011-12-19T14:32:51
34,730,620
0
0
null
null
null
null
UTF-8
C++
false
false
14,427
cpp
#include <utility> #include <algorithm> #include <vector> #include <stack> #include <set> #include <cassert> #include <cstdlib> template<typename T, typename P, typename F> inline void loop_action(T& v, P& p,F& f) { while (!p(v)) { f(v); } } //left,right,up,down enum ConnectorType{ UnknownConnector=0x0, L=0x01,R = L << 1,U = R << 1,D = U << 1, UR = U | R, RD = R | D, DL = D|L, LU = L|U , LR = L|R, UD = U|D, LUR = L|UR,DLU = D|LU ,RDL = R|DL,URD=U|RD, LURD = LUR | D }; //for print static const char* ConnectTypeStr[] = { "UnknownOrCount", "L ",//01 "R ",//02 "LR ",//03 "U ",//04 "LU ",//05 "UR ",//06 "LUR ",//07 "D ",//08 "DL ",//09 "RD ",//10 "RDL ",//11 "UD ",//12 "DLU ",//13 "URD ",//14 "LURD ",//15 }; template<int C> bool is_one_of(ConnectorType c) { return (C & c) != 0; } struct check_connection { template<typename Array2D> std::pair<typename Array2D::size_type, typename Array2D::size_type> go_left(const Array2D& array, const std::pair<typename Array2D::size_type, typename Array2D::size_type>& t)const { assert(t.second > 0); return (std::make_pair(t.first,t.second - 1)); } template<typename Array2D> std::pair<typename Array2D::size_type, typename Array2D::size_type> go_up(const Array2D& array, const std::pair<typename Array2D::size_type, typename Array2D::size_type>& t)const { assert(t.first > 0); return (std::make_pair(t.first - 1, t.second)); } template<typename Array2D> std::pair<typename Array2D::size_type, typename Array2D::size_type> go_right(const Array2D& array, const std::pair<typename Array2D::size_type, typename Array2D::size_type>& t)const { assert(t.second +1 < array[t.first].size()); return (std::make_pair(t.first, t.second +1)); } template<typename Array2D> std::pair<typename Array2D::size_type, typename Array2D::size_type> go_down(const Array2D& array, const std::pair<typename Array2D::size_type, typename Array2D::size_type>& t)const { assert(t.first + 1 < array.size()); return (std::make_pair(t.first+1,t.second)); } template<typename Array2D> bool operator()(const Array2D& array)const { if (array.empty()) return true; if (array[0].empty()) return true; typedef typename Array2D::size_type size_type; size_type i = 0; size_type j = 0; typedef std::pair<size_type,size_type> coord_type; std::stack< coord_type > coord_stack; std::set< coord_type > coords; coord_stack.push(std::make_pair(i,j)); while(!coord_stack.empty()) { coord_type t = coord_stack.top(); coord_stack.pop(); if (coords.find(std::make_pair(t.first,t.second)) != coords.end()) continue; coords.insert(std::make_pair(t.first,t.second)); ConnectorType conn = array[t.first][t.second]; if (is_one_of<L>(conn)) coord_stack.push(go_left(array,t)); if (is_one_of<U>(conn)) coord_stack.push(go_up(array,t)); if (is_one_of<R>(conn)) coord_stack.push(go_right(array,t)); if (is_one_of<D>(conn)) coord_stack.push(go_down(array,t)); if (conn == UnknownConnector) { if (t.first > 0) { ConnectorType c = array[t.first - 1][t.second]; if(c == UnknownConnector|| is_one_of<D>(c)) { coord_stack.push(go_up(array,t)); } } if (t.first+1 < array.size()) { ConnectorType c = array[t.first + 1][t.second]; if (c == UnknownConnector|| is_one_of<U>(c)) coord_stack.push(go_down(array,t)); } if (t.second > 0) { ConnectorType c = array[t.first][t.second - 1]; if (c == UnknownConnector|| is_one_of<R>(c)) coord_stack.push(go_left(array,t)); } if (t.second + 1 < array[t.first].size()) { ConnectorType c = array[t.first][t.second + 1]; if (c == UnknownConnector || is_one_of<L>(c)) { coord_stack.push(go_right(array,t)); } } } } for (i = 0;i < array.size(); ++i) for(j = 0;j < array[i].size(); ++j) { if (coords.end() == coords.find(std::make_pair(i,j))) { return false; } } return true; } }; struct is_complete{ mutable size_t count ; is_complete(size_t max_count = size_t(-1)):count(max_count){} template<typename Array2D> bool operator()(const Array2D& array)const { typedef typename Array2D::size_type size_type; if (count == 0) return true; // typedef typename Array2D::size_type size_type; for(size_type i = 0;i < array.size(); ++i) for(size_type j = 0;j < array[i].size(); ++j) { if (array[i][j] == UnknownConnector) return false; } return check_connection()(array); } }; struct default_random_policy{ typedef std::ptrdiff_t value_type; //returns a value belongs to [0,m) value_type operator()(value_type m) { double tmp ; tmp = static_cast<double>(rand()) / static_cast<double>(RAND_MAX); return static_cast<value_type>(tmp * m); } }; template<typename Array2D, typename RNG = default_random_policy> struct place_step { enum NeighborRelation{NoPath, HasPath, NoNeighbor, RelationCount}; typedef typename Array2D::size_type size_type; typedef std::vector<ConnectorType> connector_array_t; typedef place_step<Array2D, RNG> class_type; public: explicit place_step(RNG* r = 0):x(0),z(0),rng(r){ init_condition_map(); } void operator()(Array2D& array) { assert(z < array.size()); if( x < array[z].size() ) { //keep trying place at z x if ( array[z][x] == UnknownConnector) try_place(array); x += 1; } else if( z < array.size() ) { //keep trying place at z x if (x < array[z].size() && array[z][x] == UnknownConnector) try_place(array); z += 1; x = 0; } } private: void init_condition_map() { ConnectorType all_cs[]= { L,R,U,D, UR,RD,DL,LU,LR,UD, LUR,DLU,RDL,URD, LURD }; connector_array_t all_connectors(all_cs,all_cs + sizeof(all_cs)/sizeof(ConnectorType)); NeighborRelation nr[] = {NoPath, HasPath, NoNeighbor}; size_t count = sizeof(nr)/sizeof(NeighborRelation); for (size_t li = 0;li < count; ++li) for (size_t ui = 0; ui < count; ++ui) for(size_t ri = 0; ri < count; ++ri) for (size_t di = 0; di < count; ++di) { NeighborRelation l,u,r,d; l = nr[li]; u = nr[ui]; r = nr[ri]; d = nr[di]; connector_array_t cs ( all_connectors ); if (l != NoNeighbor) filter_by_conn<L>(l == HasPath, cs).swap(cs); if (u != NoNeighbor) filter_by_conn<U>(u == HasPath, cs).swap(cs); if (r != NoNeighbor) filter_by_conn<R>(r == HasPath, cs).swap(cs); if (d != NoNeighbor) filter_by_conn<D>(d ==HasPath, cs).swap(cs); condition_map[l][u][r][d].swap(cs); } } template<int _0> connector_array_t filter_by_conn(bool bHasPath, const connector_array_t& a) { connector_array_t ret; for (connector_array_t::const_iterator it = a.begin(); it != a.end();++it) { if( is_one_of<_0>(*it)) { if (bHasPath) ret.push_back(*it); } else if (!bHasPath) ret.push_back(*it); } return ret; } private: void try_place(Array2D& array)const { if (array.empty()) return ; array[z][x] = pick_current_connector(array, get_left_relation(array),get_up_relation(array),get_right_relation(array),get_down_relation(array)); return; } NeighborRelation get_left_relation(const Array2D& array)const { if (x == 0) return class_type::NoPath; ConnectorType left = array[z][x-1]; if (left == UnknownConnector) return class_type::NoNeighbor; if (is_one_of<R>(left)) return class_type::HasPath; return class_type::NoPath; } NeighborRelation get_up_relation(const Array2D& array)const { if ( z == 0) return class_type::NoPath; ConnectorType up = array[z-1][x]; if (up == UnknownConnector) return class_type::NoNeighbor; if (is_one_of<D>(up) ) return class_type::HasPath; return class_type::NoPath; } NeighborRelation get_right_relation(const Array2D& array)const { if (x == array[z].size() - 1) return class_type::NoPath; ConnectorType right = array[z][x+1]; if(right == UnknownConnector) return class_type::NoNeighbor; if (is_one_of<L>(right)) return class_type::HasPath; return class_type::NoPath; } NeighborRelation get_down_relation(const Array2D& array)const { if ( z == array.size() - 1) return class_type::NoPath; ConnectorType down = array[z+1][x]; if (down == UnknownConnector) return class_type::NoNeighbor; if (is_one_of<U>(down)) return class_type::HasPath; return class_type::NoPath; } private: ConnectorType pick_current_connector(const Array2D& array, NeighborRelation left, NeighborRelation up, NeighborRelation right, NeighborRelation down ) const { connector_array_t& a = const_cast<connector_array_t&>(condition_map[left][up][right][down]) ; if (a.empty() ){ assert(false); return UnknownConnector;} //shuffle a if(rng) std::random_shuffle(a.begin(), a.end(), *rng); else std::random_shuffle(a.begin(), a.end()); connector_array_t::iterator it = a.begin(); check_end p(x,z,array,a); advance_it step; loop_action(it, p, step); if (it == a.end()) { assert(false); return UnknownConnector;} return *it; } struct advance_it{ template<typename I> void operator()(I& it)const { ++it ; } }; struct check_end{ const Array2D& array; const connector_array_t& cs; size_type x,z; check_end(size_type x, size_type z,const Array2D& a,const connector_array_t& c): x(x),z(z),array(a),cs(c){} bool operator()(const connector_array_t::iterator& it)const { if (it == cs.end()) { return true; } Array2D& tmp = const_cast<Array2D&> ( array ); ConnectorType t = array[z][x]; tmp[z][x] = *it; bool ret = *it == LURD || check_connection()(tmp); //restore back tmp[z][x] = t; return ret; } }; private: size_type x,z; RNG* rng; connector_array_t condition_map[RelationCount][RelationCount][RelationCount][RelationCount]; }; #include <iostream> #include <cstdio> void test(int width,int height, int seed) { typedef std::vector<std::vector<ConnectorType> > array2d_t; array2d_t array; std::vector<ConnectorType> elem; elem.resize(width,UnknownConnector); array.resize(height, elem); srand(seed); default_random_policy rng; place_step<array2d_t> step(&rng); is_complete p; loop_action(array,p,step); for(size_t i = 0;i < array.size(); ++i) { for(size_t j = 0; j < array[i].size(); ++j) { if ( array[i][j] != UnknownConnector) ;//printf("%s",ConnectTypeStr[array[i][j]] ); else { printf("Error : (%d,%d)-%d\n",width,height,seed); exit(1); return; } } //printf("\n"); } } void exaust_test(int seed) { printf("seed : %d\n",seed); for(size_t i = 2;i < 20;++i) { for(size_t j = 2; j < 20; ++j) { test(i,j,seed); //printf("\n\n"); } } } int main() { for(int i = 0;i < 10000; i++) { exaust_test(i); } return 0; }
[ "luozhiyuan@ea6f400c-e855-0410-84ee-31f796524d81" ]
[ [ [ 1, 428 ] ] ]
f228fd013e004c3af10bc20c09b6c8a192b6a8e1
4ab592fb354f75b42181d5375d485031960aaa7d
/DES_GOBSTG/DES_GOBSTG/Class/PlayerBullet.cpp
782378183cadc377671e7f36a4ce5af38f76ee9b
[]
no_license
CBE7F1F65/cca610e2e115c51cef211fafb0f66662
806ced886ed61762220b43300cb993ead00949dc
b3cdff63d689e2b1748e9cd93cedd7e8389a7057
refs/heads/master
2020-12-24T14:55:56.999923
2010-07-23T04:24:59
2010-07-23T04:24:59
32,192,699
0
0
null
null
null
null
UTF-8
C++
false
false
15,731
cpp
#include "../header/PlayerBullet.h" #include "../header/Player.h" #include "../header/Enemy.h" #include "../header/SE.h" #include "../header/Main.h" #include "../header/SpriteItemManager.h" #include "../header/FrontDisplayName.h" #include "../header/BResource.h" #include "../header/Export.h" #include "../header/EventZone.h" #include "../header/ProcessDefine.h" #include "../header/Process.h" VectorList<PlayerBullet> PlayerBullet::pb[M_PL_MATCHMAXPLAYER]; int PlayerBullet::locked[M_PL_MATCHMAXPLAYER]; int PlayerBullet::activelocked[M_PL_MATCHMAXPLAYER]; hgeSprite * PlayerBullet::sprite[PLAYERSHOOTTYPEMAX][PLAYERBULLETTYPE]; DWORD PlayerBullet::bcol0; DWORD PlayerBullet::bcol1; DWORD PlayerBullet::bcol2; DWORD PlayerBullet::bcol3; WORD PlayerBullet::beams; #define _PBLOCK_ACCSPEED 1.0f #define _PBLOCK_MINSPEED 2.0f #define _PBLOCK_TURNMAX 600 #define _PBLOCK_LOCKTIMERMAX 0x80 #define _PBBEAM_LASTINDEX 1 #define _PBCHASE_TURNSPEEDDOWN 0.8f #define _PBDELAY_SPEEDDOWN 0.9f #define _PB_DELETEBOLDER M_GAMESQUARE_HEIGHT #define _PB_DELETE_LEFT_(X) M_DELETECLIENT_LEFT_(X) - _PB_DELETEBOLDER #define _PB_DELETE_RIGHT_(X) M_DELETECLIENT_RIGHT_(X) + _PB_DELETEBOLDER #define _PB_DELETE_TOP M_DELETECLIENT_TOP - _PB_DELETEBOLDER #define _PB_DELETE_BOTTOM M_DELETECLIENT_BOTTOM + _PB_DELETEBOLDER #define _PB_HEADARCPLUS 10 #define PLAYERBULLETMAX 0x100 #define _PBTEX_PLAYERBEGIN 10 PlayerBullet::PlayerBullet() { able = false; } PlayerBullet::~PlayerBullet() { } void PlayerBullet::Init() { Release(); for (int i=0; i<M_PL_MATCHMAXPLAYER; i++) { pb[i].init(PLAYERBULLETMAX); locked[i] = PBLOCK_LOST; activelocked[i] = PBLOCK_LOST; } for (int i=0; i<PLAYERSHOOTTYPEMAX; i++) { for (int j=0; j<PLAYERBULLETTYPE; j++) { sprite[i][j] = SpriteItemManager::CreateSprite(BResource::bres.playershootdata[i].siid+(((BResource::bres.playershootdata[i].flag)&PBFLAG_ANIMATION)?j:0)); } } } void PlayerBullet::Release() { for (int i=0; i<PLAYERSHOOTTYPEMAX; i++) { for (int j=0; j<PLAYERBULLETTYPE; j++) { SpriteItemManager::FreeSprite(&sprite[i][j]); } } for (int i=0; i<M_PL_MATCHMAXPLAYER; i++) { pb[i].clear(); } } void PlayerBullet::ClearItem() { for (int i=0; i<M_PL_MATCHMAXPLAYER; i++) { pb[i].clear_item(); locked[i] = PBLOCK_LOST; activelocked[i] = PBLOCK_LOST; } } void PlayerBullet::Action() { for (int j=0; j<M_PL_MATCHMAXPLAYER; j++) { DWORD stopflag = Process::mp.GetStopFlag(); bool binstop = FRAME_STOPFLAGCHECK_PLAYERINDEX_(stopflag, j, FRAME_STOPFLAG_PLAYERBULLET); if (!binstop) { if (pb[j].getSize()) { DWORD i = 0; DWORD size = pb[j].getSize(); for (pb[j].toBegin(); i<size; pb[j].toNext(), i++) { if (!pb[j].isValid()) { continue; } DWORD _index = pb[j].getIndex(); if ((*pb[j]).exist) { (*pb[j]).action(); } else { pb[j].pop(); } pb[j].toIndex(_index); } } } } } void PlayerBullet::RenderAll(BYTE playerindex) { if (pb[playerindex].getSize()) { DWORD i = 0; DWORD size = pb[playerindex].getSize(); for (pb[playerindex].toBegin(); i<size; pb[playerindex].toNext(), i++) { if (pb[playerindex].isValid()) { (*pb[playerindex]).Render(); } } } } void PlayerBullet::BuildShoot(BYTE playerindex, BYTE playerID, int usetimer, bool bchargeshoot/* =false */) { playershootData * item; for (int i=0; i<PLAYERSHOOTTYPEMAX; i++) { item = &(BResource::bres.playershootdata[i]); if (item->userID == playerID) { if ((bchargeshoot) ^ (item->bchargeshoot)) { continue; } if (item->timeMod && (item->timeMod == 1 || !(usetimer % item->timeMod))) { Build(playerindex, i); } } } } int PlayerBullet::Build(BYTE playerindex, int shootdataID, bool explode/* =false */, float xoffset/* =0 */, float yoffset/* =0 */) { if (pb[playerindex].getSize() == PLAYERBULLETMAX) { return -1; } PlayerBullet _pb; playershootData * item = &(BResource::bres.playershootdata[shootdataID]); if (!(item->timeMod) && !explode) { return -1; } pb[playerindex].push_back(_pb)->valueSet(playerindex, shootdataID, item->arrange, item->xbias+xoffset, item->ybias+yoffset, item->scale, item->angle, item->addangle, item->speed, item->accelspeed, item->power, item->hitonfactor, item->flag, item->seID, item->deletetime); return pb[playerindex].getEndIndex(); } void PlayerBullet::valueSet(BYTE _playerindex, WORD _ID, BYTE _arrange, float _xbias, float _ybias, float _scale, int _angle, int _addangle, float _speed, float _accelspeed, float _power, int _hitonfactor, WORD _flag, BYTE seID, int _deletetime) { playerindex = _playerindex; ID = _ID; angle = _angle; addangle = _addangle; speed = _speed; accelspeed = _accelspeed; oldspeed = speed; power = _power; hitonfactor = _hitonfactor; arrange = _arrange; flag = _flag; xbias = _xbias; ybias = _ybias; scale = _scale; deletetime = _deletetime; timer = 0; exist = true; able = true; fadeout = false; hscale = 1.0f; vscale = 1.0f; headangle = 0; animation = 0; diffuse = 0xffffff; alpha = 0xC0; if (flag & PBFLAG_RANDOMANGLE) { angle = randt(0, angle*2) - angle; } if (arrange) { angle += Player::p[playerindex].pg[arrange-1].shootangle; } if (flag & PBFLAG_ANTISHOOTER) { if (!arrange) { angle += Player::p[playerindex].aMainAngle(Player::p[playerindex].lastmx[0], Player::p[playerindex].lastmy[0]); } } else { angle += 27000; } if (!(flag & PBFLAG_ZONELIKE)) { xplus = speed * cost(angle); yplus = speed * sint(angle); } else { xplus = 0; yplus = 0; } if (flag & PBFLAG_BEAM) { hscale = M_CLIENT_HEIGHT / SpriteItemManager::GetTexW(BResource::bres.playershootdata[ID].siid); vscale = scale / SpriteItemManager::GetTexH(BResource::bres.playershootdata[ID].siid); angle = -9000; for (int i=0; i<PLAYERBULLETTYPE; i++) { sprite[ID][i]->SetBlendMode(BLEND_ALPHAADD); } } else { if (flag & PBFLAG_ZONELIKE) { hscale = 0; vscale = 0; } else { hscale *= scale; vscale *= scale; } } locktimer = 0; if(arrange) { x = Player::p[playerindex].pg[arrange-1].x; y = Player::p[playerindex].pg[arrange-1].y; } else { x = Player::p[playerindex].x; y = Player::p[playerindex].y; } x += xbias; y += ybias; SE::push(seID, x); } void PlayerBullet::Render() { if (sprite[ID][animation]) { /* if (flag & PBFLAG_BEAM) { spriteData * spdata = SpriteItemManager::CastSprite(BResource::bres.playershootdata[ID].siid); sprite[ID][animation]->SetTextureRect(spdata->tex_x+timer*speed, spdata->tex_y, spdata->tex_w, spdata->tex_h); } */ sprite[ID][animation]->SetColor((alpha<<24)|diffuse); SpriteItemManager::RenderSpriteEx(sprite[ID][animation], x, y, ARC(angle+headangle), hscale, vscale); } } void PlayerBullet::ClearLock() { for (int i=0; i<M_PL_MATCHMAXPLAYER; i++) { locked[i] = PBLOCK_LOST; activelocked[i] = PBLOCK_LOST; } } bool PlayerBullet::CheckAndSetLock(BObject * pbobj, BYTE playerindex, int lockedid, bool active) { if (locked[playerindex] != PBLOCK_LOST && activelocked[playerindex] != PBLOCK_LOST) { return false; } if (pbobj->x >= M_GAMESQUARE_LEFT_(playerindex) && pbobj->y <= M_GAMESQUARE_RIGHT_(playerindex) && pbobj->y >= M_GAMESQUARE_TOP && pbobj->y <= M_GAMESQUARE_BOTTOM) { if (locked[playerindex] == PBLOCK_LOST) { locked[playerindex] = lockedid; } if (activelocked[playerindex] == PBLOCK_LOST && active && pbobj->y <= M_GAMESQUARE_BOTTOM-64) { activelocked[playerindex] = lockedid; } return true; } return false; } bool PlayerBullet::GetLockAim(BObject ** ppbobj, BYTE playerindex) { int lockedid = activelocked[playerindex]; if (activelocked[playerindex] == PBLOCK_LOST) { lockedid = locked[playerindex]; } if (lockedid == PBLOCK_LOST) { return false; } if (ppbobj) { *ppbobj = &(Enemy::en[playerindex][lockedid]); return true; } return false; } void PlayerBullet::Lock() { locktimer++; BObject * _tpbobj; if (!GetLockAim(&_tpbobj, playerindex)) { if(speed < oldspeed) speed += _PBLOCK_ACCSPEED; if(speed > oldspeed) speed = oldspeed; return; } int aimangle = aMainAngle(_tpbobj->x, _tpbobj->y); bool clockwise = false; if(locktimer >= _PBLOCK_LOCKTIMERMAX) { locktimer = _PBLOCK_LOCKTIMERMAX; angle = aimangle; } while(angle > 18000) angle -= 36000; while(angle < -18000) angle += 36000; while(aimangle > 18000) aimangle -= 36000; while(aimangle < -18000) aimangle += 36000; int incangle = aimangle - angle; if(incangle > 18000) incangle = incangle - 36000; else if(incangle < -18000) incangle = 36000 + incangle; if(incangle > 0 && incangle < 18000) clockwise = true; incangle = abs(incangle); if(timer == 1 && incangle > 9000 && _tpbobj->y > y) { if(_tpbobj->x > x) angle = aimangle - 9000; else angle = aimangle + 9000; } if (speed < 0) { speed *= _PBDELAY_SPEEDDOWN; } else { if(incangle < _PBLOCK_TURNMAX) { angle = aimangle; if(speed < oldspeed) { speed += _PBLOCK_ACCSPEED; } if(speed > oldspeed) speed = oldspeed; } else { if(speed > _PBLOCK_MINSPEED) speed -= _PBLOCK_ACCSPEED; if(speed < _PBLOCK_MINSPEED) speed = _PBLOCK_MINSPEED; if(clockwise) angle += _PBLOCK_TURNMAX; else angle -= _PBLOCK_TURNMAX; } } } void PlayerBullet::hitOn() { // Player::p[playerindex].DoPlayerBulletHit(hitonfactor); if (flag & PBFLAG_ZONELIKE) { return; } fadeout = true; able = false; timer = 0; } bool PlayerBullet::isInRange(float aimx, float aimy, float w, float h) { bool hiton = true; if (flag & PBFLAG_BEAM) { hiton = false; w += scale / 2; if (timer == 0) { aimy += M_CLIENT_HEIGHT / 2; } h = M_CLIENT_HEIGHT / 2; } float rOri = BResource::bres.playershootdata[ID].collisionr * hscale; if (checkCollisionSquare(aimx, aimy, w, h, rOri)) { if (hiton) { if (!(flag & PBFLAG_ZONELIKE) && (flag & PBFLAG_OUTTURN)) { xplus = aimx - x; } hitOn(); } else if ((flag & PBFLAG_BEAM)/* && !(timer % 24)*/) { // Player::p[playerindex].DoPlayerBulletHit(hitonfactor); } return true; } return false; } void PlayerBullet::DelayShoot() { BObject * _tpbobj = NULL; GetLockAim(&_tpbobj, playerindex); if(timer == 1) { speed = -speed; } if(timer < PB_FADEOUTTIME) { if (flag & PBFLAG_TURNWHILEDELAY) { TurnBullet(oldspeed/6.0f); } speed *= _PBCHASE_TURNSPEEDDOWN; } else if(timer == PB_FADEOUTTIME) { headangle = 0; speed = oldspeed; } if (_tpbobj) { angle = aMainAngle(_tpbobj->x, _tpbobj->y); } } void PlayerBullet::TurnBullet(float mul) { headangle += (xplus<0?1:-1)*_PBLOCK_TURNMAX * mul; } void PlayerBullet::action() { timer++; if(!fadeout) { if (flag & PBFLAG_BEAM) { if (arrange) { y = Player::p[playerindex].pg[arrange-1].y; } else { y = Player::p[playerindex].y; } y += - M_CLIENT_HEIGHT / 2 + ybias; xplus = 0; yplus = 0; if (timer == 8) { timer = PB_FADEOUTTIME - 16; fadeout = true; } } else { speed += accelspeed; if ((flag & PBFLAG_DELAY) || (flag & PBFLAG_CHASE) || (flag & PBFLAG_TURNWHILEDELAY) || accelspeed) { if (flag & PBFLAG_DELAY) { DelayShoot(); } if (flag & PBFLAG_CHASE) { Lock(); } angle += addangle; xplus = speed * cost(angle); yplus = speed * sint(angle); } else { locktimer = 0; if (accelspeed && !(flag & PBFLAG_ZONELIKE)) { xplus = speed * cost(angle); yplus = speed * sint(angle); } } if (flag & PBFLAG_ZONELIKE) { if (flag & PBFLAG_ANIMATION) { if (timer % (PB_FADEOUTTIME / 3 + 1) == 1) { animation++; if (animation >= PLAYERBULLETTYPE) { animation = 0; } } } if (hscale < scale) { hscale += speed; } if (hscale > scale) { hscale = scale; } vscale = hscale; } if (flag & PBFLAG_RELATIVE) { float basex; float basey; if (arrange) { basex = Player::p[playerindex].pg[arrange-1].x; basey = Player::p[playerindex].pg[arrange-1].y; } else { basex = Player::p[playerindex].x; basex = Player::p[playerindex].y; } x = basex + xplus*timer; y = basey + yplus*timer; } else { x += xplus; y += yplus; } if (flag & PBFLAG_TURN) { TurnBullet(speed/4.0f); } } if (deletetime && timer >= 16 && timer > deletetime-16) { alpha = (deletetime-timer)*0x0C; } if (deletetime && timer >= deletetime || x < _PB_DELETE_LEFT_(playerindex) || x > _PB_DELETE_RIGHT_(playerindex) || y < _PB_DELETE_TOP || y > _PB_DELETE_BOTTOM) { exist = false; } } else { if(timer == PB_FADEOUTTIME) { exist = false; } if (flag & PBFLAG_OUTTURN) { TurnBullet(); } if (flag & PBFLAG_ANIMATION) { if (timer % (PB_FADEOUTTIME / 3 + 1) == 1) { animation++; if (animation >= PLAYERBULLETTYPE) { animation = PLAYERBULLETTYPE-1; } } } if (flag & PBFLAG_REBOUND) { if (xplus < 0) { x += 1; } else { x -= 1; } y -= 0.5f; } if (flag & PBFLAG_EXPLODE) { if (timer == 1) { Build(playerindex, ID+1, true, x-Player::p[playerindex].x, y-Player::p[playerindex].y); // SE::push(SE_PLAYER_EXPLODE, x); } // EventZone::Build(EVENTZONE_TYPE_ENEMYDAMAGE, playerindex, x, y, 32/BResource::bres.playershootdata[ID].timeMod, SpriteItemManager::GetTexW(BResource::bres.playershootdata[ID].siid), power); } if (flag & PBFLAG_SCALEUP) { hscale = (timer * 0.05f + 1.0f) * scale; vscale = hscale; } if (flag & PBFLAG_BEAM) { float taimx = Player::p[playerindex].x; if (arrange) { taimx = Player::p[playerindex].pg[arrange-1].x; } float taimy = Player::p[playerindex].y; if (arrange) { taimy = Player::p[playerindex].pg[arrange-1].y; } taimx += xbias; taimy += -M_CLIENT_HEIGHT / 2 + ybias; chaseAim(taimx, taimy, (64-timer)); updateMove(); angle = -9000; } alpha = (32 - timer) * 0x06; } able = exist && !fadeout; } bool PlayerBullet::CheckShoot(BYTE playerindex, Enemy * en, float aimx, float aimy, float aimw, float aimh) { // float totalpower = 0.0f; bool hit = false; if (pb[playerindex].getSize()) { DWORD i = 0; DWORD size = pb[playerindex].getSize(); for (pb[playerindex].toBegin(); i<size; pb[playerindex].toNext(), i++) { if (pb[playerindex].isValid() && (*pb[playerindex]).able) { if ((*pb[playerindex]).isInRange(aimx, aimy, aimw, aimh)) { hit = true; // totalpower += (*pb[playerindex]).power; if (en->CostLife((*pb[playerindex]).power)) { Player::p[playerindex].DoPlayerBulletHit((*pb[playerindex]).hitonfactor); if ((*pb[playerindex]).hitonfactor >= 0) { en->ForceActive(); } } } } } } return hit; }
[ "CBE7F1F65@4a173d03-4959-223b-e14c-e2eaa5fc8a8b" ]
[ [ [ 1, 735 ] ] ]
1c50080aa14511e0e3cd0ea39cd55bdb31750701
559770fbf0654bc0aecc0f8eb33843cbfb5834d9
/haina/codes/beluga/client/moblie/Beluga_manage/include/myinc.h
a1bc66468e81ac7bcb4543ba980352e836ece4bb
[]
no_license
CMGeorge/haina
21126c70c8c143ca78b576e1ddf352c3d73ad525
c68565d4bf43415c4542963cfcbd58922157c51a
refs/heads/master
2021-01-11T07:07:16.089036
2010-08-18T09:25:07
2010-08-18T09:25:07
49,005,284
1
0
null
null
null
null
UTF-8
C++
false
false
716
h
#ifndef __MYINC_H__ #define __MYINC_H__ #include <iostream> #include <tchar.h> #include <glib.h> // static void free_gstring (gpointer data, gpointer user_data) // { // g_string_free((GString*)data, TRUE); // } static void free_point_struct(gpointer data, gpointer user_data) { g_free(data); } // Exported Functions // void freeGStringArray(GPtrArray * pArray) // { // if (pArray) // { // g_ptr_array_foreach(pArray, free_gstring, NULL); // g_ptr_array_free(pArray, TRUE); // } // } void freeGPtrArray(GPtrArray * pArray) { if (pArray) { g_ptr_array_foreach(pArray, free_point_struct, NULL); g_ptr_array_free(pArray, TRUE); } } #endif /* __MYINC_H__ */
[ "dennis.wsh@6c45ac76-16e4-11de-9d52-39b120432c5d" ]
[ [ [ 1, 38 ] ] ]
2f85b898f59a22cf9f2a4d660b05bc37af437d58
102d8810abb4d1c8aecb454304ec564030bf2f64
/TP3/BattleCity/Classes/SDL_rotozoom.cpp
e46cec363d8c154dcb89310a38be3660e80acce2
[]
no_license
jfacorro/tp-taller-prog-1-fiuba
2742d775b917cc6df28188ecc1f671d812017a0a
a1c95914c3be6b1de56d828ea9ff03e982560526
refs/heads/master
2016-09-14T04:32:49.047792
2008-07-15T20:17:27
2008-07-15T20:17:27
56,912,077
0
0
null
null
null
null
UTF-8
C++
false
false
28,900
cpp
/* SDL_rotozoom.c - rotozoomer for 32bit or 8bit surfaces LGPL (c) A. Schiffler */ #ifdef WIN32 #include <windows.h> #endif #include <stdlib.h> #include <string.h> #include "SDL_rotozoom.h" #ifndef _SDL_rotozoom_cpp #define _SDL_rotozoom_cpp #define MAX(a,b) (((a) > (b)) ? (a) : (b)) /* 32bit integer-factor averaging Shrinker Shrinks 32bit RGBA/ABGR 'src' surface to 'dst' surface. */ int shrinkSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory) { int x, y, dx, dy, sgap, dgap, ra, ga, ba, aa; int n_average; tColorRGBA *sp, *osp, *oosp; tColorRGBA *dp; /* * Averaging integer shrink */ /* Precalculate division factor */ n_average = factorx*factory; /* * Scan destination */ sp = (tColorRGBA *) src->pixels; sgap = src->pitch - src->w * 4; dp = (tColorRGBA *) dst->pixels; dgap = dst->pitch - dst->w * 4; for (y = 0; y < dst->h; y++) { osp=sp; for (x = 0; x < dst->w; x++) { /* Trace out source box and accumulate */ oosp=sp; ra=ga=ba=aa=0; for (dy=0; dy < factory; dy++) { for (dx=0; dx < factorx; dx++) { ra += sp->r; ga += sp->g; ba += sp->b; aa += sp->a; sp++; } // src dx loop sp = (tColorRGBA *)((Uint8*)sp + (src->pitch - 4*factorx)); // next y } // src dy loop // next box-x sp = (tColorRGBA *)((Uint8*)oosp + 4*factorx); /* Store result in destination */ dp->r = ra/n_average; dp->g = ga/n_average; dp->b = ba/n_average; dp->a = aa/n_average; /* * Advance destination pointer */ dp++; } // dst x loop // next box-y sp = (tColorRGBA *)((Uint8*)osp + src->pitch*factory); /* * Advance destination pointers */ dp = (tColorRGBA *) ((Uint8 *) dp + dgap); } // dst y loop return (0); } /* 8bit integer-factor averaging Shrinker Shrinks 8bit Y 'src' surface to 'dst' surface. */ int shrinkSurfaceY(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory) { int x, y, dx, dy, sgap, dgap, a; int n_average; Uint8 *sp, *osp, *oosp; Uint8 *dp; /* * Averaging integer shrink */ /* Precalculate division factor */ n_average = factorx*factory; /* * Scan destination */ sp = (Uint8 *) src->pixels; sgap = src->pitch - src->w; dp = (Uint8 *) dst->pixels; dgap = dst->pitch - dst->w; for (y = 0; y < dst->h; y++) { osp=sp; for (x = 0; x < dst->w; x++) { /* Trace out source box and accumulate */ oosp=sp; a=0; for (dy=0; dy < factory; dy++) { for (dx=0; dx < factorx; dx++) { a += (*sp); sp++; // next x } // src dx loop sp = (Uint8 *)((Uint8*)sp + (src->pitch - factorx)); // next y } // src dy loop // next box-x sp = (Uint8 *)((Uint8*)oosp + factorx); /* Store result in destination */ *dp = a/n_average; /* * Advance destination pointer */ dp++; } // dst x loop // next box-y sp = (Uint8 *)((Uint8*)osp + src->pitch*factory); /* * Advance destination pointers */ dp = (Uint8 *)((Uint8 *)dp + dgap); } // dst y loop return (0); } /* 32bit Zoomer with optional anti-aliasing by bilinear interpolation. Zoomes 32bit RGBA/ABGR 'src' surface to 'dst' surface. */ int zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy, int smooth) { int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy, ex, ey, t1, t2, sstep; tColorRGBA *c00, *c01, *c10, *c11; tColorRGBA *sp, *csp, *dp; int dgap; /* * Variable setup */ if (smooth) { /* * For interpolation: assume source dimension is one pixel */ /* * smaller to avoid overflow on right and bottom edge. */ sx = (int) (65536.0 * (float) (src->w - 1) / (float) dst->w); sy = (int) (65536.0 * (float) (src->h - 1) / (float) dst->h); } else { sx = (int) (65536.0 * (float) src->w / (float) dst->w); sy = (int) (65536.0 * (float) src->h / (float) dst->h); } /* * Allocate memory for row increments */ if ((sax = (int *) malloc((dst->w + 1) * sizeof(Uint32))) == NULL) { return (-1); } if ((say = (int *) malloc((dst->h + 1) * sizeof(Uint32))) == NULL) { free(sax); return (-1); } /* * Precalculate row increments */ sp = csp = (tColorRGBA *) src->pixels; dp = (tColorRGBA *) dst->pixels; if (flipx) csp += (src->w-1); if (flipy) csp = (tColorRGBA*)( (Uint8*)csp + src->pitch*(src->h-1) ); csx = 0; csax = sax; for (x = 0; x <= dst->w; x++) { *csax = csx; csax++; csx &= 0xffff; csx += sx; } csy = 0; csay = say; for (y = 0; y <= dst->h; y++) { *csay = csy; csay++; csy &= 0xffff; csy += sy; } dgap = dst->pitch - dst->w * 4; /* * Switch between interpolating and non-interpolating code */ if (smooth) { /* * Interpolating Zoom */ /* * Scan destination */ csay = say; for (y = 0; y < dst->h; y++) { /* * Setup color source pointers */ c00 = csp; c01 = csp; c01++; c10 = (tColorRGBA *) ((Uint8 *) csp + src->pitch); c11 = c10; c11++; csax = sax; for (x = 0; x < dst->w; x++) { /* * Interpolate colors */ ex = (*csax & 0xffff); ey = (*csay & 0xffff); t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff; t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff; dp->r = (((t2 - t1) * ey) >> 16) + t1; t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff; t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff; dp->g = (((t2 - t1) * ey) >> 16) + t1; t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff; t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff; dp->b = (((t2 - t1) * ey) >> 16) + t1; t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff; t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff; dp->a = (((t2 - t1) * ey) >> 16) + t1; /* * Advance source pointers */ csax++; sstep = (*csax >> 16); c00 += sstep; c01 += sstep; c10 += sstep; c11 += sstep; /* * Advance destination pointer */ dp++; } /* * Advance source pointer */ csay++; csp = (tColorRGBA *) ((Uint8 *) csp + (*csay >> 16) * src->pitch); /* * Advance destination pointers */ dp = (tColorRGBA *) ((Uint8 *) dp + dgap); } } else { /* * Non-Interpolating Zoom */ csay = say; for (y = 0; y < dst->h; y++) { sp = csp; csax = sax; for (x = 0; x < dst->w; x++) { /* * Draw */ *dp = *sp; /* * Advance source pointers */ csax++; sstep = (*csax >> 16); if (flipx) sstep = -sstep; sp += sstep; /* * Advance destination pointer */ dp++; } /* * Advance source pointer */ csay++; sstep = (*csay >> 16) * src->pitch; if (flipy) sstep = -sstep; csp = (tColorRGBA *) ((Uint8 *) csp + sstep); /* * Advance destination pointers */ dp = (tColorRGBA *) ((Uint8 *) dp + dgap); } } /* * Remove temp arrays */ free(sax); free(say); return (0); } /* 8bit Zoomer without smoothing. Zoomes 8bit palette/Y 'src' surface to 'dst' surface. */ int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy) { Uint32 x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy; Uint8 *sp, *dp, *csp; int dgap; /* * Variable setup */ sx = (Uint32) (65536.0 * (float) src->w / (float) dst->w); sy = (Uint32) (65536.0 * (float) src->h / (float) dst->h); /* * Allocate memory for row increments */ if ((sax = (Uint32 *) malloc(dst->w * sizeof(Uint32))) == NULL) { return (-1); } if ((say = (Uint32 *) malloc(dst->h * sizeof(Uint32))) == NULL) { if (sax != NULL) { free(sax); } return (-1); } /* * Precalculate row increments */ csx = 0; csax = sax; for (x = 0; x < dst->w; x++) { csx += sx; *csax = (csx >> 16); csx &= 0xffff; csax++; } csy = 0; csay = say; for (y = 0; y < dst->h; y++) { csy += sy; *csay = (csy >> 16); csy &= 0xffff; csay++; } csx = 0; csax = sax; for (x = 0; x < dst->w; x++) { csx += (*csax); csax++; } csy = 0; csay = say; for (y = 0; y < dst->h; y++) { csy += (*csay); csay++; } /* * Pointer setup */ sp = csp = (Uint8 *) src->pixels; dp = (Uint8 *) dst->pixels; dgap = dst->pitch - dst->w; /* * Draw */ csay = say; for (y = 0; y < dst->h; y++) { csax = sax; sp = csp; for (x = 0; x < dst->w; x++) { /* * Draw */ *dp = *sp; /* * Advance source pointers */ sp += (*csax); csax++; /* * Advance destination pointer */ dp++; } /* * Advance source pointer (for row) */ csp += ((*csay) * src->pitch); csay++; /* * Advance destination pointers */ dp += dgap; } /* * Remove temp arrays */ free(sax); free(say); return (0); } /* 32bit Rotozoomer with optional anti-aliasing by bilinear interpolation. Rotates and zoomes 32bit RGBA/ABGR 'src' surface to 'dst' surface. */ void transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth) { int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh; tColorRGBA c00, c01, c10, c11; tColorRGBA *pc, *sp; int gap; /* * Variable setup */ xd = ((src->w - dst->w) << 15); yd = ((src->h - dst->h) << 15); ax = (cx << 16) - (icos * cx); ay = (cy << 16) - (isin * cx); sw = src->w - 1; sh = src->h - 1; pc = (tColorRGBA *)dst->pixels; gap = dst->pitch - dst->w * 4; /* * Switch between interpolating and non-interpolating code */ if (smooth) { for (y = 0; y < dst->h; y++) { dy = cy - y; sdx = (ax + (isin * dy)) + xd; sdy = (ay - (icos * dy)) + yd; for (x = 0; x < dst->w; x++) { dx = (sdx >> 16); dy = (sdy >> 16); if ((dx >= -1) && (dy >= -1) && (dx < src->w) && (dy < src->h)) { if ((dx >= 0) && (dy >= 0) && (dx < sw) && (dy < sh)) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy); sp += dx; c00 = *sp; sp += 1; c01 = *sp; sp = (tColorRGBA *) ((Uint8 *) sp + src->pitch); sp -= 1; c10 = *sp; sp += 1; c11 = *sp; } else if ((dx == sw) && (dy == sh)) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy); sp += dx; c00 = *sp; c01 = *sp; c10 = *sp; c11 = *sp; } else if ((dx == -1) && (dy == -1)) { sp = (tColorRGBA *) (src->pixels); c00 = *sp; c01 = *sp; c10 = *sp; c11 = *sp; } else if ((dx == -1) && (dy == sh)) { sp = (tColorRGBA *) (src->pixels); sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy); c00 = *sp; c01 = *sp; c10 = *sp; c11 = *sp; } else if ((dx == sw) && (dy == -1)) { sp = (tColorRGBA *) (src->pixels); sp += dx; c00 = *sp; c01 = *sp; c10 = *sp; c11 = *sp; } else if (dx == -1) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy); c00 = *sp; c01 = *sp; c10 = *sp; sp = (tColorRGBA *) ((Uint8 *) sp + src->pitch); c11 = *sp; } else if (dy == -1) { sp = (tColorRGBA *) (src->pixels); sp += dx; c00 = *sp; c01 = *sp; c10 = *sp; sp += 1; c11 = *sp; } else if (dx == sw) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy); sp += dx; c00 = *sp; c01 = *sp; sp = (tColorRGBA *) ((Uint8 *) sp + src->pitch); c10 = *sp; c11 = *sp; } else if (dy == sh) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy); sp += dx; c00 = *sp; sp += 1; c01 = *sp; c10 = *sp; c11 = *sp; } /* * Interpolate colors */ ex = (sdx & 0xffff); ey = (sdy & 0xffff); t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff; t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff; pc->r = (((t2 - t1) * ey) >> 16) + t1; t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff; t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff; pc->g = (((t2 - t1) * ey) >> 16) + t1; t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff; t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff; pc->b = (((t2 - t1) * ey) >> 16) + t1; t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff; t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff; pc->a = (((t2 - t1) * ey) >> 16) + t1; } sdx += icos; sdy += isin; pc++; } pc = (tColorRGBA *) ((Uint8 *) pc + gap); } } else { for (y = 0; y < dst->h; y++) { dy = cy - y; sdx = (ax + (isin * dy)) + xd; sdy = (ay - (icos * dy)) + yd; for (x = 0; x < dst->w; x++) { dx = (short) (sdx >> 16); dy = (short) (sdy >> 16); if (flipx) dx = (src->w-1)-dx; if (flipy) dy = (src->h-1)-dy; if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy); sp += dx; *pc = *sp; } sdx += icos; sdy += isin; pc++; } pc = (tColorRGBA *) ((Uint8 *) pc + gap); } } } /* 8bit Rotozoomer without smoothing Rotates and zoomes 8bit palette/Y 'src' surface to 'dst' surface. */ void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos) { int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh; tColorY *pc, *sp; int gap; /* * Variable setup */ xd = ((src->w - dst->w) << 15); yd = ((src->h - dst->h) << 15); ax = (cx << 16) - (icos * cx); ay = (cy << 16) - (isin * cx); sw = src->w - 1; sh = src->h - 1; pc = (tColorY *)dst->pixels; gap = dst->pitch - dst->w; /* * Clear surface to colorkey */ memset(pc, (unsigned char) (src->format->colorkey & 0xff), dst->pitch * dst->h); /* * Iterate through destination surface */ for (y = 0; y < dst->h; y++) { dy = cy - y; sdx = (ax + (isin * dy)) + xd; sdy = (ay - (icos * dy)) + yd; for (x = 0; x < dst->w; x++) { dx = (short) (sdx >> 16); dy = (short) (sdy >> 16); if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) { sp = (tColorY *) (src->pixels); sp += (src->pitch * dy + dx); *pc = *sp; } sdx += icos; sdy += isin; pc++; } pc += gap; } } /* rotozoomSurface() Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1 then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. */ #define VALUE_LIMIT 0.001 /* Local rotozoom-size function with trig result return */ void rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight, double *canglezoom, double *sanglezoom) { double x, y, cx, cy, sx, sy; double radangle; int dstwidthhalf, dstheighthalf; /* * Determine destination width and height by rotating a centered source box */ radangle = angle * (M_PI / 180.0); *sanglezoom = sin(radangle); *canglezoom = cos(radangle); *sanglezoom *= zoomx; *canglezoom *= zoomx; x = width / 2; y = height / 2; cx = *canglezoom * x; cy = *canglezoom * y; sx = *sanglezoom * x; sy = *sanglezoom * y; dstwidthhalf = MAX((int) ceil(MAX(MAX(MAX(fabs(cx + sy), fabs(cx - sy)), fabs(-cx + sy)), fabs(-cx - sy))), 1); dstheighthalf = MAX((int) ceil(MAX(MAX(MAX(fabs(sx + cy), fabs(sx - cy)), fabs(-sx + cy)), fabs(-sx - cy))), 1); *dstwidth = 2 * dstwidthhalf; *dstheight = 2 * dstheighthalf; } /* Publically available rotozoom-size function */ void rotozoomSurfaceSizeXY(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight) { double dummy_sanglezoom, dummy_canglezoom; rotozoomSurfaceSizeTrig(width, height, angle, zoomx, zoomy, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom); } /* Publically available rotozoom-size function */ void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight) { double dummy_sanglezoom, dummy_canglezoom; rotozoomSurfaceSizeTrig(width, height, angle, zoom, zoom, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom); } /* Publically available rotozoom function */ SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth) { return rotozoomSurfaceXY(src, angle, zoom, zoom, smooth); } /* Publically available rotozoom function */ SDL_Surface *rotozoomSurfaceXY(SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth) { SDL_Surface *rz_src; SDL_Surface *rz_dst; double zoominv; double sanglezoom, canglezoom, sanglezoominv, canglezoominv; int dstwidthhalf, dstwidth, dstheighthalf, dstheight; int is32bit; int i, src_converted; int flipx,flipy; /* * Sanity check */ if (src == NULL) return (NULL); /* * Determine if source surface is 32bit or 8bit */ is32bit = (src->format->BitsPerPixel == 32); if ((is32bit) || (src->format->BitsPerPixel == 8)) { /* * Use source surface 'as is' */ rz_src = src; src_converted = 0; } else { /* * New source surface is 32bit with a defined RGBA ordering */ rz_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); SDL_BlitSurface(src, NULL, rz_src, NULL); src_converted = 1; is32bit = 1; } /* * Sanity check zoom factor */ flipx = (zoomx<0); if (flipx) zoomx=-zoomx; flipy = (zoomy<0); if (flipy) zoomy=-zoomy; if (zoomx < VALUE_LIMIT) zoomx = VALUE_LIMIT; if (zoomy < VALUE_LIMIT) zoomy = VALUE_LIMIT; zoominv = 65536.0 / (zoomx * zoomx); /* * Check if we have a rotozoom or just a zoom */ if (fabs(angle) > VALUE_LIMIT) { /* * Angle!=0: full rotozoom */ /* * ----------------------- */ /* Determine target size */ rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, zoomx, zoomy, &dstwidth, &dstheight, &canglezoom, &sanglezoom); /* * Calculate target factors from sin/cos and zoom */ sanglezoominv = sanglezoom; canglezoominv = canglezoom; sanglezoominv *= zoominv; canglezoominv *= zoominv; /* Calculate half size */ dstwidthhalf = dstwidth / 2; dstheighthalf = dstheight / 2; /* * Alloc space to completely contain the rotated surface */ rz_dst = NULL; if (is32bit) { /* * Target surface is 32bit with source RGBA/ABGR ordering */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 32, rz_src->format->Rmask, rz_src->format->Gmask, rz_src->format->Bmask, rz_src->format->Amask); } else { /* * Target surface is 8bit */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 8, 0, 0, 0, 0); } /* * Lock source surface */ SDL_LockSurface(rz_src); /* * Check which kind of surface we have */ if (is32bit) { /* * Call the 32bit transformation routine to do the rotation (using alpha) */ transformSurfaceRGBA(rz_src, rz_dst, dstwidthhalf, dstheighthalf, (int) (sanglezoominv), (int) (canglezoominv), flipx, flipy, smooth); /* * Turn on source-alpha support */ SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); } else { /* * Copy palette and colorkey info */ for (i = 0; i < rz_src->format->palette->ncolors; i++) { rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i]; } rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors; /* * Call the 8bit transformation routine to do the rotation */ transformSurfaceY(rz_src, rz_dst, dstwidthhalf, dstheighthalf, (int) (sanglezoominv), (int) (canglezoominv)); SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, rz_src->format->colorkey); } /* * Unlock source surface */ SDL_UnlockSurface(rz_src); } else { /* * Angle=0: Just a zoom */ /* * -------------------- */ /* * Calculate target size */ zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight); /* * Alloc space to completely contain the zoomed surface */ rz_dst = NULL; if (is32bit) { /* * Target surface is 32bit with source RGBA/ABGR ordering */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 32, rz_src->format->Rmask, rz_src->format->Gmask, rz_src->format->Bmask, rz_src->format->Amask); } else { /* * Target surface is 8bit */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 8, 0, 0, 0, 0); } /* * Lock source surface */ SDL_LockSurface(rz_src); /* * Check which kind of surface we have */ if (is32bit) { /* * Call the 32bit transformation routine to do the zooming (using alpha) */ zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth); /* * Turn on source-alpha support */ SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); } else { /* * Copy palette and colorkey info */ for (i = 0; i < rz_src->format->palette->ncolors; i++) { rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i]; } rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors; /* * Call the 8bit transformation routine to do the zooming */ zoomSurfaceY(rz_src, rz_dst, flipx, flipy); SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, rz_src->format->colorkey); } /* * Unlock source surface */ SDL_UnlockSurface(rz_src); } /* * Cleanup temp surface */ if (src_converted) { SDL_FreeSurface(rz_src); } /* * Return destination surface */ return (rz_dst); } /* zoomSurface() Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1 then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. */ #define VALUE_LIMIT 0.001 void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight) { /* * Sanity check zoom factors */ if (zoomx < VALUE_LIMIT) { zoomx = VALUE_LIMIT; } if (zoomy < VALUE_LIMIT) { zoomy = VALUE_LIMIT; } /* * Calculate target size */ *dstwidth = (int) ((double) width * zoomx); *dstheight = (int) ((double) height * zoomy); if (*dstwidth < 1) { *dstwidth = 1; } if (*dstheight < 1) { *dstheight = 1; } } SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth) { SDL_Surface *rz_src; SDL_Surface *rz_dst; int dstwidth, dstheight; int is32bit; int i, src_converted; int flipx, flipy; /* * Sanity check */ if (src == NULL) return (NULL); /* * Determine if source surface is 32bit or 8bit */ is32bit = (src->format->BitsPerPixel == 32); if ((is32bit) || (src->format->BitsPerPixel == 8)) { /* * Use source surface 'as is' */ rz_src = src; src_converted = 0; } else { /* * New source surface is 32bit with a defined RGBA ordering */ rz_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); SDL_BlitSurface(src, NULL, rz_src, NULL); src_converted = 1; is32bit = 1; } flipx = (zoomx<0); if (flipx) zoomx = -zoomx; flipy = (zoomy<0); if (flipy) zoomy = -zoomy; /* Get size if target */ zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight); /* * Alloc space to completely contain the zoomed surface */ rz_dst = NULL; if (is32bit) { /* * Target surface is 32bit with source RGBA/ABGR ordering */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 32, rz_src->format->Rmask, rz_src->format->Gmask, rz_src->format->Bmask, rz_src->format->Amask); } else { /* * Target surface is 8bit */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 8, 0, 0, 0, 0); } /* * Lock source surface */ SDL_LockSurface(rz_src); /* * Check which kind of surface we have */ if (is32bit) { /* * Call the 32bit transformation routine to do the zooming (using alpha) */ zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth); /* * Turn on source-alpha support */ SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); } else { /* * Copy palette and colorkey info */ for (i = 0; i < rz_src->format->palette->ncolors; i++) { rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i]; } rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors; /* * Call the 8bit transformation routine to do the zooming */ zoomSurfaceY(rz_src, rz_dst, flipx, flipy); SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, rz_src->format->colorkey); } /* * Unlock source surface */ SDL_UnlockSurface(rz_src); /* * Cleanup temp surface */ if (src_converted) { SDL_FreeSurface(rz_src); } /* * Return destination surface */ return (rz_dst); } SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory) { SDL_Surface *rz_src; SDL_Surface *rz_dst; int dstwidth, dstheight; int is32bit; int i, src_converted; /* * Sanity check */ if (src == NULL) return (NULL); /* * Determine if source surface is 32bit or 8bit */ is32bit = (src->format->BitsPerPixel == 32); if ((is32bit) || (src->format->BitsPerPixel == 8)) { /* * Use source surface 'as is' */ rz_src = src; src_converted = 0; } else { /* * New source surface is 32bit with a defined RGBA ordering */ rz_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); SDL_BlitSurface(src, NULL, rz_src, NULL); src_converted = 1; is32bit = 1; } /* Get size for target */ dstwidth=rz_src->w/factorx; while (dstwidth*factorx>rz_src->w) { dstwidth--; } dstheight=rz_src->h/factory; while (dstheight*factory>rz_src->h) { dstheight--; } /* * Alloc space to completely contain the shrunken surface */ rz_dst = NULL; if (is32bit) { /* * Target surface is 32bit with source RGBA/ABGR ordering */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 32, rz_src->format->Rmask, rz_src->format->Gmask, rz_src->format->Bmask, rz_src->format->Amask); } else { /* * Target surface is 8bit */ rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight, 8, 0, 0, 0, 0); } /* * Lock source surface */ SDL_LockSurface(rz_src); /* * Check which kind of surface we have */ if (is32bit) { /* * Call the 32bit transformation routine to do the shrinking (using alpha) */ shrinkSurfaceRGBA(rz_src, rz_dst, factorx, factory); /* * Turn on source-alpha support */ SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); } else { /* * Copy palette and colorkey info */ for (i = 0; i < rz_src->format->palette->ncolors; i++) { rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i]; } rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors; /* * Call the 8bit transformation routine to do the shrinking */ shrinkSurfaceY(rz_src, rz_dst, factorx, factory); SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, rz_src->format->colorkey); } /* * Unlock source surface */ SDL_UnlockSurface(rz_src); /* * Cleanup temp surface */ if (src_converted) { SDL_FreeSurface(rz_src); } /* * Return destination surface */ return (rz_dst); } #endif
[ "juan.facorro@6dff32cf-8f48-0410-9a2e-7b8b34aa6dfb" ]
[ [ [ 1, 1235 ] ] ]
a0c6d317a05f33480f31ec8c33b99af558e4bc81
c9390a163ae5f0bc6fdc1560be59939dcbe3eb07
/skinslider/ZipBitmap.cpp
86d45b5748b900057537c6e8cbefcd1f469d3b31
[]
no_license
trimpage/multifxvst
2ceae9da1768428288158319fcf03d603ba47672
1cb40f8e0cc873f389f2818b2f40665d2ba2b18b
refs/heads/master
2020-04-06T13:23:41.059632
2010-11-04T14:32:54
2010-11-04T14:32:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,100
cpp
// ZipBitmap.cpp : implementation file // #include "stdafx.h" #include "ZipBitmap.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif COLORREF rgbWhite = RGB(255,255,255); ///////////////////////////////////////////////////////////////////////////// // CZipBitmap CZipBitmap::CZipBitmap() { m_iWidth = 0; m_iHeight = 0; } CZipBitmap::~CZipBitmap() { } void CZipBitmap::GetMetrics() { // Get the width and height BITMAP bm; GetObject(sizeof(bm), &bm); m_iWidth = bm.bmWidth; m_iHeight = bm.bmHeight; } int CZipBitmap::GetWidth() { if (!m_iWidth) GetMetrics(); return m_iWidth; } int CZipBitmap::GetHeight() { if (!m_iHeight) GetMetrics(); return m_iHeight; } CZipTransBitmap::CZipTransBitmap() { m_hbmMask = NULL; } CZipTransBitmap::~CZipTransBitmap() { if (m_hbmMask) ::DeleteObject(m_hbmMask); } void CZipTransBitmap::CreateMask(UINT uiTickImage, COLORREF colTrans) { LoadBitmap(uiTickImage); // Create a monochrome bitmap for the mask m_hbmMask = ::CreateBitmap(GetWidth(), GetHeight(), 1, 1, NULL); // Create memory DCs to work with HDC hdcMask = ::CreateCompatibleDC(NULL); HBITMAP hbmOldMask = (HBITMAP)::SelectObject(hdcMask, m_hbmMask); HDC hdcImage = ::CreateCompatibleDC(NULL); HBITMAP hbmOldImage = (HBITMAP)::SelectObject(hdcImage, m_hObject); if (colTrans == -1) colTrans = ::GetPixel(hdcImage, 0, 0); // Set the transparency color to be the top-left pixel // Make the mask ::SetBkColor(hdcImage,colTrans); ::BitBlt(hdcMask, 0, 0, GetWidth(), GetHeight(), hdcImage, 0, 0, SRCCOPY); // Apply the mask to the image ::BitBlt(hdcImage, 0, 0, GetWidth(), GetHeight(), hdcMask, 0, 0, SRCINVERT); // Tidy up ::SelectObject(hdcMask, hbmOldMask); ::SelectObject(hdcImage, hbmOldImage); ::DeleteDC(hdcMask); ::DeleteDC(hdcImage); } void CZipTransBitmap::DrawTrans(HDC ScreenDC, int x, int y) { int dx = GetWidth(); int dy = GetHeight(); // Create a memory DC to which to draw HDC hdcOffScr = ::CreateCompatibleDC(NULL); // AND the destination with the mask HBITMAP hbmOldImage = (HBITMAP)::SelectObject(hdcOffScr, m_hbmMask); ::BitBlt(ScreenDC, x, y, dx, dy, hdcOffScr, 0, 0, SRCAND); // XOR the destination with the masked tick image ::SelectObject(hdcOffScr, m_hObject); ::BitBlt(ScreenDC, x, y, dx, dy, hdcOffScr, 0, 0, SRCINVERT); // Tidy up ::SelectObject(hdcOffScr, hbmOldImage); ::DeleteDC(hdcOffScr); } CZipBackGroundBitmap::CZipBackGroundBitmap() { hDC = NULL; } CZipBackGroundBitmap::~CZipBackGroundBitmap() { if (hDC) { ::SelectObject(hDC, hbmold); ::DeleteDC(hDC); } } void CZipBackGroundBitmap::CreateBackBitmap(CRect& Area, int uiBackGround, int Options, int TickWidth, int TickHeight) { // Clear background hDC = ::CreateCompatibleDC(NULL); CreateBitmap(Area.Width(), Area.Height(), 1, ::GetDeviceCaps(hDC, BITSPIXEL), NULL); hbmold = (HBITMAP)::SelectObject(hDC, (HBITMAP)(m_hObject)); HBRUSH hBR = CreateSolidBrush(GetSysColor(COLOR_3DFACE)); ::FillRect(hDC, Area, hBR); ::DeleteObject(hBR); // Copy Background picture if (uiBackGround) { CZipBitmap Pic; Pic.LoadBitmap(uiBackGround); HDC hdcMem = ::CreateCompatibleDC(NULL); HBITMAP hbmold = (HBITMAP)::SelectObject(hdcMem, (HBITMAP)(Pic.m_hObject)); int Left, Top; Left = Top = 0; if (Options & BG_CENTER) { Left = (GetWidth() - Pic.GetWidth()) / 2; Top = (GetHeight() - Pic.GetHeight()) / 2; } else if (Options & BG_CENTER_ONTICK) { Left = (GetWidth() - Pic.GetWidth()) / 2; Top = (TickHeight - Pic.GetHeight()) / 2; } else if (Options & BG_CENTER_ONTICK_VERT) { Left = (TickWidth - Pic.GetWidth()) / 2; Top = (GetHeight() - Pic.GetHeight()) / 2; } if (Options & BG_STARTATICK) { Left = iMarginWidth - TickWidth / 2; } if (Options & BG_STARTATICK_VERT) { Top = iMarginWidth - TickHeight / 2; } // Blt the bits if (Options & BG_STRETCH_HOR) { int SpreadWidth = Area.Width(); if (Options & BG_STARTATICK) SpreadWidth -= Left * 2; ::StretchBlt(hDC, Left, Top, SpreadWidth, Pic.GetHeight(), hdcMem, 0, 0, Pic.GetWidth(), Pic.GetHeight(), SRCCOPY); } else if (Options & BG_STRETCH_VERT) { int SpreadHeight = Area.Height(); if (Options & BG_STARTATICK_VERT) SpreadHeight -= Top * 2; ::StretchBlt(hDC, Left, Top, Pic.GetWidth(), SpreadHeight, hdcMem, 0, 0, Pic.GetWidth(), Pic.GetHeight(), SRCCOPY); } else ::BitBlt(hDC, Left, Top, Pic.GetWidth(), Pic.GetHeight(), hdcMem, 0, 0, SRCCOPY); ::SelectObject(hdcMem, hbmold); ::DeleteDC(hdcMem); } } void CZipBackGroundBitmap::DrawBackGround(HDC ScreenDC, const CRect& Area) { ::BitBlt(ScreenDC, Area.left, Area.top, Area.Width(), Area.Height(), hDC, Area.left, Area.top, SRCCOPY); }
[ "CTAF@3e78e570-a0aa-6544-9a6b-7e87a0c009bc" ]
[ [ [ 1, 201 ] ] ]
5c55f3b540565f530dd07a9e558d74ec3c3e0e8c
c02cb25416f1f32b1264792c256bc8e9ddb36463
/CIFS.h
7c96d53c87e0ec3a1f4f8c1455ee7d86743c78dc
[]
no_license
tronster/node
230b60095202c9e8c7459c570d1d6b1689730786
ea14fc32bbbadf24549f693b3cd52b7423fc4365
refs/heads/master
2016-09-05T22:32:32.820092
2011-07-12T23:29:48
2011-07-12T23:29:48
2,039,073
0
0
null
null
null
null
UTF-8
C++
false
false
4,902
h
#include "geometry3d.h" #include <set> // // Class to hold information for an IFS recursive step // class IFSStep { public: geoGL::fVector2D point; int recurse; int rot; }; // // Class to store a line segment // class IFSLine { public: geoGL::fVector2D start,end; int nDepth; bool closeTo(const IFSLine &rhs) const; }; // // STL binary_function for ordering Lines by depth // template<class IFSLine> struct DepthLess : public std::binary_function<IFSLine, IFSLine, bool> { inline bool operator()(const IFSLine& lhs, const IFSLine& rhs) const { return (lhs.nDepth < rhs.nDepth); } }; // // STL binary_function for ordering Lines by coordinate position // template<class IFSLine> struct CoordLess : public std::binary_function<IFSLine, IFSLine, bool> { bool operator ()(const IFSLine &lhs, const IFSLine &rhs) const; }; // Shortcuts for various line sets used in IFS class typedef std::multiset<IFSLine, CoordLess<IFSLine> > line_Set; typedef std::multiset<IFSLine, DepthLess<IFSLine> > lineDepth_Set; typedef line_Set::iterator line_SetIT; typedef lineDepth_Set::iterator lineDepth_SetIT; // // IFS fractals - converted from Turbo Pascal 6.0/DOS // class CIFS { private: #define nTABLESIZE 360 // Size of sine/cosine tables #define fSKIPVALUE (2.0f*PI/nTABLESIZE) #define nCOLORSIZE 16 static int sinTable[nTABLESIZE]; // sine/cosine tables for speed static int cosTable[nTABLESIZE]; static bool bTableCreated; static int nPruningLevel; // Working arrays during point generation // These are cleared after CopyToArrays() line_Set lineSet; geoGL::fVector2D lineStart,lineEnd; // Currently drawn line // Final arrays after pruning and output // These are filled after CopyToArrays() int nPoints, nColors; // Number of points, colors refptr<geoGL::fVector2D> pPoints; refptr<int> pDepths; // Indices of points at particular depths // Parameters describing the fractal tree int numPoints, // Number of IFS steps maxDepth, // Iteration depth scale, // Scaling information depthScale, // Computed scale relative to depth shade, // Color shading divisor (why?) currDepth, currPts; // Current depth, Current save point geoGL::fRGBA pColors[nCOLORSIZE]; // Simple color table for fractal refptr<IFSStep> points; // steps for generating fractal // Create sin/cos tables static void createTable(); // Rotate a point in 2D space void rot2D(int rot, geoGL::fVector2D in, geoGL::fVector2D &p); // Main recursive rendering phase void render(geoGL::fVector2D p, int rot); // Virtual turtle drawing functions that draw to arrays void moveTo(geoGL::fVector2D d); void lineTo(geoGL::fVector2D d); public: CIFS(); ~CIFS(); // Initialize IFS fractal parameters void init(int nDepth, int nScale, int nShade, int nPoints, geoGL::fVector2D startPos); // Clear everything, including the finalized output void clear(); // Place color gradient into table void colorGradient(float r1, float g1, float b1, float r2, float g2, float b2, int start, int stop); // Setup point n for fractal design void setPoint (int n, geoGL::fVector2D p, int nRecursionLevel, int nRotation); // Get/Set pruning level (5 is default, higher is less detail) static void setPruning(int nNewPruning) { nPruningLevel = nNewPruning; } static inline int getPruning() { return nPruningLevel; } // Begin rendering fractal at specific angle void render(int rot=0); // Post-process rendering output void prune(); void copyToArrays(); // Accessors to finalized output inline int getNumPoints() const { return nPoints; } inline const refptr<geoGL::fVector2D> & getPoints() const { return pPoints; } inline const refptr<int> & getDepthIndices() const { return pDepths; } inline int getMaxDepth() const { return maxDepth; } inline const geoGL::fRGBA * getColors() const { return pColors; } };
[ [ [ 1, 133 ] ] ]
d4b102406bb146122fcc4fa99d11b5fd7af5f7a8
04fec4cbb69789d44717aace6c8c5490f2cdfa47
/include/wx/accel.h
05c6f6c7d3ce167ad63897405418a7eb897c9146
[]
no_license
aaryanapps/whiteTiger
04f39b00946376c273bcbd323414f0a0b675d49d
65ed8ffd530f20198280b8a9ea79cb22a6a47acd
refs/heads/master
2021-01-17T12:07:15.264788
2010-10-11T20:20:26
2010-10-11T20:20:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,468
h
/////////////////////////////////////////////////////////////////////////////// // Name: wx/accel.h // Purpose: wxAcceleratorEntry and wxAcceleratorTable classes // Author: Julian Smart, Robert Roebling, Vadim Zeitlin // Modified by: // Created: 31.05.01 (extracted from other files) // RCS-ID: $Id: accel.h 49563 2007-10-31 20:46:21Z VZ $ // Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_ACCEL_H_BASE_ #define _WX_ACCEL_H_BASE_ #include "wx/defs.h" #if wxUSE_ACCEL #include "wx/object.h" class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable; class WXDLLIMPEXP_FWD_CORE wxMenuItem; class WXDLLIMPEXP_FWD_CORE wxKeyEvent; // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // wxAcceleratorEntry flags enum { wxACCEL_NORMAL = 0x0000, // no modifiers wxACCEL_ALT = 0x0001, // hold Alt key down wxACCEL_CTRL = 0x0002, // hold Ctrl key down wxACCEL_SHIFT = 0x0004, // hold Shift key down #if defined(__WXMAC__) || defined(__WXCOCOA__) wxACCEL_CMD = 0x0008 // Command key on OS X #else wxACCEL_CMD = wxACCEL_CTRL #endif }; // ---------------------------------------------------------------------------- // an entry in wxAcceleratorTable corresponds to one accelerator // ---------------------------------------------------------------------------- class WXDLLEXPORT wxAcceleratorEntry { public: wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, wxMenuItem *item = NULL) : m_flags(flags) , m_keyCode(keyCode) , m_command(cmd) , m_item(item) { } wxAcceleratorEntry(const wxAcceleratorEntry& entry) : m_flags(entry.m_flags) , m_keyCode(entry.m_keyCode) , m_command(entry.m_command) , m_item(entry.m_item) { } // create accelerator corresponding to the specified string, return NULL if // string couldn't be parsed or a pointer to be deleted by the caller static wxAcceleratorEntry *Create(const wxString& str); wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry) { Set(entry.m_flags, entry.m_keyCode, entry.m_command, entry.m_item); return *this; } void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL) { m_flags = flags; m_keyCode = keyCode; m_command = cmd; m_item = item; } void SetMenuItem(wxMenuItem *item) { m_item = item; } int GetFlags() const { return m_flags; } int GetKeyCode() const { return m_keyCode; } int GetCommand() const { return m_command; } wxMenuItem *GetMenuItem() const { return m_item; } bool operator==(const wxAcceleratorEntry& entry) const { return m_flags == entry.m_flags && m_keyCode == entry.m_keyCode && m_command == entry.m_command && m_item == entry.m_item; } bool operator!=(const wxAcceleratorEntry& entry) const { return !(*this == entry); } #if defined(__WXMOTIF__) // Implementation use only bool MatchesEvent(const wxKeyEvent& event) const; #endif bool IsOk() const { return m_flags != 0 && m_keyCode != 0; } // string <-> wxAcceleratorEntry conversion // ---------------------------------------- // returns a wxString for the this accelerator. // this function formats it using the <flags>-<keycode> format // where <flags> maybe a hyphen-separed list of "shift|alt|ctrl" wxString ToString() const; // returns true if the given string correctly initialized this object // (i.e. if IsOk() returns true after this call) bool FromString(const wxString& str); private: // common part of Create() and FromString() static bool ParseAccel(const wxString& str, int *flags, int *keycode); int m_flags; // combination of wxACCEL_XXX constants int m_keyCode; // ASCII or virtual keycode int m_command; // Command id to generate // the menu item this entry corresponds to, may be NULL wxMenuItem *m_item; // for compatibility with old code, use accessors now! friend class WXDLLEXPORT wxMenu; }; // ---------------------------------------------------------------------------- // include wxAcceleratorTable class declaration, it is only used by the library // and so doesn't have any published user visible interface // ---------------------------------------------------------------------------- #if defined(__WXUNIVERSAL__) #include "wx/generic/accel.h" #elif defined(__WXMSW__) #include "wx/msw/accel.h" #elif defined(__WXMOTIF__) #include "wx/motif/accel.h" #elif defined(__WXGTK20__) #include "wx/gtk/accel.h" #elif defined(__WXGTK__) #include "wx/gtk1/accel.h" #elif defined(__WXMAC__) #include "wx/mac/accel.h" #elif defined(__WXCOCOA__) #include "wx/generic/accel.h" #elif defined(__WXPM__) #include "wx/os2/accel.h" #endif extern WXDLLEXPORT_DATA(wxAcceleratorTable) wxNullAcceleratorTable; #endif // wxUSE_ACCEL #endif // _WX_ACCEL_H_BASE_
[ [ [ 1, 171 ] ] ]
596e4ace3ffde1bd6edb7842d5984ed1723ee416
c95a83e1a741b8c0eb810dd018d91060e5872dd8
/Game/ObjectDLL/ObjectShared/ScaleSprite.cpp
91d812fc4156d330396dd4744af60ad51a7c9f96
[]
no_license
rickyharis39/nolf2
ba0b56e2abb076e60d97fc7a2a8ee7be4394266c
0da0603dc961e73ac734ff365bfbfb8abb9b9b04
refs/heads/master
2021-01-01T17:21:00.678517
2011-07-23T12:11:19
2011-07-23T12:11:19
38,495,312
1
0
null
null
null
null
UTF-8
C++
false
false
13,944
cpp
// ----------------------------------------------------------------------- // // // MODULE : ScaleSprite.cpp // // PURPOSE : ScaleSprite class - implementation // // CREATED : 12/07/97 // // ----------------------------------------------------------------------- // #include "stdafx.h" #include "ScaleSprite.h" #include "iltserver.h" #include "ObjectMsgs.h" #include "ParsedMsg.h" #include "SFXFuncs.h" LINKFROM_MODULE( ScaleSprite ); #pragma force_active on BEGIN_CLASS(ScaleSprite) ADD_DESTRUCTIBLE_AGGREGATE(PF_GROUP(1), 0) ADD_BOOLPROP_FLAG(StartOn, LTTRUE, 0) ADD_STRINGPROP_FLAG(Filename, "", PF_FILENAME) ADD_STRINGPROP_FLAG(DamagedFilename, "", PF_FILENAME) ADD_STRINGPROP_FLAG(DestroyedFilename, "", PF_FILENAME) ADD_VECTORPROP_VAL_FLAG(Dims, 20.0f, 20.0f, 1.0f, PF_DIMS | PF_LOCALDIMS) ADD_COLORPROP(Color, 255.0f, 255.0f, 255.0f) ADD_REALPROP(Alpha, 1.0f) ADD_REALPROP(ScaleX, 0.5f) ADD_REALPROP(ScaleY, 0.5f) PROP_DEFINEGROUP(AdditionalFlags, PF_GROUP(2)) ADD_BOOLPROP_FLAG(FlushWithWorld, LTFALSE, PF_GROUP(2)) ADD_BOOLPROP_FLAG(Rotatable, LTFALSE, PF_GROUP(2)) ADD_BOOLPROP_FLAG(Glow, LTTRUE, PF_GROUP(2)) ADD_BOOLPROP_FLAG(ZBias, LTTRUE, PF_GROUP(2)) ADD_BOOLPROP_FLAG(Additive, LTTRUE, PF_GROUP(2)) ADD_BOOLPROP_FLAG(Multiply, LTFALSE, PF_GROUP(2)) ADD_LENSFLARE_PROPERTIES(PF_GROUP(3)) END_CLASS_DEFAULT_FLAGS_PLUGIN(ScaleSprite, GameBase, NULL, NULL, 0, CScaleSpritePlugin) #pragma force_active off CMDMGR_BEGIN_REGISTER_CLASS( ScaleSprite ) CMDMGR_ADD_MSG( DESTROY, 1, NULL, "DESTROY" ) CMDMGR_ADD_MSG( DAMAGE, 1, NULL, "DAMAGE" ) CMDMGR_ADD_MSG( ON, 1, NULL, "ON" ) CMDMGR_ADD_MSG( OFF, 1, NULL, "OFF" ) CMDMGR_END_REGISTER_CLASS( ScaleSprite, GameBase ) // ----------------------------------------------------------------------- // // // ROUTINE: CScaleSpritePlugin::PreHook_PropChanged // // PURPOSE: Test any commands we might have // // ----------------------------------------------------------------------- // LTRESULT CScaleSpritePlugin::PreHook_PropChanged( const char *szObjName, const char *szPropName, const int nPropType, const GenericProp &gpPropValue, ILTPreInterface *pInterface, const char *szModifiers ) { // Since we don't have any props that need notification, just pass it to the Destructible plugin... if( LT_OK == m_DestructiblePlugin.PreHook_PropChanged( szObjName, szPropName, nPropType, gpPropValue, pInterface, szModifiers )) { return LT_OK; } return LT_UNSUPPORTED; } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::ScaleSprite // // PURPOSE: Initialize // // ----------------------------------------------------------------------- // ScaleSprite::ScaleSprite() : GameBase(OT_SPRITE) { VEC_SET(m_vScale, 1.0f, 1.0f, 1.0f); VEC_SET(m_vColor, 1.0f, 1.0f, 1.0f); m_fAlpha = 1.0f; m_bFlushWithWorld = LTFALSE; m_bRotatable = LTFALSE; m_bStartOn = LTTRUE; m_dwAdditionalFlags = 0; m_hstrDamagedFile = LTNULL; m_hstrDestroyedFile = LTNULL; } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::~ScaleSprite // // PURPOSE: Destructor // // ----------------------------------------------------------------------- // ScaleSprite::~ScaleSprite() { if (m_hstrDestroyedFile) { g_pLTServer->FreeString(m_hstrDestroyedFile); } if (m_hstrDamagedFile) { g_pLTServer->FreeString(m_hstrDamagedFile); } } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::EngineMessageFn // // PURPOSE: Handle engine messages // // ----------------------------------------------------------------------- // uint32 ScaleSprite::EngineMessageFn(uint32 messageID, void *pData, LTFLOAT fData) { uint32 dwRet; switch(messageID) { case MID_PRECREATE: { dwRet = GameBase::EngineMessageFn(messageID, pData, fData); if (fData == PRECREATE_WORLDFILE || fData == PRECREATE_STRINGPROP) { ReadProp((ObjectCreateStruct *)pData); PostPropRead((ObjectCreateStruct *)pData); } return dwRet; } break; case MID_UPDATE: { Update(); } break; case MID_INITIALUPDATE: { if (fData != INITIALUPDATE_SAVEGAME) { InitialUpdate(); } } break; case MID_SAVEOBJECT: { Save((ILTMessage_Write*)pData, (uint32)fData); } break; case MID_LOADOBJECT: { Load((ILTMessage_Read*)pData, (uint32)fData); } break; default : break; } return GameBase::EngineMessageFn(messageID, pData, fData); } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::OnTrigger // // PURPOSE: Handle trigger messages // // ----------------------------------------------------------------------- // bool ScaleSprite::OnTrigger(HOBJECT hSender, const CParsedMsg &cMsg) { static CParsedMsg::CToken s_cTok_Destroy("DESTROY"); static CParsedMsg::CToken s_cTok_Damage("DAMAGE"); static CParsedMsg::CToken s_cTok_On("ON"); static CParsedMsg::CToken s_cTok_Off("OFF"); if (cMsg.GetArg(0) == s_cTok_Destroy) { SetDestroyed(); } else if (cMsg.GetArg(0) == s_cTok_Damage) { SetDamaged(); } else if (cMsg.GetArg(0) == s_cTok_On) { if (m_hObject) { g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, FLAG_VISIBLE, FLAG_VISIBLE); g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, USRFLG_VISIBLE, USRFLG_VISIBLE); } } else if (cMsg.GetArg(0) == s_cTok_Off) { if (m_hObject) { g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, 0, FLAG_VISIBLE); g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, 0, USRFLG_VISIBLE); } } else return GameBase::OnTrigger(hSender, cMsg); return true; } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::ReadProp() // // PURPOSE: Update Properties // // ----------------------------------------------------------------------- // void ScaleSprite::ReadProp(ObjectCreateStruct *pStruct) { GenericProp genProp; ::GetLensFlareProperties(m_LensInfo); if (g_pLTServer->GetPropGeneric("DamagedFilename", &genProp) == LT_OK) { if (genProp.m_String[0]) { m_hstrDamagedFile = g_pLTServer->CreateString(genProp.m_String); } } if (g_pLTServer->GetPropGeneric("DestroyedFilename", &genProp) == LT_OK) { if (genProp.m_String[0]) { m_hstrDestroyedFile = g_pLTServer->CreateString(genProp.m_String); } } if (g_pLTServer->GetPropGeneric("ScaleX", &genProp) == LT_OK) { m_vScale.x = genProp.m_Float; } if (g_pLTServer->GetPropGeneric("ScaleY", &genProp) == LT_OK) { m_vScale.y = genProp.m_Float; } if (g_pLTServer->GetPropGeneric("Dims", &genProp) == LT_OK) { // Not used - This property is only to allow level designers // to see where the sprite is... } if (g_pLTServer->GetPropGeneric("Alpha", &genProp) == LT_OK) { m_fAlpha = genProp.m_Float; } if (g_pLTServer->GetPropGeneric("Color", &genProp) == LT_OK) { VEC_COPY(m_vColor, genProp.m_Vec); VEC_MULSCALAR(m_vColor, m_vColor, 1.0f/255.0f); } if (g_pLTServer->GetPropGeneric("Rotatable", &genProp) == LT_OK) { m_bRotatable = genProp.m_Bool; } if (g_pLTServer->GetPropGeneric("StartOn", &genProp) == LT_OK) { m_bStartOn = genProp.m_Bool; } if (g_pLTServer->GetPropGeneric("FlushWithWorld", &genProp) == LT_OK) { m_bFlushWithWorld = genProp.m_Bool; } m_dwAdditionalFlags = 0; if (g_pLTServer->GetPropGeneric("Glow", &genProp) == LT_OK) { m_dwAdditionalFlags |= (genProp.m_Bool ? FLAG_GLOWSPRITE : 0); } if (g_pLTServer->GetPropGeneric("ZBias", &genProp) == LT_OK) { m_dwAdditionalFlags |= (genProp.m_Bool ? FLAG_SPRITEBIAS : 0); } if (g_pLTServer->GetPropGeneric("Additive", &genProp) == LT_OK) { if (genProp.m_Bool) { pStruct->m_Flags2 |= FLAG2_ADDITIVE; pStruct->m_Flags |= FLAG_FOGDISABLE; } } if (g_pLTServer->GetPropGeneric("Multiply", &genProp) == LT_OK) { if (genProp.m_Bool) { pStruct->m_Flags2 |= FLAG2_MULTIPLY; pStruct->m_Flags |= FLAG_FOGDISABLE; } } } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::PostPropRead() // // PURPOSE: Finalize some data. // // ----------------------------------------------------------------------- // void ScaleSprite::PostPropRead(ObjectCreateStruct *pStruct) { if (pStruct) { pStruct->m_SkinName[0] = '\0'; pStruct->m_NextUpdate = 0.1f; pStruct->m_Scale = m_vScale; pStruct->m_Flags |= 0; // Make sure the sprite is rotateable... if (m_bRotatable || m_bFlushWithWorld) { pStruct->m_Flags |= FLAG_ROTATEABLESPRITE; } pStruct->m_Flags |= m_dwAdditionalFlags | FLAG_FORCECLIENTUPDATE; } } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::InitialUpdate // // PURPOSE: Do initial updating // // ----------------------------------------------------------------------- // LTBOOL ScaleSprite::InitialUpdate() { if (!m_hObject) return LTFALSE; // Do everything in Update (we need to make sure all the objects in // the world have been loaded)... SetNextUpdate(GetRandom(0.001f, 0.3f)); g_pLTServer->SetObjectColor(m_hObject, m_vColor.x, m_vColor.y, m_vColor.z, m_fAlpha); if (m_LensInfo.bCreateSprite) { ::BuildLensFlareSFXMessage(m_LensInfo, this); } return LTTRUE; } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::Update // // PURPOSE: Do one update // // ----------------------------------------------------------------------- // LTBOOL ScaleSprite::Update() { if (m_bStartOn) { g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, USRFLG_VISIBLE, USRFLG_VISIBLE); g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, FLAG_VISIBLE, FLAG_VISIBLE); } SetNextUpdate(UPDATE_NEVER); // BUG - This isn't quite right. Sometimes this works (flipping the sprite) // other times the sprite shouldn't be flipped...Not sure what the bug is. // For some reason the sprites are sometimes backwards...Get the rotation // so we can flip it... LTRotation rRot; LTVector vPos, vDir, vU, vR, vF; g_pLTServer->GetObjectPos(m_hObject, &vPos); g_pLTServer->GetObjectRotation(m_hObject, &rRot); vU = rRot.Up(); vR = rRot.Right(); vF = rRot.Forward(); if (m_bFlushWithWorld) { // Align the sprite to the surface directly behind the sprite // (i.e., opposite the forward vector)... VEC_NORM(vF); VEC_MULSCALAR(vDir, vF, -1.0f); // Determine where on the surface to place the sprite... IntersectInfo iInfo; IntersectQuery qInfo; VEC_COPY(qInfo.m_From, vPos); VEC_COPY(qInfo.m_Direction, vDir); qInfo.m_Flags = IGNORE_NONSOLID | INTERSECT_OBJECTS | INTERSECT_HPOLY; qInfo.m_FilterFn = LTNULL; if (g_pLTServer->CastRay(&qInfo, &iInfo)) { LTVector vTemp; VEC_COPY(vPos, iInfo.m_Point); VEC_COPY(vDir, iInfo.m_Plane.m_Normal); // Place the sprite just above the surface... VEC_MULSCALAR(vTemp, vDir, 1.0f); VEC_ADD(vPos, vPos, vTemp); g_pLTServer->SetObjectPos(m_hObject, &vPos); } } return LTTRUE; } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::SetDestroyed // // PURPOSE: Set to destroyed sprite // // ----------------------------------------------------------------------- // void ScaleSprite::SetDestroyed() { if (m_hstrDestroyedFile) { SetObjectFilenames(m_hObject, g_pLTServer->GetStringData(m_hstrDestroyedFile), ""); } else { g_pLTServer->RemoveObject(m_hObject); } } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::SetDamaged // // PURPOSE: Set to damaged sprite // // ----------------------------------------------------------------------- // void ScaleSprite::SetDamaged() { if (!m_hstrDamagedFile) return; SetObjectFilenames(m_hObject, g_pLTServer->GetStringData(m_hstrDamagedFile), ""); } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::Save // // PURPOSE: Save the object // // ----------------------------------------------------------------------- // void ScaleSprite::Save(ILTMessage_Write *pMsg, uint32 dwSaveFlags) { if (!pMsg) return; SAVE_VECTOR(m_vScale); SAVE_VECTOR(m_vColor); SAVE_FLOAT(m_fAlpha); SAVE_BOOL(m_bFlushWithWorld); SAVE_BOOL(m_bRotatable); SAVE_BOOL(m_bStartOn); SAVE_DWORD(m_dwAdditionalFlags); SAVE_HSTRING(m_hstrDamagedFile); SAVE_HSTRING(m_hstrDestroyedFile); } // ----------------------------------------------------------------------- // // // ROUTINE: ScaleSprite::Load // // PURPOSE: Load the object // // ----------------------------------------------------------------------- // void ScaleSprite::Load(ILTMessage_Read *pMsg, uint32 dwLoadFlags) { if (!pMsg) return; LOAD_VECTOR(m_vScale); LOAD_VECTOR(m_vColor); LOAD_FLOAT(m_fAlpha); LOAD_BOOL(m_bFlushWithWorld); LOAD_BOOL(m_bRotatable); LOAD_BOOL(m_bStartOn); LOAD_DWORD(m_dwAdditionalFlags); LOAD_HSTRING(m_hstrDamagedFile); LOAD_HSTRING(m_hstrDestroyedFile); }
[ [ [ 1, 544 ] ] ]
1fa589ececda2e31b98a798a254a36ccbd1ffbe1
accd6e4daa3fc1103c86d245c784182e31681ea4
/HappyHunter/Core/QuadTree.h
7bd2ef238b4979f4f1063ffb5ebcc72cc11306c3
[]
no_license
linfuqing/zero3d
d87ad6cf97069aea7861332a9ab8fc02b016d286
cebb12c37fe0c9047fb5b8fd3c50157638764c24
refs/heads/master
2016-09-05T19:37:56.213992
2011-08-04T01:37:36
2011-08-04T01:37:36
34,048,942
0
1
null
null
null
null
UTF-8
C++
false
false
8,065
h
#pragma once #include "BitFlag.h" #include "basicutils.h" #include "SceneManager.h" namespace zerO { inline UINT32 GetMaskY(UINT8 uMinY, UINT8 uMaxY) { UINT32 uHigh = FLAG(uMaxY), uLow = FLAG(uMinY), uSetMask = uHigh - 1, uClearMask = uLow - 1, uResult = uSetMask; if (uMinY) uResult &= ~uClearMask; uResult |= uHigh; uResult |= uLow; return uResult; } class CQuadTreeRectangle : public CBasicRectangle3D<UINT8> { public: void Convert(const CRectangle3D& Rect, const D3DXVECTOR3& Offset, const D3DXVECTOR3& Scale); }; class CQuadTreeNode; class CQuadTree; class CQuadTreeObject : public CSceneManagerEntry { friend class CQuadTreeNode; public: CQuadTreeObject(void); ~CQuadTreeObject(void); /*CQuadTreeNode* GetParentQuadTreeNode()const; UINT32 GetMaskZ()const; CQuadTreeObject* GetTreeForward()const; CQuadTreeObject* GetTreeRear()const;*/ virtual void PrepareForRender(); //CQuadTreeObject* GetNext()const; /*void SetQueadTree(CQuadTreeNode* pParentQuadTreeNode, UINT32 uMaskZ);*/ void AttachToQuadTree(CQuadTree* pParent); //void DetachFromSearchList(); void DetachFromQuadTree(); /*void ClearListData();*/ private: /*void __SetTreeForward(CQuadTreeObject* pTreeForward); void __SetTreeRear(CQuadTreeObject* pTreeRear); void __SetSearchForward(CQuadTreeObject* pTreeForward); void __SetSearchRear(CQuadTreeObject* pTreeRear);*/ void __AttachToSearchList(CQuadTreeObject* pForward, CQuadTreeObject* pRear); CQuadTreeObject* m_pTreeForward; CQuadTreeObject* m_pTreeRear; //CQuadTreeObject* m_pSearchForward; //CQuadTreeObject* m_pSearchRear; CQuadTree* m_pParentQuadTree; CQuadTreeNode* m_pParentQuadTreeNode; UINT32 m_uMaskY; }; /*inline CQuadTreeObject* CQuadTreeObject::GetTreeForward()const { return m_pTreeForward; } inline CQuadTreeObject* CQuadTreeObject::GetTreeRear()const { return m_pTreeRear; }*/ /*inline CQuadTreeObject* CQuadTreeObject::GetNext()const { return m_pSearchForward; }*/ /*inline void CQuadTreeObject::__SetTreeForward(CQuadTreeObject* pTreeForward) { m_pTreeForward = pTreeForward; } inline void CQuadTreeObject::__SetTreeRear(CQuadTreeObject* pTreeRear) { m_pTreeRear = pTreeRear; } inline void CQuadTreeObject::__SetSearchForward(CQuadTreeObject* pForward) { m_pSearchForward = pForward; } inline void CQuadTreeObject::__SetSearchRear(CQuadTreeObject* pRear) { m_pSearchRear = pRear; }*/ /*inline void CQuadTreeObject::SetQueadTree(CQuadTreeNode* pParentQuadTreeNode, UINT32 uMaskZ) { m_pParentQuadTreeNode = pParentQuadTreeNode; m_uMaskZ = uMaskZ; } inline CQuadTreeNode* CQuadTreeObject::GetParentQuadTreeNode()const { return m_pParentQuadTreeNode; } inline UINT32 CQuadTreeObject::GetMaskZ()const { return m_uMaskZ; }*/ inline void CQuadTreeObject::__AttachToSearchList(CQuadTreeObject* pForward, CQuadTreeObject* pRear) { m_pSearchForward = pForward; m_pSearchRear = pRear; if(pForward) pForward->m_pSearchRear = this; if(pRear) pRear->m_pSearchForward = this; } /*inline void CQuadTreeObject::DetachFromSearchList() { if(m_pSearchForward) m_pSearchForward->m_pSearchRear = m_pSearchRear; if(m_pSearchRear) m_pSearchRear->m_pSearchForward = m_pSearchForward; m_pSearchForward = NULL; m_pSearchRear = NULL; }*/ /*inline void CQuadTreeObject::ClearSearchListData() { m_pSearchForward = NULL; m_pSearchRear = NULL; }*/ class CQuadTreeNode { public: CQuadTreeNode(); ~CQuadTreeNode(); UINT32 AddMember(CQuadTreeObject* pObject, const CQuadTreeRectangle& Rect); void RemoveMember(CQuadTreeObject* pObject); void AddMemberToSearchList( CQuadTreeObject** ppListHead, CQuadTreeObject** ppListTail, UINT32 uMaskY, const LPFRUSTUM pFrustum); void AddMemberToSearchList( CQuadTreeObject** ppListHead, CQuadTreeObject** ppListTail, UINT32 uMaskY, const CRectangle3D& WorldRect, const LPFRUSTUM pFrustum); void Setup(CQuadTreeNode* pParent, CQuadTreeNode* pChild1, CQuadTreeNode* pChild2, CQuadTreeNode* pChild3, CQuadTreeNode* pChild4); UINT32 GetLocalMaskY()const; UINT32 GetWorldMaskY()const; private: void __DescendantMemberAdded(UINT32 uMaskY); void __DescendantMemberRemoved(); void __RebuildLocalMaskY(); void __RebuildWorldMaskY(); UINT32 m_uLocalMaskY; UINT32 m_uWorldMaskY; CQuadTreeObject* m_pMembers; CQuadTreeNode* m_pParent; CQuadTreeNode* m_pChildren[4]; }; inline void CQuadTreeNode::Setup(CQuadTreeNode* pParent, CQuadTreeNode* pChild1, CQuadTreeNode* pChild2, CQuadTreeNode* pChild3, CQuadTreeNode* pChild4) { DEBUG_ASSERT(m_pParent == NULL, "Parent node already set."); m_pParent = pParent; m_pChildren[0] = pChild1; m_pChildren[1] = pChild2; m_pChildren[2] = pChild3; m_pChildren[3] = pChild4; } inline UINT32 CQuadTreeNode::GetLocalMaskY()const { return m_uLocalMaskY; } inline UINT32 CQuadTreeNode::GetWorldMaskY()const { return m_uWorldMaskY; } class CQuadTree : public CSceneManager { typedef enum { MININUM_TREE_DEPTH = 1, MAXINUM_TREE_DEPTH = 8/*TOTAL_BITS(UINT8)*/ + MININUM_TREE_DEPTH }CONSTANTS; public: CQuadTree(void); ~CQuadTree(void); void Create(const CRectangle3D& Boundary, UINT uDepth); bool Destroy(); CSceneManagerEntry* SearchObject(const CRectangle3D& WorldRectangle, const LPFRUSTUM pFrustum = NULL, CSceneManagerEntry** ppSearchListTail = NULL); UINT32 AddObject(CSceneManagerEntry* pObject); private: CQuadTreeNode* m_pLevelNodes[MAXINUM_TREE_DEPTH]; D3DXVECTOR3 m_Scale; D3DXVECTOR3 m_Offset; UINT m_uDepth; void __FindTreeNodeInfo(const CQuadTreeRectangle& WorldByteRect, UINT& uLevel, UINT& uLevelX, UINT& uLevelZ); CQuadTreeNode* __FindTreeNode(const CQuadTreeRectangle& WorldByteRect); CQuadTreeNode* __GetNodeFromLevelXZ(INT nLevel, UINT x, UINT z); }; inline CQuadTreeNode* CQuadTree::__GetNodeFromLevelXZ(INT nLevel, UINT x, UINT z) { if(nLevel >= 0 && nLevel < (INT)m_uDepth) return &m_pLevelNodes[nLevel][(z << nLevel) + x]; return NULL; } inline void CQuadTree::__FindTreeNodeInfo(const CQuadTreeRectangle& WorldByteRect, UINT& uLevel, UINT& uLevelX, UINT& uLevelZ) { UINT8 uPatternX = WorldByteRect.GetMinX() ^ WorldByteRect.GetMaxX(), uPatternZ = WorldByteRect.GetMinZ() ^ WorldByteRect.GetMaxZ(), uBitPattern = MAX(uPatternX, uPatternZ); INT nHighBit = uBitPattern ? (HighestBitSet(uBitPattern) + 1) : 0; UINT uShift; uLevel = MAXINUM_TREE_DEPTH - nHighBit - MININUM_TREE_DEPTH; uLevel = MIN(uLevel, m_uDepth - 1); uShift = MAXINUM_TREE_DEPTH - uLevel - MININUM_TREE_DEPTH; uLevelX = WorldByteRect.GetMaxX() >> uShift; uLevelZ = WorldByteRect.GetMaxZ() >> uShift; } inline CQuadTreeNode* CQuadTree::__FindTreeNode(const CQuadTreeRectangle& WorldByteRect) { UINT uLevel, uLevelX, uLevelZ; __FindTreeNodeInfo(WorldByteRect, uLevel, uLevelX, uLevelZ); return __GetNodeFromLevelXZ(uLevel, uLevelX, uLevelZ); } inline UINT32 CQuadTree::AddObject(CSceneManagerEntry* pObject) { DEBUG_ASSERT(m_uDepth, "The quad tree has not been created."); CQuadTreeObject* pQuadTreeObject; if( !pObject || !( pQuadTreeObject = dynamic_cast<CQuadTreeObject*>(pObject) ) ) { DEBUG_WARNING("The object is not a CQuadTreeObject."); return 0; } CSceneManager::AddObject(pObject); CQuadTreeRectangle ByteRect; ByteRect.Convert(pObject->GetWorldRectangle(), m_Offset, m_Scale); CQuadTreeNode* pNode = __FindTreeNode(ByteRect); DEBUG_ASSERT(pNode, "Failed to locate quad tree node."); return pNode->AddMember(pQuadTreeObject, ByteRect); } }
[ [ [ 1, 321 ] ] ]
99dfe0fcd427ef97c83e137d9f97d141e560db2f
b42365c7502900abe47669cfce630e360cc9156b
/src/engine/MenuGameOver.cpp
d1806ec56de8e716e2fc02487e03241b5adfb715
[ "BSD-3-Clause" ]
permissive
ycaihua/arbarlith2
0686bacfad3414f04a4ce655ea0cad0bd754d53c
820ffc8c3efcb636eb2c639487815fb9aabdc82e
refs/heads/master
2020-12-07T02:34:25.117495
2010-08-25T03:38:21
2010-08-25T03:38:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,260
cpp
/* Original Author: Andrew Fox E-Mail: mailto:[email protected] Copyright (c) 2005-2007,2009 Game Creation Society All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Game Creation Society 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 Game Creation Society ``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 Game Creation Society 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 "stdafx.h" #include "gl.h" #include "GameStateMenu.h" #include "MenuGameOver.h" namespace Engine { MenuGameOver::MenuGameOver(void) { create(); } MenuGameOver::~MenuGameOver(void) { destroy(); } void MenuGameOver::create(void) { Menu::create("data/sprites/backdrops/gameover.jpg"); } void MenuGameOver::populateElements(void) { elements.clear(); elements.push_back( Element(vec2(30.0f, 100.0f), "Game Over") ); } void MenuGameOver::activateElement(int) { g_SoundSystem.play("data/sound/activate.wav"); GameStateMenu::GetSingleton().enterGameMenuScreen(); } }; // namespace
[ [ [ 1, 69 ] ] ]
3366c310789be56dd3cd5a4534ec756e65f90431
814b49df11675ac3664ac0198048961b5306e1c5
/Code/Engine/GUI/include/Console.h
45b1ce947b72f81754035164d551a5e77577ef5a
[]
no_license
Atridas/biogame
f6cb24d0c0b208316990e5bb0b52ef3fb8e83042
3b8e95b215da4d51ab856b4701c12e077cbd2587
refs/heads/master
2021-01-13T00:55:50.502395
2011-10-31T12:58:53
2011-10-31T12:58:53
43,897,729
0
0
null
null
null
null
ISO-8859-3
C++
false
false
2,656
h
//---------------------------------------------------------------------------------- // CConsole class // Author: Enric Vergara // // Description: // Esta clase gestiona internamente una especie de EditBox exclusiva para ejecutat scripts. // Hace uso del ScriptManager para enviarle el script que se ha introducido. //---------------------------------------------------------------------------------- #pragma once #ifndef INC_CONSOLE_H #define INC_CONSOLE_H #include "base.h" #include <string> //---Forward Declarations---- class CRenderManager; class CFontManager; class CInputManager; //--------------------------- #define MAX_HISTORY 20 //----Declaración de nuevos tipos----- struct SAutoCompleteInfo { SAutoCompleteInfo::SAutoCompleteInfo(): m_sOldBuffer(""), m_uIndex(0), m_bAutoComplete(false) {} string m_sOldBuffer; uint32 m_uIndex; bool m_bAutoComplete; vector<string> m_Functions; }; //------------------------------------ class CConsole { public: //---Init and End protocols---- CConsole(): m_sBuffer( ">" ), m_sFocusObject("_"), m_bIsActive( false ), m_fTimeCount(0.f), m_fFocusTime(0.5f), m_Result(NULL), m_BackTime1(0.f), m_BackTime2(0.f), m_uCursorPos(1) {} virtual ~CConsole() { Done(); } bool Init (); void Done (); bool IsOk () const {return m_bIsOk;} //----------------------------- void Render (CRenderManager* renderManager, CFontManager* fontManager); void Update (float elapsedTime); void SetActive (bool active) {m_bIsActive = active;} bool IsActive () const {return m_bIsActive;} void SetAutoComplete (std::vector<std::string> functions) {m_sAutoCInfo.m_Functions = functions;} void Remove1character (); void Toggle () { m_bIsActive = !m_bIsActive; }; private: void Release (); void ProcessNewEntries (CInputManager*input); void ProcessAutoComplete (bool reverse = false); void FinalizeAutoComplete (); private: //Types typedef std::vector<std::string> tHistory; bool m_bIsOk; std::string m_sBuffer; std::string m_sFocusObject; bool m_bIsActive; float m_fTimeCount; float m_fFocusTime; uint16* m_Result; tHistory m_History; tHistory::iterator m_ItHistory; SAutoCompleteInfo m_sAutoCInfo; float m_BackTime1; float m_BackTime2; uint8 m_uCursorPos; }; #endif // INC_CONSOLE_H
[ "edual1985@576ee6d0-068d-96d9-bff2-16229cd70485", "Atridas87@576ee6d0-068d-96d9-bff2-16229cd70485" ]
[ [ [ 1, 40 ], [ 42, 48 ], [ 50, 90 ] ], [ [ 41, 41 ], [ 49, 49 ] ] ]
adac896df4c92f549f305fb13b2422f426b2c73c
83ed25c6e6b33b2fabd4f81bf91d5fae9e18519c
/code/IRRMeshLoader.h
ebe608aa9aec7d154b6c782af14c0080806c220a
[ "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
3,463
h
/* Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------- Copyright (c) 2006-2010, ASSIMP Development Team All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the ASSIMP team, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the ASSIMP Development Team. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ /** @file IRRMeshLoader.h * @brief Declaration of the .irrMesh (Irrlight Engine Mesh Format) * importer class. */ #ifndef AI_IRRMESHLOADER_H_INCLUDED #define AI_IRRMESHLOADER_H_INCLUDED #include "BaseImporter.h" #include "IRRShared.h" namespace Assimp { // --------------------------------------------------------------------------- /** IrrMesh importer class. * * IrrMesh is the native file format of the Irrlight engine and its editor * irrEdit. As IrrEdit itself is capable of importing quite many file formats, * it might be a good file format for data exchange. */ class IRRMeshImporter : public BaseImporter, public IrrlichtBase { public: IRRMeshImporter(); ~IRRMeshImporter(); public: // ------------------------------------------------------------------- /** Returns whether the class can handle the format of the given file. * See BaseImporter::CanRead() for details. */ bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const; protected: // ------------------------------------------------------------------- /** Called by Importer::GetExtensionList() for each loaded importer. * See BaseImporter::GetExtensionList() for details */ void GetExtensionList(std::set<std::string>& extensions); // ------------------------------------------------------------------- /** Imports the given file into the given scene structure. * See BaseImporter::InternReadFile() for details */ void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler); }; } // end of namespace Assimp #endif // AI_IRRMESHIMPORTER_H_INC
[ "aramis_acg@67173fc5-114c-0410-ac8e-9d2fd5bffc1f", "ulfjorensen@67173fc5-114c-0410-ac8e-9d2fd5bffc1f" ]
[ [ [ 1, 47 ], [ 49, 95 ] ], [ [ 48, 48 ] ] ]
8b82a4e06a815e37f324d2be066d53c83a871364
b3b0c727bbafdb33619dedb0b61b6419692e03d3
/Source/RSSPlugin/gTestRSS/gTestRSS.cpp
63f59c4a6ecb9e1d06ba605d5b230cf564202bdb
[]
no_license
testzzzz/hwccnet
5b8fb8be799a42ef84d261e74ee6f91ecba96b1d
4dbb1d1a5d8b4143e8c7e2f1537908cb9bb98113
refs/heads/master
2021-01-10T02:59:32.527961
2009-11-04T03:39:39
2009-11-04T03:39:39
45,688,112
0
1
null
null
null
null
GB18030
C++
false
false
2,168
cpp
// gTestRSS.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include "gTestRSS.h" RSSLW * gTestRSS::pLW = NULL; vector<RSSChannel> m_vecRss; ///< 保存从文件加载的RSS频道列表 LPWSTR strTmp = NULL; long tmpCount = 0; TEST_F(gTestRSS,rsslink_Italy) { ASSERT_EQ(S_OK,gTestRSS::pLW->InitParser()); ASSERT_EQ(S_OK,gTestRSS::pLW->SetParser(L"http://rss.sina.com.cn/sports/global/italy.xml")); ASSERT_EQ(S_OK,gTestRSS::pLW->StartParser()); ASSERT_EQ(S_OK,gTestRSS::pLW->GetChannelInfo()); ASSERT_EQ(S_OK,gTestRSS::pLW->GetRssLink(strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetRssDate(strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetRssTitle(strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemInfo()); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemCount(tmpCount)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemAuthor(tmpCount - 1,strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemDate(tmpCount - 1,strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemLink(tmpCount - 1,strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemTitle(tmpCount - 1,strTmp)); } TEST_F(gTestRSS,rsslink_Sports) { ASSERT_EQ(S_OK,gTestRSS::pLW->InitParser()); ASSERT_EQ(S_OK,gTestRSS::pLW->SetParser(L"http://rss.sina.com.cn/news/allnews/sports.xml")); ASSERT_EQ(S_OK,gTestRSS::pLW->StartParser()); ASSERT_EQ(S_OK,gTestRSS::pLW->GetChannelInfo()); ASSERT_EQ(S_OK,gTestRSS::pLW->GetRssLink(strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetRssDate(strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetRssTitle(strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemInfo()); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemCount(tmpCount)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemAuthor(tmpCount - 1,strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemDate(tmpCount - 1,strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemLink(tmpCount - 1,strTmp)); ASSERT_EQ(S_OK,gTestRSS::pLW->GetItemTitle(tmpCount - 1,strTmp)); } int _tmain(int argc, _TCHAR* argv[]) { testing::GTEST_FLAG(output) = "xml:TestResult.xml"; testing::InitGoogleTest(&argc,argv); return RUN_ALL_TESTS(); }
[ [ [ 1, 50 ] ] ]
501f40ac3c03068e2c387d4e18a656db57537854
dba70d101eb0e52373a825372e4413ed7600d84d
/RendererComplement/source/DataCollector.cpp
41164ce2d4b25be1976682b927ab76e09cc11f3c
[]
no_license
nustxujun/simplerenderer
2aa269199f3bab5dc56069caa8162258e71f0f96
466a43a1e4f6e36e7d03722d0d5355395872ad86
refs/heads/master
2021-03-12T22:38:06.759909
2010-10-02T03:30:26
2010-10-02T03:30:26
32,198,944
0
0
null
null
null
null
UTF-8
C++
false
false
771
cpp
#include "DataCollector.h" namespace RCP { void DataCollector::getDataImpl(Vector4& vec4, const void* data) { const float* d = (const float* )data; vec4.x = d[0]; vec4.y = d[1]; vec4.z = d[2]; vec4.w = d[3]; } void DataCollector::getDataImpl(Vector3& vec3, const void* data) { const float* d = (const float* )data; vec3.x = d[0]; vec3.y = d[1]; vec3.z = d[2]; } void DataCollector::getDataImpl(Vector2& vec2, const void* data) { const float* d = (const float* )data; vec2.x = d[0]; vec2.y = d[1]; } void DataCollector::getDataImpl(float& f, const void* data) { memcpy(&f,data,sizeof(f)); } void DataCollector::getDataImpl(int& d, const void* data) { memcpy(&d,data,sizeof(d)); } }
[ "[email protected]@c2606ca0-2ebb-fda8-717c-293879e69bc3" ]
[ [ [ 1, 41 ] ] ]
ae0d72e727e6230dc66ec680bdfcf60b8a665078
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
/CommonSources/TagLib/tagunion.cpp
21aeebfe7341a5a6650d5084708e93ccb1feb511
[]
no_license
outcast1000/Jaangle
062c7d8d06e058186cb65bdade68a2ad8d5e7e65
18feb537068f1f3be6ecaa8a4b663b917c429e3d
refs/heads/master
2020-04-08T20:04:56.875651
2010-12-25T10:44:38
2010-12-25T10:44:38
19,334,292
3
0
null
null
null
null
UTF-8
C++
false
false
6,422
cpp
/*************************************************************************** copyright : (C) 2002 - 2008 by Scott Wheeler email : [email protected] ***************************************************************************/ /*************************************************************************** * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License version * * 2.1 as published by the Free Software Foundation. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * * USA * * * * Alternatively, this file is available under the Mozilla Public * * License Version 1.1. You may obtain a copy of the License at * * http://www.mozilla.org/MPL/ * ***************************************************************************/ #include "tagunion.h" using namespace TagLib; #define stringUnion(method) \ if(tag(0) && !tag(0)->method().isEmpty()) \ return tag(0)->method(); \ if(tag(1) && !tag(1)->method().isEmpty()) \ return tag(1)->method(); \ if(tag(2) && !tag(2)->method().isEmpty()) \ return tag(2)->method(); \ return String::null \ #define numberUnion(method) \ if(tag(0) && tag(0)->method() > 0) \ return tag(0)->method(); \ if(tag(1) && tag(1)->method() > 0) \ return tag(1)->method(); \ if(tag(2) && tag(2)->method() > 0) \ return tag(2)->method(); \ return 0 #define setUnion(method, value) \ if(tag(0)) \ tag(0)->set##method(value); \ if(tag(1)) \ tag(1)->set##method(value); \ if(tag(2)) \ tag(2)->set##method(value); \ class TagUnion::TagUnionPrivate { public: TagUnionPrivate() : tags(3, static_cast<Tag *>(0)) { } ~TagUnionPrivate() { delete tags[0]; delete tags[1]; delete tags[2]; } std::vector<Tag *> tags; }; TagUnion::TagUnion(Tag *first, Tag *second, Tag *third) { d = new TagUnionPrivate; d->tags[0] = first; d->tags[1] = second; d->tags[2] = third; } TagUnion::~TagUnion() { delete d; } Tag *TagUnion::operator[](int index) const { return tag(index); } Tag *TagUnion::tag(int index) const { return d->tags[index]; } void TagUnion::set(int index, Tag *tag) { delete d->tags[index]; d->tags[index] = tag; } String TagUnion::title() const { stringUnion(title); } String TagUnion::artist() const { stringUnion(artist); } String TagUnion::album() const { stringUnion(album); } String TagUnion::comment() const { stringUnion(comment); } String TagUnion::genre() const { stringUnion(genre); } TagLib::uint TagUnion::year() const { numberUnion(year); } TagLib::uint TagUnion::track() const { numberUnion(track); } void TagUnion::setTitle(const String &s) { setUnion(Title, s); } void TagUnion::setArtist(const String &s) { setUnion(Artist, s); } void TagUnion::setAlbum(const String &s) { setUnion(Album, s); } void TagUnion::setComment(const String &s) { setUnion(Comment, s); } void TagUnion::setGenre(const String &s) { setUnion(Genre, s); } void TagUnion::setYear(uint i) { setUnion(Year, i); } void TagUnion::setTrack(uint i) { setUnion(Track, i); } bool TagUnion::isEmpty() const { if(d->tags[0] && !d->tags[0]->isEmpty()) return false; if(d->tags[1] && !d->tags[1]->isEmpty()) return false; if(d->tags[2] && !d->tags[2]->isEmpty()) return false; return true; } //=== Alex Tags String TagUnion::lyrics_AL() const { stringUnion(lyrics_AL); } void TagUnion::setLyrics_AL(const String &s) { setUnion(Lyrics_AL, s); } uint TagUnion::rating_AL() const { numberUnion(rating_AL); } void TagUnion::setRating_AL(uint i) { setUnion(Rating_AL, i); } bool TagUnion::picture_AL(String& mime, ByteVector& data, String& description) const { for (int i = 0; i < 3; i++) { if(tag(i)) { if (tag(i)->picture_AL(mime, data, description)) return true; } } return false; } void TagUnion::setPicture_AL(String& mime, ByteVector& data, String& description) { for (int i = 0; i < 3; i++) { if(tag(i)) tag(i)->setPicture_AL(mime, data, description); } } //=== Album Artist String TagUnion::albumArtist_AL() const { stringUnion(albumArtist_AL); } void TagUnion::setAlbumArtist_AL(const String &s) { setUnion(AlbumArtist_AL, s); } //=== Composer String TagUnion::composer_AL() const { stringUnion(composer_AL); } void TagUnion::setComposer_AL(const String &s) { setUnion(Composer_AL, s); } //=== Alex Tags END
[ "outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678" ]
[ [ [ 1, 246 ] ] ]
a4b70067d9239c3501a7287ed3c34913ced462f5
e192bb584e8051905fc9822e152792e9f0620034
/tags/sources_0_1/base/test/test_tableau_composition.cpp
b34b496b70ec2942595f85cf6f9379b99b8ebaa9
[]
no_license
BackupTheBerlios/projet-univers-svn
708ffadce21f1b6c83e3b20eb68903439cf71d0f
c9488d7566db51505adca2bc858dab5604b3c866
refs/heads/master
2020-05-27T00:07:41.261961
2011-07-31T20:55:09
2011-07-31T20:55:09
40,817,685
0
0
null
null
null
null
ISO-8859-2
C++
false
false
2,065
cpp
/*************************************************************************** * Copyright (C) 2004 by Projet Univers * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "test_tableau_composition.h" CPPUNIT_TEST_SUITE_REGISTRATION(TestTableauComposition) ; void TableauComposition::testAdd() { //local variables ObArrayIndex i ; ObComposition<int> pElt(new int(123456)) ; // un opointeur sur l'élément ObAssociation<int> element(pElt) ; CPPUNIT_ASSERT( array.contains(element) == FALSE ); i = array.add( pElt.release() ) ; CPPUNIT_ASSERT( array.contains(element) == TRUE ); } void TableauComposition::setUp() { // } void TableauComposition::tearDown() { // }
[ "rogma@fb75c231-3be1-0310-9bb4-c95e2f850c73" ]
[ [ [ 1, 55 ] ] ]
6aa057fe568f6095a5540792075c73e38c813c54
829192b59a3c7a8451aad6d3079dd2a4b99f4aeb
/codigo/main.cpp
b48037e8de62dae501f0134ad5287dda4cf73561
[]
no_license
ctkawa/edexplorer
fcafe7111374e3a6c2f65d91f949672b9d1bf31c
7ff76cd4139b0b7dd127dd48a5c9cc7ee7cab66a
refs/heads/master
2021-01-10T12:44:37.012917
2011-06-07T21:00:03
2011-06-07T21:00:03
43,203,499
1
1
null
null
null
null
UTF-8
C++
false
false
8,627
cpp
/* UFSCar Departamento de Computação Bacharelado em Ciências da Computação Disciplina: Estruturas de Dados Professor: Dr. Roberto Ferrari Trabalho 2 - Implementação de estruturas indicadas Grupo: Cleber Takahito Kawamorita, RA 379425 Felipe ..., RA João Celso Santos de Oliveira, RA 379247 Willian ..., RA Junho de 2011 */ #include <iostream> #include "elemento.h" #include "no1.h" #include "no2.h" #include "fila.h" #include "lista_simples.h" #include "lista_avancada.h" #include "arvorebb.h" using namespace std; void titulo(string s){ int barras = 40, i; cout << endl; for(i=0;i<barras;i++) cout << "/"; cout << endl << "/// Testando " << s << endl; for(i=0;i<barras;i++) cout << "/"; cout << endl << endl; } int main() { /**** Testes das classes/estruturas: * * 1. classe elemento * 2. classe no1 * 3. classe no2 * 4. classe fila * 5. classe lista_simples * 6. classe lista_avancada * 7. classe arvore * ****/ //////////////////////////////////////////////// // // 1. classe elemento // // titulo("classe elemento"); cout << "Construtor sem argumento: "; elemento e0; cout << "ok" << endl; cout << "Construtor com argumento: "; elemento e1(1); if(e1.getValor() == 1) cout << "ok" << endl; cout << "GET e SET valor: "; e0.setValor(10); if(e0.getValor() == 10) cout << "ok" << endl; cout << "Sobrecarga de '=': "; e0 = e1; if( e0.getValor() == e1.getValor() ) cout << "ok" << endl; cout << "Sobrecarga de '<<': ok\t" << e0 << endl; //////////////////////////////////////////////// // // 2. classe no1 // // titulo("classe no1"); cout << "Construtor sem argumento: "; no1 node0; cout << "ok" << endl; cout << "Construtor com argumento: "; e0.setValor(100); no1 node1(e0); if(node1.getInfo() == e0) cout << "ok" << endl; cout << "GET e SET info: "; e0.setValor(99); node1.setInfo(e0); if(node1.getInfo() == e0) cout << "ok" << endl; cout << "GET e SET next: "; e0.setValor(5); no1* pnode2 = new no1(); pnode2->setInfo(e0); node0.setNext(pnode2); if(node0.getNext()->getInfo() == e0) cout << "ok" << endl; no1 meuno[3], *noPtr; meuno[0].setInfo(10); meuno[1].setInfo(11); meuno[2].setInfo(12); meuno[0].setNext(&meuno[1]); meuno[1].setNext(&meuno[2]); meuno[2].setNext(&meuno[0]); cout << "meuno[0].getInfo() = " << meuno[0].getInfo() << " / at = " << meuno[0].getNext() << endl; cout << "meuno[1].getInfo() = " << meuno[1].getInfo() << " / at = " << meuno[1].getNext() << endl; cout << "meuno[2].getInfo() = " << meuno[2].getInfo() << " / at = " << meuno[2].getNext() << endl; noPtr = meuno[0].getNext(); cout << noPtr->getInfo()<< endl; noPtr->setInfo(77); cout << noPtr->getInfo()<< endl; meuno[0].getNext()->setNext(&meuno[0]); noPtr->setNext(noPtr); cout << noPtr << endl; cout << noPtr->getNext() << endl; //////////////////////////////////////////////// // // 3. classe no2 // // titulo("classe no2"); cout << "Construtor sem argumento: "; no2 n2_0; cout << "ok" << endl; cout << "Construtor com argumento: "; e0.setValor(100); no2 n2_1(e0); if(n2_1.getInfo() == e0) cout << "ok" << endl; cout << "GET e SET info: "; e0.setValor(99); n2_1.setInfo(e0); if(n2_1.getInfo() == e0) cout << "ok" << endl; cout << "GET e SET dir: "; e0.setValor(5); no2* pn2_2 = new no2(); pn2_2->setInfo(e0); n2_0.setDir(pn2_2); if(n2_0.getDir()->getInfo() == e0) cout << "ok" << endl; cout << "GET e SET esq: "; e0.setValor(6); pn2_2->setInfo(e0); n2_0.setEsq(pn2_2); if(n2_0.getEsq()->getInfo() == e0) cout << "ok" << endl; no2 meuno2; meuno2.setInfo(720); meuno2.setDir(&meuno2); meuno2.setEsq(&meuno2); cout << meuno2.getInfo() << endl; cout << meuno2.getDir()->getInfo() << endl; delete pn2_2; //////////////////////////////////////////////// // // 4. classe fila // // titulo("classe fila"); cout<<"-----------" <<endl; fila afila(3); elemento f1,f2,f3,f; bool okb; f1=11; f2=12; f3=13; f=111; afila.entra(f3,okb); afila.entra(f2,okb); afila.entra(f1,okb); afila.entra(f,okb); afila.sai(f,okb); afila.sai(f,okb); afila.sai(f,okb); cout << f <<endl; cout<<"-----------" <<endl; elemento cambada[10], ele; bool ok; cambada[0] = 3; cambada[1] = 13; cambada[2] = 2; cambada[3] = 6; cambada[4] = 4; cambada[5] = 8; cambada[6] = 7; cambada[7] = 5; cambada[8] = 1; cambada[9] = 9; fila minhafila(4); cout << "entrando: " << cambada[3]; minhafila.entra(cambada[3], ok); cout << " Result:" << ok << endl; cout << "entrando: " << cambada[2]; minhafila.entra(cambada[2], ok); cout << " Result:" << ok << endl; cout << "entrando: " << cambada[1]; minhafila.entra(cambada[1], ok); cout << " Result:" << ok << endl; cout << "Elementos inseridos!!! Agora irao sair:" << endl; minhafila.sai(ele,ok); if (ok) cout << "saindo: " << ele ; cout << " Result:" << ok << endl; minhafila.sai(ele,ok); if (ok) cout << "saindo: " << ele ; cout << " Result:" << ok << endl; minhafila.sai(ele,ok); if (ok) cout << "saindo: " << ele ; cout << " Result:" << ok << endl; cout << "Elementos Saíram!!" << endl; //////////////////////////////////////////////// // // 5. classe lista_simples // // titulo("classe lista_simples"); lista_simples lista; int i; for(i=0; i<=10; i++){ e0.setValor(i); lista.insereElemento(e0); } lista.printAll(); for(i=0; i<=10; i+=2){ e0.setValor(i); lista.removeElemento(e0); } lista.printAll(); e0.setValor(9); if(lista.estaNaLista(e0)) cout << "9 está na lista" << endl; else cout << "9 não está na lista" << endl; e0.setValor(0); if(lista.estaNaLista(e0)) cout << "0 está na lista" << endl; else cout << "0 não está na lista" << endl; //////////////////////////////////////////////// // // 6. classe lista_avancada // // titulo("classe lista_avancada"); lista_avancada minhaListaA; // elemento ele; cout << "inserindo sequencia de 0 a 9, sempre a esquerda de Header."<<endl; for(int i=0;i<10;i++){ ele = i; if(!minhaListaA.insereAEsquerda(ele,*(minhaListaA.getPtrHeader()))) cout << "Erro na insercao de " << ele << endl; } cout << "imprimindo tudo de Header para direita. Deve ser ordem crescente:" << endl; minhaListaA.printAll(); //bool ok; cout << "Deletando tudo, 11 vezes para dar um erro:"<<endl; for(int i=1;i<=11;i++){ minhaListaA.retirar(minhaListaA.getPtrHeader()->getDir(),ok); if(!ok) cout << "Erro na remocao: " << i << endl; } cout << "há "<<minhaListaA.getTamanhoAtual()<< " elementos."<<endl; cout << "inserindo pares a direita e impares a esquerda" <<endl; for(int i=0;i<10;i+=2){ ele = i; if(!minhaListaA.insereADireita(ele,*(minhaListaA.getPtrHeader()))) cout << "Erro na insercao de " << ele << endl; ele = i+1; if(!minhaListaA.insereAEsquerda(ele,*(minhaListaA.getPtrHeader()))) cout << "Erro na insercao de " << ele << endl; } cout << "há "<<minhaListaA.getTamanhoAtual()<< " elementos."<<endl; minhaListaA.printAll(); //////////////////////////////////////////////// // // 7. classe arvore // // titulo("classe arvore"); arvorebb meuArvore, meuA2; for(int i=0;i<10;i++){ ele = i; if(!meuArvore.insere(ele)) cout << "Erro na insercao de " << ele << endl; //cout << "raiz: " << meuArvore.getRaiz() << endl; } meuArvore.imprimeAll(); cout <<endl<<endl; ele = 10; meuA2.insere(ele); ele = 5; meuA2.insere(ele); ele = 15; meuA2.insere(ele); ele = 1; meuA2.insere(ele); ele = 7; meuA2.insere(ele); ele = 12; meuA2.insere(ele); ele = 18; meuA2.insere(ele); cout << "Árvore com nós com 2 descendentes : " << endl; meuA2.imprimeAll(); cout <<endl<<endl; cout << "Árvore copiada do anterior: " << endl; arvorebb meuA3(meuA2); meuA3.imprimeAll(); cout <<endl<<endl; cout << "FIM"<<endl; return 0; }
[ "[email protected]", "[email protected]", "ctkawa@04c4bf83-96d4-3932-496e-5ed035fafcdf" ]
[ [ [ 1, 12 ], [ 14, 21 ], [ 24, 29 ], [ 34, 42 ], [ 45, 55 ], [ 57, 61 ], [ 63, 63 ], [ 65, 67 ], [ 69, 72 ], [ 74, 77 ], [ 79, 82 ], [ 84, 90 ], [ 92, 92 ], [ 94, 96 ], [ 98, 102 ], [ 104, 108 ], [ 110, 116 ], [ 118, 124 ], [ 126, 128 ], [ 130, 130 ], [ 132, 134 ], [ 136, 146 ], [ 148, 148 ], [ 150, 152 ], [ 154, 158 ], [ 160, 164 ], [ 167, 173 ], [ 175, 180 ], [ 182, 186 ], [ 188, 189 ], [ 191, 195 ], [ 197, 214 ], [ 222, 224 ], [ 226, 230 ], [ 239, 240 ], [ 242, 246 ], [ 248, 248 ], [ 250, 250 ], [ 252, 252 ], [ 254, 257 ], [ 259, 259 ], [ 261, 264 ], [ 266, 272 ], [ 274, 278 ], [ 281, 285 ], [ 287, 287 ], [ 289, 290 ], [ 322, 328 ], [ 331, 331 ], [ 337, 361 ] ], [ [ 13, 13 ], [ 22, 23 ], [ 30, 33 ], [ 43, 44 ], [ 56, 56 ], [ 62, 62 ], [ 64, 64 ], [ 68, 68 ], [ 73, 73 ], [ 78, 78 ], [ 83, 83 ], [ 91, 91 ], [ 93, 93 ], [ 97, 97 ], [ 103, 103 ], [ 109, 109 ], [ 125, 125 ], [ 129, 129 ], [ 131, 131 ], [ 135, 135 ], [ 187, 187 ], [ 196, 196 ], [ 217, 221 ], [ 241, 241 ], [ 247, 247 ], [ 249, 249 ], [ 286, 286 ], [ 288, 288 ], [ 291, 299 ], [ 321, 321 ], [ 332, 334 ], [ 336, 336 ], [ 366, 367 ] ], [ [ 117, 117 ], [ 147, 147 ], [ 149, 149 ], [ 153, 153 ], [ 159, 159 ], [ 165, 166 ], [ 174, 174 ], [ 181, 181 ], [ 190, 190 ], [ 215, 216 ], [ 225, 225 ], [ 231, 238 ], [ 251, 251 ], [ 253, 253 ], [ 258, 258 ], [ 260, 260 ], [ 265, 265 ], [ 273, 273 ], [ 279, 280 ], [ 300, 320 ], [ 329, 330 ], [ 335, 335 ], [ 362, 365 ] ] ]
6d3e290336a661b37eca772c5e60ec989ee9b9ad
3179f9d55a8d99744707b30e2cdfe21bfea0cfa3
/symbian/gCalSyncer/inc/gCalSyncerAppUi.h
bd76ff9a4d08669c9cffd1649800c86b7df5b64c
[]
no_license
santatic/toolkits
11f16dd6319af1591dfa1f07a813cfe42f2a949b
50c2a03d9ae0fb288d702ac6627b6499a513f780
refs/heads/master
2021-01-10T04:01:11.909424
2010-03-13T15:55:17
2010-03-13T15:55:17
52,971,206
0
1
null
null
null
null
UTF-8
C++
false
false
1,823
h
/* ============================================================================ Name : gCalSyncerAppUi.h Author : toolkits.googlecode.com Copyright : New BSD License Description : Declares UI class for application. ============================================================================ */ #ifndef __GCALSYNCERAPPUI_h__ #define __GCALSYNCERAPPUI_h__ // INCLUDES #include <aknappui.h> // FORWARD DECLARATIONS class CgCalSyncerAppView; // CLASS DECLARATION /** * CgCalSyncerAppUi application UI class. * Interacts with the user through the UI and request message processing * from the handler class */ class CgCalSyncerAppUi : public CAknAppUi { public: // Constructors and destructor /** * ConstructL. * 2nd phase constructor. */ void ConstructL(); /** * CgCalSyncerAppUi. * C++ default constructor. This needs to be public due to * the way the framework constructs the AppUi */ CgCalSyncerAppUi(); /** * ~CgCalSyncerAppUi. * Virtual Destructor. */ virtual ~CgCalSyncerAppUi(); private: // Functions from base classes /** * From CEikAppUi, HandleCommandL. * Takes care of command handling. * @param aCommand Command to be handled. */ void HandleCommandL(TInt aCommand); /** * HandleStatusPaneSizeChange. * Called by the framework when the application status pane * size is changed. */ void HandleStatusPaneSizeChange(); /** * From CCoeAppUi, HelpContextL. * Provides help context for the application. * size is changed. */ CArrayFix<TCoeHelpContext>* HelpContextL() const; private: // Data /** * The application view * Owned by CgCalSyncerAppUi */ CgCalSyncerAppView* iAppView; }; #endif // __GCALSYNCERAPPUI_h__ // End of File
[ [ [ 1, 85 ] ] ]
a6a2dc02332772624e5f413e39e2827131cca42d
580738f96494d426d6e5973c5b3493026caf8b6a
/Include/Vcl/dbxpressweb.hpp
0996c01636de74e35168f3013789da32c804a50e
[]
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
2,517
hpp
// Borland C++ Builder // Copyright (c) 1995, 2002 by Borland Software Corporation // All rights reserved // (DO NOT EDIT: machine generated header) 'DBXpressWeb.pas' rev: 6.00 #ifndef DBXpressWebHPP #define DBXpressWebHPP #pragma delphiheader begin #pragma option push -w- #pragma option push -Vx #include <SqlExpr.hpp> // Pascal unit #include <DBWeb.hpp> // Pascal unit #include <DB.hpp> // Pascal unit #include <HTTPProd.hpp> // Pascal unit #include <HTTPApp.hpp> // Pascal unit #include <Classes.hpp> // Pascal unit #include <SysUtils.hpp> // Pascal unit #include <SysInit.hpp> // Pascal unit #include <System.hpp> // Pascal unit //-- user supplied ----------------------------------------------------------- namespace Dbxpressweb { //-- type declarations ------------------------------------------------------- class DELPHICLASS TSQLQueryTableProducer; class PASCALIMPLEMENTATION TSQLQueryTableProducer : public Dbweb::TDSTableProducer { typedef Dbweb::TDSTableProducer inherited; private: Sqlexpr::TSQLQuery* FQuery; void __fastcall SetQuery(Sqlexpr::TSQLQuery* AQuery); protected: virtual Db::TDataSet* __fastcall GetDataSet(void); virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation); virtual void __fastcall SetDataSet(Db::TDataSet* ADataSet); public: virtual AnsiString __fastcall Content(); __published: __property Caption ; __property CaptionAlignment = {default=0}; __property Columns ; __property Footer ; __property Header ; __property MaxRows = {default=20}; __property Sqlexpr::TSQLQuery* Query = {read=FQuery, write=SetQuery}; __property RowAttributes ; __property TableAttributes ; __property OnCreateContent ; __property OnFormatCell ; __property OnGetTableCaption ; public: #pragma option push -w-inl /* TDSTableProducer.Create */ inline __fastcall virtual TSQLQueryTableProducer(Classes::TComponent* AOwner) : Dbweb::TDSTableProducer(AOwner) { } #pragma option pop #pragma option push -w-inl /* TDSTableProducer.Destroy */ inline __fastcall virtual ~TSQLQueryTableProducer(void) { } #pragma option pop }; //-- var, const, procedure --------------------------------------------------- } /* namespace Dbxpressweb */ using namespace Dbxpressweb; #pragma option pop // -w- #pragma option pop // -Vx #pragma delphiheader end. //-- end unit ---------------------------------------------------------------- #endif // DBXpressWeb
[ "bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b" ]
[ [ [ 1, 78 ] ] ]
c85ea884db6c9174ac13b1167df1382c9395e7fb
2abb585385b708be5825042ca15efca03328c1f7
/pdf/pdf/types.cpp
3bdbfc48fbaf2235705d2d9077fb2de331284a5d
[]
no_license
chrisforbes/pdf
8969574e1b05d4bda55b4e92196be0fc86cb32ac
48b307aac7584414024bc384cadd5b8e86f6b48d
refs/heads/master
2021-01-22T11:58:23.401370
2009-01-04T22:43:44
2009-01-04T22:43:44
571,974
1
0
null
null
null
null
UTF-8
C++
false
false
2,568
cpp
#include "pch.h" #include "parse.h" #include "filters.h" // The "None" PNG predictor static void Flate_None( char* dest, const char* src, int width ) { for( int i = 0 ; i < width ; i++ ) dest[i] = src[i]; } // The "Left" PNG predictor static void Flate_Left( char* dest, const char* src, int width ) { char left = 0; for( int i = 0 ; i < width ; i++ ) dest[i] = left = src[i] + left; } // The "Up" PNG predictor static void Flate_Up( char* dest, const char* src, int width, const char* prevRow ) { if( prevRow ) for( int i = 0 ; i < width ; i++ ) dest[i] = src[i] + prevRow[i]; else Flate_None( dest, src, width ); } const char* Stream::ApplyFilter( const Name& filterName, PDictionary filterParms, const char* inputStart, const char* inputEnd, size_t * outputLength, XrefTable const & objmap ) { if( filterName.str == String( "FlateDecode" ) ) { char* data = Inflate( inputStart, inputEnd, outputLength, realloc ); if( !filterParms ) return data; PNumber numCols = filterParms->Get<Number>( "Columns", objmap ); int columns = numCols ? numCols->num : 1; PNumber numPredictor = filterParms->Get<Number>( "Predictor", objmap ); int predictor = numPredictor ? numPredictor->num : 1; switch( predictor ) { case 1: return data; case 10: // Any of these mean "use the png predictor". case 11: // The predictor is chosen on a scanline-by-scanline basis. case 12: case 13: case 14: { // TODO: more parms: "Colors", "BitsPerComponent" const char* prev = NULL; const char* current = data; char* current_out = data; while( current < data + *outputLength ) { switch( *current++ ) { //case 0: // Flate_None( current_out, current, columns ); // break; //case 1: // Flate_Left( current_out, current, columns ); // break; case 2: Flate_Up( current_out, current, columns, prev ); break; default: assert( !"win?" ); Flate_None( current_out, current, columns ); break; } prev = current_out; current += columns; current_out += columns; } *outputLength = current_out - data; return data; } default: DebugBreak(); return NULL; } } else if( filterName.str == String( "DCTDecode" ) ) { size_t width, height; char* data = DCTDecode( inputStart, inputEnd - inputStart, *outputLength, width, height ); return data; } else { //DebugBreak(); return NULL; } }
[ "bob@730c6d82-bc93-41d3-a1c5-aa4189891d44" ]
[ [ [ 1, 103 ] ] ]
f7d41a042d4d896486d1f09ca8d595e50224e22d
0f8559dad8e89d112362f9770a4551149d4e738f
/Wall_Destruction/Havok/Source/Common/GeometryUtilities/Matching/hkGeometryMatchingUtils.inl
78806328e7cd1019d7b78b1f2847f6adfcce2be9
[]
no_license
TheProjecter/olafurabertaymsc
9360ad4c988d921e55b8cef9b8dcf1959e92d814
456d4d87699342c5459534a7992f04669e75d2e1
refs/heads/master
2021-01-10T15:15:49.289873
2010-09-20T12:58:48
2010-09-20T12:58:48
45,933,002
0
0
null
null
null
null
UTF-8
C++
false
false
3,095
inl
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ HK_FORCE_INLINE hkGeometryMatchingUtils::Geometry::Geometry() { m_vertexStride = sizeof(hkVector4); m_triangleIndexStride = sizeof(int) * 3; } HK_FORCE_INLINE const hkGeometryMatchingUtils::TriangleMap::Hit& hkGeometryMatchingUtils::TriangleMap::getBestMatchingTriangle( int geometryIndex, int triangleIndex) const { const hkUint32 startIndex = m_startIndexPerGeometry[geometryIndex]; return m_foundReferenceTriangle[ startIndex + triangleIndex ]; } HK_FORCE_INLINE hkGeometryMatchingUtils::Geometry::Geometry( const hkGeometry* geometry ) { m_vertices = geometry->m_vertices.begin(); m_numVertices = geometry->m_vertices.getSize(); m_triangleIndices = &geometry->m_triangles.begin()->m_a; m_numTriangles = geometry->m_triangles.getSize(); m_triangleIndexStride = sizeof(hkGeometry::Triangle); m_vertexStride = sizeof(hkVector4); } HK_FORCE_INLINE void hkGeometryMatchingUtils::FullMap::getBestMatchingVertex (int searchGeometryIndex, int searchVertexIndex, VertexHit& hitOut) const { const VertexTriangleEntry& vTri = _getSearchTriangleForSearchVertex(searchGeometryIndex, searchVertexIndex); const TriangleMap::Hit& tHit = m_triangleMap.getBestMatchingTriangle(searchGeometryIndex, vTri.m_triangleIndex); hitOut.m_geometryIndex = tHit.m_geometryIndex; hitOut.m_triangleIndex = tHit.m_triangleIndex; if (!tHit.m_flippedWinding) { hitOut.m_trianglePos = (vTri.m_trianglePos + tHit.m_indexOffset) % 3; } else { hitOut.m_trianglePos = ((3-vTri.m_trianglePos) + tHit.m_indexOffset) % 3; } } HK_FORCE_INLINE const hkGeometryMatchingUtils::FullMap::VertexTriangleEntry& hkGeometryMatchingUtils::FullMap::_getSearchTriangleForSearchVertex (int searchGeometryIndex, int searchVertexIndex) const { const hkUint32 startIndex = m_startEntryPerGeometry[searchGeometryIndex]; return m_searchTrianglePerSearchVertex [startIndex + searchVertexIndex]; } /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222) * * Confidential Information of Havok. (C) Copyright 1999-2009 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
[ [ [ 1, 70 ] ] ]
91fdcb135763a7b7b55d1041ffdcd9ab939f613e
e7c45d18fa1e4285e5227e5984e07c47f8867d1d
/Common/Scd/ScdLib/CM_CNTRL.H
21abbd2e320362d68f1aff8addf9323a5c6ffa94
[]
no_license
abcweizhuo/Test3
0f3379e528a543c0d43aad09489b2444a2e0f86d
128a4edcf9a93d36a45e5585b70dee75e4502db4
refs/heads/master
2021-01-17T01:59:39.357645
2008-08-20T00:00:29
2008-08-20T00:00:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,423
h
//================== SysCAD - Copyright Kenwalt (Pty) Ltd =================== // $Nokeywords: $ //=========================================================================== // SysCAD Copyright Kenwalt (Pty) Ltd 1992,1994 #ifndef __CM_CNTRL_H #define __CM_CNTRL_H #ifndef __SC_DEFS_H #include "sc_defs.h" #endif #ifndef __TAGOBJ_H #include "tagobj.h" #endif #ifndef __VECTORS_H #include "vectors.h" #endif #ifndef __CMINIMUM_H #include "cminimum.h" #endif #ifdef __CM_CNTRL_CPP #define DllImportExport DllExport #elif !defined(SCDLIB) #define DllImportExport DllImport #else #define DllImportExport #endif // =========================================================================== _FWDDEF(CMFControls); class DllImportExport CMFControls : public CMFCommon { protected: CDVector DeltaParms; double Sa; int iIter; int iItMax; double dTol; public: CMFControls(CCMinFinder *pFn_, double Tol=1.0e-6, int ItMax_=100); double SetRestrParms(double Alpha, CDVector & NextParms, CDVector & DeltaParms); flag ConstructLBMatrix(CDVector &NParms, CDVector &ParmTols, CDMatrix &Z, CDVector &C); int Solve(); }; // =========================================================================== #undef DllImportExport #endif
[ [ [ 1, 59 ] ] ]
6d8306641538bdf0298228007e7366561a8f98c7
99a2728f6ac5193c6d2f95f1d8d739463a216d83
/android/jni/nv/nv_sound/nv_sound.cpp
256d9ff21166e94fee9eb07d71bf2ed3b22b6b2a
[]
no_license
LeifAndersen/MarbleMachine
d78d1a14dd3d10bf0bf4c0701d3d2d2db7658a3e
4dd06c0f817a0b177ae1c288b754dabbc9b361d5
refs/heads/master
2021-01-22T06:54:52.572160
2011-08-24T17:28:15
2011-08-24T17:28:15
null
0
0
null
null
null
null
ISO-8859-4
C++
false
false
5,611
cpp
//---------------------------------------------------------------------------------- // File: libs\jni\nv_sound\nv_sound.cpp // Samples Version: Android NVIDIA samples 2 // Email: [email protected] // Forum: http://developer.nvidia.com/tegra/forums/tegra-forums/android-development // // Copyright 2009-2010 NVIDIAŽ Corporation // // 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 <jni.h> #include <android/log.h> #include <stdlib.h> #include "../nv_thread/nv_thread.h" #define MODULE "soundlib" #define THE_ACTIVITY "com/nvidia/devtech/AudioHelper" #include "nv_sound.h" static jobject s_globalThiz; static jclass NvAudioHelper_class; static jmethodID s_load; static jmethodID s_loadasset; static jmethodID s_resume; static jmethodID s_stop; static jmethodID s_play; static jmethodID s_volume; static jmethodID s_unload; static jmethodID s_source; static jmethodID s_startmusic; static jmethodID s_musicvolume; static jmethodID s_stopmusic; static jmethodID s_maxvolume; void NvSoundInit() { JNIEnv *env = NVThreadGetCurrentJNIEnv(); NvAudioHelper_class = env->FindClass(THE_ACTIVITY); jmethodID getInstance = env->GetStaticMethodID(NvAudioHelper_class, "getInstance", "()Lcom/nvidia/devtech/AudioHelper;"); __android_log_print(ANDROID_LOG_DEBUG, "apk", "inst = %d\n", (int)getInstance); s_load = env->GetMethodID(NvAudioHelper_class, "LoadSound", "(Ljava/lang/String;I)I"); s_loadasset = env->GetMethodID(NvAudioHelper_class, "LoadSoundAsset", "(Ljava/lang/String;I)I"); s_resume = env->GetMethodID(NvAudioHelper_class, "ResumeSound", "(I)V"); s_stop = env->GetMethodID(NvAudioHelper_class, "StopSound", "(I)V"); s_play = env->GetMethodID(NvAudioHelper_class, "PlaySound", "(IFFIIF)I"); s_volume = env->GetMethodID(NvAudioHelper_class, "SetVolume", "(IFF)V"); s_unload = env->GetMethodID(NvAudioHelper_class, "UnloadSample", "(I)Z"); s_source = env->GetMethodID(NvAudioHelper_class, "MusicSetDataSource", "(Ljava/lang/String;)V"); s_startmusic = env->GetMethodID(NvAudioHelper_class, "MusicStart", "()V"); s_musicvolume = env->GetMethodID(NvAudioHelper_class, "MusicVolume", "(FF)V"); s_stopmusic = env->GetMethodID(NvAudioHelper_class, "MusicStop", "()V"); s_maxvolume = env->GetMethodID(NvAudioHelper_class, "SetMaxVolume", "()V"); jobject thiz = env->CallStaticObjectMethod(NvAudioHelper_class, getInstance); if (thiz == NULL) { __android_log_print(ANDROID_LOG_DEBUG, MODULE, "no this"); } s_globalThiz = env->NewGlobalRef(thiz); } void NVSoundShutdown() { s_globalThiz = NULL; } int SoundPoolLoadSFX(const char *FileName, int Priority) { int SoundID; JNIEnv *env = NVThreadGetCurrentJNIEnv(); jstring s = env->NewStringUTF(FileName); SoundID = env->CallIntMethod(s_globalThiz, s_load, s, Priority); env->DeleteLocalRef((jobject)s); return SoundID; } int SoundPoolLoadSFXAsset(const char *FileName, int Priority) { int SoundID; JNIEnv *env = NVThreadGetCurrentJNIEnv(); jstring s = env->NewStringUTF(FileName); SoundID = env->CallIntMethod(s_globalThiz, s_loadasset, s, Priority); env->DeleteLocalRef((jobject)s); return SoundID; } void SoundPoolResume(int StreamID) { JNIEnv *env = NVThreadGetCurrentJNIEnv(); env->CallVoidMethod(s_globalThiz, s_resume, StreamID); } void SoundPoolStop(int StreamID) { JNIEnv *env = NVThreadGetCurrentJNIEnv(); jint i = StreamID; env->CallVoidMethod(s_globalThiz, s_stop, i); } int SoundPoolPlaySound(int SoundID, float LeftVolume, float RightVolume, int Priority, int Loop, float Rate) { JNIEnv *env = NVThreadGetCurrentJNIEnv(); return env->CallIntMethod(s_globalThiz, s_play, SoundID, LeftVolume, RightVolume, Priority, Loop, Rate); } void SoundPoolSetVolume(int StreamID, float LeftVolume, float RightVolume) { JNIEnv *env = NVThreadGetCurrentJNIEnv(); env->CallVoidMethod(s_globalThiz, s_volume, StreamID, LeftVolume, RightVolume); } bool SoundPoolUnloadSample(int SoundID) { JNIEnv *env = NVThreadGetCurrentJNIEnv(); return env->CallBooleanMethod(s_globalThiz, s_unload, SoundID); } void MediaPlayerSetDataSource(const char* FileName) { JNIEnv *env = NVThreadGetCurrentJNIEnv(); jstring s = env->NewStringUTF(FileName); env->CallVoidMethod(s_globalThiz, s_source, s); env->DeleteLocalRef((jobject)s); } void MediaPlayerStart() { JNIEnv *env = NVThreadGetCurrentJNIEnv(); env->CallVoidMethod(s_globalThiz, s_startmusic); } void MediaPlayerSetVolume(float LeftVolume, float RightVolume) { JNIEnv *env = NVThreadGetCurrentJNIEnv(); env->CallVoidMethod(s_globalThiz, s_musicvolume, LeftVolume, RightVolume); } void MediaPlayerStop() { JNIEnv *env = NVThreadGetCurrentJNIEnv(); env->CallVoidMethod(s_globalThiz, s_stopmusic); } void MediaSetMaxVolume() { JNIEnv *env = NVThreadGetCurrentJNIEnv(); env->CallVoidMethod(s_globalThiz, s_maxvolume); }
[ [ [ 1, 185 ] ] ]
daaf926100550554439d2904881405d0b3000d7b
b24d5382e0575ad5f7c6e5a77ed065d04b77d9fa
/RadiantLaserCross/RLC_GameConfig.h
4fe43e8b3c850b1062e4494ce68eff08070c7b3c
[]
no_license
Klaim/radiant-laser-cross
f65571018bf612820415e0f672c216caf35de439
bf26a3a417412c0e1b77267b4a198e514b2c7915
refs/heads/master
2021-01-01T18:06:58.019414
2010-11-06T14:56:11
2010-11-06T14:56:11
32,205,098
0
0
null
null
null
null
UTF-8
C++
false
false
1,524
h
#ifndef RLC_GAMECONFIG_H #define RLC_GAMECONFIG_H #pragma once #include <string> namespace rlc { namespace config { extern const unsigned int SCREEN_WIDTH; extern const unsigned int SCREEN_HEIGHT; extern unsigned int GAME_SCENE_WIDTH; extern unsigned int GAME_SCENE_HEIGHT; extern const std::string GAME_TITLE; extern const float TICK_TIME; extern float PLAYER_SHIP_SPEED; extern int KEYBOARD_PLAYERSHIP_MOVE_LEFT; extern int KEYBOARD_PLAYERSHIP_MOVE_RIGHT; extern int KEYBOARD_PLAYERSHIP_MOVE_UP; extern int KEYBOARD_PLAYERSHIP_MOVE_DOWN; extern int KEYBOARD_PLAYERSHIP_FIRE_LEFT; extern int KEYBOARD_PLAYERSHIP_FIRE_RIGHT; extern int KEYBOARD_PLAYERSHIP_FIRE_UP; extern int KEYBOARD_PLAYERSHIP_FIRE_DOWN; extern int KEYBOARD_PLAYERSHIP_ROTATE_LEFT; extern int KEYBOARD_PLAYERSHIP_ROTATE_RIGHT; extern int JOYSTICK_PLAYERSHIP_FIRE_LEFT; extern int JOYSTICK_PLAYERSHIP_FIRE_RIGHT; extern int JOYSTICK_PLAYERSHIP_FIRE_UP; extern int JOYSTICK_PLAYERSHIP_FIRE_DOWN; extern int JOYSTICK_PLAYERSHIP_ROTATE_LEFT; extern int JOYSTICK_PLAYERSHIP_ROTATE_RIGHT; extern int JOYSTICK_PLAYERSHIP_ROTATE_AXIS; extern int JOYSTICK_PLAYERSHIP_FIRE_AXIS_X; extern int JOYSTICK_PLAYERSHIP_FIRE_AXIS_Y; /** Load the config file if it exists and extract all configuration informations it can find in it. The config file is assumed to be written in the INFO format. */ void load_config(); } } #endif
[ [ [ 1, 61 ] ] ]
10393a1a6ab590b62754d0b5c097b4f6f672909e
b0b51867bd6404c1a3f7e8e29c594534431429b9
/madvnc/madserver/MadServer.cpp
e6dca3443e83fe45aaf433e1a7f3c7a503de72b5
[]
no_license
atay/madvnc
110e66ed1dd1105216a86e809e6b919713e43080
941d21f042b90c9b561eec987f0d5801a78952af
refs/heads/master
2016-08-12T03:23:36.195227
2009-09-10T19:18:51
2009-09-10T19:18:51
49,885,594
0
0
null
null
null
null
UTF-8
C++
false
false
235
cpp
#include "MadServer.h" MadServer::MadServer(){ madThread.start(); } void MadServer::startGrab(){ timer.start(); timer1.start(); } void MadServer::stats(){ qDebug() << madShooter->count/5; madShooter->count=0; }
[ "tadeusz.krzeminski@dbcee788-5dd4-11de-8c10-5fe6993ea61f", "marcin.s.cygan@dbcee788-5dd4-11de-8c10-5fe6993ea61f" ]
[ [ [ 1, 14 ] ], [ [ 15, 15 ] ] ]
fd56ab3ad7dee62f8a8fdaa4f0dd8220027ccc03
d0cf8820b4ad21333e15f7cec1e4da54efe1fdc5
/DES_GOBSTG/DES_GOBSTG/Core/Parser.cpp
28fe577872a75398453e593f3d598c1f50279ad5
[]
no_license
CBE7F1F65/c1bf2614b1ec411ee7fe4eb8b5cfaee6
296b31d342e39d1d931094c3dfa887dbb2143e54
09ed689a34552e62316e0e6442c116bf88a5a88b
refs/heads/master
2020-05-30T14:47:27.645751
2010-10-12T16:06:11
2010-10-12T16:06:11
32,192,658
0
0
null
null
null
null
UTF-8
C++
false
false
49,667
cpp
#include "Scripter.h" #include "processPrep.h" bool Scripter::Parse() { for(vector<Script>::iterator i=pnow->begin();i!=pnow->end();i++) { bool rv = false; int depth = 0; if(!i->value) continue; //Filter Type DWORD nowval = i->value; switch (nowval & SCRKWMASK_TYPE) { /************************************************************************/ /* Action */ /************************************************************************/ case SCRKW_ACTION: switch (nowval) { case SCR_SD: if(rv = Copy(&i, 2)) { int _tdi = CAST(d[0]); CINT(d[_tdi].value) = CAST(d[1]); d[_tdi].bfloat = false; } break; case SCR_SDF: if(rv = Copy(&i, 2)) { int _tdi = CAST(d[0]); CFLOAT(d[_tdi].value) = CAST(d[1]); d[_tdi].bfloat = true; } break; case SCR_SDU: if(rv = Copy(&i, 2)) { int _tdi = CAST(d[0]); CUINT(d[_tdi].value) = CUINT(d[1].value); d[_tdi].bfloat = false; } break; case SCR_ST: if(rv = Copy(&i, 3)) { int _tdi = CAST(d[0]); tar[_tdi].x = CAST(d[1]); tar[_tdi].y = CAST(d[2]); } break; case SCR_CALL: if(rv = Copy(&i, 2)) { vector<Script> * psaved = pnow; functionExecute(UCAST(d[0]), UCAST(d[1])); pnow = psaved; } break; case SCR_EXECUTE: if(rv = Copy(&i, 3)) { vector<Script> * psaved = pnow; Execute(UCAST(d[0]) + SCRIPT_CTOFFSET, UCAST(d[1]), UCAST(d[2])); pnow = psaved; } break; case SCR_RETURN: if(rv = Copy(&i, 1)) { mp.retvalue = CAST(d[0]); return true; } break; case SCR_SETSTATE: if(rv = Copy(&i, 1)) { mp.state = CAST(d[0]); } break; case SCR_SETTIME: if(rv = Copy(&i, 1)) { time = CAST(d[0]); } break; case SCR_SETDIFFI: if(rv = Copy(&i, 1)) { mp.nowdifflv = CAST(d[0]); if(mp.nowdifflv < 3) mp.defaultdifflv = mp.nowdifflv; } break; case SCR_SETCHARA: if(rv = Copy(&i, 1)) { mp.luchara = CAST(d[0]); Player::p.ID = mp.luchara << 1; } break; case SCR_SETSCENE: if(rv = Copy(&i, 1)) { mp.scene = CAST(d[0]); } break; case SCR_SETMODE: if(rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); mp.rangemode = (bool)(_tdi & RPYMODE_RANGE); mp.practicemode = (bool)(_tdi & RPYMODE_PRACTICE); } break; case SCR_SETKEY: if (rv = Copy(&i, 2)) { hge->Input_SetDIKey(CAST(d[0]), CAST(d[1])); } break; case SCR_DISABLEALLKEY: if (rv = true) { hge->Input_SetDIKey(KS_FIRE_MP, false); hge->Input_SetDIKey(KS_BOMB_MP, false); hge->Input_SetDIKey(KS_CIRCLE_MP, false); hge->Input_SetDIKey(KS_SLOW_MP, false); hge->Input_SetDIKey(KS_UP_MP, false); hge->Input_SetDIKey(KS_DOWN_MP, false); hge->Input_SetDIKey(KS_LEFT_MP, false); hge->Input_SetDIKey(KS_RIGHT_MP, false); } break; case SCR_MUSICCHANGE: if(rv = Copy(&i, 2)) { mp.musicChange(CAST(d[0]), (bool)(CAST(d[1]))); } break; case SCR_MUSICSLIDE: if (rv = Copy(&i, 2)) { mp.musicSlide(CAST(d[0]), CAST(d[1])); } case SCR_SE: if(rv = Copy(&i, 2)) { SE::push(CAST(d[0]), CAST(d[1])); } break; case SCR_SEOFF: if (rv = Copy(&i, 1)) { SE::stop(CAST(d[0])); } case SCR_EFFSETUP: if (rv = Copy(&i, 5)) { int _tdi = CAST(d[0]); effsys[_tdi].valueSet(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4])); } break; case SCR_EFFSETUPEX: if(rv = Copy(&i, 10)) { int _tdi = CAST(d[0]); effsys[_tdi].valueSet(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), CAST(d[9])); } break; case SCR_EFFSETUPCHASE: if (rv = Copy(&i, 8)) { int _tdi = CAST(d[0]); effsys[_tdi].valueSet(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7])); } break; case SCR_EFFSTOP: if (rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if (effsys[_tdi].exist && effsys[_tdi].eff) { effsys[_tdi].Stop(); } } break; case SCR_EFFOFF: if(rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); effsys[_tdi].exist = false; } break; case SCR_EFFSET: if(rv = Copy(&i, 4)) { int _tdi = CAST(d[0]); effsys[_tdi].angle = CAST(d[1]); effsys[_tdi].speed = CAST(d[2]); effsys[_tdi].zSpeed = CAST(d[3]); } break; case SCR_EFFMOVETO: if(rv = Copy(&i, 4)) { int _tdi = CAST(d[0]); effsys[_tdi].x = CAST(d[1]); effsys[_tdi].y = CAST(d[2]); effsys[_tdi].z = CAST(d[3]); } break; case SCR_BOSSSTORE: if (rv = true) { Enemy::bossflag[en[Enemy::index].type - ENEMY_BOSSTYPEBEGIN] = BOSS_STORE; } break; case SCR_BOSSATTACK: if (rv = true) { Enemy::bossflag[en[Enemy::index].type - ENEMY_BOSSTYPEBEGIN] = BOSS_ATTACK; } break; } break; /************************************************************************/ /* Basic */ /************************************************************************/ case SCRKW_BASIC: switch (nowval & SCRKWMASK_CLASS) { /************************************************************************/ /* AttackObject */ /************************************************************************/ case SCRKW_CLASS_ATTACKOBJECT: switch (nowval) { case SCR_BUBUILD: if(rv = Copy(&i, 10)) { Bullet::Build(CAST(d[0]), CAST(d[1]), (bool)(CAST(d[2])), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), CAST(d[9])); } break; case SCR_BUACTIONSET: if(rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if(!_tdi) { Bullet::_bu.actionList[0] = SECTIONEND; } else if(rv = Copy(&i, _tdi)) { for(int j=0;j<_tdi;j++) { Bullet::_bu.actionList[j] = CAST(d[j]); } Bullet::_bu.actionList[_tdi] = SECTIONEND; } } break; case SCR_BUBUILDCIRCLE: if (rv = Copy(&i, 9)) { int _tnum = CAST(d[0]); int _tanglebase; int _tanglestep = 36000 / _tnum; float _tx = CAST(d[2]); float _ty = CAST(d[3]); float _tspeed = CAST(d[4]); BYTE _ttype = CAST(d[5]); BYTE _tcolor = CAST(d[6]); int _tfadeintime = CAST(d[7]); float _tavoid = CAST(d[8]); if (CAST(d[1])) { _tanglebase = RANDA; } else { BObject _tobj; _tobj.x = _tx; _tobj.y = _ty; _tanglebase = _tobj.aMainAngle(Player::p); } for (int i=0; i<_tnum; i++) { Bullet::Build(_tx, _ty, true, _tanglebase + i * _tanglestep, _tspeed, _ttype, _tcolor, _tfadeintime, _tavoid, 0xff); } } break; case SCR_BUDECANCEL: if (rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if (_tdi >= 0 && _tdi < BULLETMAX) { if (bu.toIndex(_tdi) != VECLST_INDEXERROR) { (*bu).cancelable = false; } } break; } break; case SCR_BEBUILD: if(rv = Copy(&i, 11)) { Beam::Build(CAST(d[0]), CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), (bool)(CAST(d[7])), (bool)(CAST(d[8])), CAST(d[9]), CAST(d[10])); } break; case SCR_BEVECTOR: if (rv = Copy(&i, 5)) { int _tdi = CAST(d[0]); if (be.toIndex(_tdi) != VECLST_INDEXERROR) { if (be.isInRange() && be.isValid()) { if ((*be).able) { (*be).SetVector(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4])); } } } } break; case SCR_BEHOLD: if (rv = Copy(&i, 3)) { int _tdi = CAST(d[0]); if (be.toIndex(_tdi) != VECLST_INDEXERROR) { if (be.isInRange() && be.isValid()) { if ((*be).able) { (*be).SetHold(CAST(d[1])); (*be).angle = CAST(d[2]); } } } } break; case SCR_BEPIN: if (rv = Copy(&i, 3)) { int _tdi = CAST(d[0]); if (be.toIndex(_tdi) != VECLST_INDEXERROR) { if (be.isInRange() && be.isValid()) { if ((*be).able) { (*be).SetHold(CAST(d[1]), CAST(d[2])); } } } } break; } break; /************************************************************************/ /* Ghost */ /************************************************************************/ case SCRKW_CLASS_GHOST: switch (nowval) { case SCR_GHBUILD: if(rv = Copy(&i, 10)) { Ghost::Build(CAST(d[0]), CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), CAST(d[9])); } break; case SCR_GHSAIM: if(rv = Copy(&i, 2)) { gh[Ghost::index].aim.x = CAST(d[0]); gh[Ghost::index].aim.y = CAST(d[1]); } break; case SCR_GHSET: if(rv = Copy(&i, 3)) { gh[Ghost::index].speed = CAST(d[0]); gh[Ghost::index].angle = CAST(d[1]); gh[Ghost::index].ac = CAST(d[2]); } break; case SCR_GHCHASE: if (rv = Copy(&i, 3)) { gh[Ghost::index].chaseAim(CAST(d[0]), CAST(d[1]), CAST(d[2])); } break; } break; /************************************************************************/ /* Enemy */ /************************************************************************/ case SCRKW_CLASS_ENEMY: switch (nowval) { case SCR_ENTEXASSIGN: if(rv = Copy(&i, ENEMY_TEXMAX)) { int _tdi[ENEMY_TEXMAX]; for(int j=0; j<ENEMY_TEXMAX; j++) { _tdi[j] = CAST(d[j]); } Enemy::texAssign(mp.tex[_tdi[0]], mp.tex[_tdi[1]], mp.tex[_tdi[2]], mp.tex[_tdi[3]]); } break; case SCR_ENBUILD: if(rv = Copy(&i, 10)) { Enemy::Build(CAST(d[0]), CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), UCAST(d[9])); } break; case SCR_ENACTIONSET: if(rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if(rv = Copy(&i, _tdi)) { if(_tdi) { en[Enemy::index].ac = CAST(d[0]); for(int j=0;j<_tdi-1;j++) { en[Enemy::index].para[j] = CAST(d[j+1]); } } } } break; case SCR_ENSAIM: if(rv = Copy(&i, 2)) { en[Enemy::index].aim.x = CAST(d[0]); en[Enemy::index].aim.y = CAST(d[1]); } break; case SCR_ENCHASE: if (rv = Copy(&i, 3)) { en[Enemy::index].chaseAim(CAST(d[0]), CAST(d[1]), CAST(d[2])); } break; } break; /************************************************************************/ /* Math */ /************************************************************************/ case SCRKW_CLASS_MATH: switch (nowval) { case SCR_RAMA: if(rv = Copy(&i, 7)) { int _tdi = CAST(d[6]); BObject _tobj; _tobj.x = CAST(d[1]); _tobj.y = CAST(d[2]); if(CAST(d[0])) { CINT(d[_tdi].value) = _tobj.rMainAngle(CAST(d[3]), CAST(d[4]), CAST(d[5])); } else { CINT(d[_tdi].value) = _tobj.aMainAngle(CAST(d[3]), CAST(d[4]), CAST(d[5])); } d[_tdi].bfloat = false; } break; case SCR_DIST: if (rv = Copy(&i, 5)) { int _tdi = CAST(d[4]); float _txo = CAST(d[0]); float _tyo = CAST(d[1]); float _txa = CAST(d[2]); float _tya = CAST(d[3]); CFLOAT(d[_tdi].value) = DIST(_txo, _tyo, _txa, _tya); d[_tdi].bfloat = true; } break; } break; /************************************************************************/ /* Other */ /************************************************************************/ case SCRKW_CLASS_OTHER: switch (nowval) { } break; /************************************************************************/ /* Special */ /************************************************************************/ case SCRKW_CLASS_SPECIAL: switch (nowval) { case SCR_BOSSUP: if(rv = true) { bossinfo.bossUp(); } break; case SCR_RANGEUP: if(rv = Copy(&i, 3)) { if(mp.rangemode) { int _tdi = CAST(d[0]); tar[_tdi].x = CAST(d[1]); tar[_tdi].y = CAST(d[2]); } } break; case SCR_ACONTROL: if (rv = Copy(&i, 2)) { int _tindex = CAST(d[0]); if (_tindex >= 0 && _tindex < BULLETMAX) { if (bu.toIndex(_tindex) != VECLST_INDEXERROR) { if (bu.isInRange() && bu.isValid()) { if ((*bu).able) { int _tdi = CAST(d[1]); if(!_tdi) { (*bu).actionList[0] = SECTIONEND; } else if(rv = Copy(&i, _tdi)) { for(int j=0;j<_tdi;j++) { (*bu).actionList[j] = CAST(d[j]); } (*bu).actionList[_tdi] = SECTIONEND; } } } } } } break; case SCR_BCONTROL: if(rv = Copy(&i, 7)) { BObject * _tobj = NULL; int _ttype = CAST(d[0]); int _tdi = CAST(d[1]); int _tindex = CAST(d[_tdi]); if(_tindex == BINDEX_NULL) break; switch(_ttype) { case BTYPE_BULLET: if (_tindex >= 0 && _tindex < BULLETMAX) { if (bu.toIndex(_tindex) != VECLST_INDEXERROR) { if (bu.isInRange() && bu.isValid()) { if ((*bu).able) { _tobj = &(*bu); } } } } break; case BTYPE_BEAM: if (_tindex >= 0 && _tindex < BEAMMAX) { if (be.toIndex(_tindex) != VECLST_INDEXERROR) { if (be.isInRange() && be.isValid()) { if ((*be).able) { _tobj = &(*be); } } } } break; case BTYPE_ENEMY: if(en[_tindex].able) _tobj = &en[_tindex]; break; case BTYPE_GHOST: if(gh[_tindex].able) _tobj = &gh[_tindex]; break; } if(_tobj) { _tobj->x = CAST(d[2]); _tobj->y = CAST(d[3]); _tobj->angle = CAST(d[4]); _tobj->headangle = CAST(d[5]); _tobj->speed = CAST(d[6]); } else { CINT(d[_tdi].value) = BINDEX_NULL; d[_tdi].bfloat = false; } } break; case SCR_COLLISION_CIRCLE: if (rv = Copy(&i, 6)) { int _tdi = CAST(d[5]); BObject _tobj; _tobj.x = CAST(d[0]); _tobj.y = CAST(d[1]); CINT(d[_tdi].value) = _tobj.checkCollisionCircle(CAST(d[2]), CAST(d[3]), CAST(d[4])); d[_tdi].bfloat = false; } break; case SCR_COLLISION_SQUARE: if (rv = Copy(&i, 6)) { int _tdi = CAST(d[5]); BObject _tobj; _tobj.x = CAST(d[0]); _tobj.y = CAST(d[1]); CINT(d[_tdi].value) = _tobj.checkCollisionSquare(CAST(d[2]), CAST(d[3]), CAST(d[4])); d[_tdi].bfloat = false; } break; } break; /************************************************************************/ /* Effect */ /************************************************************************/ case SCRKW_CLASS_EFFECT: switch (nowval) { } break; /************************************************************************/ /* Player */ /************************************************************************/ case SCRKW_CLASS_PLAYER: switch (nowval) { case SCR_SETPPOS: if (rv = Copy(&i, 2)) { float _tdfx = CAST(d[0]); float _tdfy = CAST(d[1]); _tdfx = _tdfx < PL_MOVABLE_LEFT ? PL_MOVABLE_LEFT : _tdfx; _tdfx = _tdfx > PL_MOVABLE_RIGHT ? PL_MOVABLE_RIGHT : _tdfx; _tdfy = _tdfy < PL_MOVABLE_TOP ? PL_MOVABLE_TOP : _tdfy; _tdfy = _tdfy > PL_MOVABLE_BOTTOM ? PL_MOVABLE_BOTTOM : _tdfy; Player::p.x = _tdfx; Player::p.y = _tdfy; } break; case SCR_SETPLIFE: if (rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if (_tdi < 0) { break; } Player::p.nLife = _tdi > M_PL_PLAYERMAX ? M_PL_PLAYERMAX : _tdi; } break; case SCR_SETPBOMB: if (rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if (_tdi < 0) { break; } Player::p.nBomb = _tdi > M_PL_BOMBMAX ? M_PL_BOMBMAX : _tdi; } break; case SCR_SETPPOWER: if(rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if (_tdi < 0) { break; } Player::p.nPower = _tdi; if(Player::p.nPower >= PL_POWERMAX) { Player::p.nPower = PL_POWERMAX; Player::p.bFull = true; } else { Player::p.bFull = false; } } break; case SCR_SETPALIVENESS: if (rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if (_tdi < 0) { break; } Player::p.nAliveness = _tdi; } break; case SCR_SETPPOINT: if (rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); if (_tdi < 0) { break; } Player::p.nPoint = _tdi; } break; case SCR_SETPBCIRCLE: if (rv = Copy(&i, 1)) { if ((bool)(CAST(d[0])) ^ Player::p.bCircle) { Player::p.callCircleUncircleChange(); } } break; case SCR_SETPBSLOW: if (rv = Copy(&i, 1)) { Player::p.callSlowFastChange((bool)(CAST(d[0]))); } break; case SCR_SETPBINFI: if(rv = true) { Player::p.bInfi = true; } break; case SCR_SETPSPEED: if (rv = Copy(&i, 1)) { Player::p.speed = CAST(d[0]); } break; case SCR_SETPSLOWSPEED: if (rv = Copy(&i, 1)) { Player::p.slowspeed = CAST(d[0]); } break; case SCR_COLLAPSE: if (rv = true) { Player::p.callCollapse(); } break; } break; /************************************************************************/ /* Layer */ /************************************************************************/ case SCRKW_CLASS_LAYER: switch (nowval) { case SCR_BGVALUE: if(rv = Copy(&i, 11)) { int _tdi = CAST(d[0]); int _tdtexi = CAST(d[1]); ubg[_tdi]->valueSet(mp.tex[_tdtexi], CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), CAST(d[9]), UCAST(d[10])); } break; case SCR_BGVALEX: if (rv = Copy(&i, 20)) { int _tdi = CAST(d[0]); int _tdtexi = CAST(d[1]); ubg[_tdi]->valueSet(mp.tex[_tdtexi], CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), CAST(d[9]), CAST(d[10]), CAST(d[11]), CAST(d[12]), CAST(d[13]), CAST(d[14]), CAST(d[15]), CAST(d[16]), (bool)(CAST(d[17])), (bool)(CAST(d[18])), UCAST(d[19])); } break; case SCR_BGTEXRECT: if(rv = Copy(&i, 5)) { int _tdi = CAST(d[0]); ubg[_tdi]->texRectSet(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4])); } break; case SCR_BGRECT: if(rv = Copy(&i, 9)) { int _tdi = CAST(d[0]); ubg[_tdi]->rectSet(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8])); } break; case SCR_BGZ: if(rv = Copy(&i, 5)) { int _tdi = CAST(d[0]); ubg[_tdi]->zSet(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4])); } break; case SCR_BGSCALE: if(rv = Copy(&i, 3)) { int _tdi = CAST(d[0]); ubg[_tdi]->scaleSet(CAST(d[1]), CAST(d[2])); } break; case SCR_BGCOLOR: if(rv = Copy(&i, 5)) { int _tdi = CAST(d[0]); ubg[_tdi]->colorSet(UCAST(d[1]), UCAST(d[2]), UCAST(d[3]), UCAST(d[4])); } break; case SCR_BGMOVE: if(rv = Copy(&i, 3)) { int _tdi = CAST(d[0]); ubg[_tdi]->moveSet((bool)(CAST(d[1])), (bool)(CAST(d[2]))); } break; case SCR_BGFLAG: if(rv = Copy(&i, 2)) { int _tdi = CAST(d[0]); ubg[_tdi]->flag = CAST(d[1]); ubg[_tdi]->changetimer = 0; } break; case SCR_BGPARAL: if(rv = Copy(&i, 2)) { int _tdi = CAST(d[0]); ubg[_tdi]->parallelogram(CAST(d[1])); } break; case SCR_BG4V: if (rv = Copy(&i, 13)) { int _tdi = CAST(d[0]); ubg[_tdi]->vertexSet(CAST(d[1]), CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), CAST(d[9]), CAST(d[10]), CAST(d[11]), CAST(d[12])); } break; case SCR_BGOFF: if(rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); ubg[_tdi]->exist = false; } break; case SCR_BGSETUP: if(rv = Copy(&i, 3)) { int _tdi = CAST(d[0]); if(CAST(d[2]) || BGLayer::set[_tdi].sID == BGLAYERSET_NONE) { int _tsID = CAST(d[1]); if(BGLayer::set[_tdi].sID != BGLAYERSET_NONE || BGLayer::set[_tdi].sID != CAST(d[1])) { vector<Script> * psaved = pnow; scr.sceneExecute(BGLayer::set[_tdi].sID, 0); pnow = psaved; } BGLayer::set[_tdi].sID = _tsID; BGLayer::set[_tdi].timer = 0; } } break; } break; /************************************************************************/ /* Select */ /************************************************************************/ case SCRKW_CLASS_SELECT: switch (nowval) { case SCR_SELBUILD: if(rv = Copy(&i, 21)) { int _tdtexi = CAST(d[1]); Selector::Build(CAST(d[0]), mp.tex[_tdtexi], CAST(d[2]), CAST(d[3]), CAST(d[4]), CAST(d[5]), CAST(d[6]), CAST(d[7]), CAST(d[8]), CAST(d[9]), CAST(d[10]), CAST(d[11]), CAST(d[13]), CAST(d[13]), CAST(d[14]), CAST(d[15]), CAST(d[16]), CAST(d[17]), CAST(d[18]), (bool)(CAST(d[19])), (bool)(CAST(d[20]))); } break; case SCR_SELCLEAR: Selector::Clear(); rv = true; break; case SCR_SELCONFIRM: if(rv = Copy(&i, 1)) { int _tdi = CAST(d[0]); CINT(d[_tdi].value) = Selector::confirm(mp.tex[TEX_WORD]); d[_tdi].bfloat = false; } break; case SCR_SELSET: if(rv = Copy(&i, 3)) { Selector::nselect = CAST(d[0]); Selector::select = CAST(d[1]); Selector::updown = (bool)(CAST(d[2])); } break; case SCR_ISELBUILD: if(rv = Copy(&i, 7)) { InfoSelect::Build(CAST(d[0]), strdesc[CINT(d[1].value)], CAST(d[2]), CAST(d[3]), CAST(d[4]), (bool)(CAST(d[5])), (bool)(CAST(d[6]))); } break; case SCR_ISELCLEAR: Selector::Clear(); rv = true; break; case SCR_ISELSET: if(rv = Copy(&i, 3)) { InfoSelect::nselect = CAST(d[0]); InfoSelect::select = CAST(d[1]); InfoSelect::updown = (bool)(CAST(d[2])); } break; } break; } break; /************************************************************************/ /* Control */ /************************************************************************/ case SCRKW_CONTROL: switch (nowval) { case SCR_IF: nest: if(rv = Copy(&i, 1)) { if(!CAST(d[0])) { while(true) { ++i; if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_THEN) depth++; if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_END) { depth--; if(!depth) break; } } ++i; if(i!=pnow->end()) { if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_ELSE) continue; else if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_ELSEIF) goto nest; else --i; } else --i; } } break; case SCR_ELSE: case SCR_ELSEIF: if(true) { while(true) { ++i; if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_THEN) depth++; if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_END) { depth--; if(!depth) break; } } } rv = true; break; case SCR_END: case SCR_THEN: continue; case SCR_LOOP: if(rv = Copy(&i, 1)) { vector<Script> _while; while(true) { ++i; if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_THEN) depth++; else if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_END) { depth--; if(!depth) break; } _while.push_back(*i); } vector<Script> * psaved = pnow; pnow = &_while; while(CINT(d[CINT(d[0].value)].value)--) { int _idesc; _idesc = idesc[0]; if(!Parse()) break; idesc[0] = _idesc; } pnow = psaved; } break; case SCR_CHATON: if(rv = Copy(&i, 1)) { if(Player::p.ID>>1 == CAST(d[0])) { if(!chat.chati) { if(rv = Copy(&i, 3)) { if(chat.chatOn(CAST(d[0]), CAST(d[1]), (bool)(CAST(d[2])))) chat.chati++; goto chatout; } } else { if(chat.chati == 0xff) { chat.chati = 0; goto chatout; } for(int j=0;j<chat.chati;j++) { ++i; ++i; ++i; } ++i; if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_CHATOFF) { if(chat.chatOff()) chat.chati = 0xff; break; } else { --i; if(rv = Copy(&i, 3)) { if(chat.chat(CAST(d[0]), (bool)(CAST(d[1])), strdesc[CINT(d[2].value)])) chat.chati++; goto chatout; } } } } else { chatout: while(true) { ++i; if(i->type & SCR_TOKEN_COMMAND && i->value == SCR_CHATOFF) { rv = true; break; } } } } break; case SCR_CHATOFF: continue; } break; /************************************************************************/ /* Data */ /************************************************************************/ case SCRKW_DATA: switch (nowval) { case SCR_DATAGET: if (rv = Copy(&i, 4)) { int _tdi = CAST(d[3]); CINT(d[_tdi].value) = data.iRead(DATA_BINFILE, UCAST(d[0]), UCAST(d[1]), CAST(d[2])); d[_tdi].bfloat = false; } break; case SCR_DATAGETf: if (rv = Copy(&i, 4)) { int _tdi = CAST(d[4]); CFLOAT(d[_tdi].value) = data.fRead(DATA_BINFILE, UCAST(d[0]), UCAST(d[1]), CAST(d[2])); d[_tdi].bfloat = true; } break; case SCR_DATASET: if (rv = Copy(&i, 3)) { data.iWrite(DATA_BINFILE, UCAST(d[0]), UCAST(d[1]), CAST(d[2])); } break; case SCR_DATASETf: if (rv = Copy(&i, 3)) { data.fWrite(DATA_BINFILE, UCAST(d[0]), UCAST(d[1]), CAST(d[2])); } break; case SCR_TRYSTAGE: if (rv = true) { DataConnector::Try(); } break; case SCR_DEBUG_BREAKPOINT: #ifdef __DEBUG if(rv = true) { LogOut(); } #endif break; } break; } if(!rv) { #ifdef __DEBUG HGELOG("%s\nError in parsing %d.", HGELOG_ERRSTR, i->value); LogOut(); #endif return false; } } return true; } void Scripter::LogOut() { #ifdef __DEBUG_LOGOUT HGELOG("\n*****DEBUG LOGOUT START*****\n"); HGELOG("*****DEBUG*****\nFuction Descs:"); for(int i=0; i<SCR_VARBEGIN; i++) { if(d[i].bfloat) HGELOG("Desc[%d] = %f", i, CFLOAT(d[i].value)); else HGELOG("Desc[%d] = %d", i, CINT(d[i].value)); } HGELOG("*****DEBUG*****\nVariable Descs:"); for(int i=SCR_VARBEGIN; i<SCR_FREEBEGIN ;i++) { if(d[i].bfloat) HGELOG("Var[%d] = %f", i-SCR_VARBEGIN, CFLOAT(d[i].value)); else HGELOG("Var[%d] = %d", i-SCR_VARBEGIN, CINT(d[i].value)); } HGELOG("*****DEBUG*****\nFree Descs:"); for(int i=SCR_FREEBEGIN; i<SCR_RESERVEBEGIN; i++) { if(d[i].bfloat) HGELOG("_%d = %f", i-SCR_FREEBEGIN, CFLOAT(d[i].value)); else HGELOG("_%d = %d", i-SCR_FREEBEGIN, CINT(d[i].value)); } HGELOG("\n*****DEBUG LOGOUT OVER*****\n"); #endif } bool Scripter::Execute(vector<File> * ptype, DWORD name, DWORD con) { bool bFound = false; bool rv = false; nowName = name; nowCon = con; for(vector<File>::iterator i=ptype->begin();i!=ptype->end();i++) { if(i->name == name) { for(vector<Block>::iterator j=i->file.begin();j!=i->file.end();j++) { if(j->con > SCR_TIMECONTROL) { bFound = true; DWORD _timefunc0 = j->con & ~SCR_TIMECONTROL; DWORD _timefunc = _timefunc0 & ~SCR_TIMECONTROL_TEST0; DWORD _con = con; while (_timefunc) { ++j; if (bFound) { switch (_timefunc & SCRKT_TEST_OPERATOR) { case SCR_TIMEFUNC_MOD: _con = _con % j->con; break; case SCR_TIMEFUNC_PLUS: _con += j->con; break; case SCR_TIMEFUNC_LESS: if (_con >= j->con) { bFound = false; } break; case SCR_TIMEFUNC_LESSEQUAL: if (_con > j->con) { bFound = false; } break; case SCR_TIMEFUNC_EQUAL: if (_con != j->con) { bFound = false; } case SCR_TIMEFUNC_GREATEQUAL: if (_con < j->con) { bFound = false; } break; case SCR_TIMEFUNC_GREAT: if (_con <= j->con) { bFound = false; } break; default: bFound = false; break; } } _timefunc = _timefunc >> SCRKT_SIZE_OPERATOR; } if ((_timefunc0 & SCR_TIMECONTROL_TEST0) && _con != 0) { bFound = false; } if (bFound) { pnow = &(j->block); } } else if(j->con == con) { pnow = &(j->block); bFound = true; } if(bFound) { if(!(rv = Parse())) { #ifdef __DEBUG HGELOG("%s\nError in parsing script! At Block %d of File %d.", HGELOG_ERRSTR, j->con, i->name); #endif break; } bFound = false; } } break; } } return rv; } bool Scripter::Copy(vector<Script>::iterator * p, BYTE num) { if(num > SCR_MAXDESC) return false; for(int i=0; ; i++) { vector<Script>::iterator ts = ++(*p); if(i == num && ((*p) == pnow->end() || !((*p)->type & SCR_TOKEN_OPERATOR))) { --(*p); break; } if(ts->type & SCR_TOKEN_OPERATOR) { switch(ts->value) { case SCR_ADD_INT: i--; tdi = CAST(d[i]); idesc[i] = tdi + CINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_SUB_INT: i--; tdi = CAST(d[i]); idesc[i] = tdi - CINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_MUL_INT: i--; tdi = CAST(d[i]); idesc[i] = tdi * CINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_DIV_INT: i--; tdi = CAST(d[i]); idesc[i] = tdi / CINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_ADD_FLOAT: i--; tdf = CAST(d[i]); fdesc[i] = tdf + CFLOAT(ValueF(&(++(*p)), i)); d[i].value = &fdesc[i]; d[i].bfloat = true; break; case SCR_SUB_FLOAT: i--; tdf = CAST(d[i]); fdesc[i] = tdf - CFLOAT(ValueF(&(++(*p)), i)); d[i].value = &fdesc[i]; d[i].bfloat = true; break; case SCR_MUL_FLOAT: i--; tdf = CAST(d[i]); fdesc[i] = tdf * CFLOAT(ValueF(&(++(*p)), i)); d[i].value = &fdesc[i]; d[i].bfloat = true; break; case SCR_DIV_FLOAT: i--; tdf = CAST(d[i]); fdesc[i] = tdf / CFLOAT(ValueF(&(++(*p)), i)); d[i].value = &fdesc[i]; d[i].bfloat = true; break; case SCR_ADD_UINT: i--; tdu = UCAST(d[i]); idesc[i] = tdu + CUINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_SUB_UINT: i--; tdu = UCAST(d[i]); idesc[i] = tdu - CUINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_MUL_UINT: i--; tdu = UCAST(d[i]); idesc[i] = tdu * CUINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_DIV_UINT: i--; tdu = UCAST(d[i]); idesc[i] = tdu / CUINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_MOD: i--; tdi = CINT(d[i].value); idesc[i] = tdi % CINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_MOD_UINT: i--; tdu = UCAST(d[i]); idesc[i] = tdu % CUINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_INVERSE: i--; idesc[i] = ~ idesc[i]; d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_NOT: i--; idesc[i] = ! idesc[i]; d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_GREAT_INT: i--; tdi = CAST(d[i]); idesc[i] = tdi > CINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_LESS_INT: i--; tdi = CAST(d[i]); idesc[i] = tdi < CINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_GREAT_FLOAT: i--; tdf = CAST(d[i]); idesc[i] = tdf > CFLOAT(ValueF(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_LESS_FLOAT: i--; tdf = CAST(d[i]); idesc[i] = tdf < CFLOAT(ValueF(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_GREAT_UINT: i--; tdu = UCAST(d[i]); idesc[i] = tdu > CUINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; case SCR_LESS_UINT: i--; tdu = UCAST(d[i]); idesc[i] = tdu < CUINT(ValueI(&(++(*p)), i)); d[i].value = &idesc[i]; d[i].bfloat = false; break; } } else { d[i].value = Value(&(*p), i, 0); } if(*p == pnow->end()) return false; } return true; } void * Scripter::Value(vector<Script>::iterator * p, int i, BYTE force) { if((*p)->type & SCR_TOKEN_VALUE) { if(force & SCR_FORCE_INT) { d[i].bfloat = false; if((*p)->type & SCR_TOKEN_FLOAT) { idesc[i] = (int)CFLOAT(&((*p)->value)); } else { idesc[i] = (int)CINT(&((*p)->value)); } } else if(force & SCR_FORCE_FLOAT) { d[i].bfloat = true; if((*p)->type & SCR_TOKEN_FLOAT) { fdesc[i] = (float)CFLOAT(&((*p)->value)); } else { fdesc[i] = (float)CINT(&((*p)->value)); } } else { if((*p)->type & SCR_TOKEN_FLOAT) { d[i].bfloat = true; fdesc[i] = CFLOAT(&((*p)->value)); } else { d[i].bfloat = false; idesc[i] = CINT(&((*p)->value)); } } } else if((*p)->type & SCR_TOKEN_HANDLE) { d[i].bfloat = false; idesc[i] = (*p)->value; } else if((*p)->type & SCR_TOKEN_VARIABLE) { int _tdi = (*p)->value; d[i].bfloat = d[_tdi].bfloat; if(d[i].bfloat) fdesc[i] = CFLOAT(d[_tdi].value); else idesc[i] = CINT(d[_tdi].value); } else { int _tdi; float _tdf; DWORD nowval = (*p)->value; switch(nowval & SCRKWMASK_CLASS) { /************************************************************************/ /* AttackObject */ /************************************************************************/ case SCRKW_CLASS_ATTACKOBJECT: switch (nowval) { case SCR_BUI: idesc[i] = Bullet::index; d[i].bfloat = false; break; case SCR_BUANGLE: idesc[i] = bu[Bullet::index].angle; d[i].bfloat = false; break; case SCR_BUSPEED: fdesc[i] = bu[Bullet::index].speed; d[i].bfloat = true; break; case SCR_BUX: fdesc[i] = bu[Bullet::index].x; d[i].bfloat = true; break; case SCR_BUY: fdesc[i] = bu[Bullet::index].y; d[i].bfloat = true; break; case SCR_BUTIMER: idesc[i] = bu[Bullet::index].timer; d[i].bfloat = false; break; case SCR_BEI: idesc[i] = Beam::index; d[i].bfloat = false; break; case SCR_BEANGLE: idesc[i] = be[Beam::index].angle; d[i].bfloat = false; break; case SCR_BESPEED: fdesc[i] = be[Beam::index].speed; d[i].bfloat = true; break; case SCR_BEX: fdesc[i] = be[Beam::index].x; d[i].bfloat = true; break; case SCR_BEY: fdesc[i] = be[Beam::index].y; d[i].bfloat = true; break; case SCR_BETIMER: idesc[i] = be[Beam::index].timer; d[i].bfloat = false; break; case SCR_BEHOLDTAR: idesc[i] = be[Beam::index].holdtar; d[i].bfloat = false; break; case SCR_BEPINTAR: idesc[i] = be[Beam::index].pintar; d[i].bfloat = false; break; } break; /************************************************************************/ /* Ghost */ /************************************************************************/ case SCRKW_CLASS_GHOST: switch (nowval) { case SCR_GHX: fdesc[i] = gh[Ghost::index].x; d[i].bfloat = true; break; case SCR_GHY: fdesc[i] = gh[Ghost::index].y; d[i].bfloat = true; break; case SCR_GHTIMER: idesc[i] = gh[Ghost::index].timer; d[i].bfloat = false; break; case SCR_GHI: idesc[i] = Ghost::index; d[i].bfloat = false; break; case SCR_GHANGLE: idesc[i] = gh[Ghost::index].angle; d[i].bfloat = false; break; case SCR_GHSPEED: fdesc[i] = gh[Ghost::index].speed; d[i].bfloat = true; break; case SCR_GHAMAP: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); idesc[i] = gh[Ghost::index].aMainAngle(Player::p, _tdi); d[i].bfloat = false; break; case SCR_GHRMAP: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); idesc[i] = gh[Ghost::index].rMainAngle(Player::p, _tdi); d[i].bfloat = false; break; case SCR_GHAIMX: fdesc[i] = gh[Ghost::index].aim.x; d[i].bfloat = true; break; case SCR_GHAIMY: fdesc[i] = gh[Ghost::index].aim.y; d[i].bfloat = true; break; case SCR_GHAC: idesc[i] = gh[Ghost::index].ac; d[i].bfloat = false; break; } break; /************************************************************************/ /* Enemy */ /************************************************************************/ case SCRKW_CLASS_ENEMY: switch (nowval) { case SCR_ENX: fdesc[i] = en[Enemy::index].x; d[i].bfloat = true; break; case SCR_ENY: fdesc[i] = en[Enemy::index].y; d[i].bfloat = true; break; case SCR_ENTIMER: idesc[i] = en[Enemy::index].timer; d[i].bfloat = false; break; case SCR_ENI: idesc[i] = Enemy::index; d[i].bfloat = false; break; case SCR_ENANGLE: idesc[i] = en[Enemy::index].angle; d[i].bfloat = false; break; case SCR_ENSPEED: fdesc[i] = en[Enemy::index].speed; d[i].bfloat = true; break; case SCR_ENAMAP: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); idesc[i] = en[Enemy::index].aMainAngle(Player::p, _tdi); d[i].bfloat = false; break; case SCR_ENRMAP: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); idesc[i] = en[Enemy::index].rMainAngle(Player::p, _tdi); d[i].bfloat = false; break; case SCR_ENAIMX: fdesc[i] = en[Enemy::index].aim.x; d[i].bfloat = true; break; case SCR_ENAIMY: fdesc[i] = en[Enemy::index].aim.y; d[i].bfloat = true; break; } break; /************************************************************************/ /* Math */ /************************************************************************/ case SCRKW_CLASS_MATH: switch (nowval) { case SCR_RAND: idesc[i] = rand(); d[i].bfloat = false; break; case SCR_RANDA: idesc[i] = RANDA; d[i].bfloat = false; break; case SCR_RANDR: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); idesc[i] = rand() % (_tdi * 2 + 1) - _tdi; d[i].bfloat = false; break; case SCR_SEED: idesc[i] = mp.seed; d[i].bfloat = false; break; case SCR_SINA: ++(*p); fdesc[i] = sint(CINT(Value(&(*p), i, 0))); d[i].bfloat = true; break; case SCR_COSA: ++(*p); fdesc[i] = cost(CINT(Value(&(*p), i, 0))); d[i].bfloat = true; break; case SCR_TANA: ++(*p); fdesc[i] = tant(CINT(Value(&(*p), i, 0))); d[i].bfloat = true; break; case SCR_ATAN2: ++(*p); _tdf = CFLOAT((Value(&(*p), i, 0))); ++(*p); idesc[i] = ANGLE(atan2f(_tdf, CFLOAT((Value(&(*p), i, 0))))); d[i].bfloat = false; break; case SCR_SQRT: ++(*p); fdesc[i] = sqrtf(CFLOAT((Value(&(*p), i, 0)))); d[i].bfloat = true; break; case SCR_SIGN: ++(*p); idesc[i] = SIGN(CINT(Value(&(*p), i, 0))); d[i].bfloat = false; break; case SCR_ROLL: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); ++(*p); idesc[i] = ROLL(_tdi, CINT(Value(&(*p), i, 0))); d[i].bfloat = false; break; } break; /************************************************************************/ /* Other */ /************************************************************************/ case SCRKW_CLASS_OTHER: switch (nowval) { case SCR_D: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); if(d[_tdi].bfloat) fdesc[i] = CAST(d[_tdi]); else idesc[i] = CAST(d[_tdi]); d[i].bfloat = d[_tdi].bfloat; break; case SCR_DU: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); idesc[i] = UCAST(d[_tdi]); d[i].bfloat = false; break; case SCR_TX: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); fdesc[i] = tar[_tdi].x; d[i].bfloat = true; break; case SCR_TY: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); fdesc[i] = tar[_tdi].y; d[i].bfloat = true; break; case SCR_TIME: idesc[i] = time; d[i].bfloat = false; break; case SCR_NOWNAME: idesc[i] = nowName; d[i].bfloat = false; break; case SCR_NOWCON: idesc[i] = nowCon; d[i].bfloat = false; break; case SCR_DIFFI: idesc[i] = mp.nowdifflv; d[i].bfloat = false; break; case SCR_CHARA: idesc[i] = mp.luchara; d[i].bfloat = false; break; case SCR_GETSCENE: idesc[i] = mp.scene; d[i].bfloat = false; break; case SCR_MODE: idesc[i] = (mp.practicemode ? 2:0) | (mp.rangemode ? 1:0); d[i].bfloat = false; break; case SCR_REPLAYMODE: idesc[i] = mp.replaymode; d[i].bfloat = false; break; } break; /************************************************************************/ /* Special */ /************************************************************************/ case SCRKW_CLASS_SPECIAL: switch (nowval) { case SCR_CHATI: idesc[i] = chat.chati; d[i].bfloat = false; break; case SCR_BOSSFAILED: idesc[i] = BossInfo::failed; d[i].bfloat = false; break; case SCR_BOSSFLAG: idesc[i] = BossInfo::flag; d[i].bfloat = false; break; case SCR_CHECKKEY: ++(*p); _tdi = CINT(Value(&(*p), i, 0)); ++(*p); idesc[i] = hge->Input_GetDIKey(_tdi, CINT(Value(&(*p), i, 0))); d[i].bfloat = false; break; } break; /************************************************************************/ /* Effect */ /************************************************************************/ case SCRKW_CLASS_EFFECT: switch (nowval) { } break; /************************************************************************/ /* Player */ /************************************************************************/ case SCRKW_CLASS_PLAYER: switch (nowval) { case SCR_PX: fdesc[i] = Player::p.x; d[i].bfloat = true; break; case SCR_PY: fdesc[i] = Player::p.y; d[i].bfloat = true; break; case SCR_PLIFE: idesc[i] = Player::p.nLife; d[i].bfloat = false; break; case SCR_PBOMB: idesc[i] = Player::p.nBomb; d[i].bfloat = false; break; case SCR_PPOWER: idesc[i] = Player::p.nPower; d[i].bfloat = false; break; case SCR_PALIVENESS: idesc[i] = Player::p.nAliveness; d[i].bfloat =false; break; case SCR_PPOINT: idesc[i] = Player::p.nPoint; d[i].bfloat = false; break; case SCR_PBCIRCLE: idesc[i] = (int)(Player::p.bCircle); d[i].bfloat = false; break; case SCR_PBSLOW: idesc[i] = (int)(Player::p.bSlow); d[i].bfloat = false; break; case SCR_PBINFI: idesc[i] = (int)(Player::p.bInfi); d[i].bfloat = false; break; case SCR_PSPEED: fdesc[i] = Player::p.speed; d[i].bfloat = true; break; case SCR_PSLOWSPEED: fdesc[i] = Player::p.slowspeed; d[i].bfloat = true; break; } break; /************************************************************************/ /* Layer */ /************************************************************************/ case SCRKW_CLASS_LAYER: switch (nowval) { case SCR_BGSTIMER: idesc[i] = BGLayer::set[BGLayer::setindex].timer; d[i].bfloat = false; break; } break; /************************************************************************/ /* Select */ /************************************************************************/ case SCRKW_CLASS_SELECT: switch (nowval) { case SCR_SELCOMPLETE: idesc[i] = Selector::complete; d[i].bfloat = false; break; case SCR_SEL: idesc[i] = Selector::select; d[i].bfloat = false; break; case SCR_ISELCOMPLETE: idesc[i] = InfoSelect::complete; d[i].bfloat = false; break; case SCR_ISEL: idesc[i] = InfoSelect::select; d[i].bfloat = false; break; } break; } } if(d[i].bfloat) return &fdesc[i]; return &idesc[i]; }
[ "CBE7F1F65@e00939f0-95ee-11de-8df0-bd213fda01be" ]
[ [ [ 1, 2014 ] ] ]