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
e0e5ab39e07316ef7c936f11eec8aab69aa8ec8a
a1c866c630074029d5bdc632fbcf946ea9a512ab
/Trabalho 3/Source/Object.h
2b80a36707b871eee480ae3d738571835e196c0b
[]
no_license
miaosun/laig-072-162
f08aebf9592bdbe9a57ae2382d03445feffcab89
b7b5717521cd5c0a52be0ba1293f1e926dfe74c6
refs/heads/master
2020-12-24T13:28:03.086329
2010-12-21T19:57:44
2010-12-21T19:57:44
33,734,370
0
0
null
null
null
null
UTF-8
C++
false
false
6,499
h
#include "Transformation.h" class Object { public: string id; string type; Material * mat; Texture * tex; string mat_id, tex_id; bool visited; vector<Transformation *> transf; Object(string id, string type, string mat_id, string tex_id, vector<Transformation *> transf); void aplicaTransformacoes(); virtual vector<Object *> * getObjs()=0; virtual vector<string> * getSObjs()=0; virtual float getX1()=0; virtual float getX2()=0; virtual float getX3()=0; virtual float getY1()=0; virtual float getY2()=0; virtual float getY3()=0; virtual float getZ1()=0; virtual float getZ2()=0; virtual float getZ3()=0; virtual int getSlices()=0; virtual int getStacks()=0; virtual float getRadius()=0; virtual float getBase()=0; virtual float getTop()=0; virtual float getHeight()=0; virtual float getInner()=0; virtual float getOuter()=0; virtual void draw()=0; }; class Compound:public Object { public: vector<Object *> objs; vector<string> s_objs; Compound(string id, string mat_id, string tex_id, vector<Transformation *> transf, vector<string> s_objs); //funcoes vector<Object *> * getObjs(){return &this->objs;}; vector<string> * getSObjs(){return &this->s_objs;}; float getX1(){return NULL;}; float getX2(){return NULL;}; float getX3(){return NULL;}; float getY1(){return NULL;}; float getY2(){return NULL;}; float getY3(){return NULL;}; float getZ1(){return NULL;}; float getZ2(){return NULL;}; float getZ3(){return NULL;}; int getSlices(){return NULL;}; int getStacks(){return NULL;}; float getRadius(){return NULL;}; float getBase(){return NULL;}; float getTop(){return NULL;}; float getHeight(){return NULL;}; float getInner(){return NULL;}; float getOuter(){return NULL;}; void draw(); }; class Rectangle:public Object { public: float x1, x2, y1, y2; Rectangle(string id, string mat_id, string tex_id, vector<Transformation *> transf, float x1, float y1, float x2, float y2); //funcoes float getX1(){return this->x1;}; float getX2(){return this->x2;}; float getY1(){return this->y1;}; float getY2(){return this->y2;}; void draw(); float getX3(){return NULL;}; float getY3(){return NULL;}; float getZ1(){return NULL;}; float getZ2(){return NULL;}; float getZ3(){return NULL;}; int getSlices(){return NULL;}; int getStacks(){return NULL;}; float getRadius(){return NULL;}; float getBase(){return NULL;}; float getTop(){return NULL;}; float getHeight(){return NULL;}; float getInner(){return NULL;}; float getOuter(){return NULL;}; vector<Object *> * getObjs(){return NULL;}; vector<string> * getSObjs(){return NULL;}; }; class Triangle:public Object { public: float x1, x2, x3, y1, y2, y3, z1, z2, z3; float n1, n2, n3; Triangle(string id, string mat_id, string tex_id, vector<Transformation *> transf, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3); //funcoes float getX1(){return this->x1;}; float getX2(){return this->x2;}; float getX3(){return this->x3;}; float getY1(){return this->y1;}; float getY2(){return this->y2;}; float getY3(){return this->y3;}; float getZ1(){return this->z1;}; float getZ2(){return this->z2;}; float getZ3(){return this->z3;}; int getSlices(){return NULL;}; int getStacks(){return NULL;}; float getRadius(){return NULL;}; float getBase(){return NULL;}; float getTop(){return NULL;}; float getHeight(){return NULL;}; float getInner(){return NULL;}; float getOuter(){return NULL;}; vector<Object *> * getObjs(){return NULL;}; vector<string> * getSObjs(){return NULL;}; void draw(); void calcNorm(); }; class Sphere:public Object { public: float radius; int slices, stacks; Sphere(string id, string mat_id, string tex_id, vector<Transformation *> transf, float r, int slices, int stacks); //funcoes int getSlices(){return this->slices;}; int getStacks(){return this->stacks;}; float getRadius(){return this->radius;}; void draw(); float getX1(){return NULL;}; float getX2(){return NULL;}; float getX3(){return NULL;}; float getY1(){return NULL;}; float getY2(){return NULL;}; float getY3(){return NULL;}; float getZ1(){return NULL;}; float getZ2(){return NULL;}; float getZ3(){return NULL;}; float getBase(){return NULL;}; float getTop(){return NULL;}; float getHeight(){return NULL;}; float getInner(){return NULL;}; float getOuter(){return NULL;}; vector<Object *> * getObjs(){return NULL;}; vector<string> * getSObjs(){return NULL;}; }; class Cylinder:public Object { public: float base, top, height; int slices, stacks; Cylinder(string id, string mat_id, string tex_id, vector<Transformation *> transf, float base, float top, float height, int slices, int stacks); //funcoes int getSlices(){return this->slices;}; int getStacks(){return this->stacks;}; float getBase(){return this->base;}; float getTop(){return this->top;}; float getHeight(){return this->height;}; void draw(); float getX1(){return NULL;}; float getX2(){return NULL;}; float getX3(){return NULL;}; float getY1(){return NULL;}; float getY2(){return NULL;}; float getY3(){return NULL;}; float getZ1(){return NULL;}; float getZ2(){return NULL;}; float getZ3(){return NULL;}; float getInner(){return NULL;}; float getOuter(){return NULL;}; vector<Object *> * getObjs(){return NULL;}; vector<string> * getSObjs(){return NULL;}; float getRadius(){return NULL;}; }; class Disk:public Object { public: float inner, outer; int slices, loops; Disk(string id, string mat_id, string tex_id, vector<Transformation *> transf, float inner, float outer, int slices, int loops); //funcoes int getSlices(){return this->slices;}; int getStacks(){return this->loops;}; float getInner(){return this->inner;}; float getOuter(){return this->outer;}; void draw(); float getX1(){return NULL;}; float getX2(){return NULL;}; float getX3(){return NULL;}; float getY1(){return NULL;}; float getY2(){return NULL;}; float getY3(){return NULL;}; float getZ1(){return NULL;}; float getZ2(){return NULL;}; float getZ3(){return NULL;}; float getBase(){return NULL;}; float getTop(){return NULL;}; float getHeight(){return NULL;}; vector<Object *> * getObjs(){return NULL;}; vector<string> * getSObjs(){return NULL;}; float getRadius(){return NULL;}; };
[ "miaosun88@7f58f83d-947b-b5a6-e802-c2e2e7638ba7" ]
[ [ [ 1, 237 ] ] ]
9b0b92ebeef963186cc44b80ab36dae9e3496dd1
3da0b0276bc8c3d7d1bcdbabfb0e763a38d3a24c
/zju.finished/1636.cpp
f8094cac65d50576a69a9caa0260bc8eda1a4e3b
[]
no_license
usherfu/zoj
4af6de9798bcb0ffa9dbb7f773b903f630e06617
8bb41d209b54292d6f596c5be55babd781610a52
refs/heads/master
2021-05-28T11:21:55.965737
2009-12-15T07:58:33
2009-12-15T07:58:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,250
cpp
#include<cstdio> using namespace std; enum { Size = 504, }; int M,N; int mat[Size][Size]; int sum[Size][Size]; int tstnum, tstcase; void calc_sum(){ int i,j; sum[0][0] = mat[0][0]; for(i=1;i<M;i++){ sum[i][0] = sum[i-1][0] + mat[i][0]; } for(j=1;j<N;j++){ sum[0][j] = sum[0][j-1] + mat[0][j]; } for(i=1;i<M;i++){ for(j=1;j<N;j++){ sum[i][j] = mat[i][j] + sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1]; } } } int fun(){ int num; int i,j,x,y; int t; printf("Case %d:\n", tstcase); scanf("%d ", &num); while(num--){ scanf("%d%d%d%d ", &i, &j, &x, &y); i--; j--; x--; y--; if(i == 0){ if(j==0){ t = sum[x][y]; } else { t = sum[x][y] - sum[x][j-1]; } } else if(j == 0){ t = sum[x][y] - sum[i-1][y]; } else { t = sum[x][y] - sum[i-1][y] - sum[x][j-1] + sum[i-1][j-1]; } printf("%d\n",t); } } int main(){ tstcase = 0; scanf("%d ", &tstnum); while(tstcase ++ < tstnum){ scanf("%d%d ", &M, &N); for(int i=0;i<M;i++){ for(int j=0;j<N;j++){ scanf("%d ", &mat[i][j]); mat[i][j] *= mat[i][j]; } } calc_sum(); fun(); } return 0; }
[ [ [ 1, 73 ] ] ]
cb2a2f67b1677abb84efe659f8090b02a2a863f5
3e69b159d352a57a48bc483cb8ca802b49679d65
/tags/release-2006-01-03/pcbnew/queue.cpp
8e262033e2815c2aa0fd6cff95cc9e010745bd87
[]
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
4,681
cpp
/*******************************************/ /* EDITEUR de PCB: routines d'AUTOROUTAGE: */ /*******************************************/ #include "fctsys.h" #include "gr_basic.h" #include "common.h" #include "pcbnew.h" #include "autorout.h" #include "protos.h" #include "cell.h" struct queue /* search queue structure */ { struct queue *Next; int Row; /* current row */ int Col; /* current column */ int Side; /* 0=top, 1=bottom */ int Dist; /* path distance to this cell so far */ int ApxDist; /* approximate distance to target from here */ }; static long qlen = 0; /* current queue length */ static struct queue *Head = NULL; static struct queue *Tail = NULL; static struct queue *Save = NULL; /* hold empty queue structs */ /* Routines definies ici : */ void InitQueue( void ); void GetQueue( int *, int *, int *, int *, int * ); int SetQueue( int, int, int, int, int, int, int ); void ReSetQueue( int, int, int, int, int, int, int ); /************************/ /* void FreeQueue(void) */ /************************/ /* Libere la memoire de la queue de recherche */ void FreeQueue(void) { struct queue *p; InitQueue(); while( (p = Save) != NULL ) { Save = p->Next; MyFree(p); } } /************************/ /* void InitQueue(void) */ /************************/ /* initialize the search queue */ void InitQueue(void) { struct queue *p; while( (p = Head) != NULL ) { Head = p->Next; p->Next = Save; Save = p; } Tail = NULL; OpenNodes = ClosNodes = MoveNodes = MaxNodes = qlen = 0; } /*********************************************************/ /* void GetQueue(int *r, int *c, int *s, int *d, int *a) */ /*********************************************************/ /* get search queue item from list */ void GetQueue(int *r, int *c, int *s, int *d, int *a) { struct queue *p; if( (p = Head) != NULL ) /* return first item in list */ { *r = p->Row; *c = p->Col; *s = p->Side; *d = p->Dist; *a = p->ApxDist; if ((Head = p->Next) == NULL) Tail = NULL; /* put node on free list */ p->Next = Save; Save = p; ClosNodes++; qlen--; } else /* empty list */ { *r = *c = *s = *d = *a = ILLEGAL; } } /****************************************************************/ /* int SetQueue (int r,int c,int s,int d,int a,int r2,int c2 ) */ /****************************************************************/ /* add a search node to the list Return: 1 si OK 0 si defaut allocation Memoire */ int SetQueue (int r,int c,int side,int d,int a,int r2,int c2 ) { struct queue *p, *q, *t; int i, j; if( (p = Save) != NULL ) /* try free list first */ { Save = p->Next; } else if ((p = (struct queue *) MyMalloc(sizeof(queue))) == NULL) return(0); p->Row = r; p->Col = c; p->Side = side; i = (p->Dist = d) + (p->ApxDist = a); p->Next = NULL; if( (q = Head) != NULL) { /* insert in proper position in list */ if (q->Dist + q->ApxDist > i) { /* insert at head */ p->Next = q; Head = p; } else { /* search for proper position */ for (t = q, q = q->Next; q && i > (j = q->Dist + q->ApxDist); t = q, q = q->Next) ; if (q && i == j && q->Row == r2 && q->Col == c2) { /* insert after q, which is a goal node */ if ( (p->Next = q->Next) == NULL) Tail = p; q->Next = p; } else { /* insert in front of q */ if ((p->Next = q) == NULL) Tail = p; t->Next = p; } } } else /* empty search list */ Head = Tail = p; OpenNodes++; if (++qlen > MaxNodes) MaxNodes = qlen; return(1); } /******************************************************************/ /* void ReSetQueue (int r,int c,int s,int d,int a,int r2,int c2 ) */ /******************************************************************/ /* reposition node in list */ void ReSetQueue (int r,int c,int s,int d,int a,int r2,int c2 ) { struct queue *p, *q; /* first, see if it is already in the list */ for (q = NULL, p = Head; p; q = p, p = p->Next) { if (p->Row == r && p->Col == c && p->Side == s) { /* old one to remove */ if (q) { if ( (q->Next = p->Next) == NULL) Tail = q; } else if ((Head = p->Next) == NULL) Tail = NULL; p->Next = Save; Save = p; OpenNodes--; MoveNodes++; qlen--; break; } } if (!p) /* not found, it has already been closed once */ ClosNodes--; /* we will close it again, but just count once */ /* if it was there, it's gone now; insert it at the proper position */ SetQueue( r, c, s, d, a, r2, c2 ); }
[ "bokeoa@244deca0-f506-0410-ab94-f4f3571dea26" ]
[ [ [ 1, 186 ] ] ]
1733938c0c8195d533fc5b71d71a648b489fa16f
af260b99d9f045ac4202745a3c7a65ac74a5e53c
/tags/engine/src/Parser.h
447f93d3bc804d9f5332c3cc043cfcc0cea6adaa
[]
no_license
BackupTheBerlios/snap-svn
560813feabcf5d01f25bc960d474f7e218373da0
a99b5c64384cc229e8628b22f3cf6a63a70ed46f
refs/heads/master
2021-01-22T09:43:37.862180
2008-02-17T15:50:06
2008-02-17T15:50:06
40,819,397
0
0
null
null
null
null
UTF-8
C++
false
false
5,022
h
#ifndef _SeedSearcher_Parser_h #define _SeedSearcher_Parser_h // // File : $RCSfile: $ // $Workfile: Parser.h $ // Version : $Revision: 36 $ // $Author: Aviad $ // $Date: 13/05/05 11:10 $ // Description : // Concrete Parser for seed-searcher options // // Author: // Aviad Rozenhek (mailto:[email protected]) 2003-2004 // // written for the SeedSearcher program. // for details see www.huji.ac.il/~hoan // and also http://www.cs.huji.ac.il/~nirf/Abstracts/BGF1.html // // this file and as well as its library are released for academic research // only. the LESSER GENERAL PUBLIC LICENSE (LPGL) license // as well as any other restrictions as posed by the computational biology lab // and the library authors appliy. // see http://www.cs.huji.ac.il/labs/compbio/LibB/LICENSE // #include "Defs.h" #include "core/Str.h" #include "core/Argv.h" #include "core/GetOptParser.h" #include "persistance/TextWriter.h" class Parser { public: Parser (); Parser (int argc, char const * const *argv) { *this = Parser (); parse (argc, argv); } Parser (int argc, const char* argv []) { *this = Parser (); parse (argc, argv); } Parser (const Argv& inArgv) { *this = Parser (); parse (inArgv); } void restoreDefaults (); // // void parse (const Argv& argv) { __argv = argv; internalParse (); } void parse (int argc, const char* argv []){ __argv.set(argc, const_cast <char* const * const> (argv)); internalParse(); } void parse (int argc, char const* const * argv){ __argv.set(argc, argv); internalParse(); } void usage (const char*) const; // // void logParams (Persistance::TextWriter&) const; // // void checkCompatibility (const Parser& in); int getNumFileArgs () const { return __argv.argc () - __firstFileArg; } // // Argv __argv; // // exhaustive projections bool __proj_e; // // number of projections int __proj_n; // // no. of wildcards in projection int __proj_d; // // how long is midsection (which is only wildcards) int __proj_mid; // // specialize projection // (expert optimization, may lead to incorrect results) bool __proj_spec; // // seed for random projections int __proj_i; // // ask for a specific projection (not random) StrBuffer __proj_base; // // allow outer wildcards in projection (in the first and last positions) bool __proj_outer; // // no of seeds to output int __seed_n; // // length of the seed to search for int __seed_l; // // offset for checking seed redundancy int __seed_r; // // flag for checking reverse redundancy bool __seed_rr; // // length of seed to output (PSSM length) int __seed_o; // // type of preprocessor PrepType __prep; // // remove totally negative features // (expert feature, may lead to incorrect results) bool __prep_noneg; // // how deep/long should preprocessed k-mers be int __prep_l; // // type of counting mechanism: gene-count / total count CountType __count; // // bool __count_reverse; StatFixType __statfix_t; // // worst score to allow double __minusLog10score_min; // // minimal number to positive sequences for a seed int __score_min_seq; // // minimal percent of positive sequences for a seed int __score_min_seq_per; // // score using partial counts (weights) or assg_discrete counts PositionWeightType __score_partial; // // threshold for counting a sequence as positive float __weight_t; // // which type of search to perform: tree search or table search // note: tree search only works with tree preprocessor SearchType __searchType; ScoreType __scoreType; // // values for exponential loss score float __expLossPos; float __expLossNeg; enum OutputType { _out_all_, _out_pos_, _out_none_, }; // // flag that determines if PSSM files should be created OutputType __generatePSSM; // // flag that determines if .Motif files should be created OutputType __generateMotif; // // flag that determines if .sample file should be created OutputType __generateBayesian; // // flag that determines if seeds should be outputed to the log OutputType __generateSeedlog; // // StrBuffer __conf; // // int __firstFileArg; bool Parser::getOptBoolean (const char* in, bool* optUnknown = NULL); OutputType getOptOutputType(const char*); int getInt (const char* in, const char* ctx); static GetOptParser::OptionList& getOptions (); mutable GetOptParser _impl; private: void internalParse (); }; #endif
[ "aviadr1@1f8b7f26-7806-0410-ba70-a23862d07478" ]
[ [ [ 1, 208 ] ] ]
519d47e8ae7b4fad21448e4b3e892af9d2836517
075043812c30c1914e012b52c60bc3be2cfe49cc
/src/ShokoRocket++lib/Logger.cpp
b103acf40b4d19e3b5eeb92b48ea9afb22764c14
[]
no_license
Luke-Vulpa/Shoko-Rocket
8a916d70bf777032e945c711716123f692004829
6f727a2cf2f072db11493b739cc3736aec40d4cb
refs/heads/master
2020-12-28T12:03:14.055572
2010-02-28T11:58:26
2010-02-28T11:58:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,076
cpp
#include "Logger.h" Logger::Logger(std::string _filename) { output_.open(_filename.c_str(), std::ios::trunc); } Logger::~Logger(void) { output_.close(); } Logger& Logger::ErrorOut() { static Logger logger("ErrorLog.txt"); return logger; } Logger& Logger::DiagnosticOut() { static Logger logger("Diagnostic.txt"); return logger; } Logger& Logger::operator <<( int i ) { output_ << i; printf("%d", i); return *this; } Logger& Logger::operator <<( float i ) { output_ << i; printf("%f", i); return *this; } Logger& Logger::operator <<( double i ) { output_ << i; printf("%e", i); return *this; } Logger& Logger::operator <<( std::string i ) { output_ << i; printf("%s", i.c_str()); return *this; } Logger& Logger::operator <<(Vector3f v) { output_ << "(" << v.x << "," << v.y << "," << v.z << ")"; printf("(%f,%f,%f)", v.x, v.y, v.z); return *this; } Logger& Logger::operator <<(Vector2f v) { output_ << "(" << v.x << "," << v.y << ")"; printf("(%f,%f)", v.x, v.y); return *this; }
[ [ [ 1, 65 ] ] ]
aad394fe878d3858179798fcc5c50e61ce5c7f1c
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Depend/Foundation/Curves/Wm4NURBSCurve2.cpp
5a50aad19b9e8d21d75d60d295ce9805ed21b8ab
[]
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
10,403
cpp
// 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. #include "Wm4FoundationPCH.h" #include "Wm4NURBSCurve2.h" namespace Wm4 { //---------------------------------------------------------------------------- template <class Real> NURBSCurve2<Real>::NURBSCurve2 (int iNumCtrlPoints, const Vector2<Real>* akCtrlPoint, const Real* afCtrlWeight, int iDegree, bool bLoop, bool bOpen) : SingleCurve2<Real>((Real)0.0,(Real)1.0), m_bLoop(bLoop) { assert(iNumCtrlPoints >= 2); assert(1 <= iDegree && iDegree <= iNumCtrlPoints-1); m_iNumCtrlPoints = iNumCtrlPoints; m_iReplicate = (bLoop ? (bOpen ? 1 : iDegree) : 0); CreateControl(akCtrlPoint,afCtrlWeight); m_kBasis.Create(m_iNumCtrlPoints+m_iReplicate,iDegree,bOpen); } //---------------------------------------------------------------------------- template <class Real> NURBSCurve2<Real>::NURBSCurve2 (int iNumCtrlPoints, const Vector2<Real>* akCtrlPoint, const Real* afCtrlWeight, int iDegree, bool bLoop, const Real* afKnot) : SingleCurve2<Real>((Real)0.0,(Real)1.0), m_bLoop(bLoop) { assert(iNumCtrlPoints >= 2); assert(1 <= iDegree && iDegree <= iNumCtrlPoints-1); m_iNumCtrlPoints = iNumCtrlPoints; m_iReplicate = (bLoop ? 1 : 0); CreateControl(akCtrlPoint,afCtrlWeight); m_kBasis.Create(m_iNumCtrlPoints+m_iReplicate,iDegree,afKnot); } //---------------------------------------------------------------------------- template <class Real> NURBSCurve2<Real>::~NURBSCurve2 () { WM4_DELETE[] m_akCtrlPoint; WM4_DELETE[] m_afCtrlWeight; } //---------------------------------------------------------------------------- template <class Real> void NURBSCurve2<Real>::CreateControl (const Vector2<Real>* akCtrlPoint, const Real* afCtrlWeight) { int iNewNumCtrlPoints = m_iNumCtrlPoints + m_iReplicate; m_akCtrlPoint = WM4_NEW Vector2<Real>[iNewNumCtrlPoints]; size_t uiDstSize = iNewNumCtrlPoints*sizeof(Vector2<Real>); size_t uiSrcSize = m_iNumCtrlPoints*sizeof(Vector2<Real>); System::Memcpy(m_akCtrlPoint,uiDstSize,akCtrlPoint,uiSrcSize); m_afCtrlWeight = WM4_NEW Real[iNewNumCtrlPoints]; uiDstSize = iNewNumCtrlPoints*sizeof(Real); uiSrcSize = m_iNumCtrlPoints*sizeof(Real); System::Memcpy(m_afCtrlWeight,uiDstSize,afCtrlWeight,uiSrcSize); for (int i = 0; i < m_iReplicate; i++) { m_akCtrlPoint[m_iNumCtrlPoints+i] = akCtrlPoint[i]; m_afCtrlWeight[m_iNumCtrlPoints+i] = afCtrlWeight[i]; } } //---------------------------------------------------------------------------- template <class Real> int NURBSCurve2<Real>::GetNumCtrlPoints () const { return m_iNumCtrlPoints; } //---------------------------------------------------------------------------- template <class Real> int NURBSCurve2<Real>::GetDegree () const { return m_kBasis.GetDegree(); } //---------------------------------------------------------------------------- template <class Real> bool NURBSCurve2<Real>::IsOpen () const { return m_kBasis.IsOpen(); } //---------------------------------------------------------------------------- template <class Real> bool NURBSCurve2<Real>::IsUniform () const { return m_kBasis.IsUniform(); } //---------------------------------------------------------------------------- template <class Real> bool NURBSCurve2<Real>::IsLoop () const { return m_bLoop; } //---------------------------------------------------------------------------- template <class Real> void NURBSCurve2<Real>::SetControlPoint (int i, const Vector2<Real>& rkCtrl) { if (0 <= i && i < m_iNumCtrlPoints) { // set the control point m_akCtrlPoint[i] = rkCtrl; // set the replicated control point if (i < m_iReplicate) { m_akCtrlPoint[m_iNumCtrlPoints+i] = rkCtrl; } } } //---------------------------------------------------------------------------- template <class Real> Vector2<Real> NURBSCurve2<Real>::GetControlPoint (int i) const { if (0 <= i && i < m_iNumCtrlPoints) { return m_akCtrlPoint[i]; } return Vector2<Real>(Math<Real>::MAX_REAL,Math<Real>::MAX_REAL); } //---------------------------------------------------------------------------- template <class Real> void NURBSCurve2<Real>::SetControlWeight (int i, Real fWeight) { if (0 <= i && i < m_iNumCtrlPoints) { // set the control weight m_afCtrlWeight[i] = fWeight; // set the replicated control weight if (i < m_iReplicate) { m_afCtrlWeight[m_iNumCtrlPoints+i] = fWeight; } } } //---------------------------------------------------------------------------- template <class Real> Real NURBSCurve2<Real>::GetControlWeight (int i) const { if (0 <= i && i < m_iNumCtrlPoints) { return m_afCtrlWeight[i]; } return Math<Real>::MAX_REAL; } //---------------------------------------------------------------------------- template <class Real> void NURBSCurve2<Real>::SetKnot (int i, Real fKnot) { m_kBasis.SetKnot(i,fKnot); } //---------------------------------------------------------------------------- template <class Real> Real NURBSCurve2<Real>::GetKnot (int i) const { return m_kBasis.GetKnot(i); } //---------------------------------------------------------------------------- template <class Real> void NURBSCurve2<Real>::Get (Real fTime, Vector2<Real>* pkPos, Vector2<Real>* pkDer1, Vector2<Real>* pkDer2, Vector2<Real>* pkDer3) const { int i, iMin, iMax; if (pkDer3) { m_kBasis.Compute(fTime,0,iMin,iMax); m_kBasis.Compute(fTime,1,iMin,iMax); m_kBasis.Compute(fTime,2,iMin,iMax); m_kBasis.Compute(fTime,3,iMin,iMax); } else if (pkDer2) { m_kBasis.Compute(fTime,0,iMin,iMax); m_kBasis.Compute(fTime,1,iMin,iMax); m_kBasis.Compute(fTime,2,iMin,iMax); } else if (pkDer1) { m_kBasis.Compute(fTime,0,iMin,iMax); m_kBasis.Compute(fTime,1,iMin,iMax); } else // pkPos { m_kBasis.Compute(fTime,0,iMin,iMax); } Real fTmp; // compute position Vector2<Real> kX = Vector2<Real>::ZERO; Real fW = (Real)0.0; for (i = iMin; i <= iMax; i++) { fTmp = m_kBasis.GetD0(i)*m_afCtrlWeight[i]; kX += fTmp*m_akCtrlPoint[i]; fW += fTmp; } Real fInvW = ((Real)1.0)/fW; Vector2<Real> kP = fInvW*kX; if (pkPos) { *pkPos = kP; } if (!pkDer1 && !pkDer2 && !pkDer3) { return; } // compute first derivative Vector2<Real> kXDer1 = Vector2<Real>::ZERO; Real fWDer1 = (Real)0.0; for (i = iMin; i <= iMax; i++) { fTmp = m_kBasis.GetD1(i)*m_afCtrlWeight[i]; kXDer1 += fTmp*m_akCtrlPoint[i]; fWDer1 += fTmp; } Vector2<Real> kPDer1 = fInvW*(kXDer1 - fWDer1*kP); if (pkDer1) { *pkDer1 = kPDer1; } if (!pkDer2 && !pkDer3) { return; } // compute second derivative Vector2<Real> kXDer2 = Vector2<Real>::ZERO; Real fWDer2 = (Real)0.0; for (i = iMin; i <= iMax; i++) { fTmp = m_kBasis.GetD2(i)*m_afCtrlWeight[i]; kXDer2 += fTmp*m_akCtrlPoint[i]; fWDer2 += fTmp; } Vector2<Real> kPDer2 = fInvW*(kXDer2-((Real)2.0)*fWDer1*kPDer1-fWDer2*kP); if (pkDer2) { *pkDer2 = kPDer2; } if (!pkDer3) { return; } // compute third derivative Vector2<Real> kXDer3 = Vector2<Real>::ZERO; Real fWDer3 = (Real)0.0; for (i = iMin; i <= iMax; i++) { fTmp = m_kBasis.GetD3(i)*m_afCtrlWeight[i]; kXDer3 += fTmp*m_akCtrlPoint[i]; fWDer3 += fTmp; } if (pkDer3) { *pkDer3 = fInvW*(kXDer3 - ((Real)3.0)*fWDer1*kPDer2 - ((Real)3.0)*fWDer2*kPDer1 -fWDer3*kP); } } //---------------------------------------------------------------------------- template <class Real> BSplineBasis<Real>& NURBSCurve2<Real>::GetBasis () { return m_kBasis; } //---------------------------------------------------------------------------- template <class Real> Vector2<Real> NURBSCurve2<Real>::GetPosition (Real fTime) const { Vector2<Real> kPos; Get(fTime,&kPos,0,0,0); return kPos; } //---------------------------------------------------------------------------- template <class Real> Vector2<Real> NURBSCurve2<Real>::GetFirstDerivative (Real fTime) const { Vector2<Real> kDer1; Get(fTime,0,&kDer1,0,0); return kDer1; } //---------------------------------------------------------------------------- template <class Real> Vector2<Real> NURBSCurve2<Real>::GetSecondDerivative (Real fTime) const { Vector2<Real> kDer2; Get(fTime,0,0,&kDer2,0); return kDer2; } //---------------------------------------------------------------------------- template <class Real> Vector2<Real> NURBSCurve2<Real>::GetThirdDerivative (Real fTime) const { Vector2<Real> kDer3; Get(fTime,0,0,0,&kDer3); return kDer3; } //---------------------------------------------------------------------------- template <class Real> Real NURBSCurve2<Real>::GetVariation (Real, Real, const Vector2<Real>*, const Vector2<Real>*) const { // TO DO. return (Real)0.0; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // explicit instantiation //---------------------------------------------------------------------------- template WM4_FOUNDATION_ITEM class NURBSCurve2<float>; template WM4_FOUNDATION_ITEM class NURBSCurve2<double>; //---------------------------------------------------------------------------- }
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 340 ] ] ]
8d5558fe8ee67744b2c007e2c43e2c76b299d96a
3856c39683bdecc34190b30c6ad7d93f50dce728
/LastProject/Source/Frequency.cpp
3bca93737d41adf55656a0202a2a0f5bf618de50
[]
no_license
yoonhada/nlinelast
7ddcc28f0b60897271e4d869f92368b22a80dd48
5df3b6cec296ce09e35ff0ccd166a6937ddb2157
refs/heads/master
2021-01-20T09:07:11.577111
2011-12-21T22:12:36
2011-12-21T22:12:36
34,231,967
0
0
null
null
null
null
UHC
C++
false
false
660
cpp
/** @file Frequency.cpp @date 2011/09/17 @author 황윤하 @brief 프레임 측정 */ #include "stdafx.h" CFrequency::CFrequency() : m_fFrequency( 0.0f ) , m_fFrametime( 0.0f ) , m_nFrames( 0 ) { QueryPerformanceFrequency( &Frequency ); } CFrequency::~CFrequency() { } VOID CFrequency::Update() { QueryPerformanceCounter( &EndCounter ); m_fFrametime = static_cast<FLOAT>( EndCounter.QuadPart - StartCounter.QuadPart ) / static_cast<FLOAT>(Frequency.QuadPart); if( m_fFrametime > 1.0f ) { m_fFrametime = 0.0f; } StartCounter = EndCounter; m_fFrequency = 1.0f / m_fFrametime; m_nFrames = 0; }
[ "[email protected]@d02aaf57-2019-c8cd-d06c-d029ef2af4e0" ]
[ [ [ 1, 34 ] ] ]
7f820dcf17078f808bbb58468dc2b6e275f2ec4f
d7320c9c1f155e2499afa066d159bfa6aa94b432
/ghost/csvparser.cpp
b54e7a8283b5afeaa9192de10ebb31131dce4252
[]
no_license
HOST-PYLOS/ghostnordicleague
c44c804cb1b912584db3dc4bb811f29f3761a458
9cb262d8005dda0150b75d34b95961d664b1b100
refs/heads/master
2016-09-05T10:06:54.279724
2011-02-23T08:02:50
2011-02-23T08:02:50
32,241,503
0
1
null
null
null
null
UTF-8
C++
false
false
3,408
cpp
/* Copyright (c) 2001, Mayukh Bose 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 Mayukh Bose nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <iostream> #include <cstdlib> #include "csvparser.h" using namespace std; CSVParser::CSVParser() { m_sData = ""; m_nPos = 0; } void CSVParser::SkipSpaces(void) { while (m_nPos < m_sData.length() && m_sData[m_nPos] == ' ') m_nPos++; } const CSVParser & CSVParser::operator <<(const string & sIn) { this->m_sData = sIn; this->m_nPos = 0; return *this; } const CSVParser & CSVParser::operator <<(const char *sIn) { this->m_sData = sIn; this->m_nPos = 0; return *this; } CSVParser & CSVParser::operator >>(int & nOut) { string sTmp = ""; SkipSpaces(); while (m_nPos < m_sData.length() && m_sData[m_nPos] != ',') sTmp += m_sData[m_nPos++]; m_nPos++; // skip past comma nOut = atoi(sTmp.c_str()); return *this; } CSVParser & CSVParser::operator >>(double & nOut) { string sTmp = ""; SkipSpaces(); while (m_nPos < m_sData.length() && m_sData[m_nPos] != ',') sTmp += m_sData[m_nPos++]; m_nPos++; // skip past comma nOut = atof(sTmp.c_str()); return *this; } CSVParser & CSVParser::operator >>(string & sOut) { bool bQuotes = false; sOut = ""; SkipSpaces(); // Jump past first " if necessary if (m_nPos < m_sData.length() && m_sData[m_nPos] == '"') { bQuotes = true; m_nPos++; } while (m_nPos < m_sData.length()) { if (!bQuotes && m_sData[m_nPos] == ',') break; if (bQuotes && m_sData[m_nPos] == '"') { if (m_nPos + 1 >= m_sData.length() - 1) break; if (m_sData[m_nPos+1] == ',') break; } sOut += m_sData[m_nPos++]; } // Jump past last " if necessary if (bQuotes && m_nPos < m_sData.length() && m_sData[m_nPos] == '"') m_nPos++; // Jump past , if necessary if (m_nPos < m_sData.length() && m_sData[m_nPos] == ',') m_nPos++; return *this; }
[ "fredrik.sigillet@4a4c9648-eef2-11de-9456-cf00f3bddd4e" ]
[ [ [ 1, 122 ] ] ]
d4d2c2fb6eb0c9ac4a06b444f82908bd6b8b6936
91b964984762870246a2a71cb32187eb9e85d74e
/SRC/OFFI SRC!/_Interface/WndUserMarkNameChanger.cpp
fd25269d2ca7d4522bad49572400e55d87d6d85d
[]
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
WINDOWS-1252
C++
false
false
2,749
cpp
#include "StdAfx.h" #ifdef __IMPROVE_MAP_SYSTEM #ifdef __CLIENT #include "WndUserMarkNameChanger.h" #include "ResData.h" //----------------------------------------------------------------------------- CWndUserMarkNameChanger::CWndUserMarkNameChanger( void ) : m_dwUserMarkPositionInfoID( 0 ) { } //----------------------------------------------------------------------------- CWndUserMarkNameChanger::~CWndUserMarkNameChanger( void ) { } //----------------------------------------------------------------------------- BOOL CWndUserMarkNameChanger::Initialize( CWndBase* pWndParent, DWORD dwWndId ) { return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_USER_MARK_NAME_CHANGER, WBS_MODAL | WBS_KEY, CPoint( 0, 0 ), pWndParent ); } //----------------------------------------------------------------------------- void CWndUserMarkNameChanger::OnInitialUpdate( void ) { CWndNeuz::OnInitialUpdate(); CWndEdit* pWndEditNameChanger = ( CWndEdit* )GetDlgItem( WIDC_EDIT_NAME_CHANGER ); if( pWndEditNameChanger ) { pWndEditNameChanger->SetMaxStringNumber( USER_MARK_NAME_MAX_LENGTH ); pWndEditNameChanger->SetFocus(); } CWndButton* pWndButtonOK = ( CWndButton* )GetDlgItem( WIDC_BUTTON_OK ); if( pWndButtonOK ) { pWndButtonOK->SetDefault( TRUE ); } MoveParentCenter(); } //----------------------------------------------------------------------------- BOOL CWndUserMarkNameChanger::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) { switch( nID ) { case WIDC_BUTTON_OK: { CWndEdit* pWndEditNameChanger = ( CWndEdit* )GetDlgItem( WIDC_EDIT_NAME_CHANGER ); if( pWndEditNameChanger == NULL ) { break; } CUserMarkPositionInfo* pUserMarkPositionInfo = prj.m_MapInformationManager.FindUserMarkPositionInfo( m_dwUserMarkPositionInfoID ); if( pUserMarkPositionInfo == NULL ) { break; } CString strChangedName = pWndEditNameChanger->GetString(); if( strChangedName == _T( "" ) ) { strChangedName = _T( "À§Ä¡" ); } pUserMarkPositionInfo->SetName( strChangedName ); Destroy(); break; } } return CWndNeuz::OnChildNotify( message, nID, pLResult ); } //----------------------------------------------------------------------------- void CWndUserMarkNameChanger::SetInfo( DWORD dwUserMarkPositionInfoID, const CString& strName ) { m_dwUserMarkPositionInfoID = dwUserMarkPositionInfoID; CWndEdit* pWndEditNameChanger = ( CWndEdit* )GetDlgItem( WIDC_EDIT_NAME_CHANGER ); if( pWndEditNameChanger ) { pWndEditNameChanger->SetString( strName ); } } //----------------------------------------------------------------------------- #endif // __CLIENT #endif // __IMPROVE_MAP_SYSTEM
[ "[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278" ]
[ [ [ 1, 87 ] ] ]
e1894759d236402e488e7dc68ffffde1f1ccee62
a7990bf2f56d927ae884db0e727c17394bda39c4
/image-approx/BTreeIter.cpp
91be248c23bb4d8887da8909ace9e61756549866
[]
no_license
XPaladin/image-approx
600862d8d76264e25f96ae10f3a9f5639a678b17
b0fbddef0e58ae1ba2b5e31f7eb87e2a48509dfb
refs/heads/master
2016-09-01T17:49:01.705563
2009-06-15T06:01:46
2009-06-15T06:01:46
33,272,564
0
0
null
null
null
null
UTF-8
C++
false
false
702
cpp
#include "BTreeIter.h" BTreeIter::BTreeIter() { assert(false); } BTreeIter::~BTreeIter() { delete list; } BTreeIter::BTreeIter(BTree *btree){ bt=btree; list=new List<BTree *>(); } bool BTreeIter::isDone(){ return list->isDone(); } void BTreeIter::next(){ list->next(); } void BTreeIter::first(){ agregar(bt); list->first(); } int BTreeIter::size()const{ return list->size(); } Rectangle * BTreeIter::currentItem()const{ return list->currentItem()->getRectangle().clone(); } void BTreeIter::agregar(BTree * bt){ if(!bt->isLeaf()){ agregar(bt->son(0)); agregar(bt->son(1)); } list->append(bt); }
[ "pala.sepu@17da7754-4e6e-11de-84bb-6bba061bd1d3" ]
[ [ [ 1, 44 ] ] ]
1c6b18f94c6c35e1bddca0ec7a86aeaf7ea15906
bcebfeabcd5679e9d0eb01cd125c3923292ccf71
/trunk/DataStructs.h
67c61afa781074e38de1405d7cd3c8212bab5f79
[]
no_license
BackupTheBerlios/feedit-svn
792e0a6a2aed5407ca8d58a756e43d618f2ce0da
44e9e5382e7fede28b24efb06f1fad0341a650f9
refs/heads/master
2020-06-02T00:22:36.175763
2006-09-07T01:10:46
2006-09-07T01:10:46
40,669,296
0
0
null
null
null
null
UTF-8
C++
false
false
853
h
#pragma once class TreeData { public: virtual CAtlString ToString() = 0; int m_id; }; class FolderData : public TreeData { public: CAtlString ToString() { return "Folder"; } CAtlString m_name; }; class FeedData : public TreeData { public: CAtlString ToString() { return "Feed"; } CAtlString m_error; CAtlString m_title; CAtlString m_link; CAtlString m_image; CAtlString m_description; CAtlString m_rsslink; int m_unread; int m_navigateURL; }; class ListData { public: virtual CAtlString ToString() = 0; int m_id; CAtlString m_url; }; class NewsData : public ListData { public: CAtlString ToString() { return "News"; } CAtlString m_issued; CAtlString m_title; CAtlString m_description; bool m_unread; bool m_flagged; HTREEITEM m_feedTreeItem; };
[ "Sandro@b60034a5-fb9b-f04b-b957-2f3957cf9ea0", "gururamnath@b60034a5-fb9b-f04b-b957-2f3957cf9ea0" ]
[ [ [ 1, 34 ], [ 36, 63 ] ], [ [ 35, 35 ] ] ]
5f532d9738443b9f78dcdc24e1752e7b267b1935
faa30f88bd88c37ad26aeda4571668db572a140d
/codecs/VideoCodecInfo.cpp
f7d2bb8288ca342698cd6f28f1814fcbd6f1871d
[]
no_license
simophin/remotevision
88fa6ea7183c79c239474d330c05b2879836735b
2f28b9fbb82a5b92a36e0a2b1ead067dbf0e55ab
refs/heads/master
2016-09-05T18:07:42.069906
2011-06-16T08:42:31
2011-06-16T08:42:31
1,744,350
2
0
null
null
null
null
UTF-8
C++
false
false
1,031
cpp
/* * VideoCodecInfo.cpp * * Created on: 2011-5-5 * Author: launliu */ #include "VideoCodec.h" #include "VideoCodecId.h" struct IdStrMap { VideoCodecId id; const char *str; }; static struct IdStrMap ID_STR_MAPS[] = { { VCODEC_INVALID, "INVALID" }, { VCODEC_FLV, "FLV" }, { VCODEC_MJPEG, "MJPEG" }, { VCODEC_RAW, "RAW" }, { VCODEC_MPEG4, "MPEG4" }, { VCODEC_HUFFYUV, "HUFFYUV" }, }; const static size_t ID_STR_MAPS_SIZE = sizeof(ID_STR_MAPS)/sizeof(struct IdStrMap); String VideoCodec:: getStringFromId (VideoCodecId id) { int found_index = 0; for (int i=0; i<ID_STR_MAPS_SIZE; i++) { if (id == ID_STR_MAPS[i].id) { found_index = i; break; } } return String(ID_STR_MAPS[found_index].str); } VideoCodecId VideoCodec:: getIdFromString(const String &str) { int found_index = 0; for (int i=0; i<ID_STR_MAPS_SIZE; i++) { if (str == ID_STR_MAPS[i].str) { found_index = i; break; } } return ID_STR_MAPS[found_index].id; }
[ "simophin@c14b904f-9159-43ec-a207-ffd88ec269a7", "[email protected]", "simophin@localhost", "Fanchao [email protected]" ]
[ [ [ 1, 10 ], [ 28, 28 ], [ 37, 39 ], [ 48, 48 ], [ 50, 50 ] ], [ [ 11, 20 ], [ 23, 26 ], [ 29, 35 ], [ 41, 47 ], [ 49, 49 ] ], [ [ 21, 22 ] ], [ [ 27, 27 ], [ 36, 36 ], [ 40, 40 ] ] ]
71657c243f90421b287c101e09fd8d5fb5437e24
c1c3866586c56ec921cd8c9a690e88ac471adfc8
/Qt_Practise/MFC_CString_Test/MFC_CString_TestDlg.h
e86582b0d58c57d6668d3eb89c03d9cb2534ce4d
[]
no_license
rtmpnewbie/lai3d
0802dbb5ebe67be2b28d9e8a4d1cc83b4f36b14f
b44c9edfb81fde2b40e180a651793fec7d0e617d
refs/heads/master
2021-01-10T04:29:07.463289
2011-03-22T17:51:24
2011-03-22T17:51:24
36,842,700
1
0
null
null
null
null
GB18030
C++
false
false
640
h
// MFC_CString_TestDlg.h : 头文件 // #pragma once // CMFC_CString_TestDlg 对话框 class CMFC_CString_TestDlg : public CDialog { // 构造 public: CMFC_CString_TestDlg(CWnd* pParent = NULL); // 标准构造函数 // 对话框数据 enum { IDD = IDD_MFC_CSTRING_TEST_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 // 实现 protected: HICON m_hIcon; // 生成的消息映射函数 virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() };
[ "laiyanlin@27d9c402-1b7e-11de-9433-ad2e3fad96c5" ]
[ [ [ 1, 31 ] ] ]
23102697057f9ddd2883f97d5f07386c64f31293
cd1b72e71f52456e28716c426ec281c8b60b43e5
/ cs340-pacman/dot.h
376758bb9e79bc74842b81530414233a0bd34e09
[]
no_license
ShawnHuang/cs340-pacman
137d12510a2747fe8ea1ce905b3332ba168ea992
9979f59fd34c90550fe5375573efe40c80f60381
refs/heads/master
2020-06-04T13:04:47.234599
2009-12-05T15:01:25
2009-12-05T15:01:25
32,971,724
0
0
null
null
null
null
UTF-8
C++
false
false
464
h
#ifndef DOT_H #define DOT_H #include <QGraphicsItem> #define ID_DOT 1 class Dot : public QGraphicsItem //Class Wall { public: virtual int type() const; Dot(); Dot(int width, int height); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); private: QColor colorOfDot; int WIDTH_OF_DOT; int HEIGHT_OF_DOT; }; #endif // DOT_H
[ "riddhi.kapasi@c94e964c-9837-11de-bb56-53d3cd047523" ]
[ [ [ 1, 24 ] ] ]
209049ae1d74c82eaf8add111b2396987cf64129
e1b7e9b25db81b2f25088fd741e28fbc4efaf5fe
/tmp/socketSample_1/UDPEchoClient.cpp
04de0cc684e72d9b85cba235a64b6e86145876e0
[]
no_license
AaronMR/AaronMR_Robotic_Stack
c00260cf1b992806e58838688702ab240bf34233
34d5449f9ca0ffc08fac4f5d48a7c4db03bb018a
refs/heads/master
2020-03-29T21:42:23.501525
2011-02-23T17:07:29
2011-02-23T17:07:29
1,364,684
6
0
null
null
null
null
UTF-8
C++
false
false
2,534
cpp
/* * C++ sockets on Unix and Windows * Copyright (C) 2002 * * 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 "PracticalSocket.h" // For UDPSocket and SocketException #include <iostream> // For cout and cerr #include <cstdlib> // For atoi() using namespace std; const int ECHOMAX = 255; // Longest string to echo int main(int argc, char *argv[]) { if ((argc < 3) || (argc > 4)) { // Test for correct number of arguments cerr << "Usage: " << argv[0] << " <Server> <Echo String> [<Server Port>]\n"; exit(1); } string servAddress = argv[1]; // First arg: server address char* echoString = argv[2]; // Second arg: string to echo int echoStringLen = strlen(echoString); // Length of string to echo if (echoStringLen > ECHOMAX) { // Check input length cerr << "Echo string too long" << endl; exit(1); } unsigned short echoServPort = Socket::resolveService( (argc == 4) ? argv[3] : "echo", "udp"); try { UDPSocket sock; // Send the string to the server sock.sendTo(echoString, echoStringLen, servAddress, echoServPort); // Receive a response char echoBuffer[ECHOMAX + 1]; // Buffer for echoed string + \0 int respStringLen; // Length of received response if ((respStringLen = sock.recv(echoBuffer, ECHOMAX)) != echoStringLen) { cerr << "Unable to receive" << endl; exit(1); } echoBuffer[respStringLen] = '\0'; // Terminate the string! cout << "Received: " << echoBuffer << endl; // Print the echoed arg // Destructor closes the socket } catch (SocketException &e) { cerr << e.what() << endl; exit(1); } return 0; }
[ [ [ 1, 70 ] ] ]
7b18e4726b6d68c2c15738ee0a15ddbc86a0bae0
b8fbe9079ce8996e739b476d226e73d4ec8e255c
/src/engine/rb_util/functor.h
141f6031568af1bb0d014ea49b785a57258b26c6
[]
no_license
dtbinh/rush
4294f84de1b6e6cc286aaa1dd48cf12b12a467d0
ad75072777438c564ccaa29af43e2a9fd2c51266
refs/heads/master
2021-01-15T17:14:48.417847
2011-06-16T17:41:20
2011-06-16T17:41:20
41,476,633
1
0
null
2015-08-27T09:03:44
2015-08-27T09:03:44
null
UTF-8
C++
false
false
1,102
h
//****************************************************************************/ // File: Functor.h //****************************************************************************/ #ifndef __FUNCTOR_H__ #define __FUNCTOR_H__ //****************************************************************************/ // Class: Functor // Desc: //****************************************************************************/ class Functor { protected: void* m_pObj; uint32_t m_pFunc; public: Functor() : m_pObj(NULL), m_pFunc(0) {} virtual void operator()() {} static Functor null; }; // class Functor template <class T> class TFunctor : public Functor { typedef void (T::*TFunc)(); public: TFunctor( T* pObj, TFunc pFunc ) { m_pObj = (void*)pObj; *((TFunc*)&m_pFunc) = pFunc; } virtual void operator()() { if (!m_pObj || !m_pFunc) return; TFunc f = *((TFunc*)&m_pFunc); (reinterpret_cast<T*>( m_pObj )->*f)(); } }; // class TFunctor #endif // __FUNCTOR_H__
[ [ [ 1, 45 ] ] ]
ff185f810886c4f193056fb6bdc377ff5276ecab
5ed707de9f3de6044543886ea91bde39879bfae6
/ASHockey/Shared/Source/ASHockeyType.h
59dd68ff0f81d2a5b963e70cb6c03bf1b02e2041
[]
no_license
grtvd/asifantasysports
9e472632bedeec0f2d734aa798b7ff00148e7f19
76df32c77c76a76078152c77e582faa097f127a8
refs/heads/master
2020-03-19T02:25:23.901618
1999-12-31T16:00:00
2018-05-31T19:48:19
135,627,290
0
0
null
null
null
null
UTF-8
C++
false
false
10,612
h
/* ASHockeyType.h */ /******************************************************************************/ /******************************************************************************/ #ifndef ASHockeyTypeH #define ASHockeyTypeH #include "ASFantasyType.h" using namespace asfantasy; namespace ashockey { /******************************************************************************/ /* ID classes */ /* Field classes */ enum THockeyPositionEnum { pos_Undefined, pos_Winger, pos_Center, pos_Defenseman, pos_Goalie, // Non-Participating Player Positions pos_ //none }; #define pos_LastKeyPos pos_Goalie #define pos_Last pos_Goalie class THockeyPosition : public EnumType<THockeyPositionEnum,pos_Undefined,pos_Last> { public: THockeyPosition(int t = pos_Undefined) : EnumType<THockeyPositionEnum,pos_Undefined,pos_Last>(t) {} THockeyPosition(const char* str); const char* c_str() const; bool isKey() const; bool isOffensive() const; }; enum THockeyLineupEnum { lut_Undefined, lut_Skater, lut_Goalie }; #define lut_Last lut_Goalie class THockeyLineup : public EnumType<THockeyLineupEnum,lut_Undefined,lut_Last> { public: THockeyLineup(int t = lut_Undefined) : EnumType<THockeyLineupEnum,lut_Undefined,lut_Last>(t) {} }; /******************************************************************************/ enum TRosterStatusEnum { rst_Undefined, rst_Active, rst_Disabled, rst_Inactive }; #define rst_Last rst_Inactive class TRosterStatus : public EnumType<TRosterStatusEnum,rst_Undefined,rst_Last> { public: TRosterStatus(int t = rst_Undefined) : EnumType<TRosterStatusEnum,rst_Undefined,rst_Last>(t) {} TRosterStatus(const char* str); const char* c_str() const; }; /******************************************************************************/ /* Undefined TotalPoints GamesPlayed Goals Assists PenaltyMinutes Shots PlusMinus PowerPlayGoals PowerPlayAssists ShortHandedGoals ShortHandedAssists GameWinningGoals GameTyingGoals OvertimeGoals HatTricks GamesStarted Wins Losses Ties GoalsAgainst Saves Shutouts */ enum THockeyPlayerStatEnum { pst_Undefined = 0, //Both pst_TotalPoints, pst_GamesPlayed, // Offense pst_Goals, pst_Assists, pst_PenaltyMinutes, pst_Shots, pst_PlusMinus, pst_PowerPlayGoals, pst_PowerPlayAssists, pst_ShortHandedGoals, pst_ShortHandedAssists, pst_GameWinningGoals, pst_GameTyingGoals, pst_OvertimeGoals, pst_HatTricks, // Defense pst_GamesStarted, pst_Wins, pst_Losses, pst_Ties, pst_GoalsAgainst, pst_Saves, pst_Shutouts, }; #define pst_Last pst_Shutouts class THockeyPlayerStatType : public EnumType<THockeyPlayerStatEnum, pst_Undefined,pst_Last> { public: THockeyPlayerStatType(int t = pst_Undefined) : EnumType<THockeyPlayerStatEnum,pst_Undefined,pst_Last>(t) {} bool isOffensive() const { return(fT < pst_GamesStarted); } }; /******************************************************************************/ class THockeyTeam : public TTeam { protected: TPlayerIDVector fSkaterLineup; TPlayerIDVector fGoalieLineup; protected: THockeyTeam() {} virtual ~THockeyTeam() {} public: virtual void clear(); virtual const TPlayerIDVector& lineupConst(TLineup lineup) const; virtual TPlayerIDVector& lineup(TLineup lineup); protected: /* DataSetRecord methods */ virtual void readFromDataSet(TDataSet& dataSet); virtual void writeToDataSet(TDataSet& dataSet); public: friend class RefCountPtr<THockeyTeam>; friend class ASHockeyObjectBuilder; }; class THockeyTeamPtr : public TDataSetRecordPtr<THockeyTeam,TTeamID> { public: THockeyTeamPtr(TTeamPtr teamPtr = TTeamPtr()) : TDataSetRecordPtr<THockeyTeam,TTeamID>( teamPtr.isNull() ? NULL : &dynamic_cast<THockeyTeam&>(*teamPtr)) {} operator TTeamPtr() { return(TTeamPtr(fT)); } }; /******************************************************************************/ class THockeyProfPlayer : public TProfPlayer { protected: THockeyPosition fPosition; TRosterStatus fRosterStatus; protected: THockeyProfPlayer() {} virtual ~THockeyProfPlayer() {} public: virtual void clear(); virtual int getPosition() const { return(fPosition); } virtual void setPosition(int position) { fPosition = position; setHasChanged(); } void setRosterStatus(TRosterStatus rosterStatus) { fRosterStatus = rosterStatus; setHasChanged(); } TRosterStatus getRosterStatus(void) const { return (fRosterStatus); } virtual const char* getRosterStatusString() const { return(fRosterStatus.c_str()); } virtual const char* getInjuryStatusString() const { return(""); } protected: /* DataSetRecord methods */ virtual void readFromDataSet(TDataSet& dataSet); virtual void writeToDataSet(TDataSet& dataSet); virtual void validateForUpdate(); friend class RefCountPtr<THockeyProfPlayer>; friend class ASHockeyObjectBuilder; }; class THockeyProfPlayerPtr : public TDataSetRecordPtr<THockeyProfPlayer,TPlayerID> { public: THockeyProfPlayerPtr(TProfPlayerPtr profPlayerPtr = TProfPlayerPtr()) : TDataSetRecordPtr<THockeyProfPlayer,TPlayerID>( profPlayerPtr.isNull() ? NULL : &dynamic_cast<THockeyProfPlayer&>(*profPlayerPtr)) {} operator TProfPlayerPtr() { return(TProfPlayerPtr(fT)); } }; /******************************************************************************/ /* GamesPlayed Goals Assists Points Shots PlusMinus PowerPlayGoals PowerPlayAssists ShortHandedGoals ShortHandedAssists GameWinningGoals GameTyingGoals EmptyNetGoals OvertimeGoals MajorPenalties MinorPenalties PenaltyMinutes HatTricks Fights */ class TOffGameStatDetail { public: short fGamesPlayed; short fGoals; short fAssists; short fPoints; short fShots; short fPlusMinus; short fPowerPlayGoals; short fPowerPlayAssists; short fShortHandedGoals; short fShortHandedAssists; short fGameWinningGoals; short fGameTyingGoals; short fEmptyNetGoals; short fOvertimeGoals; //fTotalPenalties = fMajorPenalties + fMinorPenalties short fMajorPenalties; short fMinorPenalties; short fPenaltyMinutes; short fHatTricks; short fFights; public: TOffGameStatDetail() { clear(); } virtual void clear(); short calcTotalPoints() const; double getStat(int playerStatType); void sumStats(const TOffGameStatDetail& offGameStatDetail); }; /******************************************************************************/ /* GamesPlayed GamesStarted MinutesPlayed Wins Losses Ties GoalsAgainst EmptyNetGoalsAgainst ShotsAgainst Saves Shutouts MajorPenalties PenaltyMinutes Fights */ class TDefGameStatDetail { public: short fGamesPlayed; short fGamesStarted; short fMinutesPlayed; short fWins; short fLosses; short fTies; short fGoalsAgainst; short fEmptyNetGoalsAgainst; short fShotsAgainst; short fSaves; short fShutouts; short fMajorPenalties; short fPenaltyMinutes; short fFights; public: TDefGameStatDetail() { clear(); } virtual void clear(); short calcTotalPoints() const; double getStat(int playerStatType); void sumStats(const TDefGameStatDetail& defGameStatDetail); }; /******************************************************************************/ class THockeyOffGameStat : public TOffGameStat { protected: TOffGameStatDetail fOffGameStatDetail; protected: THockeyOffGameStat() {} virtual ~THockeyOffGameStat() {} public: virtual void clear(); TOffGameStatDetail& offGameStatDetail() { setHasChanged(); return(fOffGameStatDetail); } const TOffGameStatDetail& offGameStatDetail() const { return(fOffGameStatDetail); } virtual void calcTotalPoints() { fTotalPoints = fOffGameStatDetail.calcTotalPoints(); setHasChanged(); } virtual double getStat(int playerStatType); static CStr31 getDefaultStatStr(int playerStatType); virtual CStr31 getStatStr(int playerStatType); virtual void sumStats(const TOffGameStatPtr offGameStatPtr); protected: /* DataSetRecord methods */ virtual void readFromDataSet(TDataSet& dataSet); virtual void writeToDataSet(TDataSet& dataSet); virtual void validateForUpdate(); friend class RefCountPtr<THockeyOffGameStat>; friend class ASHockeyObjectBuilder; }; class THockeyOffGameStatPtr : public TDataSetRecordPtr<THockeyOffGameStat, TPlayerDateID> { public: THockeyOffGameStatPtr(TOffGameStatPtr offGameStatPtr = TOffGameStatPtr()) : TDataSetRecordPtr<THockeyOffGameStat,TPlayerDateID>( offGameStatPtr.isNull() ? NULL : &dynamic_cast<THockeyOffGameStat&>(*offGameStatPtr)) {} operator TOffGameStatPtr() { return(TOffGameStatPtr(fT)); } }; /******************************************************************************/ class THockeyDefGameStat : public TDefGameStat { protected: TDefGameStatDetail fDefGameStatDetail; protected: THockeyDefGameStat() {} virtual ~THockeyDefGameStat() {} public: virtual void clear(); TDefGameStatDetail& defGameStatDetail() { setHasChanged(); return(fDefGameStatDetail); } const TDefGameStatDetail& defGameStatDetail() const { return(fDefGameStatDetail); } virtual void calcTotalPoints() { fTotalPoints = fDefGameStatDetail.calcTotalPoints(); setHasChanged(); } virtual double getStat(int playerStatType); static CStr31 getDefaultStatStr(int playerStatType); virtual CStr31 getStatStr(int playerStatType); virtual void sumStats(const TDefGameStatPtr defGameStatPtr); protected: /* DataSetRecord methods */ virtual void readFromDataSet(TDataSet& dataSet); virtual void writeToDataSet(TDataSet& dataSet); virtual void validateForUpdate(); friend class RefCountPtr<THockeyDefGameStat>; friend class ASHockeyObjectBuilder; }; class THockeyDefGameStatPtr : public TDataSetRecordPtr<THockeyDefGameStat, TPlayerDateID> { public: THockeyDefGameStatPtr(TDefGameStatPtr defGameStatPtr = TDefGameStatPtr()) : TDataSetRecordPtr<THockeyDefGameStat,TPlayerDateID>( defGameStatPtr.isNull() ? NULL : &dynamic_cast<THockeyDefGameStat&>(*defGameStatPtr)) {} operator TDefGameStatPtr() { return(TDefGameStatPtr(fT)); } }; /******************************************************************************/ }; //namespace ashockey #endif //ASHockeyType /******************************************************************************/ /******************************************************************************/
[ [ [ 1, 454 ] ] ]
32c1590656430149e366c448537da61542e45d91
68cfffb549ab1cb32e02db4f80ed001a912e455b
/reference/GreedySnake/GreedySnake/SuikayStrategy.cpp
f46a832a9ea324548a83051305bc0300e477fd61
[]
no_license
xhbang/Console-snake
e462d6c206dc1dd071640f0ad203eb367460b2c8
a61cf9d91744f084741e2c29b930d9646256479b
refs/heads/master
2016-09-10T20:18:10.598179
2011-12-05T10:33:51
2011-12-05T10:33:51
2,902,986
0
0
null
null
null
null
UTF-8
C++
false
false
1,144
cpp
#include "StdAfx.h" #include "SuikayStrategy.h" #include "Manager.h" SuikayStrategy::SuikayStrategy(void) { } SuikayStrategy::~SuikayStrategy(void) { } DIRECTION SuikayStrategy::chooseDirection(CPoint snakeHead) { CPoint PFruit = Manager::theManager()->getFruitPalce(); if (Manager::theManager()->isLegal(CPoint(snakeHead.x+1, snakeHead.y)) && snakeHead.x < PFruit.x) return DOWN; if (Manager::theManager()->isLegal(CPoint(snakeHead.x-1, snakeHead.y)) && snakeHead.x > PFruit.x) return UP; if (Manager::theManager()->isLegal(CPoint(snakeHead.x, snakeHead.y+1)) && snakeHead.y < PFruit.y) return RIGHT; if (Manager::theManager()->isLegal(CPoint(snakeHead.x, snakeHead.y-1)) && snakeHead.y > PFruit.y) return LEFT; ////////////////////////////////////////////////////////////////////////// if (Manager::theManager()->isLegal(CPoint(snakeHead.x+1, snakeHead.y))) return DOWN; if (Manager::theManager()->isLegal(CPoint(snakeHead.x-1, snakeHead.y))) return UP; if (Manager::theManager()->isLegal(CPoint(snakeHead.x, snakeHead.y+1))) return RIGHT; return LEFT; }
[ [ [ 1, 44 ] ] ]
6c30e08e3518a2338c824fe95e608967d107714b
36d0ddb69764f39c440089ecebd10d7df14f75f3
/プログラム/Game/Object/GameScene/AI/PlayerAI.h
2d8aa8911593cf5e00a7e71da5da2eece9cc10b5
[]
no_license
weimingtom/tanuki-mo-issyo
3f57518b4e59f684db642bf064a30fc5cc4715b3
ab57362f3228354179927f58b14fa76b3d334472
refs/heads/master
2021-01-10T01:36:32.162752
2009-04-19T10:37:37
2009-04-19T10:37:37
48,733,344
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
1,399
h
/*******************************************************************************/ /** * @file PlayerAI.h. * * @brief プレイヤーAI定義. * * @date 2008/12/15. * * @version 1.00. * * @author Tsubasa Uragami. */ /*******************************************************************************/ #ifndef _PLAYERAI_H_ #define _PLAYERAI_H_ /*===== インクルード ==========================================================*/ #include "Object/GameScene/AI/AIBase.h" #include "IGameDevice.h" class Player; class PlayerAI : public AIBase { public: PlayerAI(IGameDevice& device, Player& player); /*=========================================================================*/ /** * @brief デストラクタ. * */ ~PlayerAI(); /*=========================================================================*/ /** * @brief 指定されたキーが押されたか判定. * */ bool GetKeyTrigger(unsigned int key); /*=========================================================================*/ /** * @brief 指定されたキーが押されているか判定. * */ bool GetKeyDown(unsigned int key); /*=========================================================================*/ /** * @brief 判定. * */ void Update(float frameTime); private: IGameDevice& m_device; Player& m_player; }; #endif
[ "rs.drip@aa49b5b2-a402-11dd-98aa-2b35b7097d33" ]
[ [ [ 1, 57 ] ] ]
bb404564e345fd5db29c134bbea818cde11af14f
14bc620a0365e83444dad45611381c7f6bcd052b
/ITUEngine/Game/HUD.cpp
644f5f1c00420cf1b900fe33b2c5dcc0f2be0c87
[]
no_license
jumoel/itu-gameengine
a5750bfdf391ae64407217bfc1df8b2a3db551c7
062dd47bc1be0f39a0add8615e81361bcaa2bd4c
refs/heads/master
2020-05-03T20:39:31.307460
2011-12-19T10:54:10
2011-12-19T10:54:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
865
cpp
#include <Game\HUD.hpp> #include "GL/glew.h" #include "GL/wglew.h" #include <Managers\MediaManager.hpp> void HUD::draw() { glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glPushMatrix(); { glLoadIdentity(); glOrtho(0.0f,640.0f,480.0f,0.0f,-100.0f,100.0f); glMatrixMode(GL_MODELVIEW); glPushMatrix(); { glLoadIdentity(); glBegin(GL_QUADS); { glColor3f(1.0f,1.0f,1.0f); glVertex3f( 20.0f, 460.0f,0.0f); glVertex3f(140.0f, 460.0f,0.0f); glVertex3f(140.0f,380.0f,0.0f); glVertex3f( 20.0f,380.0f,0.0f); } glEnd(); } glPopMatrix(); } glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); }
[ [ [ 1, 40 ] ], [ [ 41, 41 ] ] ]
48365187717cbcaa2822ea3afd95d0920646d7b7
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
/Trackers/LastFMAdapterTracker.h
d57fa4b516d594033fa7b044b284af2e97ec6a2e
[]
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
1,442
h
// /* // * // * Copyright (C) 2003-2010 Alexandros Economou // * // * This file is part of Jaangle (http://www.jaangle.com) // * // * 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, 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 GNU Make; see the file COPYING. If not, write to // * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // * http://www.gnu.org/copyleft/gpl.html // * // */ #pragma once #include "ITracker.h" class LastFMServices; class LastFMAdapterTracker:public ITracker { public: LastFMAdapterTracker():m_pLastFM(NULL) {} virtual ~LastFMAdapterTracker(void) {} virtual void SubmitTrack(Action action, const TrackerTrack& track, UINT actionTime); virtual LPCTSTR GetName() {return _T("LastFM Scrobbler");} //Extra Interface void SetLastFM(LastFMServices* pLastFM) {m_pLastFM = pLastFM;} private: LastFMServices* m_pLastFM; };
[ "outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678" ]
[ [ [ 1, 42 ] ] ]
de890e4d179e6c082ef2dd907e552bf86a33b11b
677f7dc99f7c3f2c6aed68f41c50fd31f90c1a1f
/SolidSBCTestLib/SolidSBCHarddriveConfig.h
20d36ffe64db76561d5dc30df73b1185fe1d577f
[]
no_license
M0WA/SolidSBC
0d743c71ec7c6f8cfe78bd201d0eb59c2a8fc419
3e9682e90a22650e12338785c368ed69a9cac18b
refs/heads/master
2020-04-19T14:40:36.625222
2011-12-02T01:50:05
2011-12-02T01:50:05
168,250,374
0
0
null
null
null
null
UTF-8
C++
false
false
1,500
h
#pragma once #include <SolidSBCTestSDK.h> #define SSBC_TEST_HARDDRIVE_TMP_WRITE_FILE _T("C:\\tmpwrite.dat") #define SSBC_TEST_HARDDRIVE_TMP_READ_FILE _T("C:\\tmpread.dat") #define SSBC_TEST_HARDDRIVE_THREAD_BLOCKSIZE_WRITE 1024 //4MB #define SSBC_TEST_HARDDRIVE_THREAD_BLOCKSIZE_READ 1024 //4MB class CSolidSBCHarddriveConfig : public CSolidSBCTestConfig { public: CSolidSBCHarddriveConfig(const CString& strXml = _T("")); ~CSolidSBCHarddriveConfig(void); //getter BOOL GetRandomRead(void); BOOL GetRandomWrite(void); ULONG GetReadMax(void); ULONG GetWriteMax(void); UINT GetReadWriteDelay(void); BOOL GetTransmitData(void); //setter inline BOOL SetRandomRead(const BOOL& bRandomRead) { return SetAttributeByName<BOOL>(_T("RandomRead"), bRandomRead); } inline BOOL SetRandomWrite(const BOOL& bRandomWrite) { return SetAttributeByName<BOOL>(_T("RandomWrite"), bRandomWrite); } inline BOOL SetReadMax(const ULONG& nReadMax) { return SetAttributeByName<ULONG>(_T("ReadMax"), nReadMax); } inline BOOL SetWriteMax(const ULONG& nWriteMax) { return SetAttributeByName<ULONG>(_T("WriteMax"), nWriteMax); } inline BOOL SetReadWriteDelay(const UINT& nReadWriteDelay) { return SetAttributeByName<ULONG>(_T("ReadWriteDelay"),nReadWriteDelay ); } inline BOOL SetTransmitData(const BOOL& bTransmitData) { return SetAttributeByName<BOOL>(_T("TransmitData"), bTransmitData); } protected: void RegisterAttributes(void); };
[ "admin@bd7e3521-35e9-406e-9279-390287f868d3" ]
[ [ [ 1, 47 ] ] ]
e85963ba89a28384eb44a1686f51717585335725
f6c641b102ebbffb48e93dd554a0b7eb7e639be7
/Source/Base/Base Graphics Library/TextureData2D.hpp
f3feaa4a7db56776b35f61f5a90d4d9170c7679d
[]
no_license
ZAsprose/rtrt-on-gpu
e3ca4921a3429cbc72e0cee8afd946200b83573d
4949e373c273f963467658ca25d39244da7fb4e6
refs/heads/master
2021-01-10T14:42:45.293509
2010-08-25T18:37:19
2010-08-25T18:37:19
53,016,647
0
0
null
null
null
null
UTF-8
C++
false
false
4,855
hpp
/* ----------------------------------------------------------------------------- | B A S E G R A P H I C S L I B R A R Y | ----------------------------------------------------------------------------- Copyright (c) 2009 - 2010 Denis Bogolepov ( denisbogol @ gmail.com ) This library 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. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _TEXTURE_DATA_2D_ #define _TEXTURE_DATA_2D_ #include <OpenGL.h> namespace graphics { class TextureData2D { public: /************************************************************************/ /* CONSTRUCTOR AND DESTRUCTOR */ /************************************************************************/ /* If data are created and used only on GPU set last argument to TRUE */ TextureData2D ( GLsizei width = 512, GLsizei height = 512, GLuint components = 4, bool empty = false ); ~TextureData2D ( void ); /************************************************************************/ /* OVERLOADED OPERATORS */ /************************************************************************/ operator GLfloat * ( void ); operator const GLfloat * ( void ) const; /************************************************************************/ /* PUBLIC METHODS */ /************************************************************************/ /* For accessing to texture data as a 1D array of tuples */ template < class TUPLE > TUPLE & Pixel ( GLuint x ); /* For accessing to texture data as a 2D array of tuples */ template < class TUPLE > TUPLE & Pixel ( GLuint x, GLuint y ); //------------------------------------------------------------------------ GLenum Type ( void ) const; //------------------------------------------------------------------------ GLsizei Width ( void ) const; GLsizei Height ( void ) const; //------------------------------------------------------------------------ GLenum PixelFormat ( void ) const; GLint InternalFormat ( void ) const; //------------------------------------------------------------------------ /* Possible targets: GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE_ARB */ void Upload ( GLenum target = GL_TEXTURE_RECTANGLE_ARB ); //------------------------------------------------------------------------ /* Loads data from graphics file ( BMP, PNG, JPG, TGA, DDS, PSD, HDR ) */ static TextureData2D * LoadFromFile ( char * filename ); private: /************************************************************************/ /* PRIVATE FIELDS */ /************************************************************************/ GLfloat * fPixels; //------------------------------------------------------------------------ GLsizei fWidth; GLsizei fHeight; //------------------------------------------------------------------------ GLuint fComponents; }; /********************************************************************************/ template < class TUPLE > TUPLE & TextureData2D :: Pixel ( GLuint x ) { return ( TUPLE & ) *( fPixels + x * fComponents ); } /********************************************************************************/ template < class TUPLE > TUPLE & TextureData2D :: Pixel ( GLuint x, GLuint y ) { return ( TUPLE & ) *( fPixels + ( x + y * fWidth ) * fComponents ); } } #endif
[ [ [ 1, 131 ] ] ]
1d36453348c35f600bfd8f1a952d4d1523dcce7c
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/messagingmw/BCTForSendUIAPI/src/SendUIAPITest.cpp
87bec5edc1b68b08b0204ea967315b173da60754
[]
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
7,623
cpp
/* * Copyright (c) 2002 - 2007 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: ?Description * */ // INCLUDE FILES #include <Stiftestinterface.h> #include "SendUIAPITest.h" #include <SettingServerClient.h> // EXTERNAL DATA STRUCTURES //extern ?external_data; // EXTERNAL FUNCTION PROTOTYPES //extern ?external_function( ?arg_type,?arg_type ); // CONSTANTS //const ?type ?constant_var = ?constant; // MACROS //#define ?macro ?macro_def // LOCAL CONSTANTS AND MACROS //const ?type ?constant_var = ?constant; //#define ?macro_name ?macro_def // MODULE DATA STRUCTURES //enum ?declaration //typedef ?declaration // LOCAL FUNCTION PROTOTYPES //?type ?function_name( ?arg_type, ?arg_type ); // FORWARD DECLARATIONS //class ?FORWARD_CLASSNAME; // ============================= LOCAL FUNCTIONS =============================== // ----------------------------------------------------------------------------- // ?function_name ?description. // ?description // Returns: ?value_1: ?description // ?value_n: ?description_line1 // ?description_line2 // ----------------------------------------------------------------------------- // /* ?type ?function_name( ?arg_type arg, // ?description ?arg_type arg) // ?description { ?code // ?comment // ?comment ?code } */ // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- // CSendUIAPITest::CSendUIAPITest // C++ default constructor can NOT contain any code, that // might leave. // ----------------------------------------------------------------------------- // CSendUIAPITest::CSendUIAPITest( CTestModuleIf& aTestModuleIf ): CScriptBase( aTestModuleIf ), iMessageData( NULL ), iMessageAddress( NULL ) { } // ----------------------------------------------------------------------------- // CSendUIAPITest::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CSendUIAPITest::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; TInt ret = settingServer.Connect(); if(ret != KErrNone) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings(loggerSettings); if(ret != KErrNone) { User::Leave(ret); } // Close Setting server session settingServer.Close(); TFileName logFileName; if(loggerSettings.iAddTestCaseTitle) { TName title; TestModuleIf().GetTestCaseTitleL(title); logFileName.Format(KSendUIAPITestLogFileWithTitle, &title); } else { logFileName.Copy(KSendUIAPITestLogFile); } iLog = CStifLogger::NewL( KSendUIAPITestLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); } // ----------------------------------------------------------------------------- // CSendUIAPITest::NewL // Two-phased constructor. // ----------------------------------------------------------------------------- // CSendUIAPITest* CSendUIAPITest::NewL( CTestModuleIf& aTestModuleIf ) { CSendUIAPITest* self = new (ELeave) CSendUIAPITest( aTestModuleIf ); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); return self; } // Destructor CSendUIAPITest::~CSendUIAPITest() { // Delete resources allocated from test methods Delete(); // Delete logger delete iLog; } // ----------------------------------------------------------------------------- // CSendUIAPITest::?MsgDataSetSubjectL // ?Test Case for Calling CMessageData's SetSubjectL fun // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt CSendUIAPITest::MsgDataSetSubjectL( TPtrC& aSubject ) { // Print to UI _LIT( KSendUIAPITest, "SendUIAPITest" ); _LIT( KMsgDataSetSubjectL, "In MsgDataSetSubjectL" ); TestModuleIf().Printf( 0, KSendUIAPITest, KMsgDataSetSubjectL ); // Print to log file iLog->Log( KMsgDataSetSubjectL); //Create the instance of CMessageData CMessageData* messagedata = InitL(); //Set the subject TRAPD(err,messagedata->SetSubjectL(&aSubject)); if(err == KErrNone) { return KErrNone; } else { return err; } } // ----------------------------------------------------------------------------- // CSendUIAPITest::?MsgDataCompSubjectL // ?Test Case for Calling CMessageData's Subject fun and comparing it with passed param // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt CSendUIAPITest::MsgDataCompSubjectL( TPtrC& aSubject ) { // Print to UI _LIT( KSendUIAPITest, "SendUIAPITest" ); _LIT( KMsgDataCompSubjectL, "In MsgDataCompSubjectL" ); TestModuleIf().Printf( 0, KSendUIAPITest, KMsgDataCompSubjectL ); // Print to log file iLog->Log( KMsgDataCompSubjectL); //Create the instance of CMessageData CMessageData* messagedata = InitL(); //Get the subject from message data TPtrC msgdatasubject = messagedata->Subject(); //Compare the two subjects if(msgdatasubject == aSubject) { return KErrNone; } else { return KErrGeneral; } } //----------------------------------------------------------------------------- // CSendUIAPITest::SendTestClassVersion // Method used to send version of test class //----------------------------------------------------------------------------- // void CSendUIAPITest::SendTestClassVersion() { TVersion moduleVersion; moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; TFileName moduleName; moduleName = _L("SendUIAPITest.dll"); TBool newVersionOfMethod = ETrue; TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); } // ========================== OTHER EXPORTED FUNCTIONS ========================= // ----------------------------------------------------------------------------- // LibEntryL is a polymorphic Dll entry point. // Returns: CScriptBase: New CScriptBase derived object // ----------------------------------------------------------------------------- // EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework { return ( CScriptBase* ) CSendUIAPITest::NewL( aTestModuleIf ); } // End of File
[ "none@none" ]
[ [ [ 1, 269 ] ] ]
229e8d3860aa9e9d7194e8a4bb38caddb9c943da
21da454a8f032d6ad63ca9460656c1e04440310e
/tools/wcpp_vc9_projects/test.utest.win32/stdafx.cpp
d556de8ebe3b1b0f1c2ebaed2e81ded354e84f85
[]
no_license
merezhang/wcpp
d9879ffb103513a6b58560102ec565b9dc5855dd
e22eb48ea2dd9eda5cd437960dd95074774b70b0
refs/heads/master
2021-01-10T06:29:42.908096
2009-08-31T09:20:31
2009-08-31T09:20:31
46,339,619
0
0
null
null
null
null
GB18030
C++
false
false
276
cpp
// stdafx.cpp : 只包括标准包含文件的源文件 // test.utest.win32.pch 将作为预编译头 // stdafx.obj 将包含预编译类型信息 #include "stdafx.h" // TODO: 在 STDAFX.H 中 // 引用任何所需的附加头文件,而不是在此文件中引用
[ "xukun0217@98f29a9a-77f1-11de-91f8-ab615253d9e8" ]
[ [ [ 1, 8 ] ] ]
f6a692b6b3cc999002c73710841480668ac42e10
d54d8b1bbc9575f3c96853e0c67f17c1ad7ab546
/hlsdk-2.3-p3/multiplayer/dmc/dlls/quake_gun.h
510c4c2e4787912cfa455eee553746a592eed7d6
[]
no_license
joropito/amxxgroup
637ee71e250ffd6a7e628f77893caef4c4b1af0a
f948042ee63ebac6ad0332f8a77393322157fa8f
refs/heads/master
2021-01-10T09:21:31.449489
2010-04-11T21:34:27
2010-04-11T21:34:27
47,087,485
1
0
null
null
null
null
UTF-8
C++
false
false
1,145
h
/*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting * object code is restricted to non-commercial enhancements to products from * Valve LLC. All other use, distribution, or modification is prohibited * without written permission from Valve LLC. * ****/ /* ===== quake_gun.h ======================================================== This is a half-life weapon that fires every one of the quake weapons. It's automatically given to all players. */ #include "effects.h" class CQuakeGun : public CBasePlayerWeapon { public: void Spawn( void ); void Precache( void ); int iItemSlot( void ) { return 1; } int GetItemInfo(ItemInfo *p); int SuperDamageSound( void ); void PrimaryAttack( void ); BOOL Deploy( void ); void UpdateEffect( void ); void CreateEffect ( void ); void DestroyEffect ( void ); CBeam *m_pBeam; };
[ "joropito@23c7d628-c96c-11de-a380-73d83ba7c083" ]
[ [ [ 1, 44 ] ] ]
672749f9d063929da9baccbd2979c4f8fe436145
89d2197ed4531892f005d7ee3804774202b1cb8d
/GWEN/include/Gwen/Controls/TextBox.h
7fbf5b0e0bca73c7d26649d80ef5a66f3f02478a
[ "MIT", "Zlib" ]
permissive
hpidcock/gbsfml
ef8172b6c62b1c17d71d59aec9a7ff2da0131d23
e3aa990dff8c6b95aef92bab3e94affb978409f2
refs/heads/master
2020-05-30T15:01:19.182234
2010-09-29T06:53:53
2010-09-29T06:53:53
35,650,825
0
0
null
null
null
null
UTF-8
C++
false
false
2,426
h
/* GWEN Copyright (c) 2010 Facepunch Studios See license in Gwen.h */ #pragma once #include "Base.h" #include "Gwen/BaseRender.h" #include "Gwen/Controls/Label.h" #include "Gwen/Controls/ScrollControl.h" namespace Gwen { namespace Controls { class GWEN_EXPORT TextBox : public Label { GWEN_CONTROL( TextBox, Label ); virtual void Render( Skin::Base* skin ); virtual void RenderFocus( Gwen::Skin::Base* skin){}; virtual void Layout( Skin::Base* skin ); virtual bool OnChar( Gwen::UnicodeChar c ); virtual void InsertText( const Gwen::UnicodeString& str ); virtual void DeleteText( int iStartPos, int iLength ); virtual void RefreshCursorBounds(); virtual bool OnKeyReturn( bool bDown ); virtual bool OnKeyBackspace( bool bDown ); virtual bool OnKeyDelete( bool bDown ); virtual bool OnKeyRight( bool bDown ); virtual bool OnKeyLeft( bool bDown ); virtual bool OnKeyHome( bool bDown ); virtual bool OnKeyEnd( bool bDown ); virtual bool AccelOnlyFocus() { return true; } virtual void OnPaste(); virtual void OnCopy(); virtual void OnCut(); virtual void OnSelectAll(); virtual void OnMouseDoubleClickLeft( int x, int y ); virtual void EraseSelection(); virtual bool HasSelection(); virtual UnicodeString GetSelection(); virtual void SetCursorPos( int i ); virtual void SetCursorEnd( int i ); virtual void OnMouseClickLeft( int x, int y, bool bDown ); virtual void OnMouseMoved( int x, int y, int deltaX, int deltaY ); virtual void SetSelectAllOnFocus( bool b ){ m_bSelectAll = b; if ( b ) OnSelectAll(); } virtual void MakeCaratVisible(); virtual void OnEnter(); virtual bool NeedsInputChars(){ return true; } Event::Caller onTextChanged; Event::Caller onReturnPressed; protected: virtual void OnTextChanged(); virtual bool IsTextAllowed( const Gwen::UnicodeString& str, int iPos ){ return true; } bool m_bSelectAll; int m_iCursorPos; int m_iCursorEnd; Rect m_rectCursorBounds; }; class GWEN_EXPORT TextBoxNumeric : public TextBox { public: GWEN_CONTROL( TextBoxNumeric, TextBox ); virtual float GetFloatFromText(); private: virtual bool IsTextAllowed( const Gwen::UnicodeString& str, int iPos ); }; } }
[ "haza55@5bf3a77f-ad06-ad18-b9fb-7d0f6dabd793" ]
[ [ [ 1, 96 ] ] ]
7e72f9b0054a23fd2074b87ab476ae57e98b60e1
fd518ed0226c6a044d5e168ab50a0e4a37f8efa9
/iAuthor/AmpSdk/wmvgen/src/Crc16.h
33d408d505aefe70f8162235ebb85f841f40f367
[]
no_license
shilinxu/iprojects
e2e2394df9882afaacfb9852332f83cbef6a8c93
79bc8e45596577948c45cf2afcff331bc71ab026
refs/heads/master
2020-05-17T19:15:43.197685
2010-04-02T15:58:11
2010-04-02T15:58:11
41,959,151
0
0
null
null
null
null
UTF-8
C++
false
false
599
h
// Crc16.h: interface for the CCrc16 class. // ////////////////////////////////////////////////////////////////////// #ifndef __Crc16__ #define __Crc16__ class CCrc16 { public: WORD m_crc16; CCrc16(); CCrc16(const BYTE* src, int idx, int sz); CCrc16(const BYTE* src, int sz); ~CCrc16(); static WORD MakeCRC16(const BYTE* src, int idxStart, int Length); static bool CheckCRC16(const BYTE* src, int Length, WORD crc); static inline BYTE hi(WORD b) { return(b >> 8); } static inline BYTE lo(WORD b) { return(b & 0x00ff); } }; #endif // __Crc16__
[ [ [ 1, 32 ] ] ]
136ba811e374b252b4da72dc08a75e6c046651e8
975d45994f670a7f284b0dc88d3a0ebe44458a82
/Docs/FINAIS/Fonte/cliente/Source/Network/CBugMessage.h
7b8a25104a44649f378458102c992340dcc2f9d2
[]
no_license
phabh/warbugs
2b616be17a54fbf46c78b576f17e702f6ddda1e6
bf1def2f8b7d4267fb7af42df104e9cdbe0378f8
refs/heads/master
2020-12-25T08:51:02.308060
2010-11-15T00:37:38
2010-11-15T00:37:38
60,636,297
0
0
null
null
null
null
UTF-8
C++
false
false
823
h
/* Classse para serializar dados para envio e recebimento via socket Baseada na classe dreamMessage.h do livro Programming Multiplayer Games @autor Paulo */ #include <string> #include <sstream> #pragma once #define MAXPACKAGESIZE 300 class CBugMessage { private: int _readCount; // posicao de leitura public: std::string _data; // vetor com os dados void clear(void); void writeByte(char c); void writeShort(short c); void writeInt(int c); void writeFloat(float c); void writeString(char *s); void beginReading(void); char readByte(void); short readShort(void); int readInt(void); float readFloat(void); char * readString(void); int getSize(void) {return _data.size();} };
[ [ [ 1, 39 ] ] ]
863aeeaa9e2fa6727847149f803671208c770df4
71db16f07e91c3d49691f99c3edbfcba6a604189
/FahProxy/AssemblyInfo.cpp
3e4a25eb6bd30d4ba8f3a571e4fff6fe49180884
[]
no_license
jaboles/fahproxy
503832879d9c1081e69b642d8cfe32fd0334a3b2
131b97ddf86220e4ba52878ba22d06f97003a023
refs/heads/master
2022-12-07T13:26:03.522052
2008-08-26T11:29:01
2008-08-26T11:29:01
290,090,861
0
0
null
null
null
null
UTF-8
C++
false
false
1,323
cpp
using namespace System; using namespace System::Reflection; using namespace System::Runtime::CompilerServices; using namespace System::Runtime::InteropServices; using namespace System::Security::Permissions; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly:AssemblyTitleAttribute("FahProxy")]; [assembly:AssemblyDescriptionAttribute("")]; [assembly:AssemblyConfigurationAttribute("")]; [assembly:AssemblyCompanyAttribute("Company")]; [assembly:AssemblyProductAttribute("FahProxy")]; [assembly:AssemblyCopyrightAttribute("Copyright (c) Company 2008")]; [assembly:AssemblyTrademarkAttribute("")]; [assembly:AssemblyCultureAttribute("")]; // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the value or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly:AssemblyVersionAttribute("1.0.*")]; [assembly:ComVisible(false)]; [assembly:CLSCompliantAttribute(true)]; [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
[ "jb@dc620d95-ca3a-fc45-9de6-42b3e20515ab" ]
[ [ [ 1, 38 ] ] ]
2da0baca63b3535343e780e7f73b6040cd17e31c
216ae2fd7cba505c3690eaae33f62882102bd14a
/utils/nxogre/include/NxOgreFunctions.h
10002fde8aa0f9e56b4271decb299b3baef033c6
[]
no_license
TimelineX/balyoz
c154d4de9129a8a366c1b8257169472dc02c5b19
5a0f2ee7402a827bbca210d7c7212a2eb698c109
refs/heads/master
2021-01-01T05:07:59.597755
2010-04-20T19:53:52
2010-04-20T19:53:52
56,454,260
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
3,241
h
/** File: NxOgreFunctions.h Created on: 4-Nov-08 Author: Robin Southern "betajaen" SVN: $Id$ © Copyright, 2008-2009 by Robin Southern, http://www.nxogre.org This file is part of NxOgre. NxOgre is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NxOgre is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with NxOgre. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NXOGRE_FUNCTIONS_H #define NXOGRE_FUNCTIONS_H #include "NxOgreStable.h" #include "NxOgreCommon.h" namespace NxOgre_Namespace { namespace Functions { /** \brief Just like strlen */ unsigned int getCStringLength(const char*); /** \brief Convert any vector3 class to another, assuming both classes have public member variables x y z */ template<typename from, typename to> to NxOgreForceInline XYZ(const from& _from) { to _to; _to.x = _from.x; _to.y = _from.y; _to.z = _from.z; return _to; } /** \brief Convert any vector3 class to another, assuming both classes have public member variables x y z */ template<typename from, typename to> void NxOgreForceInline XYZ(const from& _from, to& _to) { _to.x = _from.x; _to.y = _from.y; _to.z = _from.z; } /** \brief Convert any vector4 class to another, assuming both classes have public member variables w x y z */ template<typename from, typename to> to NxOgreForceInline WXYZ(const from& _from) { to _to; _to.w = _from.w; _to.x = _from.x; _to.y = _from.y; _to.z = _from.z; return _to; } /** \brief Convert any vector4 class to another, assuming both classes have public member variables w x y z */ template<typename from, typename to> void NxOgreForceInline WXYZ(const from& _from, to& _to) { _to.w = _from.w; _to.x = _from.x; _to.y = _from.y; _to.z = _from.z; } /** \brief Turn a const char* into a hash */ unsigned long generateHash(const char*, Enums::HashAlgorithm); template<typename T> void fill(T* start, T* end, T value) { for (;start != end; ++start) (*start) = value; } } // namespace Functions } // namespace NxOgre_Namespace #endif
[ "umutert@b781d008-8b8c-11de-b664-3b115b7b7a9b" ]
[ [ [ 1, 115 ] ] ]
de2c87b363837ce6f4264a38e86367fd41fbe7e8
854ee643a4e4d0b7a202fce237ee76b6930315ec
/arcemu_svn/src/sun/src/InstanceScripts/Raid_OnyxiasLair.cpp
027c562bd242e2d5fdacf2c9ecc36729a684ad84
[]
no_license
miklasiak/projekt
df37fa82cf2d4a91c2073f41609bec8b2f23cf66
064402da950555bf88609e98b7256d4dc0af248a
refs/heads/master
2021-01-01T19:29:49.778109
2008-11-10T17:14:14
2008-11-10T17:14:14
34,016,391
2
0
null
null
null
null
UTF-8
C++
false
false
19,590
cpp
/* * Moon++ Scripts for Ascent MMORPG Server * Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/> * Copyright (C) 2007-2008 Moon++ Team <http://www.moonplusplus.info/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * 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, see <http://www.gnu.org/licenses/>. */ #include "StdAfx.h" #include "Setup.h" /************************************************************************/ /* Raid_OnyxiasLair.cpp Script by DK */ /************************************************************************/ /* This script covers Onyxia's mind */ //Creature Name #define CN_ONYXIA 10184 #define CN_ONYXIAN_WHELP 11262 #define WALK 0 #define RUN 256 #define FLY 768 //0 = walk, 256 = run, 768 = fly //Phase 1,3 Spells #define FLAME_BREATH 18435 //Corrected http://www.wowhead.com/?spell=18435 #define KNOCK_AWAY 19633 //Reduce thread script effect main target #define WING_BUFFET 18500 // self #define CLEAVE 19983//15579,16044,19642,29832 //target Corrected #define TAIL_SWEEP 15847 //Phase 2 Spells #define SCRIPTABLE_FIREBALL 18392 //Corrected http://www.wowhead.com/?spell=18392 //Script it #define ENTANGLING_FLAMES 20019 //Onyxia's Breath (Deep Breath) #define DEEP_BREATH 17086 //Phase 3 Spells #define AOE_FEAR 18431//With Activate Object struct Coords { float x; float y; float z; float o; }; static Coords coords[] = { { 0, 0, 0, 0 }, { -75.945f, -219.245f, -83.375f, 0.004947f }, { -72.945f, -219.245f, -80.779f, 0.004947f }, { 42.621f, -217.195f, -66.056f, 3.014011f }, { 12.270f, -254.694f, -67.997f, 2.395585f }, { -79.020f, -252.374f, -68.965f, 0.885179f }, { -80.257f, -174.240f, -69.293f, 5.695741f }, { 27.875f, -178.547f, -66.041f, 3.908957f }, { -4.868f, -217.171f, -86.710f, 3.141590f } }; static Coords whelpCoords[] = { { -30.812f, -166.395f, -89.000f, 5.160f }, { -30.233f, -264.158f, -89.896f, 1.129f }, { -35.813f, -169.427f, -90.000f, 5.384f }, { -36.104f, -260.961f, -90.600f, 1.111f }, { -34.643f, -164.080f, -90.000f, 5.364f }, { -35.377f, -267.320f, -91.000f, 1.111f } }; class OnyxiaAI : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(OnyxiaAI); OnyxiaAI(Creature* pCreature) : CreatureAIScript(pCreature) { m_phase = 1; m_entry = pCreature->GetEntry(); m_useSpell = true; m_eFlamesCooldown = 1; m_whelpCooldown = 7; m_aoeFearCooldown = 30; m_fCastCount = 5; _unit->GetAIInterface()->setMoveType(4); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(1, 2000, RUN)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(2, 0, FLY)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(3, 0, FLY)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(4, 0, FLY)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(5, 0, FLY)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(6, 0, FLY)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(7, 0, FLY)); _unit->GetAIInterface()->addWayPoint(CreateWaypoint(8, 0, FLY)); infoFear = dbcSpell.LookupEntry(AOE_FEAR); infoCleave = dbcSpell.LookupEntry(CLEAVE); infoFBreath = dbcSpell.LookupEntry(FLAME_BREATH); infoKAway = dbcSpell.LookupEntry(KNOCK_AWAY); infoSFireball = dbcSpell.LookupEntry(SCRIPTABLE_FIREBALL); infoWBuffet = dbcSpell.LookupEntry(WING_BUFFET); infoDeepBreath = dbcSpell.LookupEntry(DEEP_BREATH); if(!infoFear || !infoCleave || !infoFBreath || !infoKAway || !infoSFireball || !infoWBuffet || !infoDeepBreath) m_useSpell = false; _unit->GetAIInterface()->setOutOfCombatRange(200000); m_fBreath = false; m_kAway = false; m_wBuffet = false; m_Cleave = false; } void OnCombatStart(Unit* mTarget) { m_phase = 1; m_eFlamesCooldown = 1; m_whelpCooldown = 7; _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); _unit->SetStandState(0); _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "How fortuitous, usually I must leave my lair to feed!"); if(m_useSpell) RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME)); m_fBreath = false; m_kAway = false; m_wBuffet = false; m_Cleave = false; } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setMoveType(0); _unit->GetAIInterface()->setWaypointToMove(0); _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); _unit->GetAIInterface()->SetAllowedToEnterCombat(true); _unit->GetAIInterface()->m_moveFly = false; _unit->GetAIInterface()->m_canMove = true; _unit->SetStandState(STANDSTATE_SLEEP); /*if(_unit->m_pacified > 0) _unit->m_pacified--;*/ if(m_useSpell) RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { if(m_useSpell) RemoveAIUpdateEvent(); m_phase = 1; m_eFlamesCooldown = 1; m_whelpCooldown = 7; /*Add Loot? mKiller-> */ } void OnReachWP(uint32 iWaypointId, bool bForwards) { switch(iWaypointId) { case 1: { _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->setWaypointToMove(2); Fly(); }break; case 2: { _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->setWaypointToMove(3); }break; case 3: { _unit->GetAIInterface()->m_canMove = false; _unit->GetAIInterface()->SetAllowedToEnterCombat(true); _unit->GetAIInterface()->setCurrentAgent(AGENT_SPELL); //_unit->m_pacified--; _unit->GetAIInterface()->SetAIState(STATE_SCRIPTIDLE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); _unit->GetAIInterface()->setWaypointToMove(0); WorldPacket data(SMSG_MOVE_SET_HOVER, 13); data << _unit->GetNewGUID(); data << uint32(0); _unit->SendMessageToSet(&data, false); m_currentWP = 3; }break; case 8: { _unit->GetAIInterface()->SetAllowedToEnterCombat(true); _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTIDLE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); _unit->GetAIInterface()->setWaypointToMove(0); /*_unit->m_pacified--; if(_unit->m_pacified > 0) _unit->m_pacified--;*/ WorldPacket data(SMSG_MOVE_UNSET_HOVER, 13); data << _unit->GetNewGUID(); data << uint32(0); _unit->SendMessageToSet(&data, false); Land(); }break; default: { _unit->GetAIInterface()->m_canMove = false; _unit->GetAIInterface()->SetAllowedToEnterCombat(true); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTIDLE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); _unit->GetAIInterface()->setWaypointToMove(0); WorldPacket data(SMSG_MOVE_SET_HOVER, 13); data << _unit->GetNewGUID(); data << uint32(0); _unit->SendMessageToSet(&data, false); //_unit->m_pacified--; }break; }; } void AIUpdate() { switch(m_phase) { case 1: { PhaseOne(); }break; case 2: { PhaseTwo(); }break; case 3: { PhaseThree(); }break; default: { m_phase = 1; }; }; } void PhaseOne() { if(_unit->GetHealthPct() <= 65) { m_phase = 2; _unit->SetFloatValue(UNIT_MOD_CAST_SPEED, 0.01f); if(_unit->GetCurrentSpell() != NULL) _unit->GetCurrentSpell()->cancel(); _unit->GetAIInterface()->SetAllowedToEnterCombat(false); //_unit->m_pacified++; _unit->GetAIInterface()->StopMovement(0); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->setWaypointToMove(1); return; } uint32 val = RandomUInt(1000); SpellCast(val); } void PhaseTwo() { if(_unit->GetHealthPct() <= 40) { m_phase = 3; _unit->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); if(_unit->GetCurrentSpell() != NULL) _unit->GetCurrentSpell()->cancel(); _unit->GetAIInterface()->m_canMove = true; _unit->GetAIInterface()->SetAllowedToEnterCombat(false); //_unit->m_pacified++; _unit->GetAIInterface()->StopMovement(0); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->setWaypointToMove(8); return; } if(_unit->GetAIInterface()->getMoveType() == MOVEMENTTYPE_WANTEDWP) return; m_eFlamesCooldown--; if(!m_eFlamesCooldown && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget()) { _unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoSFireball, false);//(_unit->getAttackTarget(), m_eFlamesCooldown = 4; m_fCastCount--; } if(!m_fCastCount) { uint32 val = RandomUInt(1250); if(val < 250)//Move left { m_currentWP++; if(m_currentWP >= 8) m_currentWP = 3; _unit->GetAIInterface()->m_canMove = true; _unit->GetAIInterface()->SetAllowedToEnterCombat(false); //_unit->m_pacified++; _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->setWaypointToMove(m_currentWP); m_fCastCount = 5; } else if(val > 1000)//Move right { m_currentWP--; if(m_currentWP < 3) m_currentWP = 7; _unit->GetAIInterface()->m_canMove = true; _unit->GetAIInterface()->SetAllowedToEnterCombat(false); //_unit->m_pacified++; _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->setWaypointToMove(m_currentWP); m_fCastCount = 5; } else if(val < 350) { //Deep breath _unit->CastSpell(_unit, infoDeepBreath, false); m_fCastCount = 5; } else m_fCastCount = 5; } m_whelpCooldown--; if(!m_whelpCooldown) { Creature *cre = NULL; for(int i = 0; i < 6; i++) { cre = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_ONYXIAN_WHELP, whelpCoords[i].x, whelpCoords[i].y, whelpCoords[i].z, whelpCoords[i].o, true, false, _unit->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE), 50); if(cre) { cre->GetAIInterface()->MoveTo(14.161f, -177.874f, -85.649f, 0.23f); cre->GetAIInterface()->setOutOfCombatRange(100000); } cre = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_ONYXIAN_WHELP, whelpCoords[5-i].x, whelpCoords[5-i].y, whelpCoords[5-i].z, whelpCoords[5-i].o, true, false, _unit->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE), 50); if(cre) { cre->GetAIInterface()->MoveTo(27.133f, -232.030f, -84.188f, 0.44f); cre->GetAIInterface()->setOutOfCombatRange(100000); } } m_whelpCooldown = 30; } } void PhaseThree() { if(!m_aoeFearCooldown) { _unit->CastSpell(_unit, infoFear, false);//(_unit->getAttackTarget(), m_aoeFearCooldown = 30; return; } uint32 val = RandomUInt(1000); SpellCast(val); m_whelpCooldown--; m_aoeFearCooldown--; if(!m_whelpCooldown) { Creature *cre = NULL; for(int i = 0; i < 6; i++) { cre = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_ONYXIAN_WHELP, whelpCoords[i].x, whelpCoords[i].y, whelpCoords[i].z, whelpCoords[i].o, true, false, _unit->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE), 50); if(cre) { cre->GetAIInterface()->MoveTo(14.161f, -177.874f, -85.649f, 0.23f); cre->GetAIInterface()->setOutOfCombatRange(100000); } cre = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_ONYXIAN_WHELP, whelpCoords[5-i].x, whelpCoords[5-i].y, whelpCoords[5-i].z, whelpCoords[5-i].o, true, false, _unit->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE), 50); if(cre) { cre->GetAIInterface()->MoveTo(27.133f, -232.030f, -84.188f, 0.44f); cre->GetAIInterface()->setOutOfCombatRange(100000); } } m_whelpCooldown = 300; } } inline WayPoint* CreateWaypoint(int id, uint32 waittime, uint32 flags) { //WayPoint* wp = new WayPoint; //WayPoint * wp = _unit->GetMapMgr()->GetInterface()->CreateWaypoint(); //WayPoint * wp = sStructFactory.CreateWaypoint(); WayPoint * wp = _unit->CreateWaypointStruct(); wp->id = id; wp->x = coords[id].x; wp->y = coords[id].y; wp->z = coords[id].z; wp->o = coords[id].o; wp->waittime = waittime; wp->flags = flags; wp->forwardemoteoneshot = 0; wp->forwardemoteid = 0; wp->backwardemoteoneshot = 0; wp->backwardemoteid = 0; wp->forwardskinid = 0; wp->backwardskinid = 0; return wp; } void Fly() { _unit->Emote(EMOTE_ONESHOT_LIFTOFF); //Do we need hover really? Check it :D /*WorldPacket data(SMSG_MOVE_SET_HOVER, 13); data << _unit->GetNewGUID(); data << uint32(0); _unit->SendMessageToSet(&data, false);*/ _unit->GetAIInterface()->m_moveFly = true; } void Land() { _unit->Emote(EMOTE_ONESHOT_LAND); //Do we need hover really? Check it :D /*WorldPacket data(SMSG_MOVE_UNSET_HOVER, 13); data << _unit->GetNewGUID(); data << uint32(0); _unit->SendMessageToSet(&data, false);*/ _unit->GetAIInterface()->m_moveFly = false; } void SpellCast(uint32 val) { if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget()) { if(m_fBreath) { _unit->CastSpell(_unit, infoFBreath, false); m_fBreath = false; return; } else if(m_kAway) { _unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoKAway, false); m_kAway = false; return; } else if(m_wBuffet) { _unit->CastSpell(_unit, infoWBuffet, false); m_wBuffet = false; return; } else if(m_Cleave) { _unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoCleave, false); m_Cleave = false; return; } if(val >= 100 && val <= 225) { _unit->setAttackTimer(6000, false);//6000 m_fBreath = true; //_unit->CastSpell(_unit, infoFBreath, false); } else if(val > 225 && val <= 300) { _unit->setAttackTimer(4000, false);//2000 m_kAway = true; //_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoKAway, false); } else if(val > 300 && val <= 375) { _unit->setAttackTimer(4000, false);//3000 m_wBuffet = true; //_unit->CastSpell(_unit, infoWBuffet, false); } else if(val > 375 && val < 450) { _unit->setAttackTimer(4000, false);//2000 m_Cleave = true; // _unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoCleave, false); } } } inline bool HasEntry() { return (m_entry != 0) ? true : false; } protected: bool m_fBreath; bool m_kAway; bool m_wBuffet; bool m_Cleave; uint32 m_entry; uint32 m_phase; bool m_useSpell; uint32 m_eFlamesCooldown; uint32 m_whelpCooldown; uint32 m_aoeFearCooldown; uint32 m_fCastCount; uint32 m_currentWP; SpellEntry *infoFear, *infoWBuffet, *infoCleave, *infoFBreath, *infoKAway, *infoSFireball, *infoDeepBreath; }; void SetupOnyxiasLair(ScriptMgr * mgr) { // Onyxia mgr->register_creature_script(CN_ONYXIA, &OnyxiaAI::Create); }
[ "[email protected]@3074cc92-8d2b-11dd-8ab4-67102e0efeef" ]
[ [ [ 1, 544 ] ] ]
030b4c7cdbdef9bb8280025260069e0aec367e13
51c71b06d7fa1aa97df4ffe6782e9a4924480a33
/KinectCamera/KinectCameraManager.h
f6ac53e2df27f530b4e7cea8e6dfbc66f6aa6f5a
[]
no_license
alonf01/open-light
9eb8d185979cfa16797f9d2201cf192b3e91f270
685f974fcd7cc29b6bec00fa17804c5f2b7a83c3
refs/heads/master
2020-05-30T15:24:08.579565
2010-12-14T00:56:32
2010-12-14T00:56:32
35,759,673
0
0
null
null
null
null
UTF-8
C++
false
false
1,127
h
//////////////////////////////////////////////////////////////////////////////////////////////////// /// @file KinectCamera\KinectCameraManager.h /// /// @brief Declares the kinect camera manager class. //////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once // Project includes #include "KinectCamera.h" #include "CameraManager.h" #include <conio.h> #include <windows.h> #include <math.h> // Forward declarations namespace Kinect { class KinectFinder; } //////////////////////////////////////////////////////////////////////////////////////////////////// /// @class KinectCameraManager /// /// @brief Manager for kinect cameras. /// /// @ingroup KinectCamera /// /// @author Brett Jones /// @date 12/12/2010 //////////////////////////////////////////////////////////////////////////////////////////////////// class KINECT_CAMERA_DECL KinectCameraManager: public CameraManager { public: void Init(CameraConfigParams* camParams); void CleanUp(); private: Kinect::KinectFinder *mKinectManager; };
[ "b.jonessoda@8a600b9a-ddf7-11de-b878-c5ec750a8c44" ]
[ [ [ 1, 43 ] ] ]
aeee7709f108073ea668a8af580cc953cb2ecff7
cb1c6c586d769f919ed982e9364d92cf0aa956fe
/examples/TRTRenderTest/TRTRenderTest.cpp
109966f345ce9c511acba718914ff8f626818b10
[]
no_license
jrk/tinyrt
86fd6e274d56346652edbf50f0dfccd2700940a6
760589e368a981f321e5f483f6d7e152d2cf0ea6
refs/heads/master
2016-09-01T18:24:22.129615
2010-01-07T15:19:44
2010-01-07T15:19:44
462,454
3
0
null
null
null
null
UTF-8
C++
false
false
7,895
cpp
//===================================================================================================================== // // TRTRenderTest.cpp // // Rendering test harness for TRT. Performs simple raycasting against a mesh, using all of TRT's data structures // // Part of the TinyRT Raytracing Library. // Author: Joshua Barczak // // Copyright 2008 Joshua Barczak. All rights reserved. // See Doc/LICENSE.txt for terms and conditions. // //===================================================================================================================== #include <iostream> #include "TinyRT.h" using namespace TinyRT; #include "PPMImage.h" #include "Timer.h" #include "TestUtils.h" #include "TestRaycaster.h" #include "AABBTreeRaycaster.h" #include "GridRaycaster.h" #include "QBVHRaycaster.h" #include "KDTreeRaycaster.h" #include "RenderTest.h" #include "BoundingBoxViewpointGenerator.h" template< class Tree_T > void PrintTreeStats( const Tree_T* pTree ) { TreeStatistics stats; GetTreeStatistics( stats, pTree ); size_t nMemUsed, nMemAllocated; pTree->GetMemoryUsage( nMemUsed, nMemAllocated ); nMemUsed /= 1024; nMemAllocated /= 1024; printf("====================================================\n"); printf(" TREE STATS\n"); printf("====================================================\n"); printf(" Nodes: %u\n" " Leafs: %u (%.2f%% empty)\n" " Objects: %u\n" " Objects (min/max/avg/avg_nonempty) %u / %u / %u / %u\n" " Memory used/alloated(KB): %u / %u\n", stats.nNodes, stats.nLeafs, stats.nEmptyLeafs*100.0f / (float) stats.nLeafs, stats.nTotalObjects, stats.nMinObjectsPerLeaf, stats.nMaxObjectsPerLeaf, stats.nAvgObjectsPerLeaf, stats.nAvgObjectsPerNonEmptyLeaf, nMemUsed, nMemAllocated ); printf("=====================================================\n"); } void RandomRayTest( TestRaycaster* pCast, int nRays ) { srand(0); printf("RANDOM RAY TEST\n"); AxisAlignedBox box; TestMesh* pMesh = pCast->GetMesh(); pMesh->GetAABB( box ); Timer tm; for( int i=0; i<nRays; i++ ) { TinyRT::Vec3f vS1 = TinyRT::Vec3f( RandomFloat(), RandomFloat(), RandomFloat() ); TinyRT::Vec3f vS2 = TinyRT::Vec3f( RandomFloat(), RandomFloat(), RandomFloat() ); for(int j=0; j<3; j++ ) { vS1[j] = Lerp( box.Min()[j], box.Max()[j], vS1[j] ); vS2[j] = Lerp( box.Min()[j], box.Max()[j], vS2[j] ); } TinyRT::Ray r( vS1, vS2-vS1 ); TriangleRayHit hit; pCast->RaycastFirstHit( r, hit ); } uint32 nTime = tm.Tick(); printf("Time: %u. Rays/s: %.2f\n", nTime, nRays / (nTime/1000.0f) ); } template< class AABBTreeBuilder_T > void DoBVHTest( TestMesh* pMesh, AABBTreeBuilder_T& builder, float fTriCost, ViewpointGenerator* pViews, RenderTest::Options& renderOpts ) { Timer tm; AABBTree< TestMesh >* pBVH = new AABBTree<TestMesh>(); pBVH->Build( pMesh, builder ); printf("Build took: %u ms\n", tm.Tick() ); PrintTreeStats( pBVH ); float fCost = GetAABBTreeSAHCost( ConstantCost<uint32>(fTriCost), pBVH, pBVH->GetRoot() ); printf("SAH cost: %f\n", fCost ); AABBTreeRaycaster rc( pMesh, pBVH ); RandomRayTest( &rc, 1000000 ); RenderTest rt( &rc, pViews, renderOpts ); rt.Run(); } void DoQBVHTest( TestMesh* pMesh, float fTriCost, ViewpointGenerator* pViews, RenderTest::Options& renderOpts ) { Timer tm; SahAABBTreeBuilder< TestMesh > builder( fTriCost ); QuadAABBTree< TestMesh >* pTree = new QuadAABBTree<TestMesh>; pTree->Build( pMesh, builder ); printf("Build took: %u ms\n", tm.Tick() ); PrintTreeStats( pTree ); QBVHRaycaster rc( pMesh, pTree ); RandomRayTest( &rc, 1000000 ); RenderTest rt( &rc, pViews, renderOpts ); rt.Run(); } void TestBVH( TestMesh* pMesh, ViewpointGenerator* pViews, RenderTest::Options& renderOpts ) { float fTriCost = 1; printf("SAH QBVH\n"); printf("=================\n"); { DoQBVHTest( pMesh, 1, pViews, renderOpts ); } printf("MEDIAN CUT BVH\n"); printf("================\n"); { MedianCutAABBTreeBuilder< TestMesh > builder(2); DoBVHTest( pMesh, builder, fTriCost, pViews, renderOpts ); } printf("SAH BVH\n"); printf("================\n"); { SahAABBTreeBuilder<TestMesh, ConstantCost<uint32> > builder( fTriCost ); DoBVHTest( pMesh, builder, fTriCost, pViews, renderOpts ); } } void TestGrid( TestMesh* pMesh, ViewpointGenerator* pViews, RenderTest::Options& renderOpts ) { printf("UNIFORM GRID\n"); printf("================\n"); Timer tm; GridRaycaster rc( pMesh ); float fElapsed = (float) tm.Tick(); printf("Grid build took: %.2f\n", fElapsed ); printf("Grid size: %u x %u x %u\n", rc.GetGrid()->GetCellCounts().x, rc.GetGrid()->GetCellCounts().y, rc.GetGrid()->GetCellCounts().z ); printf("Cell count: %u\n", rc.GetGrid()->GetCellCounts().x * rc.GetGrid()->GetCellCounts().y * rc.GetGrid()->GetCellCounts().z ); printf("SAH cost: %f\n", GetUniformGridSAHCost( 3.0f, rc.GetGrid() ) ); RandomRayTest( &rc, 1000000 ); RenderTest rt( &rc, pViews, renderOpts ); rt.Run(); } void TestKDTree( TestMesh* pMesh, ViewpointGenerator* pViews, RenderTest::Options& renderOpts ) { printf("KD-TREE \n"); printf("================\n"); static const float ISECT_COST = 3.0f; KDTree<TestMesh>* pTree = new KDTree<TestMesh>; SahKDTreeBuilder<TestMesh, TestMesh::Clipper > builder( ISECT_COST ); Timer tm; pTree->Build( pMesh, builder ); float fElapsed = (float) tm.Tick(); printf("Build took: %.2f\n", fElapsed ); PrintTreeStats( pTree ); printf("SAH cost: %f\n", GetKDTreeSAHCost( ISECT_COST, pTree, pTree->GetRoot(), pTree->GetBoundingBox() ) ); KDTreeRaycaster rc( pMesh, pTree ); RandomRayTest( &rc, 1000000 ); RenderTest rt( &rc, pViews, renderOpts ); rt.Run(); } /// Simple little mailboxing performance tester template< class Mailbox_T, int TEST_VAL_COUNT > long MailboxPerf( ) { Mailbox_T mb; int nTestVals[TEST_VAL_COUNT]; for( int i=0; i<TEST_VAL_COUNT; i++ ) nTestVals[i] = rand(); Timer tm; for(int i=0; i<10000000; i++ ) { mb.CheckMailbox(nTestVals[i%TEST_VAL_COUNT]); } return tm.Tick(); } template<int SIZE> void MailboxPerfTest() { printf("--------------\n"); printf("SIZE: %u\n", SIZE ); printf("--------------\n"); printf("Fifo: %u\n", MailboxPerf< FifoMailbox<int,SIZE>,128 >() ); printf("DM: %u\n", MailboxPerf< DirectMapMailbox<int,SIZE>,128 >() ); printf("SIMDFifo: %u\n", MailboxPerf< SimdFifoMailbox<SIZE>,128 >() ); } int main() { printf("Loading mesh\n"); TestMesh* pMesh = TestMesh::LoadPly( "..\\models\\bunny.ply", true ); if( !pMesh ) { printf("ERROR LOADING MODEL\n"); return 1; } RenderTest::Options renderOpts; renderOpts.dumpFilePrefix = "test"; renderOpts.goldImagePrefix = "";//"goldimages\\bunny\\test"; renderOpts.nImageSize = 256; renderOpts.nTileSize = 4; AxisAlignedBox meshBox; pMesh->GetAABB( meshBox ); BoundingBoxViewpointGenerator views( meshBox, 10 ); TestKDTree( pMesh, &views, renderOpts ); TestBVH( pMesh, &views, renderOpts ); TestGrid( pMesh, &views, renderOpts ); delete pMesh; return 0; }
[ "jbarcz1@6ce04321-59f9-4392-9e3f-c0843787e809" ]
[ [ [ 1, 280 ] ] ]
1703632c8ef67dc7ed4018c737729424c44e1dd8
563e71cceb33a518f53326838a595c0f23d9b8f3
/v3/ProcTerrain/ProcTerrain/Util/VBO.h
c4a50bbd57600fd746120b88103ae3a5309f5668
[]
no_license
fabio-miranda/procedural
3d937037d63dd16cd6d9e68fe17efde0688b5a0a
e2f4b9d34baa1315e258613fb0ea66d1235a63f0
refs/heads/master
2021-05-28T18:13:57.833985
2009-10-07T21:09:13
2009-10-07T21:09:13
39,636,279
1
1
null
null
null
null
UTF-8
C++
false
false
989
h
#ifndef VBO_H #define VBO_H #include "GL/glew.h" //#include "GL/glfw.h" #include "Vertex.h" #include "../Config.h" #include <list> class VBO{ private: GLuint m_vboVertices; GLuint m_vboIndices; int m_verticesSize; int m_indicesSize; GLushort* m_ptrIndices; Vertex* m_ptrVertices; //int m_vertexSize; //int m_indexSize; //The m_vertexSize and m_indexSize are modified on the CubeSphere::FillArray. This is just a preccaution to make sure //that we delete the right size from the buffer //int m_oldVertexSize; //int m_oldIndexSize; public: VBO(Vertex[4], int, GLushort[4], int); ~VBO(); void DeleteBuffer(); //void InitBuffer(); void Render(); //Vertex* m_vertexArray; //GLuint* m_indexArray; //std::list<Vertex> m_listVertex; //std::list<GLuint> m_listIndex; //void IncreaseVertexSize(int); //void IncreaseIndexSize(int); //int GetVertexSize(); //int GetIndexSize(); }; #endif
[ "fabiom@01b71de8-32d4-11de-96ab-f16d9912eac9" ]
[ [ [ 1, 61 ] ] ]
e724f69bf7a20bd5b5528e720f12d0b7fc791b0e
7f72fc855742261daf566d90e5280e10ca8033cf
/branches/full-calibration/ground/src/plugins/hitlnew/xplanesimulator.cpp
df13acccc1de904d2298df0a68419c9ab1e369ff
[]
no_license
caichunyang2007/my_OpenPilot_mods
8e91f061dc209a38c9049bf6a1c80dfccb26cce4
0ca472f4da7da7d5f53aa688f632b1f5c6102671
refs/heads/master
2023-06-06T03:17:37.587838
2011-02-28T10:25:56
2011-02-28T10:25:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,849
cpp
/** ****************************************************************************** * * @file xplanesimulator.cpp * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @brief * @see The GNU Public License (GPL) Version 3 * @defgroup hitlplugin * @{ * *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * 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 */ /** * Description of X-Plane Protocol: * * To see what data can be sended/recieved to/from X-Plane, launch X-Plane -> goto main menu * (cursor at top of main X-Plane window) -> Settings -> Data Input and Output -> Data Set. * Data Set shown all X-Plane params, * each row has four checkbox: 1st check - out to UDP; 4 check - show on screen * All the UDP messages for X-Plane have the same format, which is: * 5-character MESSAGE PROLOUGE (to indicate the type of message) * and then a DATA INPUT STRUCTURE (containing the message data that you want to send or receive) * * DATA INPUT/OUTPUT STRUCTURE is the following stuct: * * struct data_struct * { * int index; // data index, the index into the list of variables // you can output from the Data Output screen in X-Plane. * float data[8]; // the up to 8 numbers you see in the data output screen associated with that selection.. // many outputs do not use all 8, though. * }; * * For Example, update of aileron/elevon/rudder in X-Plane (11 row in Data Set) * bytes value description * [0-3] DATA message type * [4] none no matter * [5-8] 11 code of setting param(row in Data Set) * [9-41] data message data (8 float values) * total size: 41 byte * */ #include "xplanesimulator.h" #include "extensionsystem/pluginmanager.h" #include <coreplugin/icore.h> #include <coreplugin/threadmanager.h> #include <math.h> #include <qxtlogger.h> void TraceBuf(const char* buf,int len); XplaneSimulator::XplaneSimulator(const SimulatorSettings& params) : Simulator(params) { } XplaneSimulator::~XplaneSimulator() { } void XplaneSimulator::setupUdpPorts(const QString& host, int inPort, int outPort) { inSocket->bind(QHostAddress(host), inPort); outSocket->bind(QHostAddress(host), outPort); } /** * update data in X-Plane simulator */ void XplaneSimulator::transmitUpdate() { //Read ActuatorDesired from autopilot ActuatorDesired::DataFields actData = actDesired->getData(); float ailerons = actData.Roll; float elevator = actData.Pitch; float rudder = actData.Yaw; float throttle = actData.Throttle*2-1.0; float tmp = -999; quint32 none = *((quint32*)&tmp); // get float as 4 bytes quint32 code; QByteArray buf; QDataStream stream(&buf,QIODevice::ReadWrite); // !!! LAN byte order - Big Endian //#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN // stream.setByteOrder(QDataStream::LittleEndian); //#endif // 11th data settings (flight con: ail/elv/rud) buf.clear(); code = 11; quint8 header[] = "DATA"; stream << *((quint32*)header) << (quint8)0x30 << code << *((quint32*)&elevator) << *((quint32*)&ailerons) << *((quint32*)&rudder) << none << *((quint32*)&ailerons) << none << none << none; TraceBuf(buf.data(),41); outSocket->write(buf); // 25th data settings (throttle command) buf.clear(); code = 25; stream << *((quint32*)header) << (quint8)0x30 << code << *((quint32*)&throttle) << none << none << none << none << none << none << none; outSocket->write(buf); /** !!! this settings was given from ardupilot X-Plane.pl, I comment them but if it needed comment should be removed !!! // 8th data settings (joystick 1 ail/elv/rud) stream << "DATA0" << quint32(11) << elevator << ailerons << rudder << float(-999) << float(-999) << float(-999) << float(-999) << float(-999); outSocket->write(buf); */ } /** * process data string from X-Plane simulator */ void XplaneSimulator::processUpdate(const QByteArray& dataBuf) { float altitude = 0; float latitude = 0; float longitude = 0; float airspeed = 0; float speed = 0; float pitch = 0; float roll = 0; float heading = 0; float pressure = 0; float weather = 0; QString str; QByteArray& buf = const_cast<QByteArray&>(dataBuf); QString data(buf); if(data.left(4) == "DATA") // check type of packet { buf.remove(0,5); if(dataBuf.size() % 36) { qxtLog->info("incorrect length of UDP packet: ",buf); return; // incorrect length of struct } // check correctness of data length, length must be multiple of (id_size+8*float_size)=4+8*4=36 int channelCounter = dataBuf.size() / 36; do { switch(buf[0]) // switch by id { case XplaneSimulator::LatitudeLongitude: latitude = *((float*)(buf.data()+4*1)); longitude = *((float*)(buf.data()+4*2)); altitude = *((float*)(buf.data()+4*3)) /* * 3.048 */; break; case XplaneSimulator::Speed: airspeed = *((float*)(buf.data()+4*6)); speed = *((float*)(buf.data()+4*7)); break; case XplaneSimulator::PitchRollHeading: pitch = *((float*)(buf.data()+4*1)); roll = *((float*)(buf.data()+4*2)); heading = *((float*)(buf.data()+4*3)); break; case XplaneSimulator::SystemPressures: pressure = *((float*)(buf.data()+4*1)); break; case XplaneSimulator::AtmosphereWeather: weather = *((float*)(buf.data()+4*1)); break; default: break; } channelCounter--; buf.remove(0,36); } while (channelCounter); // Update AltitudeActual object BaroAltitude::DataFields altActualData; memset(&altActualData, 0, sizeof(BaroAltitude::DataFields)); altActualData.Altitude = altitude; altActualData.Temperature = weather; altActualData.Pressure = pressure; altActual->setData(altActualData); // Update attActual object AttitudeActual::DataFields attActualData; memset(&attActualData, 0, sizeof(AttitudeActual::DataFields)); attActualData.Roll = roll; //roll; attActualData.Pitch = pitch; // pitch // attActualData.Yaw = yaw; // attActualData.q1 = 0; // attActualData.q2 = 0; // attActualData.q3 = 0; // attActualData.q4 = 0; attActual->setData(attActualData); // Update gps objects GPSPosition::DataFields gpsData; memset(&gpsData, 0, sizeof(GPSPosition::DataFields)); gpsData.Altitude = altitude; // gpsData.Heading = pitch[2]; // gpsData.Groundspeed = speed[0]; gpsData.Latitude = latitude; gpsData.Longitude = longitude; gpsPos->setData(gpsData); } // issue manual update //attActual->updated(); //altActual->updated(); //posActual->updated(); } void TraceBuf(const char* buf,int len) { QString str; bool reminder=true; for(int i=0; i < len; i++) { if(!(i%16)) { if(i>0) { qDebug() << str; str.clear(); reminder=false; } reminder=true; } str+=QString(" 0x%1").arg((quint8)buf[i],2,16,QLatin1Char('0')); } if(reminder) qDebug() << str; }
[ "jonathan@ebee16cc-31ac-478f-84a7-5cbb03baadba" ]
[ [ [ 1, 260 ] ] ]
383a47de41d754faf6a5d8240b680343fd27381a
9ad9345e116ead00be7b3bd147a0f43144a2e402
/Integration_WAH_&_Extraction/SMDataExtraction/Algorithm/Apriori.cpp
7aa89b7262633aee46cface20651ad9efc802cf6
[]
no_license
asankaf/scalable-data-mining-framework
e46999670a2317ee8d7814a4bd21f62d8f9f5c8f
811fddd97f52a203fdacd14c5753c3923d3a6498
refs/heads/master
2020-04-02T08:14:39.589079
2010-07-18T16:44:56
2010-07-18T16:44:56
33,870,353
0
0
null
null
null
null
UTF-8
C++
false
false
9,946
cpp
#include "StdAfx.h" #include "Apriori.h" #include <string.h> #include <time.h> #include <iostream> using namespace std; Apriori::Apriori(void) { m_no_of_rules = 1000; m_no_of_items = 1000; } Apriori::~Apriori(void) { } void Apriori::GetUniqueItems(WrapDataSource * _wrapped,AlgoUtils & _utils) { vector<BitStreamHolder *> holder; map<int,vector<int>> pre_att_index_map; _utils.GetUniqueBitmaps(_wrapped,m_unique_bitmap_holders,pre_att_index_map,m_unique_values_index_map); m_index_attribute_map = _utils.CreateIndexAttributeMap(pre_att_index_map); CalculateCountsForUniqueBitmaps(); } void Apriori::GenerateRules() { //Handle for empty occurance typedef vector<BitStreamHolder *>::const_iterator vector_iter; for (vector_iter start = m_frequent_item_set.begin(); (start != m_frequent_item_set.end() && m_rules.size() < m_no_of_rules ); start++) { GenerateRulesForHolder(*(start)); } } void Apriori::GenerateRulesForHolder(BitStreamHolder * _holder) { //Handle exceptions(division by zero is a must) int support_for_holder = m_bitmap_count_holder[_holder->Hash()]; if (support_for_holder > 0) { for (size_t index = 0; index < _holder->Bit_stream_no().size(); index++) { vector<int> antecedant = GenerateAntedecent(index,_holder->Bit_stream_no()); vector<int> consequent; consequent.push_back(_holder->Bit_stream_no().at(index)); int hash_val_antecedent = CalculateHash(antecedant); int hash_val_consequent = CalculateHash(consequent); int rule_hash = hash_val_antecedent * 10 +hash_val_consequent; if (!ContainsRule(rule_hash)) { m_added_rules.push_back(rule_hash); int confidence_ =0; // if (m_bitmap_count_holder[hash_val_consequent] > 0) // { // confidence_= ((int)(support_for_holder/m_bitmap_count_holder[hash_val_consequent])*100); // if (confidence_ >= m_confidence) // { // AssociateRule * rule = new AssociateRule(); // rule->Antecedant(consequent); // rule->Consequent(antecedant); // rule->Support(support_for_holder); // rule->Confidence(confidence_); // m_rules.push_back(rule); // } // } confidence_ = (((float)support_for_holder/(float)m_bitmap_count_holder[hash_val_antecedent])*(float)100); if (confidence_ >= m_confidence && confidence_ <=100) { AssociateRule * rule = new AssociateRule(); rule->Antecedant(antecedant); rule->Consequent(consequent); rule->Support(support_for_holder); rule->Confidence(confidence_); m_rules.push_back(rule); } } } } } // void Apriori::GenerateStringRules() // { // // } void Apriori::RunAlgorithm(WrapDataSource * source) { //time_t start,end1,end2,end3; AlgoUtils utils; cout<<"Start to run algorithm: "<<endl; //start = clock(); GetUniqueItems(source,utils); cout<<"Finished creating unique bimaps: "<<endl; CreateInitialCandidateSet(utils); cout<<"Finished CreateInitialCandidateSet: "<<endl; GenerateAllCandidateSets(utils); //end1 = clock(); cout<<"Finished GenerateAllCandidateSets :"<<endl; cout << "Generating Strings : " << endl; GenerateRules(); //end2 = clock(); CreateRuleStrings(source); cout<<"Finished creating rules: "<<endl; //cout<<"Time - Generating Frequent Item sets : "<<(end1 - start)<<endl; //cout<<"Time - Generating Rules : "<<(end2 - start)<<endl; } void Apriori::CreateRuleStrings(WrapDataSource * source) { vector<EncodedAttributeInfo *> _att_vector = source->codedAttributes(); for (size_t index = 0; index < m_rules.size(); index++) { CreateStringForRule(m_rules.at(index),_att_vector); } } void Apriori::CreateStringForRule(AssociateRule * _rule , vector<EncodedAttributeInfo *> _atrributes) { vector<int> antecedent = _rule->Antecedant(); string antecedant_str = GetStringForVector(_atrributes,antecedent); vector<int> consequent = _rule->Consequent(); string consequent_str = GetStringForVector(_atrributes,consequent); string total_rule = ""; // strcat(total_rule,antecedant_str); // strcat(total_rule," => "); // strcat(total_rule,consequent_str); total_rule += antecedant_str; total_rule += " => "; total_rule += consequent_str; //cout << "Total Val : " << total_rule << endl; //cout << "Antecedent : " << antecedant_str << endl; _rule->Rule(total_rule); } bool Apriori::ContainsRule(int _hash) { sort(m_added_rules.begin(),m_added_rules.end()); return binary_search(m_added_rules.begin(),m_added_rules.end(),_hash); } string Apriori::GetStringForVector(vector<EncodedAttributeInfo *> & _atrributes,vector<int> & _index_vector) { string result=""; for (size_t index = 0; index < _index_vector.size();index++) { int attribute = m_index_attribute_map[_index_vector.at(index)]; //Retrieving from attribute Id is handled this way int attribute_vect_id = (_atrributes.size()-1) -attribute; string attribute_name = _atrributes.at(attribute_vect_id)->attributeName(); unsigned long int unique_val = m_unique_values_index_map.at(index); EncodedMultiCatAttribute * multi_cat = static_cast<EncodedMultiCatAttribute *>(_atrributes.at(attribute_vect_id)); string val = multi_cat->uniqueValList().at(unique_val); // strcat(result," , "); // strcat(result,val); result += (attribute_name +" = "+val); if (index != _index_vector.size()-1) { result += " , "; } } return result; } vector<int> Apriori::GenerateAntedecent(int _index,vector<int> & _frequent_indices) { vector<int> result; //Very inefficient method. Should be replaced immediately. //Try to delete the element and perform a copy. for (size_t index = 0; index < _frequent_indices.size() ; index++) { if (index != _index) { result.push_back(_frequent_indices.at(index)); } } return result; } int Apriori::CalculateHash(vector<int> & _vector) { int factor = 1; int hash = 0; sort(_vector.begin(),_vector.end()); for (vector_iter start = _vector.begin(); start != _vector.end(); start++) { hash += (*(start)+1)*factor; factor *=10; } return hash; } void Apriori::CalculateCountsForUniqueBitmaps() { typedef vector<BitStreamHolder *>::const_iterator vector_iter; for (vector_iter start = m_unique_bitmap_holders.begin() ; start != m_unique_bitmap_holders.end(); start++) { BitStreamHolder * temp_holder = *(start); m_bitmap_count_holder[temp_holder->Hash()] = temp_holder->Count(); } } int Apriori::GetCountForBitMap(int _hash_value) { map<int,int>::iterator iter = m_bitmap_count_holder.find(_hash_value); return iter->second; } bool Apriori::ContainCombination(int _combination) { return (m_bitmap_count_holder.find(_combination) != m_bitmap_count_holder.end()); } void Apriori::GenerateCandidates(AlgoUtils & _utils) { vector<BitStreamHolder *> candidate_set_copy = m_candidate_set; m_candidate_set.clear(); typedef vector<BitStreamHolder *>::const_iterator holder_iter; for (size_t index = 0; index < candidate_set_copy.size(); index++) { for (size_t inner_index = 0 ; inner_index < candidate_set_copy.size(); inner_index++ ) { if (inner_index != index) { BitStreamHolder * main_holder = candidate_set_copy.at(index); vector<BitStreamHolder *> temp_holder_vect = main_holder->Difference(candidate_set_copy.at(inner_index),m_index_attribute_map); for (holder_iter iter = temp_holder_vect.begin(); iter != temp_holder_vect.end(); iter++) { BitStreamHolder * temp_holder = main_holder->Merge(*(iter),m_index_attribute_map,m_unique_bitmap_holders); if (temp_holder != NULL) { int temp_holder_hash = temp_holder->Hash(); int holder_count = temp_holder->Count(); if (!ContainCombination(temp_holder_hash) && (holder_count >= m_support)) { m_bitmap_count_holder[temp_holder_hash] = holder_count; m_candidate_set.push_back(temp_holder); } } } } } } //Inefficient memory handling. Need to delete BitStreamInfoObjects, when no longer used. _utils.CopyFirstToSecond(m_candidate_set,m_frequent_item_set); } void Apriori::GenerateAllCandidateSets(AlgoUtils & _utils) { int initial_size = 0; int termination_size = 0; do { initial_size = m_candidate_set.size(); GenerateCandidates(_utils); termination_size = m_candidate_set.size(); } while (m_candidate_set.size() > 0 && (initial_size != termination_size) && m_frequent_item_set.size() < m_no_of_items); } void Apriori::CreateInitialCandidateSet(AlgoUtils & _utils) { for (size_t index = 0; (index < m_unique_bitmap_holders.size() && m_candidate_set.size() < m_no_of_items); index++) { for (size_t inner_index = index +1 ; inner_index < m_unique_bitmap_holders.size() && m_candidate_set.size() < m_no_of_items; inner_index++ ) { if (inner_index != index) { BitStreamHolder * temp_holder = (m_unique_bitmap_holders.at(index))->Merge(m_unique_bitmap_holders.at(inner_index),m_index_attribute_map,m_unique_bitmap_holders); if (temp_holder != NULL) { int temp_holder_hash = temp_holder->Hash(); int holder_count = temp_holder->Count(); if (!ContainCombination(temp_holder_hash) && (holder_count >= m_support)) { m_bitmap_count_holder[temp_holder_hash] = holder_count; m_candidate_set.push_back(temp_holder); } } } } } //Inefficient memory handling. Need to delete BitStreamInfoObjects, when no longer used. _utils.CopyFirstToSecond(m_candidate_set,m_frequent_item_set); }
[ "jaadds@c7f6ba40-6498-11de-987a-95e5a5a5d5f1", "chamaraanuradha@c7f6ba40-6498-11de-987a-95e5a5a5d5f1" ]
[ [ [ 1, 95 ], [ 97, 303 ] ], [ [ 96, 96 ] ] ]
df71e3d37a847f3722d6838fea260272546f1a80
9710e59ed37e5b7a9d05fe99ffcca5f49444f7a3
/src/AbstractMode.h
f780dc179e0b20498de516b6cdfa4b510edc5e60
[]
no_license
btuduri/dspaint
218d6de862d9e5c0b062c17d5f75c569e35ffb5e
a1f47537c960d6e93ef8853a14c9ee4b9f267ec5
refs/heads/master
2016-09-06T08:44:20.354217
2009-04-27T20:58:05
2009-04-27T20:58:05
32,271,641
0
0
null
null
null
null
UTF-8
C++
false
false
1,586
h
#ifndef ABSTRACTMODE_H #define ABSTRACTMODE_H #include "Canvas.h" #include "Options.h" #include "PromptManager.h" namespace DSPaint { /** * The child classes should implement the button presses as the default does nothing. */ class AbstractMode { private: void ChooseMode(); public: /** * Creates a new mode. */ AbstractMode(); /** * Destroys this mode. */ virtual ~AbstractMode(); /** * Return the name of the mode. */ virtual const char *GetName(); /** * Method to execute on A press. */ virtual void A(); /** * Method to execute on B press. */ virtual void B(); /** * Method to execute on X press. */ virtual void X(); /** * Method to execute on Y press. */ virtual void Y(); /** * Method to execute on L press. */ void L(); /** * Method to execute on R press. */ void R(); /** * Method to execute on +up press. */ virtual void Up(); /** * Method to execute on +down press. */ virtual void Down(); /** * Method to execute on +left press. */ virtual void Left(); /** * Method to execute on +right press. */ virtual void Right(); /** * Method to execute on start press. */ virtual void Start(); /** * Method to execute on select press. * This should ideally be a help screen. */ virtual void Select(); }; } #endif
[ "nightstalkerz@08a58f1c-9a32-11dd-9476-71c886a649bc" ]
[ [ [ 1, 97 ] ] ]
308b8851340ec399d95249b44f6e8813010ef51c
7b4c786d4258ce4421b1e7bcca9011d4eeb50083
/_代码统计专用文件夹/C++Primer中文版(第4版)/第一章 快速入门/20081217_习题1.11_while循环_转换为for循环_输出.cpp
a0992c25b18946231cde14568de94a39ebedb225
[]
no_license
lzq123218/guoyishi-works
dbfa42a3e2d3bd4a984a5681e4335814657551ef
4e78c8f2e902589c3f06387374024225f52e5a92
refs/heads/master
2021-12-04T11:11:32.639076
2011-05-30T14:12:43
2011-05-30T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
108
cpp
#include <iostream> int main() { for(int i=10;i>=0;--i) std::cout << i << std::endl; return 0; }
[ "baicaibang@70501136-4834-11de-8855-c187e5f49513" ]
[ [ [ 1, 8 ] ] ]
d06660f5222e7926bceb9ae2fcec326728323105
b83c990328347a0a2130716fd99788c49c29621e
/include/boost/lambda/detail/lambda_functor_base.hpp
b1b4e3f0b6eaf1ca6b7941a1c6a5a1317f369be7
[]
no_license
SpliFF/mingwlibs
c6249fbb13abd74ee9c16e0a049c88b27bd357cf
12d1369c9c1c2cc342f66c51d045b95c811ff90c
refs/heads/master
2021-01-18T03:51:51.198506
2010-06-13T15:13:20
2010-06-13T15:13:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
22,416
hpp
// Boost Lambda Library lambda_functor_base.hpp ----------------------------- // // Copyright (C) 1999, 2000 Jaakko Jarvi ([email protected]) // // 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 // ------------------------------------------------------------ #ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP #define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP namespace boost { namespace lambda { #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(push) #pragma warning(disable:4512) //assignment operator could not be generated #endif // for return type deductions we wrap bound argument to this class, // which fulfils the base class contract for lambda_functors template <class T> class identity { T elem; public: typedef T element_t; // take all parameters as const references. Note that non-const references // stay as they are. typedef typename boost::add_reference< typename boost::add_const<T>::type >::type par_t; explicit identity(par_t t) : elem(t) {} template <typename SigArgs> struct sig { typedef element_t type; }; template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; } }; #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(pop) #endif template <class T> inline lambda_functor<identity<T&> > var(T& t) { return identity<T&>(t); } // for lambda functors, var is an identity operator. It was forbidden // at some point, but we might want to var something that can be a // non-lambda functor or a lambda functor. template <class T> lambda_functor<T> var(const lambda_functor<T>& t) { return t; } template <class T> struct var_type { typedef lambda_functor<identity<T&> > type; }; template <class T> inline lambda_functor<identity<typename bound_argument_conversion<const T>::type> > constant(const T& t) { return identity<typename bound_argument_conversion<const T>::type>(t); } template <class T> lambda_functor<T> constant(const lambda_functor<T>& t) { return t; } template <class T> struct constant_type { typedef lambda_functor< identity<typename bound_argument_conversion<const T>::type> > type; }; template <class T> inline lambda_functor<identity<const T&> > constant_ref(const T& t) { return identity<const T&>(t); } template <class T> lambda_functor<T> constant_ref(const lambda_functor<T>& t) { return t; } template <class T> struct constant_ref_type { typedef lambda_functor<identity<const T&> > type; }; // as_lambda_functor turns any types to lambda functors // non-lambda_functors will be bound argument types template <class T> struct as_lambda_functor { typedef typename detail::remove_reference_and_cv<T>::type plain_T; typedef typename detail::IF<is_lambda_functor<plain_T>::value, plain_T, lambda_functor< identity<typename bound_argument_conversion<T>::type> > >::RET type; }; // turns arbitrary objects into lambda functors template <class T> inline lambda_functor<identity<typename bound_argument_conversion<const T>::type> > to_lambda_functor(const T& t) { return identity<typename bound_argument_conversion<const T>::type>(t); } template <class T> inline lambda_functor<T> to_lambda_functor(const lambda_functor<T>& t) { return t; } namespace detail { // In a call constify_rvals<T>::go(x) // x should be of type T. If T is a non-reference type, do // returns x as const reference. // Otherwise the type doesn't change. // The purpose of this class is to avoid // 'cannot bind temporaries to non-const references' errors. template <class T> struct constify_rvals { template<class U> static inline const U& go(const U& u) { return u; } }; template <class T> struct constify_rvals<T&> { template<class U> static inline U& go(U& u) { return u; } }; // check whether one of the elements of a tuple (cons list) is of type // null_type. Needed, because the compiler goes ahead and instantiates // sig template for nullary case even if the nullary operator() is not // called template <class T> struct is_null_type { BOOST_STATIC_CONSTANT(bool, value = false); }; template <> struct is_null_type<null_type> { BOOST_STATIC_CONSTANT(bool, value = true); }; template<class Tuple> struct has_null_type { BOOST_STATIC_CONSTANT(bool, value = (is_null_type<typename Tuple::head_type>::value || has_null_type<typename Tuple::tail_type>::value)); }; template<> struct has_null_type<null_type> { BOOST_STATIC_CONSTANT(bool, value = false); }; // helpers ------------------- template<class Args, class SigArgs> class deduce_argument_types_ { typedef typename as_lambda_functor<typename Args::head_type>::type lf_t; typedef typename lf_t::inherited::template sig<SigArgs>::type el_t; public: typedef boost::tuples::cons< el_t, typename deduce_argument_types_<typename Args::tail_type, SigArgs>::type > type; }; template<class SigArgs> class deduce_argument_types_<null_type, SigArgs> { public: typedef null_type type; }; // // note that tuples cannot have plain function types as elements. // // Hence, all other types will be non-const, except references to // // functions. // template <class T> struct remove_reference_except_from_functions { // typedef typename boost::remove_reference<T>::type t; // typedef typename detail::IF<boost::is_function<t>::value, T, t>::RET type; // }; template<class Args, class SigArgs> class deduce_non_ref_argument_types_ { typedef typename as_lambda_functor<typename Args::head_type>::type lf_t; typedef typename lf_t::inherited::template sig<SigArgs>::type el_t; public: typedef boost::tuples::cons< // typename detail::remove_reference_except_from_functions<el_t>::type, typename boost::remove_reference<el_t>::type, typename deduce_non_ref_argument_types_<typename Args::tail_type, SigArgs>::type > type; }; template<class SigArgs> class deduce_non_ref_argument_types_<null_type, SigArgs> { public: typedef null_type type; }; // ------------- // take stored Args and Open Args, and return a const list with // deduced elements (real return types) template<class Args, class SigArgs> class deduce_argument_types { typedef typename deduce_argument_types_<Args, SigArgs>::type t1; public: typedef typename detail::IF< has_null_type<t1>::value, null_type, t1 >::RET type; }; // take stored Args and Open Args, and return a const list with // deduced elements (references are stripped from the element types) template<class Args, class SigArgs> class deduce_non_ref_argument_types { typedef typename deduce_non_ref_argument_types_<Args, SigArgs>::type t1; public: typedef typename detail::IF< has_null_type<t1>::value, null_type, t1 >::RET type; }; template <int N, class Args, class SigArgs> struct nth_return_type_sig { typedef typename as_lambda_functor< typename boost::tuples::element<N, Args>::type // typename tuple_element_as_reference<N, Args>::type >::type lf_type; typedef typename lf_type::inherited::template sig<SigArgs>::type type; }; template<int N, class Tuple> struct element_or_null { typedef typename boost::tuples::element<N, Tuple>::type type; }; template<int N> struct element_or_null<N, null_type> { typedef null_type type; }; } // end detail // -- lambda_functor base --------------------- // the explicit_return_type_action case ----------------------------------- template<class RET, class Args> class lambda_functor_base<explicit_return_type_action<RET>, Args> { public: Args args; explicit lambda_functor_base(const Args& a) : args(a) {} template <class SigArgs> struct sig { typedef RET type; }; template<class RET_, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const { return detail::constify_rvals<RET>::go( detail::r_select<RET>::go(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)); } }; // the protect_action case ----------------------------------- template<class Args> class lambda_functor_base<protect_action, Args> { public: Args args; public: explicit lambda_functor_base(const Args& a) : args(a) {} template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return boost::tuples::get<0>(args); } template<class SigArgs> struct sig { // typedef typename detail::tuple_element_as_reference<0, SigArgs>::type type; typedef typename boost::tuples::element<0, Args>::type type; }; }; // Do nothing -------------------------------------------------------- class do_nothing_action {}; template<class Args> class lambda_functor_base<do_nothing_action, Args> { // Args args; public: // explicit lambda_functor_base(const Args& a) {} lambda_functor_base() {} template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const { return CALL_USE_ARGS; } template<class SigArgs> struct sig { typedef void type; }; }; // These specializations provide a shorter notation to define actions. // These lambda_functor_base instances take care of the recursive evaluation // of the arguments and pass the evaluated arguments to the apply function // of an action class. To make action X work with these classes, one must // instantiate the lambda_functor_base as: // lambda_functor_base<action<ARITY, X>, Args> // Where ARITY is the arity of the apply function in X // The return type is queried as: // return_type_N<X, EvaluatedArgumentTypes>::type // for which there must be a specialization. // Function actions, casts, throws,... all go via these classes. template<class Act, class Args> class lambda_functor_base<action<0, Act>, Args> { public: // Args args; not needed explicit lambda_functor_base(const Args& /*a*/) {} template<class SigArgs> struct sig { typedef typename return_type_N<Act, null_type>::type type; }; template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return Act::template apply<RET>(); } }; #if defined BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART #error "Multiple defines of BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART" #endif #define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(ARITY) \ template<class Act, class Args> \ class lambda_functor_base<action<ARITY, Act>, Args> \ { \ public: \ Args args; \ \ explicit lambda_functor_base(const Args& a) : args(a) {} \ \ template<class SigArgs> struct sig { \ typedef typename \ detail::deduce_non_ref_argument_types<Args, SigArgs>::type rets_t; \ public: \ typedef typename \ return_type_N_prot<Act, rets_t>::type type; \ }; \ \ \ template<class RET, CALL_TEMPLATE_ARGS> \ RET call(CALL_FORMAL_ARGS) const { \ using boost::tuples::get; \ using detail::constify_rvals; \ using detail::r_select; \ using detail::element_or_null; \ using detail::deduce_argument_types; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(1) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(2) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(3) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(4) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; typedef typename element_or_null<3, rets_t>::type rt3; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(5) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; typedef typename element_or_null<3, rets_t>::type rt3; typedef typename element_or_null<4, rets_t>::type rt4; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(6) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; typedef typename element_or_null<3, rets_t>::type rt3; typedef typename element_or_null<4, rets_t>::type rt4; typedef typename element_or_null<5, rets_t>::type rt5; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(7) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; typedef typename element_or_null<3, rets_t>::type rt3; typedef typename element_or_null<4, rets_t>::type rt4; typedef typename element_or_null<5, rets_t>::type rt5; typedef typename element_or_null<6, rets_t>::type rt6; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(8) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; typedef typename element_or_null<3, rets_t>::type rt3; typedef typename element_or_null<4, rets_t>::type rt4; typedef typename element_or_null<5, rets_t>::type rt5; typedef typename element_or_null<6, rets_t>::type rt6; typedef typename element_or_null<7, rets_t>::type rt7; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(9) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; typedef typename element_or_null<3, rets_t>::type rt3; typedef typename element_or_null<4, rets_t>::type rt4; typedef typename element_or_null<5, rets_t>::type rt5; typedef typename element_or_null<6, rets_t>::type rt6; typedef typename element_or_null<7, rets_t>::type rt7; typedef typename element_or_null<8, rets_t>::type rt8; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)) ); } }; BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(10) typedef typename deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; typedef typename element_or_null<0, rets_t>::type rt0; typedef typename element_or_null<1, rets_t>::type rt1; typedef typename element_or_null<2, rets_t>::type rt2; typedef typename element_or_null<3, rets_t>::type rt3; typedef typename element_or_null<4, rets_t>::type rt4; typedef typename element_or_null<5, rets_t>::type rt5; typedef typename element_or_null<6, rets_t>::type rt6; typedef typename element_or_null<7, rets_t>::type rt7; typedef typename element_or_null<8, rets_t>::type rt8; typedef typename element_or_null<9, rets_t>::type rt9; return Act::template apply<RET>( constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)), constify_rvals<rt9>::go(r_select<rt9>::go(get<9>(args), CALL_ACTUAL_ARGS)) ); } }; #undef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART } // namespace lambda } // namespace boost #endif
[ [ [ 1, 607 ] ] ]
ea8bfe1d49698839258c73638ebef4d7d33913a3
651639abcfc06818971a0296944703b3dd050e8d
/Stage2.hpp
b89e247b73b43e4b6769ceb42873a803dba4cf40
[]
no_license
reanag/snailfight
5256dc373e3f3f3349f77c7e684cb0a52ccc5175
c4f157226faa31d526684233f3c5cd4572949698
refs/heads/master
2021-01-19T07:34:17.122734
2010-01-20T17:16:36
2010-01-20T17:16:36
34,893,173
0
0
null
null
null
null
UTF-8
C++
false
false
5,327
hpp
#ifndef STAGE2_HPP #define STAGE2_HPP #include "..\Box2D_v2.0.1\Box2D\Include\Box2D.h" #include <SFML/Graphics.hpp> #include <iostream> #include <math.h> #include "Object.hpp" #include "TempObjectHandler.hpp" using namespace std; using namespace sf; class Stage2 : public Object { public: /*class Line { b2Body* path02Body; data path02data; Shape Path02; public: Line(b2World* world2,int x, int y, int w, int h, string name) { b2BodyDef path02BodyDef; path02BodyDef.position.Set(x, y); path02Body = world2->CreateBody(&path02BodyDef); b2PolygonDef path02ShapeDef; path02ShapeDef.SetAsBox(w,h); path02Body->CreateShape(&path02ShapeDef); path02data.label=name; path02data.object=this; path02Body->SetUserData(&path02data); Path02=Shape::Rectangle(0, 0, path02ShapeDef.vertices[2].x*2, path02ShapeDef.vertices[2].y*2, Color(0,200,200)); Path02.SetCenter(path02ShapeDef.vertices[2].x, path02ShapeDef.vertices[2].y); Path02.SetPosition(path02BodyDef.position.x,path02BodyDef.position.y); } };*/ int BGWidth; int BGHeight; float BGScale; bool Visiblepath; RenderWindow* Window; b2World* world; TempObjectHandler* TOH; b2Body* groundBody; data grounddata; //Shape Ground; b2Body* wall1Body; data wall1data; Shape Wall1; b2Body* wall2Body; data wall2data; Shape Wall2; b2Body* roofBody; data roofdata; Shape Roof; b2Body* path01Body; data path01data; Shape Path01; b2Body* path02Body; data path02data; Shape Path02; b2Body* path03Body; data path03data; Shape Path03; b2Body* path04Body; data path04data; Shape Path04; b2Body* path05Body; data path05data; Shape Path05; b2Body* path06Body; data path06data; Shape Path06; b2Body* path07Body; data path07data; Shape Path07; b2Body* path08Body; data path08data; Shape Path08; b2Body* path09Body; data path09data; Shape Path09; b2Body* path10Body; data path10data; Shape Path10; b2Body* path11Body; data path11data; Shape Path11; b2Body* path12Body; data path12data; Shape Path12; b2Body* path13Body; data path13data; Shape Path13; b2Body* path14Body; data path14data; Shape Path14; b2Body* path15Body; data path15data; Shape Path15; b2Body* path16Body; data path16data; Shape Path16; b2Body* path17Body; data path17data; Shape Path17; b2Body* path18Body; data path18data; Shape Path18; b2Body* path19Body; data path19data; Shape Path19; b2Body* path20Body; data path20data; Shape Path20; b2Body* path21Body; data path21data; Shape Path21; b2Body* path22Body; data path22data; Shape Path22; b2Body* path23Body; data path23data; Shape Path23; b2Body* path24Body; data path24data; Shape Path24; b2Body* balcony01Body; data balcony01data; Shape Balcony01; b2Body* balcony02Body; data balcony02data; Shape Balcony02; b2Body* balcony03Body; data balcony03data; Shape Balcony03; b2Body* balcony04Body; data balcony04data; Shape Balcony04; b2Body* balcony05Body; data balcony05data; Shape Balcony05; b2Body* tree201Body; data tree201data; Shape Tree201; b2Body* tree202Body; data tree202data; Shape Tree202; b2Body* tree203Body; data tree203data; Shape Tree203; b2Body* tree204Body; data tree204data; Shape Tree204; b2Body* tree205Body; data tree205data; Shape Tree205; b2Body* tree206Body; data tree206data; Shape Tree206; Image grassImg; Sprite GrassSp; Image bacgroundImg; Sprite BacgroundSp; Image topImg; Sprite topSp; //Image treeImg; //Sprite TreeSp; //Stage(RenderWindow* window, b2World* World, TempObjectHandler* toh); Stage2(); void MakeStage(RenderWindow* window, b2World* World, TempObjectHandler* toh); int Width(){return BGWidth;}; int Height(){return BGHeight;}; int RelativeWidth(float percent){return (int)(((float)BGWidth)*percent*0.01);}; int RelativeHeight(float percent){return (int)(((float)BGHeight)*percent*0.01);}; void Show(); void ShowAfter(); void InputHandling(/*Event ev*/); }; #endif
[ "[email protected]@96fa20d8-dc45-11de-8f20-5962d2c82ea8" ]
[ [ [ 1, 193 ] ] ]
268dbbec61de2facee2f8b5f0e093aa00deb07c9
6bdb3508ed5a220c0d11193df174d8c215eb1fce
/Codes/Halak.Toolkit/EditorAttribute.cpp
1ccd170d29db0cd888d7dde092d4f8cbc1901668
[]
no_license
halak/halak-plusplus
d09ba78640c36c42c30343fb10572c37197cfa46
fea02a5ae52c09ff9da1a491059082a34191cd64
refs/heads/master
2020-07-14T09:57:49.519431
2011-07-09T14:48:07
2011-07-09T14:48:07
66,716,624
0
0
null
null
null
null
UTF-8
C++
false
false
568
cpp
#include <Halak.Toolkit/PCH.h> #include <Halak.Toolkit/EditorAttribute.h> #include <Halak.Toolkit/TypeLibrary.h> namespace Halak { namespace Toolkit { EditorAttribute::EditorAttribute(const char* editorTypeName) : Attribute(), editorTypeName(editorTypeName) { } EditorAttribute::~EditorAttribute() { } const TypeInfo* EditorAttribute::GetEditorType() const { return TypeLibrary::GetInstance().Find(editorTypeName); } } }
[ [ [ 1, 24 ] ] ]
06f2def3b1223b66cd2494f22eee8460e590a0ff
cd387cba6088f351af4869c02b2cabbb678be6ae
/lib/geometry/doc/doxygen_examples.hpp
c89e2550c7a8a2d52027d3e268f6397e26493be5
[ "BSL-1.0" ]
permissive
pedromartins/mew-dev
e8a9cd10f73fbc9c0c7b5bacddd0e7453edd097e
e6384775b00f76ab13eb046509da21d7f395909b
refs/heads/master
2016-09-06T14:57:00.937033
2009-04-13T15:16:15
2009-04-13T15:16:15
32,332,332
0
0
null
null
null
null
UTF-8
C++
false
false
7,854
hpp
// Geometry Library // // Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands. // Copyright Bruno Lalande 2008 // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef _DOXYGEN_EXAMPLES_HPP #define _DOXYGEN_EXAMPLES_HPP /*! \example 1_point_example.cpp In most cases the documentation gives small examples of how to use the algorithms or classes. The point example is a slightly larger example giving the an idea of how to use different algorithms from the library, related to points. It shows - the usage of include files - how to declare points, using different coordinate types - how to construct points, specifying coordinates, initializing to zero or to infinite - how to compare points to each other - how points can be streamed as OGC text - calculating the distance from point to point */ //--------------------------------------------------------------------------------------------------- /*! \example 2_point_ll_example.cpp This example explains how to use point_ll latlong points. Those points can be specified in degrees or in radians. Calculations are usually done using radians. Storage is usually in degrees. There is a conversion method available. Furthermore, there are specific measures to avoid confusion between lat/lon, lat with east/west, etc: - There is a constructor using latitude / longitude - There is a constructor using longitude / latitude - There is \b no constructor using two floating point values - The latitude using DMS class should have north or south - The longitude using DMS class should have east or west */ //--------------------------------------------------------------------------------------------------- /*! \example 3_linestring_example.cpp The linestring example shows how linestrings can be declared and used and shows some more algorithms. One of the important concepts of the geometry library is that it is totally built upon the standard library, using the standard containers such as std::vector. A linestring is, as explained elsewhere in this documentation, not much more than a vector of points. Most algorithms run on linestrings, but can also run on any iterator pair. And all algorithms on std::vector can be used on geometry::linestring. The sample shows this, shows some algorithms: - geometry::envelope - geometry::length - geometry::distance - geometry::simplify - geometry::for_each - geometry::intersection This documentation illustrates the simplify algorithm and the intersection algorithm with some pictures. The simplify algorithm simplifies a linestring. Simplification means that the less important points are removed from the line and that the points that are most important for the shape of a line are kept. Simplification is done using the well known Douglas Peucker algorithm. The library user can specify the distance or tolerance, which indicates how much the linestring should be simplified. The image below shows the original and simplified linestring: \image html simplify_example.png The red line is the original linestring; the blue line is the simplified line which has one point less. In geographical applications simplification can reduce a linestring to its basic form containing only 10% of its original points. The intersection algorithm intersects two geometries which each other, delivering a third geometry. In the case of the example a linestring is intersected with a box. Intersection with a box is often called a clip. The image below illustrates the intersection. \image html intersection_linestring_example.png The red line is intersected with the blue box. The intersection result, painted in black, is a multi_linestring containing three linestrings. */ //--------------------------------------------------------------------------------------------------- /*! \example 4_polygon_example.cpp The polygon example shows some examples of what can be done with polygons in the Geometry Library: * the outer ring and the inner rings * how to calculate the area of a polygon * how to get the centroid, and how to get an often more interesting label point * how to correct the polygon such that it is clockwise and closed * within: the well-known point in polygon algorithm * how to use polygons which use another container, or which use different containers for points and for inner rings * how polygons can be intersected, or clipped, using a clipping box The illustrations below show the usage of the within algorithm and the intersection algorithm. The within algorithm results in true if a point lies completly within a polygon. If it lies exactly on a border it is not considered as within and if it is inside a hole it is also not within the polygon. This is illustrated below, where only the point in the middle is within the polygon. \image html within_polygon_example.png The clipping algorithm, called intersection, is illustrated below: \image html clip_polygon_example.png The yellow polygon, containing a hole, is clipped with the blue rectangle, resulting in a multi_polygon of three polygons, drawn in red. The hole is vanished. include polygon_example.cpp */ //--------------------------------------------------------------------------------------------------- /*! \example 5_distance_example.cpp The distance example shows how the distance algorithms can be used for point_xy points, for point_ll points, with our without explicitly specified strategies */ //--------------------------------------------------------------------------------------------------- /*! \example 6_transformation_example.cpp This sample demonstrates the usage of the Geometry Library in combination with the uBLAS matrix/vector library. The Geometry Library does not define vector/matrix calculations. The reason for that is they are already there. Boost contains one in uBLAS. Furthermore there is a MTL. And there are many more available. So the Geometry Library can be used in combination with matrix/vector libraries. It supports the algorithm \b for_each_point which iterates through all points of a container, of a polygon, and it can visit a point as well (for consistancy). for_each_point can be used for transformations or projections. The Geometry Library also uses simple matrix/vector calculations in its algorithms. For example the dot-product is used, a determinant is calculated in the intersection calculation of segments, and a cross-product will be used. At this moment this those aritmethics calculated in the library. Until now we didn't want to introduce a library for this, because it was not completely clear which library. That might change. */ //--------------------------------------------------------------------------------------------------- /*! \example 7_custom_point_example.cpp This sample demonstrates that custom points can be made as well. In this case it is defined from boost::tuple and adds some properties. It is also possible to make a legacy point and add a traits class. */ //--------------------------------------------------------------------------------------------------- /*! \example well_formed_point.cpp A small but well formed point. This source shows that and tests if custom points can be handled by the geometry library */ //--------------------------------------------------------------------------------------------------- /*! \example well_formed_point_traits.cpp A small but well formed point, using traits classes. This source shows that and tests if (legacy) points can be handled by the geometry library */ #endif // _DOXYGEN_EXAMPLES_HPP
[ "fushunpoon@1fd432d8-e285-11dd-b2d9-215335d0b316" ]
[ [ [ 1, 168 ] ] ]
f21dcb83a68181d1ff78ffb7699b738b668eb6f1
58496be10ead81e2531e995f7d66017ffdfc6897
/Include/PropertiesImpl.h
7c227f993d499d33682063186538355351c4e020
[]
no_license
Diego160289/cross-fw
ba36fc6c3e3402b2fff940342315596e0365d9dd
532286667b0fd05c9b7f990945f42279bac74543
refs/heads/master
2021-01-10T19:23:43.622578
2011-01-09T14:54:12
2011-01-09T14:54:12
38,457,864
0
0
null
null
null
null
UTF-8
C++
false
false
2,432
h
//============================================================================ // Date : 22.12.2010 // Author : Tkachenko Dmitry // Copyright : (c) Tkachenko Dmitry ([email protected]) //============================================================================ #ifndef __PROPERTIESIMPL_H__ #define __PROPERTIESIMPL_H__ #include "IFacesTools.h" #include "SyncObj.h" #include "Exceptions.h" #include "INamedVariableImpl.h" namespace IFacesImpl { using IFaces::RetCode; using IFaces::retOk; using IFaces::retFalse; using IFaces::retFail; template < typename TBaseIFace = IFaces::IProperties > class IProperties : public TBaseIFace { public: IProperties() : SynObj(0) { } // IProperties virtual RetCode AddProperty(IFaces::INamedVariable *prop) { return retFail; } virtual RetCode RemoveProperty(const char *propName) { return retFail; } virtual RetCode GetValue(const char *propName, IFaces::IVariant **value) const { return retFail; } virtual RetCode SetValue(const char *propName, IFaces::IVariant *value) { return retFail; } virtual RetCode EnumProperties(IFaces::IEnum **props) const { return retFail; } private: Common::ISynObj *SynObj; protected: void InitSynObj(Common::ISynObj *synObj) { SynObj = synObj; } }; class IPropertiesImpl : public Common::CoClassBase < TYPE_LIST_1(IProperties<IFaces::IProperties>) > { public: DECLARE_UUID(25a525ca-e9b1-4b4b-bb7f-0b4e7e66bba9) IPropertiesImpl() { //InitSynObj(&GetSynObj()); } }; class IPersistsPropertiesImpl : public Common::CoClassBase < TYPE_LIST_1(IProperties<IFaces::IPersistsProperties>) > { public: DECLARE_UUID(672066ad-3284-474c-bb0b-9bd3ea7302f9) IPersistsPropertiesImpl() { //InitSynObj(&GetSynObj()); } // IPersistsProperties virtual RetCode Load(IFaces::IInputStream *stream) { return retFail; } virtual RetCode Save(IFaces::IOutputStream *stream) { return retFail; } virtual const char* GetStreamName() const { return ""; } }; } #endif // !__PROPERTIESIMPL_H__
[ "TkachenkoDmitryV@d548627a-540d-11de-936b-e9512c4d2277" ]
[ [ [ 1, 116 ] ] ]
00f08ab9813e339b4637b1f965e0df2ca6d6a016
8403411fa78af2109c30e7c33ad9bc860d12ed83
/src/tools/connect_edges_tool.cc
cf9609f9ed25d7d3d7873ee4c2024aad6dc39db4
[]
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
1,188
cc
/* * connect_edges_tool.cc * * Created on: Sep 12, 2008 * Author: david.morris */ #include "connect_edges_tool.h" #include "../MainWindow.h" class MainWindow; ConnectEdgesTool::ConnectEdgesTool(QWidget *parent) { parent_ = parent; layout_ = new QGridLayout; layout_->setVerticalSpacing(1); layout_->setHorizontalSpacing(1); QLabel *no_options_label_ = new QLabel(tr("No Options for this tool.")); layout_->addWidget(no_options_label_, 0, 0); layout_->setRowStretch(1, 1); layout_->setColumnStretch(1, 1); widget_ = new QWidget; widget_->setWindowTitle(tr("Connect Edges")); widget_->setLayout(layout_); action_ = new QAction(tr("Connects Edges"), parent_); action_->setIcon(QIcon(":/images/connect_edges.png")); action_->setCheckable(true); action_->setStatusTip(tr("Connect Edges")); action_->setToolTip(tr("Connect Edges")); connect(action_, SIGNAL(triggered()), this, SLOT(Activate())); } void ConnectEdgesTool::Activate() { ((MainWindow*) parent_)->setToolOptions(widget_); ((MainWindow*) parent_)->setMode(MainWindow::ConnectEdges); } void ConnectEdgesTool::RetranslateUi(){ }
[ "dvmorris@e0e46c49-be69-4f5a-ad62-21024a331aea" ]
[ [ [ 1, 43 ] ] ]
15d61d120b73ec87b5ceee8807447c66cf22b40e
5dc78c30093221b4d2ce0e522d96b0f676f0c59a
/src/modules/physics/box2d/Body.h
f6195b798cb0bc61bbee1c9f07fb9690a8bfdce2
[ "Zlib" ]
permissive
JackDanger/love
f03219b6cca452530bf590ca22825170c2b2eae1
596c98c88bde046f01d6898fda8b46013804aad6
refs/heads/master
2021-01-13T02:32:12.708770
2009-07-22T17:21:13
2009-07-22T17:21:13
142,595
1
0
null
null
null
null
UTF-8
C++
false
false
8,695
h
/** * Copyright (c) 2006-2009 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. **/ #ifndef LOVE_PHYSICS_BOX2D_BODY_H #define LOVE_PHYSICS_BOX2D_BODY_H // LOVE #include <common/runtime.h> #include <common/Object.h> // Box2D #include "Include/Box2D.h" namespace love { namespace physics { namespace box2d { // Forward declarations. class World; /** * A Body is an entity which has position and orientation * in world space. A Body does have collision geometry * by itself, but depend on an arbitrary number of child Shape objects * which together constitute the final geometry for the Body. **/ class Body : public Object { // Friends. friend class Joint; friend class DistanceJoint; friend class MouseJoint; friend class CircleShape; friend class PolygonShape; friend class Shape; private: // We need a shared_ptr to the parent World, // because World can not be destroyed as long as // bodies exists in it. // // This ensures that a World only can be destroyed // once all bodies have been destroyed too. World * world; public: // The Box2D body. (Should not be public?) b2Body * body; /** * Create a Body at position p. **/ Body(World * world, b2Vec2 p, float m, float i); ~Body(); /** * Gets the current x-position of the Body. **/ float getX(); /** * Gets the current y-position of the Body. **/ float getY(); /** * Gets the current angle (deg) of the Body. **/ float getAngle(); /** * Gets the current position of the Body. * @returns The current x-position. * @returns The current y-position. **/ int getPosition(lua_State * L); /** * Gets the velocity in the current center of mass. * @returns The x-component of the velocity. * @returns The y-component of the velocity. **/ int getVelocity(lua_State * L); /** * The current center of mass for the Body in world * coordinates. * @returns The x-component of the point. * @returns The y-component of the point. **/ int getWorldCenter(lua_State * L); /** * The current center of mass for the Body in local * coordinates. * @returns The x-component of the point. * @returns The y-component of the point. **/ int getLocalCenter(lua_State * L); /** * Get the current Body spin. (Angular velocity). **/ float getSpin() const; /** * Gets the Body's mass. **/ float getMass() const; /** * Gets the Body's intertia. **/ float getInertia() const; /** * Gets the Body's angular damping. **/ float getAngularDamping() const; /** * Gets the Body's linear damping. **/ float getDamping() const; /** * Apply an impulse (jx, jy) with offset (0, 0). **/ void applyImpulse(float jx, float jy); /** * Apply an impulse (jx, jy) with offset (rx, ry). **/ void applyImpulse(float jx, float jy, float rx, float ry); /** * Apply torque (t). **/ void applyTorque(float t); /** * Apply force (fx, fy) with offset (0, 0). **/ void applyForce(float fx, float fy); /** * Apply force (fx, fy) with offset (rx, ry). **/ void applyForce(float fx, float fy, float rx, float ry); /** * Sets the x-position of the Body. **/ void setX(float x); /** * Sets the Y-position of the Body. **/ void setY(float y); /** * Sets the current velocity of the Body. **/ void setVelocity(float x, float y); /** * Sets the angle of the Body. **/ void setAngle(float d); /** * Sets the current spin of the Body. **/ void setSpin(float r); /** * Sets the current position of the Body. **/ void setPosition(float x, float y); /** * Sets the mass from the currently attatched shapes. **/ void setMassFromShapes(); /** * Sets mass properties. * @param x The x-coordinate for the local center of mass. * @param y The y-coordinate for the local center of mass. * @param m The mass. * @param i The inertia. **/ void setMass(float x, float y, float m, float i); /** * Sets the Body's angular damping. **/ void setAngularDamping(float d); /** * Sets the Body's linear damping. **/ void setDamping(float d); /** * Transforms a point (x, y) from local coordinates * to world coordinates. * @param x The x-coordinate of the local point. * @param y The y-coordinate of the local point. * @returns The x-coordinate of the point in world coordinates. * @returns The y-coordinate of the point in world coordinates. **/ int getWorldPoint(lua_State * L); /** * Transforms a vector (x, y) from local coordinates * to world coordinates. * @param x The x-coordinate of the local vector. * @param y The y-coordinate of the local vector. * @returns The x-coordinate of the vector in world coordinates. * @returns The y-coordinate of the vector in world coordinates. **/ int getWorldVector(lua_State * L); /** * Transforms a point (x, y) from world coordinates * to local coordinates. * @param x The x-coordinate of the world point. * @param y The y-coordinate of the world point. * @returns The x-coordinate of the point in local coordinates. * @returns The y-coordinate of the point in local coordinates. **/ int getLocalPoint(lua_State * L); /** * Transforms a vector (x, y) from world coordinates * to local coordinates. * @param x The x-coordinate of the world vector. * @param y The y-coordinate of the world vector. * @returns The x-coordinate of the vector in local coordinates. * @returns The y-coordinate of the vector in local coordinates. **/ int getLocalVector(lua_State * L); /** * Gets the velocity on the Body for the given world point. * @param x The x-coordinate of the world point. * @param y The y-coordinate of the world point. * @returns The x-component of the velocity vector. * @returns The y-component of the velocity vector. **/ int getVelocityWorldPoint(lua_State * L); /** * Gets the velocity on the Body for the given local point. * @param x The x-coordinate of the local point. * @param y The y-coordinate of the local point. * @returns The x-component of the velocity vector. * @returns The y-component of the velocity vector. **/ int getVelocityLocalPoint(lua_State * L); /** * Returns true if the Body is a bullet, false otherwise. **/ bool isBullet() const; /** * Set whether this Body should be treated as a bullet. * Bullets require more processing power than normal shapes. **/ void setBullet(bool bullet); /** * Checks whether a Body is static or not, i.e. terrain * or not. **/ bool isStatic() const; /** * The opposite of isStatic. **/ bool isDynamic() const; /** * Checks whether a Body is frozen or not. * A Body will freeze if hits the world bounding box. **/ bool isFrozen() const; /** * Checks whether a Body is sleeping or nor. A Body * will fall to sleep if nothing happens to it for while. **/ bool isSleeping() const; /** * Controls whether this Body should be allowed to sleep. **/ void setAllowSleep(bool allow); /** * Controls the Body's sleep. * @param sleep True to put to sleep, false to wake up. **/ void setSleep(bool sleep); private: /** * Gets a 2d vector from the arguments on the stack. **/ b2Vec2 getVector(lua_State * L); /** * Pushed the x- and y-components of a vector on * the stack. **/ int pushVector(lua_State * L, const b2Vec2 & v); }; } // box2d } // physics } // love #endif // LOVE_PHYSICS_BOX2D_BODY_H
[ "prerude@3494dbca-881a-0410-bd34-8ecbaf855390" ]
[ [ [ 1, 349 ] ] ]
5509f438dd37b765360fc922652d5581ad7a87cc
4d3983366ea8a2886629d9a39536f0cd05edd001
/src/main/main.cpp
943405ef271a2347c349905eed597efa372e30be
[]
no_license
clteng5316/rodents
033a06d5ad11928425a40203a497ea95e98ce290
7be0702d0ad61d9a07295029ba77d853b87aba64
refs/heads/master
2021-01-10T13:05:13.757715
2009-08-07T14:46:13
2009-08-07T14:46:13
36,857,795
1
0
null
null
null
null
SHIFT_JIS
C++
false
false
4,361
cpp
// main.cpp #include "stdafx.h" #include "sq.hpp" #include "win32.hpp" #include "ref.hpp" #include "string.hpp" #include "resource.h" #pragma comment(lib, "comctl32") #pragma comment(lib, "gdi32") #pragma comment(lib, "imm32") #pragma comment(lib, "shell32") #pragma comment(lib, "shlwapi") #pragma comment(lib, "version") #pragma comment(lib, "winmm") #pragma comment(lib, "wininet") #pragma comment(lib, "gdiplus") // これってバグじゃないの? #define CLSID_NameSpaceTreeControl CLSID_NamespaceTreeControl const bool DEBUG = RELEASE_OR_DEBUG(false, true); int WINDOWS_VERSION; int VERSION; #define def_(name) v.def(_SC(#name), name) const PCWSTR DIR_SCRIPT = L"lib"; const PCWSTR DIR_DOCUMENT = L"doc"; WCHAR APPNAME[MAX_PATH]; WCHAR PATH_ROOT[MAX_PATH]; WCHAR PATH_SCRIPT[MAX_PATH]; static SQInteger import(HSQUIRRELVM v) throw() { PCWSTR name; if SQ_FAILED(sq_getstring(v, 2, &name)) return SQ_ERROR; return sq::import(v, name); } static void init_constants() { ::GetModuleFileName(null, PATH_ROOT, MAX_PATH); // VERSION Version ver; if (ver.open(PATH_ROOT)) { VERSION = ver.ProductVersion; wcscpy_s(APPNAME, ver.value(L"ProductName")); } // WINDOWS_VERSION OSVERSIONINFOEX info = { sizeof(OSVERSIONINFOEX) }; ::GetVersionEx((OSVERSIONINFO*)&info); DWORD release; if (info.wProductType == VER_NT_WORKSTATION) release = 0; else release = (GetSystemMetrics(SM_SERVERR2) == 0 ? 1 : 2); // {major}{minor}{NT}{SP} WINDOWS_VERSION = ((info.dwMajorVersion << 24) + (info.dwMinorVersion << 16) + (release << 8) + (info.wServicePackMajor)); // Paths ::PathRemoveFileSpec(PATH_ROOT); ::SetCurrentDirectory(PATH_ROOT); ::PathCombine(PATH_SCRIPT, PATH_ROOT, DIR_SCRIPT); } static int month2int(PCSTR name) { const PCSTR MONTHS[12] = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" }; for (int i = 0; i < lengthof(MONTHS); ++i) if (_strnicmp(name, MONTHS[i], 3) == 0) return i + 1; return 0; } static string iso_date(PCSTR date) { int year, month, day; CHAR monstr[32]; WCHAR isostr[32]; sscanf_s(date, "%32s %d %d", monstr, lengthof(monstr), &day, &year); month = month2int(monstr); swprintf_s(isostr, L"%04d-%02d-%02d", year, month, day); return str::dup(isostr); } int __stdcall wWinMain(HINSTANCE, HINSTANCE, LPWSTR args, int) { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF); init_constants(); CoInitializeEx(null, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); OleInitialize(null); static ULONG_PTR gdiplusToken = 0; GdiplusStartupInput gdiplusInput; GdiplusStartup(&gdiplusToken, &gdiplusInput, null); sq::VM v = sq::open(); sq_pushroottable(v); v.def(L"getslot" , sq::getslot); v.def(L"import" , import); sq_pushconsttable(v); def_(APPNAME); def_(DEBUG); def_(VERSION); def_(SQUIRREL_VERSION); def_(WINDOWS_VERSION); v.def(L"BUILD", iso_date(__DATE__)); v.pop(1); def_config(v); def_io(v); def_os(v); def_ui(v); sq::import(v, L"main"); BoardcastMessage(WM_DESTROY); v.close(); DllUnload(); GdiplusShutdown(gdiplusToken); OleUninitialize(); CoUninitialize(); return 0; } //#define ALWAYS_XP namespace { struct REGCLASS { CLSID clsid; HRESULT (*create)(REFINTF pp); }; #define DEF_CLASS(name) { CLSID_##name, Xp##name##Create } const REGCLASS CLASS[] = { DEF_CLASS( ExplorerBrowser ), DEF_CLASS( KnownFolderManager ), DEF_CLASS( NameSpaceTreeControl ), DEF_CLASS( FileOperation ), DEF_CLASS( FileOpenDialog ), DEF_CLASS( FileSaveDialog ), }; static HRESULT XpCreateInstance(REFCLSID clsid, REFINTF pp) { for (size_t i = 0; i < lengthof(CLASS); ++i) if (CLASS[i].clsid == clsid) return CLASS[i].create(pp); return REGDB_E_CLASSNOTREG; } } //#define ALWAYS_XP HRESULT CreateInstance(REFCLSID clsid, REFINTF pp) { HRESULT hr; #ifdef ALWAYS_XP if SUCCEEDED(XpCreateInstance(clsid, pp)) return S_OK; #endif hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC, pp.iid, pp.pp); #ifndef ALWAYS_XP if (hr == REGDB_E_CLASSNOTREG) hr = XpCreateInstance(clsid, pp); #endif return hr; }
[ "itagaki.takahiro@fad0b036-4cad-11de-8d8d-752d95cf3e3c" ]
[ [ [ 1, 197 ] ] ]
c80c9f308c8b1d937dbae0e79b931a1503849068
91ac219c4cde8c08a6b23ac3d207c1b21124b627
/common/mlc/QAMMapping.h
70bccb408931a9bcde3d1ff3e0238e9f2f12f0b4
[]
no_license
DazDSP/hamdrm-dll
e41b78d5f5efb34f44eb3f0c366d7c1368acdbac
287da5949fd927e1d3993706204fe4392c35b351
refs/heads/master
2023-04-03T16:21:12.206998
2008-01-05T19:48:59
2008-01-05T19:48:59
354,168,520
0
0
null
null
null
null
UTF-8
C++
false
false
2,128
h
/******************************************************************************\ * Technische Universitaet Darmstadt, Institut fuer Nachrichtentechnik * Copyright (c) 2001 * * Author(s): * Volker Fischer * * Description: * * ****************************************************************************** * * 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 * \******************************************************************************/ #if !defined(QAM_MAPPING_H__3B0BA660_CA63_4344_BB2B_23E7A0D31912__INCLUDED_) #define QAM_MAPPING_H__3B0BA660_CA63_4344_BB2B_23E7A0D31912__INCLUDED_ #include "../GlobalDefinitions.h" #include "../tables/TableQAMMapping.h" #include "../Vector.h" #include "../Parameter.h" /* Classes ********************************************************************/ class CQAMMapping { public: CQAMMapping() {} virtual ~CQAMMapping() {} void Map(CVector<_BINARY>& vecbiInputData1, CVector<_BINARY>& vecbiInputData2, CVector<_BINARY>& vecbiInputData3, CVector<_BINARY>& vecbiInputData4, CVector<_BINARY>& vecbiInputData5, CVector<_BINARY>& vecbiInputData6, CVector<_COMPLEX>* pcOutputData); void Init(int iNewOutputBlockSize, CParameter::ECodScheme eNewCodingScheme); protected: int iOutputBlockSize; CParameter::ECodScheme eMapType; }; #endif // !defined(QAM_MAPPING_H__3B0BA660_CA63_4344_BB2B_23E7A0D31912__INCLUDED_)
[ [ [ 1, 60 ] ] ]
d8f552d2742300142344829e04f2821a566b032e
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctestlist/src/bctestListAppUi.cpp
2b764c9cf94403ad206caa64451c1cf45d7798e5
[]
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
2,430
cpp
/* * Copyright (c) 2002 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: Avkon list test application * */ #include <avkon.hrh> #include <aknsutils.h> #include "bctestlist.hrh" #include "bctestlistAppUi.h" #include "bctestlistview.h" // ================= MEMBER FUNCTIONS ========================================= // // ---------------------------------------------------------------------------- // CBCTestListAppUi::CBCTestListAppUi() // Default constructor. // ---------------------------------------------------------------------------- // CBCTestListAppUi::CBCTestListAppUi() { } // ---------------------------------------------------------------------------- // void CBCTestListAppUi::ConstructL() // Symbian 2nd phase constructor can leave. // Creates view class object. // ---------------------------------------------------------------------------- void CBCTestListAppUi::ConstructL() { BaseConstructL(); AknsUtils::SetAvkonSkinEnabledL( ETrue ); CBCTestListView* view = CBCTestListView::NewL(); CleanupStack::PushL( view ); AddViewL( view ); CleanupStack::Pop( view ); ActivateLocalViewL( view->Id() ); } // ---------------------------------------------------------------------------- // CBCTestListAppUi::~CBCTestListAppUi() // Destructor // ---------------------------------------------------------------------------- CBCTestListAppUi::~CBCTestListAppUi() { } // ---------------------------------------------------------------------------- // void CBCTestListAppUi::HandleCommandL( TInt ) // Handles the commands. // ---------------------------------------------------------------------------- void CBCTestListAppUi::HandleCommandL( TInt aCommand ) { switch ( aCommand ) { case EAknSoftkeyBack: case EEikCmdExit: Exit(); break; default: break; } } // End of File
[ "none@none" ]
[ [ [ 1, 82 ] ] ]
a4b92d54edf714a215e34702d620d93221c62bdd
20c74d83255427dd548def97f9a42112c1b9249a
/src/roadfighter/control.cpp
107eabfb09b67ac34874c9044ee02e47fd7cf964
[]
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
1,317
cpp
#include "control.h" #include "wavesound-manager.h" #include "oggsound-manager.h" Control::Control() { } Control::Control(PlayerCar *p) { player = p; } void Control::moveLeft() { if(player->getCarState() == CAR_READY || player->getCarState() == CAR_RUNNING) player->moveLeft(); } void Control::moveRight() { if(player->getCarState() == CAR_READY || player->getCarState() == CAR_RUNNING) player->moveRight(); } void Control::accelerateA() { if(player->getCarState() == CAR_READY || player->getCarState() == CAR_RUNNING) { player->setSpeedMode(SPEED_MODE_A); player->incSpeed(); } else brake(); } void Control::accelerateB() { if(player->getCarState() == CAR_READY || player->getCarState() == CAR_RUNNING) { player->setSpeedMode(SPEED_MODE_B); player->incSpeed(); } else brake(); //player->setSpeed(player->getSpeed() + 100); } void Control::brake() { if(!player->isCompletingStage()) { if(player->getCarState() == CAR_READY || player->getCarState() == CAR_RUNNING) { player->decSpeed(1); } if(player->isCarSlowingDown()) { WSM->play(ROADFIGHER_BRAKES_SOUND, yes, yes); } else { if(WSM->isPlaying(ROADFIGHER_BRAKES_SOUND)) { WSM->stop(ROADFIGHER_BRAKES_SOUND); } } } }
[ [ [ 1, 72 ] ] ]
2a5272588f8ab00d62e79f23e8cd9d7855381a11
d425cf21f2066a0cce2d6e804bf3efbf6dd00c00
/GameInitOptionsScreen.cpp
c3c8595a3f00f9f9fb3f536ebcce45499db54209
[]
no_license
infernuslord/ja2
d5ac783931044e9b9311fc61629eb671f376d064
91f88d470e48e60ebfdb584c23cc9814f620ccee
refs/heads/master
2021-01-02T23:07:58.941216
2011-10-18T09:22:53
2011-10-18T09:22:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
88,301
cpp
#ifdef PRECOMPILEDHEADERS #include "JA2 All.h" #include "Intro.h" #else #include "Types.h" #include "GameInitOptionsScreen.h" #include "GameSettings.h" #include "Utilities.h" #include "wCheck.h" #include "Font Control.h" #include "WordWrap.h" #include "Render Dirty.h" #include "Input.h" #include "Options Screen.h" #include "English.h" #include "Sysutil.h" #include "Fade Screen.h" #include "Cursor Control.h" #include "Music Control.h" #include "cursors.h" #include "Intro.h" #include "Text.h" #include "_Ja25EnglishText.h" #include "Soldier Profile.h" #endif #include "gameloop.h" #include "connect.h" #include "saveloadscreen.h" #ifdef JA2UB #include "Legion cfg.h" #endif #include <vfs/Core/vfs.h> #include <vfs/Core/vfs_init.h> #include <vfs/Tools/vfs_property_container.h> #include <vfs/Core/vfs_os_functions.h> ////////////////////////////////////////////////////////////// // SANDRO - the start-new-game screen has been changed a lot ////////////////////////////////////////////////////////////// //////////////////////////////////////////// // // Global Defines // /////////////////////////////////////////// #define GIO_TITLE_FONT FONT14ARIAL #define GIO_TITLE_COLOR FONT_MCOLOR_WHITE #define GIO_TOGGLE_TEXT_FONT FONT10ARIAL #define GIO_TOGGLE_TEXT_COLOR FONT_MCOLOR_WHITE //buttons #define GIO_CANCEL_X iScreenWidthOffset + ((320 - 115) / 2) #define GIO_BTN_START_X iScreenWidthOffset + 320 + 105 #define GIO_BTN_START_Y iScreenHeightOffset + 435 //main title #define GIO_MAIN_TITLE_X 0 #define GIO_MAIN_TITLE_Y iScreenHeightOffset + 10 #define GIO_MAIN_TITLE_WIDTH SCREEN_WIDTH //radio box locations #define GIO_GAP_BN_SETTINGS 35 #define GIO_OFFSET_TO_TEXT 36 #define GIO_OFFSET_TO_TOGGLE_BOX 180 #define GIO_OFFSET_TO_TOGGLE_BOX_Y 9 #define GIO_TITLE_DISTANCE 30 // higher means closer #define GIO_DIF_SETTING_X iScreenWidthOffset + 48 #define GIO_DIF_SETTING_Y iScreenHeightOffset + 55 #define GIO_DIF_SETTING_WIDTH GIO_OFFSET_TO_TOGGLE_BOX - GIO_OFFSET_TO_TEXT #define GIO_IMP_SETTING_X GIO_DIF_SETTING_X #define GIO_IMP_SETTING_Y GIO_DIF_SETTING_Y + 63 #define GIO_IMP_SETTING_WIDTH GIO_DIF_SETTING_WIDTH // old/new traits #define GIO_TRAITS_SETTING_X GIO_DIF_SETTING_X + 36 #define GIO_TRAITS_SETTING_Y GIO_IMP_SETTING_Y + 52 #define GIO_TRAITS_SETTING_WIDTH GIO_DIF_SETTING_WIDTH // Madd #define GIO_GAME_SETTING_X GIO_TRAITS_SETTING_X #define GIO_GAME_SETTING_Y GIO_TRAITS_SETTING_Y + 67 #define GIO_GAME_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_IRON_MAN_SETTING_X GIO_TRAITS_SETTING_X #define GIO_IRON_MAN_SETTING_Y GIO_GAME_SETTING_Y + 67 #define GIO_IRON_MAN_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_TERRORISTS_SETTING_X GIO_TRAITS_SETTING_X #define GIO_TERRORISTS_SETTING_Y GIO_IRON_MAN_SETTING_Y + 67 #define GIO_TERRORISTS_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_BR_SETTING_X iScreenWidthOffset + 370 #define GIO_BR_SETTING_Y GIO_DIF_SETTING_Y #define GIO_BR_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_PROGRESS_SETTING_X GIO_BR_SETTING_X #define GIO_PROGRESS_SETTING_Y GIO_BR_SETTING_Y + 63 #define GIO_PROGRESS_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_INV_SETTING_X GIO_PROGRESS_SETTING_X #define GIO_INV_SETTING_Y GIO_PROGRESS_SETTING_Y + 63 #define GIO_INV_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_DROPALL_SETTING_X GIO_INV_SETTING_X + 36 #define GIO_DROPALL_SETTING_Y GIO_INV_SETTING_Y + 56 #define GIO_DROPALL_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_GUN_SETTING_X GIO_DROPALL_SETTING_X #define GIO_GUN_SETTING_Y GIO_DROPALL_SETTING_Y + 67 #define GIO_GUN_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_CACHES_SETTING_X GIO_GUN_SETTING_X #define GIO_CACHES_SETTING_Y GIO_GUN_SETTING_Y + 67 #define GIO_CACHES_SETTING_WIDTH GIO_DIF_SETTING_WIDTH #define GIO_TIMED_TURN_SETTING_X GIO_GUN_SETTING_X #define GIO_TIMED_TURN_SETTING_Y GIO_IRON_MAN_SETTING_Y #define GIO_TIMED_TURN_SETTING_WIDTH GIO_DIF_SETTING_WIDTH // INI File #define JA2SP_INI_FILENAME "ja2_sp.ini" // INI Section #define JA2SP_INI_INITIAL_SECTION "JA2 Singleplayer Initial Settings" // INI Properties #define JA2SP_DIFFICULTY_LEVEL "DIFFICULTY_LEVEL" #define JA2SP_BOBBY_RAY_SELECTION "BOBBY_RAY_SELECTION" #define JA2SP_MAX_IMP_CHARACTERS "MAX_IMP_CHARACTERS" #define JA2SP_PROGRESS_SPEED_OF_ITEM_CHOICES "PROGRESS_SPEED_OF_ITEM_CHOICES" #define JA2SP_SKILL_TRAITS "SKILL_TRAITS" #define JA2SP_INVENTORY_ATTACHMENTS "INVENTORY_ATTACHMENTS" #define JA2SP_GAME_STYLE "GAME_STYLE" #define JA2SP_ENEMIES_DROP_ALL_ITEMS "ENEMIES_DROP_ALL_ITEMS" #define JA2SP_EXTRA_DIFFICULTY "EXTRA_DIFFICULTY" #define JA2SP_AVAILABLE_ARSENAL "AVAILABLE_ARSENAL" #define JA2SP_NUMBER_OF_TERRORISTS "NUMBER_OF_TERRORISTS" #define JA2SP_SECRET_WEAPON_CACHES "SECRET_WEAPON_CACHES" //Difficulty settings enum { GIO_DIFF_EASY, GIO_DIFF_MED, GIO_DIFF_HARD, GIO_DIFF_INSANE, NUM_DIFF_SETTINGS, }; enum { GIO_TRAITS_OLD, GIO_TRAITS_NEW, NUM_TRAIT_OPTIONS, }; // Game Settings options #ifdef JA2UB enum { GIO_TEXT_OFF, GIO_TEXT_ON, NUM_TEXT_STYLES, }; #endif enum { GIO_REALISTIC, GIO_SCI_FI, NUM_GAME_STYLES, }; // Iron man mode enum { GIO_CAN_SAVE, GIO_IRON_MAN, NUM_SAVE_OPTIONS, }; #ifdef JA2UB enum { GIO_TEX_JOHN_RANDOM, GIO_TEX_AND_JOHN, NUM_RPC_UB_OPTIONS, }; #else enum { GIO_TERRORISTS_RANDOM, GIO_TERRORISTS_ALL, NUM_TERRORISTS_OPTIONS, }; #endif // BR options enum { GIO_BR_GOOD, GIO_BR_GREAT, GIO_BR_EXCELLENT, GIO_BR_AWESOME, NUM_BR_OPTIONS, }; enum { GIO_PROGRESS_VERY_SLOW, GIO_PROGRESS_SLOW, GIO_PROGRESS_NORMAL, GIO_PROGRESS_FAST, GIO_PROGRESS_VERY_FAST, NUM_PROGRESS_OPTIONS, }; // New inventory options enum { GIO_INV_OLD, GIO_INV_NEW, GIO_INV_NEW_NAS, // WANNE: Added NAS to the start new game screen NUM_INV_OPTIONS, }; enum { GIO_DROPALL_OFF, GIO_DROPALL_ON, NUM_DROPALL_OPTIONS, }; // Gun options enum { GIO_REDUCED_GUNS, GIO_GUN_NUT, NUM_GUN_OPTIONS, }; enum { GIO_CACHES_RANDOM, GIO_CACHES_ALL, NUM_CACHES_OPTIONS, }; // Timed turns setting (Multiplayer exclusive) enum { GIO_NO_TIMED_TURNS, GIO_TIMED_TURNS, GIO_NUM_TIMED_TURN_OPTIONS, }; //enum for different states of game enum { GIO_NOTHING, GIO_CANCEL, GIO_EXIT, GIO_IRON_MAN_MODE, MP_LOAD }; //////////////////////////////////////////// // // Global Variables // /////////////////////////////////////////// BOOLEAN gfGIOScreenEntry = TRUE; BOOLEAN gfGIOScreenExit = FALSE; BOOLEAN gfReRenderGIOScreen=TRUE; BOOLEAN gfGIOButtonsAllocated = FALSE; UINT8 gubGameOptionScreenHandler=GIO_NOTHING; UINT32 gubGIOExitScreen = GAME_INIT_OPTIONS_SCREEN; UINT32 guiGIOMainBackGroundImage; INT32 giGioMessageBox = -1; INT8 iCurrentDifficulty; INT8 iCurrentBRSetting; INT8 iCurrentIMPNumberSetting; INT8 iCurrentProgressSetting; INT8 iCurrentInventorySetting; UINT32 guiGIOSMALLFRAME; // Done Button void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason); UINT32 guiGIODoneButton; INT32 giGIODoneBtnImage; // Cancel Button void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason); UINT32 guiGIOCancelButton; INT32 giGIOCancelBtnImage; // MP LOAD Button void MPBtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason); UINT32 MPguiGIOCancelButton; INT32 MPgiGIOCancelBtnImage; UINT32 giGIODifficultyButton[ 2 ]; INT32 giGIODifficultyButtonImage[ 2 ]; void BtnGIODifficultySelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ); void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ); UINT32 giGIOIMPNumberButton[ 2 ]; INT32 giGIOIMPNumberButtonImage[ 2 ]; void BtnGIOIMPNumberSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ); void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ); UINT32 giGIOBRSettingButton[ 2 ]; INT32 giGIOBRSettingButtonImage[ 2 ]; void BtnGIOBRSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ); void BtnGIOBRSettingRightCallback( GUI_BUTTON *btn,INT32 reason ); UINT32 giGIOProgressSettingButton[ 2 ]; INT32 giGIOProgressSettingButtonImage[ 2 ]; void BtnGIOProgressSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ); void BtnGIOProgressSettingRightCallback( GUI_BUTTON *btn,INT32 reason ); UINT32 giGIOInventorySettingButton [ 2 ]; INT32 giGIOInventorySettingButtonImage [ 2 ]; void BtnGIOInventorySettingLeftCallback( GUI_BUTTON *btn,INT32 reason ); void BtnGIOInventorySettingRightCallback( GUI_BUTTON *btn,INT32 reason ); UINT32 guiTraitsOptionTogglesImage[ NUM_TRAIT_OPTIONS ]; UINT32 guiTraitsOptionToggles[ NUM_TRAIT_OPTIONS ]; void BtnGIOOldTraitsCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIONewTraitsCallback(GUI_BUTTON *btn,INT32 reason); void NewTraitsNotPossibleMessageBoxCallBack( UINT8 bExitValue ); //checkbox to toggle Game style #ifdef JA2UB UINT32 guiGameTextTogglesImage[ NUM_TEXT_STYLES ]; UINT32 guiGameTextToggles[ NUM_TEXT_STYLES ]; #endif UINT32 guiGameStyleTogglesImage[ NUM_GAME_STYLES ]; UINT32 guiGameStyleToggles[ NUM_GAME_STYLES ]; #ifdef JA2UB void BtnGIOOffStyleCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIOOnStyleCallback(GUI_BUTTON *btn,INT32 reason); #else void BtnGIORealisticStyleCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIOScifiStyleCallback(GUI_BUTTON *btn,INT32 reason); #endif //checkbox to toggle Save style UINT32 guiGameSaveTogglesImage[ NUM_SAVE_OPTIONS ]; UINT32 guiGameSaveToggles[ NUM_SAVE_OPTIONS ]; void BtnGIOIronManOffCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIOIronManOnCallback(GUI_BUTTON *btn,INT32 reason); #ifdef JA2UB UINT32 guiRpcOptionTogglesImage[ NUM_RPC_UB_OPTIONS ]; UINT32 guiRpcOptionToggles[ NUM_RPC_UB_OPTIONS ]; #else UINT32 guiTerroristsOptionTogglesImage[ NUM_TERRORISTS_OPTIONS ]; UINT32 guiTerroristsOptionToggles[ NUM_TERRORISTS_OPTIONS ]; #endif #ifdef JA2UB void BtnGIORpcRandomCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIORpcAllCallback(GUI_BUTTON *btn,INT32 reason); #else void BtnGIOTerroristsRandomCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIOTerroristsAllCallback(GUI_BUTTON *btn,INT32 reason); #endif UINT32 guiDropAllOptionTogglesImage[ NUM_DROPALL_OPTIONS ]; UINT32 guiDropAllOptionToggles[ NUM_DROPALL_OPTIONS ]; void BtnGIODropAllOffCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIODropAllOnCallback(GUI_BUTTON *btn,INT32 reason); //checkbox to toggle Gun options UINT32 guiGunOptionTogglesImage[ NUM_GUN_OPTIONS ]; UINT32 guiGunOptionToggles[ NUM_GUN_OPTIONS ]; void BtnGIOGunSettingReducedCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIOGunSettingToGCallback(GUI_BUTTON *btn,INT32 reason); #ifdef JA2UB //off #else UINT32 guiWeaponCachesOptionTogglesImage[ NUM_CACHES_OPTIONS ]; UINT32 guiWeaponCachesOptionToggles[ NUM_CACHES_OPTIONS ]; void BtnGIOWeaponCachesRandomCallback(GUI_BUTTON *btn,INT32 reason); void BtnGIOWeaponCachesAllCallback(GUI_BUTTON *btn,INT32 reason); #endif UINT32 guiTimedTurnToggles[ GIO_NUM_TIMED_TURN_OPTIONS ]; void BtnTimedTurnsTogglesCallback(GUI_BUTTON *btn,INT32 reason); void RenderGIOSmallSelectionFrame(INT16 sX, INT16 sY); //////////////////////////////////////////// // // Local Function Prototypes // /////////////////////////////////////////// extern void ClearMainMenu(); BOOLEAN EnterGIOScreen(); BOOLEAN ExitGIOScreen(); void HandleGIOScreen(); BOOLEAN RenderGIOScreen(); void GetGIOScreenUserInput(); UINT8 GetCurrentGunButtonSetting(); // JA2Gold: added save (iron man) button setting UINT8 GetCurrentGameSaveButtonSetting(); #ifdef JA2UB UINT8 GetCurrentTextStyleButtonSetting(); #else UINT8 GetCurrentGameStyleButtonSetting(); #endif // SANDRO - added following UINT8 GetCurrentTraitsOptionButtonSetting(); UINT8 GetCurrentDropAllButtonSetting(); #ifdef JA2UB UINT8 GetCurrentTexAndJohnButtonSetting(); #else UINT8 GetCurrentTerroristsButtonSetting(); #endif #ifdef JA2UB //off #else UINT8 GetCurrentWeaponCachesButtonSetting(); #endif void DoneFadeOutForExitGameInitOptionScreen( void ); void DoneFadeInForExitGameInitOptionScreen( void ); UINT8 GetCurrentTimedTurnsButtonSetting(); BOOLEAN DoGioMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); void DisplayMessageToUserAboutGameDifficulty(); void ConfirmGioDifSettingMessageBoxCallBack( UINT8 bExitValue ); BOOLEAN DisplayMessageToUserAboutIronManMode(); BOOLEAN DisplayMessageToUserAboutOIVandNASincompatibility(); void ConfirmGioIronManMessageBoxCallBack( UINT8 bExitValue ); BOOLEAN SpIniExists() { BOOLEAN exists = TRUE; if(!getVFS()->fileExists(JA2SP_INI_FILENAME)) exists = FALSE; return exists; } UINT32 GameInitOptionsScreenInit( void ) { memset( &gGameOptions, 0, sizeof( GAME_OPTIONS ) ); // WANNE: Read initial game settings from ja2_sp.ini vfs::PropertyContainer props; if (SpIniExists()) props.initFromIniFile(JA2SP_INI_FILENAME); // Difficulty Level (Default: Experienced = 1) gGameOptions.ubDifficultyLevel = ((UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_DIFFICULTY_LEVEL, 1)) + 1; // Bobby Ray's Selection (Default: Great = 1) UINT8 ubBobbyRay = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_BOBBY_RAY_SELECTION, 1); switch (ubBobbyRay) { // Normal case 0: gGameOptions.ubBobbyRay = BR_GOOD; break; // Great case 1: gGameOptions.ubBobbyRay = BR_GREAT; break; // Excellent case 2: gGameOptions.ubBobbyRay = BR_EXCELLENT; break; // Awesome case 3: gGameOptions.ubBobbyRay = BR_AWESOME; break; } // Max. IMP Characters UINT8 maxIMPCharacterCount = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_MAX_IMP_CHARACTERS, 1); gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, maxIMPCharacterCount) )); // Progress Speed of Item Choices (Default: Normal) gGameOptions.ubProgressSpeedOfItemsChoices = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_PROGRESS_SPEED_OF_ITEM_CHOICES, ITEM_PROGRESS_NORMAL); // Skill Traits UINT8 ubTraitSystem = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_SKILL_TRAITS, 1); if (!gGameExternalOptions.fReadProfileDataFromXML) ubTraitSystem = 0; gGameOptions.fNewTraitSystem = ubTraitSystem; // Inventory Attachments (Default: New/New = 2) UINT8 ubInventoryAttachmentSystem = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_INVENTORY_ATTACHMENTS, 2); // NIV is not allowed if (!IsNIVModeValid(true)) ubInventoryAttachmentSystem = 0; switch (ubInventoryAttachmentSystem) { // Old / Old case 0: gGameOptions.ubInventorySystem = INVENTORY_OLD; gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; break; // New / Old case 1: gGameOptions.ubInventorySystem = INVENTORY_NEW; gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; break; // New / New case 2: gGameOptions.ubInventorySystem = INVENTORY_NEW; gGameOptions.ubAttachmentSystem = ATTACHMENT_NEW; break; } // Game Style (Default: Realistic = 0) gGameOptions.ubGameStyle = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_GAME_STYLE, STYLE_REALISTIC); // Enemies Drop All Items (Default: Off = 0) gGameOptions.fEnemiesDropAllItems = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_ENEMIES_DROP_ALL_ITEMS, 0); // Extra Difficulty (Default: Save Anytime = 0) gGameOptions.fIronManMode = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_EXTRA_DIFFICULTY, 0); // Available Arsenal (Default: Tons of Guns = 1) gGameOptions.fGunNut = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_AVAILABLE_ARSENAL, 1); #ifdef JA2UB // tex and john gGameLegionOptions.TEX_AND_JOHN = (BOOLEAN)props.getIntProperty( L"Ja2_sp Settings", L"RPC_TEX_AND_JOHN", 0); gGameLegionOptions.Random_Manuel_Text = (BOOLEAN)props.getIntProperty( L"Ja2_sp Settings", L"RANDOM_MANUEL_TEXT", 0); #else // Number of Terrorists (Default: Random = 0) gGameOptions.fEnableAllTerrorists = (BOOLEAN)props.getIntProperty( L"Ja2_sp Settings", L"NUMBER_OF_TERRORISTS", 0); #endif // Secret Weapon Caches (Default: Random = 0) gGameOptions.fEnableAllWeaponCaches = (BOOLEAN)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_SECRET_WEAPON_CACHES, 0); gGameOptions.fAirStrikes = FALSE; gGameOptions.fTurnTimeLimit = FALSE; return (1); } UINT32 GameInitOptionsScreenHandle( void ) { StartFrameBufferRender(); if( gfGIOScreenEntry ) { GameInitOptionsScreenInit(); EnterGIOScreen(); gfGIOScreenEntry = FALSE; gfGIOScreenExit = FALSE; InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); } GetGIOScreenUserInput(); HandleGIOScreen(); // render buttons marked dirty MarkButtonsDirty( ); RenderButtons( ); ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); if ( HandleFadeOutCallback( ) ) { ClearMainMenu(); return( gubGIOExitScreen ); } if ( HandleBeginFadeOut( gubGIOExitScreen ) ) { return( gubGIOExitScreen ); } if( gfGIOScreenExit ) { ExitGIOScreen(); } if ( HandleFadeInCallback( ) ) { // Re-render the scene! RenderGIOScreen(); } if ( HandleBeginFadeIn( gubGIOExitScreen ) ) { } return( gubGIOExitScreen ); } UINT32 GameInitOptionsScreenShutdown( void ) { return( 1 ); } BOOLEAN EnterGIOScreen() { VOBJECT_DESC VObjectDesc, VObjectDesc2; if( gfGIOButtonsAllocated ) return( TRUE ); SetCurrentCursorFromDatabase( CURSOR_NORMAL ); // load the Main trade screen backgroiund image VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; if (iResolution == 0) { FilenameForBPP("INTERFACE\\OptionsScreenBackGround.sti", VObjectDesc.ImageFile); } else if (iResolution == 1) { FilenameForBPP("INTERFACE\\OptionsScreenBackGround_800x600.sti", VObjectDesc.ImageFile); } else if (iResolution == 2) { FilenameForBPP("INTERFACE\\OptionsScreenBackGround_1024x768.sti", VObjectDesc.ImageFile); } CHECKF(AddVideoObject(&VObjectDesc, &guiGIOMainBackGroundImage )); VObjectDesc2.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("INTERFACE\\GIOSmallFrame.sti", VObjectDesc2.ImageFile); CHECKF(AddVideoObject(&VObjectDesc2, &guiGIOSMALLFRAME)); //Ok button giGIODoneBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 ); guiGIODoneButton = CreateIconAndTextButton( giGIODoneBtnImage, gzGIOScreenText[GIO_START_TEXT], OPT_BUTTON_FONT, OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, TEXT_CJUSTIFIED, GIO_BTN_START_X, GIO_BTN_START_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIODoneCallback); SpecifyButtonSoundScheme( guiGIODoneButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyDisabledButtonStyle( guiGIODoneButton, DISABLED_STYLE_NONE ); //Cancel button giGIOCancelBtnImage = UseLoadedButtonImage( giGIODoneBtnImage, -1,1,-1,3,-1 ); guiGIOCancelButton = CreateIconAndTextButton( giGIOCancelBtnImage, gzGIOScreenText[GIO_CANCEL_TEXT], OPT_BUTTON_FONT, OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, TEXT_CJUSTIFIED, GIO_CANCEL_X, GIO_BTN_START_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOCancelCallback ); SpecifyButtonSoundScheme( guiGIOCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); /////////////////////////////////////////////////////////////////////////////////////////////////////// // DIFFICULTY SETTING giGIODifficultyButtonImage[ 0 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,0,-1,1,-1 ); giGIODifficultyButtonImage[ 1 ]= LoadButtonImage( "INTERFACE\\GIO_SELECTION_ARROWS.STI" ,-1,2,-1,3,-1 ); // left button - decrement difficulty level giGIODifficultyButton[ 0 ] = QuickCreateButton( giGIODifficultyButtonImage[ 0 ], GIO_DIF_SETTING_X + 39, GIO_DIF_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIODifficultySelectionLeftCallback ); // right button - increment difficulty level giGIODifficultyButton[ 1 ] = QuickCreateButton( giGIODifficultyButtonImage[ 1 ], GIO_DIF_SETTING_X + 158, GIO_DIF_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIODifficultySelectionRightCallback ); // set user data MSYS_SetBtnUserData(giGIODifficultyButton[0],0, 0 ); MSYS_SetBtnUserData(giGIODifficultyButton[1],0, 1 ); iCurrentDifficulty = max( 0, gGameOptions.ubDifficultyLevel - 1); /////////////////////////////////////////////////////////////////////////////////////////////////////// // MAX IMP NUMBER SETTING giGIOIMPNumberButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ],-1,0,-1,1,-1 ); giGIOIMPNumberButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ],-1,2,-1,3,-1 ); // left button - decrement difficulty level giGIOIMPNumberButton[ 0 ] = QuickCreateButton( giGIOIMPNumberButtonImage[ 0 ], GIO_IMP_SETTING_X + 39, GIO_IMP_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOIMPNumberSelectionLeftCallback ); // right button - increment difficulty level giGIOIMPNumberButton[ 1 ] = QuickCreateButton( giGIOIMPNumberButtonImage[ 1 ], GIO_IMP_SETTING_X + 158, GIO_IMP_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOIMPNumberSelectionRightCallback ); // set user data MSYS_SetBtnUserData(giGIOIMPNumberButton[0],0, 0 ); MSYS_SetBtnUserData(giGIOIMPNumberButton[1],0, 1 ); iCurrentIMPNumberSetting = gGameOptions.ubMaxIMPCharacters; /////////////////////////////////////////////////////////////////////////////////////////////////////// // OLD/NEW TARITS SETTING guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ] = LoadButtonImage( "INTERFACE\\GIOCheckButton.sti" ,-1,0,-1,2,-1 ); guiTraitsOptionToggles[ GIO_TRAITS_OLD ] = CreateIconAndTextButton( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], gzGIOScreenText[ GIO_TRAITS_OLD_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_TRAITS_SETTING_X + 74), (GIO_TRAITS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOOldTraitsCallback); guiTraitsOptionTogglesImage[ GIO_TRAITS_NEW ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiTraitsOptionToggles[ GIO_TRAITS_NEW ] = CreateIconAndTextButton( guiTraitsOptionTogglesImage[ GIO_TRAITS_NEW ], gzGIOScreenText[ GIO_TRAITS_NEW_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_TRAITS_SETTING_X), (GIO_TRAITS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIONewTraitsCallback ); SpecifyButtonSoundScheme( guiTraitsOptionToggles[ GIO_TRAITS_OLD ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiTraitsOptionToggles[ GIO_TRAITS_NEW ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiTraitsOptionToggles[ GIO_TRAITS_OLD ],0, 0 ); MSYS_SetBtnUserData(guiTraitsOptionToggles[ GIO_TRAITS_NEW ],0, 1 ); if( gGameOptions.fNewTraitSystem ) ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_NEW ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_OLD ] ]->uiFlags |= BUTTON_CLICKED_ON; /////////////////////////////////////////////////////////////////////////////////////////////////////// // GAME SETTING ( realistic, sci fi ) #ifdef JA2UB guiGameTextTogglesImage[ GIO_TEXT_OFF ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGameTextToggles[ GIO_TEXT_OFF ] = CreateIconAndTextButton( guiGameTextTogglesImage[ GIO_TEXT_OFF ], gzGIOScreenText[ GIO_REALISTIC_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_GAME_SETTING_X + 74), (GIO_GAME_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOOffStyleCallback); guiGameTextTogglesImage[ GIO_TEXT_ON ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGameTextToggles[ GIO_TEXT_ON ] = CreateIconAndTextButton( guiGameTextTogglesImage[ GIO_TEXT_ON ], gzGIOScreenText[ GIO_SCI_FI_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOOnStyleCallback ); SpecifyButtonSoundScheme( guiGameTextToggles[ GIO_TEXT_OFF ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiGameTextToggles[ GIO_TEXT_ON ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiGameTextToggles[ GIO_TEXT_OFF ],0, 0 ); MSYS_SetBtnUserData(guiGameTextToggles[ GIO_TEXT_ON ],0, 1 ); if( gGameLegionOptions.Random_Manuel_Text ) ButtonList[ guiGameTextToggles[ GIO_TEXT_ON ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiGameTextToggles[ GIO_TEXT_OFF ] ]->uiFlags |= BUTTON_CLICKED_ON; #else guiGameStyleTogglesImage[ GIO_REALISTIC ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGameStyleToggles[ GIO_REALISTIC ] = CreateIconAndTextButton( guiGameStyleTogglesImage[ GIO_REALISTIC ], gzGIOScreenText[ GIO_REALISTIC_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_GAME_SETTING_X + 74), (GIO_GAME_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIORealisticStyleCallback); guiGameStyleTogglesImage[ GIO_SCI_FI ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGameStyleToggles[ GIO_SCI_FI ] = CreateIconAndTextButton( guiGameStyleTogglesImage[ GIO_SCI_FI ], gzGIOScreenText[ GIO_SCI_FI_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOScifiStyleCallback ); SpecifyButtonSoundScheme( guiGameStyleToggles[ GIO_REALISTIC ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiGameStyleToggles[ GIO_SCI_FI ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiGameStyleToggles[ GIO_REALISTIC ],0, 0 ); MSYS_SetBtnUserData(guiGameStyleToggles[ GIO_SCI_FI ],0, 1 ); if( gGameOptions.ubGameStyle == STYLE_SCIFI ) ButtonList[ guiGameStyleToggles[ GIO_SCI_FI ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiGameStyleToggles[ GIO_REALISTIC ] ]->uiFlags |= BUTTON_CLICKED_ON; #endif /////////////////////////////////////////////////////////////////////////////////////////////////////// // IRON MAN SETTING guiGameSaveTogglesImage[ GIO_CAN_SAVE ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGameSaveToggles[ GIO_CAN_SAVE ] = CreateIconAndTextButton( guiGameSaveTogglesImage[ GIO_CAN_SAVE ], gzGIOScreenText[ GIO_SAVE_ANYWHERE_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_IRON_MAN_SETTING_X), (GIO_IRON_MAN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOIronManOffCallback); guiGameSaveTogglesImage[ GIO_IRON_MAN ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGameSaveToggles[ GIO_IRON_MAN ] = CreateIconAndTextButton( guiGameSaveTogglesImage[ GIO_IRON_MAN ], gzGIOScreenText[ GIO_IRON_MAN_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_IRON_MAN_SETTING_X + 74), (GIO_IRON_MAN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOIronManOnCallback ); SpecifyButtonSoundScheme( guiGameSaveToggles[ GIO_CAN_SAVE ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiGameSaveToggles[ GIO_IRON_MAN ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiGameSaveToggles[ GIO_CAN_SAVE ],0, 0 ); MSYS_SetBtnUserData(guiGameSaveToggles[ GIO_IRON_MAN ],0, 1 ); if( gGameOptions.fIronManMode ) ButtonList[ guiGameSaveToggles[ GIO_IRON_MAN ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags |= BUTTON_CLICKED_ON; /////////////////////////////////////////////////////////////////////////////////////////////////////// // NUMBER OF TERRORISTS SETTING #ifdef JA2UB guiRpcOptionTogglesImage[ GIO_TEX_JOHN_RANDOM ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ] = CreateIconAndTextButton( guiRpcOptionTogglesImage[ GIO_TEX_JOHN_RANDOM ], gzGIOScreenText[ GIO_TERRORISTS_RANDOM_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIORpcRandomCallback); guiRpcOptionTogglesImage[ GIO_TEX_AND_JOHN ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiRpcOptionToggles[ GIO_TEX_AND_JOHN ] = CreateIconAndTextButton( guiRpcOptionTogglesImage[ GIO_TEX_AND_JOHN ], gzGIOScreenText[ GIO_TERRORISTS_ALL_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_TERRORISTS_SETTING_X + 74), (GIO_TERRORISTS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIORpcAllCallback ); #else guiTerroristsOptionTogglesImage[ GIO_TERRORISTS_RANDOM ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiTerroristsOptionToggles[ GIO_TERRORISTS_RANDOM ] = CreateIconAndTextButton( guiTerroristsOptionTogglesImage[ GIO_TERRORISTS_RANDOM ], gzGIOScreenText[ GIO_TERRORISTS_RANDOM_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOTerroristsRandomCallback); guiTerroristsOptionTogglesImage[ GIO_TERRORISTS_ALL ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiTerroristsOptionToggles[ GIO_TERRORISTS_ALL ] = CreateIconAndTextButton( guiTerroristsOptionTogglesImage[ GIO_TERRORISTS_ALL ], gzGIOScreenText[ GIO_TERRORISTS_ALL_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_TERRORISTS_SETTING_X + 74), (GIO_TERRORISTS_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOTerroristsAllCallback ); #endif #ifdef JA2UB SpecifyButtonSoundScheme( guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiRpcOptionToggles[ GIO_TEX_AND_JOHN ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ],0, 0 ); MSYS_SetBtnUserData(guiRpcOptionToggles[ GIO_TEX_AND_JOHN ],0, 1 ); if( gGameLegionOptions.TEX_AND_JOHN ) ButtonList[ guiRpcOptionToggles[ GIO_TEX_AND_JOHN ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ] ]->uiFlags |= BUTTON_CLICKED_ON; #else SpecifyButtonSoundScheme( guiTerroristsOptionToggles[ GIO_TERRORISTS_RANDOM ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiTerroristsOptionToggles[ GIO_TERRORISTS_ALL ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiTerroristsOptionToggles[ GIO_TERRORISTS_RANDOM ],0, 0 ); MSYS_SetBtnUserData(guiTerroristsOptionToggles[ GIO_TERRORISTS_ALL ],0, 1 ); if( gGameOptions.fEnableAllTerrorists ) ButtonList[ guiTerroristsOptionToggles[ GIO_TERRORISTS_ALL ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiTerroristsOptionToggles[ GIO_TERRORISTS_RANDOM ] ]->uiFlags |= BUTTON_CLICKED_ON; #endif /////////////////////////////////////////////////////////////////////////////////////////////////////// // BOBBY RAY SETTING giGIOBRSettingButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ], -1,0,-1,1,-1 ); giGIOBRSettingButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ], -1,2,-1,3,-1 ); // left button - decrement BR level giGIOBRSettingButton[ 0 ] = QuickCreateButton( giGIOBRSettingButtonImage[ 0 ], GIO_BR_SETTING_X + 39, GIO_BR_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOBRSettingLeftCallback ); // right button - increment BR level giGIOBRSettingButton[ 1 ] = QuickCreateButton( giGIOBRSettingButtonImage[ 1 ], GIO_BR_SETTING_X + 158, GIO_BR_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOBRSettingRightCallback ); // set user data MSYS_SetBtnUserData(giGIOBRSettingButton[0],0, 0 ); MSYS_SetBtnUserData(giGIOBRSettingButton[1],0, 1 ); // set initial value switch ( gGameOptions.ubBobbyRay ) { case BR_GOOD: iCurrentBRSetting = GIO_BR_GOOD; break; case BR_GREAT: iCurrentBRSetting = GIO_BR_GREAT; break; case BR_EXCELLENT: iCurrentBRSetting = GIO_BR_EXCELLENT; break; case BR_AWESOME: iCurrentBRSetting = GIO_BR_AWESOME; break; default: iCurrentBRSetting = GIO_BR_GOOD; // optimistically assume, we have selected the normal one break; } /////////////////////////////////////////////////////////////////////////////////////////////////////// // ITEM PROGRESS SETTING giGIOProgressSettingButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ], -1,0,-1,1,-1 ); giGIOProgressSettingButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ], -1,2,-1,3,-1 ); // left button - decrement BR level giGIOProgressSettingButton[ 0 ] = QuickCreateButton( giGIOProgressSettingButtonImage[ 0 ], GIO_PROGRESS_SETTING_X + 39, GIO_PROGRESS_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOProgressSettingLeftCallback ); // right button - increment BR level giGIOProgressSettingButton[ 1 ] = QuickCreateButton( giGIOProgressSettingButtonImage[ 1 ], GIO_PROGRESS_SETTING_X + 158, GIO_PROGRESS_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOProgressSettingRightCallback ); // set user data MSYS_SetBtnUserData(giGIOProgressSettingButton[0],0, 0 ); MSYS_SetBtnUserData(giGIOProgressSettingButton[1],0, 1 ); // set initial value iCurrentProgressSetting = gGameOptions.ubProgressSpeedOfItemsChoices; /////////////////////////////////////////////////////////////////////////////////////////////////////// // OLD/NEW INVENTORY SETTING if (IsNIVModeValid(true) == TRUE ) { giGIOInventorySettingButtonImage[ 0 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 0 ],-1,0,-1,1,-1 ); giGIOInventorySettingButtonImage[ 1 ]= UseLoadedButtonImage( giGIODifficultyButtonImage[ 1 ],-1,2,-1,3,-1 ); // left button - decrement difficulty level giGIOInventorySettingButton[ 0 ] = QuickCreateButton( giGIOInventorySettingButtonImage[ 0 ], GIO_INV_SETTING_X + 39, GIO_INV_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOInventorySettingLeftCallback ); // right button - increment difficulty level giGIOInventorySettingButton[ 1 ] = QuickCreateButton( giGIOInventorySettingButtonImage[ 1 ], GIO_INV_SETTING_X + 158, GIO_INV_SETTING_Y , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnGIOInventorySettingRightCallback ); // set user data MSYS_SetBtnUserData(giGIOInventorySettingButton[0],0, 0 ); MSYS_SetBtnUserData(giGIOInventorySettingButton[1],0, 1 ); if (UsingNewInventorySystem()==true && UsingNewAttachmentSystem()==true) { iCurrentInventorySetting = GIO_INV_NEW_NAS; } else { // set initial value switch ( gGameOptions.ubInventorySystem ) { case INVENTORY_OLD: iCurrentInventorySetting = GIO_INV_OLD; break; case INVENTORY_NEW: iCurrentInventorySetting = GIO_INV_NEW; break; } } } /////////////////////////////////////////////////////////////////////////////////////////////////////// // DROP ALL ON/OFF SETTING guiDropAllOptionTogglesImage[ GIO_DROPALL_OFF ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiDropAllOptionToggles[ GIO_DROPALL_OFF ] = CreateIconAndTextButton( guiDropAllOptionTogglesImage[ GIO_DROPALL_OFF ], gzGIOScreenText[ GIO_DROPALL_OFF_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_DROPALL_SETTING_X), (GIO_DROPALL_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIODropAllOffCallback); guiDropAllOptionTogglesImage[ GIO_DROPALL_ON ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiDropAllOptionToggles[ GIO_DROPALL_ON ] = CreateIconAndTextButton( guiDropAllOptionTogglesImage[ GIO_DROPALL_ON ], gzGIOScreenText[ GIO_DROPALL_ON_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_DROPALL_SETTING_X + 74), (GIO_DROPALL_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIODropAllOnCallback ); SpecifyButtonSoundScheme( guiDropAllOptionToggles[ GIO_DROPALL_OFF ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiDropAllOptionToggles[ GIO_DROPALL_ON ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiDropAllOptionToggles[ GIO_DROPALL_OFF ],0, 0 ); MSYS_SetBtnUserData(guiDropAllOptionToggles[ GIO_DROPALL_ON ],0, 1 ); if( gGameOptions.fEnemiesDropAllItems ) ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_ON ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_OFF ] ]->uiFlags |= BUTTON_CLICKED_ON; /////////////////////////////////////////////////////////////////////////////////////////////////////// // GUN SETTING guiGunOptionTogglesImage[ GIO_REDUCED_GUNS ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGunOptionToggles[ GIO_REDUCED_GUNS ] = CreateIconAndTextButton( guiGunOptionTogglesImage[ GIO_REDUCED_GUNS ], gzGIOScreenText[ GIO_REDUCED_GUNS_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_GUN_SETTING_X + 74), (GIO_GUN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOGunSettingReducedCallback); guiGunOptionTogglesImage[ GIO_GUN_NUT ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiGunOptionToggles[ GIO_GUN_NUT ] = CreateIconAndTextButton( guiGunOptionTogglesImage[ GIO_GUN_NUT ], gzGIOScreenText[ GIO_GUN_NUT_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_GUN_SETTING_X), (GIO_GUN_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOGunSettingToGCallback ); SpecifyButtonSoundScheme( guiGunOptionToggles[ GIO_REDUCED_GUNS ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiGunOptionToggles[ GIO_GUN_NUT ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiGunOptionToggles[ GIO_REDUCED_GUNS ],0, 0 ); MSYS_SetBtnUserData(guiGunOptionToggles[ GIO_GUN_NUT ],0, 1 ); if( gGameOptions.fGunNut ) ButtonList[ guiGunOptionToggles[ GIO_GUN_NUT ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiGunOptionToggles[ GIO_REDUCED_GUNS ] ]->uiFlags |= BUTTON_CLICKED_ON; /////////////////////////////////////////////////////////////////////////////////////////////////////// // WEAPON CACHES SETTING #ifdef JA2UB //off #else guiWeaponCachesOptionTogglesImage[ GIO_CACHES_RANDOM ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiWeaponCachesOptionToggles[ GIO_CACHES_RANDOM ] = CreateIconAndTextButton( guiWeaponCachesOptionTogglesImage[ GIO_CACHES_RANDOM ], gzGIOScreenText[ GIO_CACHES_RANDOM_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_CACHES_SETTING_X), (GIO_CACHES_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOWeaponCachesRandomCallback); guiWeaponCachesOptionTogglesImage[ GIO_CACHES_ALL ] = UseLoadedButtonImage( guiTraitsOptionTogglesImage[ GIO_TRAITS_OLD ], -1,1,-1,3,-1 ); guiWeaponCachesOptionToggles[ GIO_CACHES_ALL ] = CreateIconAndTextButton( guiWeaponCachesOptionTogglesImage[ GIO_CACHES_ALL ], gzGIOScreenText[ GIO_CACHES_ALL_TEXT ], GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, GIO_TOGGLE_TEXT_COLOR, NO_SHADOW, TEXT_CJUSTIFIED, (GIO_CACHES_SETTING_X + 74), (GIO_CACHES_SETTING_Y + 10), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, BtnGIOWeaponCachesAllCallback ); SpecifyButtonSoundScheme( guiWeaponCachesOptionToggles[ GIO_CACHES_RANDOM ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); SpecifyButtonSoundScheme( guiWeaponCachesOptionToggles[ GIO_CACHES_ALL ], BUTTON_SOUND_SCHEME_BIGSWITCH3 ); MSYS_SetBtnUserData(guiWeaponCachesOptionToggles[ GIO_CACHES_RANDOM ],0, 0 ); MSYS_SetBtnUserData(guiWeaponCachesOptionToggles[ GIO_CACHES_ALL ],0, 1 ); if( gGameOptions.fEnableAllWeaponCaches ) ButtonList[ guiWeaponCachesOptionToggles[ GIO_CACHES_ALL ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiWeaponCachesOptionToggles[ GIO_CACHES_RANDOM ] ]->uiFlags |= BUTTON_CLICKED_ON; #endif //Reset the exit screen gubGIOExitScreen = GAME_INIT_OPTIONS_SCREEN; //REnder the screen once so we can blt ot to ths save buffer RenderGIOScreen(); BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); gfGIOButtonsAllocated = TRUE; return( TRUE ); } void BtnGIODifficultySelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentDifficulty > 0 ) { PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentDifficulty--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentDifficulty > 0 ) { PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentDifficulty--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIODifficultyButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { #ifdef JA2UB if ( iCurrentDifficulty < 2 ) #else if ( iCurrentDifficulty < 3 ) #endif { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentDifficulty++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); #ifdef JA2UB if ( iCurrentDifficulty < 2 ) #else if ( iCurrentDifficulty < 3 ) #endif { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentDifficulty++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOBRSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentBRSetting > 0 ) { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentBRSetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentBRSetting > 0 ) { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentBRSetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOBRSettingRightCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentBRSetting < 3 ) { PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentBRSetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentBRSetting < 3 ) { PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentBRSetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOBRSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOIMPNumberSelectionLeftCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentIMPNumberSetting > 1 ) { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentIMPNumberSetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentIMPNumberSetting > 1 ) { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentIMPNumberSetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOBRSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentIMPNumberSetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentIMPNumberSetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOInventorySettingLeftCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentInventorySetting > GIO_INV_OLD ) { PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentInventorySetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentInventorySetting > GIO_INV_OLD ) { PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentInventorySetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOInventorySettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOInventorySettingRightCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentInventorySetting < GIO_INV_NEW_NAS ) { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentInventorySetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOInventorySettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentInventorySetting < GIO_INV_NEW_NAS ) { PlayButtonSound( giGIOInventorySettingButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentInventorySetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOInventorySettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOProgressSettingLeftCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentProgressSetting > 0 ) { PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentProgressSetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentProgressSetting > 0 ) { PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_CLICKED_ON ); iCurrentProgressSetting--; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOProgressSettingButton[0], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOProgressSettingRightCallback( GUI_BUTTON *btn,INT32 reason ) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentProgressSetting < GIO_PROGRESS_VERY_FAST ) { PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentProgressSetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentProgressSetting < GIO_PROGRESS_VERY_FAST ) { PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_CLICKED_ON ); iCurrentProgressSetting++; gfReRenderGIOScreen =TRUE; } else { PlayButtonSound( giGIOProgressSettingButton[1], BUTTON_SOUND_DISABLED_CLICK ); } } else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if (btn->uiFlags & BUTTON_CLICKED_ON) { btn->uiFlags&=~(BUTTON_CLICKED_ON); } } } void BtnGIOOldTraitsCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_TRAITS_SETTING_X), (GIO_TRAITS_SETTING_Y + 10), 230, 40 ); ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_NEW ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiTraitsOptionToggles[ GIO_TRAITS_OLD ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIONewTraitsCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { if (!gGameExternalOptions.fReadProfileDataFromXML) { PlayButtonSound( guiTraitsOptionToggles[ GIO_TRAITS_NEW ], BUTTON_SOUND_DISABLED_CLICK ); DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioNewTraitsImpossibleText[0], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_OK, NewTraitsNotPossibleMessageBoxCallBack ); } else { RestoreExternBackgroundRect( (GIO_TRAITS_SETTING_X), (GIO_TRAITS_SETTING_Y + 10), 230, 40 ); ButtonList[ guiTraitsOptionToggles[ GIO_TRAITS_OLD ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiTraitsOptionToggles[ GIO_TRAITS_NEW ], BUTTON_SOUND_CLICKED_ON ); } } } void NewTraitsNotPossibleMessageBoxCallBack( UINT8 bExitValue ) { /*if( bExitValue == MSG_BOX_RETURN_YES ) { gubGameOptionScreenHandler = GIO_NOTHING; }*/ } #ifdef JA2UB void BtnGIOOffStyleCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGameTextToggles[ GIO_TEXT_ON ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGameTextToggles[ GIO_TEXT_OFF ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIOOnStyleCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGameTextToggles[ GIO_TEXT_OFF ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGameTextToggles[ GIO_TEXT_ON ], BUTTON_SOUND_CLICKED_ON ); } } #else void BtnGIORealisticStyleCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGameStyleToggles[ GIO_SCI_FI ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGameStyleToggles[ GIO_REALISTIC ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIOScifiStyleCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_GAME_SETTING_X), (GIO_GAME_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGameStyleToggles[ GIO_REALISTIC ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGameStyleToggles[ GIO_SCI_FI ], BUTTON_SOUND_CLICKED_ON ); } } #endif void BtnGIOIronManOffCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_IRON_MAN_SETTING_X), (GIO_IRON_MAN_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGameSaveToggles[ GIO_IRON_MAN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGameStyleToggles[ GIO_CAN_SAVE ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIOIronManOnCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_IRON_MAN_SETTING_X), (GIO_IRON_MAN_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGameStyleToggles[ GIO_IRON_MAN ], BUTTON_SOUND_CLICKED_ON ); } } #ifdef JA2UB void BtnGIORpcRandomCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), 230, 40 ); ButtonList[ guiRpcOptionToggles[ GIO_TEX_AND_JOHN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIORpcAllCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), 230, 40 ); ButtonList[ guiRpcOptionToggles[ GIO_TEX_JOHN_RANDOM ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiRpcOptionToggles[ GIO_TEX_AND_JOHN ], BUTTON_SOUND_CLICKED_ON ); } } #else void BtnGIOTerroristsRandomCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), 230, 40 ); ButtonList[ guiTerroristsOptionToggles[ GIO_TERRORISTS_ALL ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiTerroristsOptionToggles[ GIO_TERRORISTS_RANDOM ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIOTerroristsAllCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_TERRORISTS_SETTING_X), (GIO_TERRORISTS_SETTING_Y + 10), 230, 40 ); ButtonList[ guiTerroristsOptionToggles[ GIO_TERRORISTS_RANDOM ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiTerroristsOptionToggles[ GIO_TERRORISTS_ALL ], BUTTON_SOUND_CLICKED_ON ); } } #endif void BtnGIODropAllOffCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_DROPALL_SETTING_X), (GIO_DROPALL_SETTING_Y + 10), 230, 40 ); ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_ON ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiDropAllOptionToggles[ GIO_DROPALL_OFF ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIODropAllOnCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_DROPALL_SETTING_X), (GIO_DROPALL_SETTING_Y + 10), 230, 40 ); ButtonList[ guiDropAllOptionToggles[ GIO_DROPALL_OFF ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiDropAllOptionToggles[ GIO_DROPALL_ON ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIOGunSettingReducedCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_GUN_SETTING_X), (GIO_GUN_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGunOptionToggles[ GIO_GUN_NUT ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGunOptionToggles[ GIO_REDUCED_GUNS ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIOGunSettingToGCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_GUN_SETTING_X), (GIO_GUN_SETTING_Y + 10), 230, 40 ); ButtonList[ guiGunOptionToggles[ GIO_REDUCED_GUNS ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiGunOptionToggles[ GIO_GUN_NUT ], BUTTON_SOUND_CLICKED_ON ); } } #ifdef JA2UB //off #else void BtnGIOWeaponCachesRandomCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_CACHES_SETTING_X), (GIO_CACHES_SETTING_Y + 10), 230, 40 ); ButtonList[ guiWeaponCachesOptionToggles[ GIO_CACHES_ALL ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiWeaponCachesOptionToggles[ GIO_CACHES_RANDOM ], BUTTON_SOUND_CLICKED_ON ); } } void BtnGIOWeaponCachesAllCallback(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) return; if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { RestoreExternBackgroundRect( (GIO_CACHES_SETTING_X), (GIO_CACHES_SETTING_Y + 10), 230, 40 ); ButtonList[ guiWeaponCachesOptionToggles[ GIO_CACHES_RANDOM ] ]->uiFlags &= ~BUTTON_CLICKED_ON; btn->uiFlags|=(BUTTON_CLICKED_ON); PlayButtonSound( guiWeaponCachesOptionToggles[ GIO_CACHES_ALL ], BUTTON_SOUND_CLICKED_ON ); } } #endif BOOLEAN ExitGIOScreen() { UINT16 cnt; if( !gfGIOButtonsAllocated ) return( TRUE ); //Delete the main options screen background DeleteVideoObjectFromIndex( guiGIOMainBackGroundImage ); DeleteVideoObjectFromIndex( guiGIOSMALLFRAME ); // Destroy Basic buttons RemoveButton( guiGIOCancelButton ); RemoveButton( guiGIODoneButton ); UnloadButtonImage( giGIOCancelBtnImage ); UnloadButtonImage( giGIODoneBtnImage ); // Destroy Difficulty setting buttons RemoveButton( giGIODifficultyButton[0] ); RemoveButton( giGIODifficultyButton[1] ); UnloadButtonImage( giGIODifficultyButtonImage[0] ); UnloadButtonImage( giGIODifficultyButtonImage[1] ); // Destroy IMP Number setting buttons RemoveButton( giGIOIMPNumberButton[0] ); RemoveButton( giGIOIMPNumberButton[1] ); UnloadButtonImage( giGIOIMPNumberButtonImage[0] ); UnloadButtonImage( giGIOIMPNumberButtonImage[1] ); // Destroy BR setting buttons RemoveButton( giGIOBRSettingButton[0] ); RemoveButton( giGIOBRSettingButton[1] ); UnloadButtonImage( giGIOBRSettingButtonImage[0] ); UnloadButtonImage( giGIOBRSettingButtonImage[1] ); // Destroy Progress setting buttons RemoveButton( giGIOProgressSettingButton[0] ); RemoveButton( giGIOProgressSettingButton[1] ); UnloadButtonImage( giGIOProgressSettingButtonImage[0] ); UnloadButtonImage( giGIOProgressSettingButtonImage[1] ); // Destroy Traits setting buttons for( cnt=0; cnt<NUM_TRAIT_OPTIONS; cnt++) { RemoveButton( guiTraitsOptionToggles[ cnt ] ); UnloadButtonImage( guiTraitsOptionTogglesImage[ cnt ] ); } // Destroy Game setting buttons #ifdef JA2UB for( cnt=0; cnt<NUM_TEXT_STYLES; cnt++) { RemoveButton( guiGameTextToggles[ cnt ] ); UnloadButtonImage( guiGameTextTogglesImage[ cnt ] ); } #else for( cnt=0; cnt<NUM_GAME_STYLES; cnt++) { RemoveButton( guiGameStyleToggles[ cnt ] ); UnloadButtonImage( guiGameStyleTogglesImage[ cnt ] ); } #endif // Destroy Iron Man setting buttons for( cnt=0; cnt<NUM_SAVE_OPTIONS; cnt++) { RemoveButton( guiGameSaveToggles[ cnt ] ); UnloadButtonImage( guiGameSaveTogglesImage[ cnt ] ); } // Destroy Terrorists setting buttons #ifdef JA2UB for( cnt=0; cnt<NUM_RPC_UB_OPTIONS; cnt++) { RemoveButton( guiRpcOptionToggles[ cnt ] ); UnloadButtonImage( guiRpcOptionTogglesImage[ cnt ] ); } #else for( cnt=0; cnt<NUM_TERRORISTS_OPTIONS; cnt++) { RemoveButton( guiTerroristsOptionToggles[ cnt ] ); UnloadButtonImage( guiTerroristsOptionTogglesImage[ cnt ] ); } #endif // Destroy Inventory setting buttons if(IsNIVModeValid(true) == TRUE) { // Destroy Inventory settings RemoveButton( giGIOInventorySettingButton[0] ); RemoveButton( giGIOInventorySettingButton[1] ); UnloadButtonImage( giGIOInventorySettingButtonImage[0] ); UnloadButtonImage( giGIOInventorySettingButtonImage[1] ); } // Destroy Drop All setting buttons for( cnt=0; cnt<NUM_DROPALL_OPTIONS; cnt++) { RemoveButton( guiDropAllOptionToggles[ cnt ] ); UnloadButtonImage( guiDropAllOptionTogglesImage[ cnt ] ); } // Destroy Gun setting buttons for( cnt=0; cnt<NUM_GUN_OPTIONS; cnt++) { RemoveButton( guiGunOptionToggles[ cnt ] ); UnloadButtonImage( guiGunOptionTogglesImage[ cnt ] ); } #ifdef JA2UB //off #else // Destroy Weapon Caches setting buttons for( cnt=0; cnt<NUM_CACHES_OPTIONS; cnt++) { RemoveButton( guiWeaponCachesOptionToggles[ cnt ] ); UnloadButtonImage( guiWeaponCachesOptionTogglesImage[ cnt ] ); } #endif gfGIOButtonsAllocated = FALSE; //If we are starting the game stop playing the music if( gubGameOptionScreenHandler == GIO_EXIT ) SetMusicMode( MUSIC_NONE ); gfGIOScreenExit = FALSE; gfGIOScreenEntry = TRUE; return( TRUE ); } void HandleGIOScreen() { if( gubGameOptionScreenHandler != GIO_NOTHING ) { switch( gubGameOptionScreenHandler ) { case GIO_CANCEL: gubGIOExitScreen = MAINMENU_SCREEN; gfGIOScreenExit = TRUE; break; case MP_LOAD: gubGIOExitScreen = SAVE_LOAD_SCREEN; gfSaveGame = FALSE; gfGIOScreenExit = TRUE; guiPreviousOptionScreen = GAME_INIT_OPTIONS_SCREEN; break; case GIO_EXIT: { //if we are already fading out, get out of here if( gFadeOutDoneCallback != DoneFadeOutForExitGameInitOptionScreen ) { //Disable the ok button DisableButton( guiGIODoneButton ); gFadeOutDoneCallback = DoneFadeOutForExitGameInitOptionScreen; FadeOutNextFrame( ); } break; } case GIO_IRON_MAN_MODE: DisplayMessageToUserAboutGameDifficulty(); break; } gubGameOptionScreenHandler = GIO_NOTHING; } if( gfReRenderGIOScreen ) { RenderGIOScreen(); gfReRenderGIOScreen = FALSE; } } BOOLEAN RenderGIOScreen() { HVOBJECT hPixHandle; RestoreExternBackgroundRect( GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_DIF_SETTING_Y-3, 120, 20 ); RestoreExternBackgroundRect( GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_IMP_SETTING_Y-3, 120, 20 ); RestoreExternBackgroundRect( GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_BR_SETTING_Y-3, 120, 20 ); RestoreExternBackgroundRect( GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_PROGRESS_SETTING_Y-3, 120, 20 ); RestoreExternBackgroundRect( GIO_INV_SETTING_X+GIO_OFFSET_TO_TEXT + 20, GIO_INV_SETTING_Y-3, 120, 20 ); //Get the main background screen graphic and blt it GetVideoObject(&hPixHandle, guiGIOMainBackGroundImage ); BltVideoObject(FRAME_BUFFER, hPixHandle, 0,0,0, VO_BLT_SRCTRANSPARENCY,NULL); //Shade the background ShadowVideoSurfaceRect( FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, iScreenWidthOffset + 640, iScreenHeightOffset + 480 ); //Display the title DrawTextToScreen( gzGIOScreenText[ GIO_INITIAL_GAME_SETTINGS ], GIO_MAIN_TITLE_X, GIO_MAIN_TITLE_Y, GIO_MAIN_TITLE_WIDTH, GIO_TITLE_FONT, GIO_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Dif Settings Title Text RenderGIOSmallSelectionFrame( (GIO_DIF_SETTING_X + 36), (GIO_DIF_SETTING_Y - 3) ); DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_DIF_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_DIF_SETTING_Y+6), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentDifficulty + 9 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the IMP number Title Text RenderGIOSmallSelectionFrame( (GIO_IMP_SETTING_X + 36), (GIO_IMP_SETTING_Y - 3) ); DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_IMP_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_IMP_NUMBER_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); if ( iCurrentIMPNumberSetting <= 6 ) { DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_IMP_SETTING_Y+6), GIO_IMP_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentIMPNumberSetting + 32 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } else { CHAR16 sStartLevelString[16]; swprintf(sStartLevelString, L"%i", iCurrentIMPNumberSetting ); DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_IMP_SETTING_Y+6), GIO_IMP_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, sStartLevelString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); } // Display BR Setting texts RenderGIOSmallSelectionFrame( (GIO_BR_SETTING_X + 36), (GIO_BR_SETTING_Y - 3) ); DisplayWrappedString( (UINT16)(GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_BR_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_BR_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_BR_QUALITY_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( (UINT16)(GIO_BR_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_BR_SETTING_Y+6), GIO_BR_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentBRSetting + 20 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); // Display Progress Setting texts RenderGIOSmallSelectionFrame( (GIO_PROGRESS_SETTING_X + 36), (GIO_PROGRESS_SETTING_Y - 3) ); DisplayWrappedString( (UINT16)(GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT - 6), (UINT16)(GIO_PROGRESS_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_PROGRESS_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_PROGRESS_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( (UINT16)(GIO_PROGRESS_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_PROGRESS_SETTING_Y+6), GIO_PROGRESS_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentProgressSetting + 49 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); // Old/new traits system DisplayWrappedString( (GIO_TRAITS_SETTING_X - 6), (UINT16)(GIO_TRAITS_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_TRAITS_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_TRAITS_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Game Settings Title Text DisplayWrappedString( (GIO_GAME_SETTING_X - 6), (UINT16)(GIO_GAME_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_GAME_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_GAME_STYLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); // JA2Gold: Display the iron man Settings Title Text DisplayWrappedString( (GIO_IRON_MAN_SETTING_X - 6), (UINT16)(GIO_IRON_MAN_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_IRON_MAN_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_GAME_SAVE_STYLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Terrorists Settings Title Text DisplayWrappedString( (GIO_TERRORISTS_SETTING_X - 6), (UINT16)(GIO_TERRORISTS_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_TERRORISTS_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_TERRORISTS_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); // Display Inventory Settings text RenderGIOSmallSelectionFrame( (GIO_INV_SETTING_X + 36), (GIO_INV_SETTING_Y - 3) ); DisplayWrappedString( (UINT16)(GIO_INV_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_INV_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_INV_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_INV_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( (UINT16)(GIO_INV_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_INV_SETTING_Y+5), GIO_INV_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentInventorySetting + 54 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Drop All Settings Title Text DisplayWrappedString( (GIO_DROPALL_SETTING_X - 6), (UINT16)(GIO_DROPALL_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_DROPALL_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DROPALL_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Gun Settings Title Text DisplayWrappedString( (GIO_GUN_SETTING_X - 6), (UINT16)(GIO_GUN_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_GUN_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the Weapon Caches Settings Title Text #ifdef JA2UB //off #else DisplayWrappedString( (GIO_CACHES_SETTING_X - 6), (UINT16)(GIO_CACHES_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE), GIO_CACHES_SETTING_WIDTH + 14, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_CACHES_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); #endif return( TRUE ); } void GetGIOScreenUserInput() { InputAtom Event; while( DequeueEvent( &Event ) ) { if( Event.usEvent == KEY_DOWN ) { switch( Event.usParam ) { case ESC: //Exit out of the screen gubGameOptionScreenHandler = GIO_CANCEL; break; #ifdef JA2TESTVERSION case 'r': gfReRenderGIOScreen=TRUE; break; case 'i': InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); break; #endif case ENTER: gubGameOptionScreenHandler = GIO_EXIT; break; } } } } void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags |= BUTTON_CLICKED_ON; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); //if the user doesnt have IRON MAN mode selected if( !DisplayMessageToUserAboutIronManMode() ) { //Confirm the difficulty setting DisplayMessageToUserAboutGameDifficulty(); } InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags |= BUTTON_CLICKED_ON; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); gubGameOptionScreenHandler = GIO_CANCEL; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } void MPBtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason) { if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) { btn->uiFlags |= BUTTON_CLICKED_ON; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); gubGameOptionScreenHandler = MP_LOAD; InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); } } UINT8 GetCurrentTraitsOptionButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_TRAIT_OPTIONS; cnt++) { if( ButtonList[ guiTraitsOptionToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #ifdef JA2UB UINT8 GetCurrentTextStyleButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_TEXT_STYLES; cnt++) { if( ButtonList[ guiGameTextToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #else UINT8 GetCurrentGameStyleButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_GAME_STYLES; cnt++) { if( ButtonList[ guiGameStyleToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #endif UINT8 GetCurrentGameSaveButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_SAVE_OPTIONS; cnt++) { if( ButtonList[ guiGameSaveToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #ifdef JA2UB UINT8 GetCurrentTexAndJohnButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_RPC_UB_OPTIONS; cnt++) { if( ButtonList[ guiRpcOptionToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #else UINT8 GetCurrentTerroristsButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_GAME_STYLES; cnt++) { if( ButtonList[ guiTerroristsOptionToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #endif UINT8 GetCurrentDropAllButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_GAME_STYLES; cnt++) { if( ButtonList[ guiDropAllOptionToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } UINT8 GetCurrentGunButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_GUN_OPTIONS; cnt++) { if( ButtonList[ guiGunOptionToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #ifdef JA2UB //off #else UINT8 GetCurrentWeaponCachesButtonSetting() { UINT8 cnt; for( cnt=0; cnt<NUM_GAME_STYLES; cnt++) { if( ButtonList[ guiWeaponCachesOptionToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } #endif UINT8 GetCurrentTimedTurnsButtonSetting() { UINT8 cnt; for( cnt=0; cnt<GIO_NUM_TIMED_TURN_OPTIONS; cnt++) { if( ButtonList[ guiTimedTurnToggles[ cnt ] ]->uiFlags & BUTTON_CLICKED_ON ) { return( cnt ); } } return( 0 ); } void DoneFadeOutForExitGameInitOptionScreen( void ) { // loop through and get the status of all the buttons gGameOptions.fGunNut = GetCurrentGunButtonSetting(); #ifdef JA2UB gGameOptions.ubGameStyle = FALSE; gGameLegionOptions.Random_Manuel_Text = GetCurrentTextStyleButtonSetting(); #else gGameOptions.ubGameStyle = GetCurrentGameStyleButtonSetting(); #endif #ifdef JA2UB gGameOptions.ubDifficultyLevel = min( NUM_DIFF_SETTINGS-1, ( max( 1, (iCurrentDifficulty + 1)) )); #else gGameOptions.ubDifficultyLevel = min( NUM_DIFF_SETTINGS, ( max( 1, (iCurrentDifficulty + 1)) )); #endif gGameOptions.fTurnTimeLimit = FALSE; // iron man gGameOptions.fIronManMode = GetCurrentGameSaveButtonSetting(); switch ( iCurrentBRSetting ) { case GIO_BR_GOOD: gGameOptions.ubBobbyRay = BR_GOOD; break; case GIO_BR_GREAT: gGameOptions.ubBobbyRay = BR_GREAT; break; case GIO_BR_EXCELLENT: gGameOptions.ubBobbyRay = BR_EXCELLENT; break; case GIO_BR_AWESOME: gGameOptions.ubBobbyRay = BR_AWESOME; break; } // CHRISL: if(IsNIVModeValid(true) == TRUE) { switch ( iCurrentInventorySetting) { case GIO_INV_OLD: gGameOptions.ubInventorySystem = INVENTORY_OLD; gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; break; case GIO_INV_NEW: gGameOptions.ubInventorySystem = INVENTORY_NEW; gGameOptions.ubAttachmentSystem = ATTACHMENT_OLD; break; case GIO_INV_NEW_NAS: gGameOptions.ubInventorySystem = INVENTORY_NEW; gGameOptions.ubAttachmentSystem = ATTACHMENT_NEW; } } // SANDRO - added following: gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, iCurrentIMPNumberSetting) )); gGameOptions.fNewTraitSystem = GetCurrentTraitsOptionButtonSetting(); #ifdef JA2UB gGameLegionOptions.TEX_AND_JOHN = GetCurrentTexAndJohnButtonSetting(); #else gGameOptions.fEnableAllTerrorists = GetCurrentTerroristsButtonSetting(); #endif gGameOptions.fEnemiesDropAllItems = GetCurrentDropAllButtonSetting(); #ifdef JA2UB gGameOptions.fEnableAllWeaponCaches = FALSE; #else gGameOptions.fEnableAllWeaponCaches = GetCurrentWeaponCachesButtonSetting(); #endif gGameOptions.ubProgressSpeedOfItemsChoices = min( GIO_PROGRESS_VERY_FAST, iCurrentProgressSetting ); // gubGIOExitScreen = INIT_SCREEN; #ifdef JA2UB gubGIOExitScreen = INIT_SCREEN; //JA25: No longer going to the intro screen #else gubGIOExitScreen = INTRO_SCREEN; #endif //set the fact that we should do the intro videos // gbIntroScreenMode = INTRO_BEGINNING; #ifdef JA2TESTVERSION if( gfKeyState[ ALT ] ) { if( gfKeyState[ CTRL ] ) { gMercProfiles[ MIGUEL ].bMercStatus = MERC_IS_DEAD; gMercProfiles[ SKYRIDER ].bMercStatus = MERC_IS_DEAD; } SetIntroType( INTRO_ENDING ); } else #endif #ifdef JA2UB //Ja25: No intro videos #else SetIntroType( INTRO_BEGINNING ); #endif ExitGIOScreen(); #ifdef JA2UB gFadeInDoneCallback = DoneFadeInForExitGameInitOptionScreen; FadeInNextFrame( ); #endif SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); } void DoneFadeInForExitGameInitOptionScreen( void ) { SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); } BOOLEAN DoGioMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) { SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; // do message box and return giGioMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); // send back return state return( ( giGioMessageBox != -1 ) ); } void DisplayMessageToUserAboutGameDifficulty() { UINT8 ubDiffLevel = iCurrentDifficulty; switch( ubDiffLevel ) { case 0: DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_NOVICE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); break; case 1: DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERIENCED], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); break; case 2: DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERT], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); break; case 3: DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_INSANE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); break; } } void ConfirmGioDifSettingMessageBoxCallBack( UINT8 bExitValue ) { if( bExitValue == MSG_BOX_RETURN_YES ) { gubGameOptionScreenHandler = GIO_EXIT; } } BOOLEAN DisplayMessageToUserAboutIronManMode() { // Madd UINT8 ubIronManMode = GetCurrentGameSaveButtonSetting(); //FALSE; //if the user has selected IRON MAN mode if( ubIronManMode ) { DoGioMessageBox( MSG_BOX_BASIC_STYLE, gzIronManModeWarningText[ IMM__IRON_MAN_MODE_WARNING_TEXT ], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioIronManMessageBoxCallBack ); return( TRUE ); } return( FALSE ); } void ConfirmGioIronManMessageBoxCallBack( UINT8 bExitValue ) { if( bExitValue == MSG_BOX_RETURN_YES ) { gubGameOptionScreenHandler = GIO_IRON_MAN_MODE; } else { ButtonList[ guiGameSaveToggles[ GIO_IRON_MAN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags |= BUTTON_CLICKED_ON; } } void RenderGIOSmallSelectionFrame(INT16 sX, INT16 sY) { HVOBJECT hHandle; // get the video object GetVideoObject(&hHandle, guiGIOSMALLFRAME); // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, sX, sY , VO_BLT_SRCTRANSPARENCY,NULL); return; }
[ "jazz_ja@b41f55df-6250-4c49-8e33-4aa727ad62a1" ]
[ [ [ 1, 2595 ] ] ]
175db182849b2bd07840ba5a55d13d1e67264710
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Graphic/Renderer/D3D10RenderCubeTexture.h
f13791a9cee89f54b13245c8100a613c5e815a8d
[]
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
GB18030
C++
false
false
946
h
#ifndef _D3D10RENDERCUBETEXTURE_H_ #define _D3D10RENDERCUBETEXTURE_H_ #include "D3D10Prerequisites.h" #include "../Main/RenderTexture.h" namespace Flagship { class _DLL_Export D3D10RenderCubeTexture : public RenderTexture { public: D3D10RenderCubeTexture(); virtual ~D3D10RenderCubeTexture(); enum { Face_PositiveX, Face_NegativeX, Face_PositiveY, Face_NegativeY, Face_PositiveZ, Face_NegativeZ, Face_Max, }; // 初始化渲染贴图 bool Initialize( UINT uiSize, DWORD dwFormat ); public: // 存储渲染贴图 virtual void SaveRenderTexture( wstring szPath ); // 更新渲染对象 virtual void Update(); protected: // 渲染表面 ID3D10RenderTargetView * m_pRenderSurface[Face_Max]; // 深度模版表面 ID3D10DepthStencilView * m_pDepthSurface; private: }; } #endif
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 48 ] ] ]
77b2fc3ecb446d21de3c58c39df488d9a429082d
33f59b1ba6b12c2dd3080b24830331c37bba9fe2
/Graphic/Renderer/D3D10SDKMesh.cpp
0d4f04020b80fc5cc17c9946757cfa590170daad
[]
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
GB18030
C++
false
false
1,920
cpp
#include "D3D10SDKMesh.h" #include "D3D10RenderWindow.h" namespace Flagship { D3D10SDKMesh::D3D10SDKMesh() { m_iClassType = Base::Mesh_SDKMesh; m_pBound = new BoundingBox; m_pSDKMesh = new CDXUTSDKMesh; } D3D10SDKMesh::~D3D10SDKMesh() { SAFE_DELETE( m_pBound ); SAFE_DELETE( m_pSDKMesh ); m_pD3D10VertexBuffer = NULL; m_pD3D10IndexBuffer = NULL; } bool D3D10SDKMesh::Create() { // 获取D3D10设备指针 ID3D10Device * pD3D10Device = ( ( D3D10RenderWindow * ) RenderWindow::GetActiveRenderWindow() )->GetDevice(); // 创建DXUT对象 m_pSDKMesh->Create( pD3D10Device, m_szPathName.c_str() ); const D3D10_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 }, }; for ( int i = 0; i < 3; i++ ) { m_pInputElement[i] = layout[i]; } m_iElementNum = 3; m_dwIndexFormat = m_pSDKMesh->GetIBFormat10( 0 ); return true; } void D3D10SDKMesh::Destory() { Mesh::Destory(); // 释放DXUT对象 m_pSDKMesh->Destroy(); } bool D3D10SDKMesh::Cache() { if ( ! Mesh::Cache() ) { return false; } // 获取缓冲 m_pD3D10VertexBuffer = m_pSDKMesh->GetVB10( 0, 0 ); m_pD3D10IndexBuffer = m_pSDKMesh->GetIB10( 0 ); // 获取缓冲信息 m_dwNumTrangle = (DWORD) m_pSDKMesh->GetNumIndices( 0 ) / 3; m_dwNumVertex = (DWORD) m_pSDKMesh->GetNumVertices( 0, 0 ); m_dwVertexSize = m_pSDKMesh->GetVertexStride( 0, 0 ); // 设置标记 m_bReady = true; return true; } void D3D10SDKMesh::UnCache() { Mesh::UnCache(); SAFE_RELEASE( m_pD3D10VertexBuffer ); SAFE_RELEASE( m_pD3D10IndexBuffer ); } }
[ "yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa" ]
[ [ [ 1, 84 ] ] ]
4d89ecad1cdd505f3ff844b996c303af147c4b85
fc4946d917dc2ea50798a03981b0274e403eb9b7
/gentleman/gentleman/WindowsAPICodePack/WindowsAPICodePack/DirectX/DirectX/Direct3D11/D3D11Texture2D.h
479767c86fb59ff4cc4b987f7c320e21f89406b6
[]
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,071
h
//Copyright (c) Microsoft Corporation. All rights reserved. #pragma once #include "D3D11Resource.h" namespace Microsoft { namespace WindowsAPICodePack { namespace DirectX { namespace Direct3D11 { using namespace System; /// <summary> /// A 2D texture interface manages texel data, which is structured memory. /// <para>(Also see DirectX SDK: ID3D11Texture2D)</para> /// </summary> public ref class Texture2D : public Microsoft::WindowsAPICodePack::DirectX::Direct3D11::D3DResource { public: /// <summary> /// Get the properties of the texture resource. /// <para>(Also see DirectX SDK: ID3D11Texture2D::GetDesc)</para> /// </summary> property Texture2DDescription Description { Texture2DDescription get(); } internal: Texture2D() { } internal: Texture2D(ID3D11Texture2D* pNativeID3D11Texture2D) { Attach(pNativeID3D11Texture2D); } }; } } } }
[ "lucemia@9e708c16-f4dd-11de-aa3c-59de0406b4f5" ]
[ [ [ 1, 41 ] ] ]
1160a4123acfd83d8d093dd62fc59b06d63b8766
c0a577ec612a721b324bb615c08882852b433949
/antlr/src/antlr_runtime/src/LLkParser.cpp
f50336f1b12bb6b9608341c6fb98c248f5f2232b
[]
no_license
guojerry/cppxml
ca87ca2e3e62cbe2a132d376ca784f148561a4cc
a4f8b7439e37b6f1f421445694c5a735f8beda71
refs/heads/master
2021-01-10T10:57:40.195940
2010-04-21T13:25:29
2010-04-21T13:25:29
52,403,012
0
0
null
null
null
null
UTF-8
C++
false
false
2,171
cpp
/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/RIGHTS.html * * $Id: //depot/code/org.antlr/main/main/lib/cpp/src/LLkParser.cpp#5 $ */ /* 1999-2007 Version 3.2 November 2007 * * Optional version * * Modified by David Wigg at London South Bank University for CPP_parser.g * to provide dynamic tracing * * See MyReadMe.txt for further information * * This file is best viewed in courier font with tabs set to 4 spaces */ #include "antlr/LLkParser.hpp" #include <iostream> #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif ANTLR_USING_NAMESPACE(std) /**An LL(k) parser. * * @see antlr.Token * @see antlr.TokenBuffer * @see antlr.LL1Parser */ // LLkParser(int k_); LLkParser::LLkParser(const ParserSharedInputState& state, int k_) : Parser(state), k(k_) { } LLkParser::LLkParser(TokenBuffer& tokenBuf, int k_) : Parser(tokenBuf), k(k_) { } LLkParser::LLkParser(TokenStream& lexer, int k_) : Parser(new TokenBuffer(lexer)), k(k_) { } void LLkParser::trace(const char* ee, const char* rname) { traceIndent(); cout << ee << rname << ((inputState->guessing>0)?";[guessing]":"; "); // version to show guesing level //cout << ee << rname << ((inputState->guessing>0)?";[guessing]":"; ") << inputState->guessing ; for (int i = 1; i <= k; i++) { if (i != 1) { cout << ", "; } cout << "LA(" << i << ")=="; string temp; try { temp = LT(i)->getText().c_str(); } catch( ANTLRException& ae ) { temp = "[error: "; temp += ae.toString(); temp += ']'; } cout << temp; } cout << endl; } // DW 060204 For dynamic tracing void LLkParser::antlrTrace(bool traceFlag) { antlrTracing = traceFlag; } void LLkParser::traceIn(const char* rname) { traceDepth++; // DW 060204 For dynamic tracing if (antlrTracing) trace("> ",rname); } void LLkParser::traceOut(const char* rname) { // DW 060204 For dynamic tracing if (antlrTracing) trace("< ",rname); traceDepth--; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif
[ "oeichenwei@0e9f5f58-6d57-11de-950b-9fccee66d0d9" ]
[ [ [ 1, 108 ] ] ]
a7e7de35409d2546bc739d33c91b054bce4b0c13
2112057af069a78e75adfd244a3f5b224fbab321
/branches/refactor/src_root/include/map_splitter/MapUtil.h
e0f6fc2e7db2eb5140181551fe7df92f6447d407
[]
no_license
blockspacer/ireon
120bde79e39fb107c961697985a1fe4cb309bd81
a89fa30b369a0b21661c992da2c4ec1087aac312
refs/heads/master
2023-04-15T00:22:02.905112
2010-01-07T20:31:07
2010-01-07T20:31:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,648
h
/*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * ***************************************************************************/ /** @file MapUtil.h @brief Utility that split big map in tiles, pre-calculate splatting by pre-calculating coverage map and pre-calculate normals. */ #ifndef MapUtil_H #define MapUtil_H #ifdef _DEBUG #define DEBUG_PROGRESS_OUTPUT(A) {std::cout << A;} #else #define DEBUG_PROGRESS_OUTPUT(A) #endif #include "Ogre.h" #include "OgreRoot.h" #include "OgreImage.h" #include "OgreString.h" #include "OgreSingleton.h" #include "OgreDefaultHardwareBufferManager.h" #include "OgreMaterialManager.h" #ifndef _MAPEDITOR #include "OgrePagingLandScapeOptions.h" #include "OgrePagingLandScapeData2D.h" #endif //_MAPEDITOR #include "MapNormaler.h" namespace Ogre { /** * \ingroup Tool_MapSplitter * * * \par * * \version 0.2 * second version * * \date 06-07-2004 * * \author [email protected] * * \todo * Add New methods, faster, smaller. * Add DXT5 compression to maps. * Add Real-time methods to modify part of a map * (SubNormalCalc, SubCoverageCalc, subPvs, sublight) * adds unlimited number of splat maps ? * Zip all maps at the end * * * \bug */ class MapUtil : public Singleton<MapUtil> { public : static MapUtil& getSingleton(void); /** Override standard Singleton retrieval. @remarks Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll. @par This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors. */ static MapUtil* getSingletonPtr(void); MapUtil(); ~MapUtil(); /** * @rem if launched on its own load Ogre, options, log, etc... */ void Load(); /** * @rem does process one or more maps */ void process(); /** * @remarks * Does what it should. (depending on option file) */ void processOneMap (); /** * @remarks * no scaling here. * \param x position in width * \param z position in height * \return height at this point */ const Real getHeight (const Real x, const Real z); /** * @remarks * */ Real *getHeightData (); /** * @remarks * no scaling here. Value comes from the pre-calculated map. * \param x position in width * \param z position in height * \return Normal at this point */ const Vector3 getNormalAt(const Real x, const Real z); /** * @remarks * */ Vector3 *getNormalData(); /** * * \return Max height */ Real getMaxHeight () {return mMax;} /** * * \return total Width of HeightMap */ uint getMapWidth () {return mWidth;} /** * * \return total Height of HeightMap */ uint getMapHeight () {return mHeight;} /** * * \return total Width of HeightMap */ uint getMapTileWidthNumber () {return mPageX;} /** * * \return total Height of HeightMap */ uint getMapTileHeightNumber () {return mPageZ;} /** * * \param Filename of image to load as Map * \param *ImageMap Where to load image * \return */ void load (const String &filename, Image *ImageMap); /** * save and split maps * \param extension of filename name under which file must be saved */ void saveAndSplitHeightMap (const String &filename); /** * save and split Normal maps * \param extension of filename name under which file must be saved */ void saveAndSplitNormalMap (const String &filename); /** * save and split Base maps * \param extension of filename name under which file must be saved */ void saveAndSplitBaseMap (const String &filename); /** * save and split Color maps * \param extension of filename name under which file must be saved */ void saveAndSplitColorMap (const String &filename); /** * save and split Coverage maps * \param extension of filename name under which file must be saved */ void saveAndSplitCoverageMap (const String &filename); /** * save and split Alpha maps * \param extension of filename name under which file must be saved */ void saveAndSplitAlphaMaps (const String &filename, int i); /** * save and split Light maps * \param extension of filename name under which file must be saved */ void saveAndSplitLightMap (const String &filename); /** * save and split Shadow maps * \param extension of filename name under which file must be saved */ void saveAndSplitShadowMap (const String &filename); /** * get theoretical maximum height (depend on source data type, not on data) */ const Real getMaxTheoHeight (); void LoadDataFromMemory(uint mapWidth, uint mapHeight, Real *heightData, Real max); void LoadDataFromSource(); void LoadOptions(); void setMap (const String &mapName, const String &extension, const String &texture_extension, const uint pageSize, const String &OutDirectory, const String &groupname); void setMapColoring (const ColourValue *colors, const Real *heights, const uint numColors); String mFileName; String mPureFilename; String mExt; String mTextureExt; String mColorMapName; bool b_SaveAsRaw; bool b_SaveAsPng; bool b_SaveBigFile; uint mPageSize; uint mPageSpacing; uint mPageX; uint mPageZ; uint mp2Height; uint mp2Width; uint mHeight; uint mWidth; Real mMax; bool mGenHeightMap; bool mGenMiniMap; uint mGenMiniMapWidth; uint mGenMiniMapHeight; bool mGenCoverageMap; bool mGenBaseMap; bool mGenAlphaMaps; bool mGenLightMap; bool mGenColorMapGenerate; bool mGenColorMapSplit; bool mGenElevationMap; bool mGenNormalMap; bool mGenEqualize; bool mGenInfiniteMap; bool mGenHeightNormalMap; bool mGenRGBMaps; bool mGenAlphaSplatRGBAMaps; bool mGenAlphaSplatLightMaps; bool mGenShadowMap; bool mGenLitColorMapGenerate; bool mGenLitColorMapSplit; bool mGenLitBaseMap; bool mGenPVSMap; bool mGenHorizonMap; bool mGenZHorizon; Real mHeightMapBlurFactor; uint world_height; uint world_width; bool mPaged; String mOutDirectory; #ifndef _MAPEDITOR PagingLandScapeData2D *mHeightdata; PagingLandScapeOptions *mOptions; #endif //_MAPEDITOR Image *mNormalMap; Image *mAlphaMap[4]; size_t mNormalMapBpp; uint mNormalMapDataSize; uchar *mNormalMapData; MapNormaler NormalMapper; Vector3 mSun; Real mAmb; Real mDiff; int mBlur; Vector3 scale; String mGroupName; String Splat_Filename_0; String Splat_Filename_1; String Splat_Filename_2; String Splat_Filename_3; ColourValue matColor[4]; Real matHeight[4]; private : Root *mRoot; Real *mData; Real maxHeight; /** * Loads the Big heightMap to split and pre-calculate * */ void loadHeightMap(); }; } #endif //MapUtil_H
[ [ [ 1, 328 ] ] ]
418b6be3254c3b7901ad845632a07a8b3cfd3912
1736474d707f5c6c3622f1cd370ce31ac8217c12
/TestComLib/TestComLib.h
25f93bc69e8dfc421b6e45827ea5faf417b24f87
[]
no_license
arlm/pseudo
6d7450696672b167dd1aceec6446b8ce137591c0
27153e50003faff31a3212452b1aec88831d8103
refs/heads/master
2022-11-05T23:38:08.214807
2011-02-18T23:18:36
2011-02-18T23:18:36
275,132,368
0
0
null
null
null
null
UTF-8
C++
false
false
990
h
// Copyright (c) Microsoft Corporation 2008. All rights reserved. #pragma once #include <unknwn.h> ////////////////////////////////////////////////////////////////////////////////////////////////// typedef enum { Apple = 0, Banana, Pear } TestFruitType; ////////////////////////////////////////////////////////////////////////////////////////////////// interface __declspec(uuid("dd683bca-aef8-43a0-0099-8b1308d4b974")) IFruit : IUnknown { STDMETHOD(SetFruit)(TestFruitType eFruit) = 0; STDMETHOD(GetFruit)(TestFruitType* peFruit) = 0; }; #define IID_IFruit __uuidof(IFruit) /////////////////////////////////////////////////////////////////////////////////////// class __declspec(uuid("b9dd55f6-09c2-4f48-009d-11c2ffa788f8")) CoClassMultiFruit {}; class __declspec(uuid("65d61b9c-0c9f-4dfc-00b1-4b284fc0d310")) CoClassSingleFruit {}; #define CLSID_MultiFruit __uuidof(CoClassMultiFruit) #define CLSID_SingleFruit __uuidof(CoClassSingleFruit)
[ [ [ 1, 32 ] ] ]
f491f3ced8fded38d45733e56e2e01e8c2107057
df96cbce59e3597f2aecc99ae123311abe7fce94
/dom/generated_dom/not_implemented/js_css_ViewCSS.cpp
ad701636d528809b916121440bf6465eec016755
[]
no_license
abhishekbhalani/webapptools
f08b9f62437c81e0682497923d444020d7b319a2
93b6034e0a9e314716e072eb6d3379d92014f25a
refs/heads/master
2021-01-22T17:58:00.860044
2011-12-14T10:54:11
2011-12-14T10:54:11
40,562,019
2
0
null
null
null
null
UTF-8
C++
false
false
414
cpp
/* DO NOT EDIT! This file has been generated by generate_sources.py script. $Id$ */ #include "precomp.h" using namespace v8; v8::Handle<v8::Value> js_css_ViewCSS::getComputedStyle(v8::Handle<v8::Value> val_elt, css::DOMString val_pseudoElt) { return css::ViewCSS::getComputedStyle(val_elt, val_pseudoElt); } js_css_ViewCSS::js_css_ViewCSS() {} js_css_ViewCSS::~js_css_ViewCSS() {}
[ "stinger911@79c36d58-6562-11de-a3c1-4985b5740c72" ]
[ [ [ 1, 18 ] ] ]
48def9b3a06694aaae1d691669accf2a852a7cbb
5ac13fa1746046451f1989b5b8734f40d6445322
/minimangalore/Nebula2/code/nebula2/src/gfx2/nd3d9server_main.cc
1e551694c314ea766eaa0177985e9b7e58be9d6a
[]
no_license
moltenguy1/minimangalore
9f2edf7901e7392490cc22486a7cf13c1790008d
4d849672a6f25d8e441245d374b6bde4b59cbd48
refs/heads/master
2020-04-23T08:57:16.492734
2009-08-01T09:13:33
2009-08-01T09:13:33
35,933,330
0
0
null
null
null
null
UTF-8
C++
false
false
8,662
cc
//------------------------------------------------------------------------------ // nd3d9server_main.cc // (C) 2003 RadonLabs GmbH //------------------------------------------------------------------------------ #include "gfx2/nd3d9server.h" #include "kernel/nenv.h" #include "kernel/nfileserver2.h" #include "gfx2/nd3d9texture.h" nNebulaClass(nD3D9Server, "ngfxserver2"); nD3D9Server* nD3D9Server::Singleton = 0; //------------------------------------------------------------------------------ /** */ nD3D9Server::nD3D9Server() : #ifdef __NEBULA_STATS__ timeStamp(0.0), queryResourceManager(0), #endif windowHandler(this), deviceBehaviourFlags(0), d3dSprite(0), d3d9(0), d3d9Device(0), depthStencilSurface(0), backBufferSurface(0), captureSurface(0), effectPool(0), featureSet(InvalidFeatureSet), textElements(64, 64), #if __NEBULA_STATS__ statsFrameCount(0), statsNumTextureChanges(0), statsNumRenderStateChanges(0), statsNumDrawCalls(0), statsNumPrimitives(0), #endif d3dxLine(0) { n_assert(0 == Singleton); Singleton = this; WATCHER_INIT(watchNumPrimitives, "watchGfxNumPrimitives", nArg::Int); WATCHER_INIT(watchFPS, "watchGfxFPS", nArg::Float); WATCHER_INIT(watchNumDrawCalls, "watchGfxDrawCalls", nArg::Int); WATCHER_INIT(watchNumRenderStateChanges, "watchGfxRSChanges", nArg::Int); memset(&(this->devCaps), 0, sizeof(this->devCaps)); memset(&(this->presentParams), 0, sizeof(this->presentParams)); memset(&(this->shapeMeshes), 0, sizeof(this->shapeMeshes)); // HACK: // we used to open the window here, but we now do it lazily in OpenDisplay() // to give the calling app the chance to set (e.g.) the window's name and // icon before it is opened. // initialize Direct3D this->D3dOpen(); // initialize the device identifier this->InitDeviceIdentifier(); } //------------------------------------------------------------------------------ /** */ nD3D9Server::~nD3D9Server() { // shut down all if (this->displayOpen) { this->CloseDisplay(); } this->D3dClose(); if (this->windowHandler.IsWindowOpen()) { this->windowHandler.CloseWindow(); } n_assert(0 != Singleton); Singleton = 0; } //------------------------------------------------------------------------------ /** Initialize Direct3D. */ void nD3D9Server::D3dOpen() { n_assert(0 == this->d3d9); // create the d3d object this->d3d9 = Direct3DCreate9(D3D_SDK_VERSION); if (!this->d3d9) { n_error("nD3D9Server: could not initialize Direct3D!\n"); } // update the feature set this->UpdateFeatureSet(); } //------------------------------------------------------------------------------ /** Shutdown Direct3D. */ void nD3D9Server::D3dClose() { n_assert(this->d3d9); n_assert(0 == this->d3d9Device); // release the d3d object int refCount = this->d3d9->Release(); if (0 < refCount) { n_printf("WARNING: Direct3D9 interface was still referenced (count = %d)\n", refCount); } this->d3d9 = 0; } //----------------------------------------------------------------------------- /** Open the display. */ bool nD3D9Server::OpenDisplay() { n_assert(!this->displayOpen); if (!this->windowHandler.IsWindowOpen()) { // lazy initialization: open the app window // don't do this in the constructor because the window's name and icon // won't have been set at that time. this->windowHandler.OpenWindow(); } if (this->DeviceOpen()) { nGfxServer2::OpenDisplay(); // clear display if (this->BeginFrame()) { if (this->BeginScene()) { this->Clear(AllBuffers, 0.0f, 0.0f, 0.0f, 1.0f, 1.0, 0); this->EndScene(); this->PresentScene(); } this->EndFrame(); } return true; } return false; } //----------------------------------------------------------------------------- /** Close the display. */ void nD3D9Server::CloseDisplay() { n_assert(this->displayOpen); this->DeviceClose(); nGfxServer2::CloseDisplay(); } //----------------------------------------------------------------------------- /** Implements the Windows message pump. Must be called once a frame OUTSIDE of BeginScene() / EndScene(). @return false if nD3D9Server requests to shutdown the application */ bool nD3D9Server::Trigger() { return this->windowHandler.Trigger(); } //----------------------------------------------------------------------------- /** Create screen shot and save it to given filename. (.jpg file) @param fileName filename for screen shot. - 25-Apr-05 floh rewritten for performance */ bool nD3D9Server::SaveScreenshot(const char* fileName, nTexture2::FileFormat fileFormat) { n_assert(fileName); n_assert(this->d3d9Device); HRESULT hr; // get mangled path name nString mangledPath = nFileServer2::Instance()->ManglePath(fileName); // copy back buffer to offscreen surface hr = this->d3d9Device->GetRenderTargetData(this->backBufferSurface, this->captureSurface); n_assert(SUCCEEDED(hr)); // save image D3DXIMAGE_FILEFORMAT d3dxFormat = nD3D9Texture::FileFormatToD3DX(fileFormat); hr = D3DXSaveSurfaceToFile(mangledPath.Get(), d3dxFormat, this->captureSurface, NULL, NULL); n_assert(SUCCEEDED(hr)); // all ok return true; } //----------------------------------------------------------------------------- /** Enter dialog box mode. */ void nD3D9Server::EnterDialogBoxMode() { n_assert(this->windowHandler.GetDisplayMode().GetDialogBoxMode()); n_assert(this->d3d9Device); HRESULT hr; nGfxServer2::EnterDialogBoxMode(); // reset the device with lockable backbuffer flag this->OnDeviceCleanup(false); D3DPRESENT_PARAMETERS p = this->presentParams; p.MultiSampleType = D3DMULTISAMPLE_NONE; p.Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; hr = this->d3d9Device->Reset(&p); this->InitDeviceState(); this->OnDeviceInit(false); hr = this->d3d9Device->SetDialogBoxMode(TRUE); } //----------------------------------------------------------------------------- /** Leave dialog box mode. */ void nD3D9Server::LeaveDialogBoxMode() { n_assert(this->windowHandler.GetDisplayMode().GetDialogBoxMode()); n_assert(this->d3d9Device); nGfxServer2::LeaveDialogBoxMode(); HRESULT hr = this->d3d9Device->SetDialogBoxMode(FALSE); // only reset the device if it is currently valid hr = this->d3d9Device->TestCooperativeLevel(); if (SUCCEEDED(hr)) { this->OnDeviceCleanup(false); hr = this->d3d9Device->Reset(&this->presentParams); this->InitDeviceState(); this->OnDeviceInit(false); } } //----------------------------------------------------------------------------- /** Set the current display mode. This will not take effect until OpenDisplay() has been called! */ void nD3D9Server::SetDisplayMode(const nDisplayMode2& mode) { this->windowHandler.SetDisplayMode(mode); } //----------------------------------------------------------------------------- /** Get the current display mode. */ const nDisplayMode2& nD3D9Server::GetDisplayMode() const { return this->windowHandler.GetDisplayMode(); } //----------------------------------------------------------------------------- /** */ void nD3D9Server::SetWindowTitle(const char* title) { this->windowHandler.SetWindowTitle(title); } //----------------------------------------------------------------------------- /** Return true when vertex shaders are running in emulation. */ bool nD3D9Server::AreVertexShadersEmulated() { n_assert(this->d3d9Device); #if N_D3D9_FORCEMIXEDVERTEXPROCESSING return true; #else if (DX7 == this->GetFeatureSet()) { return true; } return 0 == (this->deviceBehaviourFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING); #endif } //------------------------------------------------------------------------------ /** - 24-Nov-04 kims added */ void nD3D9Server::SetSkipMsgLoop(bool skip) { this->windowHandler.SetSkipMsgLoop(skip); }
[ "BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 321 ] ] ]
65b93891916b570c232a324e7d0443aa99319f5d
e83babea370f43f4bad3294c9832318cfb657578
/src/tp2/tp2_application.h
801cd5ffa26163416ef181c0f4f3e8a487dc3e89
[]
no_license
maoueh/inf8702
6f5b233a3818422eca308d53804916184691d1a9
34931a16049cf7fed3835658c5bc9aedd5b1b540
refs/heads/master
2021-01-10T19:47:25.485668
2009-09-16T23:12:18
2009-09-16T23:12:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,298
h
#ifndef TP2_APPLICATION_H #define TP2_APPLICATION_H #include "color.h" #include "opengl_application.h" class ShaderProgram; class TextureUnit; class Window; class Tp2Application : public OpenGlApplication { public: Tp2Application(CommandLine* commandLine); virtual ~Tp2Application(); protected: virtual void initialize(); virtual STRING& getName() { return mName; } virtual void keyPressed(Window* window, INT keyCode, INT repeat); virtual void mousePressed(MouseEvent& event); virtual void mouseDragged(MouseEvent& event); virtual void draw(); virtual void updateWorld(); private: void initializeTextures(); void applyTextures(); void deactivateTextures(); void compileQuadGridList(FLOAT size, INT rowCount, INT columnCount, BOOL isOutsideNormal); void drawQuadGrid(FLOAT size, INT rowCount, INT columnCount, BOOL isOutsideNormal); void updateLights(); STRING mName; ShaderProgram* mShaderProgram; BOOL mIsShaderOn; INT mLastMouseX; INT mLastMouseY; TextureUnit* m3dLabsTextureUnit; TextureUnit* mRustTextureUnit; TextureUnit* mStonewallTextureUnit; UINT mQuadGridListId; Color mCubeColor; Color mFogColor; INT mActiveColorComponent; FLOAT mPointLightPosition[4]; Color mPointLightAmbient; Color mPointLightDiffuse; Color mPointLightSpecular; Color mPointLightEmission; Color mSpotLightAmbient; Color mSpotLightDiffuse; Color mSpotLightSpecular; Color mSpotLightEmission; FLOAT mDirectionalLightPosition[4]; Color mDirectionalLightAmbient; Color mDirectionalLightDiffuse; Color mDirectionalLightSpecular; Color mDirectionalLightEmission; Color mMaterialAmbient; Color mMaterialDiffuse; Color mMaterialSpecular; Color mMaterialEmission; FLOAT mMaterialShininess[1]; FLOAT mRotationAngleX; FLOAT mRotationAngleY; FLOAT mRotationAngleZ; FLOAT mRotationFreqX; FLOAT mRotationFreqY; FLOAT mRotationFreqZ; FLOAT mAxisScaleFactor; BOOL mAutomaticRotation; BOOL mIsSpotLightOn; BOOL mIsDirectionalLightOn; BOOL mIsPointLightOn; }; #endif
[ "Matt@Extra-PC.(none)" ]
[ [ [ 1, 96 ] ] ]
55d408f9a13bf2b472dec7e148b16fab21ce6082
ea6b169a24f3584978f159ec7f44184f9e84ead8
/source/reflect/string/ConstString.cc
5e48b49641439d76605a8e71f3c0486df432c6c7
[]
no_license
sparecycles/reflect
e2051e5f91a7d72375dd7bfa2635cf1d285d8ef7
bec1b6e6521080ad4d932ee940073d054c8bf57f
refs/heads/master
2020-06-05T08:34:52.453196
2011-08-18T16:33:47
2011-08-18T16:33:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,939
cc
#include <reflect/string/ConstString.h> #include <reflect/string/SharedString.h> #include <reflect/string/Fragment.h> #include <reflect/Reflector.h> #include <reflect/PrimitiveType.hpp> #include <reflect/PrimitiveTypes.h> #include <cstring> namespace reflect { namespace string { ConstString::ConstString(const char *s) : mpString(s ? s : "") , mLength(size_type(std::strlen(mpString))) { } ConstString::ConstString() : mpString("") , mLength(0) { } const char *ConstString::c_str() const { return mpString; } const char *ConstString::data() const { return mpString; } ConstString::size_type ConstString::length() const { return mLength; } ConstString::size_type ConstString::size() const { return mLength; } /////////////////////////////////////////// ConstString::size_type ConstString::find(char ch, ConstString::size_type pos) const { return Fragment(*this).find(ch, pos); } ConstString::size_type ConstString::find(const char *s, ConstString::size_type pos, ConstString::size_type len) const { return Fragment(*this).find(s, pos, len); } ConstString::size_type ConstString::find(const Fragment &s, ConstString::size_type pos) const { return Fragment(*this).find(s, pos); } ConstString::size_type ConstString::find_first_of(char ch, ConstString::size_type pos) const { return Fragment(*this).find_first_of(ch, pos); } ConstString::size_type ConstString::find_first_of(const Fragment &s, ConstString::size_type pos) const { return Fragment(*this).find_first_of(s, pos); } ConstString::size_type ConstString::rfind(char ch, ConstString::size_type pos) const { return Fragment(*this).rfind(ch, pos); } ConstString::size_type ConstString::rfind(const char *s, ConstString::size_type pos, ConstString::size_type len) const { return Fragment(*this).rfind(s, pos, len); } ConstString::size_type ConstString::rfind(const Fragment &s, ConstString::size_type pos) const { return Fragment(*this).rfind(s, pos); } ConstString::size_type ConstString::find_last_of(char ch, ConstString::size_type pos) const { return Fragment(*this).find_last_of(ch, pos); } ConstString::size_type ConstString::find_last_of(const Fragment &s, ConstString::size_type pos) const { return Fragment(*this).find_last_of(s, pos); } Fragment ConstString::substr(ConstString::size_type index, ConstString::size_type amount) const { return Fragment(*this).substr(index, amount); } bool ConstString::empty() const { return 0 == size(); } ConstString::operator Fragment() const { return Fragment(data(), length()); } bool ConstString::operator ==(const Fragment &other) const { return Fragment(*this) == other; } bool ConstString::operator <=(const Fragment &other) const { return Fragment(*this) <= other; } bool ConstString::operator >=(const Fragment &other) const { return Fragment(*this) >= other; } bool ConstString::operator < (const Fragment &other) const { return Fragment(*this) < other; } bool ConstString::operator > (const Fragment &other) const { return Fragment(*this) > other; } bool ConstString::operator !=(const Fragment &other) const { return Fragment(*this) != other; } ConstString::const_iterator ConstString::begin() const { return data(); } ConstString::const_iterator ConstString::end() const { return data() + size(); } namespace internals { void SerializeConstString(const ConstString *in, ConstString *out, Reflector &reflector) { if(reflector.Serializing()) { reflector | string::Fragment(*in); } else { string::SharedString pool_string; reflector | pool_string; *out = pool_string.c_str(); } } } } } DEFINE_STATIC_REFLECTION(reflect::string::ConstString, "const_string") { + Concrete; + ConversionFrom<const char *>(); SerializeWith<&reflect::string::internals::SerializeConstString>(); }
[ [ [ 1, 162 ] ] ]
3c6a2a935daf71e1c61550880d3b85cf4566be9a
42b578d005c2e8870a03fe02807e5607fec68f40
/src/init.cc
ca1a175eb0492b9f6a0391c85b51db47f232a355
[ "MIT" ]
permissive
hylom/xom
e2b02470cd984d0539ded408d13f9945af6e5f6f
a38841cfe50c3e076b07b86700dfd01644bf4d4a
refs/heads/master
2021-01-23T02:29:51.908501
2009-10-30T08:41:30
2009-10-30T08:41:30
null
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
29,537
cc
#include "ed.h" #include <float.h> #include <new.h> #include <io.h> #include <eh.h> #include <fcntl.h> #include <objbase.h> #include "ctl3d.h" #include "environ.h" #include "except.h" #include "privctrl.h" #include "xdde.h" #include "fnkey.h" #include "syntaxinfo.h" #include "ipc.h" #include "sock.h" #include "conf.h" #include "colors.h" #ifdef DEBUG # include "mainframe.h" # include <crtdbg.h> #endif #ifndef M_PI # define M_PI 3.141592653589793 #endif const char Application::ToplevelClassName[] = " "; const char Application::FrameClassName[] = " "; const char Application::ClientClassName[] = " "; const char Application::ModelineClassName[] = " "; const char FunctionKeyClassName[] = " "; Application app; char enable_quit::q_enable; Application::Application () : mouse (kbdq) { default_tab_columns = 8; auto_save_count = 0; toplevel_is_active = 0; ime_composition = 0; ime_open_mode = kbd_queue::IME_MODE_OFF; sleep_timer_exhausted = 0; last_vkeycode = -1; kbd_repeat_count = 0; wait_cursor_depth = 0; f_in_drop = 0; drop_window = 0; drag_window = 0; drag_buffer = 0; f_protect_quit = 0; hwnd_clipboard = 0; last_cmd_tick = GetTickCount (); f_auto_save_pending = 0; default_caret_blink_time = 0; last_blink_caret = 0; lquit_char = make_char ('G' - '@'); quit_vkey = 'G'; quit_mod = MOD_CONTROL; ini_file_path = 0; minibuffer_prompt_column = -1; int tem; initial_stack = &tem; in_gc = 0; } Application::~Application () { xfree (ini_file_path); } static lisp make_path (const char *s, int append_slash = 1) { Char *b = (Char *)alloca ((strlen (s) + 1) * sizeof (Char)); Char *be = s2w (b, s); map_backsl_to_sl (b, be - b); if (append_slash && be != b && be[-1] != '/') *be++ = '/'; return make_string (b, be - b); } static void init_module_dir () { char path[PATH_MAX]; GetModuleFileName (0, path, sizeof path); char *p = jrindex (path, '\\'); if (p) p[1] = 0; xsymbol_value (Qmodule_dir) = make_path (path); } static inline void init_current_dir () { xsymbol_value (Qdefault_dir) = make_path (sysdep.curdir); } static void init_windows_dir () { char path[PATH_MAX]; GetWindowsDirectory (path, sizeof path); xsymbol_value (Qwindows_dir) = make_path (path); GetSystemDirectory (path, sizeof path); xsymbol_value (Qsystem_dir) = make_path (path); } static int init_home_dir (const char *path) { char home[PATH_MAX], *tem; int l = WINFS::GetFullPathName (path, sizeof home, home, &tem); if (!l || l >= sizeof home) return 0; DWORD f = WINFS::GetFileAttributes (home); if (f == -1 || !(f & FILE_ATTRIBUTE_DIRECTORY)) return 0; xsymbol_value (Qhome_dir) = make_path (home); return 1; } static void init_home_dir () { char path[PATH_MAX]; static const char xyzzyhome[] = "XYZZYHOME"; static const char cfgInit[] = "init"; if (read_conf (cfgInit, "homeDir", path, sizeof path) && init_home_dir (path)) return; for (int i = 0; i <= 5; i += 5) { char *e = getenv (xyzzyhome + i); if (e && init_home_dir (e)) return; } char *drive = getenv ("HOMEDRIVE"); char *dir = getenv ("HOMEPATH"); if (drive && dir && strlen (drive) + strlen (dir) < sizeof path - 1) { strcpy (stpcpy (path, drive), dir); if (init_home_dir (path)) return; } if (read_conf (cfgInit, "logDir", path, sizeof path) && init_home_dir (path)) return; xsymbol_value (Qhome_dir) = xsymbol_value (Qmodule_dir); } static void init_load_path () { lisp l = make_string ("lisp"); xsymbol_value (Vload_path) = Qnil; if (Fequalp (xsymbol_value (Qmodule_dir), xsymbol_value (Qdefault_dir)) == Qnil) xsymbol_value (Vload_path) = xcons (Fmerge_pathnames (l, xsymbol_value (Qdefault_dir)), xsymbol_value (Vload_path)); xsymbol_value (Vload_path) = xcons (Fmerge_pathnames (l, xsymbol_value (Qmodule_dir)), xsymbol_value (Vload_path)); xsymbol_value (Vload_path) = xcons (Fmerge_pathnames (make_string ("site-lisp"), xsymbol_value (Qmodule_dir)), xsymbol_value (Vload_path)); } static void init_user_config_path (const char *config_path) { if (!config_path) config_path = getenv ("XYZZYCONFIGPATH"); if (config_path) { char path[PATH_MAX], *tem; int l = WINFS::GetFullPathName (config_path, sizeof path, path, &tem); if (l && l < sizeof path) { DWORD a = WINFS::GetFileAttributes (path); if (a != DWORD (-1) && a & FILE_ATTRIBUTE_DIRECTORY) { xsymbol_value (Quser_config_path) = make_path (path); return; } } } char *path = (char *)alloca (w2sl (xsymbol_value (Qmodule_dir)) + w2sl (xsymbol_value (Vuser_name)) + 32); char *p = stpcpy (w2s (path, xsymbol_value (Qmodule_dir)), "usr"); WINFS::CreateDirectory (path, 0); *p++ = '/'; p = w2s (p, xsymbol_value (Vuser_name)); WINFS::CreateDirectory (path, 0); *p++ = '/'; strcpy (p, sysdep.windows_short_name); WINFS::CreateDirectory (path, 0); DWORD a = WINFS::GetFileAttributes (path); if (a != DWORD (-1) && a & FILE_ATTRIBUTE_DIRECTORY) xsymbol_value (Quser_config_path) = make_path (path); else xsymbol_value (Quser_config_path) = xsymbol_value (Qmodule_dir); } static void init_user_inifile_path (const char *ini_file) { if (!ini_file) ini_file = getenv ("XYZZYINIFILE"); if (ini_file && find_slash (ini_file)) { char path[PATH_MAX], *tem; int l = WINFS::GetFullPathName (ini_file, sizeof path, path, &tem); if (l && l < sizeof path) { HANDLE h = CreateFile (path, GENERIC_READ, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, 0); if (h != INVALID_HANDLE_VALUE) { CloseHandle (h); app.ini_file_path = xstrdup (path); return; } } } if (!ini_file) ini_file = "xyzzy.ini"; char *path = (char *)alloca (w2sl (xsymbol_value (Quser_config_path)) + strlen (ini_file) + 32); strcpy (w2s (path, xsymbol_value (Quser_config_path)), ini_file); app.ini_file_path = xstrdup (path); } static void init_dump_path () { if (!*app.dump_image) { int l = GetModuleFileName (0, app.dump_image, PATH_MAX); char *e = app.dump_image + l; if (l > 4 && !_stricmp (e - 4, ".exe")) e -= 3; else *e++ = '.'; strcpy (e, sysdep.windows_short_name); } } static void init_env_symbols (const char *config_path, const char *ini_file) { xsymbol_value (Vfeatures) = xcons (Kxyzzy, xcons (Kieee_floating_point, Qnil)); xsymbol_value (Qdump_image_path) = make_path (app.dump_image, 0); init_module_dir (); init_current_dir (); init_environ (); init_user_config_path (config_path); init_user_inifile_path (ini_file); init_home_dir (); init_load_path (); init_windows_dir (); } #pragma optimize ("g", off) static void init_math_symbols () { #define CP(T, F) (xsymbol_value (T) = xsymbol_value (F)) xsymbol_value (Qmost_positive_single_float) = make_single_float (FLT_MAX); xsymbol_value (Qmost_negative_single_float) = make_single_float (-FLT_MAX); for (float fl = 1.0F, fe = 1.1F; fl && fe > fl; fe = fl, fl /= 2.0F) ; xsymbol_value (Qleast_positive_single_float) = make_single_float (fe); xsymbol_value (Qleast_negative_single_float) = make_single_float (-fe); xsymbol_value (Qleast_positive_normalized_single_float) = make_single_float (FLT_MIN); xsymbol_value (Qleast_negative_normalized_single_float) = make_single_float (-FLT_MIN); for (fl = 1.0F, fe = 1.1F; 1.0F + fl != 1.0F && fe > fl; fe = fl, fl /= 2.0F) ; xsymbol_value (Qsingle_float_epsilon) = make_single_float (fe); for (fl = 1.0F, fe = 1.1F; 1.0F - fl != 1.0F && fe > fl; fe = fl, fl /= 2.0F) ; xsymbol_value (Qsingle_float_negative_epsilon) = make_single_float (fe); CP (Qmost_positive_short_float, Qmost_positive_single_float); CP (Qmost_negative_short_float, Qmost_negative_single_float); CP (Qleast_positive_short_float, Qleast_positive_single_float); CP (Qleast_negative_short_float, Qleast_negative_single_float); CP (Qleast_positive_normalized_short_float, Qleast_positive_normalized_single_float); CP (Qleast_negative_normalized_short_float, Qleast_negative_normalized_single_float); CP (Qshort_float_epsilon, Qsingle_float_epsilon); CP (Qshort_float_negative_epsilon, Qsingle_float_negative_epsilon); xsymbol_value (Qmost_positive_double_float) = make_double_float (DBL_MAX); xsymbol_value (Qmost_negative_double_float) = make_double_float (-DBL_MAX); for (double dl = 1.0, de = 1.1; dl && de > dl; de = dl, dl /= 2.0) ; xsymbol_value (Qleast_positive_double_float) = make_double_float (de); xsymbol_value (Qleast_negative_double_float) = make_double_float (-de); xsymbol_value (Qleast_positive_normalized_double_float) = make_double_float (DBL_MIN); xsymbol_value (Qleast_negative_normalized_double_float) = make_double_float (-DBL_MIN); for (dl = 1.0, de = 1.1; 1.0 + dl != 1.0 && de > dl; de = dl, dl /= 2.0) ; xsymbol_value (Qdouble_float_epsilon) = make_double_float (de); for (dl = 1.0, de = 1.1; 1.0 - dl != 1.0 && de > dl; de = dl, dl /= 2.0) ; xsymbol_value (Qdouble_float_negative_epsilon) = make_double_float (de); CP (Qmost_positive_long_float, Qmost_positive_double_float); CP (Qleast_positive_long_float, Qleast_positive_double_float); CP (Qleast_negative_long_float, Qleast_negative_double_float); CP (Qmost_negative_long_float, Qmost_negative_double_float); CP (Qleast_positive_normalized_long_float, Qleast_positive_normalized_double_float); CP (Qleast_negative_normalized_long_float, Qleast_negative_normalized_double_float); CP (Qlong_float_epsilon, Qdouble_float_epsilon); CP (Qlong_float_negative_epsilon, Qdouble_float_negative_epsilon); xsymbol_value (Qmost_positive_fixnum) = make_fixnum (LONG_MAX); xsymbol_value (Qmost_negative_fixnum) = make_fixnum (LONG_MIN); xsymbol_value (Qpi) = make_double_float (M_PI); xsymbol_value (Qimag_two) = make_complex (make_fixnum (0), make_fixnum (2)); #undef CP } #pragma optimize ("", on) static void init_symbol_value_once () { xsymbol_value (Qt) = Qt; xsymbol_value (Vprint_readably) = Qnil; xsymbol_value (Vprint_escape) = Qt; xsymbol_value (Vprint_pretty) = Qt; xsymbol_value (Vprint_base) = make_fixnum (10); xsymbol_value (Vprint_radix) = Qnil; xsymbol_value (Vprint_circle) = Qnil; xsymbol_value (Vprint_length) = Qnil; xsymbol_value (Vprint_level) = Qnil; xsymbol_value (Vload_verbose) = Qt; xsymbol_value (Vload_print) = Qnil; xsymbol_value (Vload_pathname) = Qnil; xsymbol_value (Vrandom_state) = Fmake_random_state (Qt); xsymbol_value (Vdefault_random_state) = xsymbol_value (Vrandom_state); xsymbol_value (Qcall_arguments_limit) = make_fixnum (MAX_VECTOR_LENGTH); xsymbol_value (Qlambda_parameters_limit) = make_fixnum (MAX_VECTOR_LENGTH); xsymbol_value (Qmultiple_values_limit) = make_fixnum (MULTIPLE_VALUES_LIMIT); init_math_symbols (); init_readtable (); xsymbol_value (Qchar_code_limit) = make_fixnum (CHAR_LIMIT); xsymbol_value (Qarray_rank_limit) = make_fixnum (ARRAY_RANK_LIMIT); xsymbol_value (Qarray_dimension_limit) = make_fixnum (MAX_VECTOR_LENGTH); xsymbol_value (Qarray_total_size_limit) = make_fixnum (MAX_VECTOR_LENGTH); xsymbol_value (Qinternal_time_units_per_second) = make_fixnum (1000); xsymbol_value (Vcreate_buffer_hook) = Qnil; xsymbol_value (Vdefault_fileio_encoding) = xsymbol_value (Qencoding_sjis); xsymbol_value (Vexpected_fileio_encoding) = xsymbol_value (Qencoding_auto); xsymbol_value (Vdefault_eol_code) = make_fixnum (eol_crlf); xsymbol_value (Vexpected_eol_code) = make_fixnum (eol_guess); xsymbol_value (Qor_string_integer) = xcons (Qor, xcons (Qstring, xcons (Qinteger, Qnil))); xsymbol_value (Qor_symbol_integer) = xcons (Qor, xcons (Qsymbol, xcons (Qinteger, Qnil))); xsymbol_value (Qor_string_character) = xcons (Qor, xcons (Qstring, xcons (Qcharacter, Qnil))); xsymbol_value (Qor_integer_marker) = xcons (Qor, xcons (Qinteger, xcons (Qmarker, Qnil))); xsymbol_value (Qor_character_cons) = xcons (Qor, xcons (Qcharacter, xcons (Qcons, Qnil))); xsymbol_value (Qor_symbol_string) = xcons (Qor, xcons (Qsymbol, xcons (Qstring, Qnil))); xsymbol_value (Qor_string_stream) = xcons (Qor, xcons (Qstring, xcons (Qstream, Qnil))); xsymbol_value (Vread_default_float_format) = Qsingle_float; xsymbol_value (Vscroll_bar_step) = make_fixnum (2); xsymbol_value (Vglobal_keymap) = Fmake_keymap (); xsymbol_value (Vselection_keymap) = Qnil; xsymbol_value (Vkept_undo_information) = make_fixnum (1000); xsymbol_value (Vbuffer_read_only) = Qnil; xsymbol_value (Venable_meta_key) = Qt; xsymbol_value (Vlast_command_char) = Qnil; xsymbol_value (Vneed_not_save) = Qnil; xsymbol_value (Vauto_save) = Qt; xsymbol_value (Vbeep_on_error) = Qt; xsymbol_value (Vbeep_on_warn) = Qt; xsymbol_value (Vbeep_on_never) = Qnil; xsymbol_value (Vprefix_value) = Qnil; xsymbol_value (Vprefix_args) = Qnil; xsymbol_value (Vnext_prefix_value) = Qnil; xsymbol_value (Vnext_prefix_args) = Qnil; xsymbol_value (Vdefault_syntax_table) = Fmake_syntax_table (); xsymbol_value (Vauto_fill) = Qnil; xsymbol_value (Vthis_command) = Qnil; xsymbol_value (Vlast_command) = Qnil; xsymbol_value (Qsoftware_type) = make_string (ProgramName); xsymbol_value (Qsoftware_version) = make_string (VersionString); xsymbol_value (Qsoftware_version_display_string) = make_string (DisplayVersionString); xsymbol_value (Qtemporary_string) = make_string_simple ("", 0); xsymbol_value (Vversion_control) = Qt; xsymbol_value (Vkept_old_versions) = make_fixnum (2); xsymbol_value (Vkept_new_versions) = make_fixnum (2); xsymbol_value (Vmake_backup_files) = Qt; xsymbol_value (Vmake_backup_file_always) = Qnil; xsymbol_value (Vpack_backup_file_name) = Qt; xsymbol_value (Vauto_save_interval) = make_fixnum (256); xsymbol_value (Vauto_save_interval_timer) = make_fixnum (30); xsymbol_value (Vbackup_by_copying) = Qnil; xsymbol_value (Vinverse_mode_line) = Qt; xsymbol_value (Vbuffer_list_sort_ignore_case) = Qt; xsymbol_value (Veat_mouse_activate) = Qt; xsymbol_value (Vindent_tabs_mode) = Qt; xsymbol_value (Slock_file) = Qnil; xsymbol_value (Vexclusive_lock_file) = Qnil; xsymbol_value (Vcursor_shape) = Karrow; xsymbol_value (Vhide_restricted_region) = Qnil; xsymbol_value (Vfiler_last_command_char) = Qnil; xsymbol_value (Vfiler_dual_window) = Qnil; xsymbol_value (Vfiler_left_window_p) = Qt; xsymbol_value (Vfiler_secondary_directory) = Qnil; xsymbol_value (Vfiler_click_toggle_marks_always) = Qt; xsymbol_value (Vdll_module_list) = Qnil; xsymbol_value (Vfunction_bar_labels) = make_vector (MAX_FUNCTION_BAR_LABEL, Qnil); xsymbol_value (Vkeyword_hash_table) = Qnil; xsymbol_value (Vhighlight_keyword) = Qt; xsymbol_value (Vhtml_highlight_mode) = Qnil; xsymbol_value (Vblink_caret) = Qt; xsymbol_value (Vparentheses_hash_table) = Qnil; xsymbol_value (Vdefault_kinsoku_bol_chars) = Qnil; xsymbol_value (Vdefault_kinsoku_eol_chars) = Qnil; xsymbol_value (Vdde_timeout) = make_fixnum (30000); xsymbol_value (Vbrackets_is_wildcard_character) = Qt; init_char_encoding (); xsymbol_value (Vbypass_evalhook) = Qnil; xsymbol_value (Vbypass_applyhook) = Qnil; xsymbol_value (Vtitle_bar_format) = Qnil; xsymbol_value (Vstatus_bar_format) = Qnil; xsymbol_value (Vlast_status_bar_format) = Qnil; xsymbol_value (Vscroll_margin) = make_fixnum (0); xsymbol_value (Vjump_scroll_threshold) = make_fixnum (3); xsymbol_value (Vauto_update_per_device_directory) = Qt; xsymbol_value (Vmodal_filer_save_position) = Qt; xsymbol_value (Vmodal_filer_save_size) = Qt; xsymbol_value (Vfiler_echo_filename) = Qt; xsymbol_value (Vfiler_eat_esc) = Qt; xsymbol_value (Vsupport_mouse_wheel) = Qt; xsymbol_value (Vminibuffer_save_ime_status) = Qt; xsymbol_value (Vuse_shell_execute_ex) = Qt; xsymbol_value (Vshell_execute_disregards_shift_key) = Qt; xsymbol_value (Vregexp_keyword_list) = Qnil; xsymbol_value (Vunicode_to_half_width) = Qt; xsymbol_value (Vcolor_page_enable_dir_p) = Qnil; xsymbol_value (Vcolor_page_enable_subdir_p) = Qnil; } static void init_symbol_value () { xsymbol_value (Vquit_flag) = Qnil; xsymbol_value (Vinhibit_quit) = Qnil; xsymbol_value (Voverwrite_mode) = Qnil; xsymbol_value (Vprocess_list) = Qnil; xsymbol_value (Vminibuffer_message) = Qnil; xsymbol_value (Vsi_find_motion) = Qt; xsymbol_value (Vdefault_menu) = Qnil; xsymbol_value (Vlast_active_menu) = Qnil; xsymbol_value (Vreader_in_backquote) = Qnil; xsymbol_value (Vreader_preserve_white) = Qnil; xsymbol_value (Vread_suppress) = Qnil; xsymbol_value (Vreader_label_alist) = Qnil; xsymbol_value (Vclipboard_newer_than_kill_ring_p) = Qnil; xsymbol_value (Vkill_ring_newer_than_clipboard_p) = Qnil; xsymbol_value (Vkbd_encoding) = xsymbol_value (Qencoding_sjis); xsymbol_value (Qperformance_counter_frequency) = (sysdep.perf_counter_present_p ? make_integer (*(large_int *)&sysdep.perf_freq) : make_fixnum (1000)); xsymbol_value (Vsi_accept_kill_xyzzy) = Qt; xsymbol_value (Vlast_match_string) = Qnil; } static void init_command_line (int ac) { lisp p = Qnil; for (int i = __argc - 1; i >= ac; i--) p = xcons (make_string (__argv[i]), p); xsymbol_value (Vsi_command_line_args) = p; } void report_out_of_memory () { MessageBox (0, "メモリが不足しています", TitleBarString, MB_OK | MB_ICONHAND); } static inline int check_dump_key () { return (GetAsyncKeyState (VK_SHIFT) < 0 && GetAsyncKeyState (VK_CONTROL) < 0); } static int init_lisp_objects () { const char *config_path = 0, *ini_file = 0; *app.dump_image = 0; for (int ac = 1; ac < __argc - 1; ac += 2) if (!strcmp (__argv[ac], "-image")) { char *tem; int l = WINFS::GetFullPathName (__argv[ac + 1], sizeof app.dump_image, app.dump_image, &tem); if (!l || l >= sizeof app.dump_image) *app.dump_image = 0; } else if (!strcmp (__argv[ac], "-config")) config_path = __argv[ac + 1]; else if (!strcmp (__argv[ac], "-ini")) ini_file = __argv[ac + 1]; else break; try { init_dump_path (); if ((ac < __argc || !check_dump_key ()) && rdump_xyzzy ()) combine_syms (); else { init_syms (); init_symbol_value_once (); init_condition (); } init_symbol_value (); init_syntax_spec (); init_env_symbols (config_path, ini_file); xsymbol_value (Vconvert_registry_to_file_p) = boole (reg2ini ()); load_misc_colors (); init_command_line (ac); syntax_state::init_color_table (); create_std_streams (); } catch (nonlocal_jump &) { app.active_frame.selected = 0; report_out_of_memory (); return 0; } return 1; } static int init_editor_objects () { try { Window::create_default_windows (); create_default_buffers (); } catch (nonlocal_jump &) { app.active_frame.selected = 0; report_out_of_memory (); return 0; } return 1; } lisp Fsi_startup () { return Fsi_load_library (make_string ("startup"), Qnil); } static int register_wndclasses (HINSTANCE hinst) { WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = toplevel_wndproc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hinst; wc.hIcon = LoadIcon (hinst, MAKEINTRESOURCE (IDI_XYZZY)); wc.hCursor = sysdep.hcur_arrow; wc.hbrBackground = 0; wc.lpszMenuName = 0; wc.lpszClassName = Application::ToplevelClassName; app.atom_toplev = RegisterClass (&wc); if (!app.atom_toplev) return 0; wc.style = 0; wc.lpfnWndProc = frame_wndproc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hinst; wc.hIcon = 0; wc.hCursor = sysdep.hcur_arrow; wc.hbrBackground = 0; wc.lpszMenuName = 0; wc.lpszClassName = Application::FrameClassName; if (!RegisterClass (&wc)) return 0; wc.style = 0; wc.lpfnWndProc = client_wndproc; wc.cbClsExtra = 0; wc.cbWndExtra = sizeof (Window *); wc.hInstance = hinst; wc.hIcon = 0; wc.hCursor = sysdep.hcur_arrow; wc.hbrBackground = 0; wc.lpszMenuName = 0; wc.lpszClassName = Application::ClientClassName; if (!RegisterClass (&wc)) return 0; wc.style = 0; wc.lpfnWndProc = modeline_wndproc; wc.cbClsExtra = 0; wc.cbWndExtra = sizeof (Window *); wc.hInstance = hinst; wc.hIcon = 0; wc.hCursor = sysdep.hcur_sizens; wc.hbrBackground = HBRUSH (COLOR_BTNFACE + 1); wc.lpszMenuName = 0; wc.lpszClassName = Application::ModelineClassName; if (!RegisterClass (&wc)) return 0; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = fnkey_wndproc; wc.cbClsExtra = 0; wc.cbWndExtra = sizeof (void *); wc.hInstance = hinst; wc.hIcon = 0; wc.hCursor = sysdep.hcur_arrow; wc.hbrBackground = HBRUSH (COLOR_BTNFACE + 1); wc.lpszMenuName = 0; wc.lpszClassName = FunctionKeyClassName; if (!RegisterClass (&wc)) return 0; stdctl_hook_init (hinst); return 1; } static int __cdecl handle_new_failure (size_t) { FEstorage_error (); return 0; } static void copy_handle (DWORD f, int fd) { HANDLE o = GetStdHandle (f), n; HANDLE hproc = GetCurrentProcess (); if (DuplicateHandle (hproc, o, hproc, &n, 0, 0, DUPLICATE_SAME_ACCESS)) { _close (fd); _open_osfhandle (long (n), _O_TEXT | (fd ? 0 : _O_RDONLY)); SetStdHandle (f, n); } } static void pre_allocate_stack1 () { alloca (1024 * 1024); } static int pre_allocate_stack () { int ok = 1; try { pre_allocate_stack1 (); } catch (Win32Exception &) { ok = 0; } return ok; } static int sw_minimized_p (int sw) { switch (sw) { case SW_SHOWMINIMIZED: case SW_MINIMIZE: case SW_SHOWMINNOACTIVE: return 1; default: return 0; } } static inline int sw_maximized_p (int sw) { return sw == SW_SHOWMAXIMIZED; } static int init_app (HINSTANCE hinst, int passed_cmdshow, int &ole_initialized) { SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); app.toplev = 0; init_ucs2_table (); copy_handle (STD_INPUT_HANDLE, 0); copy_handle (STD_OUTPUT_HANDLE, 1); copy_handle (STD_ERROR_HANDLE, 2); Ctl3d::enable (hinst); _set_new_handler (handle_new_failure); _set_se_translator (se_handler); if (!pre_allocate_stack ()) { report_out_of_memory (); return 0; } if (*sysdep.host_name) strcpy (stpcpy (TitleBarString + strlen (TitleBarString), "@"), sysdep.host_name); if (!init_lisp_objects ()) return 0; app.hinst = hinst; if (!register_wndclasses (hinst)) return 0; InitPrivateControls (hinst); POINT point; SIZE size; int cmdshow = environ::load_geometry (passed_cmdshow, &point, &size); int restore_maximized = 0; if (sw_minimized_p (passed_cmdshow)) { restore_maximized = sw_maximized_p (cmdshow); cmdshow = passed_cmdshow; } else if (sw_maximized_p (passed_cmdshow)) cmdshow = passed_cmdshow; int show_normal = !sw_minimized_p (cmdshow) && !sw_maximized_p (cmdshow); xsymbol_value (Vsave_window_size) = boole (environ::save_window_size); xsymbol_value (Vsave_window_position) = boole (environ::save_window_position); xsymbol_value (Vrestore_window_size) = boole (environ::restore_window_size); xsymbol_value (Vrestore_window_position) = boole (environ::restore_window_position); ole_initialized = SUCCEEDED (OleInitialize (0)); app.toplev = CreateWindow (Application::ToplevelClassName, TitleBarString, WS_OVERLAPPEDWINDOW, point.x, point.y, size.cx, size.cy, HWND_DESKTOP, 0, hinst, 0); if (!app.toplev) return 0; mouse_state::install_hook (); init_listen_server (); sock::init_winsock (hinst); WINDOWPLACEMENT wp; wp.length = sizeof wp; GetWindowPlacement (app.toplev, &wp); if (point.x != CW_USEDEFAULT) { wp.rcNormalPosition.right -= wp.rcNormalPosition.left; wp.rcNormalPosition.bottom -= wp.rcNormalPosition.top; wp.rcNormalPosition.left = point.x; wp.rcNormalPosition.top = point.y; wp.rcNormalPosition.right += point.x; wp.rcNormalPosition.bottom += point.y; } if (restore_maximized) { wp.flags = WPF_RESTORETOMAXIMIZED; wp.showCmd = SW_SHOWMINIMIZED; } else { wp.flags = 0; wp.showCmd = cmdshow; } SetWindowPlacement (app.toplev, &wp); if (point.x != CW_USEDEFAULT && show_normal) SetWindowPos (app.toplev, 0, 0, 0, wp.rcNormalPosition.right - wp.rcNormalPosition.left, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); #ifndef WINDOWBLINDS_FIXED if (size.cx != CW_USEDEFAULT && show_normal) { RECT r; GetClientRect (app.toplev, &r); AdjustWindowRect (&r, WS_OVERLAPPEDWINDOW, 0); int aw = r.right - r.left, ah = r.bottom - r.top; GetWindowRect (app.toplev, &r); int ww = r.right - r.left, wh = r.bottom - r.top; ww = min (ww, aw); wh = min (wh, ah); SetWindowPos (app.toplev, 0, 0, 0, ww, wh, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); } #endif /* WINDOWBLINDS_FIXED */ if (!start_quit_thread ()) return 0; Fbegin_wait_cursor (); ShowWindow (app.toplev, cmdshow); if (sysdep.Win5p ()) UpdateWindow (app.toplev); app.modeline_param.init (HFONT (SendMessage (app.hwnd_sw, WM_GETFONT, 0, 0))); if (!init_editor_objects ()) return 0; try {Dde::initialize ();} catch (Dde::Exception &) {} return 1; } int PASCAL WinMain (HINSTANCE hinst, HINSTANCE, LPSTR, int cmdshow) { int ole_initialized = 0; if (init_app (hinst, cmdshow, ole_initialized)) { xyzzy_instance xi (app.toplev); MSG msg; while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { XyzzyTranslateMessage (&msg); DispatchMessage (&msg); } int terminate_normally = 0; try { int init_ok = 0; try { Ffuncall (Ssi_startup, Qnil); init_ok = 1; } catch (nonlocal_jump &) { print_condition (nonlocal_jump::data ()); } if (init_ok) { start_listen_server (); Fset_cursor (xsymbol_value (Vcursor_shape)); end_wait_cursor (1); app.kbdq.init_kbd_encoding (); while (1) { try { main_loop (); break; } catch (nonlocal_jump &) { } } } app.kbdq.gime.disable (); cleanup_lisp_objects (); terminate_normally = 1; } catch (Win32Exception &) { } if (!terminate_normally) { _set_se_translator (0); cleanup_exception (); } sock::term_winsock (); } mouse_state::remove_hook (); if (app.toplev) { end_listen_server (); DestroyWindow (app.toplev); } if (ole_initialized) OleUninitialize (); #ifdef DEBUG { _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR); for (Buffer *bp = Buffer::b_blist, *b_next; bp; bp = b_next) { b_next = bp->b_next; delete bp; } for (Window *wp = app.active_frame.windows, *w_next; wp; wp = w_next) { w_next = wp->w_next; delete wp; } g_frame.cleanup (); fflush (stdout); fflush (stderr); _CrtSetDbgFlag (_CrtSetDbgFlag (_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); } #endif return 0; }
[ [ [ 1, 1015 ] ] ]
f2e96de012563c44ace8c9e6733dd6a58e193b14
62874cd4e97b2cfa74f4e507b798f6d5c7022d81
/src/PropertiesEditor/PropertyWidgetFactory.cpp
e690c58a4f409db8b0c42686d069f8600c13e6cf
[]
no_license
rjaramih/midi-me
6a4047e5f390a5ec851cbdc1b7495b7fe80a4158
6dd6a1a0111645199871f9951f841e74de0fe438
refs/heads/master
2021-03-12T21:31:17.689628
2011-07-31T22:42:05
2011-07-31T22:42:05
36,944,802
0
0
null
null
null
null
UTF-8
C++
false
false
2,559
cpp
// Includes #include "PropertyWidgetFactory.h" #include "PropertyWidget.h" #include "PropertyWidgetCreator.h" #include "PropertyWidgetBool.h" #include "PropertyWidgetCompound.h" #include "PropertyWidgetInt.h" #include "PropertyWidgetUInt.h" #include "PropertyWidgetReal.h" #include "PropertyWidgetString.h" #include <Properties/Property.h> using namespace MidiMe; /************ * Singleton * ************/ PropertyWidgetFactory & PropertyWidgetFactory::getInstance() { static PropertyWidgetFactory instance; static bool initialized = false; if(!initialized) { initialized = true; instance.createStandardWidgetCreators(); } return instance; } /****************************** * Constructors and destructor * ******************************/ PropertyWidgetFactory::PropertyWidgetFactory() { } PropertyWidgetFactory::~PropertyWidgetFactory() { } /****************** * Other functions * ******************/ PropertyWidgetCreator * PropertyWidgetFactory::getCreator(const std::string &type) const { WidgetCreatorMap::const_iterator it = m_creators.find(type); return (it == m_creators.end()) ? NULL : it->second; } bool PropertyWidgetFactory::canCreate(const std::string &type) const { return m_creators.find(type) != m_creators.end(); } PropertyWidget * PropertyWidgetFactory::createWidget(Property *property) { PropertyWidgetCreator *pCreator = getCreator(property->getType()); if(!pCreator) return 0; return pCreator->createWidget(property); } bool PropertyWidgetFactory::destroyWidget(PropertyWidget *pProperty) { if (!pProperty) return false; // Get the creator of this property PropertyWidgetCreator *pCreator = getCreator(pProperty->getProperty()->getType()); if (!pCreator) return false; pCreator->destroyWidget(pProperty); return true; } /********************** * Protected functions * **********************/ void PropertyWidgetFactory::registerCreator(PropertyWidgetCreator *pCreator) { if (pCreator) m_creators[pCreator->getType()] = pCreator; } void PropertyWidgetFactory::unregisterCreator(PropertyWidgetCreator *pCreator) { if (pCreator) m_creators.erase(pCreator->getType()); } void PropertyWidgetFactory::createStandardWidgetCreators() { static PropertyWidgetCreatorBool boolCreator; static PropertyWidgetCreatorCompound compoundCreator; static PropertyWidgetCreatorInt intCreator; static PropertyWidgetCreatorUInt uintCreator; static PropertyWidgetCreatorReal realCreator; static PropertyWidgetCreatorString stringCreator; }
[ "Jeroen.Dierckx@d8a2fbcc-2753-0410-82a0-8bc2cd85795f" ]
[ [ [ 1, 112 ] ] ]
c45eb6df05ad4e52930f3ac58a8d969fee3a20eb
c95a83e1a741b8c0eb810dd018d91060e5872dd8
/Game/ObjectDLL/ObjectShared/AIRegion.h
da3332108f88cb2d48982509b6ddd7d74b7b80bb
[]
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
2,323
h
// (c) 1997-2000 Monolith Productions, Inc. All Rights Reserved #ifndef __AIREGION_H__ #define __AIREGION_H__ #include "ltengineobjects.h" #pragma warning( disable : 4786 ) #include <vector> LINKTO_MODULE( AIRegion ); class AINodeSearch; class CAI; class AIVolume; typedef std::vector<AIVolume*> AIREGION_VOLUME_LIST; class AIRegion : public BaseClass { public : static AIRegion* HandleToObject(HOBJECT hRegion) { return (AIRegion*)g_pLTServer->HandleToObject(hRegion); } public : // Ctors/Dtors/etc AIRegion(); ~AIRegion(); void Verify() {} // Engine uint32 EngineMessageFn (uint32 messageID, void *pData, LTFLOAT lData); LTBOOL ReadProp(ObjectCreateStruct *pData); void Load(ILTMessage_Read *pMsg); void Save(ILTMessage_Write *pMsg); // Methods const char* GetName() const { return g_pLTServer->GetStringData(m_hstrName); } void AddVolume(AIVolume* pVolume); void AddSearcher(CAI* pAI); void RemoveSearcher(CAI* pAI); HSTRING GetPostSearchMsg() { return m_cPostSearchMsgs >= 1 ? m_ahstrPostSearchMsgs[--m_cPostSearchMsgs] : LTNULL; } LTBOOL IsSearchable() const { return m_cSearchNodes > 0; } AINodeSearch* FindNearestSearchNode(const LTVector& vPos, LTFLOAT fCurTime) const; uint32 GetNumSearchNodes() const { return m_cSearchNodes; } AINodeSearch* GetSearchNode(uint32 iNode) { return ( iNode < m_cSearchNodes ) ? m_apSearchNodes[iNode] : LTNULL; } // const LTVector& GetExtentsMin() const { return m_vExtentsMin; } const LTVector& GetExtentsMin() const; const LTVector& GetExtentsMax() const { return m_vExtentsMax; } uint8 GetPsetByte(); public : enum Constants { kMaxPostSearchMsgs = 32, kMaxSearchNodes = 64, }; protected : HSTRING m_hstrName; AIREGION_VOLUME_LIST m_lstVolumes; AINodeSearch* m_apSearchNodes[kMaxSearchNodes]; uint32 m_cSearchNodes; uint32 m_cSearchers; uint32 m_cPostSearchMsgs; HSTRING m_ahstrPostSearchMsgs[kMaxPostSearchMsgs]; LTVector m_vExtentsMin; // Min extents of box containing all volumes in region. LTVector m_vExtentsMax; // Max extents of box containing all volumes in region. LTBOOL m_bPSets[8]; // Optional Permission sets (on/off) }; #endif
[ [ [ 1, 92 ] ] ]
83c6c2fbd3bb6d5d000004930e0b4872373a5c7d
15732b8e4190ae526dcf99e9ffcee5171ed9bd7e
/INC/StdTS.h
69e60379a0b8a7f8134d098657a6e22cce948439
[]
no_license
clovermwliu/whutnetsim
d95c07f77330af8cefe50a04b19a2d5cca23e0ae
924f2625898c4f00147e473a05704f7b91dac0c4
refs/heads/master
2021-01-10T13:10:00.678815
2010-04-14T08:38:01
2010-04-14T08:38:01
48,568,805
0
0
null
null
null
null
UTF-8
C++
false
false
426
h
#ifndef __STDTS_H__ #define __STDTS_H__ #pragma once #include "HiberTopoBase.h" #include "PlatTopoBase.h" #include <string> using namespace std; class CStdTS : public CHiberTopoBase { public: CStdTS(); ~CStdTS(void); public: bool GenerateTopo(); void SetLocationViaBoundBox(const Location& BoundBoxLeftDown, const Location& BoundBoxRightUpper, BoxType type = DEFAULT); }; #endif
[ "pengelmer@f37e807c-cba8-11de-937e-2741d7931076" ]
[ [ [ 1, 22 ] ] ]
ebbdf4642a06103ce17218f05338a51f7859153b
8f8cc0ed96d272f1aee79becfc1138538abbefc9
/prototype/bdk/Stategenerator/stdafx.cpp
ece7a62294384163d8ec9078436ba1fdded54b57
[]
no_license
BackupTheBerlios/picdatcom-svn
0a417abb3b60df6aedb47c0eb52998d262e459b7
0696c6d6e0c7158ede88908257abea0e0a7e303c
refs/heads/master
2016-09-02T07:52:18.882862
2010-06-10T22:43:50
2010-06-10T22:43:50
40,800,263
0
0
null
null
null
null
ISO-8859-1
C++
false
false
321
cpp
// stdafx.cpp : Quelldatei, die nur die Standard-Includes einbindet. // Stategenerator.pch ist der vorkompilierte Header. // stdafx.obj enthält die vorkompilierten Typinformationen. #include "stdafx.h" // TODO: Auf zusätzliche Header verweisen, die in STDAFX.H // und nicht in dieser Datei erforderlich sind.
[ "uwebr@161c6524-834b-0410-aead-e7223efaf009" ]
[ [ [ 1, 8 ] ] ]
6ee26b40f604a300aeef5275b24c912ddd47f14a
968aa9bac548662b49af4e2b873b61873ba6f680
/imgtools/imgcheck/libimgutils/inc/romreader.h
72ebb9e3bf5355c49766dc4edbd3d9f3c2d47b01
[]
no_license
anagovitsyn/oss.FCL.sftools.dev.build
b3401a1ee3fb3c8f3d5caae6e5018ad7851963f3
f458a4ce83f74d603362fe6b71eaa647ccc62fee
refs/heads/master
2021-12-11T09:37:34.633852
2010-12-01T08:05:36
2010-12-01T08:05:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,691
h
/* * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * @internalComponent * @released * */ #ifndef ROMREADER_H #define ROMREADER_H #include <e32image.h> #include "imagereader.h" class TRomRootDirectoryList; class TRomDir; class TRomImageHeader; class TRomEntry; class RomImageFSEntry; class RomImageHeader; const string KEpocIdentifier("EPOC"); const string KRomImageIdentifier("ROM"); const unsigned int KLdrOpcode = 0xe51ff004; const unsigned int KRomBase = 0x80000000; const unsigned int KRomBaseMaxLimit = 0x82000000; /** Class for ROM reader @internalComponent @released */ class RomReader : public ImageReader { public: RomReader(const char* aFile, EImageType aImgType ); ~RomReader(void); static bool IsRomImage(const string& aWord); static bool IsRomExtImage(const string& aWord); void ReadImage(void); void ProcessImage(void); void BuildDir(TRomDir *aDir, RomImageFSEntry* aPaFSEntry); void BuildDir(short int *aOffsetTbl, short int aOffsetTblCount, TRomDir *aDir, RomImageFSEntry* aPaFSEntry); void GetRomDirTbl(short int** aBase, short int& aCount, TRomDir *aRomDir); void AddChild(RomImageFSEntry *aPa, RomImageFSEntry *aChild, TRomEntry* aRomEntry); const unsigned long int ImageCompressionType(void) const; const char* RomHdrPtr(void) const; const unsigned long int RomBase(void) const; const unsigned int HdrSize(void) const; const unsigned long int RootDirList(void) const; const unsigned int ImgSize() const; void PrepareExecutableList(void); ExeNamesVsDepListMap& GatherDependencies(void); void PrepareAddVsExeMap(void); void CollectImportExecutableNames(const RomImageFSEntry* aEntry, StringList& aImportExecutables); unsigned int CodeSectionAddress(unsigned int& aImageAddress); void PrepareExeVsIdMap(void); const ExeVsIdDataMap& GetExeVsIdMap(void) const; void PrepareExeVsRomFsEntryMap(void); RomImageHeader *iImageHeader; TRomRootDirectoryList *iRootDirList; RomImageFSEntry *iRomImageRootDirEntry; unsigned char *iData; ExeVsRomFsEntryMap iExeVsRomFsEntryMap; EImageType iImgType; RomAddrVsExeName iAddVsExeMap; VectorList iImageAddress; static bool iNoRomLoaderHeader; }; #endif //ROMREADER_H
[ "none@none" ]
[ [ [ 1, 92 ] ] ]
c4940fba026b33f6275a3e1b1304627a9f409aa1
1cc5720e245ca0d8083b0f12806a5c8b13b5cf98
/uva/src/dois/272/p272.cpp
6a2c0ab700bb03875d5b49922908c36159ae4c1c
[]
no_license
Emerson21/uva-problems
399d82d93b563e3018921eaff12ca545415fd782
3079bdd1cd17087cf54b08c60e2d52dbd0118556
refs/heads/master
2021-01-18T09:12:23.069387
2010-12-15T00:38:34
2010-12-15T00:38:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
399
cpp
/* @JUDGE_ID: 39315ZN 272 C++ "Largura" */ #include <iostream> #include <stdio.h> using namespace std; int main(int argc, char **argv) { bool primeira = true; char c; while(scanf("%c",&c)==1) { if(c=='\"') { if(primeira) { cout << "``"; } else { cout << "''"; } primeira = !primeira; } else { cout << c; } } return 0; }
[ [ [ 1, 30 ] ] ]
4cd2d6119be32ed49c2da37ce90cdf8e3016ccf7
5236606f2e6fb870fa7c41492327f3f8b0fa38dc
/srpc/include/srpc/StringTypes.h
76d42f00f4c4c773d60ea7f7916a4d23b291e792
[]
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,331
h
#ifndef SRPC_STRINGTYPES_H #define SRPC_STRINGTYPES_H #ifdef _MSC_VER # pragma once #endif // 문자열 관련 타입을 정의한다 #include "srpc.h" #include "detail/Allocator.h" #include <sstream> #include <string> namespace srpc { /** @addtogroup types * @{ */ // = String types typedef std::basic_string<char, std::char_traits<char>, SrpcStringAllocator<char> > String; typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, SrpcStringAllocator<wchar_t> > WString; // = String stream types typedef std::basic_istringstream<char, std::char_traits<char>, SrpcStringAllocator<char> > IStringStream; typedef std::basic_ostringstream<char, std::char_traits<char>, SrpcStringAllocator<char> > OStringStream; typedef std::basic_istringstream<wchar_t, std::char_traits<wchar_t>, SrpcStringAllocator<wchar_t> > WIStringStream; typedef std::basic_ostringstream<wchar_t, std::char_traits<wchar_t>, SrpcStringAllocator<wchar_t> > WOStringStream; /// "" SRPC_API extern const String null_string; /// L"" SRPC_API extern const WString null_wstring; /** @} */ // addtogroup types } // namespace srpc #endif // SRPC_STRINGTYPES_H
[ "kcando@6d7ccee0-1a3b-0410-bfa1-83648d9ec9a4" ]
[ [ [ 1, 65 ] ] ]
565f389fc36392e1e521a92cbb75cd8d068ad854
ea2786bfb29ab1522074aa865524600f719b5d60
/MultimodalSpaceShooter/src/entities/Entity.h
f8e5fd92a3d38f41d8738e14800e922ee71dd450
[]
no_license
jeremysingy/multimodal-space-shooter
90ffda254246d0e3a1e25558aae5a15fed39137f
ca6e28944cdda97285a2caf90e635a73c9e4e5cd
refs/heads/master
2021-01-19T08:52:52.393679
2011-04-12T08:37:03
2011-04-12T08:37:03
1,467,691
0
1
null
null
null
null
UTF-8
C++
false
false
887
h
#ifndef ENTITY_H #define ENTITY_H #include <SFML/Graphics/Shape.hpp> namespace Object { enum Type { NEUTRAL, PLAYER, DESTRUCTIVE, WEAPON, }; } class Entity { public: Entity(Object::Type type = Object::NEUTRAL); virtual ~Entity(); virtual void update(float frameTime) = 0; virtual void draw(sf::RenderTarget& window) const = 0; virtual sf::FloatRect getBoundingRect() const = 0; virtual void onCollision(Object::Type otherType, const sf::FloatRect& area); Object::Type getType() const; void destroy(); bool isDestroyed() const; protected: Object::Type myType; private: Entity(const Entity&); Entity& operator =(const Entity&); bool myIsDestroyed; }; #endif // ENTITY_H
[ [ [ 1, 43 ] ] ]
5c2d28b318cf64ddbb6c93da5f22881fec9a53a3
c70941413b8f7bf90173533115c148411c868bad
/core/src/vtxGlyphResource.cpp
6c58be0d5e042211796a541f93e38f96c707cbbd
[]
no_license
cnsuhao/vektrix
ac6e028dca066aad4f942b8d9eb73665853fbbbe
9b8c5fa7119ff7f3dc80fb05b7cdba335cf02c1a
refs/heads/master
2021-06-23T11:28:34.907098
2011-03-27T17:39:37
2011-03-27T17:39:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,684
cpp
/* ----------------------------------------------------------------------------- This source file is part of "vektrix" (the rich media and vector graphics rendering library) For the latest info, see http://www.fuse-software.com/ Copyright (c) 2009-2010 Fuse-Software (tm) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- */ #include "vtxGlyphResource.h" #include "vtxFontResource.h" #include "vtxLogManager.h" namespace vtx { //----------------------------------------------------------------------- GlyphResource::GlyphResource(FontResource* parent) : mIndex(0), mCode(0), mAdvance(0.0f), mParent(parent) { } //----------------------------------------------------------------------- GlyphResource::~GlyphResource() { } //----------------------------------------------------------------------- void GlyphResource::setIndex(const uint& index) { mIndex = index; } //----------------------------------------------------------------------- const uint& GlyphResource::getIndex() const { return mIndex; } //----------------------------------------------------------------------- void GlyphResource::setCode(const ushort& code) { if(code == 65) VTX_LOG("CHAR: %c %4.2f %4.2f", (char)code, mBoundingBox.getWidth(), mBoundingBox.getHeight()); //for_each(it, ShapeElementList, mShapeElements) //{ // ShapeElement& element = *it; // switch(element.type) // { // case ShapeElement::SID_MOVE_TO: // std::cout << "move: " << element.pos.x << " " << element.pos.y << std::endl; // break; // case ShapeElement::SID_CURVE_TO: // std::cout << "curve: " << element.ctrl.x << " " << element.ctrl.y << std::endl; // std::cout << "to: " << element.pos.x << " " << element.pos.y << std::endl; // break; // case ShapeElement::SID_LINE_TO: // std::cout << "line: " << element.pos.x << " " << element.pos.y << std::endl; // break; // } //} mCode = code; mParent->_notifyGlyphCode(mCode, this); } //----------------------------------------------------------------------- const ushort& GlyphResource::getCode() const { return mCode; } //----------------------------------------------------------------------- const float& GlyphResource::getAdvance() const { return mAdvance; } //----------------------------------------------------------------------- void GlyphResource::setAdvance(const float& advance) { mAdvance = advance; } //----------------------------------------------------------------------- void GlyphResource::addShapeElement(ShapeElement element, const bool& auto_extend_bb) { if(auto_extend_bb) { mBoundingBox.extend(element.pos); if(element.type == ShapeElement::SID_CURVE_TO) mBoundingBox.extend(element.ctrl); } mShapeElements.push_back(element); } //----------------------------------------------------------------------- const ShapeElementList& GlyphResource::getElementList() const { return mShapeElements; } //----------------------------------------------------------------------- void GlyphResource::setBoundingBox(const BoundingBox& bb) { mBoundingBox = bb; } //----------------------------------------------------------------------- const BoundingBox& GlyphResource::getBoundingBox() const { return mBoundingBox; } //----------------------------------------------------------------------- FontResource* GlyphResource::getParentFont() const { return mParent; } //----------------------------------------------------------------------- }
[ "stonecold_@9773a11d-1121-4470-82d2-da89bd4a628a" ]
[ [ [ 1, 137 ] ] ]
f2a8eae645f8670a18fbdbf43fff95debd2c5542
bfdfb7c406c318c877b7cbc43bc2dfd925185e50
/engine/test/Test_HSca_List.cpp
a3e632327a3579fd5fa550c7cbbe084fb6b847c3
[ "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,943
cpp
/* -*- coding: sjis-dos; -*- */ /* * copyright 2010 FUKUZAWA Tadashi. All rights reserved. */ #include "../stdlib/ffiout/HSca_List.h" #include "hyValue.h" #include <cppunit/extensions/HelperMacros.h> #include <cppunit/ui/text/TestRunner.h> using namespace Hayat::Common; using namespace Hayat::Ffi::HScb_stdlib; class Test_HSca_List : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(Test_HSca_List); CPPUNIT_TEST(test_HSca_List); CPPUNIT_TEST_SUITE_END(); public: void* hayatMemory; Context* context; void setUp(void) { hayatMemory = HMD_ALLOC(20480); initMemory(hayatMemory, 20480); initStdlib(); context = gCodeManager.createContext(); } void tearDown(void) { finalizeAll(); HMD_FREE(hayatMemory); } static bool isEqual(Context* context, ValueList* a, ValueList* b) { context->pushList(a); context->pushList(b); HSca_List::m_HSfx_3d3d(context, 1); return context->popBool(); } void test_HSca_List(void) { context->pushList(NULL); HSca_List::m_HSfq_empty_0(context, 0); CPPUNIT_ASSERT_EQUAL(true, context->popBool()); context->pushInt(1001); context->pushList(NULL); context->pushClass(HC_List); HSca_List::m_HSfa_cons(context, 2); ValueList* x = context->popList(); CPPUNIT_ASSERT_EQUAL(1001, x->head().toInt()); context->pushFloat(2002.25f); context->pushList(x); context->pushClass(HC_List); HSca_List::m_HSfa_cons(context, 2); x = context->popList(); context->pushList(x); HSca_List::m_HSfa_head(context, 0); CPPUNIT_ASSERT_EQUAL(2002.25f, context->popFloat()); context->pushList(x); HSca_List::m_HSfa_tail(context, 0); ValueList* y = context->popList(); CPPUNIT_ASSERT_EQUAL(1001, y->head().toInt()); // now x == '(2002.25, 1001) context->pushInt(567); context->pushList(NULL); context->pushClass(HC_List); HSca_List::m_HSfa_cons(context, 2); y = context->popList(); context->pushInt(34); context->pushList(y); context->pushClass(HC_List); HSca_List::m_HSfa_cons(context, 2); y = context->popList(); // now y == '(34, 567) context->pushList(x); context->pushList(y); HSca_List::m_HSfa_append_1(context, 1); ValueList* z = context->popList(); CPPUNIT_ASSERT(z != x); CPPUNIT_ASSERT(z != y); CPPUNIT_ASSERT(!isEqual(context,z,x)); CPPUNIT_ASSERT(!isEqual(context,z,y)); // now z == '(34, 567, 2002.25, 1001) context->pushList(z); HSca_List::m_HSfa_clone_0(context, 0); y = context->popList(); Value t[4]; t[0] = Value::fromInt(34); t[1] = Value::fromInt(567); t[2] = Value::fromFloat(2002.25); t[3] = Value::fromInt(1001); int i = 0; while (z != NULL) { CPPUNIT_ASSERT(i < 4); CPPUNIT_ASSERT(y != NULL); CPPUNIT_ASSERT(y != z); CPPUNIT_ASSERT(isEqual(context,z,y)); context->pushList(z); HSca_List::m_HSfa_head(context, 0); Value v = context->pop(); CPPUNIT_ASSERT(v.type == t[i].type); CPPUNIT_ASSERT(v.data == t[i].data); context->pushList(z); HSca_List::m_HSfa_tail(context, 0); z = context->popList(); context->pushList(y); HSca_List::m_HSfa_tail(context, 0); y = context->popList(); ++i; } CPPUNIT_ASSERT(y == NULL); } }; CPPUNIT_TEST_SUITE_REGISTRATION(Test_HSca_List);
[ [ [ 1, 134 ] ] ]
bbd548854131481614b6bc8787c1ead1a709533b
16052d8fae72cecb6249372b80fe633251685e1d
/distances/single_link.h
02b94c9115380a149151d778fe5f155694749949
[]
no_license
istrandjev/hierarhical-clustering
7a9876c5c6124488162f4089d7888452a53595a6
adad22cce42d68b04cca747352d94df039e614a2
refs/heads/master
2021-01-19T14:59:08.593414
2011-06-29T06:07:41
2011-06-29T06:07:41
32,250,503
0
0
null
null
null
null
UTF-8
C++
false
false
444
h
#ifndef NEAREST_NEIGHBOUR_HPP #define NEAREST_NEIGHBOUR_HPP #include "distance.h" class Cluster; class HierarchicalClustering; class SingleLink: public Distance { public: virtual double mergedDistance(const Cluster& leftFromCluster, const Cluster& rightFromCluster, const Cluster& toCluster, HierarchicalClustering& hierarchicalClustering) const; virtual std::string getName() const; }; #endif //NEAREST_NEIGHBOUR_HPP
[ "[email protected]@c0cadd32-5dbd-3e50-b098-144b922aa411", "[email protected]@c0cadd32-5dbd-3e50-b098-144b922aa411" ]
[ [ [ 1, 8 ], [ 10, 17 ] ], [ [ 9, 9 ] ] ]
1dc0845ef6d894729c677d14b2857bdf23dbe6ca
6a61cc5e7845f122a197b2630af2fd4e795e1b8b
/texture.h
e28ff9506671c718c2ceda8e7dd89ceafaf4ad88
[]
no_license
dagtornes/eit-kode
e952919aa32019732421bee01bee0599a1c59c2e
a48a439cd143342d750c33cf1569e8f90db29b11
refs/heads/master
2021-05-27T14:28:01.437788
2011-03-30T14:22:15
2011-03-30T14:22:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
746
h
#pragma once /* Supported formats: png Fixed state? */ class textureObject { public: GLuint texture; textureObject() { texture = NULL; } ~textureObject() { if(texture!=NULL) glDeleteTextures(1, &texture); } bool loadTexture(const char *filename) { glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); return true; } }; //void setTextureState (bilinar point ect
[ [ [ 1, 38 ] ] ]
5ec335d8fb61c36bde9e8bae1e00727efa66a533
d54d8b1bbc9575f3c96853e0c67f17c1ad7ab546
/hlsdk-2.3-p3/multiplayer/ricochet/cl_dll/ammohistory.cpp
565a3529c821f9bdf83234eae31e8c4dcff02d7f
[]
no_license
joropito/amxxgroup
637ee71e250ffd6a7e628f77893caef4c4b1af0a
f948042ee63ebac6ad0332f8a77393322157fa8f
refs/heads/master
2021-01-10T09:21:31.449489
2010-04-11T21:34:27
2010-04-11T21:34:27
47,087,485
1
0
null
null
null
null
UTF-8
C++
false
false
5,614
cpp
/*** * * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. * * This product contains software technology licensed from Id * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting * object code is restricted to non-commercial enhancements to products from * Valve LLC. All other use, distribution, or modification is prohibited * without written permission from Valve LLC. * ****/ // // ammohistory.cpp // #include "hud.h" #include "cl_util.h" #include "parsemsg.h" #include <string.h> #include <stdio.h> #include "ammohistory.h" HistoryResource gHR; #define AMMO_PICKUP_GAP (gHR.iHistoryGap+5) #define AMMO_PICKUP_PICK_HEIGHT (32 + (gHR.iHistoryGap * 2)) #define AMMO_PICKUP_HEIGHT_MAX (ScreenHeight - 100) #define MAX_ITEM_NAME 32 int HISTORY_DRAW_TIME = 5; // keep a list of items struct ITEM_INFO { char szName[MAX_ITEM_NAME]; HSPRITE spr; wrect_t rect; }; void HistoryResource :: AddToHistory( int iType, int iId, int iCount ) { if ( iType == HISTSLOT_AMMO && !iCount ) return; // no amount, so don't add if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) ) { // the pic would have to be drawn too high // so start from the bottom iCurrentHistorySlot = 0; } HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot HISTORY_DRAW_TIME = CVAR_GET_FLOAT( "hud_drawhistory_time" ); freeslot->type = iType; freeslot->iId = iId; freeslot->iCount = iCount; freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME; } void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount ) { if ( iType != HISTSLOT_ITEM ) return; if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) ) { // the pic would have to be drawn too high // so start from the bottom iCurrentHistorySlot = 0; } HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot // I am really unhappy with all the code in this file int i = gHUD.GetSpriteIndex( szName ); if ( i == -1 ) return; // unknown sprite name, don't add it to history freeslot->iId = i; freeslot->type = iType; freeslot->iCount = iCount; HISTORY_DRAW_TIME = CVAR_GET_FLOAT( "hud_drawhistory_time" ); freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME; } void HistoryResource :: CheckClearHistory( void ) { for ( int i = 0; i < MAX_HISTORY; i++ ) { if ( rgAmmoHistory[i].type ) return; } iCurrentHistorySlot = 0; } // // Draw Ammo pickup history // int HistoryResource :: DrawAmmoHistory( float flTime ) { for ( int i = 0; i < MAX_HISTORY; i++ ) { if ( rgAmmoHistory[i].type ) { rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); if ( rgAmmoHistory[i].DisplayTime <= flTime ) { // pic drawing time has expired memset( &rgAmmoHistory[i], 0, sizeof(HIST_ITEM) ); CheckClearHistory(); } else if ( rgAmmoHistory[i].type == HISTSLOT_AMMO ) { wrect_t rcPic; HSPRITE *spr = gWR.GetAmmoPicFromWeapon( rgAmmoHistory[i].iId, rcPic ); int r, g, b; UnpackRGB(r,g,b, RGB_YELLOWISH); float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80; ScaleColors(r, g, b, min(scale, 255) ); // Draw the pic int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); int xpos = ScreenWidth - 24; if ( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic { // the dll has to make sure it has sent info the weapons you need SPR_Set( *spr, r, g, b ); SPR_DrawAdditive( 0, xpos, ypos, &rcPic ); } // Draw the number gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b ); } else if ( rgAmmoHistory[i].type == HISTSLOT_WEAP ) { WEAPON *weap = gWR.GetWeapon( rgAmmoHistory[i].iId ); if ( !weap ) return 1; // we don't know about the weapon yet, so don't draw anything int r, g, b; UnpackRGB(r,g,b, RGB_YELLOWISH); if ( !gWR.HasAmmo( weap ) ) UnpackRGB(r,g,b, RGB_REDISH); // if the weapon doesn't have ammo, display it as red float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80; ScaleColors(r, g, b, min(scale, 255) ); int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); int xpos = ScreenWidth - (weap->rcInactive.right - weap->rcInactive.left); SPR_Set( weap->hInactive, r, g, b ); SPR_DrawAdditive( 0, xpos, ypos, &weap->rcInactive ); } else if ( rgAmmoHistory[i].type == HISTSLOT_ITEM ) { int r, g, b; if ( !rgAmmoHistory[i].iId ) continue; // sprite not loaded wrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId ); UnpackRGB(r,g,b, RGB_YELLOWISH); float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80; ScaleColors(r, g, b, min(scale, 255) ); int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); int xpos = ScreenWidth - (rect.right - rect.left) - 10; SPR_Set( gHUD.GetSprite( rgAmmoHistory[i].iId ), r, g, b ); SPR_DrawAdditive( 0, xpos, ypos, &rect ); } } } return 1; }
[ "joropito@23c7d628-c96c-11de-a380-73d83ba7c083" ]
[ [ [ 1, 190 ] ] ]
85fa46ba1c8a098bee3e7438a315e1de47167475
85c91b680d74357b379204ecf7643ae1423f8d1e
/branches/pre_mico_2_3-12/examples/services/monitoring_service/container_service_MonImpl/container_service_MonImpl.cpp
ae595cf1e148a21ba8eaa04076745428f27a0866
[]
no_license
BackupTheBerlios/qedo-svn
6fdec4ca613d24b99a20b138fb1488f1ae9a80a2
3679ffe8ac7c781483b012dbef70176e28fea174
refs/heads/master
2020-11-26T09:42:37.603285
2010-07-02T10:00:26
2010-07-02T10:00:26
40,806,890
0
0
null
null
null
null
UTF-8
C++
false
false
7,032
cpp
// // generated by Qedo // #include "container_service_MonImpl.h" // BEGIN USER INSERT SECTION file // END USER INSERT SECTION file namespace container_service { // BEGIN USER INSERT SECTION MonExec unsigned long MonExec::get_new_event_number() { Qedo::QedoLock lock (counter_mutex); counter++; return counter; }; IOP::Codec_ptr MonExec::get_cdr_codec_ptr() { return m_cdrCodec.in(); } // END USER INSERT SECTION MonExec MonExec::MonExec() { // BEGIN USER INSERT SECTION MonExec::MonExec counter = 0; //codec int dummy = 0; CORBA::ORB_var orb = CORBA::ORB_init (dummy, 0); CORBA::Object_var obj = orb->resolve_initial_references ("CodecFactory"); IOP::CodecFactory_var factory = IOP::CodecFactory::_narrow(obj); if ( CORBA::is_nil(factory) ) { std::cout << "no CDR" << std::endl; return; } /* * Create codec */ IOP::Encoding how; how.major_version = 1; how.minor_version = 0; how.format = IOP::ENCODING_CDR_ENCAPS; try { m_cdrCodec = factory->create_codec(how); } catch(const IOP::CodecFactory::UnknownEncoding& _ex) { std::cout << "no CDR" << std::endl; } // END USER INSERT SECTION MonExec::MonExec } MonExec::~MonExec() { // BEGIN USER INSERT SECTION MonExec::~MonExec // END USER INSERT SECTION MonExec::~MonExec } void MonExec::set_context(::container_service::CCM_monitor_ContextImpl_ptr context) throw (CORBA::SystemException, Components::CCMException) { context_ = ::container_service::CCM_monitor_ContextImpl::_duplicate(context); } void MonExec::configuration_complete() throw (CORBA::SystemException, Components::InvalidConfiguration) { // BEGIN USER INSERT SECTION MonExec::configuration_complete std::cout << "Monitorung Serivce: configuration_complete" << std::endl; Components::ContainerPortableInterceptor::ServerContainerInterceptorRegistration_ptr server_reg = context_->get_server_interceptor_dispatcher_registration(); server_interceptor_ = new Qedo::ServerContainerInterceptor(context_,this); server_cookie_ = server_reg->register_server_interceptor(server_interceptor_); Components::ContainerPortableInterceptor::ClientContainerInterceptorRegistration_ptr client_reg = context_->get_client_interceptor_dispatcher_registration(); client_interceptor_ = new Qedo::ClientContainerInterceptor(context_,this); client_reg->register_client_interceptor(client_interceptor_); // std::string component_id = ""; // server_reg->register_interceptor_for_component(server_interceptor_, component_id.c_str()); // context_->register_servant_locator_for_all(server_interceptor_); // END USER INSERT SECTION MonExec::configuration_complete } void MonExec::remove() throw (CORBA::SystemException) { // BEGIN USER INSERT SECTION MonExec::remove Components::ContainerPortableInterceptor::ServerContainerInterceptorRegistration_ptr server_reg = context_->get_server_interceptor_dispatcher_registration(); server_reg->unregister_server_interceptor(server_cookie_); Components::ContainerPortableInterceptor::ClientContainerInterceptorRegistration_ptr client_reg = context_->get_client_interceptor_dispatcher_registration(); client_reg->unregister_client_interceptor(client_cookie_); // END USER INSERT SECTION MonExec::remove } // BEGIN USER INSERT SECTION MonImpl // END USER INSERT SECTION MonImpl MonImpl::MonImpl() :component_(new MonExec()) { // BEGIN USER INSERT SECTION MonImpl::MonImpl // END USER INSERT SECTION MonImpl::MonImpl } MonImpl::~MonImpl() { // BEGIN USER INSERT SECTION MonImpl::~MonImpl // END USER INSERT SECTION MonImpl::~MonImpl component_->_remove_ref(); } ::CORBA::Object* MonImpl::obtain_executor(const char* name) throw (CORBA::SystemException) { if (! strcmp ( name, "component" ) ) { return Components::EnterpriseComponent::_duplicate (component_); } return Components::EnterpriseComponent::_nil(); } void MonImpl::release_executor(::CORBA::Object_ptr executor) throw (CORBA::SystemException) { CORBA::release (executor); } void MonImpl::configuration_complete() throw (CORBA::SystemException, Components::InvalidConfiguration) { component_->configuration_complete(); // BEGIN USER INSERT SECTION MonImpl::configuration_complete // register_container_interceptors(context_); // END USER INSERT SECTION MonImpl::configuration_complete } void MonImpl::set_extension_context(::Components::ExtensionContext_ptr context) throw (CORBA::SystemException, Components::CCMException) { #ifdef TAO_ORB ::container_service::CCM_monitor_Context_ptr tmp_context; tmp_context = dynamic_cast<::container_service::CCM_monitor_ContextImpl*>(context); if (tmp_context) context_ = ::container_service::CCM_monitor_ContextImpl::_duplicate(tmp_context); else context_ = ::container_service::CCM_monitor_ContextImpl::_nil(); #else context_ = ::container_service::CCM_monitor_ContextImpl::_narrow(context); #endif component_->set_context(context_); } void MonImpl::ccm_activate() throw (CORBA::SystemException, Components::CCMException) { // BEGIN USER INSERT SECTION MonImpl::ccm_activate // END USER INSERT SECTION MonImpl::ccm_activate } void MonImpl::ccm_passivate() throw (CORBA::SystemException, Components::CCMException) { // BEGIN USER INSERT SECTION MonImpl::ccm_passivate // END USER INSERT SECTION MonImpl::ccm_passivate } void MonImpl::ccm_remove() throw (CORBA::SystemException, Components::CCMException) { // BEGIN USER INSERT SECTION MonImpl::ccm_remove // END USER INSERT SECTION MonImpl::ccm_remove } // BEGIN USER INSERT SECTION HomeMonExec // END USER INSERT SECTION HomeMonExec HomeMonExec::HomeMonExec() { // BEGIN USER INSERT SECTION HomeMonExec::HomeMonExec // END USER INSERT SECTION HomeMonExec::HomeMonExec } HomeMonExec::~HomeMonExec() { // BEGIN USER INSERT SECTION HomeMonExec::~HomeMonExec // END USER INSERT SECTION HomeMonExec::~HomeMonExec } void HomeMonExec::set_context(Components::HomeContext_ptr ctx) throw (CORBA::SystemException, Components::CCMException) { context_ = Components::HomeContext::_duplicate(ctx); } ::Components::EnterpriseComponent_ptr HomeMonExec::create () throw (CORBA::SystemException, Components::CreateFailure) { // BEGIN USER INSERT SECTION HomeMonExec::create std::cout << "create called." << std::endl; // END USER INSERT SECTION HomeMonExec::create return new MonImpl(); } }; // // entry point // ::Components::HomeExecutorBase_ptr create_monitor_homeE(void) { // BEGIN USER INSERT SECTION create_monitor_home // END USER INSERT SECTION create_monitor_home return new ::container_service::HomeMonExec(); }
[ "tom@798282e8-cfd4-0310-a90d-ae7fb11434eb" ]
[ [ [ 1, 295 ] ] ]
80c1dd9e41dfd46a7987afa6a2643297d801aaba
86bb1666e703b6be9896166d1b192a20f4a1009c
/source/bbn/BBN_Option.cpp
cd5c51808501157b8bbe6c46a89e478705b3c301
[]
no_license
aggronerd/Mystery-Game
39f366e9b78b7558f5f9b462a45f499060c87d7f
dfd8220e03d552dc4e0b0f969e8be03cf67ba048
refs/heads/master
2021-01-10T21:15:15.318110
2010-08-22T09:16:08
2010-08-22T09:16:08
2,344,888
0
1
null
null
null
null
UTF-8
C++
false
false
1,390
cpp
#include <string> #include <vector> #include <exception> using namespace std; #include "BBN_Option.h" #include "BBN_Decision.h" #include "BBN_Given.h" #include "BBN_Prob.h" #include "../misc/logging.h" #include "../Application.h" BBN_Option::BBN_Option(BBN_Decision* decision) : _decision(decision) { DEBUG_MSG("BBN_Option::BBN_Option(BBN_Decision*) - Called.") } BBN_Option::~BBN_Option() { DEBUG_MSG("BBN_Option::~BBN_Option() - Called.") _decision = 0x0; } void BBN_Option::load_from_xml(const CL_DomElement& element) { DEBUG_MSG("BBN_Option::load_from_xml(CL_DomElement) - Called.") _name = element.get_attribute("name"); _english = element.get_attribute("english"); DEBUG_MSG("BBN_Option::load_from_xml(CL_DomElement) - Option name = '" + _name + "'.") } CL_String8 BBN_Option::get_name() { return(_name); } void BBN_Option::set_name(const CL_String8& new_name) { _name = new_name; } CL_String8 BBN_Option::get_english() { if(!_english.empty()) { return(_english); } else { return(get_name()); } } void BBN_Option::set_english(const CL_String8& new_english) { _english = new_english; } unsigned int BBN_Option::get_id() { return(_id); } void BBN_Option::set_id(unsigned int id) { _id = id; } BBN_Decision* BBN_Option::get_decision() { return(_decision); }
[ [ [ 1, 74 ] ] ]
79787eb90a6569bb44ce123e095ee393244cac77
bf4f0fc16bd1218720c3f25143e6e34d6aed1d4e
/Graph.cpp
7106c05ba58898450a214695ce375f2766f06edc
[]
no_license
shergin/downright
4b0f161700673d7eb49459e4fde2b7d095eb91bb
6cc40cd35878e58f4ae8bae8d5e58256e6df4ce8
refs/heads/master
2020-07-03T13:34:20.697914
2009-09-29T19:15:07
2009-09-29T19:15:07
null
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
13,350
cpp
#include "StdAfx.h" #include "graph.h" //#include "math.h" #define Abs(x) ((x<0)?(-x):(x)) union rgb { unsigned __int8 element[3]; COLORREF color; }; void MultiplyColor(COLORREF &color, double k) { rgb x; x.color=color; x.element[0]=(unsigned __int8)((double)x.element[0]*k); x.element[1]=(unsigned __int8)((double)x.element[1]*k); x.element[2]=(unsigned __int8)((double)x.element[2]*k); color=x.color; } CGraph::CGraph(void) : m_bShowSplitter(false) { m_GesturePreviewCreate=false; m_bShowSplitter=false; m_ScrollPos=0; } CGraph::~CGraph(void) { if((HDC)m_GesturePreviewDC!=0) { //m_Bitmap.Detach(); m_GesturePreviewDC.Detach(); m_GesturePreviewBitmap.DeleteObject(); m_GesturePreviewDC.DeleteDC(); } } #define line(p,x1,y1,x2,y2) (p)->MoveTo(x1,y1);(p)->LineTo(x2,y2); // Линия #define rectangle(p,x1,y1,x2,y2) line(p,x1,y1,x2,y1);line(p,x1,y2,x2,y2);line(p,x1,y1,x1,y2);line(p,x2,y1,x2,y2); #define rect(r,x1,y1,x2,y2); r.left=(x1);r.top=(y1);r.right=(x2);r.bottom=(y2); // инициализируем void CGraph::Init(CWnd *pMainWnd, CPoint *pSize, HBRUSH *pHBRUSH, CIdentify *pIdentify) { m_pIdentify=pIdentify; m_pHBRUSH=pHBRUSH; m_pMainWnd=pMainWnd; m_pSize=pSize; m_SplitterPosition=300; Color[0]=(COLORREF)GetSysColor(COLOR_BTNFACE); // фон окна диалога Color[1]=(COLORREF)GetSysColor(COLOR_HIGHLIGHTTEXT/*COLOR_WINDOW*/); // фон окна (~белый) Color[3]=(COLORREF)GetSysColor(COLOR_INACTIVECAPTION); Color[2]=Color[3]; MultiplyColor(Color[2],0.6); Color[4]=Color[2]; MultiplyColor(Color[4],0.9); //Color[2]=(COLORREF)GetSysColor(COLOR_HIGHLIGHT); Color[5]=(COLORREF)RGB(0,0,0); Color[6]=(COLORREF)RGB(255,255,255); } void CGraph::Draw(int param, int activeGesture) { TRACE("Draw\n"); CClientDC DC(m_pMainWnd); CBrush *background=NULL; if(m_pHBRUSH!=0) { background=background->FromHandle(*m_pHBRUSH); DC.SetBrushOrg(100,5); } CBrush brush,brush1; brush.CreateSolidBrush(Color[6]); CBrush* pOldBrush=DC.SelectObject(&brush); CPen pen; pen.CreatePen(PS_SOLID,1,Color[3]); CPen* pOldPen=DC.SelectObject(&pen); int k=5,s=7; // коэфициент пропорций логотипа RECT r; rect(r ,s+0 ,-s+m_pSize->y-k*10 ,s+k ,-s+m_pSize->y ); DC.FillSolidRect(&r,Color[2]); rect(r ,s+k*9 ,-s+m_pSize->y-k*10 ,s+k*10 ,-s+m_pSize->y ); DC.FillSolidRect(&r,Color[2]); rect(r ,s+k ,-s+m_pSize->y-k*10 ,s+k*9 ,-s+m_pSize->y-k*9 ); DC.FillSolidRect(&r,Color[2]); rect(r ,s+k ,-s+m_pSize->y-k ,s+k*9 ,-s+m_pSize->y ); DC.FillSolidRect(&r,Color[2]); rect(r ,s+k*6 ,-s+m_pSize->y-k*9 ,s+k*9 ,-s+m_pSize->y-k*6 ); DC.FillSolidRect(&r,Color[2]); rect(r ,s+k*11-2 ,27 ,s+k*12-2 ,s+m_pSize->y-s*2 ); DC.FillSolidRect(&r,Color[2]); // [-] сплеш if(param==2) { int x1=68; int y1=27; int x2=m_pSize->x-7; int y2=m_pSize->y-7; DrawBigLogoSpace(&DC,x1,y1,x2,y2); // подготовка шрифтов LOGFONT logFont; logFont.lfHeight=26; logFont.lfWidth=0; logFont.lfEscapement=0; logFont.lfOrientation=0; logFont.lfWeight=0; logFont.lfItalic=0; logFont.lfUnderline=0; logFont.lfStrikeOut=0; logFont.lfCharSet=1; logFont.lfOutPrecision=OUT_DEFAULT_PRECIS; logFont.lfClipPrecision=CLIP_DEFAULT_PRECIS; logFont.lfQuality=ANTIALIASED_QUALITY; logFont.lfPitchAndFamily=VARIABLE_PITCH|FF_SWISS; _tcscpy_s(logFont.lfFaceName,_T("Tahoma")); DC.SetBkMode(TRANSPARENT); //нормальный CFont NormalFont; NormalFont.CreateFontIndirect(&logFont); //вертикальный logFont.lfEscapement=2700; logFont.lfHeight=22; CFont VertFont; VertFont.CreateFontIndirect(&logFont); //маленький logFont.lfEscapement=0; logFont.lfHeight=11; CFont SmallFont; SmallFont.CreateFontIndirect(&logFont); //правый logFont.lfOrientation=16; logFont.lfHeight=26; CFont RightFont; RightFont.CreateFontIndirect(&logFont); CFont* oldFont=DC.SelectObject(&NormalFont); DC.SetTextColor(Color[3]); DC.TextOut(x1+10,y2-55,_T("downright blackrain, generation three, version eight")); DC.SetTextColor(Color[4]); DC.TextOut(x2-280,y2-72,_T("http://downright.shergin.com")); DC.SetTextColor(Color[3]); DC.SelectObject(&VertFont); int i=0; /* DC.TextOut(x2-73+i++*18,y1+10,"pr.shergin"); DC.TextOut(x2-73+i++*18,y1+10,"web.shergin"); DC.TextOut(x2-73+i++*18,y1+10,"design.shergin"); DC.TextOut(x2-73+i++*18,y1+10,"programming.shergin"); DC.TextOut(x2-73+i++*18,y1+10,"research.shergin"); */ DC.TextOut(x2-2,y1+11,_T("copyright © shergin research lab, 2003-05")); // DC.SelectObject(&RightFont); // DC.TextOut(x2-10,y2-70,"http://downright.shergin.net"); DC.SelectObject(&SmallFont); DC.TextOut(x2-570,y2-27,_T("This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program,")); DC.TextOut(x2-570,y2-18,_T("or any portion of it, may result in severe civil and penalties, and will be prosecuted to the maximum extent possible under the law.")); goto label_return; } // [-] разделитель if(m_bShowSplitter) { static int oldPos=-1; // [-] стираем if(oldPos!=-1) { rect(r,oldPos,27,oldPos+k,m_pSize->y-s); DC.FillSolidRect(&r,Color[0]); } oldPos=m_SplitterPosition; // [-] рисуем rect(r,m_SplitterPosition,27,m_SplitterPosition+k,m_pSize->y-s); DC.FillSolidRect(&r,Color[2]); } if(param==3) { int x1=m_SplitterPosition+12; int y1=51; int x2=m_pSize->x-11; int y2=m_pSize->y-11; DrawBigLogoSpace(&DC,x1,y1,x2,y2); } if(param==1)//рисуем панель символов { int x1=m_SplitterPosition+12; int y1=51; int x2=m_pSize->x-11; int y2=m_pSize->y-11; DrawBigLogoSpace(&DC,x1,y1,x2,y2); CRgn rgn; rgn.CreateRectRgn(x1+5*2,y1+5*2,x2-5*2,y2-5*2); DC.SelectClipRgn(&rgn); CPoint point; int n=10; int level=0,i=0; int x=0, y=0; CSymbols &symbols=m_pIdentify->m_Gestures[activeGesture].m_Symbols; for(i=0;i<symbols.m_nSymbol;i++) { point.x=x2-57-x*53; point.y=y2-57-y*53; DrawSymbol(&DC,point,&symbols.m_Symbol[i],0); // x, y x++;y--; if((y<0)/*||(m_SplitterPosition+x*61+100>m_pSize->x)*/){level++;y=level;x=0;} } rgn.DeleteObject(); } label_return: DC.SelectObject(pOldBrush); DC.SelectObject(pOldPen); } void CGraph::DrawSplitterBar(int position) { m_SplitterPosition=position; CClientDC dc(m_pMainWnd); CBrush brush(Color[2]); CBrush* pOldBrush = dc.SelectObject(&brush); dc.PatBlt( position, 27, 5, m_pSize->y-34, PATINVERT ); dc.SelectObject(pOldBrush); } void CGraph::DrawSymbol(CDC* pDC, CPoint point, CSymbol* pSymbol, int style) { int size=0; rgb c0,c1; if(style==0) { size=40; // pDC->FillSolidRect(point.x,point.y,size+6,size+6,Color[2]); // line(pDC,point.x-3,point.y-3,point.x-3,point.y+size+9); // line(pDC,point.x-3,point.y-3,point.x+size+9,point.y-3); COLORREF color=Color[2]; MultiplyColor(color,0.7); DrawLogo(pDC,point.x-3,point.y-3,5,color); c0.color=Color[1];//1 c1.color=Color[2];//2 } if(style==1) { size=30; CPen pen; pen.CreatePen(PS_SOLID,1,Color[3]); CPen* pOldPen=pDC->SelectObject(&pen); //pDC->FillSolidRect(point.x,point.y,size+6,size+6,Color[0]); rectangle(pDC,point.x,point.y,point.x+size+6,point.y+size+6); pDC->SelectObject(pOldPen); c0.color=Color[2];//1 c1.color=Color[0];//2 } // символ не символ... то нахуй нам нужен такой символ?! if(pSymbol->m_nDirection==0)return; int i=0; int minx=0, miny=0, maxx=0, maxy=0; int px=0, py=0, ox=0, oy=0; int gx=0,gy=0; double len=0; for(i=0;i<pSymbol->m_nDirection;i++) { gx=pSymbol->m_Direction[i].x; gy=pSymbol->m_Direction[i].y; len+=max(Abs(gx),Abs(gy)); px+=gx; py+=gy; if(minx>px)minx=px; if(miny>py)miny=py; if(maxx<px)maxx=px; if(maxy<py)maxy=py; } ox=maxx-minx;//по идее minx <= 0 (miny <= 0) oy=maxy-miny; if((ox==0)&&(oy==0))return; double sx=(double)size/((double)ox+0.01),sy=(double)size/((double)oy+0.01); double scale=min(sx,sy); long dx=0,dy=0; if(ox<oy) dx=(long)(((double)(size-(double)scale*ox))/2.); else dy=(long)(((double)(size-(double)scale*oy))/2.); px=0; py=0; point.x+=dx+3-1; point.y+=dy+3-1; long d=pSymbol->m_nDirection; len*=scale; long iColor=0; float dr=(float)(c0.element[0]-c1.element[0])/(float)len; float dg=(float)(c0.element[1]-c1.element[1])/(float)len; float db=(float)(c0.element[2]-c1.element[2])/(float)len; unsigned __int8 rr; unsigned __int8 gg; unsigned __int8 bb; long x1=0,y1=0,x2=0,y2=0; x1=point.x-(long)((minx)*scale); y1=point.y-(long)((miny)*scale); for(i=0;i<d;i++) { px+=pSymbol->m_Direction[i].x; py+=pSymbol->m_Direction[i].y; x2=point.x+(long)((px-minx)*scale); y2=point.y+(long)((py-miny)*scale); { long dx=x2-x1; long dy=y2-y1; long length=max(Abs(dx),Abs(dy)); double ldx=(double)dx/(double)length; double ldy=(double)dy/(double)length; long x=0,y=0; double i; for(i=0;i<length;i++) { x=x1+(long)(ldx*i); y=y1+(long)(ldy*i); rr=(unsigned __int8)((long)c0.element[0]-(long)(dr*iColor)); gg=(unsigned __int8)((long)c0.element[1]-(long)(dg*iColor)); bb=(unsigned __int8)((long)c0.element[2]-(long)(db*iColor)); iColor++; pDC->SetPixelV(x ,y ,RGB(rr,gg,bb)); pDC->SetPixelV(x ,y-1,RGB(rr,gg,bb)); pDC->SetPixelV(x ,y+1,RGB(rr,gg,bb)); pDC->SetPixelV(x-1,y ,RGB(rr,gg,bb)); pDC->SetPixelV(x+1 ,y ,RGB(rr,gg,bb)); /* if(Abs(ldx)<Abs(ldy)) pDC->SetPixelV(x-1,y,RGB(rr,gg,bb)); else pDC->SetPixelV(x,y-1,RGB(rr,gg,bb)); */ } iColor--; } x1=x2; y1=y2; } } #define GesturePreviewWidth 1000 void CGraph::CreateGesturePreview(void) { m_GesturePreviewCreate=true; m_GesturePreviewSize.SetPoint(600,1000); if((HDC)m_GesturePreviewDC!=0) { m_GesturePreviewBitmap.Detach(); m_GesturePreviewDC.Detach(); } CClientDC dc(m_pMainWnd); m_GesturePreviewDC.CreateCompatibleDC(&dc); m_GesturePreviewBitmap.CreateCompatibleBitmap(&dc,m_GesturePreviewSize.x,m_GesturePreviewSize.y); m_GesturePreviewDC.SelectObject(m_GesturePreviewBitmap); m_GesturePreviewDC.FillSolidRect(0,0,600,600,Color[2]); // подготовка шрифтов LOGFONT logFont; logFont.lfHeight=18; logFont.lfWidth=0; logFont.lfEscapement=0; logFont.lfOrientation=0; logFont.lfWeight=0; logFont.lfItalic=0; logFont.lfUnderline=0; logFont.lfStrikeOut=0; logFont.lfCharSet=1; logFont.lfOutPrecision=OUT_DEFAULT_PRECIS; logFont.lfClipPrecision=CLIP_DEFAULT_PRECIS; logFont.lfQuality=DRAFT_QUALITY; logFont.lfPitchAndFamily=VARIABLE_PITCH|FF_SWISS; _tcscpy_s(logFont.lfFaceName,_T("Tahoma")); m_GesturePreviewDC.SetBkMode(TRANSPARENT); //нормальный CFont NormalFont; NormalFont.CreateFontIndirect(&logFont); //вертикальный logFont.lfEscapement=900; CFont VertFont; VertFont.CreateFontIndirect(&logFont); CFont* oldFont=m_GesturePreviewDC.SelectObject(&NormalFont); m_GesturePreviewDC.SetTextColor(Color[3]); // начинаем рисовать CPoint point; #define offset 20 int i=0,p=0,level=0,minus=0; for(i=0;i<m_pIdentify->m_nGestures;i++) { //m_GesturePreviewDC.FillSolidRect(5+level*offset,5+i*41+20,600,20,Color[0]); switch(m_pIdentify->m_Gestures[i].m_GroupStatus) { case 0: for(p=0;p<m_pIdentify->m_Gestures[i].m_Symbols.m_nSymbol;p++) { point.x=5+p*41+level*offset; point.y=5+i*41; DrawSymbol(&m_GesturePreviewDC, point, &m_pIdentify->m_Gestures[i].m_Symbols.m_Symbol[p],1); } break; case 1: level++; break; case 2: level--; minus++; break; } m_GesturePreviewDC.TextOut(7+level*offset,22+i*41,m_pIdentify->m_Gestures[i].m_Name); } // for(int g=0;g<20;g++) // m_GesturePreviewDC.FillSolidRect(10,g*30,600,g*30+30,(COLORREF)GetSysColor(g)); m_GesturePreviewCreate=false; } void CGraph::DrawLogo(CDC* pDC, int x, int y, int k, COLORREF color) { RECT r; rect(r ,x+0 ,y+0 ,x+k ,y+k*10 ); pDC->FillSolidRect(&r,color); rect(r ,x+k*9 ,y+0 ,x+k*10 ,y+k*10 ); pDC->FillSolidRect(&r,color); rect(r ,x+k ,y+0 ,x+k*9 ,y+k*1 ); pDC->FillSolidRect(&r,color); rect(r ,x+k ,y+k*9 ,x+k*9 ,y+k*10 ); pDC->FillSolidRect(&r,color); rect(r ,x+k*6 ,y+k*1 ,x+k*9 ,y+k*4 ); pDC->FillSolidRect(&r,color); } void CGraph::DrawBigLogoSpace(CDC* pDC, int x1, int y1, int x2, int y2) { CRect r; rect(r,x1,y1,x2,y2);pDC->FillSolidRect(&r,Color[2]); COLORREF color=Color[2]; MultiplyColor(color,0.9); DrawLogo(pDC,x1+(x2-x1)/2-60,y1+(y2-y1)/2-60,12,color); #define space 5 #define thickness 40 rect(r,x1+space,y1+space,x2-space,y1+space+thickness);pDC->FillSolidRect(&r,color); rect(r,x1+space,y2-space-thickness,x2-space,y2-space);pDC->FillSolidRect(&r,color); }
[ [ [ 1, 490 ] ] ]
289f91bdb7ceb53d377a93b39d5d84f3a2198fcf
87334636c03a120990a166b7af710a544de7519d
/src/gdx-cpp/graphics/g2d/SpriteCache.cpp
c43126ab11755c70abac9b55d954d9d43c089eea
[ "Apache-2.0" ]
permissive
trarck/libgdx-cpp
07c58152858b1ff5d274e811147a5ad12bb741b1
ade99300ab046256f41be443ef0c7bea14fff5ab
refs/heads/master
2021-01-18T09:28:36.027837
2011-09-13T21:52:22
2011-09-13T21:52:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
28,942
cpp
/* Copyright 2011 Aevum Software aevum @ aevumlab.com 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. @author Victor Vicente de Carvalho [email protected] @author Ozires Bortolon de Faria [email protected] */ #include "SpriteCache.hpp" #include "gdx-cpp/Gdx.hpp" #include "gdx-cpp/Graphics.hpp" #include "gdx-cpp/graphics/GL20.hpp" #include "gdx-cpp/graphics/Color.hpp" #include "gdx-cpp/graphics/Mesh.hpp" #include "gdx-cpp/utils/NumberUtils.hpp" #include "gdx-cpp/graphics/glutils/ShaderProgram.hpp" #include "gdx-cpp/math/MathUtils.hpp" #include <string.h> #include <stdexcept> using namespace gdx_cpp::graphics::glutils; using namespace gdx_cpp::graphics::g2d; using namespace gdx_cpp::graphics; using namespace gdx_cpp; float SpriteCache::tempVertices[Sprite::VERTEX_SIZE * 6]; ShaderProgram* SpriteCache::createDefaultShader () { if (!Gdx::graphics->isGL20Available()) return NULL; std::string vertexShader = "attribute vec4 " + ShaderProgram::POSITION_ATTRIBUTE + ";\n" // "attribute vec4 " + ShaderProgram::COLOR_ATTRIBUTE + ";\n" // "attribute vec2 " + ShaderProgram::TEXCOORD_ATTRIBUTE + "0;\n" // "uniform mat4 u_projectionViewMatrix;\n" // "varying vec4 v_color;\n" // "varying vec2 v_texCoords;\n" // "\n" // "void main()\n" // "{\n" // " v_color = " + ShaderProgram::COLOR_ATTRIBUTE + ";\n" // " v_texCoords = " + ShaderProgram::TEXCOORD_ATTRIBUTE + "0;\n" // " gl_Position = u_projectionViewMatrix * " + ShaderProgram::POSITION_ATTRIBUTE + ";\n" // "}\n"; std::string fragmentShader = "#ifdef GL_ES\n" // "precision mediump float;\n" // "#endif\n" // "varying vec4 v_color;\n" // "varying vec2 v_texCoords;\n" // "uniform sampler2D u_texture;\n" // "void main()\n"// "{\n" // " gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" // "}"; ShaderProgram* shader = new ShaderProgram(vertexShader, fragmentShader); if (shader->isCompiled() == false) throw std::runtime_error("Error compiling shader: " + shader->getLog()); return shader; } gdx_cpp::graphics::g2d::SpriteCache::SpriteCache(int size, bool useIndices, ShaderProgram* shader) : color(Color::WHITE.toFloatBits()) , tempColor(1,1,1,1) , customShader(0) , shader(shader) , mesh(0) , drawing(false) , currentCache(0) { textures.reserve(8); counts.reserve(8); std::vector<VertexAttribute> attribute; attribute.push_back(VertexAttribute(VertexAttributes::Usage::Position, 2, ShaderProgram::POSITION_ATTRIBUTE)); attribute.push_back(VertexAttribute(VertexAttributes::Usage::ColorPacked, 4, ShaderProgram::COLOR_ATTRIBUTE)); attribute.push_back(VertexAttribute(VertexAttributes::Usage::TextureCoordinates, 2, ShaderProgram::TEXCOORD_ATTRIBUTE + "0")); mesh = new Mesh(true, size * (useIndices ? 4 : 6), useIndices ? size * 6 : 0, attribute); mesh->setAutoBind(false); if (useIndices) { int length = size * 6; std::vector<short> indices(length); short j = 0; for (int i = 0; i < length; i += 6, j += 4) { indices[i + 0] = (short)j; indices[i + 1] = (short)(j + 1); indices[i + 2] = (short)(j + 2); indices[i + 3] = (short)(j + 2); indices[i + 4] = (short)(j + 3); indices[i + 5] = (short)j; } mesh->setIndices(indices); } projectionMatrix.setToOrtho2D(0, 0, Gdx::graphics->getWidth(), Gdx::graphics->getHeight()); } void SpriteCache::setColor (const gdx_cpp::graphics::Color& tint) { color = tint.toFloatBits(); } void SpriteCache::setColor (float r, float g, float b, float a) { int intBits = (int)(255 * a) << 24 | (int)(255 * b) << 16 | (int)(255 * g) << 8 | (int)(255 * r); color = utils::NumberUtils::intBitsToFloat(intBits & 0xfeffffff); } void SpriteCache::setColor (float color) { this->color = color; } gdx_cpp::graphics::Color& SpriteCache::getColor () { int intBits = utils::NumberUtils::floatToRawIntBits(color); tempColor.r = (intBits & 0xff) / 255.0f; tempColor.g = (((unsigned int) intBits >> 8) & 0xff) / 255.0f; tempColor.b = (((unsigned int)intBits >> 16) & 0xff) / 255.0f; tempColor.a = (((unsigned int)intBits >> 24) & 0xff) / 255.0f; return tempColor; } void SpriteCache::beginCache () { if (currentCache != NULL) throw std::runtime_error("endCache must be called before begin."); int verticesPerImage = mesh->getNumIndices() > 0 ? 4 : 6; currentCache = new Cache(caches.size(), mesh->getNumVertices() / verticesPerImage * 6); caches.push_back(currentCache); mesh->getVerticesBuffer().compact(); } void SpriteCache::beginCache (unsigned int cacheID) { if (currentCache != NULL) throw std::runtime_error("endCache must be called before begin."); if (cacheID == caches.size() - 1) { caches.erase(caches.begin() + cacheID); beginCache(); return; } currentCache = caches[cacheID]; mesh->getVerticesBuffer().position(currentCache->offset); } int SpriteCache::endCache () { if (currentCache == NULL) throw std::runtime_error("beginCache must be called before endCache."); int cacheCount = mesh->getVerticesBuffer().position() - currentCache->offset; if (currentCache->textures.size() == 0) { // New cache. currentCache->maxCount = cacheCount; currentCache->textures = textures; currentCache->counts = counts; mesh->getVerticesBuffer().flip(); } else { // Redefine existing cache. if (cacheCount > currentCache->maxCount) { std::stringstream ss; ss << "If a cache is not the last created, it cannot be redefined with more entries than when it was first created: " << cacheCount << " (" + currentCache->maxCount << " max)"; throw std::runtime_error(ss.str()); } if (currentCache->textures.size() < textures.size()) { currentCache->textures.resize(textures.size()); } for (int i = 0, n = textures.size(); i < n; i++) currentCache->textures[i] = textures[i]; if (currentCache->counts.size() < counts.size()) currentCache->counts.resize(counts.size()); for (int i = 0, n = counts.size(); i < n; i++) currentCache->counts[i] = counts[i]; utils::float_buffer& vertices = mesh->getVerticesBuffer(); vertices.position(0); Cache* lastCache = caches[caches.size() - 1]; vertices.limit(lastCache->offset + lastCache->maxCount); } Cache* cache = currentCache; currentCache = NULL; textures.clear(); counts.clear(); return cache->id; } void SpriteCache::clear () { caches.clear(); mesh->getVerticesBuffer().clear().flip(); } void SpriteCache::add (gdx_cpp::graphics::Texture::ptr texture,float x,float y) { float fx2 = x + texture->getWidth(); float fy2 = y + texture->getHeight(); tempVertices[0] = x; tempVertices[1] = y; tempVertices[2] = color; tempVertices[3] = 0; tempVertices[4] = 1; tempVertices[5] = x; tempVertices[6] = fy2; tempVertices[7] = color; tempVertices[8] = 0; tempVertices[9] = 0; tempVertices[10] = fx2; tempVertices[11] = fy2; tempVertices[12] = color; tempVertices[13] = 1; tempVertices[14] = 0; if (mesh->getNumIndices() > 0) { tempVertices[15] = fx2; tempVertices[16] = y; tempVertices[17] = color; tempVertices[18] = 1; tempVertices[19] = 1; add(texture, tempVertices, 30, 0, 20); } else { tempVertices[15] = fx2; tempVertices[16] = fy2; tempVertices[17] = color; tempVertices[18] = 1; tempVertices[19] = 0; tempVertices[20] = fx2; tempVertices[21] = y; tempVertices[22] = color; tempVertices[23] = 1; tempVertices[24] = 1; tempVertices[25] = x; tempVertices[26] = y; tempVertices[27] = color; tempVertices[28] = 0; tempVertices[29] = 1; add(texture, tempVertices, 30, 0, 30); } } void SpriteCache::add (const gdx_cpp::graphics::Texture::ptr texture, float x, float y, int srcWidth, int srcHeight, float u, float v, float u2, float v2, float color) { float fx2 = x + srcWidth; float fy2 = y + srcHeight; tempVertices[0] = x; tempVertices[1] = y; tempVertices[2] = color; tempVertices[3] = u; tempVertices[4] = v; tempVertices[5] = x; tempVertices[6] = fy2; tempVertices[7] = color; tempVertices[8] = u; tempVertices[9] = v2; tempVertices[10] = fx2; tempVertices[11] = fy2; tempVertices[12] = color; tempVertices[13] = u2; tempVertices[14] = v2; if (mesh->getNumIndices() > 0) { tempVertices[15] = fx2; tempVertices[16] = y; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v; add(texture, tempVertices, 30, 0, 20); } else { tempVertices[15] = fx2; tempVertices[16] = fy2; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v2; tempVertices[20] = fx2; tempVertices[21] = y; tempVertices[22] = color; tempVertices[23] = u2; tempVertices[24] = v; tempVertices[25] = x; tempVertices[26] = y; tempVertices[27] = color; tempVertices[28] = u; tempVertices[29] = v; add(texture, tempVertices, 30, 0, 30); } } void SpriteCache::add (Texture::ptr texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight) { float invTexWidth = 1.0f / texture->getWidth(); float invTexHeight = 1.0f / texture->getHeight(); float u = srcX * invTexWidth; float v = (srcY + srcHeight) * invTexHeight; float u2 = (srcX + srcWidth) * invTexWidth; float v2 = srcY * invTexHeight; float fx2 = x + srcWidth; float fy2 = y + srcHeight; tempVertices[0] = x; tempVertices[1] = y; tempVertices[2] = color; tempVertices[3] = u; tempVertices[4] = v; tempVertices[5] = x; tempVertices[6] = fy2; tempVertices[7] = color; tempVertices[8] = u; tempVertices[9] = v2; tempVertices[10] = fx2; tempVertices[11] = fy2; tempVertices[12] = color; tempVertices[13] = u2; tempVertices[14] = v2; if (mesh->getNumIndices() > 0) { tempVertices[15] = fx2; tempVertices[16] = y; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v; add(texture, tempVertices, 30, 0, 20); } else { tempVertices[15] = fx2; tempVertices[16] = fy2; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v2; tempVertices[20] = fx2; tempVertices[21] = y; tempVertices[22] = color; tempVertices[23] = u2; tempVertices[24] = v; tempVertices[25] = x; tempVertices[26] = y; tempVertices[27] = color; tempVertices[28] = u; tempVertices[29] = v; add(texture, tempVertices, 30, 0, 30); } } void SpriteCache::add (gdx_cpp::graphics::Texture::ptr texture,float x,float y,float width,float height,int srcX,int srcY,int srcWidth,int srcHeight,bool flipX,bool flipY) { float invTexWidth = 1.0f / texture->getWidth(); float invTexHeight = 1.0f / texture->getHeight(); float u = srcX * invTexWidth; float v = (srcY + srcHeight) * invTexHeight; float u2 = (srcX + srcWidth) * invTexWidth; float v2 = srcY * invTexHeight; float fx2 = x + width; float fy2 = y + height; if (flipX) { float tmp = u; u = u2; u2 = tmp; } if (flipY) { float tmp = v; v = v2; v2 = tmp; } tempVertices[0] = x; tempVertices[1] = y; tempVertices[2] = color; tempVertices[3] = u; tempVertices[4] = v; tempVertices[5] = x; tempVertices[6] = fy2; tempVertices[7] = color; tempVertices[8] = u; tempVertices[9] = v2; tempVertices[10] = fx2; tempVertices[11] = fy2; tempVertices[12] = color; tempVertices[13] = u2; tempVertices[14] = v2; if (mesh->getNumIndices() > 0) { tempVertices[15] = fx2; tempVertices[16] = y; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v; add(texture, tempVertices, 30, 0, 20); } else { tempVertices[15] = fx2; tempVertices[16] = fy2; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v2; tempVertices[20] = fx2; tempVertices[21] = y; tempVertices[22] = color; tempVertices[23] = u2; tempVertices[24] = v; tempVertices[25] = x; tempVertices[26] = y; tempVertices[27] = color; tempVertices[28] = u; tempVertices[29] = v; add(texture, tempVertices, 30, 0, 30); } } void SpriteCache::add (gdx_cpp::graphics::Texture::ptr texture,float x,float y,float originX,float originY,float width,float height,float scaleX,float scaleY,float rotation,int srcX,int srcY,int srcWidth,int srcHeight,bool flipX,bool flipY) { // bottom left and top right corner points relative to origin float worldOriginX = x + originX; float worldOriginY = y + originY; float fx = -originX; float fy = -originY; float fx2 = width - originX; float fy2 = height - originY; // scale if (scaleX != 1 || scaleY != 1) { fx *= scaleX; fy *= scaleY; fx2 *= scaleX; fy2 *= scaleY; } // construct corner points, start from top left and go counter clockwise float p1x = fx; float p1y = fy; float p2x = fx; float p2y = fy2; float p3x = fx2; float p3y = fy2; float p4x = fx2; float p4y = fy; float x1; float y1; float x2; float y2; float x3; float y3; float x4; float y4; // rotate if (rotation != 0) { float cos = math::utils::cosDeg(rotation); float sin = math::utils::sinDeg(rotation); x1 = cos * p1x - sin * p1y; y1 = sin * p1x + cos * p1y; x2 = cos * p2x - sin * p2y; y2 = sin * p2x + cos * p2y; x3 = cos * p3x - sin * p3y; y3 = sin * p3x + cos * p3y; x4 = x1 + (x3 - x2); y4 = y3 - (y2 - y1); } else { x1 = p1x; y1 = p1y; x2 = p2x; y2 = p2y; x3 = p3x; y3 = p3y; x4 = p4x; y4 = p4y; } x1 += worldOriginX; y1 += worldOriginY; x2 += worldOriginX; y2 += worldOriginY; x3 += worldOriginX; y3 += worldOriginY; x4 += worldOriginX; y4 += worldOriginY; float invTexWidth = 1.0f / texture->getWidth(); float invTexHeight = 1.0f / texture->getHeight(); float u = srcX * invTexWidth; float v = (srcY + srcHeight) * invTexHeight; float u2 = (srcX + srcWidth) * invTexWidth; float v2 = srcY * invTexHeight; if (flipX) { float tmp = u; u = u2; u2 = tmp; } if (flipY) { float tmp = v; v = v2; v2 = tmp; } tempVertices[0] = x1; tempVertices[1] = y1; tempVertices[2] = color; tempVertices[3] = u; tempVertices[4] = v; tempVertices[5] = x2; tempVertices[6] = y2; tempVertices[7] = color; tempVertices[8] = u; tempVertices[9] = v2; tempVertices[10] = x3; tempVertices[11] = y3; tempVertices[12] = color; tempVertices[13] = u2; tempVertices[14] = v2; if (mesh->getNumIndices() > 0) { tempVertices[15] = x4; tempVertices[16] = y4; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v; add(texture, tempVertices, 30, 0, 20); } else { tempVertices[15] = x3; tempVertices[16] = y3; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v2; tempVertices[20] = x4; tempVertices[21] = y4; tempVertices[22] = color; tempVertices[23] = u2; tempVertices[24] = v; tempVertices[25] = x1; tempVertices[26] = y1; tempVertices[27] = color; tempVertices[28] = u; tempVertices[29] = v; add(texture, tempVertices, 30, 0, 30); } } void SpriteCache::add (TextureRegion::ptr region,float x,float y) { add(region, x, y, region->getRegionWidth(), region->getRegionHeight()); } void SpriteCache::add (TextureRegion::ptr region,float x,float y,float width,float height) { float fx2 = x + width; float fy2 = y + height; float u = region->u; float v = region->v2; float u2 = region->u2; float v2 = region->v; tempVertices[0] = x; tempVertices[1] = y; tempVertices[2] = color; tempVertices[3] = u; tempVertices[4] = v; tempVertices[5] = x; tempVertices[6] = fy2; tempVertices[7] = color; tempVertices[8] = u; tempVertices[9] = v2; tempVertices[10] = fx2; tempVertices[11] = fy2; tempVertices[12] = color; tempVertices[13] = u2; tempVertices[14] = v2; if (mesh->getNumIndices() > 0) { tempVertices[15] = fx2; tempVertices[16] = y; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v; add(region->getTexture(), tempVertices, 30, 0, 20); } else { tempVertices[15] = fx2; tempVertices[16] = fy2; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v2; tempVertices[20] = fx2; tempVertices[21] = y; tempVertices[22] = color; tempVertices[23] = u2; tempVertices[24] = v; tempVertices[25] = x; tempVertices[26] = y; tempVertices[27] = color; tempVertices[28] = u; tempVertices[29] = v; add(region->getTexture(), tempVertices, 30, 0, 30); } } void SpriteCache::add (TextureRegion::ptr region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation) { // bottom left and top right corner points relative to origin float worldOriginX = x + originX; float worldOriginY = y + originY; float fx = -originX; float fy = -originY; float fx2 = width - originX; float fy2 = height - originY; // scale if (scaleX != 1 || scaleY != 1) { fx *= scaleX; fy *= scaleY; fx2 *= scaleX; fy2 *= scaleY; } // construct corner points, start from top left and go counter clockwise float p1x = fx; float p1y = fy; float p2x = fx; float p2y = fy2; float p3x = fx2; float p3y = fy2; float p4x = fx2; float p4y = fy; float x1; float y1; float x2; float y2; float x3; float y3; float x4; float y4; // rotate if (rotation != 0) { float cos = math::utils::cosDeg(rotation); float sin = math::utils::sinDeg(rotation); x1 = cos * p1x - sin * p1y; y1 = sin * p1x + cos * p1y; x2 = cos * p2x - sin * p2y; y2 = sin * p2x + cos * p2y; x3 = cos * p3x - sin * p3y; y3 = sin * p3x + cos * p3y; x4 = x1 + (x3 - x2); y4 = y3 - (y2 - y1); } else { x1 = p1x; y1 = p1y; x2 = p2x; y2 = p2y; x3 = p3x; y3 = p3y; x4 = p4x; y4 = p4y; } x1 += worldOriginX; y1 += worldOriginY; x2 += worldOriginX; y2 += worldOriginY; x3 += worldOriginX; y3 += worldOriginY; x4 += worldOriginX; y4 += worldOriginY; float u = region->u; float v = region->v2; float u2 = region->u2; float v2 = region->v; tempVertices[0] = x1; tempVertices[1] = y1; tempVertices[2] = color; tempVertices[3] = u; tempVertices[4] = v; tempVertices[5] = x2; tempVertices[6] = y2; tempVertices[7] = color; tempVertices[8] = u; tempVertices[9] = v2; tempVertices[10] = x3; tempVertices[11] = y3; tempVertices[12] = color; tempVertices[13] = u2; tempVertices[14] = v2; if (mesh->getNumIndices() > 0) { tempVertices[15] = x4; tempVertices[16] = y4; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v; add(region->getTexture(), tempVertices, 30, 0, 20); } else { tempVertices[15] = x3; tempVertices[16] = y3; tempVertices[17] = color; tempVertices[18] = u2; tempVertices[19] = v2; tempVertices[20] = x4; tempVertices[21] = y4; tempVertices[22] = color; tempVertices[23] = u2; tempVertices[24] = v; tempVertices[25] = x1; tempVertices[26] = y1; tempVertices[27] = color; tempVertices[28] = u; tempVertices[29] = v; add(region->getTexture(), tempVertices, Sprite::SPRITE_SIZE, 0, 30); } } void SpriteCache::add (Sprite& sprite) { if (mesh->getNumIndices() > 0) { add(sprite.getTexture(), sprite.getVertices(), Sprite::SPRITE_SIZE, 0, Sprite::SPRITE_SIZE); return; } float* const spriteVertices = sprite.getVertices(); memcpy(tempVertices, spriteVertices, sizeof(float) * 3 * Sprite::VERTEX_SIZE); memcpy(tempVertices, &spriteVertices[2 * Sprite::VERTEX_SIZE], sizeof(float) * 3 * Sprite::VERTEX_SIZE); memcpy(tempVertices, &spriteVertices[3 * Sprite::VERTEX_SIZE], sizeof(float) * 4 * Sprite::VERTEX_SIZE); memcpy(tempVertices, spriteVertices, sizeof(float) * 5 * Sprite::VERTEX_SIZE); add(sprite.getTexture(), tempVertices, Sprite::SPRITE_SIZE, 0, 30); } void SpriteCache::begin () { if (drawing) throw std::runtime_error("end must be called before begin."); if (Gdx::graphics->isGL20Available() == false) { GL10& gl = *Gdx::gl10; gl.glDepthMask(false); gl.glEnable(GL10::GL_TEXTURE_2D); gl.glMatrixMode(GL10::GL_PROJECTION); gl.glLoadMatrixf(projectionMatrix.val); gl.glMatrixMode(GL10::GL_MODELVIEW); gl.glLoadMatrixf(transformMatrix.val); mesh->bind(); } else { combinedMatrix.set(projectionMatrix).mul(transformMatrix); GL20& gl = *Gdx::gl20; gl.glDepthMask(false); gl.glEnable(GL20::GL_TEXTURE_2D); if (customShader != NULL) { customShader->begin(); customShader->setUniformMatrix("u_proj", projectionMatrix); customShader->setUniformMatrix("u_trans", transformMatrix); customShader->setUniformMatrix("u_projTrans", combinedMatrix); customShader->setUniformi("u_texture", 0); } else { shader->begin(); shader->setUniformMatrix("u_projectionViewMatrix", combinedMatrix); shader->setUniformi("u_texture", 0); } mesh->bind(*shader); } drawing = true; } void SpriteCache::end () { if (!drawing) throw std::runtime_error("begin must be called before end."); drawing = false; if (Gdx::graphics->isGL20Available() == false) { GL10& gl = *Gdx::gl10; gl.glDepthMask(true); gl.glDisable(GL10::GL_TEXTURE_2D); mesh->unbind(); } else { shader->end(); GL20& gl = *Gdx::gl20; gl.glDepthMask(true); gl.glDisable(GL20::GL_TEXTURE_2D); mesh->unbind(*shader); } } void SpriteCache::draw (int cacheID) { if (!drawing) throw std::runtime_error("SpriteCache.begin must be called before draw."); Cache* cache = caches[cacheID]; int offset = cache->offset; std::vector<Texture::ptr>& textures = cache->textures; std::vector<int>& counts = cache->counts; if (Gdx::graphics->isGL20Available()) { for (int i = 0, n = textures.size(); i < n; i++) { int count = counts[i]; textures[i]->bind(); if (customShader != NULL) mesh->render(*customShader, GL10::GL_TRIANGLES, offset, count); else mesh->render(*shader, GL10::GL_TRIANGLES, offset, count); offset += count; } } else { for (int i = 0, n = textures.size(); i < n; i++) { int count = counts[i]; textures[i]->bind(); mesh->render(GL10::GL_TRIANGLES, offset, count); offset += count; } } } void SpriteCache::draw (int cacheID,int offset,int length) { if (!drawing) throw std::runtime_error("SpriteCache.begin must be called before draw."); Cache* cache = caches[cacheID]; offset = offset * 6 + cache->offset; length *= 6; std::vector<Texture::ptr>& textures = cache->textures; std::vector<int>& counts = cache->counts; if (Gdx::graphics->isGL20Available()) { for (int i = 0, n = textures.size(); i < n; i++) { textures[i]->bind(); int count = counts[i]; if (count > length) { i = n; count = length; } else length -= count; if (customShader != NULL) mesh->render(*customShader, GL10::GL_TRIANGLES, offset, count); else mesh->render(*shader, GL10::GL_TRIANGLES, offset, count); offset += count; } } else { for (int i = 0, n = textures.size(); i < n; i++) { textures[i]->bind(); int count = counts[i]; if (count > length) { i = n; count = length; } else length -= count; mesh->render(GL10::GL_TRIANGLES, offset, count); offset += count; } } } void SpriteCache::dispose () { mesh->dispose(); if (shader != NULL) shader->dispose(); } gdx_cpp::math::Matrix4& SpriteCache::getProjectionMatrix () { return projectionMatrix; } void SpriteCache::setProjectionMatrix (const gdx_cpp::math::Matrix4& projection) { if (drawing) throw std::runtime_error("Can't set the matrix within begin/end."); projectionMatrix.set(projection); } gdx_cpp::math::Matrix4& SpriteCache::getTransformMatrix () { return transformMatrix; } void SpriteCache::setTransformMatrix (const gdx_cpp::math::Matrix4& transform) { if (drawing) throw std::runtime_error("Can't set the matrix within begin/end."); transformMatrix.set(transform); } void SpriteCache::setShader (gdx_cpp::graphics::glutils::ShaderProgram* shader) { customShader = shader; } void SpriteCache::add(Texture::ptr texture, float* vertices, int size, int offset, int length) { if (currentCache == NULL) throw std::runtime_error("beginCache must be called before add."); int verticesPerImage = mesh->getNumIndices() > 0 ? 4 : 6; int count = length / (verticesPerImage * Sprite::VERTEX_SIZE) * 6; int lastIndex = textures.size() - 1; if (lastIndex < 0 || textures[lastIndex] != texture) { textures.push_back(texture); counts.push_back(count); } else counts[lastIndex] = counts[lastIndex] + count; mesh->getVerticesBuffer().put(vertices, size, offset, length); }
[ [ [ 1, 953 ] ] ]
7665920b6638ac81643e015a69ba05dbd6010e7e
444a151706abb7bbc8abeb1f2194a768ed03f171
/trunk/ENIGMAsystem/SHELL/Platforms/xlib/XLIBwindow.cpp
61f2c4bda99385f8f3c5669e25e8095e3f908529
[]
no_license
amorri40/Enigma-Game-Maker
9d01f70ab8de42f7c80af9a0f8c7a66e412d19d6
c6b701201b6037f2eb57c6938c184a5d4ba917cf
refs/heads/master
2021-01-15T11:48:39.834788
2011-11-22T04:09:28
2011-11-22T04:09:28
1,855,342
1
1
null
null
null
null
UTF-8
C++
false
false
12,033
cpp
/** Copyright (C) 2008-2011 IsmAvatar <[email protected]>, Josh Ventura *** *** This file is a part of the ENIGMA Development Environment. *** *** ENIGMA 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, version 3 of the license or any later version. *** *** This application and its source code is distributed AS-IS, 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 code. If not, see <http://www.gnu.org/licenses/> **/ //File consists of Ism's code glued together and set to work with ENIGMA //(Josh's doing) #include <stdio.h> //printf, NULL #include <stdlib.h> //malloc #include <unistd.h> //usleep #include <time.h> //clock #include <string> //Return strings without needing a GC #include <X11/Xlib.h> //#include <X11/Xutil.h> //#include <X11/Xos.h> //#include <X11/Xatom.h> //#include <X11/keysym.h> #include <GL/glx.h> //#include <GL/gl.h> //#include <GL/glu.h> #include "../../Universal_System/CallbackArrays.h" // For those damn vk_ constants. #include "../platforms_mandatory.h" // For type insurance #include "../../GameSettings.h" // ABORT_ON_ALL_ERRORS (MOVEME: this shouldn't be needed here) #include "XLIBwindow.h" #include "XLIBmain.h" #include <X11/Xlib.h> #define uint unsigned int using namespace std; using namespace enigma::x11; ////////// // INIT // ////////// Cursor NoCursor,DefCursor; void gmw_init() { //Default cursor DefCursor = XCreateFontCursor(disp,68); //Blank cursor XColor dummy; Pixmap blank = XCreateBitmapFromData(disp,win,"",1,1); if(blank == None) { //out of memory printf("Failed to create no cursor. lulz\n"); NoCursor = DefCursor; } else { NoCursor = XCreatePixmapCursor(disp,blank,blank,&dummy,&dummy,0,0); XFreePixmap(disp,blank); } } void sleep(int ms) { if(ms>1000) sleep(ms/1000); if(ms>0) usleep(ms%1000*1000); } int visx = -1, visy = -1; int window_set_visible(bool visible) { if(visible) { XMapRaised(disp,win); GLXContext glxc = glXGetCurrentContext(); glXMakeCurrent(disp,win,glxc); if(visx != -1 && visy != -1) window_set_position(visx,visy); } else XUnmapWindow(disp, win); return 0; } int window_get_visible() { XWindowAttributes wa; XGetWindowAttributes(disp,win,&wa); return wa.map_state != IsUnmapped; } void window_set_caption(string caption) { XStoreName(disp,win,caption.c_str()); } string window_get_caption() { char *caption; XFetchName(disp,win,&caption); string r=caption; return r; } inline int getMouse(int i) { Window r1,r2; int rx,ry,wx,wy; unsigned int mask; XQueryPointer(disp,win,&r1,&r2,&rx,&ry,&wx,&wy,&mask); switch(i) { case 0: return rx; case 1: return ry; case 2: return wx; case 3: return wy; default: return -1; } } int display_mouse_get_x() { return getMouse(0); } int display_mouse_get_y() { return getMouse(1); } int window_mouse_get_x() { return getMouse(2); } int window_mouse_get_y() { return getMouse(3); } void window_mouse_set(double x,double y) { XWarpPointer(disp,None,win,0,0,0,0,(int)x,(int)y); } void display_mouse_set(double x,double y) { XWarpPointer(disp,None,DefaultRootWindow(disp),0,0,0,0,(int)x,(int)y); } //////////// // WINDOW // //////////// static int getWindowDimension(int i) { XFlush(disp); XWindowAttributes wa; XGetWindowAttributes(disp,win,&wa); if(i == 2) return wa.width; if(i == 3) return wa.height; Window root, parent, *child; uint children; XQueryTree(disp,win,&root,&parent,&child,&children); XWindowAttributes pwa; XGetWindowAttributes(disp,parent,&pwa); return i?(i==1?pwa.y+wa.y:-1):pwa.x+wa.x; } //Getters int window_get_x() { return getWindowDimension(0); } int window_get_y() { return getWindowDimension(1); } int window_get_width() { return getWindowDimension(2); } int window_get_height() { return getWindowDimension(3); } //Setters void window_set_position(int x,int y) { XWindowAttributes wa; XGetWindowAttributes(disp,win,&wa); XMoveWindow(disp,win,(int) x - wa.x,(int) y - wa.y); } void window_set_size(unsigned int w,unsigned int h) { XResizeWindow(disp,win, w, h); } void window_set_rectangle(int x,int y,int w,int h) { XMoveResizeWindow(disp, win, x, y, w, h); } //Center void window_center() { Window r; int x,y; uint w,h,b,d; XGetGeometry(disp,win,&r,&x,&y,&w,&h,&b,&d); Screen *s = DefaultScreenOfDisplay(disp); XMoveWindow(disp,win,s->width/2-w/2,s->height/2-h/2); } //////////////// // FULLSCREEN // //////////////// enum { _NET_WM_STATE_REMOVE, _NET_WM_STATE_ADD, _NET_WM_STATE_TOGGLE }; void window_set_fullscreen(bool full) { Atom wmState = XInternAtom(disp, "_NET_WM_STATE", False); Atom aFullScreen = XInternAtom(disp,"_NET_WM_STATE_FULLSCREEN", False); XEvent xev; xev.xclient.type=ClientMessage; xev.xclient.serial = 0; xev.xclient.send_event=True; xev.xclient.window=win; xev.xclient.message_type=wmState; xev.xclient.format=32; xev.xclient.data.l[0] = (full ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE); xev.xclient.data.l[1] = aFullScreen; xev.xclient.data.l[2] = 0; XSendEvent(disp,DefaultRootWindow(disp),False,SubstructureRedirectMask|SubstructureNotifyMask,&xev); } // FIXME: Looks like I gave up on this one bool window_get_fullscreen() { Atom aFullScreen = XInternAtom(disp,"_NET_WM_STATE_FULLSCREEN",False); Atom ra; int ri; unsigned long nr, bar; unsigned char *data; int stat = XGetWindowProperty(disp,win,aFullScreen,0L,0L,False,AnyPropertyType,&ra,&ri,&nr,&bar,&data); if (stat != Success) { printf("Status: %d\n",stat); //return 0; } /*printf("%d %d %d %d\n",ra,ri,nr,bar); for (int i = 0; i < nr; i++) printf("%02X ",data[i]); printf("\n");*/ return 0; } //default + -5 I \ | / - ^ ... drg no - | drg3 ... X ... ? url + short curs[] = { 68, 68, 68, 130, 52, 152, 135, 116, 136, 108, 114, 150, 90, 68, 108, 116, 90, 150, 0, 150, 92, 60, 52}; void window_set_cursor(int c) { XUndefineCursor(disp,win); XDefineCursor(disp, win, (c == -1) ? NoCursor : XCreateFontCursor(disp,curs[-c])); } // FIXME: MOVEME: I can't decide where the hell to put this. void screen_refresh() { glXSwapBuffers(disp,win); } namespace enigma { char keymap[256]; char usermap[256]; void initkeymap() { // Pretend this part doesn't exist keymap[0x51] = vk_left; keymap[0x53] = vk_right; keymap[0x52] = vk_up; keymap[0x54] = vk_down; keymap[0xE3] = vk_control; keymap[0xE4] = vk_control; keymap[0xE9] = vk_alt; keymap[0xEA] = vk_alt; keymap[0xE1] = vk_shift; keymap[0xE2] = vk_shift; keymap[0x0D] = vk_enter; keymap[0x85] = vk_lsuper; keymap[0x86] = vk_rsuper; keymap[0x17] = vk_tab; keymap[0x42] = vk_caps; keymap[0x4E] = vk_scroll; keymap[0x7F] = vk_pause; keymap[0x9E] = vk_numpad0; keymap[0x9C] = vk_numpad1; keymap[0x99] = vk_numpad2; keymap[0x9B] = vk_numpad3; keymap[0x96] = vk_numpad4; keymap[0x9D] = vk_numpad5; keymap[0x98] = vk_numpad6; keymap[0x95] = vk_numpad7; keymap[0x97] = vk_numpad8; keymap[0x9A] = vk_numpad9; keymap[0xAF] = vk_divide; keymap[0xAA] = vk_multiply; keymap[0xAD] = vk_subtract; keymap[0xAB] = vk_add; keymap[0x9F] = vk_decimal; keymap[0xBE] = vk_f1; keymap[0xBF] = vk_f2; keymap[0xC0] = vk_f3; keymap[0xC1] = vk_f4; keymap[0xC2] = vk_f5; keymap[0xC3] = vk_f6; keymap[0xC4] = vk_f7; keymap[0xC5] = vk_f8; keymap[0xC6] = vk_f9; keymap[0xC7] = vk_f10; keymap[0xC8] = vk_f11; keymap[0xC9] = vk_f12; keymap[0x08] = vk_backspace; keymap[0x1B] = vk_escape; keymap[0x50] = vk_home; keymap[0x57] = vk_end; keymap[0x55] = vk_pageup; keymap[0x56] = vk_pagedown; keymap[0xFF] = vk_delete; keymap[0x63] = vk_insert; // Set up identity map... for (int i = 0; i < 'a'; i++) usermap[i] = i; for (int i = 'a'; i <= 'z'; i++) // 'a' to 'z' wrap to 'A' to 'Z' usermap[i] = i + 'A' - 'a'; for (int i = 'z'+1; i < 255; i++) usermap[i] = i; } } #include <sys/time.h> extern double fps; namespace enigma { string* parameters; unsigned int parameterc; void windowsystem_write_exename(char* x) { unsigned irx = 0; if (enigma::parameterc) for (irx = 0; enigma::parameters[0][irx] != 0; irx++) x[irx] = enigma::parameters[0][irx]; x[irx] = 0; } #define hielem 9 static int last_second[hielem+1] = {0},last_microsecond[hielem+1] = {0}; void sleep_for_framerate(int rs) { timeval tv; for (int i=1; i<hielem+1; i++) { last_microsecond[i-1] = last_microsecond[i]; last_second[i-1] = last_second[i]; } //How many microseconds since 1970? herp gettimeofday(&tv, NULL); // I'm feeling hacky, so we'll give the processor a millisecond to take care // of these calculations and hop threads. I'd rather be fast than slow. int sdur = 1000000/rs - 1000 - (tv.tv_sec - last_second[hielem]) * 1000000 - (tv.tv_usec - last_microsecond[hielem]); if (sdur > 0 and sdur < 1000000) usleep(sdur); // Store this time for diff next time gettimeofday(&tv, NULL); last_second[hielem] = tv.tv_sec, last_microsecond[hielem] = tv.tv_usec; fps = (hielem+1)*1000000 / ((last_second[hielem] - last_second[0]) * 1000000 + (last_microsecond[hielem] - last_microsecond[0])); } } #include "../../Universal_System/globalupdate.h" void io_handle() { enigma::input_push(); while(XQLength(disp)) { printf("processing an event...\n"); if(handleEvents() > 0) exit(0); } enigma::update_globals(); } void io_clear() { for (int i = 0; i < 255; i++) enigma::keybdstatus[i] = enigma::last_keybdstatus[i] = 0; for (int i = 0; i < 3; i++) enigma::mousestatus[i] = enigma::last_mousestatus[i] = 0; } void keyboard_wait() { for (;;) { io_handle(); for (int i = 0; i < 255; i++) if (enigma::keybdstatus[i]) return; usleep(10000); // Sleep 1/100 second } } string parameter_string(unsigned num) { return num < enigma::parameterc ? enigma::parameters[num] : ""; } int parameter_count() { return enigma::parameterc; } /* display_get_width() // Returns the width of the display in pixels. display_get_height() // Returns the height of the display in pixels. display_set_size(w,h) Sets the width and height of the display in pixels. Returns whether this was successful. (Realize that only certain combinations are allowed.) display_get_colordepth() Returns the color depth in bits. display_get_frequency() Returns the refresh frequency of the display. display_set_colordepth(coldepth) Sets the color depth. In general only 16 and 32 are allowed values. Returns whether successful. display_set_frequency(frequency) Sets the refresh frequency for the display. Only few frequencies are allowed. Typically you could set this to 60 with a same room speed to get smooth 60 frames per second motion. Returns whether successful. display_set_all(w,h,frequency,coldepth) Sets all at once. Use -1 for values you do not want to change. Returns whether successful. display_test_all(w,h,frequency,coldepth) Tests whether the indicated settings are allowed. It does not change the settings. Use -1 for values you do not want to change. Returns whether the settings are allowed. display_reset() Resets the display settings to the ones when the program was started. window_default() window_get_cursor() window_set_color(color) window_get_color() window_set_region_scale(scale,adaptwindow) window_get_region_scale() window_set_showborder(show) window_get_showborder() window_set_showicons(show) window_get_showicons() window_set_stayontop(stay) window_get_stayontop() window_set_sizeable(sizeable) window_get_sizeable() */
[ [ [ 1, 417 ] ] ]
8f24c0aaa5aca093b5321b9621a2fca809d39796
709cd826da3ae55945fd7036ecf872ee7cdbd82a
/Term/Bowling/tags/Submittion2/LethalBowling/OpenGlException.cpp
4150132f43f8d46b4298bc9b76547ab8963e5a35
[]
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
248
cpp
#include "OpenGlException.h" namespace Virgin { OpenGlException::OpenGlException(void) { } OpenGlException::OpenGlException(const String& message) : Exception(message) { } OpenGlException::~OpenGlException(void) { } }
[ [ [ 1, 20 ] ] ]
0f0e8ec8f41e3d17b14661487477c878481fd39e
1193b8d2ab6bb40ce2adbf9ada5b3d1124f1abb3
/branches/basicelements/libsonetto/include/SonettoWindowSkinManager.h
3597de41526ed825ee860573e5f7a37a51f7ce3b
[]
no_license
sonetto/legacy
46bb60ef8641af618d22c08ea198195fd597240b
e94a91950c309fc03f9f52e6bc3293007c3a0bd1
refs/heads/master
2021-01-01T16:45:02.531831
2009-09-10T21:50:42
2009-09-10T21:50:42
32,183,635
0
2
null
null
null
null
UTF-8
C++
false
false
2,654
h
/*----------------------------------------------------------------------------- Copyright (c) 2009, Sonetto Project Developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the Sonetto Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -----------------------------------------------------------------------------*/ #ifndef SONETTO_WINDOWSKINMANAGER_H #define SONETTO_WINDOWSKINMANAGER_H #include <OgreResourceManager.h> #include "SonettoPrerequisites.h" #include "SonettoWindowSkin.h" namespace Sonetto { class SONETTO_API WindowSkinManager : public Ogre::ResourceManager, public Ogre::Singleton<WindowSkinManager> { private: // must implement this from ResourceManager's interface Ogre::Resource *createImpl(const Ogre::String &name, Ogre::ResourceHandle handle, const Ogre::String &group, bool isManual, Ogre::ManualResourceLoader *loader, const Ogre::NameValuePairList *createParams); public: WindowSkinManager(); virtual ~WindowSkinManager(); virtual WindowSkinPtr load(const Ogre::String &name, const Ogre::String &group); static WindowSkinManager &getSingleton(); static WindowSkinManager *getSingletonPtr(); }; } #endif // SONETTO_WINDOWSKINMANAGER_H
[ [ [ 1, 58 ] ] ]
b953b9b07aa684396b83bb733f644b5f87e494c0
f9351a01f0e2dec478e5b60c6ec6445dcd1421ec
/itl/libs/itl/test/test_interval_map/test_interval_map.cpp
e281068f8a2ee0e3cdfcb592337ed7d9f1ba84b1
[ "BSL-1.0" ]
permissive
WolfgangSt/itl
e43ed68933f554c952ddfadefef0e466612f542c
6609324171a96565cabcf755154ed81943f07d36
refs/heads/master
2016-09-05T20:35:36.628316
2008-11-04T11:44:44
2008-11-04T11:44:44
327,076
0
1
null
null
null
null
UTF-8
C++
false
false
1,392
cpp
/*----------------------------------------------------------------------------+ Copyright (c) 2008-2008: Joachim Faulhaber +-----------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENCE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +----------------------------------------------------------------------------*/ #define BOOST_TEST_MODULE itl::interval_set unit test #include <string> #include <boost/mpl/list.hpp> #include <boost/test/unit_test.hpp> #include <boost/test/test_case_template.hpp> // interval instance types #include "../test_type_lists.hpp" #include "../test_value_maker.hpp" #include <boost/itl/interval_map.hpp> using namespace std; using namespace boost; using namespace unit_test; using namespace boost::itl; // ----------------------------------------------------------------------------- // test_interval_set_shared are tests that should give identical results for all // interval_sets: interval_set, separate_interval_set and split_interval_set. #include "../test_interval_map_shared.hpp" // Due to limited expressiveness of the testing framework, the testcode in files // test_interval_map{,_split}_shared.cpp is generated through code // replication. #include "test_interval_map_shared.cpp"
[ "jofaber@6b8beb3d-354a-0410-8f2b-82c74c7fef9a" ]
[ [ [ 1, 35 ] ] ]
4468db5edfed22a90f92b4a55836672c1bdea6b4
ef25bd96604141839b178a2db2c008c7da20c535
/src/src/AIToolkit/AIRess.h
c60fe1de65d3cfb44c4d3e9e64f013cdb0ac81b5
[]
no_license
OtterOrder/crock-rising
fddd471971477c397e783dc6dd1a81efb5dc852c
543dc542bb313e1f5e34866bd58985775acf375a
refs/heads/master
2020-12-24T14:57:06.743092
2009-07-15T17:15:24
2009-07-15T17:15:24
32,115,272
0
0
null
null
null
null
UTF-8
C++
false
false
267
h
#ifndef _AIRess_H_ #define _AIRess_H_ #include <Core/Types/Vector.h> class AIRess { public: // Variable enum statesGZip { IDLE, MOVE, ATTACK, EVADE }; public: // Function static int calculDistance( Vector3f pos1, Vector3f pos2 ); }; #endif
[ "olivier.levaque@7c6770cc-a6a4-11dd-91bf-632da8b6e10b" ]
[ [ [ 1, 19 ] ] ]
d388a8c554c77b7f8d9b182e71db28a3a0635b25
967868cbef4914f2bade9ef8f6c300eb5d14bc57
/Date/Interval.hpp
a8035db780deb0a8b0073d1213089cd951753c8b
[]
no_license
saminigod/baseclasses-001
159c80d40f69954797f1c695682074b469027ac6
381c27f72583e0401e59eb19260c70ee68f9a64c
refs/heads/master
2023-04-29T13:34:02.754963
2009-10-29T11:22:46
2009-10-29T11:22:46
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
745
hpp
/* © Vestris Inc., Geneva, Switzerland http://www.vestris.com, 1994-1999 All Rights Reserved _____________________________________________________ written by Daniel Doubrovkine - [email protected] */ #ifndef BASE_INTERVAL_HPP #define BASE_INTERVAL_HPP #include <platform/include.hpp> #include <Object/Object.hpp> typedef enum { itMicroseconds, itMilliseconds, itSeconds, itMinutes, itHours } CIntervalType; class CInterval : public CObject { #ifdef _UNIX property(struct timeval, Start); #endif #ifdef _WIN32 property(struct base_timeb, Start); #endif public: CInterval(void); virtual ~CInterval(void); long Get(CIntervalType = itMilliseconds) const; void Reset(void); }; #endif
[ [ [ 1, 34 ] ] ]
cd9c98db97d2d7c45c6e5ad4ead35edff98ea723
9566086d262936000a914c5dc31cb4e8aa8c461c
/EnigmaProtocol/Messages/RequestMessages.hpp
02463dd95567e1dc51ef490614a2451ba3cac157
[]
no_license
pazuzu156/Enigma
9a0aaf0cd426607bb981eb46f5baa7f05b66c21f
b8a4dfbd0df206e48072259dbbfcc85845caad76
refs/heads/master
2020-06-06T07:33:46.385396
2011-12-19T03:14:15
2011-12-19T03:14:15
3,023,618
1
0
null
null
null
null
WINDOWS-1252
C++
false
false
2,000
hpp
#ifndef REQUESTMESSAGES_HPP_INCLUDED #define REQUESTMESSAGES_HPP_INCLUDED /* Copyright © 2009 Christopher Joseph Dean Schaefer (disks86) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "LoginRequestMessage.hpp" #include "MovementRequestMessage.hpp" #include "CharacterCreationRequestMessage.hpp" #include "CharacterListRequestMessage.hpp" #include "CharacterSelectionRequestMessage.hpp" #include "PlayerOnMapUpdateRequestMessage.hpp" #include "ChatRequestMessage.hpp" #include "VoiceChatRequestMessage.hpp" #include "ChangeMapRequestMessage.hpp" #include "InviteRequestMessage.hpp" #include "KickRequestMessage.hpp" #include "PlayerListRequestMessage.hpp" #include "CreatePlayerOrganizationRequestMessage.hpp" #include "ModifyPlayerOrganizationRankRequestMessage.hpp" #include "SetPlayerRankRequestMessage.hpp" #include "RollRequestMessage.hpp" #include "ServerTimeRequestMessage.hpp" #include "NpcOnMapUpdateRequestMessage.hpp" #include "MonsterOnMapUpdateRequestMessage.hpp" #include "ItemOnMapUpdateRequestMessage.hpp" #include "NpcChatRequestMessage.hpp" #include "ItemTransferRequestMessage.hpp" #include "SkillRequestMessage.hpp" #endif // REQUESTMESSAGES_HPP_INCLUDED
[ [ [ 1, 40 ] ] ]
fb64b89083d4a758e120fe4a84267663fc497551
ad8046a7c792e31fab898fa13a7693ff34ef2b83
/eFilm/CustomeMessageExample/stdafx.cpp
95df886f1db966e8ed42acc2fb0f351ffb984c05
[]
no_license
alibinjamil/datamedris
df5f205775e78b76f15155c27e316f81beba1660
3f4711ef3c43e21870261bfbcab7fbafd369e114
refs/heads/master
2016-08-12T06:06:00.915112
2010-12-22T08:47:14
2010-12-22T08:47:14
44,970,197
0
0
null
null
null
null
UTF-8
C++
false
false
219
cpp
// stdafx.cpp : source file that includes just the standard includes // CustomeMessageExample.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
[ [ [ 1, 5 ] ] ]
54144ebcb662ee141bdfff9c22ffb44f63975c2d
6dac9369d44799e368d866638433fbd17873dcf7
/src/branches/01032005/sound/fmod/fmod_dll.cpp
78824343da58bc89a29452415074cc283abb4ac3
[]
no_license
christhomas/fusionengine
286b33f2c6a7df785398ffbe7eea1c367e512b8d
95422685027bb19986ba64c612049faa5899690e
refs/heads/master
2020-04-05T22:52:07.491706
2006-10-24T11:21:28
2006-10-24T11:21:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
630
cpp
#include <Fusion.h> #include <FusionPlugin.h> #include <FMODSound.h> Fusion *fusion; //==================================== // Creates the DInputDeviceDB object //==================================== FUSIONPLUGIN void GetInstance(Fusion &f) { fusion = &f; if(fusion->Sound == NULL){ fusion->Sound = new FMODSound(); fusion->Sound->Initialise(); } } //==================================== // Destroys the DInputDeviceDB object //==================================== FUSIONPLUGIN void DestroyInstance(void) { if(fusion->Sound != NULL){ delete fusion->Sound; fusion->Sound = NULL; } }
[ "chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7" ]
[ [ [ 1, 30 ] ] ]
8e47bc5c7052904dd9c421b7cd0730fdb84eeb5a
222bc22cb0330b694d2c3b0f4b866d726fd29c72
/src/brookbox/wm2/WmlMorphController.inl
305a75091c15ffb05dafedecdedb30db6ae1e46f
[ "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
2,322
inl
// Magic Software, Inc. // http://www.magic-software.com // http://www.wild-magic.com // Copyright (c) 2003. All Rights Reserved // // The Wild Magic Library (WML) source code is supplied under the terms of // the license agreement http://www.magic-software.com/License/WildMagic.pdf // and may not be copied or disclosed except in accordance with the terms of // that agreement. //---------------------------------------------------------------------------- inline int MorphController::GetTargetQuantity () const { return m_iTargetQuantity; } //---------------------------------------------------------------------------- inline Vector3f* MorphController::SetVertices (int i, Vector3f* akVertex) { assert( i < m_iTargetQuantity ); Vector3f* akSave = m_aakVertex[i]; m_aakVertex[i] = akVertex; return akSave; } //---------------------------------------------------------------------------- inline Vector3f* MorphController::GetVertices (int i) { assert( i < m_iTargetQuantity ); return m_aakVertex[i]; } //---------------------------------------------------------------------------- inline int MorphController::GetKeyQuantity () const { return m_iKeyQuantity; } //---------------------------------------------------------------------------- inline float* MorphController::SetTimes (float* afTime) { float* afSave = m_afTime; m_afTime = afTime; return afSave; } //---------------------------------------------------------------------------- inline float* MorphController::GetTimes () { return m_afTime; } //---------------------------------------------------------------------------- inline float* MorphController::SetWeights (int i, float* afWeight) { assert( i < m_iKeyQuantity ); float* afSave = m_aafWeight[i]; m_aafWeight[i] = afWeight; return afSave; } //---------------------------------------------------------------------------- inline float* MorphController::GetWeights (int i) { assert( i < m_iKeyQuantity ); return m_aafWeight[i]; } //---------------------------------------------------------------------------- inline bool& MorphController::UpdateNormals () { return m_bUpdateNormals; } //----------------------------------------------------------------------------
[ [ [ 1, 66 ] ] ]
ab6831cf7d87b8cdc9a95f4b77765f0aeac9e2d4
f77f105963cd6447d0f392b9ee7d923315a82ac6
/Box2DandOgre/source/GameFramework.cpp
e27677fd714918449c23dc9d5005197921165163
[]
no_license
GKimGames/parkerandholt
8bb2b481aff14cf70a7a769974bc2bb683d74783
544f7afa462c5a25c044445ca9ead49244c95d3c
refs/heads/master
2016-08-07T21:03:32.167272
2010-08-26T03:01:35
2010-08-26T03:01:35
32,834,451
0
0
null
null
null
null
UTF-8
C++
false
false
8,549
cpp
/*============================================================================= GameFramework.cpp Author: Matt King =============================================================================*/ #include "GameFramework.h" #include "GameObject.h" #include "AppStateManager.hpp" using namespace Ogre; template<> GameFramework* Ogre::Singleton<GameFramework>::ms_Singleton = 0; //============================================================================= // GameFramework // GameFramework::GameFramework() { numScreenShots_ = 0; root_ = 0; renderWindow_ = 0; viewport_ = 0; log_ = 0; timer_ = 0; inputManager_ = 0; keyboard_ = 0; mouse_ = 0; debugOverlay_ = 0; infoOverlay_ = 0; } //============================================================================= // GameFramework // GameFramework::~GameFramework() { if(inputManager_) { delete keyboard_; delete mouse_; OIS::InputManager::destroyInputSystem(inputManager_); } delete root_; } //============================================================================= // InitOgre // /// Initialize Ogre. Shows a load image and loads all the resources. It also /// sets up OIS listeners. bool GameFramework::InitOgre(Ogre::String wndTitle, OIS::KeyListener *pKeyListener, OIS::MouseListener *pMouseListener) { Ogre::LogManager* logMgr = new Ogre::LogManager(); log_ = Ogre::LogManager::getSingleton().createLog("ParkerAndHoltLog.log", true, true, false); log_->setDebugOutputEnabled(true); root_ = new Ogre::Root(); //try first to restore an existing config //if (!root_->restoreConfig()) { if(root_->showConfigDialog()) { // If returned true, user clicked OK so initialise // Here we choose to let the system create a default rendering window by passing 'true' renderWindow_ = root_->initialise(true, wndTitle); } else { return false; } } viewport_ = renderWindow_->addViewport(0); // Creating a load image // First we have to load the image and material, these are stored in the loadScreen folder Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../media/materials/loadScreen", "FileSystem", "LoadScreen"); Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("LoadScreen"); // Create background rectangle covering the whole screen Rectangle2D* rect = new Rectangle2D(true); rect->setCorners(-0.5, 0.5, 0.5, -0.5); rect->setMaterial("Materials/LoadMaterial"); // Use infinite AAB to always stay visible AxisAlignedBox aabInf; aabInf.setInfinite(); rect->setBoundingBox(aabInf); Ogre::SceneManager* sceneMgr = root_->createSceneManager(ST_GENERIC, "LoadScreen"); sceneMgr->setAmbientLight(Ogre::ColourValue(1, 1, 1)); SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode("Background"); node->attachObject(rect); camera_ = sceneMgr->createCamera("LoadCamera"); camera_->setNearClipDistance(1); camera_->setAspectRatio(Real(viewport_->getActualWidth()) / Real(viewport_->getActualHeight())); viewport_->setCamera(camera_); // Render a frame so our loadScreen is drawn. root_->renderOneFrame(); // Setup the OIS input stuffs. unsigned long hWnd = 0; OIS::ParamList paramList; renderWindow_->getCustomAttribute("WINDOW", &hWnd); paramList.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd))); inputManager_ = OIS::InputManager::createInputSystem(paramList); keyboard_ = static_cast<OIS::Keyboard*>(inputManager_->createInputObject(OIS::OISKeyboard, true)); mouse_ = static_cast<OIS::Mouse*>(inputManager_->createInputObject(OIS::OISMouse, true)); mouse_->getMouseState().height = renderWindow_->getHeight(); mouse_->getMouseState().width = renderWindow_->getWidth(); if(pKeyListener == 0) keyboard_->setEventCallback(this); else keyboard_->setEventCallback(pKeyListener); if(pMouseListener == 0) mouse_->setEventCallback(this); else mouse_->setEventCallback(pMouseListener); // Load the resources. Ogre::String secName, typeName, archName; Ogre::ConfigFile cf; cf.load("resources.cfg"); Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator(); while (seci.hasMoreElements()) { secName = seci.peekNextKey(); Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); Ogre::ConfigFile::SettingsMultiMap::iterator i; for (i = settings->begin(); i != settings->end(); ++i) { typeName = i->first; archName = i->second; Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName); } } Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); timer_ = new Ogre::Timer(); timer_->reset(); renderWindow_->setActive(true); return true; } //============================================================================= // KeyPressed // /// bool GameFramework::KeyPressed(const OIS::KeyEvent &keyEventRef) { if(keyboard_->isKeyDown(OIS::KC_SYSRQ)) { std::ostringstream ss; ss << "screenshot_" << ++numScreenShots_ << ".png"; renderWindow_->writeContentsToFile(ss.str()); return true; } if(keyboard_->isKeyDown(OIS::KC_O)) { if(debugOverlay_) { if(!debugOverlay_->isVisible()) debugOverlay_->show(); else debugOverlay_->hide(); } } return true; } //============================================================================= // KeyReleased // /// bool GameFramework::KeyReleased(const OIS::KeyEvent &keyEventRef) { return true; } //============================================================================= // MouseMoved // /// bool GameFramework::MouseMoved(const OIS::MouseEvent &evt) { return true; } //============================================================================= // MousePressed // /// bool GameFramework::MousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id) { return true; } //============================================================================= // MouseReleased // /// bool GameFramework::MouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id) { return true; } //============================================================================= // UpdateOgre // /// void GameFramework::UpdateOgre(double timeSinceLastFrame) { UpdateStats(); } //============================================================================= // UpdateOgre // /// Updates the stats, FPS etc. void GameFramework::UpdateStats() { static String currFps = "Current FPS: "; static String avgFps = "Average FPS: "; static String bestFps = "Best FPS: "; static String worstFps = "Worst FPS: "; static String tris = "Triangle Count: "; static String batches = "Batch Count: "; const RenderTarget::FrameStats& stats = renderWindow_->getStatistics(); /* OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps"); Ogre::Real left = guiAvg->getParent()->getLeft(); Ogre::Real top = guiAvg->getParent()->getTop(); OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps"); OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps"); guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)); guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS) +" "+StringConverter::toString(stats.bestFrameTime)+" ms"); guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS) +" "+StringConverter::toString(stats.worstFrameTime)+" ms"); OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount)); OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Core/NumBatches"); guiBatches->setCaption(batches + StringConverter::toString(stats.batchCount)); OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); guiDbg->setCaption(""); */ }
[ "mapeki@34afb35a-be5b-11de-bb5c-85734917f5ce" ]
[ [ [ 1, 296 ] ] ]
8300e52da5fefba3e2f8dfe07e13787ceed1b070
b08e948c33317a0a67487e497a9afbaf17b0fc4c
/Display/DisplayBuffer.cpp
e970aabbc394ee53e7774ac73eca29ab1fb38e88
[]
no_license
15831944/bastionlandscape
e1acc932f6b5a452a3bd94471748b0436a96de5d
c8008384cf4e790400f9979b5818a5a3806bd1af
refs/heads/master
2023-03-16T03:28:55.813938
2010-05-21T15:00:07
2010-05-21T15:00:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,284
cpp
#include "stdafx.h" #include "../Display/Display.h" namespace ElixirEngine { //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- DisplayVertexBuffer::DisplayVertexBuffer(DisplayRef _rDisplay) : CoreObject(), m_rDisplay(_rDisplay), m_uBufferSize(0), m_uVertexSize(0), m_uVertexDecl(0), m_pVertexBuffer(NULL) { } DisplayVertexBuffer::~DisplayVertexBuffer() { } bool DisplayVertexBuffer::Create(const boost::any& _rConfig) { CreateInfo* pInfo = boost::any_cast<CreateInfo*>(_rConfig); bool bResult = (NULL != pInfo) && (0 != pInfo->m_uBufferSize) && (NULL != pInfo->m_pVertexElement); if (false != bResult) { Release(); m_uBufferSize = pInfo->m_uBufferSize; m_uVertexSize = pInfo->m_uVertexSize; HRESULT hResult = m_rDisplay.GetDevicePtr()->CreateVertexBuffer( m_uBufferSize, D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &m_pVertexBuffer, NULL); bResult = SUCCEEDED(hResult); } if (false != bResult) { m_uVertexDecl = m_rDisplay.CreateVertexDeclaration(pInfo->m_pVertexElement); bResult = (0 != m_uVertexDecl); } return bResult; } void DisplayVertexBuffer::Update() { } void DisplayVertexBuffer::Release() { if (0 != m_uVertexDecl) { m_rDisplay.ReleaseVertexDeclaration(m_uVertexDecl); m_uVertexDecl = 0; } if (NULL != m_pVertexBuffer) { m_pVertexBuffer->Release(); m_pVertexBuffer = NULL; } } bool DisplayVertexBuffer::Set(const VoidPtr _pData) { VoidPtr pLockedData = NULL; HRESULT hResult = m_pVertexBuffer->Lock(0, m_uBufferSize, &pLockedData, 0); if (SUCCEEDED(hResult)) { memcpy(pLockedData, _pData, m_uBufferSize); m_pVertexBuffer->Unlock(); } return (SUCCEEDED(hResult)); } bool DisplayVertexBuffer::Use() { VertexBufferPtr pCurrentVertexBuffer; unsigned int uOffset; unsigned int uStride; HRESULT hResult = m_rDisplay.GetDevicePtr()->GetStreamSource(0, &pCurrentVertexBuffer, &uOffset, &uStride); if ((SUCCEEDED(hResult)) && (pCurrentVertexBuffer != m_pVertexBuffer)) { hResult = m_rDisplay.GetDevicePtr()->SetStreamSource(0, m_pVertexBuffer, 0, m_uVertexSize); } if (SUCCEEDED(hResult)) { const Key uCurrentVertexDecl = m_rDisplay.GetCurrentVertexDeclaration(); if (uCurrentVertexDecl != m_uVertexDecl) { hResult = m_rDisplay.SetVertexDeclaration(m_uVertexDecl); } } return (SUCCEEDED(hResult)); } DisplayVertexBufferPtr DisplayVertexBuffer::NewInstance() { return new DisplayVertexBuffer(*Display::GetInstance()); } void DisplayVertexBuffer::DeleteInstance(DisplayVertexBufferPtr _pObject) { delete _pObject; } //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- DisplayIndexBuffer::DisplayIndexBuffer(DisplayRef _rDisplay) : CoreObject(), m_rDisplay(_rDisplay), m_uBufferSize(0), m_b16Bits(false), m_pIndexBuffer(NULL) { } DisplayIndexBuffer::~DisplayIndexBuffer() { } bool DisplayIndexBuffer::Create(const boost::any& _rConfig) { CreateInfo* pInfo = boost::any_cast<CreateInfo*>(_rConfig); bool bResult = (NULL != pInfo) && (0 != pInfo->m_uBufferSize); if (false != bResult) { Release(); m_b16Bits = pInfo->m_b16Bits; m_uBufferSize = pInfo->m_uBufferSize * ((false != m_b16Bits) ? sizeof(Word) : sizeof(UInt)); HRESULT hResult = m_rDisplay.GetDevicePtr()->CreateIndexBuffer( m_uBufferSize, D3DUSAGE_WRITEONLY, (false != m_b16Bits) ? D3DFMT_INDEX16 : D3DFMT_INDEX32, D3DPOOL_DEFAULT, &m_pIndexBuffer, NULL); bResult = SUCCEEDED(hResult); } return bResult; } void DisplayIndexBuffer::Update() { } void DisplayIndexBuffer::Release() { if (NULL != m_pIndexBuffer) { m_pIndexBuffer->Release(); m_pIndexBuffer = NULL; } } bool DisplayIndexBuffer::Set(const VoidPtr _pData) { VoidPtr pLockedData = NULL; HRESULT hResult = m_pIndexBuffer->Lock(0, m_uBufferSize, &pLockedData, 0); if (SUCCEEDED(hResult)) { memcpy(pLockedData, _pData, m_uBufferSize); m_pIndexBuffer->Unlock(); } return (SUCCEEDED(hResult)); } bool DisplayIndexBuffer::Use() { IndexBufferPtr pCurrentIndexBuffer; HRESULT hResult = m_rDisplay.GetDevicePtr()->GetIndices(&pCurrentIndexBuffer); if ((SUCCEEDED(hResult)) && (pCurrentIndexBuffer != m_pIndexBuffer)) { hResult = m_rDisplay.GetDevicePtr()->SetIndices(m_pIndexBuffer); } return (SUCCEEDED(hResult)); } DisplayIndexBufferPtr DisplayIndexBuffer::NewInstance() { return new DisplayIndexBuffer(*Display::GetInstance()); } void DisplayIndexBuffer::DeleteInstance(DisplayIndexBufferPtr _pObject) { delete _pObject; } }
[ "voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329" ]
[ [ [ 1, 205 ] ] ]
379dd8c0f6a9babbd4a90f6e828cc3b4d9918c93
864b3c4db459e0b497eab4ec85cce01122c48fad
/kg_dag_walk/dag_walk.h
d2d9c5216e723e477ff3df8ee33b08676ac421f1
[]
no_license
kgeorge/kgeorge-lib
e1b6334f7e02822886641c5a92956045bfd88349
c81040deeebb9324845928a65d1d9146fac3d2dd
refs/heads/master
2021-01-10T08:19:23.124790
2009-07-12T23:04:54
2009-07-12T23:04:54
36,910,482
0
0
null
null
null
null
UTF-8
C++
false
false
8,146
h
#if !defined(KG_DAGWALK_H_) #define KG_DAGWALK_H_ #include <cassert> /** * dag_walk exemplifies a generic dag walk, * The nodes which the dag is built up of can be any user defined Node data structure. * Its only requirement is that it should have a way to set/unset a visit flag, * which can be used to trackn whrether the node had been already visited or not. * The nodes can be NULL nodes ( hence we are passing them as pointers) * Also, the nodes thus passed are mutable( ie: not const nodes). * The node_trait class defines access functions for the node. * * The actual operation done upon visiting each dag node is encapsulated by a walk * template class W. The walk_traits accessor class defines accssors to get and set the * required information from W. * **/ namespace kg { template < typename N > struct node_traits { //get the visit tag from the node static bool get_visit_tag(const N * pNode ) { return false;} //set the visit flag static void set_visit_tag( N *pNode, bool b ) { return; } //how the children of the nodes are defined typedef N * node_container; typedef N ** node_iterator; typedef const N ** node_const_iterator; //get the begin and end iterators for the children static typename node_iterator get_node_container_begin( N *pNode ) { return NULL;} static typename node_const_iterator get_node_container_begin(const N *pNode ) { return NULL;} static typename node_iterator get_node_container_end( N *pNode ) { return NULL;} static typename node_const_iterator get_node_container_end(const N *pNode ) { return NULL;} }; struct walk_traits_base { /** *these specify the different return types *for the dag walk * eOK = the result of the walk was a success * ePrune = further traversal of the descenadnts of this node is disallowed * eStop = stop the traversal and return immediately * eError = same as eStop, but signifies an error **/ typedef enum { eOK, ePrune, eStop, eError } walk_result; }; template < typename N, typename W> struct walk_traits : public walk_traits_base { //W should have a defined an internal class or struct //called stack_type. Further it should have the member variables // stack_type & get_stack() // const stack_type &get_stack() const; //THis is not much of a problem usually since, //W is a class that the user will be makin exclusively for //the purpose of walk unlike N. N may be more //or a less predfined class, and its definition //may be not modifiable by the user. typedef typename W::stack_type stack_type; //does this walk allows multiple visits for //the dag node. generally during a dag walk, the nodes // visisted once are not visited again static const bool is_multiple_visits_allowed = false; //main operation that need be performed on the node //THis is called in dag_walk, for each node, //before we recurse into the dscendents static walk_result pre( N *pNode, W &w ) { return eOK;} //get the curent stack variable of W static stack_type & get_stack( W & w){ return w.get_stack(); } static const stack_type &get_stack( const W & w) { return w.get_stack();} //set the curent stack on W static void set_stack( W &w, const stack_type &s ){ return ; } //main operatrion that will be called after visiting the descendants //this function is called after visiting the children static walk_result post( N * pNode, W &w, const walk_result &res ){ return res;} }; /** * Generic dag_walk procedure * * - do the pre operation on the node * - visit the children and call dag_walk recursively * - do the post operation on th node * @param pNode[in, out] pointer to node. * Note that pNode is a not a const pointer and is mutable * * @param w [in, out] the walk operation on the node * @return walk_result **/ template < typename N, typename W > walk_traits_base::walk_result dag_walk( N *pNode, W &w) { typedef typename walk_traits<N, W> wtraits; typedef typename node_traits< N > ntraits; typedef walk_traits_base::walk_result walk_result; walk_result res = wtraits::eOK; bool b_visit_children = true; //there is no need to visit this node //if multiple visits are not allowed and it has already been visited earlier bool b_should_do_main_operations = wtraits::is_multiple_visits_allowed || !ntraits::get_visit_tag( pNode); if( b_should_do_main_operations) { res = wtraits::pre( pNode, w ); //set the visit flag for this node ntraits::set_visit_tag( pNode, true ); //if the result of the main operation //is prune, stop or error, the not visit children if ( res > wtraits::eOK) { b_visit_children = false; } } else { //there is no need to continue //this node has been visited once return res; } //if the children ought to be visisted if ( b_visit_children ) { //copy the curreht stack //we need to rstore it after visiting chilren wtraits::stack_type s_copy( wtraits::get_stack( w) ); ntraits::node_iterator nit, nbegin, nend; nbegin = ntraits::get_node_container_begin( pNode ); nend = ntraits::get_node_container_end( pNode ); for( nit = nbegin; nit != nend; ++ nit ) { N * pChild = *nit; assert( pChild ); res = dag_walk( pChild, w ); //restore the stack on w //so that the next child gets the same context wtraits::set_stack( w, s_copy); //if the rsult of this walk is more serious //than ePrune, let us quit if ( res >= wtraits::eStop ) { break; } } } //finally do the post operation //The post operation is the one done after vsisting the children. //It is passed the previous value of res. //So the first step in post, has to check the result so far, //and treat it accordingly if( res <= wtraits::ePrune ) { res = wtraits::post( pNode, w, res ); } return res; } /** * Generic tree_walk procedure * * - do the pre operation on the node * - visit the children and call tree_walk recursively * - do the post operation on th node * tree walk is a simplified form of dag walk * in that the nodes need nothave a visit flag mamber * @param pNode[in, out] pointer to node. * Note that pNode not a const pointer and is mutable * * @param w [in, out] the walk operation on the node * @return walk_result **/ template < typename W, typename N > walk_traits_base::walk_result tree_walk( W & w, N *pNode) { typedef typename walk_traits<W, N> wtraits; typedef typename node_traits< N > ntraits; typedef walk_traits_base::walk_result walk_result; using walk_traits_base::eOK; using walk_traits_base::ePrune; using walk_traits_base::eStop; using walk_traits_base::eError; walk_result res = wtraits::pre( w, pNode ); //if the result of the main operation //is prune, stop or eror, the not visist children bool b_visit_children = true; if ( res > eOK) { b_visit_children = false; } //if the children ought to be visisted if ( b_visit_children ) { //copy the curreht stack //we need to rstore it after vssiting chilren wtraits::stack_type s_copy( wtraits::get_stack( w) ); ntraits::node_iterator nit, nbegin, nend; nbegin = ntraits::get_node_container_begin( pNode ); nend = ntraits::get_node_container_end( pNode ); for( nit = nbegin; nit != nend; ++ nit ) { N * pChild = *nit; assert( pChild ); res = tree_walk( w, pChild ); //restore the stack on w //so that the next child gets the same context wtraits::set_stack( w, s_copy); //if the rsult of this walk is more serious //than ePrune, let us quit if ( res >= wtraits::eStop ) { break; } } } //finally do the post operation //The pst operation is the one done after vsisting the children. //It is passed the previous value of res. //So the first step in post, has to check the result so far, //and treat it accordingly if ( res <= ePrune ) { res = wtraits::post( w, pNode, res ); } return res; } }; //namespace kg #endif //KG_DAGWALK_H_
[ "kgeorge2@553ec044-b8b1-11dd-a067-9b1d96bc3259" ]
[ [ [ 1, 259 ] ] ]
92b832487c60064f2943b35a90c3ec3de21bc185
f8b364974573f652d7916c3a830e1d8773751277
/emulator/allegrex/instructions/HALT.h
4d0f0c81e25ec97c772c1cd791c752a7f4c43701
[]
no_license
lemmore22/pspe4all
7a234aece25340c99f49eac280780e08e4f8ef49
77ad0acf0fcb7eda137fdfcb1e93a36428badfd0
refs/heads/master
2021-01-10T08:39:45.222505
2009-08-02T11:58:07
2009-08-02T11:58:07
55,047,469
0
0
null
null
null
null
UTF-8
C++
false
false
1,035
h
template< > struct AllegrexInstructionTemplate< 0x70000000, 0xffffffff > : AllegrexInstructionUnknown { static AllegrexInstructionTemplate &self() { static AllegrexInstructionTemplate insn; return insn; } static AllegrexInstruction *get_instance() { return &AllegrexInstructionTemplate::self(); } virtual AllegrexInstruction *instruction(u32 opcode) { return this; } virtual char const *opcode_name() { return "HALT"; } virtual void interpret(Processor &processor, u32 opcode); virtual void disassemble(u32 address, u32 opcode, char *opcode_name, char *operands, char *comment); protected: AllegrexInstructionTemplate() {} }; typedef AllegrexInstructionTemplate< 0x70000000, 0xffffffff > AllegrexInstruction_HALT; namespace Allegrex { extern AllegrexInstruction_HALT &HALT; } #ifdef IMPLEMENT_INSTRUCTION AllegrexInstruction_HALT &Allegrex::HALT = AllegrexInstruction_HALT::self(); #endif
[ [ [ 1, 41 ] ] ]
59522dbf0cefb583618aec6d6dbd8445f79e2db9
cfa6cdfaba310a2fd5f89326690b5c48c6872a2a
/Sources/Server/M-Server/M-Server/M-ServerView.cpp
e91305191feac1a86589fdc4dca943dfae4a8780
[]
no_license
asdlei00/project-jb
1cc70130020a5904e0e6a46ace8944a431a358f6
0bfaa84ddab946c90245f539c1e7c2e75f65a5c0
refs/heads/master
2020-05-07T21:41:16.420207
2009-09-12T03:40:17
2009-09-12T03:40:17
40,292,178
0
0
null
null
null
null
UHC
C++
false
false
4,734
cpp
// M-ServerView.cpp : CMServerView 클래스의 구현 // #include "stdafx.h" #include "M-Server.h" #include "M-ServerDoc.h" #include "M-ServerView.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CMServerView IMPLEMENT_DYNCREATE(CMServerView, CFormView) BEGIN_MESSAGE_MAP(CMServerView, CFormView) ON_MESSAGE(WM_CLIENT_RECEIVE, OnClientReceive) ON_MESSAGE(WM_CLIENT_CONNECT, OnClientConnect) ON_MESSAGE(WM_CLIENT_CLOSE, OnClientClose) ON_MESSAGE(WM_SERVER_ACCEPT, OnClientAccept) ON_BN_CLICKED(IDC_BUTTON1, &CMServerView::OnBnClickedButton1) ON_BN_CLICKED(IDC_BUTTON2, &CMServerView::OnBnClickedButton2) END_MESSAGE_MAP() // CMServerView 생성/소멸 CMServerView::CMServerView() : CFormView(CMServerView::IDD) { // TODO: 여기에 생성 코드를 추가합니다. } CMServerView::~CMServerView() { g_sToolMgr.ReleaseToolMgr(); } void CMServerView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); DDX_Control(pDX, IDC_EDIT1, m_editIP); DDX_Control(pDX, IDC_BUTTON1, m_btnConnect); DDX_Control(pDX, IDC_BUTTON2, m_btnDisconnect); DDX_Control(pDX, IDC_EDIT2, m_editUserCount); } BOOL CMServerView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: CREATESTRUCT cs를 수정하여 여기에서 // Window 클래스 또는 스타일을 수정합니다. return CFormView::PreCreateWindow(cs); } void CMServerView::OnInitialUpdate() { CFormView::OnInitialUpdate(); GetParentFrame()->RecalcLayout(); ResizeParentToFit(); CRect rcClient; GetClientRect(&rcClient); GetParentFrame()->RecalcLayout(); // 스크롤 크기를 뷰의 크기로 맞추어 줌. SetScaleToFitSize(rcClient.Size()); Init(); InitControls(); g_pMainDlg = this; } void CMServerView::OnRButtonUp(UINT nFlags, CPoint point) { ClientToScreen(&point); OnContextMenu(this, point); } void CMServerView::OnContextMenu(CWnd* pWnd, CPoint point) { theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE); } // CMServerView 진단 #ifdef _DEBUG void CMServerView::AssertValid() const { CFormView::AssertValid(); } void CMServerView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } CMServerDoc* CMServerView::GetDocument() const // 디버그되지 않은 버전은 인라인으로 지정됩니다. { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMServerDoc))); return (CMServerDoc*)m_pDocument; } #endif //_DEBUG // CMServerView 메시지 처리기 LONG CMServerView::OnClientReceive(UINT wParam, LONG lParam) { MSG_RET ret = g_sToolMgr.GetWinSockMgr()->OnReceive((SOCKET) wParam, (int) lParam); if(ret == MSG_CONNECT_SUCCESS) { m_editIP.EnableWindow(false); m_btnConnect.EnableWindow(false); m_btnDisconnect.EnableWindow(true); } return S_OK; } LONG CMServerView::OnClientConnect(UINT wParam, LONG lParam) { /*g_sToolMgr.SetConnected(true); g_sToolMgr.GetWinSockMgr()->SetServerRun(true); m_btnConnect.EnableWindow(false); m_btnDisconnect.EnableWindow(true); g_sToolMgr.GetLog()->AddLog(LOG_TYPE_CONN, "서버 매니저에 접속 성공...");*/ return S_OK; } LONG CMServerView::OnClientClose(UINT wParam, LONG lParam) { /*g_sToolMgr.SetConnected(false); g_sToolMgr.GetWinSockMgr()->SetServerRun(false); m_btnConnect.EnableWindow(true); m_btnDisconnect.EnableWindow(false); g_sToolMgr.GetLog()->AddLog(LOG_TYPE_CONN, "서버 매니저에 접속 실패...");*/ return S_OK; } LONG CMServerView::OnClientAccept(UINT wParam, LONG lParam) { //if(!g_sToolMgr.IsConnected()) return E_FAIL; g_sToolMgr.GetWinSockMgr()->OnAccept(); return S_OK; } LONG CMServerView::OnClientNetDown(UINT wParam, LONG lParam) { return S_OK; } void CMServerView::Init() { g_sToolMgr.InitToolMgr(m_hWnd, LOCAL_HOST_IP); } void CMServerView::InitControls() { m_editIP.SetWindowTextA("127.0.0.1"); m_btnConnect.EnableWindow(true); m_btnDisconnect.EnableWindow(false); m_editUserCount.SetWindowTextA("0"); } void CMServerView::OnBnClickedButton1() { // TODO: Add your control notification handler code here // Connect to the M-Server Manager CString strIP; m_editIP.GetWindowTextA(strIP); g_sToolMgr.GetWinSockMgr()->ConnectToServerMgr(strIP); //g_sToolMgr.GetWinSockMgr()->GetServerSock()->Connect(strIP, MAIN_SERVER_PORT); } void CMServerView::OnBnClickedButton2() { // TODO: Add your control notification handler code here // Disconnect to the M-Server Manager g_sToolMgr.GetWinSockMgr()->CloseServerMgrSock(); m_editIP.EnableWindow(true); m_btnConnect.EnableWindow(true); m_btnDisconnect.EnableWindow(false); }
[ [ [ 1, 20 ], [ 27, 39 ], [ 41, 45 ], [ 50, 65 ], [ 76, 111 ] ], [ [ 21, 26 ], [ 40, 40 ], [ 46, 49 ], [ 66, 75 ], [ 112, 206 ] ] ]
1423743c89ac905ffc264eff7935300a088025fc
cb119cb9f64dff66a4545bc97bb5c100231f8e99
/Cald2Mobile/src/Controller.h
72b55dc508fa146489ecad866ec385e585d7c376
[]
no_license
developercyrus/skmobile
2700ca44b2fbfc117aa08e9911d58082c91c4eca
41f0797fd93a11bd19ce3a9c5632b45a4e1e8034
refs/heads/master
2016-09-10T20:16:03.966366
2009-03-23T13:17:24
2009-03-23T13:17:24
41,470,818
0
0
null
null
null
null
UTF-8
C++
false
false
2,290
h
#pragma once class CMainFrame; class CSKMobileView; class Controller { public : virtual void Init(CMainFrame * mainFrame) = 0; virtual void Init(CSKMobileView * view) = 0; virtual void Fini() = 0; virtual BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct) = 0; virtual LRESULT OnBackLastApplication(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) = 0; virtual LRESULT OnSaveContentHtml(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) = 0; virtual LRESULT OnSaveContentXml(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) = 0; // virtual LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) = 0; virtual LRESULT OnInputChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) = 0; virtual void OnTimer(UINT_PTR nIDEvent) = 0; virtual LRESULT OnInputSetFocus(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) = 0; virtual LRESULT OnInputKillFocus(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) = 0; virtual LRESULT OnContentTabChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) = 0; virtual LRESULT OnDocumentComplete(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) = 0; virtual LRESULT OnHotspot(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) = 0; virtual LRESULT OnAction(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) = 0; virtual LRESULT OnCloseTab(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) = 0; virtual LRESULT OnQueryMode(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) = 0; virtual BOOL OnReturnKey(UINT nRepCnt, UINT nFlags) = 0; virtual BOOL OnUpKey(UINT nRepCnt, UINT nFlags) = 0; virtual BOOL OnDownKey(UINT nRepCnt, UINT nFlags) = 0; virtual BOOL OnLeftKey(UINT nRepCnt, UINT nFlags) = 0; virtual BOOL OnRightKey(UINT nRepCnt, UINT nFlags) = 0; virtual BOOL OnChar(UINT nChar, UINT nRepCnt,UINT nFlags) = 0; virtual LRESULT OnSimulateKey(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) = 0; }; class ControllerFactory { public : void listAvailableControllerNames(char const* names[], unsigned * count); Controller * create(char const* name); };
[ "dev.skmobile@fe250e65-8235-0410-9de6-1f804e4dffba" ]
[ [ [ 1, 71 ] ] ]
f5a0ae04fee815305275f499afe2626d0509a182
9a48be80edc7692df4918c0222a1640545384dbb
/Libraries/Boost1.40/libs/regex/test/regress/main.cpp
a8e490ff15dd83e8b31afbc2f43241efc7f785a1
[ "BSL-1.0" ]
permissive
fcrick/RepSnapper
05e4fb1157f634acad575fffa2029f7f655b7940
a5809843f37b7162f19765e852b968648b33b694
refs/heads/master
2021-01-17T21:42:29.537504
2010-06-07T05:38:05
2010-06-07T05:38:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,755
cpp
/* * * Copyright (c) 2004 * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE main.cpp * VERSION see <boost/version.hpp> * DESCRIPTION: entry point for test program. */ #include "test.hpp" #include "test_locale.hpp" #include <stdarg.h> #ifdef TEST_THREADS #include <list> #include <boost/thread.hpp> #include <boost/thread/tss.hpp> #include <boost/shared_ptr.hpp> #include <boost/array.hpp> int* get_array_data(); #endif int error_count = 0; #define RUN_TESTS(name) \ std::cout << "Running test case \"" #name "\".\n";\ name(); void run_tests() { RUN_TESTS(basic_tests); RUN_TESTS(test_simple_repeats); RUN_TESTS(test_alt); RUN_TESTS(test_sets); RUN_TESTS(test_sets2); RUN_TESTS(test_anchors); RUN_TESTS(test_backrefs); RUN_TESTS(test_character_escapes); RUN_TESTS(test_assertion_escapes); RUN_TESTS(test_tricky_cases); RUN_TESTS(test_grep); RUN_TESTS(test_replace); RUN_TESTS(test_non_greedy_repeats); RUN_TESTS(test_non_marking_paren); RUN_TESTS(test_partial_match); RUN_TESTS(test_forward_lookahead_asserts); RUN_TESTS(test_fast_repeats); RUN_TESTS(test_fast_repeats2); RUN_TESTS(test_independent_subs); RUN_TESTS(test_nosubs); RUN_TESTS(test_conditionals); RUN_TESTS(test_options); RUN_TESTS(test_options2); #ifndef TEST_THREADS RUN_TESTS(test_en_locale); #endif RUN_TESTS(test_emacs); RUN_TESTS(test_operators); RUN_TESTS(test_overloads); RUN_TESTS(test_unicode); RUN_TESTS(test_pocessive_repeats); RUN_TESTS(test_mark_resets); RUN_TESTS(test_recursion); } int cpp_main(int /*argc*/, char * /*argv*/[]) { #ifdef TEST_THREADS try{ get_array_data(); // initialises data. } catch(const std::exception& e) { std::cerr << "TSS Initialisation failed with message: " << e.what() << std::endl; return -1; } std::list<boost::shared_ptr<boost::thread> > threads; for(int i = 0; i < 5; ++i) { try{ threads.push_back(boost::shared_ptr<boost::thread>(new boost::thread(&run_tests))); } catch(const std::exception& e) { std::cerr << "<note>Thread creation failed with message: " << e.what() << "</note>" << std::endl; } } std::list<boost::shared_ptr<boost::thread> >::const_iterator a(threads.begin()), b(threads.end()); while(a != b) { (*a)->join(); ++a; } #else run_tests(); #endif return error_count; } #ifdef TEST_THREADS int* get_array_data() { static boost::thread_specific_ptr<boost::array<int, 200> > tp; if(tp.get() == 0) tp.reset(new boost::array<int, 200>); return tp.get()->data(); } #endif const int* make_array(int first, ...) { // // this function takes a variable number of arguments // and packs them into an array that we can pass through // our testing macros (ideally we would use an array literal // but these can't apparently be used as macro arguments). // #ifdef TEST_THREADS int* data = get_array_data(); #else static int data[200]; #endif va_list ap; va_start(ap, first); // // keep packing args, until we get two successive -2 values: // int terminator_count; int next_position = 1; data[0] = first; if(first == -2) terminator_count = 1; else terminator_count = 0; while(terminator_count < 2) { data[next_position] = va_arg(ap, int); if(data[next_position] == -2) ++terminator_count; else terminator_count = 0; ++next_position; } va_end(ap); return data; } #ifdef BOOST_NO_EXCEPTIONS namespace boost{ void throw_exception(std::exception const & e) { std::abort(); } } #endif void test(const char& c, const test_regex_replace_tag& tag) { do_test(c, tag); } void test(const char& c, const test_regex_search_tag& tag) { do_test(c, tag); } void test(const char& c, const test_invalid_regex_tag& tag) { do_test(c, tag); } #ifndef BOOST_NO_WREGEX void test(const wchar_t& c, const test_regex_replace_tag& tag) { do_test(c, tag); } void test(const wchar_t& c, const test_regex_search_tag& tag) { do_test(c, tag); } void test(const wchar_t& c, const test_invalid_regex_tag& tag) { do_test(c, tag); } #endif #include <boost/test/included/prg_exec_monitor.hpp>
[ "metrix@Blended.(none)" ]
[ [ [ 1, 206 ] ] ]
57b1709be34bda65d10096ac4ff545805e5e4ecd
5ac13fa1746046451f1989b5b8734f40d6445322
/minimangalore/Nebula2/code/mangalore/properties/videocameraproperty.cc
3b583425e47e286c044cf43da8fbad2e2cb24d71
[]
no_license
moltenguy1/minimangalore
9f2edf7901e7392490cc22486a7cf13c1790008d
4d849672a6f25d8e441245d374b6bde4b59cbd48
refs/heads/master
2020-04-23T08:57:16.492734
2009-08-01T09:13:33
2009-08-01T09:13:33
35,933,330
0
0
null
null
null
null
UTF-8
C++
false
false
5,287
cc
//------------------------------------------------------------------------------ // properties/videocameraproperty.cc // (C) 2005 Radon Labs GmbH //------------------------------------------------------------------------------ #include "properties/videocameraproperty.h" #include "managers/focusmanager.h" #include "input/server.h" #include "graphics/server.h" #include "graphics/cameraentity.h" #include "game/entity.h" #include "msg/updatetransform.h" #include "properties/pathanimproperty.h" // video camera specific attributes namespace Attr { DefineVector3(VideoCameraCenterOfInterest); DefineVector3(VideoCameraDefaultUpVec); }; namespace Properties { ImplementRtti(Properties::VideoCameraProperty, Properties::CameraProperty); ImplementFactory(Properties::VideoCameraProperty); using namespace Game; using namespace Managers; using namespace Message; //------------------------------------------------------------------------------ /** */ VideoCameraProperty::VideoCameraProperty() { // empty } //------------------------------------------------------------------------------ /** */ VideoCameraProperty::~VideoCameraProperty() { // empty } //------------------------------------------------------------------------------ /** This adds the default attributes to the property. */ void VideoCameraProperty::SetupDefaultAttributes() { CameraProperty::SetupDefaultAttributes(); vector3 identity; GetEntity()->SetVector3(Attr::VideoCameraCenterOfInterest, identity); GetEntity()->SetVector3(Attr::VideoCameraDefaultUpVec, vector3(0.0f, 1.0f, 0.0f)); } //------------------------------------------------------------------------------ /** */ bool VideoCameraProperty::Accepts(Msg* msg) { if (msg->CheckId(UpdateTransform::Id)) return true; return CameraProperty::Accepts(msg); } //------------------------------------------------------------------------------ /** */ void VideoCameraProperty::HandleMessage(Msg* msg) { if (msg->CheckId(UpdateTransform::Id)) { // this is coming usually from the AnimPath property Graphics::CameraEntity* camera = Graphics::Server::Instance()->GetCamera(); n_assert(camera != 0); camera->SetTransform(((UpdateTransform*)msg)->GetMatrix()); } else { CameraProperty::HandleMessage(msg); } } //------------------------------------------------------------------------------ /** */ void VideoCameraProperty::OnActivate() { CameraProperty::OnActivate(); // initialize the Maya camera object const matrix44& m = GetEntity()->GetMatrix44(Attr::Transform); this->mayaCamera.SetDefaultEyePos(m.pos_component()); //this->mayaCamera.SetDefaultUpVec(m.y_component()); //this->mayaCamera.SetDefaultCenterOfInterest(m.pos_component() - m.z_component() * 10.0f); this->mayaCamera.SetDefaultCenterOfInterest(GetEntity()->GetAttr(Attr::VideoCameraCenterOfInterest).GetVector3()); this->mayaCamera.SetDefaultUpVec(GetEntity()->GetAttr(Attr::VideoCameraDefaultUpVec).GetVector3()); this->mayaCamera.Initialize(); } //------------------------------------------------------------------------------ /** */ void VideoCameraProperty::OnObtainFocus() { CameraProperty::OnObtainFocus(); } //------------------------------------------------------------------------------ /** */ void VideoCameraProperty::OnRender() { if (FocusManager::Instance()->GetInputFocusEntity() == GetEntity()) { // feed the Maya camera object with input nInputServer* inputServer = nInputServer::Instance(); if (inputServer->GetButton("ctrlPressed")) { this->mayaCamera.SetResetButton(inputServer->GetButton("vwrReset")); this->mayaCamera.SetLookButton(inputServer->GetButton("lmbPressed")); this->mayaCamera.SetPanButton(inputServer->GetButton("mmbPressed")); this->mayaCamera.SetZoomButton(inputServer->GetButton("rmbPressed")); this->mayaCamera.SetSliderLeft(inputServer->GetSlider("vwrLeft")); this->mayaCamera.SetSliderRight(inputServer->GetSlider("vwrRight")); this->mayaCamera.SetSliderUp(inputServer->GetSlider("vwrUp")); this->mayaCamera.SetSliderDown(inputServer->GetSlider("vwrDown")); } // update the Maya camera this->mayaCamera.Update(); } if (FocusManager::Instance()->GetCameraFocusEntity() == GetEntity()) { if (!(GetEntity()->HasAttr(Attr::AnimPath) && GetEntity()->GetString(Attr::AnimPath).IsValid())) { // only use the internal matrix if we are not animated Graphics::CameraEntity* camera = Graphics::Server::Instance()->GetCamera(); n_assert(camera != 0); float fov = this->GetEntity()->GetFloat(Attr::FieldOfView); camera->GetCamera().SetPerspective(fov, 4.0f/3.0f, 0.1f, 2500.0f); camera->SetTransform(this->mayaCamera.GetViewMatrix()); } } // important: call parent class at the end to apply any shake effects CameraProperty::OnRender(); } } // namespace Properties
[ "BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c" ]
[ [ [ 1, 165 ] ] ]
55833099cf52be3535da436f7bd8a5fa9d70fe01
067ff5708784b1fd2595957de78518e87073ccb4
/Capture_Estimator/Capture_Estimator/Pose_Marker.h
5a350671fcc83f5b5e796bb3be72c685fde311ae
[]
no_license
wolfmanu/opencvthesis
637a6a6ead5c839e731faca19ae0dd3e59e33cd3
c4e806d6369b4ed80ebadce1684e32f147eafce4
refs/heads/master
2016-09-05T22:38:07.528951
2010-09-10T12:01:49
2010-09-10T12:01:49
32,142,213
0
0
null
null
null
null
UTF-8
C++
false
false
482
h
#pragma once class Pose_Marker { public: Pose_Marker(double roll, double pitch, double yaw, double distX, double distY, double distZ, int mId); Pose_Marker(void); ~Pose_Marker(void); double roll, pitch, yaw; //degree double distX, distY, distZ; //cm int errorState; int markerId; std::string toString(); std::string toLine(); std::string toFTP(); friend bool operator ==(const Pose_Marker &pm1, const Pose_Marker &pm2); };
[ "thewolfmanu@8d742ff4-5afa-cc76-88a1-f39302f5df42" ]
[ [ [ 1, 26 ] ] ]
32249990ba2d726a650eacb5fb0b3a4c67c65cda
1caba14ec096b36815b587f719dda8c963d60134
/tags/start/smx/libsmx/strary.h
da6c6f9362b3e61899b9485b5bfae5e418d4b1b4
[]
no_license
BackupTheBerlios/smx-svn
0502dff1e494cffeb1c4a79ae8eaa5db647e5056
7955bd611e88b76851987338b12e47a97a327eaf
refs/heads/master
2021-01-10T19:54:39.450497
2009-03-01T12:24:56
2009-03-01T12:24:56
40,749,397
0
0
null
null
null
null
UTF-8
C++
false
false
1,666
h
/* COPYRIGHT 1998 Prime Data Corp. All Rights Reserved. Duplication of this file without prior written authorization is strictly prohibited. */ #ifndef _STRARY_H #define _STRARY_H #ifndef _STR_H #include "str.h" #endif #include <vector> class CStrAry : public std::vector<CStr> { protected: const char **myV; public: CStrAry(int n=0) : std::vector<CStr>(n) { myV = NULL; } CStrAry(CStr *d, int n) : std::vector<CStr>(n) { memcpy(pointer(), d, n * sizeof(CStr)); myV = NULL; } ~CStrAry() { if (myV) free(myV); } CStr *Grow(int n) {resize(n); return Data();} CStr *Data() {return &(*begin());}; int Count() const {if (this) return size(); else return 0;} CStr &GetAt(int i) {if (i < Count()) return *(begin() + i); else return CStr::Null;} CStr &SetAt(int i, const char *str) {if (i >= Count()) Grow(i+1); return *(begin() + i) = str;} CStr &operator[](int i) {return GetAt(i);} CStr &SetAt(int i, CStr &str) {if (i >= Count()) Grow(i+1); return *(begin() + i) = str;} CStr &Add(CStr str) {push_back(str); return back();} CStrAry &operator =(const char **newBuf) { if (newBuf) { const char **t = newBuf; while (*t) ++t; Grow(t-newBuf); int i=0; for (t = newBuf; *t; ++t) Data()[i++] = *t; } return *this; } operator const char ** () { myV = (const char **) realloc(myV,sizeof(char *) * size()); unsigned int i; for (i=0;i<size();++i) { myV[i] = GetAt(i); } myV[size()]=NULL; return myV; } void Shift(int n) { _M_start += n; } void Restore(int n) { _M_start -= n; } }; #endif // #ifndef _STRARY_H
[ "(no author)@407f561b-fe63-0410-8234-8332a1beff53" ]
[ [ [ 1, 66 ] ] ]
fb8791ece0c72d9d853237bfe70efb2ecd40a3bb
545dec4462a2febe8e9db02496369b1e8022c6a5
/inc/rendercheckGL.h
e6a586245fc012f47bbe0abc5f16bbc6ecd954ae
[]
no_license
andrey-malets/opencl-usu-2009
6d1bcca084c1038249603b35cf09ffc74792af7e
a896419258c98853e90e25afe217b4084131bd1a
refs/heads/master
2020-04-14T07:37:25.561928
2009-12-21T09:51:23
2009-12-21T09:51:23
32,697,173
0
0
null
null
null
null
UTF-8
C++
false
false
8,181
h
/* * Copyright 1993-2009 NVIDIA Corporation. All rights reserved. * * NVIDIA Corporation and its licensors retain all intellectual property and * proprietary rights in and to this software and related documentation. * Any use, reproduction, disclosure, or distribution of this software * and related documentation without an express license agreement from * NVIDIA Corporation is strictly prohibited. * * Please refer to the applicable NVIDIA end user license agreement (EULA) * associated with this source code for terms and conditions that govern * your use of this NVIDIA software. * */ #ifndef _RENDERCHECK_GL_H_ #define _RENDERCHECK_GL_H_ #include <assert.h> #include <vector> #include <map> #include <string> #include <GL/glew.h> #if defined(__APPLE__) || defined(MACOSX) #include <GLUT/glut.h> #else #include <GL/glut.h> #endif #include <nvShaderUtils.h> using std::vector; using std::map; using std::string; #define BUFFER_OFFSET(i) ((char *)NULL + (i)) #if _DEBUG #define CHECK_FBO checkStatus(__FILE__, __LINE__, true) #else #define CHECK_FBO true #endif class CheckRender { public: CheckRender(unsigned int width, unsigned int height, unsigned int bpp, bool bQAReadback, bool bUseFBO, bool bUsePBO); virtual ~CheckRender(); virtual void allocateMemory(unsigned int width, unsigned int height, unsigned int bpp, bool bUsePBO ); virtual void setExecPath(char *path) { #ifdef WIN32 strcpy_s(m_ExecPath, strlen(m_ExecPath), path); #else strcpy(m_ExecPath, path); #endif } virtual void EnableQAReadback(bool bStatus) { m_bQAReadback = bStatus; } virtual bool IsQAReadback() { return m_bQAReadback; } virtual bool IsFBO() { return m_bUseFBO; } virtual bool IsPBO() { return m_bUsePBO; } virtual void * imageData() { return m_pImageData; } // Interface to this class functions virtual void setPixelFormat(GLenum format) { m_PixelFormat = format; } virtual int getPixelFormat() { return m_PixelFormat; } virtual bool checkStatus(const char *zfile, int line, bool silent) = 0; virtual bool readback( GLuint width, GLuint height ) = 0; virtual bool readback( GLuint width, GLuint height, GLuint bufObject ) = 0; virtual bool readback( GLuint width, GLuint height, unsigned char *membuf ) = 0; virtual void bindReadback(); virtual void unbindReadback(); virtual void savePGM( const char *zfilename, bool bInvert, void **ppReadBuf ); virtual void savePPM( const char *zfilename, bool bInvert, void **ppReadBuf ); virtual bool PGMvsPGM( const char *src_file, const char *ref_file, const float epsilon, const float threshold = 0.0f ); virtual bool PPMvsPPM( const char *src_file, const char *ref_file, const float epsilon, const float threshold = 0.0f ); void setThresholdCompare(float value) { m_fThresholdCompare = value; } virtual void dumpBin(void *data, unsigned int bytes, char *filename); virtual bool compareBin2BinUint(const char *src_file, const char *ref_file, unsigned int nelements, const float epsilon, const float threshold); virtual bool compareBin2BinFloat(const char *src_file, const char *ref_file, unsigned int nelements, const float epsilon, const float threshold); protected: unsigned int m_Width, m_Height, m_Bpp; unsigned char *m_pImageData; // This is the image data stored in system memory bool m_bQAReadback, m_bUseFBO, m_bUsePBO; GLuint m_pboReadback; GLenum m_PixelFormat; float m_fThresholdCompare; char m_ExecPath[256]; }; class CheckBackBuffer : public CheckRender { public: CheckBackBuffer(unsigned int width, unsigned int height, unsigned int bpp, bool bUseOpenGL = true); virtual ~CheckBackBuffer(); virtual bool checkStatus(const char *zfile, int line, bool silent); virtual bool readback( GLuint width, GLuint height ); virtual bool readback( GLuint width, GLuint height, GLuint bufObject ); virtual bool readback( GLuint width, GLuint height, unsigned char *membuf ); private: virtual void bindFragmentProgram() {}; virtual void bindRenderPath() {}; virtual void unbindRenderPath() {}; // bind to the FBO to Texture virtual void bindTexture() {}; // release this bind virtual void unbindTexture() {}; }; // structure defining the properties of a single buffer struct bufferConfig { string name; GLenum format; int bits; }; // structures defining properties of an FBO struct fboConfig { string name; GLenum colorFormat; GLenum depthFormat; int redbits; int depthBits; int depthSamples; int coverageSamples; }; struct fboData { GLuint colorTex; //color texture GLuint depthTex; //depth texture GLuint fb; // render framebuffer GLuint resolveFB; //multisample resolve target GLuint colorRB; //color render buffer GLuint depthRB; // depth render buffer }; class CFrameBufferObject { public: CFrameBufferObject (unsigned int width, unsigned int height, bool bUseFloat, GLenum eTarget); CFrameBufferObject (unsigned int width, unsigned int height, fboData &data, fboConfig &config, bool bUseFloat = false); CFrameBufferObject (unsigned int width, unsigned int height, fboData &data, fboConfig &config, bool bUseFloat, GLenum eTarget); virtual ~CFrameBufferObject(); GLuint createTexture(GLenum target, int w, int h, GLint internalformat, GLenum format); void attachTexture( GLenum texTarget, GLuint texId, GLenum attachment = GL_COLOR_ATTACHMENT0_EXT, int mipLevel = 0, int zSlice = 0); bool initialize(unsigned width, unsigned height, fboConfig & rConfigFBO, fboData & rActiveFBO); bool create( GLuint width, GLuint height, fboConfig &config, fboData &data ); bool createMSAA( GLuint width, GLuint height, fboConfig *p_config, fboData *p_data ); bool createCSAA( GLuint width, GLuint height, fboConfig *p_config, fboData *p_data ); virtual void freeResources(); virtual bool checkStatus(const char *zfile, int line, bool silent); virtual void renderQuad(int width, int height, GLenum eTarget); // bind to the Fragment Program void bindFragmentProgram() { glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_textureProgram); glEnable(GL_FRAGMENT_PROGRAM_ARB); } // bind to the FrameBuffer Object void bindRenderPath() { glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_fboData.fb ); } // release current FrameBuffer Object void unbindRenderPath() { glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); } // bind to the FBO to Texture void bindTexture() { glBindTexture( m_eGLTarget, m_fboData.colorTex ); } // release this bind void unbindTexture() { glBindTexture( m_eGLTarget, 0 ); } GLuint getFbo() { return m_fboData.fb; } GLuint getTex() { return m_fboData.colorTex; } GLuint getDepthTex() { return m_fboData.depthTex; } private: fboData m_fboData; fboConfig m_fboConfig; GLuint m_textureProgram; GLuint m_overlayProgram; bool m_bUseFloat; GLenum m_eGLTarget; }; // CheckFBO - render and verify contents of the FBO class CheckFBO: public CheckRender { public: CheckFBO(unsigned int width, unsigned int height, unsigned int bpp); CheckFBO(unsigned int width, unsigned int height, unsigned int bpp, CFrameBufferObject *pFrameBufferObject); virtual ~CheckFBO(); virtual bool checkStatus(const char *zfile, int line, bool silent); virtual bool readback( GLuint width, GLuint height ); virtual bool readback( GLuint width, GLuint height, GLuint bufObject ); virtual bool readback( GLuint width, GLuint height, unsigned char *membuf ); private: CFrameBufferObject *m_pFrameBufferObject; }; #endif // _RENDERCHECK_GL_H_
[ "[email protected]@78a82cd4-d041-11de-a697-fbeabf64b1f8" ]
[ [ [ 1, 245 ] ] ]