blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
7
| license_type
stringclasses 2
values | repo_name
stringlengths 6
79
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 4
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.07k
426M
⌀ | star_events_count
int64 0
27
| fork_events_count
int64 0
12
| gha_license_id
stringclasses 3
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 6
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 20
6.28M
| extension
stringclasses 20
values | content
stringlengths 20
6.28M
| authors
sequencelengths 1
16
| author_lines
sequencelengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4494e32206aff955cdd3570018788a2786bdf748 | b2155efef00dbb04ae7a23e749955f5ec47afb5a | /demo/demo_lake/LakeApp.h | 95da38555450cd575d61a8c67386aaaf38619f3c | [] | no_license | zjhlogo/originengine | 00c0bd3c38a634b4c96394e3f8eece86f2fe8351 | a35a83ed3f49f6aeeab5c3651ce12b5c5a43058f | refs/heads/master | 2021-01-20T13:48:48.015940 | 2011-04-21T04:10:54 | 2011-04-21T04:10:54 | 32,371,356 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 653 | h | /*!
* \file LakeApp.h
* \date 10-27-2010 9:28:45
*
*
* \author zjhlogo ([email protected])
*/
#ifndef __LAKEAPP_H__
#define __LAKEAPP_H__
#include "../common/BaseApp.h"
#include <OECore/IOEModel.h>
class CLakeApp : public CBaseApp
{
public:
CLakeApp();
virtual ~CLakeApp();
virtual bool UserDataInit();
virtual void UserDataTerm();
virtual void Update(float fDetailTime);
private:
void Init();
void Destroy();
private:
IOEModel* m_pModelSky;
IOEModel* m_pModelLand;
IOEModel* m_pModelLake;
IOETexture* m_pRenderTargetReflect;
IOETexture* m_pRenderTargetRefract;
};
#endif // __LAKEAPP_H__
| [
"zjhlogo@fdcc8808-487c-11de-a4f5-9d9bc3506571"
] | [
[
[
1,
37
]
]
] |
8199f316681bd8ae7445c47ae259b49993123354 | 8d2ef01bfa0b7ed29cf840da33e8fa10f2a69076 | /code/Beispiel/Beispiel.cpp | d6bdd25d71550556c9b8dbc3fd585b25258ee54e | [] | no_license | BackupTheBerlios/insane | fb4c5c6a933164630352295692bcb3e5163fc4bc | 7dc07a4eb873d39917da61e0a21e6c4c843b2105 | refs/heads/master | 2016-09-05T11:28:43.517158 | 2001-01-31T20:46:38 | 2001-01-31T20:46:38 | 40,043,333 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 737 | cpp | #include "stdafx.h"
#include "../insanefx.h"
#include "../kernel/fxConsole.h"
#include "../kernel/fxVars.h"
#include "../kernel/fxTimer.h"
#include "../RenderDevice/OpenGL/fxGL.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
fxConsole * Console = new fxConsole;
fxVars * Vars = new fxVars;
fxTimer * Timer = new fxTimer;
fxRenderDevice * rd = new fxGL;
rd->OpenWindow();
// main message loop, standart windows stuff...
MSG msg;
while( GetMessage(&msg, NULL, 0, 0) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
rd->CloseWindow();
return msg.wParam;
}
| [
"josef"
] | [
[
[
1,
35
]
]
] |
ef197b0a385a00b22d5964e258c8d7056b5c2f36 | 1102f77e8dbf563a024cec0b885c0d9f9da2ef39 | /view/triggerinternalmoveview.cc | 2d1d92fe2917bef3d7cf2b071f0563a27b53816c | [] | no_license | pgoodman/uwo-cooper | 7c38c1bc0b3fc04cabb128cd5a3c984c67efc2f3 | ea881e9794cb2c0ae64c0d73117facfd92c3f96b | refs/heads/master | 2016-09-11T03:29:39.537161 | 2010-04-05T21:28:26 | 2010-04-05T21:28:26 | 32,091,588 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,800 | cc | /*
* triggerinternalmoveview.cc
*
* Created on: Mar 14, 2010
* Author: Stephan Beltran
* Version: $Id$
*/
#include "triggerinternalmoveview.h"
/**
* Constructor
*/
TriggerInternalMoveView::TriggerInternalMoveView(UnitModel *chosenUnit,
QWidget *parent)
: QDialog(parent) {
// Set up the form layout
FormLayoutPtr layout(this);
// Get the particular member that is moving
unitNo = chosenUnit;
// Make button group for empty/occupied unit
QButtonGroup *occupied_unit_group(new QButtonGroup);
isEmpty = new QRadioButton;
withMembers = new QRadioButton;
occupied_unit_group->addButton(isEmpty);
occupied_unit_group->addButton(withMembers);
// make the layout of the form
newunit = layout << "New Unit: " |= new ModelListWidget<UnitModel>;
membersMoving = layout << "Choose members who are moving: " |= new ModelListWidget<MemberModel>;
move_in_date = layout << "Move In Date: " |= new QDateEdit;
isEmpty = layout << "Moving Into Empty Unit?" |= new QRadioButton;
withMembers = layout << "Moving Into Occupied Unit?" |= new QRadioButton;
// make and add in the buttons
ok_button = new QPushButton("Ok");
QPushButton *cancel(new QPushButton("Cancel"));\
layout << ok_button | cancel;
// TODO: does internal move report an error with only 1 unit in the system?
std::stringstream ss;
ss << "id != " << (unitNo->id);
UnitModel::iterator_range new_units(UnitModel::findAll(ss.str().c_str()));
newunit->fill(new_units);
newunit->selectFirst();
std::stringstream ss2;
ss2 << "id != " << (unitNo->id);
MemberModel::iterator_range memberList(MemberModel::findAll(ss2.str().c_str()));
membersMoving->setMultipleSelect(true);
membersMoving->fill(memberList);
membersMoving->selectFirst();
// misc
move_in_date->setCalendarPopup(true);
isEmpty->setChecked(true);
setModal(true);
setWindowTitle("Trigger Internal Move event");
// signals / slots
connect(ok_button, SIGNAL(clicked()), this, SLOT(tryOK()));
connect(cancel, SIGNAL(clicked()), this, SLOT(cancelEvent()));
connect(
membersMoving, SIGNAL(itemSelectionChanged()),
this, SLOT(activateEmptyUnit())
);
}
/**
* Attempt Check the date.
*/
bool TriggerInternalMoveView::checkDate(void) {
QDateTime today = QDateTime::currentDateTime();
today.setTime(QTime());
if(move_in_date->dateTime() < today) {
QMessageBox::information(
this, "Invalid Field",
"Please enter a move in date that is not in the past."
);
return false;
}
return true;
}
/**
* Attempt to accept the event
*/
void TriggerInternalMoveView::tryOK(void) {
if(this->checkDate()) {
emit okEvent();
}
}
/**
* De/activate the check box depending on whether all members are chosen or not
*/
void TriggerInternalMoveView::activateEmptyUnit () {
QList<MemberModel*> members(membersMoving->getSelectedModels());
oldUnitEmpty = (membersMoving->count() == members.count());
}
/**
* Causes the function to trigger an Internal Move Event
*/
void TriggerInternalMoveView::okEvent(void) {
// Recieve all the given information about move dates and notice dates, as well as the unit being moved into.
QDateTime moveInDate = move_in_date->dateTime();
QDateTime moveOutDate = moveInDate;
QDateTime noticeDate = QDateTime::currentDateTime();
UnitModel *intoUnit = newunit->getSelectedModel();
UnitModel *outOfUnit = unitNo;
memberList1 = membersMoving->getSelectedModels();
memberList2 = memberList1;
// If the unit being moved into will be empty upon move in,
// Set up move in inspection tasks according to the specifications
if (isEmpty->isChecked() == true) {
QString *description(new QString);
QTextStream ss(description);
while (!(memberList1.isEmpty())) {
MemberModel *temp = memberList1.first();
ss << "Member Name: " << temp->getFirstName() << " " << temp->getLastName() << "\n";
if(temp->isTelephoneShared()) {
ss << "Telephone Number: " << temp->getTelephoneNum() << "\n";
}
memberList1.removeFirst();
}
ss << "Unit Number: " << QVariant(intoUnit->id).toString() << "\n";
ss << "Move-in Date: " << moveInDate.toString("MMMM d, yyyy") << "\n";
// Get the Inspections Committee
CommitteeModel *ic(CommitteeModel::findById(
CommitteeModel::INSPECTIONS_COMMITTEE_ID
));
// Send Move-In Inspection Task
QDateTime MoveIn_in_30_days(moveInDate);
MoveIn_in_30_days = MoveIn_in_30_days.addDays(30);
ic->addTask(QString("Move-In Inspection"), *description, MoveIn_in_30_days);
}
if (oldUnitEmpty == true) {
// SEND MOVE OUT EVENTS FOR OLD UNIT
QString *descript2(new QString);
QTextStream ss2(descript2);
memberList2 = membersMoving->getSelectedModels();
while (!(memberList2.isEmpty())) {
MemberModel *temp = memberList2.first();
ss2 << "Member Name: " << temp->getFirstName() << " " << temp->getLastName() << "\n";
if(temp->isTelephoneShared()) {
ss2 << "Telephone Number: " << temp->getTelephoneNum() << "\n";
}
memberList2.removeFirst();
}
ss2 << "Unit Number: " << QVariant(outOfUnit->id).toString() << "\n";
ss2 << "Move-in Date: " << moveInDate.toString("MMMM d, yyyy") << "\n";
// Get the Inspections Committee
CommitteeModel *ic(CommitteeModel::findById(
CommitteeModel::INSPECTIONS_COMMITTEE_ID
));
// Send First Move-Out Inspection Task
QDateTime MoveOut_in_30_days(noticeDate);
MoveOut_in_30_days = MoveOut_in_30_days.addDays(30);
ic->addTask(QString("Move-out Inspection 1"), *descript2, MoveOut_in_30_days);
// Send Second Move-Out Inspection Task
QDateTime one_week_before(moveOutDate);
one_week_before = one_week_before.addDays(-7);
ic->addTask(QString("Move-out Inspection 2"), *descript2, one_week_before);
// Send Third Move-Out Inspection Task
QDateTime dayOf(moveOutDate);
ic->addTask(QString("Move-out Inspection 3"), *descript2, dayOf);
}
done(QDialog::Accepted);
}
/**
* When the options are cancelled
*/
void TriggerInternalMoveView::cancelEvent(void){
done(QDialog::Rejected);
}
| [
"stephanb89@c307de66-1bdf-11df-a447-cf726199f266",
"peter.goodman@c307de66-1bdf-11df-a447-cf726199f266"
] | [
[
[
1,
15
],
[
18,
43
],
[
49,
118
],
[
120,
202
]
],
[
[
16,
17
],
[
44,
48
],
[
119,
119
]
]
] |
d6de5ed60366e2f9dc16f383470d7d6694063372 | 17558c17dbc37842111466c43add5b31e3f1b29b | /device/portlistener.h | dc41ac2bdc982f5914ed5d7be2fc4783e674b6e1 | [] | no_license | AeroWorks/inav | 5c61b6c7a5af1a3f99009de8e177a2ceff3447b0 | 5a97aaca791026d9a09c2273c37e237b18b9cb35 | refs/heads/master | 2020-09-05T23:45:11.561252 | 2011-04-24T01:53:22 | 2011-04-24T01:53:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 662 | h | #ifndef PORTLISTENER_H
#define PORTLISTENER_H
#include <QObject>
#include <qextserialport.h>
class PortListener : public QObject
{
Q_OBJECT
public:
PortListener();
~PortListener();
bool open();
bool receiveLine(QString& buffer);
void close();
QextSerialPort * port;
protected:
static BaudRateType parseBaudRateType(QString string);
static FlowType parseFlowType(QString string);
static DataBitsType parseDataBitsType(QString string);
static StopBitsType parseStopBitsType(QString string);
static ParityType parseParityType(QString string);
};
#endif // PORTLISTENER_H
| [
"[email protected]"
] | [
[
[
1,
34
]
]
] |
4b2d801f606d96b9c2754ecc4273fe7bed2d5870 | 1b27519a521968ab59605a016d5d58fc6f501c3b | /main.cpp | 5fb422c94b1bdc7da138ae3151ccfbe99200764c | [] | no_license | codegooglecom/webmo | 9d2b10d74d72697c263f7a42e5ebc9e4716614ae | 7e0f36631ba8be628f644349fb39c506a218e791 | refs/heads/master | 2021-01-10T13:10:25.757817 | 2010-07-12T13:37:53 | 2010-07-12T13:37:53 | 43,678,768 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 191 | cpp | #include <QtGui>
#include "mainwindow.h"
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
MainWindow browser;
browser.show();
return app.exec();
}
| [
"ym.sysu@b9f22f32-c183-4c91-89c2-6a8dbc7706bc"
] | [
[
[
1,
10
]
]
] |
d71919392927ba5b9191fef9c3ed1d65607024fb | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Dependencies/Xerces/include/xercesc/framework/XMLValidator.hpp | f988fde9c970518ad6208e2fdb749b995267c9eb | [] | no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,100 | hpp | /*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XMLValidator.hpp 191054 2005-06-17 02:56:35Z jberry $
*/
#if !defined(XMLVALIDATOR_HPP)
#define XMLVALIDATOR_HPP
#include <xercesc/framework/XMLAttr.hpp>
#include <xercesc/framework/XMLValidityCodes.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class ReaderMgr;
class XMLBufferMgr;
class XMLElementDecl;
class XMLScanner;
class Grammar;
/**
* This abstract class provides the interface for all validators. This is
* the simple amount of API that all validators must honor, in order for
* the scanner to use them to do validation. All validators will actually
* contain much more functionality than is accessible via this common API,
* but that functionality requires that you know what type of validator you
* are dealing with.
*
* Basically, at this level, the primary concern is to be able to query
* core information about elements and attributes. Adding decls to the
* validator requires that you go through the derived interface because they
* all have their own decl types. At this level, we can return information
* via the base decl classes, from which each validator derives its own
* decl classes.
*/
class XMLPARSER_EXPORT XMLValidator : public XMemory
{
public:
// -----------------------------------------------------------------------
// Constructors are hidden, just the virtual destructor is exposed
// -----------------------------------------------------------------------
/** @name Destructor */
//@{
/**
* The derived class should clean up its allocated data, then this class
* will do the same for data allocated at this level.
*/
virtual ~XMLValidator()
{
}
//@}
// -----------------------------------------------------------------------
// The virtual validator interface
// -----------------------------------------------------------------------
/** @name Virtual validator interface */
//@{
/**
* The derived class should look up its declaration of the passed element
* from its element pool. It should then use the content model description
* contained in that element declaration to validate that the passed list
* of child elements are valid for that content model. The count can be
* zero, indicating no child elements.
*
* Note that whitespace and text content are not validated here. Those are
* handled by the scanner. So only element ids are provided here.
*
* @param elemDecl The element whose content is to be checked.
*
* @param children An array of element QName which represent the elements
* found within the parent element, i.e. the content
* to be validated.
*
* @param childCount The number of elements in the childIds array. It can
* be zero if the element had none.
*/
virtual int checkContent
(
XMLElementDecl* const elemDecl
, QName** const children
, const unsigned int childCount
) = 0;
/**
* The derived class should fault in the passed XMLAttr value. It should
* use the passeed attribute definition (which is passed via the base
* type so it must often be downcast to the appropriate type for the
* derived validator class), to fill in the passed attribute. This is done
* as a performance enhancement since the derived class has more direct
* access to the information.
*/
virtual void faultInAttr
(
XMLAttr& toFill
, const XMLAttDef& attDef
) const = 0;
/**
* This method is called by the scanner after a Grammar is scanned.
*/
virtual void preContentValidation(bool reuseGrammar,
bool validateDefAttr = false) = 0;
/**
* This method is called by the scanner after the parse has completed. It
* gives the validator a chance to check certain things that can only be
* checked after the whole document has been parsed, such as referential
* integrity of ID/IDREF pairs and so forth. The validator should just
* issue errors for any problems it finds.
*/
virtual void postParseValidation() = 0;
/**
* This method is called by the scanner before a new document is about
* to start. It gives the validator a change to reset itself in preperation
* for another validation pass.
*/
virtual void reset() = 0;
/**
* The derived class should return a boolean that indicates whether it
* requires namespace processing or not. Some do and some allow it to be
* optional. This flag is used to control whether the client code's
* requests to disable namespace processing can be honored or not.
*/
virtual bool requiresNamespaces() const = 0;
/**
* The derived class should apply any rules to the passed attribute value
* that are above and beyond those defined by XML 1.0. The scanner itself
* will impose XML 1.0 rules, based on the type of the attribute. This
* will generally be used to check things such as range checks and other
* datatype related validation.
*
* If the value breaks any rules as defined by the derived class, it
* should just issue errors as usual.
*/
virtual void validateAttrValue
(
const XMLAttDef* attDef
, const XMLCh* const attrValue
, bool preValidation = false
, const XMLElementDecl* elemDecl = 0
) = 0;
/**
* The derived class should apply any rules to the passed element decl
* that are above and beyond those defined by XML 1.0.
*
* If the value breaks any rules as defined by the derived class, it
* should just issue errors as usual.
*/
virtual void validateElement
(
const XMLElementDecl* elemDef
) = 0;
/**
* Retrieve the Grammar used
*/
virtual Grammar* getGrammar() const =0;
/**
* Set the Grammar
*/
virtual void setGrammar(Grammar* aGrammar) =0;
//@}
// -----------------------------------------------------------------------
// Virtual DTD handler interface.
// -----------------------------------------------------------------------
/** @name Virtual DTD handler interface */
//@{
/**
* This method allows the scanner to ask the validator if it handles
* DTDs or not.
*/
virtual bool handlesDTD() const = 0;
// -----------------------------------------------------------------------
// Virtual Schema handler interface.
// -----------------------------------------------------------------------
/** @name Virtual Schema handler interface */
/**
* This method allows the scanner to ask the validator if it handles
* Schema or not.
*/
virtual bool handlesSchema() const = 0;
//@}
// -----------------------------------------------------------------------
// Setter methods
//
// setScannerInfo() is called by the scanner to tell the validator
// about the stuff it needs to have access to.
// -----------------------------------------------------------------------
/** @name Setter methods */
//@{
/**
* @param owningScanner This is a pointer to the scanner to which the
* validator belongs. The validator will often
* need to query state data from the scanner.
*
* @param readerMgr This is a pointer to the reader manager that is
* being used by the scanner.
*
* @param bufMgr This is the buffer manager of the scanner. This
* is provided as a convenience so that the validator
* doesn't have to create its own buffer manager
* during the parse process.
*/
void setScannerInfo
(
XMLScanner* const owningScanner
, ReaderMgr* const readerMgr
, XMLBufferMgr* const bufMgr
);
/**
* This method is called to set an error reporter on the validator via
* which it will report any errors it sees during parsing or validation.
* This is generally called by the owning scanner.
*
* @param errorReporter A pointer to the error reporter to use. This
* is not adopted, just referenced so the caller
* remains responsible for its cleanup, if any.
*/
void setErrorReporter
(
XMLErrorReporter* const errorReporter
);
//@}
// -----------------------------------------------------------------------
// Error emitter methods
// -----------------------------------------------------------------------
/** @name Error emittor methods */
//@{
/**
* This call is a convenience by which validators can emit errors. Most
* of the grunt work of loading the text, getting the current source
* location, ect... is handled here.
*
* If the loaded text has replacement parameters, then text strings can be
* passed. These will be used to replace the tokens {0}, {1}, {2}, and {3}
* in the order passed. So text1 will replace {0}, text2 will replace {1},
* and so forth.
*
* textX Up to four replacement parameters. They can be provided
* as either XMLCh strings, or local code page strings which
* will be transcoded internally.
*
* @param toEmit The error code to emit. it must be one of the defined
* validator error codes.
*
*/
void emitError(const XMLValid::Codes toEmit);
void emitError
(
const XMLValid::Codes toEmit
, const XMLCh* const text1
, const XMLCh* const text2 = 0
, const XMLCh* const text3 = 0
, const XMLCh* const text4 = 0
);
void emitError
(
const XMLValid::Codes toEmit
, const char* const text1
, const char* const text2 = 0
, const char* const text3 = 0
, const char* const text4 = 0
);
//@}
// -----------------------------------------------------------------------
// Deprecated XMLValidator interface
// -----------------------------------------------------------------------
/**
*
* DEPRECATED.
* For those validators that contrain the possible root elements of a
* document to only particular elements, they should use this call to
* validate that the passed root element id is a legal root element.
*/
bool checkRootElement
(
const unsigned int
) { return true;};
// -----------------------------------------------------------------------
// Notification that lazy data has been deleted
// -----------------------------------------------------------------------
static void reinitMsgMutex();
static void reinitMsgLoader();
protected :
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
XMLValidator
(
XMLErrorReporter* const errReporter = 0
);
// -----------------------------------------------------------------------
// Protected getters
// -----------------------------------------------------------------------
const XMLBufferMgr* getBufMgr() const;
XMLBufferMgr* getBufMgr();
const ReaderMgr* getReaderMgr() const;
ReaderMgr* getReaderMgr();
const XMLScanner* getScanner() const;
XMLScanner* getScanner();
private :
// -----------------------------------------------------------------------
// Unimplemented Constructors and Operators
// -----------------------------------------------------------------------
XMLValidator(const XMLValidator&);
XMLValidator& operator=(const XMLValidator&);
// -----------------------------------------------------------------------
// Private data members
//
// fErrorReporter
// The error reporter we are to use, if any.
//
// -----------------------------------------------------------------------
XMLBufferMgr* fBufMgr;
XMLErrorReporter* fErrorReporter;
ReaderMgr* fReaderMgr;
XMLScanner* fScanner;
};
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
inline void
XMLValidator::setScannerInfo(XMLScanner* const owningScanner
, ReaderMgr* const readerMgr
, XMLBufferMgr* const bufMgr)
{
// We don't own any of these, we just reference them
fScanner = owningScanner;
fReaderMgr = readerMgr;
fBufMgr = bufMgr;
}
inline void
XMLValidator::setErrorReporter(XMLErrorReporter* const errorReporter)
{
fErrorReporter = errorReporter;
}
// ---------------------------------------------------------------------------
// XMLValidator: Protected getter
// ---------------------------------------------------------------------------
inline const XMLBufferMgr* XMLValidator::getBufMgr() const
{
return fBufMgr;
}
inline XMLBufferMgr* XMLValidator::getBufMgr()
{
return fBufMgr;
}
inline const ReaderMgr* XMLValidator::getReaderMgr() const
{
return fReaderMgr;
}
inline ReaderMgr* XMLValidator::getReaderMgr()
{
return fReaderMgr;
}
inline const XMLScanner* XMLValidator::getScanner() const
{
return fScanner;
}
inline XMLScanner* XMLValidator::getScanner()
{
return fScanner;
}
XERCES_CPP_NAMESPACE_END
#endif
| [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
] | [
[
[
1,
432
]
]
] |
b604a10e860560c497c7a126f1c5a715505119aa | 353bd39ba7ae46ed521936753176ed17ea8546b5 | /src/layer1_system/m2_loader/src/axm2_m2_loader.cpp | 7d53d25cfeef96b5e4aa743158563410f72538ad | [] | no_license | d0n3val/axe-engine | 1a13e8eee0da667ac40ac4d92b6a084ab8a910e8 | 320b08df3a1a5254b776c81775b28fa7004861dc | refs/heads/master | 2021-01-01T19:46:39.641648 | 2007-12-10T18:26:22 | 2007-12-10T18:26:22 | 32,251,179 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,646 | cpp |
/**
* @file
* Main library management functions
*/
#include "axm2_stdafx.h"
/** Global state of the library */
axm2_state state;
#define AXM2_NUM_ERROR_MSG 1
/**
* List of error messages
" @see basic_error_messages
*/
const char* error_messages[AXM2_NUM_ERROR_MSG] = { "Unknown error" };
/**
* Main entry for the DLL
* Executed when the client do "loadlibrary"
*/
BOOL APIENTRY DllMain()
{
#ifdef _DEBUG
// Initializes CRT Dbg
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF );
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );
#endif
return( TRUE );
}
/**
* Returns a library state
*/
AXM2_API unsigned int axm2_get( const int query_state )
{
switch( query_state )
{
case AXM2_VERSION:
return( state.lib_version );
case AXM2_LIBRARY_ID:
return( state.lib_id );
case AXM2_LAST_ERROR:
{
int value = state.last_error;
state.last_error = 0;
return( value );
}
case AXM2_DEBUG_MODE:
return( state.debug_mode );
default:
AXE_SET_ERROR( AXE_ERROR_MSG_COULD_NOT_GET_STATE );
return( AXE_FALSE );
}
}
/**
* Sets a library state
*/
AXM2_API unsigned int axm2_set( const int query_state, const unsigned int new_value )
{
switch( query_state )
{
case AXM2_LAST_ERROR:
state.last_error = new_value;
break;
default:
AXE_SET_ERROR( AXE_ERROR_MSG_COULD_NOT_SET_STATE );
return( AXE_FALSE );
}
return( AXE_TRUE );
}
/**
* Returns a message in english explaining an error code
* @see AXM2_LAST_ERROR
* @see error_messages
*/
AXM2_API const char* axm2_get_error_message( const unsigned int error_number )
{
int ok = AXE_IN_RANGE( error_number, 0, (AXE_NUM_BASIC_ERROR_MSG + AXM2_NUM_ERROR_MSG - 1) );
AXE_CHECK_ERROR( ok, AXE_ERROR_MSG_UNKNOWN_ERROR_NUMBER );
if( error_number < AXE_NUM_BASIC_ERROR_MSG )
{
return( basic_error_messages[error_number] );
}
else
{
return( error_messages[error_number - AXE_NUM_BASIC_ERROR_MSG] );
}
}
/**
* Sets callback function to call in case of errors
*/
AXM2_API int axm2_set_error_callback( void (*error_callback) (int, const char*, long) )
{
AXE_CHECK_DBG_ERROR( (NULL != error_callback), AXE_ERROR_MSG_BAD_ERROR_CALLBACK_FUNCTION );
state.error_callback = error_callback;
return( AXE_TRUE );
}
/* $Id: axm2_m2_loader.cpp,v 1.1 2004/09/24 17:58:39 doneval Exp $ */
| [
"d0n3val@2cff7946-3f3c-0410-b79f-f9b517ddbf54"
] | [
[
[
1,
115
]
]
] |
45d186207a81b890779b5b1c683238d0a845196b | cc336f796b029620d6828804a866824daa6cc2e0 | /cximage/CxImage/ximatga.cpp | d58afb1be3cf165933f64e3f420a3886d995c7a6 | [] | no_license | tokyovigilante/xbmc-sources-fork | 84fa1a4b6fec5570ce37a69d667e9b48974e3dc3 | ac3c6ef8c567f1eeb750ce6e74c63c2d53fcde11 | refs/heads/master | 2021-01-19T10:11:37.336476 | 2009-03-09T20:33:58 | 2009-03-09T20:33:58 | 29,232 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,915 | cpp | // Place the code and data below here into the CXIMAGE section.
#ifndef _DLL
#pragma code_seg( "CXIMAGE" )
#pragma data_seg( "CXIMAGE_RW" )
#pragma bss_seg( "CXIMAGE_RW" )
#pragma const_seg( "CXIMAGE_RD" )
#pragma comment(linker, "/merge:CXIMAGE_RW=CXIMAGE")
#pragma comment(linker, "/merge:CXIMAGE_RD=CXIMAGE")
#endif
/*
* File: ximatga.cpp
* Purpose: Platform Independent TGA Image Class Loader and Writer
* 05/Jan/2001 <[email protected]>
* CxImage version 5.80 29/Sep/2003
*/
#include "ximatga.h"
#if CXIMAGE_SUPPORT_TGA
#include "ximaiter.h"
// Definitions for image types.
#define TGA_Null 0
#define TGA_Map 1
#define TGA_RGB 2
#define TGA_Mono 3
#define TGA_RLEMap 9
#define TGA_RLERGB 10
#define TGA_RLEMono 11
#define TGA_CompMap 32
#define TGA_CompMap4 33
////////////////////////////////////////////////////////////////////////////////
bool CxImageTGA::Decode(CxFile *hFile)
{
if (hFile == NULL) return false;
TGAHEADER tgaHead;
try
{
if (hFile->Read(&tgaHead,sizeof(tgaHead),1)==0)
throw "Not a TGA";
bool bCompressed;
switch (tgaHead.ImageType){
case TGA_Map:
case TGA_RGB:
case TGA_Mono:
bCompressed = false;
break;
case TGA_RLEMap:
case TGA_RLERGB:
case TGA_RLEMono:
bCompressed = true;
break;
default:
throw "Unknown TGA image type";
}
if (tgaHead.ImageWidth==0 || tgaHead.ImageHeight==0 || tgaHead.PixelDepth==0 || tgaHead.CmapLength>256)
throw "bad TGA header";
if (tgaHead.PixelDepth!=8 && tgaHead.PixelDepth!=15 && tgaHead.PixelDepth!=16 && tgaHead.PixelDepth!=24 && tgaHead.PixelDepth!=32)
throw "bad TGA header";
if (tgaHead.IdLength>0) hFile->Seek(tgaHead.IdLength,SEEK_CUR); //skip descriptor
Create(tgaHead.ImageWidth, tgaHead.ImageHeight, tgaHead.PixelDepth, CXIMAGE_FORMAT_TGA);
#if CXIMAGE_SUPPORT_ALPHA // <vho>
if (tgaHead.PixelDepth==32) AlphaCreate(); // Image has alpha channel
#endif //CXIMAGE_SUPPORT_ALPHA
if (!IsValid()) throw "TGA Create failed";
if (info.nEscape) throw "Cancelled"; // <vho> - cancel decoding
if (tgaHead.CmapType != 0){ // read the palette
rgb_color pal[256];
hFile->Read(pal,tgaHead.CmapLength*sizeof(rgb_color), 1);
for (int i=0;i<tgaHead.CmapLength; i++) SetPaletteColor((BYTE)i,pal[i].b,pal[i].g,pal[i].r);
}
if (tgaHead.ImageType == TGA_Mono || tgaHead.ImageType == TGA_RLEMono)
SetGrayPalette();
// Bits 4 & 5 of the Image Descriptor byte control the ordering of the pixels.
bool bXReversed = ((tgaHead.ImagDesc & 16) == 16);
bool bYReversed = ((tgaHead.ImagDesc & 32) == 32);
CImageIterator iter(this);
BYTE rleLeftover = 255; //for images with illegal packet boundary
BYTE* pDest;
for (int y=0; y < tgaHead.ImageHeight; y++){
if (info.nEscape) throw "Cancelled"; // <vho> - cancel decoding
if (hFile == NULL || hFile->Eof()) throw "corrupted TGA";
if (bYReversed) pDest = iter.GetRow(tgaHead.ImageHeight-y-1);
else pDest = iter.GetRow(y);
if (bCompressed) rleLeftover = ExpandCompressedLine(pDest,&tgaHead,hFile,tgaHead.ImageWidth,y,rleLeftover);
else ExpandUncompressedLine (pDest,&tgaHead,hFile,tgaHead.ImageWidth,y,0);
}
if (bXReversed) Mirror();
#if CXIMAGE_SUPPORT_ALPHA
if (bYReversed && tgaHead.PixelDepth==32) AlphaFlip(); //<lioucr>
#endif //CXIMAGE_SUPPORT_ALPHA
} catch (char *message) {
strncpy(info.szLastError,message,255);
return FALSE;
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
bool CxImageTGA::Encode(CxFile * hFile)
{
if (EncodeSafeCheck(hFile)) return false;
if (head.biBitCount<8){
strcpy(info.szLastError,"Bit depth must be 8 or 24");
return false;
}
TGAHEADER tgaHead;
tgaHead.IdLength = 0; // Image ID Field Length
tgaHead.CmapType = GetPalette()!=0; // Color Map Type
tgaHead.ImageType = (head.biBitCount == 8) ? (BYTE)TGA_Map : (BYTE)TGA_RGB; // Image Type
tgaHead.CmapIndex=0; // First Entry Index
tgaHead.CmapLength=(head.biBitCount == 8) ? 256 : 0; // Color Map Length
tgaHead.CmapEntrySize=(head.biBitCount == 8) ? (BYTE)24 : (BYTE)0; // Color Map Entry Size
tgaHead.X_Origin=0; // X-origin of Image
tgaHead.Y_Origin=0; // Y-origin of Image
tgaHead.ImageWidth=(WORD)head.biWidth; // Image Width
tgaHead.ImageHeight=(WORD)head.biHeight; // Image Height
tgaHead.PixelDepth=(BYTE)head.biBitCount; // Pixel Depth
tgaHead.ImagDesc=0; // Image Descriptor
if (pAlpha && head.biBitCount==24) tgaHead.PixelDepth=32;
hFile->Write(&tgaHead,sizeof(TGAHEADER),1);
if (head.biBitCount==8){
rgb_color pal[256];
RGBQUAD* ppal = GetPalette();
for (int i=0;i<256; i++){
pal[i].r = ppal[i].rgbBlue;
pal[i].g = ppal[i].rgbGreen;
pal[i].b = ppal[i].rgbRed;
}
hFile->Write(&pal,256*sizeof(rgb_color),1);
}
CImageIterator iter(this);
BYTE* pDest;
if (pAlpha==0 || head.biBitCount==8){
for (int y=0; y < tgaHead.ImageHeight; y++){
pDest = iter.GetRow(y);
hFile->Write(pDest,tgaHead.ImageWidth * (head.biBitCount >> 3),1);
}
} else {
pDest = (BYTE*)malloc(4*tgaHead.ImageWidth);
RGBQUAD c;
for (int y=0; y < tgaHead.ImageHeight; y++){
for(int x=0, x4=0;x<tgaHead.ImageWidth;x++, x4+=4){
c=GetPixelColor(x,y);
pDest[x4+0]=c.rgbBlue;
pDest[x4+1]=c.rgbGreen;
pDest[x4+2]=c.rgbRed;
#if CXIMAGE_SUPPORT_ALPHA // <vho>
pDest[x4+3]=(BYTE)((AlphaGet(x,y)*info.nAlphaMax)/255);
#else
pDest[x4+3]=0;
#endif //CXIMAGE_SUPPORT_ALPHA
}
hFile->Write(pDest,4*tgaHead.ImageWidth,1);
}
free(pDest);
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
BYTE CxImageTGA::ExpandCompressedLine(BYTE* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int width, int y, BYTE rleLeftover)
{
try{
BYTE rle;
long filePos;
for (int x=0; x<width; ){
if (rleLeftover != 255){
rle = rleLeftover;
rleLeftover = 255;
} else {
hFile->Read(&rle,1,1);
}
if (rle & 128) { // RLE-Encoded packet
rle -= 127; // Calculate real repeat count.
if ((x+rle)>width){
rleLeftover = 128 + (rle - (width - x) - 1);
filePos = hFile->Tell();
rle=width-x;
}
switch (ptgaHead->PixelDepth)
{
case 32: {
RGBQUAD color;
hFile->Read(&color,4,1);
for (int ix = 0; ix < rle; ix++){
memcpy(&pDest[3*ix],&color,3);
#if CXIMAGE_SUPPORT_ALPHA // <vho>
AlphaSet(ix+x,y,color.rgbReserved);
#endif //CXIMAGE_SUPPORT_ALPHA
}
break;
}
case 24: {
rgb_color triple;
hFile->Read(&triple,3,1);
for (int ix = 0; ix < rle; ix++) memcpy(&pDest[3*ix],&triple,3);
break;
}
case 15:
case 16: {
WORD pixel;
hFile->Read(&pixel,2,1);
rgb_color triple;
triple.r = (BYTE)(( pixel & 0x1F ) * 8); // red
triple.g = (BYTE)(( pixel >> 2 ) & 0x0F8); // green
triple.b = (BYTE)(( pixel >> 7 ) & 0x0F8); // blue
for (int ix = 0; ix < rle; ix++){
memcpy(&pDest[3*ix],&triple,3);
}
break;
}
case 8: {
BYTE pixel;
hFile->Read(&pixel,1,1);
for (int ix = 0; ix < rle; ix++) pDest[ix] = pixel;
}
}
if (rleLeftover!=255) hFile->Seek(filePos, SEEK_SET);
} else { // Raw packet
rle += 1; // Calculate real repeat count.
if ((x+rle)>width){
rleLeftover = rle - (width - x) - 1;
rle=width-x;
}
ExpandUncompressedLine(pDest,ptgaHead,hFile,rle,y,x);
}
if (head.biBitCount == 24) pDest += rle*3; else pDest += rle;
x += rle;
}
} catch(...){ }
return rleLeftover;
}
////////////////////////////////////////////////////////////////////////////////
void CxImageTGA::ExpandUncompressedLine(BYTE* pDest,TGAHEADER* ptgaHead,CxFile *hFile,int width, int y, int xoffset)
{
try{
switch (ptgaHead->PixelDepth){
case 8:
hFile->Read(pDest,width,1);
break;
case 15:
case 16:{
BYTE* dst=pDest;
WORD pixel;
for (int x=0; x<width; x++){
hFile->Read(&pixel,2,1);
*dst++ = (BYTE)(( pixel & 0x1F ) * 8); // blue
*dst++ = (BYTE)(( pixel >> 2 ) & 0x0F8); // green
*dst++ = (BYTE)(( pixel >> 7 ) & 0x0F8); // red
}
break;
}
case 24:
hFile->Read(pDest,3*width,1);
break;
case 32:{
BYTE* dst=pDest;
for (int x=0; x<width; x++){
RGBQUAD pixel;
hFile->Read(&pixel,4,1);
*dst++ = pixel.rgbBlue;
*dst++ = pixel.rgbGreen;
*dst++ = pixel.rgbRed;
#if CXIMAGE_SUPPORT_ALPHA // <vho>
AlphaSet(x+xoffset,y,pixel.rgbReserved); //alpha
#endif //CXIMAGE_SUPPORT_ALPHA
}
break;
}
}
} catch(...){ }
}
////////////////////////////////////////////////////////////////////////////////
#endif // CXIMAGE_SUPPORT_TGA
| [
"jmarshallnz@568bbfeb-2a22-0410-94d2-cc84cf5bfa90"
] | [
[
[
1,
305
]
]
] |
8571397e1504da71c88cedff4e99f27fd7f276d0 | b4bff7f61d078e3dddeb760e21174a781ed7f985 | /Source/Contrib/Video/src/DirectShow/OSGDirectShowManager.inl | 4521d23876952a265560991a6370fc3a64ef215a | [] | no_license | Langkamp/OpenSGToolbox | 8283edb6074dffba477c2c4d632e954c3c73f4e3 | 5a4230441e68f001cdf3e08e9f97f9c0f3c71015 | refs/heads/master | 2021-01-16T18:15:50.951223 | 2010-05-19T20:24:52 | 2010-05-19T20:24:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,319 | inl | /*---------------------------------------------------------------------------*\
* OpenSG ToolBox Video *
* *
* *
* *
* *
* www.vrac.iastate.edu *
* *
Authors: David Kabala
* *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
* License *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Library General Public License as published *
* by the Free Software Foundation, version 2. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* *
\*---------------------------------------------------------------------------*/
#include "OSGDirectShowManager.h"
OSG_BEGIN_NAMESPACE
OSG_END_NAMESPACE
| [
"[email protected]"
] | [
[
[
1,
32
]
]
] |
32de0edd56f6a47cc9ee8e5c90e04bd8c3ff2fc6 | 2dbbca065b62a24f47aeb7ec5cd7a4fd82083dd4 | /OUAN/OUAN/Src/Game/GameObject/GameObjectBee_Butterfly.cpp | f479018c9df2a0500accb933483b2ae9fd21454a | [] | no_license | juanjmostazo/once-upon-a-night | 9651dc4dcebef80f0475e2e61865193ad61edaaa | f8d5d3a62952c45093a94c8b073cbb70f8146a53 | refs/heads/master | 2020-05-28T05:45:17.386664 | 2010-10-06T12:49:50 | 2010-10-06T12:49:50 | 38,101,059 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,393 | cpp | #include "OUAN_Precompiled.h"
#include "GameObjectBee_Butterfly.h"
#include "../GameWorldManager.h"
using namespace OUAN;
GameObjectBee_Butterfly::GameObjectBee_Butterfly(const std::string& name)
:GameObject(name,GAME_OBJECT_TYPE_BEE_BUTTERFLY)
{
}
GameObjectBee_Butterfly::~GameObjectBee_Butterfly()
{
}
/// Set logic component
void GameObjectBee_Butterfly::setLogicComponentEnemy(LogicComponentEnemyPtr logicComponentEnemy)
{
mLogicComponentEnemy=logicComponentEnemy;
}
/// return logic component
LogicComponentEnemyPtr GameObjectBee_Butterfly::getLogicComponentEnemy()
{
return mLogicComponentEnemy;
}
void GameObjectBee_Butterfly::setRenderComponentPositional(RenderComponentPositionalPtr pRenderComponentPositional)
{
mRenderComponentPositional=pRenderComponentPositional;
}
void GameObjectBee_Butterfly::setRenderComponentInitial(RenderComponentInitialPtr pRenderComponentInitial)
{
mRenderComponentInitial=pRenderComponentInitial;
}
RenderComponentPositionalPtr GameObjectBee_Butterfly::getRenderComponentPositional() const
{
return mRenderComponentPositional;
}
RenderComponentInitialPtr GameObjectBee_Butterfly::getRenderComponentInitial() const
{
return mRenderComponentInitial;
}
void GameObjectBee_Butterfly::setRenderComponentEntityDreams(RenderComponentEntityPtr pRenderComponentEntityDreams)
{
mRenderComponentEntityDreams=pRenderComponentEntityDreams;
}
void GameObjectBee_Butterfly::setRenderComponentEntityNightmares(RenderComponentEntityPtr pRenderComponentEntityNightmares)
{
mRenderComponentEntityNightmares=pRenderComponentEntityNightmares;
}
RenderComponentEntityPtr GameObjectBee_Butterfly::getRenderComponentEntityDreams() const
{
return mRenderComponentEntityDreams;
}
RenderComponentEntityPtr GameObjectBee_Butterfly::getRenderComponentEntityNightmares() const
{
return mRenderComponentEntityNightmares;
}
void GameObjectBee_Butterfly::setPhysicsComponentCharacterDreams(PhysicsComponentCharacterPtr pPhysicsComponentCharacterDreams)
{
mPhysicsComponentCharacterDreams=pPhysicsComponentCharacterDreams;
}
PhysicsComponentCharacterPtr GameObjectBee_Butterfly::getPhysicsComponentCharacterDreams() const
{
return mPhysicsComponentCharacterDreams;
}
void GameObjectBee_Butterfly::setPhysicsComponentCharacterNightmares(PhysicsComponentCharacterPtr pPhysicsComponentCharacterNightmares)
{
mPhysicsComponentCharacterNightmares=pPhysicsComponentCharacterNightmares;
}
PhysicsComponentCharacterPtr GameObjectBee_Butterfly::getPhysicsComponentCharacterNightmares() const
{
return mPhysicsComponentCharacterNightmares;
}
void GameObjectBee_Butterfly::update(double elapsedSeconds)
{
GameObject::update(elapsedSeconds);
}
void GameObjectBee_Butterfly::reset()
{
GameObject::reset();
mPhysicsComponentCharacterDreams->reset();
mPhysicsComponentCharacterNightmares->reset();
}
bool GameObjectBee_Butterfly::hasPositionalComponent() const
{
return true;
}
RenderComponentPositionalPtr GameObjectBee_Butterfly::getPositionalComponent() const
{
return getRenderComponentPositional();
}
void GameObjectBee_Butterfly::processCollision(GameObjectPtr pGameObject, Ogre::Vector3 pNormal)
{
if (mLogicComponentEnemy.get())
{
mLogicComponentEnemy->processCollision(pGameObject, pNormal);
}
}
bool GameObjectBee_Butterfly::hasPhysicsComponent() const
{
return false;
}
PhysicsComponentPtr GameObjectBee_Butterfly::getPhysicsComponent() const
{
return (mGameWorldManager->getWorld()==DREAMS)
?getPhysicsComponentCharacterDreams()
:getPhysicsComponentCharacterNightmares();
}
void GameObjectBee_Butterfly::processEnterTrigger(GameObjectPtr pGameObject)
{
if (mLogicComponentEnemy.get())
{
mLogicComponentEnemy->processEnterTrigger(pGameObject);
}
}
void GameObjectBee_Butterfly::processExitTrigger(GameObjectPtr pGameObject)
{
if (mLogicComponentEnemy.get())
{
mLogicComponentEnemy->processExitTrigger(pGameObject);
}
}
void GameObjectBee_Butterfly::changeWorldFinished(int newWorld)
{
if (!isEnabled()) return;
switch(newWorld)
{
case DREAMS:
break;
case NIGHTMARES:
break;
default:
break;
}
}
void GameObjectBee_Butterfly::changeWorldStarted(int newWorld)
{
if (!isEnabled()) return;
switch(newWorld)
{
case DREAMS:
break;
case NIGHTMARES:
break;
default:
break;
}
}
void GameObjectBee_Butterfly::changeToWorld(int newWorld, double perc)
{
if (!isEnabled()) return;
switch(newWorld)
{
case DREAMS:
break;
case NIGHTMARES:
break;
default:
break;
}
}
bool GameObjectBee_Butterfly::hasRenderComponentEntity() const
{
return true;
}
RenderComponentEntityPtr GameObjectBee_Butterfly::getEntityComponent() const
{
return (mWorld==DREAMS)?mRenderComponentEntityDreams:mRenderComponentEntityNightmares;
}
bool GameObjectBee_Butterfly::hasLogicComponent() const
{
return true;
}
LogicComponentPtr GameObjectBee_Butterfly::getLogicComponent() const
{
return mLogicComponentEnemy;
}
//-------------------------------------------------------------------------------------------
TGameObjectBee_ButterflyParameters::TGameObjectBee_ButterflyParameters() : TGameObjectParameters()
{
}
TGameObjectBee_ButterflyParameters::~TGameObjectBee_ButterflyParameters()
{
} | [
"ithiliel@1610d384-d83c-11de-a027-019ae363d039",
"wyern1@1610d384-d83c-11de-a027-019ae363d039",
"juanj.mostazo@1610d384-d83c-11de-a027-019ae363d039"
] | [
[
[
1,
2
],
[
103,
106
],
[
108,
111
],
[
195,
200
],
[
202,
206
],
[
208,
210
]
],
[
[
3,
34
],
[
40,
44
],
[
50,
91
],
[
93,
93
],
[
98,
100
],
[
112,
113
],
[
115,
117
],
[
119,
194
],
[
201,
201
],
[
207,
207
],
[
211,
220
]
],
[
[
35,
39
],
[
45,
49
],
[
92,
92
],
[
94,
97
],
[
101,
102
],
[
107,
107
],
[
114,
114
],
[
118,
118
]
]
] |
7f0bafc1e7df918b9d0945f616e6bcc83ebaccaf | 6426b0ba09cf324c4caad8b86b74f33ef489710e | /src/MVC/Controller.h | 1941b77a7439369a993286f2cc7617707128fdce | [] | no_license | gameoverhack/iMediate | e619a1148ecc3f76f011e2c1a7fa9cdb32c8a290 | 9c43edf26954cbc15fb0145632fa4dbf2634fc29 | refs/heads/master | 2020-04-05T23:05:37.392441 | 2010-10-23T20:10:03 | 2010-10-23T20:10:03 | 1,373,120 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,157 | h | /*
* Controller.h
* openFrameworks
*
* Created by gameoverx on 1/09/09.
* Copyright 2009 __MyCompanyName__. All rights reserved.
*
*/
#ifndef __CONTROLLER_H
#define __CONTROLLER_H
#define CONTROLLER ControllerSingleton::Instance()
#include "Singleton.h"
#include "Model.h"
#include "View.h"
#include "Logger.h"
#include "ApplicationLoader.h"
#include "goVideoGroup.h"
#include "goGuiManager.h"
#include "goMidiManager.h"
#include "goOSCManager.h"
#define GROUPS CONTROLLER->groups
class Controller
{
public:
Controller()
{
LOG("Controller instantiated");
};
~Controller()
{
LOG("Controller destroyed");
};
goVideoGroup groups[MAX_VIDEO_CHANNELS];
void setup();
void fullScreen();
string folderArray[1000]; // silly big number for max number of directories
private:
string windowTitle;
bool bCustomFullscreen;
};
typedef Singleton<Controller> ControllerSingleton; // Global declaration
#endif
| [
"gameover@4bdaed08-0356-49c7-8fa1-902f09de843b"
] | [
[
[
1,
56
]
]
] |
7a263b8f25a66470f5a01146b3620aaad3ad1dfb | cfa6cdfaba310a2fd5f89326690b5c48c6872a2a | /References/Chat/ChatS/Mgr.cpp | 639b2e33df84e99245ea2adc1298d0a6d5ccbe7e | [] | 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 | 5,692 | cpp | #include "StdAfx.h"
#include "mgr.h"
#include "member.h"
#include "ChatSDlg.h"
#include ".\mgr.h"
CMgr::CMgr(void)
{
}
CMgr::~CMgr(void)
{
}
int CMgr::ExistMember(CString id)
{
// 아이디가 존재하는지 검사..
int nSel=-1;
for(int i=0;i<m_Membernum;i++){
if(strcmp(m_Memberlist[i].GetID(), id)==0){
nSel=i;
break;
}
}
return nSel;
}
bool CMgr::Addmember(CString id, CString pass, CString name) // 멤버 추가.
{
// 기존 아이디가 존재하는지 검사
if(m_Membernum==0 || ExistMember(id) == -1)
{
// 파일에 추가
CFile file;
if(file.Open(_T("Memberdata.dat"), CFile::modeWrite))
{
//리스트에 저장
m_Memberlist[m_Membernum].Setmember(id, pass, name);
m_Memberlist[m_Membernum].m_mylistnum = 0;
m_Membernum++;
//파일에 저장
CArchive ar(&file, CArchive::store);
Serialize(ar);
ar.Close();
}
else {
AfxMessageBox(_T("파일에 저장 실패"));
}
}
else
{
// 아이디가 이미 존재하는 경우 멤버추가 실패
return false;
}
return true;
}
bool CMgr::Delmember(CString id)
{
// 번호 찾기
int nSel=ExistMember(id);
CFile file;
if(file.Open(_T("Memberdata.dat"), CFile::modeWrite))
{
//리스트에서 삭제
for(int i=nSel;i<m_Membernum-1;i++){
m_Memberlist[i].Setmember (m_Memberlist[i+1].m_id, m_Memberlist[i+1].m_pass, m_Memberlist[i+1].m_name);
}
m_Membernum --;
//파일에 저장
CArchive ar(&file, CArchive::store);
Serialize(ar);
ar.Close();
return true;
}
return false;
}
void CMgr::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{ // storing code
ar << m_Membernum;
for(int i=0;i<m_Membernum;i++){
ar << m_Memberlist[i].m_id;
ar << m_Memberlist[i].m_pass;
ar << m_Memberlist[i].m_name;
ar << m_Memberlist[i].m_mylistnum;
for(int j=0;j<m_Memberlist[i].m_mylistnum;j++)
{
ar << m_Memberlist[i].m_mylist[j];
}
}
}
else
{ // loading code
ar >> m_Membernum;
for(int i=0;i<m_Membernum;i++){
ar >> m_Memberlist[i].m_id;
ar >> m_Memberlist[i].m_pass;
ar >> m_Memberlist[i].m_name;
ar >> m_Memberlist[i].m_mylistnum;
for(int j=0;j<m_Memberlist[i].m_mylistnum;j++)
{
ar >> m_Memberlist[i].m_mylist[j];
}
}
}
}
bool CMgr::Init(CChatSDlg *p)
{
CFile file;
if(file.Open(_T("Memberdata.dat"), CFile::modeRead))
{
// 파일이 이미 존재할 경우 읽기모드
CArchive ar(&file, CArchive::load);
Serialize(ar);
for(int i=0;i<m_Membernum;i++){
// 다이얼로그에 표시
p->ShowMember(i,m_Memberlist[i].GetID(), m_Memberlist[i].GetName());
}
ar.Close();
}
else {
// 파일이 없을 경우 파일 생성
file.Open(_T("Memberdata.dat"), CFile::modeCreate | CFile::modeWrite);
CArchive ar(&file, CArchive::store);
m_Membernum = 0;
Serialize(ar);
ar.Close();
}
return true;
}
bool CMgr::CheckPass(CString id, CString pass)
{
int nSel=ExistMember(id);
if(strcmp(m_Memberlist[nSel].m_pass , pass) == 0) return true;
return false;
}
void CMgr::ModMemberName(int nSel, CString name)
{
// 데이터 변경
m_Memberlist[nSel].m_name = name;
// 파일에 저장
CFile file;
if(file.Open(_T("Memberdata.dat"), CFile::modeWrite))
{
CArchive ar(&file, CArchive::store);
Serialize(ar);
ar.Close();
}
}
void CMgr::SetMemberOnline(CString id, bool online, CDataSocket * pDataSocket)
{
// 번호 찾기
int nSel=ExistMember(id);
if(nSel==-1) return;
m_Memberlist[nSel].m_online = online;
m_Memberlist[nSel].m_pDataSocket = pDataSocket;
}
CString CMgr::GetMemberName(CString id)
{
int nSel=ExistMember(id);
return m_Memberlist[nSel].GetName();
}
bool CMgr::GetMemberOnline(CString id)
{
// 번호 찾기
int nSel=ExistMember(id);
if(nSel==-1) return false;
return m_Memberlist[nSel].m_online;
}
CDataSocket * CMgr::GetMemberSocket(CString id)
{
// 번호 찾기
int nSel=ExistMember(id);
if(nSel==-1) return NULL;
return m_Memberlist[nSel].m_pDataSocket;
}
void CMgr::AddMemberMylist(int nSel, CString destId) // 대화상대 추가해서 저장.
{
// 이미 있는 사람인지.. 확인
// 데이터 변경
m_Memberlist[nSel].Addmylist(destId);
// 파일에 저장
CFile file;
if(file.Open(_T("Memberdata.dat"), CFile::modeWrite))
{
CArchive ar(&file, CArchive::store);
Serialize(ar);
ar.Close();
}
}
void CMgr::DelMemberMylist(int nSel, CString destId) // 대화상대 삭제해서 저장.
{
// 데이터 변경
m_Memberlist[nSel].Delmylist(destId);
// 파일에 저장
CFile file;
if(file.Open(_T("Memberdata.dat"), CFile::modeWrite))
{
CArchive ar(&file, CArchive::store);
Serialize(ar);
ar.Close();
}
}
CDataSocket * CMgr::GetMemberSocket(int nSel)
{
return m_Memberlist[nSel].m_pDataSocket;
}
CString CMgr::GetMemberID(int nSel)
{
return m_Memberlist[nSel].m_id;
}
CString CMgr::GetMemberName(int nSel)
{
return m_Memberlist[nSel].m_name;
}
bool CMgr::GetMemberOnline(int nSel)
{
return m_Memberlist[nSel].m_online;
}
int CMgr::GetMemberMylistnum(int nSel)
{
return m_Memberlist[nSel].m_mylistnum;
}
CString CMgr::GetMemberMylist(int nSel, int nSel2)
{
return m_Memberlist[nSel].m_mylist[nSel2];
}
int CMgr::GetMemberMylistExist(int nSel, CString id)
{
int n = m_Memberlist[nSel].m_mylistnum;
// 리스트에 아이디가 존재하는지 검사..
int nSel2=-1;
for(int i=0;i<n;i++){
if(strcmp(m_Memberlist[nSel].m_mylist[i], id)==0){
nSel2=i;
break;
}
}
return nSel2;
}
| [
"[email protected]"
] | [
[
[
1,
273
]
]
] |
03168b40ee661ee2845084a4a62c0600cf0ded12 | 906e87b1936397339734770be45317f06fe66e6e | /include/TGScrollBox.h | ff6dd20ca492094c4f3093399928f3cf0e7b5b87 | [] | no_license | kcmohanprasad/tgui | 03c1ab47e9058bc763b7e6ffc21a37b4358369bf | 9f9cf391fa86b99c7d606c4d196e512a7b06be95 | refs/heads/master | 2021-01-10T08:52:18.629088 | 2007-05-17T04:42:58 | 2007-05-17T04:42:58 | 52,069,498 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,703 | h | //-----------------------------------------------------------------------------
// This source file is part of TGUI (Tiny GUI)
//
// Copyright (c) 2006-2007 Tubras Software, Ltd
// Also see acknowledgements in Readme.html
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to
// do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef __TGSCROLLBOX_H__
#define __TGSCROLLBOX_H__
namespace TGUI
{
class _TGUIExport TGScrollBox : public TGControl
{
TGReal clientWidth;
TGReal clientHeight;
TGReal hScrollMax;
TGReal vScrollMax;
TGReal hScroll;
TGReal vScroll;
int scrolling; // 0=no, 1=vertical, 2=horizontal
public:
TGScrollBox(TGControl *parent, TGString name="");
virtual ~TGScrollBox();
virtual void setScrollingBounds(TGReal hMax, TGReal vMax);
virtual void render();
virtual TGString getControlType() {return "TGScrollBox";};
virtual void setBounds(int x1, int y1, int x2, int y2);
virtual void layout();
virtual bool pointInControl(TGReal x, TGReal y);
virtual TGControl *childAt(TGReal x, TGReal y);
virtual TGReal getVScrollMax() {return vScrollMax;};
virtual void setVScrollPos(TGReal value);
virtual void onScroll(TGReal hd, TGReal vd);
virtual void onMouseDown(int x, int y, int b);
virtual void onMouseMoved(int x, int y);
virtual void onMouseUp(int x, int y, int b);
virtual void onMouseEnter();
virtual void onMouseExit();
};
}
#endif
| [
"pc0der@a5263bde-0223-0410-8bbb-1954fdd97a2f"
] | [
[
[
1,
71
]
]
] |
3de98c145a03a9cc815596cf056792659f6d4a30 | 1eb0e6d7119d33fa76bdad32363483d0c9ace9b2 | /PointCloud/trunk/PointCloud/CellData.cpp | 66515bf70fed2a97687132c1be9d2a12d3da9c00 | [] | no_license | kbdacaa/point-clouds-mesh | 90f174a534eddb373a1ac6f5481ee7a80b05f806 | 73b6bc17aa5c597192ace1a3356bff4880ca062f | refs/heads/master | 2016-09-08T00:22:30.593144 | 2011-06-04T01:54:24 | 2011-06-04T01:54:24 | 41,203,780 | 0 | 2 | null | null | null | null | GB18030 | C++ | false | false | 3,080 | cpp | #include "stdafx.h"
#include "CellData.h"
/*
构建点云到三维栅格中
输入参数:l为栅格边长的倒数,cellsBox为点云的包围盒,dataPts为点云数据,nPts为点云个数
输出参数:cells为构建的栅格中存储的点序号
*/
void readPtsToCell(Array3D<CellData>& cells, float l, BBox& cellsBox, float** dataPts, int nPts){
for (int i = 0; i < nPts ; i++){
float* pt = dataPts[i];
int x = (int)((pt[0]-cellsBox.min[0]) * l);
int y = (int)((pt[1]-cellsBox.min[1]) * l);
int z = (int)((pt[2]-cellsBox.min[2]) * l);
if (x == cells.size[0])
x--;
if (y == cells.size[1])
y--;
if (z == cells.size[2])
z--;
cells(x, y, z).pts.push_back(i);
}
}
/*
计算两点之间的距离的平方
*/
template <class T>
inline T Ratio2(T* p, T* c){
return (p[0]-c[0])*(p[0]-c[0]) + (p[1]-c[1])*(p[1]-c[1]) + (p[2]-c[2])*(p[2]-c[2]);
}
/*
根据三维栅格法进行精简点云数据
输入参数:t为精简比例>1,dataPts点云数据,nPts点云个数
输出参数:beSimpled 是否被精简掉
返回值:保留点的个数
beSimpled 使用之前设置为true
三维栅格法在数据点云精简中的应用
*/
int simplyByCell(bool* beSimpled, float t, float** dataPts, int nPts){
assert(t > 0);
assert(dataPts!= NULL);
assert(nPts > 0);
for (int i = 0; i < nPts ; i++){
beSimpled[i] = true;
}
int leftNum = 0;
BBox cellsBox;
cellsBox.init();
for (int i = 0; i < nPts ; i++){
float* pt = dataPts[i];
for (int j = 0; j < 3 ; j++){
if (cellsBox.min[j]>pt[j])
cellsBox.min[j] = pt[j];
if (cellsBox.max[j] < pt[j])
cellsBox.max[j] = pt[j];
}
}
vect3f cellSize;
cellSize = cellsBox.size();
// TODO::
//+如何计算栅格长度的倒数?l为栅格边长的倒数+
float l = sqrt(nPts*(cellSize[0]+cellSize[1]+cellSize[2]) / (6*t*cellSize[0]*cellSize[1]*cellSize[2]));
int xs = (int)(cellSize[0] * l);
int ys = (int)(cellSize[1] * l);
int zs = (int)(cellSize[2] * l);
Array3D<CellData> cells;
cells.resize(xs, ys, zs);
readPtsToCell(cells, l, cellsBox, dataPts, nPts);
int size = cells.size[0]*cells.size[1]*cells.size[2];
for (int i = 0; i < size ; i++){
CellData cell = cells.data[i];
int cellptsize = cell.pts.size();
if (cellptsize == 0) continue;
float centerPt[3]; //+栅格的中心点+
centerPt[0] = centerPt[1] = centerPt[2] = 0;
for (int j = 0; j < cellptsize ; j++){
int idx = cell.pts[j];
centerPt[0] += dataPts[idx][0];
centerPt[1] += dataPts[idx][1];
centerPt[2] += dataPts[idx][2];
}
centerPt[0] /= cellptsize;
centerPt[1] /= cellptsize;
centerPt[2] /= cellptsize;
double minR2 = DBL_MAX;
int idxMin = -1;
for (int j = 0; j < cellptsize ; j++){
float* pt = dataPts[cell.pts[j]];
double R2 = Ratio2(pt, centerPt);
if (minR2 > R2){
minR2 = R2;
idxMin = cell.pts[j];
}
}
beSimpled[idxMin] = false; //+距离栅格中心最近的点保留+
leftNum++;
}
return leftNum;
} | [
"huangchunkuangke@e87e5053-baee-b2b1-302d-3646b6e6cf75"
] | [
[
[
1,
111
]
]
] |
9a92a39d5838abe5ae5c84ca3dc5c251dc87065a | 5a05acb4caae7d8eb6ab4731dcda528e2696b093 | /GameEngine/Gfx/GeometryType.hpp | 28d20427fc2bc592a4d94732c9ceb822eb618410 | [] | no_license | andreparker/spiralengine | aea8b22491aaae4c14f1cdb20f5407a4fb725922 | 36a4942045f49a7255004ec968b188f8088758f4 | refs/heads/master | 2021-01-22T12:12:39.066832 | 2010-05-07T00:02:31 | 2010-05-07T00:02:31 | 33,547,546 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 881 | hpp | /*!
*/
#ifndef GEOMETRY_TYPE_HPP
#define GEOMETRY_TYPE_HPP
#include <boost/cstdint.hpp>
namespace Spiral
{
namespace Impl
{
struct GeometryType
{
GeometryType():type(INVALID)
{}
enum
{
INVALID = -1,
GT_TRIANGLES = 0x0004,
GT_TRIANGLE_STRIP = 0x0005,
GT_QUADS = 0x0007,
GT_POINTS = 0x0000
};
boost::int32_t GetType()const
{
return type;
}
static GeometryType Create_TriangleType()
{
return GeometryType( GT_TRIANGLES );
}
static GeometryType Create_TriangleStripType()
{
return GeometryType( GT_TRIANGLE_STRIP );
}
static GeometryType Create_PointType()
{
return GeometryType( GT_POINTS );
}
private:
GeometryType( boost::int32_t type_ ):
type( type_ )
{
}
boost::int32_t type;
};
}//Impl
typedef Impl::GeometryType GeometryType;
}
#endif | [
"DreLnBrown@e933ee44-1dc6-11de-9e56-bf19dc6c588e"
] | [
[
[
1,
59
]
]
] |
019a70a39bb8f384a1599fbc80b755e2486df896 | 57574cc7192ea8564bd630dbc2a1f1c4806e4e69 | /Poker/Comun/Properties.h | 435251b4d8f654dd4d58b0fe1cd794a76d74011c | [] | no_license | natlehmann/taller-2010-2c-poker | 3c6821faacccd5afa526b36026b2b153a2e471f9 | d07384873b3705d1cd37448a65b04b4105060f19 | refs/heads/master | 2016-09-05T23:43:54.272182 | 2010-11-17T11:48:00 | 2010-11-17T11:48:00 | 32,321,142 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 631 | h | #ifndef _PROPERTIES_H__
#define _PROPERTIES_H__
#define _CRT_SECURE_NO_DEPRECATE 1
#define PROP_SEPARADOR "="
#define PROP_COMENTARIO "#"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <fstream>
#include <map>
using namespace std;
class Properties
{
private:
string nombreArchivo;
ifstream* archivo;
map<string,string>* properties;
void inicializar();
void procesarLinea(string linea);
public:
Properties(string nombreArchivo);
virtual ~Properties(void);
string get(string clave);
void setNombreArchivo(string nombreArchivo);
};
#endif
| [
"[email protected]@a9434d28-8610-e991-b0d0-89a272e3a296"
] | [
[
[
1,
36
]
]
] |
e1d3c5bcf7fa7443c397e4f0491f55b7e2c3e21f | 2d978d6a23763d194e594f0c067fc52092f5c486 | /Win32/CefSharp/Utils.cpp | de16eea9c81b4efc61facde283e2b53a2dd46251 | [] | no_license | WindowsTermKit/TermKit | 08ce90aed222e9261f1132d5d243d4cf3ab9242b | 414a36452fac78e2553265c2b43be05dd7a61656 | refs/heads/master | 2021-01-17T21:36:24.528259 | 2011-06-04T02:59:28 | 2011-06-04T02:59:28 | 1,808,466 | 25 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 754 | cpp | #include "stdafx.h"
namespace CefSharp
{
String^ convertToString(const cef_string_t& cefStr)
{
return gcnew String(cefStr.str);
}
String^ convertToString(const CefString& cefStr)
{
return gcnew String(cefStr.c_str());
}
CefString convertFromString(String^ str)
{
pin_ptr<const wchar_t> pStr = PtrToStringChars(str);
CefString cefStr(pStr);
return cefStr;
}
void assignFromString(cef_string_t& cefStrT, String^ str)
{
cef_string_clear(&cefStrT);
if(str != nullptr)
{
pin_ptr<const wchar_t> pStr = PtrToStringChars(str);
cef_string_copy(pStr, str->Length, &cefStrT);
}
}
} | [
"[email protected]"
] | [
[
[
1,
32
]
]
] |
5eaa2b68fe14693c8441e3c602d49de15db587d4 | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/mw/locationsrv/landmarks_api/src/testcposlandmark.cpp | 9d5f87fcff20056a1bb8e365f4baa647b342f462 | [] | 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 | 34,341 | cpp | /*
* Copyright (c) 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:
*
*/
// INCLUDE FILES
#include <EPos_CPosLandmark.h>
#include <EPos_CPosLandmarkDatabase.h>
#include <EPos_CPosLmCategoryManager.h>
#include <EPos_CPosLandmarkCategory.h>
#include <LbsPosition.h>
#include "testcposlandmark.h"
#include <StifParser.h>
#include <Stiftestinterface.h>
// Literals
// Test Database URI
_LIT( KDBUri, "file://c:eposlmtest.ldb" );
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CTestPosLandmark::CTestPosLandmark
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CTestPosLandmark::CTestPosLandmark( CStifLogger* aLog )
{
iLog = aLog;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::NewL
//
//
// -----------------------------------------------------------------------------
//
CTestPosLandmark* CTestPosLandmark::NewL( CStifLogger* aLog )
{
CTestPosLandmark* self = new (ELeave) CTestPosLandmark( aLog );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop();
return self;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::ConstructL
//
//
// -----------------------------------------------------------------------------
//
void CTestPosLandmark::ConstructL()
{
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::~CTestPosLandmark
//
//
// -----------------------------------------------------------------------------
//
CTestPosLandmark::~CTestPosLandmark()
{
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::CreateNewLandmarkL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::CreateNewLandmarkL( CStifItemParser& /*aItem*/ )
{
//Create an object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
delete lmk;
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::CreateNewLandmarkLC
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::CreateNewLandmarkLC( CStifItemParser& /*aItem*/ )
{
//Create an object using NewLC()
CPosLandmark* lmk = CPosLandmark::NewLC();
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::CreateLandmarkCopyL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::CreateLandmarkCopyL( CStifItemParser& /*aItem*/ )
{
// Create an object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set radius of original landmark
lmk->SetCoverageRadius( 2104 );
// Create another object using copy constructor NewL
CPosLandmark* lmkCopy = CPosLandmark::NewL( *lmk );
CleanupStack::PushL( lmkCopy );
// Get radius of new landmark
TReal32 radius;
lmkCopy->GetCoverageRadius( radius );
// Check radius
if( radius == 2104 )
{
iLog->Log( _L( "Landmark Creation passed" ) );
//delete both the landmarks
CleanupStack::PopAndDestroy( 2, lmk ); // lmkCopy
return KErrNone;
}
else
{
iLog->Log( _L( "Landmark Creation failed" ) );
CleanupStack::PopAndDestroy( 2, lmk ); // lmkCopy
return KErrGeneral;
}
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::CreateLandmarkCopyLC
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::CreateLandmarkCopyLC( CStifItemParser& /*aItem*/ )
{
//Create an object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Create another landmark object using copy constructor NewLC
CPosLandmark* lmkCopy = CPosLandmark::NewLC( *lmk );
//
CleanupStack::PopAndDestroy( 2, lmk ); // lmkCopy
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetLandmarkNameL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetLandmarkNameL( CStifItemParser& aItem )
{
TPtrC name;
TInt err = aItem.GetNextString( name ); // Landmark name
//Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set name of landmark
lmk->SetLandmarkNameL( name );
// Get name
TPtrC getNamePtr;
lmk->GetLandmarkName( getNamePtr );
//
iLog->Log( _L("Name of landmark was set...") );
iLog->Log( getNamePtr );
// Delete object
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::GetLandmarkNameL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::GetLandmarkNameL( CStifItemParser& aItem )
{
TInt num;
TInt err = aItem.GetNextInt( num ); // To set Landmark name or not
//Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set name of landmark if integer value passed from cfg file is 1
if( num == 1 )
{
_LIT( KLmkName, "A landmark Name" );
TBufC<20> nameBuf( KLmkName );
lmk->SetLandmarkNameL( KLmkName );
}
// Get name
TPtrC getNamePtr;
TInt error = lmk->GetLandmarkName( getNamePtr );
// Check name
iLog->Log( _L("Got the name of landmark...") );
iLog->Log( getNamePtr );
// Delete object
CleanupStack::PopAndDestroy( lmk );
return error;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetAndGetLmkDescL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetAndGetLmkDescL( CStifItemParser& aItem )
{
// For setting or not setting desc
TInt num;
TInt err = aItem.GetNextInt( num );
// Description
TPtrC setDescPtr;
err = aItem.GetNextString( setDescPtr ); // Landmark Desc
//Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set description of landmark if num == 1
if( num == 1 )
{
lmk->SetLandmarkDescriptionL( setDescPtr );
}
// Get desc
TPtrC getDescPtr;
TInt error = lmk->GetLandmarkDescription( getDescPtr );
if( KErrNone != error )
{
// Error
iLog->Log( _L( "Error in getting description of landmark..." ) );
User::Leave( error );
}
// Print desc
iLog->Log( _L("Got the description of landmark...") );
iLog->Log( getDescPtr );
//Compare desc
if( getDescPtr.Compare( setDescPtr ) != 0 )
{
iLog->Log( _L("Error in getting description of landmark...") );
User::Leave( error );
}
//Test successful
iLog->Log( _L("Set and get description of landmark successful...") );
// Delete object
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetAndGetCovRadiusL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetAndGetCovRadiusL( CStifItemParser& aItem )
{
// For setting or not setting radius
TInt num;
TInt err = aItem.GetNextInt( num );
// Radius
TPtrC radiusPtr;
err = aItem.GetNextString( radiusPtr );
TLex lex( radiusPtr );
TReal32 radius = 23.56;
lex.Val( radius );
//Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set coverage radius of landmark if num == 1
if( num == 1 )
{
lmk->SetCoverageRadius( radius ); //Return type void
}
// Get cov radius
TInt error;
TReal32 getRadius;
error = lmk->GetCoverageRadius( getRadius );
if( KErrNone != error )
{
// Error
iLog->Log( _L("Error in getting radius of landmark...") );
User::Leave( error );
}
//Compare radius
if( radius != getRadius )
{
iLog->Log( _L("Error in getting radius of landmark...") );
User::Leave( error );
}
//Test successful
iLog->Log( _L("Set and get radius of landmark successful...") );
// Delete object
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetAndGetPositionL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetAndGetPositionL( CStifItemParser& aItem )
{
// Decides whether to use or not Wgs84 data, and to set the position or not
TInt num;
TInt err = aItem.GetNextInt( num );
TPtrC latPtr;
TPtrC longPtr;
err = aItem.GetNextString( latPtr );
err = aItem.GetNextString( longPtr );
TLex lex1( latPtr );
TLex lex2( longPtr );
TReal64 latitude = 21.2435;
TReal64 longitude = 89.0001;
lex1.Val( latitude );
lex2.Val( longitude );
//Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set position of landmark
TInt error;
TLocality position;
position.SetCoordinate( latitude, longitude );
// if num is -1 then use datum other than Wsg84
if( num == -1 )
{
const TPositionDatumId KId = {0x00}; // Wgs84 is 0x101FAA29
position.SetDatum( KId );
}
// set position only if num is not 0
if( num != 0 )
{
lmk->SetPositionL( position );
}
// Get position
TLocality getPosition;
error = lmk->GetPosition( getPosition );
if( KErrNone != error )
{
// Error
iLog->Log( _L("Error in getting position of landmark...") );
User::Leave( error );
}
//Compare position
//Latitude
if( getPosition.Latitude() != latitude )
{
iLog->Log( _L("Error in getting position of landmark...") );
User::Leave( KErrGeneral );
}
//Longitude
if( getPosition.Longitude() != longitude )
{
iLog->Log( _L("Error in getting position of landmark...") );
User::Leave( KErrGeneral );
}
//Test successful
iLog->Log( _L("Set and get position of landmark successful...") );
// Delete object
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetAndGetPositionFieldL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetAndGetPositionFieldL( CStifItemParser& aItem )
{
// Decides whether to set position field or not
TInt num;
TInt err = aItem.GetNextInt( num );
TPtrC fieldNamePtr;
err = aItem.GetNextString( fieldNamePtr );
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set Position field
TPositionFieldId fieldId = 1;
TInt error;
// Set only if num == 1
if( num == 1 )
{
lmk->SetPositionFieldL( fieldId, fieldNamePtr );
}
//Get Position field
TPtrC getPosField;
error = lmk->GetPositionField( fieldId, getPosField );
if( KErrNone != error )
{
iLog->Log( _L("Error in getting position field...") );
User::Leave( error );
}
//Print Position field
iLog->Log( _L("Getting position field of landmark successful...") );
iLog->Log(getPosField);
//Compare position fields
if( getPosField.Compare( fieldNamePtr ) != 0)
{
//Error
iLog->Log( _L("Error in getting position field...") );
User::Leave( KErrGeneral );//return KErrGeneral;
}
iLog->Log( _L("Get and set position field of landmark successful...") );
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::NumOfPosFieldsL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::NumOfPosFieldsL( CStifItemParser& /*aItem*/ )
{
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
//
TUint numOfPosFields;
numOfPosFields = lmk->NumOfAvailablePositionFields();
if( numOfPosFields != 0 )
{
iLog->Log( _L("Error in getting number of position fields of landmark...") );
User::Leave( KErrGeneral );
}
iLog->Log( _L("Getting number of position fields of landmark successful...") );
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::IsPosFieldAvailableL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::IsPosFieldAvailableL( CStifItemParser& /*aItem*/ )
{
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Check for position field with id 1, should return EFalse
TPositionFieldId fieldId = 1;
TBool result;
result = lmk->IsPositionFieldAvailable( fieldId );
if ( result )
{
iLog->Log( _L("Error in IsPositionFieldAvailable1...") );
User::Leave( KErrGeneral );
}
// Add a position field to landmark at index 'fieldId'
_LIT( KFieldName, "The City Name" );
lmk->SetPositionFieldL( fieldId, KFieldName );
// Check for position field, should return ETrue
result = lmk->IsPositionFieldAvailable( fieldId );
if ( !result )
{
iLog->Log( _L("Error in IsPositionFieldAvailable2...") );
User::Leave( KErrGeneral );
}
iLog->Log( _L("IsPositionFieldAvailable successful...") );
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::RemovePositionField
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::RemovePositionFieldL( CStifItemParser& /*aItem*/ )
{
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Add a position field
TPositionFieldId fieldId = 1;
_LIT( KFieldName, "The City Name" );
//TInt error;
lmk->SetPositionFieldL( fieldId, KFieldName );
// Check if field is available, should return ETrue
TBool result;
result = lmk->IsPositionFieldAvailable( fieldId );
if ( !result )
{
iLog->Log( _L("Error in setting position field, can not test RemovePositionField.") );
User::Leave( KErrGeneral );
}
// Remove position field
lmk->RemovePositionField( fieldId ); // No return
// Check if field is available, should return EFalse
result = lmk->IsPositionFieldAvailable( fieldId );
if ( result )
{
iLog->Log( _L("Error in RemovePositionField...") );
User::Leave( KErrGeneral );
}
iLog->Log( _L("RemovePositionField successful...") );
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::RemoveAttributes
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::RemoveAttributesL( CStifItemParser& /*aItem*/ )
{
TInt error;
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set name of landmark
_LIT( KLmkName, "A landmarkk Name" );
lmk->SetLandmarkNameL( KLmkName );
// Set position
TReal64 latitude = 21.2435; //An arbitrary lat
TReal64 longitude = 89.0001; //An arbitrary long
TLocality position;
position.SetCoordinate( latitude, longitude );
lmk->SetPositionL( position );
// Set coverage radius of landmark
TReal32 radius = 250.5;
lmk->SetCoverageRadius( radius ); //Return type void
// Set description of landmark
_LIT( KLmkDesc, "A Landmark Description" );
lmk->SetLandmarkDescriptionL( KLmkDesc );
// Remove name
error = RemoveAttrName( lmk );
if ( KErrNone != error )
{
iLog->Log(_L("Error in RemoveAttributes"));
User::Leave( KErrGeneral );
}
// Remove position
error = RemoveAttrPosition( lmk );
if ( KErrNone != error)
{
iLog->Log(_L("Error in RemoveAttributes"));
User::Leave( KErrGeneral );
}
// Remove radius
error = RemoveAttrCovRadius( lmk );
if ( KErrNone != error )
{
iLog->Log(_L("Error in RemoveAttributes"));
User::Leave( KErrGeneral );
}
// Remove description
error = RemoveAttrDescription( lmk );
if ( KErrNone != error )
{
iLog->Log(_L("Error in RemoveAttributes"));
User::Leave( KErrGeneral );
}
// Test successful
iLog->Log(_L("RemoveAttributes successful"));
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::RemoveAttrName
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::RemoveAttrName( CPosLandmark* aLandmark )
{
// Get name
TPtrC getNamePtr;
TInt error = aLandmark->GetLandmarkName( getNamePtr );
if( KErrNone != error )
{
iLog->Log( _L("Error in getting name of landmark, can not test RemoveAttrName...") );
return error;
}
// Print name
iLog->Log(getNamePtr);
//Remove attributes, name
aLandmark->RemoveLandmarkAttributes( CPosLandmark::ELandmarkName );
// Check if removed
error = aLandmark->GetLandmarkName( getNamePtr );
if(KErrNotFound != error )
{
iLog->Log(_L("Error in RemoveAttributes Name"));
return KErrGeneral;
}
iLog->Log(_L("RemoveAttributes Name successful"));
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::RemoveAttrPosition
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::RemoveAttrPosition( CPosLandmark* aLandmark )
{
TInt error;
// Get position
TLocality getPosition;
error = aLandmark->GetPosition( getPosition );
if( KErrNone != error )
{
// Error
iLog->Log( _L("Error in getting position of landmark, can not test RemoveAttrPosition...") );
return error;
}
// Remove Position
aLandmark->RemoveLandmarkAttributes( CPosLandmark::EPosition );
// Check if removed successfully
error = aLandmark->GetPosition( getPosition );
if(KErrNotFound != error )
{
iLog->Log(_L("Error in RemoveAttributes Position"));
return KErrGeneral;
}
iLog->Log(_L("RemoveAttributes Position successful"));
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::RemoveAttrCovRadius
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::RemoveAttrCovRadius( CPosLandmark* aLandmark )
{
// Get cov radius
TInt error;
TReal32 getRadius;
error = aLandmark->GetCoverageRadius( getRadius );
if( KErrNone != error )
{
// Error
iLog->Log( _L("Error in getting radius of landmark, can not test RemoveAttrCovRadius...") );
return error;
}
// Remove radius
aLandmark->RemoveLandmarkAttributes( CPosLandmark::ECoverageRadius );
// Check if removed successfully
error = aLandmark->GetCoverageRadius( getRadius );
if( KErrNotFound != error )
{
iLog->Log(_L("Error in RemoveAttributes Radius"));
return KErrGeneral;
}
iLog->Log(_L("RemoveAttributes Radius successful"));
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::RemoveAttrDescription
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::RemoveAttrDescription( CPosLandmark* aLandmark )
{
TInt error;
// Get desc
TPtrC getDescPtr;
error = aLandmark->GetLandmarkDescription( getDescPtr );
if( KErrNone != error )
{
// Error
iLog->Log( _L("Error in getting description of landmark, can not test RemoveAttrDescription...") );
return error;
}
// Remove description
aLandmark->RemoveLandmarkAttributes( CPosLandmark::EDescription );
// Check if removed successfully
error = aLandmark->GetLandmarkDescription( getDescPtr );
if( KErrNotFound != error )
{
iLog->Log(_L("Error in RemoveAttributes Description"));
return KErrGeneral;
}
iLog->Log(_L("RemoveAttributes Description successful"));
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::PositionFieldIdL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::PositionFieldIdL( CStifItemParser& /*aItem*/ )
{
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Check without adding any position field
TPositionFieldId currentFieldId;
currentFieldId = lmk->FirstPositionFieldId();
if( EPositionFieldNone != currentFieldId )
{
//
iLog->Log( _L("Error in getting first position field id") );
User::Leave( KErrGeneral );
}
// Set 5 position fields for the landmark, from index 1 to 5
_LIT( KFieldName, "Position Field " );
TInt error;
for( TInt i = 1; i <= 5; i++ )
{
currentFieldId = i;
TBuf<20> currentFieldName;
currentFieldName.Copy( KFieldName );
currentFieldName.AppendNum( i );
lmk->SetPositionFieldL( currentFieldId, currentFieldName );
} // Loop
// Check
// Get First Id
currentFieldId = lmk->FirstPositionFieldId();
if( EPositionFieldNone == currentFieldId )
{
//
iLog->Log( _L("Error in getting first position field id") );
User::Leave( KErrGeneral );
}
// Get and Print first position field
TPtrC getPosField;
error = lmk->GetPositionField( currentFieldId, getPosField );
if( KErrNone != error )
{
iLog->Log( _L("Error in getting position field, first position field id is wrong...") );
User::Leave( KErrGeneral );
}
iLog->Log( getPosField );
// Get Next 4 Ids, get corresponding position field and print
TPositionFieldId previoudFieldId;
for( TInt i = 1; i <= 4; i++ )
{
// Get id
previoudFieldId = currentFieldId;
currentFieldId = lmk->NextPositionFieldId( previoudFieldId );
// Check
if( EPositionFieldNone == currentFieldId )
{
//
iLog->Log( _L("Error in getting next position field id") );
User::Leave( KErrGeneral );
}
// Get field
error = lmk->GetPositionField( currentFieldId, getPosField );
//Check
if( KErrNone != error )
{
iLog->Log( _L("Error in getting position field, next position field id is wrong...") );
User::Leave( KErrGeneral );
}
// Print
iLog->Log( getPosField );
} // Loop
// Try to retrieve one more id, should return EPositionFieldNone
previoudFieldId = currentFieldId;
currentFieldId = lmk->NextPositionFieldId( previoudFieldId );
// Check
if( EPositionFieldNone != currentFieldId )
{
//
iLog->Log( _L("Error in getting next position field id") );
User::Leave( KErrGeneral );
}
iLog->Log( _L("PositionFieldId successful") );
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::LandmarkIdL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::LandmarkIdL( CStifItemParser& /*aItem*/ )
{
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// lmk has not been added to the database yet, should return KPosLmNullItemId
TPosLmItemId lmkId;
lmkId = lmk->LandmarkId();
if( KPosLmNullItemId != lmkId )
{
iLog->Log( _L("Error in getting LandmarkId") );
User::Leave( KErrGeneral );
}
// Add lmk to database
// Open default database
CPosLandmarkDatabase* lmkDatabase = CPosLandmarkDatabase::OpenL( KDBUri );
CleanupStack::PushL( lmkDatabase );
// Initialize database
ExecuteAndDeleteLD( lmkDatabase->InitializeL() );
// Add landmark lmk to database
TPosLmItemId addId;
addId=lmkDatabase->AddLandmarkL( *lmk );
// Now lmk is added to database, should return valid id
lmkId = lmk->LandmarkId();
if( KPosLmNullItemId == lmkId )
{
iLog->Log( _L("Error in getting LandmarkId") );
User::Leave( KErrGeneral );
}
// Compare ids
if( lmkId != addId )
{
iLog->Log( _L("Error in getting LandmarkId, wrong id returned") );
User::Leave( KErrGeneral );
}
iLog->Log( _L("LandmarkId Successfulll") );
// Remove the added landmark from database
User::After(2000000);
lmkDatabase->RemoveLandmarkL( lmkId );
CleanupStack::PopAndDestroy( 2, lmk );
ReleaseLandmarkResources();
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::IsPartial
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::IsPartialL( CStifItemParser& /*aItem*/ )
{
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Check if partial, should return EFalse
TBool result;
result = lmk->IsPartial();
if( result )
{
iLog->Log( _L("Error in IsPartial") );
User::Leave( KErrGeneral );
}
// Open database, add landmark, read again as partial, check with IsPartial
// Open and initialize DB
CPosLandmarkDatabase* lmkDatabase = CPosLandmarkDatabase::OpenL( KDBUri );
CleanupStack::PushL( lmkDatabase );
// Initialize database
ExecuteAndDeleteLD( lmkDatabase->InitializeL() );
// Add landmark lmk to database
TPosLmItemId lmkId;
lmkId = lmkDatabase->AddLandmarkL( *lmk );
// Read partial landmark
CPosLandmark* partialLmk = lmkDatabase->ReadPartialLandmarkLC( lmkId );
// Check if partial, should return ETrue
result = partialLmk->IsPartial();
if( !result )
{
iLog->Log( _L("Error in IsPartial") );
User::Leave( KErrGeneral );
}
//
iLog->Log( _L("IsPartial successful") );
//Remove landmark from database
lmkDatabase->RemoveLandmarkL( lmkId );
CleanupStack::PopAndDestroy( 3, lmk );
ReleaseLandmarkResources();
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetAndGetIcon
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetAndGetIconL( CStifItemParser& aItem )
{
TInt num;
TInt err = aItem.GetNextInt( num );
TPtrC iconPathPtr;
err = aItem.GetNextString( iconPathPtr );
//
// Create a landmark
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Set Icon for landmark if num == 1
if( num == 1 )
{
lmk->SetIconL( iconPathPtr, 1, 1 );
}
// Get Icon
TPtrC fileName;
TInt index;
TInt mask;
TInt error;
error = lmk->GetIcon( fileName, index, mask);
if( KErrNone != error )
{
iLog->Log( _L("Error in Getting Icon"));
User::Leave( error );
}
iLog->Log( fileName );
iLog->Log( _L("SetAndGetIcon successful"));
CleanupStack::PopAndDestroy( lmk );
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::AddAndRemoveLmCategory
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::AddAndRemoveLmCategoryL( CStifItemParser& aItem )
{
TPtrC catNamePtr;
TInt err = aItem.GetNextString( catNamePtr );
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Open default database
CPosLandmarkDatabase* lmkDatabase = CPosLandmarkDatabase::OpenL( KDBUri );
CleanupStack::PushL( lmkDatabase );
// Initialize database
ExecuteAndDeleteLD( lmkDatabase->InitializeL() );
// Create a category manager
CPosLmCategoryManager* categoryMgr = CPosLmCategoryManager::NewL( *lmkDatabase );
CleanupStack::PushL( categoryMgr );
// Add a category to database, get category id
// Create category
CPosLandmarkCategory* category = CPosLandmarkCategory::NewL();
CleanupStack::PushL( category );
category->SetCategoryNameL( catNamePtr );
// Add to database
TPosLmItemId categoryId;
categoryId = categoryMgr->AddCategoryL( *category );
// Add category to landmark
lmk->AddCategoryL( categoryId );
// Get and check
RArray<TPosLmItemId> idArray;
lmk->GetCategoriesL( idArray );
if( idArray.Count() != 1 )
{
iLog->Log( _L("AddCateGory fails, category not added to landmark ") );
//Remove category from database
ExecuteAndDeleteLD( categoryMgr->RemoveCategoryL( categoryId ) );
User::Leave( KErrGeneral );
}
// Remove category from landmark
lmk->RemoveCategory( categoryId );
// Get and check
lmk->GetCategoriesL( idArray );
if( idArray.Count() != 0 )
{
iLog->Log( _L("RemoveCategory fails, category not removed from landmark ") );
//Remove category from database
ExecuteAndDeleteLD( categoryMgr->RemoveCategoryL( categoryId ) );
//Cleanup
User::Leave(KErrGeneral);
}
iLog->Log( _L("AddAndRemoveCategory successful") );
//Remove category from database
ExecuteAndDeleteLD( categoryMgr->RemoveCategoryL( categoryId ) );
//Cleanup
CleanupStack::PopAndDestroy( 4, lmk );
ReleaseLandmarkResources();
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::GetCategories
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::GetCategoriesL( CStifItemParser& /*aItem*/ )
{
// Create a new landmark object using NewL()
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
// Get Categories
RArray<TPosLmItemId> idArray;
lmk->GetCategoriesL( idArray );
// Check, no category exists in landmark, should be 0
if( idArray.Count() != 0 )
{
iLog->Log(_L("GetCategories fails"));
User::Leave( KErrGeneral );
}
// Add a category to landmark and test again
// Open default database
CPosLandmarkDatabase* lmkDatabase = CPosLandmarkDatabase::OpenL( KDBUri );
CleanupStack::PushL( lmkDatabase );
// Initialize database
ExecuteAndDeleteLD( lmkDatabase->InitializeL() );
// New Category
CPosLandmarkCategory* category = CPosLandmarkCategory::NewL();
CleanupStack::PushL( category );
_LIT( KCategoryName, "A category Name" );
TBufC<20> categoryBuf( KCategoryName );
category->SetCategoryNameL( categoryBuf );
// New Category manager
CPosLmCategoryManager* categoryMgr = CPosLmCategoryManager::NewL( *lmkDatabase );
CleanupStack::PushL( categoryMgr );
// Add Category to database
TPosLmItemId categoryId;
categoryId = categoryMgr->AddCategoryL( *category );
// Add Category to landmark
lmk->AddCategoryL( categoryId );
// Get Categories
lmk->GetCategoriesL( idArray );
// Check, 1 category exists in landmark, count of array items should be 1
if( idArray.Count() != 1 )
{
iLog->Log(_L("GetCategories fails"));
//Remove category from database
ExecuteAndDeleteLD( categoryMgr->RemoveCategoryL( categoryId ) );
User::Leave( KErrGeneral );
}
iLog->Log( _L("GetCategories successful") );
//Remove category from database
ExecuteAndDeleteLD( categoryMgr->RemoveCategoryL( categoryId ) );
//Cleanup
CleanupStack::PopAndDestroy( 4, lmk );
ReleaseLandmarkResources();
return KErrNone;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetAndGetPositionFieldL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetAndGetPlaceId( CStifItemParser& aItem )
{
TInt returnCode = KErrGeneral;
_LIT(KPID, "1234");
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
TPtrC retPID;
lmk->SetPlaceIdL(KPID);
returnCode = lmk->GetPlaceId(retPID);
if(KErrNone != returnCode || (retPID != KPID))
{
returnCode = KErrGeneral;
}
else
{
returnCode = KErrNone;
}
CleanupStack::PopAndDestroy(lmk);
return returnCode;
}
// -----------------------------------------------------------------------------
// CTestPosLandmark::SetAndGetPositionFieldL
//
//
// -----------------------------------------------------------------------------
//
TInt CTestPosLandmark::SetAndGetTimeStamp( CStifItemParser& aItem )
{
TInt returnCode = KErrGeneral;
CPosLandmark* lmk = CPosLandmark::NewL();
CleanupStack::PushL( lmk );
TTime setTime;
setTime.Set(_L("20091006:000000.000000"));
TTime retTime;
lmk->SetTimeStampL(setTime);
returnCode = lmk->GetTimeStamp(retTime);
if(setTime!=retTime || returnCode!= KErrNone)
{
returnCode = KErrGeneral;
}
else
returnCode = KErrNone;
CleanupStack::PopAndDestroy(lmk);
return returnCode;
}
| [
"none@none"
] | [
[
[
1,
1129
]
]
] |
4d7bad7fa25a49f3bfeff8e44dc937616adfaaa2 | a29ec259efa2c2f13e24be86a4c6ba174780857d | /projects/tpfinal/Personajes/Roxy/Character_Roxy.h | 3fd5123808c310513e04003f0bd011d724e6318d | [] | no_license | nlelouche/programacion2 | 639ffb55d06af4f696031ec777bec898b6224774 | 5ec9b29014c13786230e834deb44679b110351b4 | refs/heads/master | 2016-09-06T15:40:38.888016 | 2007-11-09T01:03:51 | 2007-11-09T01:03:51 | 32,653,635 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 756 | h | #ifndef _CHARACTER_ROXY_H_
#define _CHARACTER_ROXY_H_
#include "../../RPGCharacter.h"
class Character_Roxy : public RPGCharacter
{
protected:
// propiedades de la IA
float m_fCurrentIATime; // tiempo actual para controlar la IA
bool m_bMoveUp; // dice si el personaje se tiene q mover hacia arriba o hacia abajo
public:
Character_Roxy();
~Character_Roxy();
// sobrecargas de los metodos de RPGCharacter
virtual void OnActionFinished(char *pszName);
virtual void Draw();
virtual void Update(float fTimeBetweenFrames);
virtual void UpdateIA(float fTimeBetweenFrames);
// llamado a las acciones
virtual void Idle();
virtual void Hit();
virtual void Move(float fDirection);
};
#endif //_CHARACTER_ROXY_H_ | [
"yoviacthulhu@70076bbf-733e-0410-a12a-85c366f55b74"
] | [
[
[
1,
32
]
]
] |
501c49095c0c426534b67e1418fe4067ae381b97 | 789bfae90cbb728db537b24eb9ab21c88bda2786 | /source/LegendDisappearStateClass.h | 60205045c28c8a0124fc099f45acd63275f5d7d8 | [
"MIT"
] | permissive | Izhido/bitsweeper | b89db2c2050cbc82ea60d31d2f31b041a1e913a3 | a37902c5b9ae9c25ee30694c2ba0974fd235090e | refs/heads/master | 2021-01-23T11:49:21.723909 | 2011-12-24T22:43:30 | 2011-12-24T22:43:30 | 34,614,275 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 422 | h | #ifndef LEGENDDISAPPEARSTATECLASS_H
#define LEGENDDISAPPEARSTATECLASS_H
#include "StateClass.h"
#define LEGEND_DISAPPEAR_STATE 9
class LegendDisappearStateClass
: public StateClass
{
public:
LegendDisappearStateClass();
void Start(class CommonDataClass* CommonData);
void Run(class CommonDataClass* CommonData);
void Draw(CommonDataClass* CommonData);
private:
int Count;
};
#endif
| [
"[email protected]@66f87ebb-1a6f-337b-3a26-6cadc16acdcf"
] | [
[
[
1,
25
]
]
] |
a3b206581097a3ae88ceb123856c6811bfc2db59 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/boost/date_time/microsec_time_clock.hpp | 4021af382aa675bc9c082beaea6fe4dbaae786ee | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | willrebuild/flyffsf | e5911fb412221e00a20a6867fd00c55afca593c7 | d38cc11790480d617b38bb5fc50729d676aef80d | refs/heads/master | 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,933 | hpp | #ifndef DATE_TIME_HIGHRES_TIME_CLOCK_HPP___
#define DATE_TIME_HIGHRES_TIME_CLOCK_HPP___
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0)
* Author: Jeff Garland, Bart Garst
* $Date: 2006/03/18 16:47:55 $
*/
/*! @file microsec_time_clock.hpp
This file contains a high resolution time clock implementation.
*/
#include <boost/detail/workaround.hpp>
#include "boost/date_time/c_time.hpp"
#include "boost/cstdint.hpp"
#include "boost/shared_ptr.hpp"
#ifdef BOOST_HAS_FTIME
#include <windows.h>
#endif
#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
namespace boost {
namespace date_time {
//! A clock providing microsecond level resolution
/*! A high precision clock that measures the local time
* at a resolution up to microseconds and adjusts to the
* resolution of the time system. For example, for the
* a library configuration with nano second resolution,
* the last 3 places of the fractional seconds will always
* be 000 since there are 1000 nano-seconds in a micro second.
*/
template<class time_type>
class microsec_clock
{
public:
typedef typename time_type::date_type date_type;
typedef typename time_type::time_duration_type time_duration_type;
typedef typename time_duration_type::rep_type resolution_traits_type;
//! return a local time object for the given zone, based on computer clock
//JKG -- looks like we could rewrite this against universal_time
template<class time_zone_type>
static time_type local_time(shared_ptr<time_zone_type> tz_ptr) {
typedef typename time_type::utc_time_type utc_time_type;
typedef second_clock<utc_time_type> second_clock;
// we'll need to know the utc_offset this machine has
// in order to get a utc_time_type set to utc
utc_time_type utc_time = second_clock::universal_time();
time_duration_type utc_offset = second_clock::local_time() - utc_time;
// use micro clock to get a local time with sub seconds
// and adjust it to get a true utc time reading with sub seconds
utc_time = microsec_clock<utc_time_type>::local_time() - utc_offset;
return time_type(utc_time, tz_ptr);
}
private:
// we want this enum available for both platforms yet still private
enum TZ_FOR_CREATE { LOCAL, GMT };
public:
#ifdef BOOST_HAS_GETTIMEOFDAY
//! Return the local time based on computer clock settings
static time_type local_time() {
return create_time(LOCAL);
}
//! Get the current day in universal date as a ymd_type
static time_type universal_time()
{
return create_time(GMT);
}
private:
static time_type create_time(TZ_FOR_CREATE tz) {
timeval tv;
gettimeofday(&tv, 0); //gettimeofday does not support TZ adjust on Linux.
std::time_t t = tv.tv_sec;
boost::uint32_t fs = tv.tv_usec;
std::tm curr, *curr_ptr = 0;
if (tz == LOCAL) {
curr_ptr = c_time::localtime(&t, &curr);
} else {
curr_ptr = c_time::gmtime(&t, &curr);
}
date_type d(curr_ptr->tm_year + 1900,
curr_ptr->tm_mon + 1,
curr_ptr->tm_mday);
//The following line will adjusts the fractional second tick in terms
//of the current time system. For example, if the time system
//doesn't support fractional seconds then res_adjust returns 0
//and all the fractional seconds return 0.
int adjust = resolution_traits_type::res_adjust()/1000000;
time_duration_type td(curr_ptr->tm_hour,
curr_ptr->tm_min,
curr_ptr->tm_sec,
fs*adjust);
return time_type(d,td);
}
#endif // BOOST_HAS_GETTIMEOFDAY
#ifdef BOOST_HAS_FTIME
//! Return the local time based on computer clock settings
static time_type local_time() {
FILETIME ft;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
// Some runtime library implementations expect local times as the norm for ctime.
FILETIME ft_utc;
GetSystemTimeAsFileTime(&ft_utc);
FileTimeToLocalFileTime(&ft_utc,&ft);
#else
GetSystemTimeAsFileTime(&ft);
#endif
return create_time(ft, LOCAL);
}
//! Return the UTC time based on computer settings
static time_type universal_time() {
FILETIME ft;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
// Some runtime library implementations expect local times as the norm for ctime.
FILETIME ft_utc;
GetSystemTimeAsFileTime(&ft_utc);
FileTimeToLocalFileTime(&ft_utc,&ft);
#else
GetSystemTimeAsFileTime(&ft);
#endif
return create_time(ft, GMT);
}
private:
static time_type create_time(FILETIME& ft, TZ_FOR_CREATE tz) {
// offset is difference (in 100-nanoseconds) from
// 1970-Jan-01 to 1601-Jan-01
boost::uint64_t c1 = 27111902;
boost::uint64_t c2 = 3577643008UL; // 'UL' removes compiler warnings
const boost::uint64_t OFFSET = (c1 << 32) + c2;
boost::uint64_t filetime = ft.dwHighDateTime;
filetime = filetime << 32;
filetime += ft.dwLowDateTime;
filetime -= OFFSET;
// filetime now holds 100-nanoseconds since 1970-Jan-01
// microseconds -- static casts supress warnings
boost::uint32_t sub_sec = static_cast<boost::uint32_t>((filetime % 10000000) / 10);
std::time_t t = static_cast<time_t>(filetime / 10000000); // seconds since epoch
std::tm curr, *curr_ptr = 0;
if (tz == LOCAL) {
curr_ptr = c_time::localtime(&t, &curr);
}
else {
curr_ptr = c_time::gmtime(&t, &curr);
}
date_type d(curr_ptr->tm_year + 1900,
curr_ptr->tm_mon + 1,
curr_ptr->tm_mday);
//The following line will adjusts the fractional second tick in terms
//of the current time system. For example, if the time system
//doesn't support fractional seconds then res_adjust returns 0
//and all the fractional seconds return 0.
int adjust = static_cast<int>(resolution_traits_type::res_adjust()/1000000);
time_duration_type td(curr_ptr->tm_hour,
curr_ptr->tm_min,
curr_ptr->tm_sec,
sub_sec * adjust);
//st.wMilliseconds * adjust);
return time_type(d,td);
}
#endif // BOOST_HAS_FTIME
};
} } //namespace date_time
#endif //BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
#endif
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] | [
[
[
1,
196
]
]
] |
8b482a4a4ea42912bce24f01a8a985f1348ec028 | f6529b63d418f7d0563d33e817c4c3f6ec6c618d | /source/cheats/cheat.cpp | 805eef1115e2e15a7ed1366c5bf0296cce474ec0 | [] | no_license | Captnoord/Wodeflow | b087659303bc4e6d7360714357167701a2f1e8da | 5c8d6cf837aee74dc4265e3ea971a335ba41a47c | refs/heads/master | 2020-12-24T14:45:43.854896 | 2011-07-25T14:15:53 | 2011-07-25T14:15:53 | 2,096,630 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 11,209 | cpp | #include <string.h>
#include <gccore.h>
#include "cheat.hpp"
#include "text.hpp"
#include "menu.hpp"
#include "http.h"
#define GECKOURL "http://www.geckocodes.org/codes/R/%s.txt"
#define CHEATSPERPAGE 4
void loadCheatFile(SmartBuf &buffer, u32 &size, const char *cheatPath, const char *gameId)
{
FILE *fp = 0;
u32 fileSize;
SmartBuf fileBuf;
buffer.release();
size = 0;
fp = fopen(fmt("%s/%s.gct", cheatPath, gameId), "rb");
if (fp == 0)
return;
fseek(fp, 0, SEEK_END);
fileSize = ftell(fp);
fseek(fp, 0, SEEK_SET);
fileBuf = smartCoverAlloc(fileSize);
if (!fileBuf)
{
fclose(fp);
return;
}
if (fread(fileBuf.get(), 1, fileSize, fp) != fileSize)
{
fclose(fp);
return;
}
fclose(fp);
buffer = fileBuf;
size = fileSize;
}
void CMenu::_CheatSettings() {
s32 padsState;
WPADData *wd;
u32 btn;
WPAD_Rumble(WPAD_CHAN_0, 0);
// try to load cheat file
int txtavailable=0;
m_cheatSettingsPage = 1; // init page
txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str()));
_showCheatSettings();
_textCheatSettings();
if (txtavailable)
m_btnMgr.setText(m_cheatLblTitle,wfmt(L"%s",m_cheatfile.getGameName().c_str()));
else
m_btnMgr.setText(m_cheatLblTitle,L"");
while (true)
{
WPAD_ScanPads();
padsState = WPAD_ButtonsDown(0);
wd = WPAD_Data(0);
btn = _btnRepeat(wd->btns_h);
if ((padsState & (WPAD_BUTTON_HOME | WPAD_BUTTON_B)) != 0)
break;
if (wd->ir.valid)
m_btnMgr.mouse(wd->ir.x - m_cur.width() / 2, wd->ir.y - m_cur.height() / 2);
else if ((padsState & WPAD_BUTTON_UP) != 0)
m_btnMgr.up();
else if ((padsState & WPAD_BUTTON_DOWN) != 0)
m_btnMgr.down();
if ((padsState & WPAD_BUTTON_MINUS) != 0)
{
if (m_cheatSettingsPage > 1)
--m_cheatSettingsPage;
_hideCheatSettings();
_showCheatSettings();
m_btnMgr.click(m_cheatBtnPageM);
}
else if ((padsState & WPAD_BUTTON_PLUS) != 0)
{
_hideCheatSettings();
if (m_cheatSettingsPage < (m_cheatfile.getCnt()+CHEATSPERPAGE-1)/CHEATSPERPAGE)
++m_cheatSettingsPage;
_showCheatSettings();
m_btnMgr.click(m_cheatBtnPageP);
}
if ((padsState & WPAD_BUTTON_A) != 0)
{
m_btnMgr.click();
if (m_btnMgr.selected() == m_cheatBtnBack)
break;
else if (m_btnMgr.selected() == m_cheatBtnPageM)
{
_hideCheatSettings();
if (m_cheatSettingsPage > 1)
--m_cheatSettingsPage;
_showCheatSettings();
}
else if (m_btnMgr.selected() == m_cheatBtnPageP)
{
_hideCheatSettings();
if (m_cheatSettingsPage < (m_cheatfile.getCnt()+CHEATSPERPAGE-1)/CHEATSPERPAGE)
++m_cheatSettingsPage;
_showCheatSettings();
}
for (int i = 0; i < CHEATSPERPAGE; ++i)
if (m_btnMgr.selected() == m_cheatBtnItem[i]) {
// handling code for clicked cheat
m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i] = !m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i];
_showCheatSettings();
}
if (m_btnMgr.selected() == m_cheatBtnApply)
{
int operation_ok,check = 0;
//checks if at least one cheat is selected
for (unsigned int i=0; i < m_cheatfile.getCnt(); ++i) {
if (m_cheatfile.sCheatSelected[i] == true)
{
check = 1;
break;
}
}
if (check)
{
operation_ok = m_cheatfile.createGCT(fmt("%s/%s.gct", m_cheatDir.c_str(), m_cf.getId().c_str()));
operation_ok = m_cheatfile.createTXT(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str()));
}
m_cfg.setOptBool(m_cf.getId(), "cheat",1);
if (operation_ok)
break;
}
if (m_btnMgr.selected() == m_cheatBtnDownload)
{
// Download cheat code
m_btnMgr.hide(m_cheatLblTitle);
u32 bufferSize = 0x100000; // Maximum download size 1 MB
SmartBuf buffer;
block cheatfile;
FILE *file;
char ip[16];
if (!m_networkInit && _initNetwork(ip) < 0) {
m_btnMgr.hide(m_cheatLblTitle);
break;
}
m_networkInit = true;
buffer = smartCoverAlloc(bufferSize);
cheatfile = downloadfile(buffer.get(), bufferSize, sfmt(GECKOURL, m_cf.getId().c_str()).c_str(),CMenu::_downloadProgress, this);
if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<') {
// cheat file was downloaded and presumably no 404
file = fopen(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str()), "wb");
if (file != NULL)
{
fwrite(cheatfile.data, 1, cheatfile.size, file);
fclose(file);
break;
}
}
else
{
// cheat code not found, show result
m_btnMgr.setText(m_cheatLblItem[0], _t("cheat4", L"Download not found."));
m_btnMgr.setText(m_cheatLblItem[1], wfmt(L"http://www.geckocodes.org/codes/R/%s.txt",m_cf.getId().c_str()));
m_btnMgr.show(m_cheatLblItem[1]);
}
}
}
_mainLoopCommon(wd);
}
_hideCheatSettings();
}
void CMenu::_hideCheatSettings(bool instant)
{
m_btnMgr.hide(m_cheatBtnBack, instant);
m_btnMgr.hide(m_cheatBtnApply, instant);
m_btnMgr.hide(m_cheatBtnDownload, instant);
m_btnMgr.hide(m_cheatLblTitle, instant);
m_btnMgr.hide(m_cheatLblPage, instant);
m_btnMgr.hide(m_cheatBtnPageM, instant);
m_btnMgr.hide(m_cheatBtnPageP, instant);
for (int i=0;i<CHEATSPERPAGE;++i) {
m_btnMgr.hide(m_cheatBtnItem[i], instant);
m_btnMgr.hide(m_cheatLblItem[i], instant);
}
for (u32 i = 0; i < ARRAY_SIZE(m_cheatLblUser); ++i)
if (m_cheatLblUser[i] != -1u)
m_btnMgr.hide(m_cheatLblUser[i]);
}
// CheatMenu
// check for cheat txt file
// if it exists, load it and show cheat texts on screen
// if it does not exist, show download button
void CMenu::_showCheatSettings(void)
{
_setBg(m_cheatBg, m_cheatBg);
m_btnMgr.show(m_cheatBtnBack);
m_btnMgr.show(m_cheatLblTitle);
for (u32 i = 0; i < ARRAY_SIZE(m_cheatLblUser); ++i)
if (m_cheatLblUser[i] != -1u)
m_btnMgr.show(m_cheatLblUser[i]);
if (m_cheatfile.getCnt() > 0) {
// cheat found, show apply
m_btnMgr.show(m_cheatBtnApply);
m_btnMgr.show(m_cheatLblPage);
m_btnMgr.show(m_cheatBtnPageM);
m_btnMgr.show(m_cheatBtnPageP);
m_btnMgr.setText(m_cheatLblPage, wfmt(L"%i / %i", m_cheatSettingsPage, (m_cheatfile.getCnt()+CHEATSPERPAGE-1)/CHEATSPERPAGE));
// Show cheats if available, else hide
for (u32 i=0; i < CHEATSPERPAGE; ++i) {
// cheat in range?
if (((m_cheatSettingsPage-1)*CHEATSPERPAGE + i + 1) <= m_cheatfile.getCnt())
{
//Limit to 70 characters otherwise the Cheatnames overlap
char tempcheatname[71];
strncpy(tempcheatname, m_cheatfile.getCheatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i).c_str(),70);
tempcheatname[70] = '\0';
// cheat avaiable, show elements and text
m_btnMgr.setText(m_cheatLblItem[i], wstringEx(tempcheatname));
//m_btnMgr.setText(m_cheatLblItem[i], m_cheatfile.getCheseleatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i));
m_btnMgr.setText(m_cheatBtnItem[i], _optBoolToString(m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i]));
m_btnMgr.show(m_cheatLblItem[i]);
m_btnMgr.show(m_cheatBtnItem[i]);
}
else
{
// cheat out of range, hide elements
m_btnMgr.hide(m_cheatLblItem[i]);
m_btnMgr.hide(m_cheatBtnItem[i]);
}
}
}
else
{
// no cheat found, allow downloading
m_btnMgr.show(m_cheatBtnDownload);
m_btnMgr.setText(m_cheatLblItem[0], _t("cheat3", L"Cheat file for game not found."));
m_btnMgr.show(m_cheatLblItem[0]);
}
}
void CMenu::_initCheatSettingsMenu(CMenu::SThemeData &theme)
{
_addUserLabels(theme, m_cheatLblUser, ARRAY_SIZE(m_cheatLblUser), "CHEAT");
m_cheatBg = _texture(theme.texSet, "CHEAT/BG", "texture", theme.bg);
m_cheatLblTitle = _addLabel(theme, "CHEAT/TITLE", theme.lblFont, L"Cheats", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_cheatBtnBack = _addButton(theme, "CHEAT/BACK_BTN", theme.btnFont, L"", 460, 410, 150, 56, theme.btnFontColor);
m_cheatBtnApply = _addButton(theme, "CHEAT/APPLY_BTN", theme.btnFont, L"", 240, 410, 150, 56, theme.btnFontColor);
m_cheatBtnDownload = _addButton(theme, "CHEAT/DOWNLOAD_BTN", theme.btnFont, L"", 240, 410, 200, 56, theme.btnFontColor);
m_cheatLblPage = _addLabel(theme, "CHEAT/PAGE_BTN", theme.btnFont, L"", 76, 410, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cheatBtnPageM = _addPicButton(theme, "CHEAT/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 410, 56, 56);
m_cheatBtnPageP = _addPicButton(theme, "CHEAT/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 410, 56, 56);
m_cheatLblItem[0] = _addLabel(theme, "CHEAT/ITEM_0", theme.lblFont, L"", 40, 100, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[0] = _addButton(theme, "CHEAT/ITEM_0_BTN", theme.btnFont, L"", 500, 100, 120, 56, theme.btnFontColor);
m_cheatLblItem[1] = _addLabel(theme, "CHEAT/ITEM_1", theme.lblFont, L"", 40, 160, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[1] = _addButton(theme, "CHEAT/ITEM_1_BTN", theme.btnFont, L"", 500, 160, 120, 56, theme.btnFontColor);
m_cheatLblItem[2] = _addLabel(theme, "CHEAT/ITEM_2", theme.lblFont, L"", 40, 220, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[2] = _addButton(theme, "CHEAT/ITEM_2_BTN", theme.btnFont, L"", 500, 220, 120, 56, theme.btnFontColor);
m_cheatLblItem[3] = _addLabel(theme, "CHEAT/ITEM_3", theme.lblFont, L"", 40, 280, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[3] = _addButton(theme, "CHEAT/ITEM_3_BTN", theme.btnFont, L"", 500, 280, 120, 56, theme.btnFontColor);
m_cheatLblItem[4] = _addLabel(theme, "CHEAT/ITEM_4", theme.lblFont, L"", 40, 340, 460, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cheatBtnItem[4] = _addButton(theme, "CHEAT/ITEM_4_BTN", theme.btnFont, L"", 500, 340, 120, 56, theme.btnFontColor);
_setHideAnim(m_cheatBtnApply, "CHEAT/APPLY_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_cheatBtnBack, "CHEAT/BACK_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_cheatBtnDownload, "CHEAT/DOWNLOAD_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_cheatLblPage, "CHEAT/PAGE_BTN", 0, 200, 1.f, 0.f);
_setHideAnim(m_cheatBtnPageM, "CHEAT/PAGE_MINUS", 0, 200, 1.f, 0.f);
_setHideAnim(m_cheatBtnPageP, "CHEAT/PAGE_PLUS", 0, 200, 1.f, 0.f);
for (int i=0;i<CHEATSPERPAGE;++i) {
_setHideAnim(m_cheatBtnItem[i], sfmt("CHEAT/ITEM_%i_BTN", i).c_str(), 200, 0, 1.f, 0.f);
_setHideAnim(m_cheatLblItem[i], sfmt("CHEAT/ITEM_%i_BTN", i).c_str(), -200, 0, 1.f, 0.f);
}
_hideCheatSettings(true);
_textCheatSettings();
}
void CMenu::_textCheatSettings(void)
{
m_btnMgr.setText(m_cheatBtnBack, _t("cheat1", L"Back"));
m_btnMgr.setText(m_cheatBtnApply, _t("cheat2", L"Apply"));
m_btnMgr.setText(m_cheatBtnDownload, _t("cfg4", L"Download"));
}
| [
"[email protected]@a6d911d2-2a6f-2b2f-592f-0469abc2858f"
] | [
[
[
1,
321
]
]
] |
53952b38f873b068635f87cbc05cd55a124a40a6 | fd3f2268460656e395652b11ae1a5b358bfe0a59 | /srchybrid/ToolTipCtrlX.cpp | 1ab9e427191291b8bfcbecb6bdbbd50aa91d944e | [] | no_license | mikezhoubill/emule-gifc | e1cc6ff8b1bb63197bcfc7e67c57cfce0538ff60 | 46979cf32a313ad6d58603b275ec0b2150562166 | refs/heads/master | 2021-01-10T20:37:07.581465 | 2011-08-13T13:58:37 | 2011-08-13T13:58:37 | 32,465,033 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 26,648 | cpp | //this file is part of eMule
//Copyright (C)2002-2008 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net )
//
//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., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "stdafx.h"
#include "ToolTipCtrlX.h"
#include "OtherFunctions.h"
#include "emule.h"
#include "log.h"
#include "VisualStylesXP.h"
#include "NTService.h" // Run eMule as NT Service [leuk_he/Stulle] - Stulle
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define DFLT_DRAWTEXT_FLAGS (DT_NOPREFIX | DT_EXTERNALLEADING | DT_END_ELLIPSIS)
IMPLEMENT_DYNAMIC(CToolTipCtrlX, CToolTipCtrl)
BEGIN_MESSAGE_MAP(CToolTipCtrlX, CToolTipCtrl)
ON_WM_SYSCOLORCHANGE()
ON_WM_SETTINGCHANGE()
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnNmCustomDraw)
ON_NOTIFY_REFLECT(NM_THEMECHANGED, OnNmThemeChanged)
ON_NOTIFY_REFLECT_EX(TTN_SHOW, OnTTShow)
END_MESSAGE_MAP()
CToolTipCtrlX::CToolTipCtrlX()
{
memset(&m_lfNormal, 0, sizeof(m_lfNormal));
m_bCol1Bold = true;
m_bShowFileIcon = false;
ResetSystemMetrics();
m_dwCol1DrawTextFlags = DT_LEFT | DFLT_DRAWTEXT_FLAGS;
m_dwCol2DrawTextFlags = DT_LEFT | DFLT_DRAWTEXT_FLAGS;
}
CToolTipCtrlX::~CToolTipCtrlX()
{
}
void CToolTipCtrlX::SetCol1DrawTextFlags(DWORD dwFlags)
{
m_dwCol1DrawTextFlags = DFLT_DRAWTEXT_FLAGS | dwFlags;
}
void CToolTipCtrlX::SetCol2DrawTextFlags(DWORD dwFlags)
{
m_dwCol2DrawTextFlags = DFLT_DRAWTEXT_FLAGS | dwFlags;
}
BOOL CToolTipCtrlX::SubclassWindow(HWND hWnd)
{
BOOL bResult = __super::SubclassWindow(hWnd);
// Win98/Win2000: Preventive, turning off tooltip animations should help in getting around
// some glitches when using customized tooltip drawing. Though, doesn't seem to help a lot.
if (theApp.m_ullComCtrlVer <= MAKEDLLVERULL(5,81,0,0))
ModifyStyle(0, TTS_NOANIMATE | TTS_NOFADE);
return bResult;
}
void CToolTipCtrlX::ResetSystemMetrics()
{
m_fontBold.DeleteObject();
m_fontNormal.DeleteObject();
memset(&m_lfNormal, 0, sizeof(m_lfNormal));
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))
memcpy(&m_lfNormal, &ncm.lfStatusFont, sizeof(m_lfNormal));
m_crTooltipBkColor = GetSysColor(COLOR_INFOBK);
m_crTooltipTextColor = GetSysColor(COLOR_INFOTEXT);
m_rcScreen.left = 0;
m_rcScreen.top = 0;
m_rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
m_rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
m_iScreenWidth4 = m_rcScreen.Width() / 4;
// ==> Run eMule as NT Service [leuk_he/Stulle] - Stulle
if (RunningAsService()) {
DWORD dwProcessId;
DWORD dwThreadId= GetWindowThreadProcessId(m_hWnd,&dwProcessId);
EnumThreadWindows(dwThreadId, EnumProc,(LPARAM) dwThreadId);
}
// <== Run eMule as NT Service [leuk_he/Stulle] - Stulle
}
void CToolTipCtrlX::OnNmThemeChanged(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
ResetSystemMetrics();
*pResult = 0;
}
void CToolTipCtrlX::OnSysColorChange()
{
ResetSystemMetrics();
CToolTipCtrl::OnSysColorChange();
}
void CToolTipCtrlX::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
ResetSystemMetrics();
CToolTipCtrl::OnSettingChange(uFlags, lpszSection);
}
void CToolTipCtrlX::CustomPaint(LPNMTTCUSTOMDRAW pNMCD)
{
CWnd* pwnd = CWnd::FromHandle(pNMCD->nmcd.hdr.hwndFrom);
CDC* pdc = CDC::FromHandle(pNMCD->nmcd.hdc);
// Windows Vista (General)
// -----------------------
// *Need* to use (some aspects) of the 'TOOLTIP' theme to get typical Vista tooltips.
//
// Windows Vista *without* SP1
// ---------------------------
// The Vista 'TOOLTIP' theme offers a bold version of the standard tooltip font via
// the TTP_STANDARDTITLE part id. Furthermore TTP_STANDARDTITLE is the same font as
// the standard tooltip font (TTP_STANDARD). So, the 'TOOLTIP' theme can get used
// thoroughly.
//
// Windows Vista *with* SP1
// ------------------------
// The Vista SP1(!) 'TOOLTIP' theme does though *not* offer a bold font. Keep
// in mind that TTP_STANDARDTITLE does not return a bold font. Keep also in mind
// that TTP_STANDARDTITLE is even a *different* font than TTP_STANDARD!
// Which means, that TTP_STANDARDTITLE should *not* be used within the same line
// as TTP_STANDARD. It just looks weird. TTP_STANDARDTITLE could be used for a
// single line (the title line), but it would though not give us a bold font.
// So, actually we can use the Vista 'TOOLTIP' theme only for getting the proper
// tooltip background.
//
// Windows XP
// ----------
// Can *not* use the 'TOOLTIP' theme at all because it would give us only a (non-bold)
// black font on a white tooltip window background. Seems that the 'TOOLTIP' theme under
// WinXP is just using the default Window values (black+white) and does not
// use any of the tooltip specific Window metrics...
//
bool bUseEmbeddedThemeFonts = false;
HTHEME hTheme = NULL;
if (theApp.IsVistaThemeActive()) {
hTheme = g_xpStyle.OpenThemeData(*pwnd, L"TOOLTIP");
// Using the theme's fonts works only under Vista without SP1. When SP1
// is installed the fonts which are used for TTP_STANDARDTITLE and TTP_STANDARD
// do no longer match (should not get displayed within the same text line).
if (hTheme) bUseEmbeddedThemeFonts = true;
}
CString strText;
pwnd->GetWindowText(strText);
CRect rcWnd;
pwnd->GetWindowRect(&rcWnd);
CFont* pOldDCFont = NULL;
if (hTheme == NULL || !bUseEmbeddedThemeFonts)
{
// If we have a theme, we try to query the correct fonts from it
if (m_fontNormal.m_hObject == NULL && hTheme) {
// Windows Vista Ultimate, 6.0.6001 SP1 Build 6001, English with German Language Pack
// ----------------------------------------------------------------------------------
// TTP_STANDARD, TTSS_NORMAL
// Height -12
// Weight 400
// CharSet 1
// Quality 5
// FaceName "Segoe UI"
//
// TTP_STANDARDTITLE, TTSS_NORMAL
// Height -12
// Weight 400
// CharSet 1
// Quality 5
// FaceName "Segoe UI Fett" (!!!) Note: "Fett" (that is German !?)
//
// That font name ("Segoe UI *Fett*") looks quite suspicious. I would not be surprised
// if that eventually leads to a problem within the font mapper which may not be capable
// of finding the (english) version of that font and thus falls back to the standard
// system font. At least this would explain why the TTP_STANDARD and TTP_STANDARDTITLE
// fonts are *different* on that particular Windows Vista system.
LOGFONT lf = {0};
if (g_xpStyle.GetThemeFont(hTheme, pdc->m_hDC, TTP_STANDARD, TTSS_NORMAL, TMT_FONT, &lf) == S_OK) {
VERIFY( m_fontNormal.CreateFontIndirect(&lf) );
if (m_bCol1Bold && m_fontBold.m_hObject == NULL) {
memset(&lf, 0, sizeof(lf));
if (g_xpStyle.GetThemeFont(hTheme, pdc->m_hDC, TTP_STANDARDTITLE, TTSS_NORMAL, TMT_FONT, &lf) == S_OK)
VERIFY( m_fontBold.CreateFontIndirect(&lf) );
}
// Get the tooltip font color
COLORREF crText;
if (g_xpStyle.GetThemeColor(hTheme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &crText) == S_OK)
m_crTooltipTextColor = crText;
}
}
// If needed, create the standard tooltip font which was queried from the system metrics
if (m_fontNormal.m_hObject == NULL && m_lfNormal.lfHeight != 0)
VERIFY( m_fontNormal.CreateFontIndirect(&m_lfNormal) );
// Select the tooltip font
if (m_fontNormal.m_hObject != NULL) {
pOldDCFont = pdc->SelectObject(&m_fontNormal);
// If needed, create the bold version of the tooltip font by deriving it from the standard font
if (m_bCol1Bold && m_fontBold.m_hObject == NULL) {
LOGFONT lf;
m_fontNormal.GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
VERIFY( m_fontBold.CreateFontIndirect(&lf) );
}
}
// Set the font color (queried from system metrics or queried from theme)
pdc->SetTextColor(m_crTooltipTextColor);
}
// Auto-format the text only if explicitly requested. Otherwise we would also format
// single line tooltips for regular list items, and if those list items contain ':'
// characters they would be shown partially in bold. For performance reasons, the
// auto-format is to be requested by appending the TOOLTIP_AUTOFORMAT_SUFFIX_CH
// character. Appending, because we can remove that character efficiently without
// re-allocating the entire string.
bool bAutoFormatText = strText.GetLength() > 0 && strText[strText.GetLength() - 1] == TOOLTIP_AUTOFORMAT_SUFFIX_CH;
if (bAutoFormatText)
strText.Truncate(strText.GetLength() - 1); // truncate the TOOLTIP_AUTOFORMAT_SUFFIX_CH char by setting it to NUL
bool bShowFileIcon = m_bShowFileIcon && bAutoFormatText;
if (bShowFileIcon) {
int iPosNL = strText.Find(_T('\n'));
if (iPosNL > 0) {
int iPosColon = strText.Find(_T(':'));
if (iPosColon < iPosNL)
bShowFileIcon = false; // 1st line does not contain a filename
}
}
int iTextHeight = 0;
int iMaxCol1Width = 0;
int iMaxCol2Width = 0;
int iMaxSingleLineWidth = 0;
CSize sizText(0);
int iPos = 0;
int iCaptionHeight = 0;
const int iCaptionEnd = bShowFileIcon ? max(strText.Find(_T("\n<br_head>\n")), 0) : 0; // special tooltip with file icon
const int iLineHeightOff = 1;
const int iIconMinYBorder = bShowFileIcon ? 3 : 0;
const int iIconWidth = bShowFileIcon ? theApp.GetBigSytemIconSize().cx : 0;
const int iIconHeight = bShowFileIcon ? theApp.GetBigSytemIconSize().cy : 0;
const int iIconDrawingWidth = bShowFileIcon ? (iIconWidth + 9) : 0;
while (iPos != -1)
{
CString strLine = GetNextString(strText, _T('\n'), iPos);
int iColon = bAutoFormatText ? strLine.Find(_T(':')) : -1;
if (iColon != -1) {
CSize siz;
if (hTheme && bUseEmbeddedThemeFonts) {
CRect rcExtent;
CRect rcBounding(0, 0, 32767, 32767);
g_xpStyle.GetThemeTextExtent(hTheme, *pdc, m_bCol1Bold ? TTP_STANDARDTITLE : TTP_STANDARD, TTSS_NORMAL, strLine, iColon + 1, m_dwCol1DrawTextFlags, &rcBounding, &rcExtent);
siz.cx = rcExtent.Width();
siz.cy = rcExtent.Height();
}
else {
CFont* pOldFont = m_bCol1Bold ? pdc->SelectObject(&m_fontBold) : NULL;
siz = pdc->GetTextExtent(strLine, iColon + 1);
if (pOldFont)
pdc->SelectObject(pOldFont);
}
iMaxCol1Width = max(iMaxCol1Width, siz.cx + ((bShowFileIcon && iPos <= iCaptionEnd + strLine.GetLength()) ? iIconDrawingWidth : 0));
iTextHeight = siz.cy + iLineHeightOff; // update height with 'col1' string, because 'col2' string might be empty and therefore has no height
if (iPos <= iCaptionEnd)
iCaptionHeight += siz.cy + iLineHeightOff;
else
sizText.cy += siz.cy + iLineHeightOff;
LPCTSTR pszCol2 = (LPCTSTR)strLine + iColon + 1;
while (_istspace((_TUCHAR)*pszCol2))
pszCol2++;
if (*pszCol2 != _T('\0')) {
if (hTheme && bUseEmbeddedThemeFonts) {
CRect rcExtent;
CRect rcBounding(0, 0, 32767, 32767);
g_xpStyle.GetThemeTextExtent(hTheme, *pdc, TTP_STANDARD, TTSS_NORMAL, pszCol2, ((LPCTSTR)strLine + strLine.GetLength()) - pszCol2, m_dwCol2DrawTextFlags, &rcBounding, &rcExtent);
siz.cx = rcExtent.Width();
siz.cy = rcExtent.Height();
}
else {
siz = pdc->GetTextExtent(pszCol2, ((LPCTSTR)strLine + strLine.GetLength()) - pszCol2);
}
iMaxCol2Width = max(iMaxCol2Width, siz.cx);
}
}
else if (bShowFileIcon && iPos <= iCaptionEnd && iPos == strLine.GetLength() + 1){
// file name, printed bold on top without any tabbing or desc
CSize siz;
if (hTheme && bUseEmbeddedThemeFonts) {
CRect rcExtent;
CRect rcBounding(0, 0, 32767, 32767);
g_xpStyle.GetThemeTextExtent(hTheme, *pdc, m_bCol1Bold ? TTP_STANDARDTITLE : TTP_STANDARD, TTSS_NORMAL, strLine, strLine.GetLength(), m_dwCol1DrawTextFlags, &rcBounding, &rcExtent);
siz.cx = rcExtent.Width();
siz.cy = rcExtent.Height();
}
else {
CFont* pOldFont = m_bCol1Bold ? pdc->SelectObject(&m_fontBold) : NULL;
siz = pdc->GetTextExtent(strLine);
if (pOldFont)
pdc->SelectObject(pOldFont);
}
iMaxSingleLineWidth = max(iMaxSingleLineWidth, siz.cx + iIconDrawingWidth);
iCaptionHeight += siz.cy + iLineHeightOff;
}
else if (!strLine.IsEmpty() && strLine.Compare(_T("<br>")) != 0 && strLine.Compare(_T("<br_head>")) != 0) {
CSize siz;
if (hTheme && bUseEmbeddedThemeFonts) {
CRect rcExtent;
CRect rcBounding(0, 0, 32767, 32767);
g_xpStyle.GetThemeTextExtent(hTheme, *pdc, TTP_STANDARD, TTSS_NORMAL, strLine, strLine.GetLength(), m_dwCol2DrawTextFlags, &rcBounding, &rcExtent);
siz.cx = rcExtent.Width();
siz.cy = rcExtent.Height();
}
else {
siz = pdc->GetTextExtent(strLine);
}
iMaxSingleLineWidth = max(iMaxSingleLineWidth, siz.cx + ((bShowFileIcon && iPos <= iCaptionEnd) ? iIconDrawingWidth : 0));
if (bShowFileIcon && iPos <= iCaptionEnd + strLine.GetLength())
iCaptionHeight += siz.cy + iLineHeightOff;
else
sizText.cy += siz.cy + iLineHeightOff;
}
else{
CSize siz;
if (hTheme && bUseEmbeddedThemeFonts) {
CRect rcExtent;
CRect rcBounding(0, 0, 32767, 32767);
g_xpStyle.GetThemeTextExtent(hTheme, *pdc, TTP_STANDARD, TTSS_NORMAL, _T(" "), 1, m_dwCol2DrawTextFlags, &rcBounding, &rcExtent);
siz.cx = rcExtent.Width();
siz.cy = rcExtent.Height();
}
else {
// TODO: Would need to use 'GetTabbedTextExtent' here, but do we actually use 'tabbed' text here at all ??
siz = pdc->GetTextExtent(_T(" "), 1);
}
sizText.cy += siz.cy + iLineHeightOff;
}
}
if (bShowFileIcon && iCaptionEnd > 0)
iCaptionHeight = max(iCaptionHeight, theApp.GetBigSytemIconSize().cy + (2*iIconMinYBorder));
sizText.cy += iCaptionHeight;
if (hTheme && theApp.m_ullComCtrlVer >= MAKEDLLVERULL(6,16,0,0))
sizText.cy += 2; // extra bottom margin for Vista/Theme
iMaxCol1Width = min(m_iScreenWidth4, iMaxCol1Width);
iMaxCol2Width = min(m_iScreenWidth4*2, iMaxCol2Width);
const int iMiddleMargin = 6;
iMaxSingleLineWidth = max(iMaxSingleLineWidth, iMaxCol1Width + iMiddleMargin + iMaxCol2Width);
if (iMaxSingleLineWidth > m_iScreenWidth4*3)
iMaxSingleLineWidth = m_iScreenWidth4*3;
sizText.cx = iMaxSingleLineWidth;
if (pNMCD->uDrawFlags & DT_CALCRECT)
{
pNMCD->nmcd.rc.left = rcWnd.left;
pNMCD->nmcd.rc.top = rcWnd.top;
pNMCD->nmcd.rc.right = rcWnd.left + sizText.cx;
pNMCD->nmcd.rc.bottom = rcWnd.top + sizText.cy;
}
else
{
pwnd->ScreenToClient(&rcWnd);
int iOldBkColor = -1;
if (hTheme) {
int iPartId = TTP_STANDARD;
int iStateId = TTSS_NORMAL;
if (g_xpStyle.IsThemeBackgroundPartiallyTransparent(hTheme, iPartId, iStateId))
g_xpStyle.DrawThemeParentBackground(m_hWnd, pdc->m_hDC, &rcWnd);
g_xpStyle.DrawThemeBackground(hTheme, pdc->m_hDC, iPartId, iStateId, &rcWnd, NULL);
}
else {
::FillRect(*pdc, &rcWnd, GetSysColorBrush(COLOR_INFOBK));
iOldBkColor = pdc->SetBkColor(m_crTooltipBkColor);
// Vista: Need to draw the window border explicitly !?
if (theApp.m_ullComCtrlVer >= MAKEDLLVERULL(6,16,0,0)) {
CPen pen;
pen.CreatePen(0, 1, m_crTooltipTextColor);
CPen *pOP = pdc->SelectObject(&pen);
pdc->MoveTo(rcWnd.left, rcWnd.top);
pdc->LineTo(rcWnd.right - 1, rcWnd.top);
pdc->LineTo(rcWnd.right - 1, rcWnd.bottom - 1);
pdc->LineTo(rcWnd.left, rcWnd.bottom - 1);
pdc->LineTo(rcWnd.left, rcWnd.top);
pdc->SelectObject(pOP);
pen.DeleteObject();
}
}
int iOldBkMode = 0;
if ((hTheme && !bUseEmbeddedThemeFonts) || (hTheme == NULL && iOldBkColor != -1))
iOldBkMode = pdc->SetBkMode(TRANSPARENT);
CPoint ptText(pNMCD->nmcd.rc.left, pNMCD->nmcd.rc.top);
iPos = 0;
while (iPos != -1)
{
CString strLine = GetNextString(strText, _T('\n'), iPos);
int iColon = bAutoFormatText ? strLine.Find(_T(':')) : -1;
CRect rcDT;
if (!bShowFileIcon || (unsigned)iPos > (unsigned)iCaptionEnd + strLine.GetLength())
rcDT.SetRect(ptText.x, ptText.y, ptText.x + iMaxCol1Width, ptText.y + iTextHeight);
else
rcDT.SetRect(ptText.x + iIconDrawingWidth, ptText.y, ptText.x + iMaxCol1Width, ptText.y + iTextHeight);
if (iColon != -1) {
// don't draw empty <col1> strings (they are still handy to use for skipping the <col1> space)
if (iColon > 0) {
if (hTheme && bUseEmbeddedThemeFonts)
g_xpStyle.DrawThemeText(hTheme, pdc->m_hDC, m_bCol1Bold ? TTP_STANDARDTITLE : TTP_STANDARD, TTSS_NORMAL, strLine, iColon + 1, m_dwCol1DrawTextFlags, 0, &rcDT);
else {
CFont* pOldFont = m_bCol1Bold ? pdc->SelectObject(&m_fontBold) : NULL;
pdc->DrawText(strLine, iColon + 1, &rcDT, m_dwCol1DrawTextFlags);
if (pOldFont)
pdc->SelectObject(pOldFont);
}
}
LPCTSTR pszCol2 = (LPCTSTR)strLine + iColon + 1;
while (_istspace((_TUCHAR)*pszCol2))
pszCol2++;
if (*pszCol2 != _T('\0')) {
rcDT.left = ptText.x + iMaxCol1Width + iMiddleMargin;
rcDT.right = rcDT.left + iMaxCol2Width;
if (hTheme && bUseEmbeddedThemeFonts)
g_xpStyle.DrawThemeText(hTheme, pdc->m_hDC, TTP_STANDARD, TTSS_NORMAL, pszCol2, ((LPCTSTR)strLine + strLine.GetLength()) - pszCol2, m_dwCol2DrawTextFlags, 0, &rcDT);
else
pdc->DrawText(pszCol2, ((LPCTSTR)strLine + strLine.GetLength()) - pszCol2, &rcDT, m_dwCol2DrawTextFlags);
}
ptText.y += iTextHeight;
}
else if (bShowFileIcon && iPos <= iCaptionEnd && iPos == strLine.GetLength() + 1){
// first line on special fileicon tab - draw icon and bold filename
if (hTheme && bUseEmbeddedThemeFonts)
g_xpStyle.DrawThemeText(hTheme, pdc->m_hDC, m_bCol1Bold ? TTP_STANDARDTITLE : TTP_STANDARD, TTSS_NORMAL, strLine, strLine.GetLength(), m_dwCol1DrawTextFlags, 0, &CRect(ptText.x + iIconDrawingWidth, ptText.y, ptText.x + iMaxSingleLineWidth, ptText.y + iTextHeight));
else {
CFont* pOldFont = m_bCol1Bold ? pdc->SelectObject(&m_fontBold) : NULL;
pdc->DrawText(strLine, CRect(ptText.x + iIconDrawingWidth, ptText.y, ptText.x + iMaxSingleLineWidth, ptText.y + iTextHeight), m_dwCol1DrawTextFlags);
if (pOldFont)
pdc->SelectObject(pOldFont);
}
ptText.y += iTextHeight;
int iImage = theApp.GetFileTypeSystemImageIdx(strLine, -1, true);
if (theApp.GetBigSystemImageList() != NULL) {
int iPosY = rcDT.top;
if (iCaptionHeight > iIconHeight)
iPosY += (iCaptionHeight - iIconHeight) / 2;
::ImageList_Draw(theApp.GetBigSystemImageList(), iImage, pdc->GetSafeHdc(), ptText.x, iPosY, ILD_TRANSPARENT);
}
}
else {
bool bIsBrHeadLine = false;
if (bAutoFormatText && (strLine.Compare(_T("<br>")) == 0 || (bIsBrHeadLine = strLine.Compare(_T("<br_head>")) == 0) == true)){
CPen pen;
pen.CreatePen(0, 1, m_crTooltipTextColor);
CPen *pOP = pdc->SelectObject(&pen);
if (bIsBrHeadLine)
ptText.y = iCaptionHeight;
pdc->MoveTo(ptText.x, ptText.y + ((iTextHeight - 2) / 2));
pdc->LineTo(ptText.x + iMaxSingleLineWidth, ptText.y + ((iTextHeight - 2) / 2));
ptText.y += iTextHeight;
pdc->SelectObject(pOP);
pen.DeleteObject();
}
else{
if (hTheme && bUseEmbeddedThemeFonts) {
CRect rcLine(ptText.x, ptText.y, 32767, 32767);
g_xpStyle.DrawThemeText(hTheme, pdc->m_hDC, TTP_STANDARD, TTSS_NORMAL, strLine, strLine.GetLength(), DT_EXPANDTABS | m_dwCol2DrawTextFlags, 0, &rcLine);
ptText.y += iTextHeight;
}
else {
// Text is written in the currently selected font. If 'nTabPositions' is 0 and 'lpnTabStopPositions' is NULL,
// tabs are expanded to eight times the average character width.
CSize siz;
if (strLine.IsEmpty()) // Win98: To draw an empty line we need to output at least a space.
siz = pdc->TabbedTextOut(ptText.x, ptText.y, _T(" "), 1, NULL, 0);
else
siz = pdc->TabbedTextOut(ptText.x, ptText.y, strLine, strLine.GetLength(), NULL, 0);
ptText.y += siz.cy + iLineHeightOff;
}
}
}
}
if (iOldBkColor != -1)
pdc->SetBkColor(iOldBkColor);
if (hTheme && !bUseEmbeddedThemeFonts)
pdc->SetBkMode(iOldBkMode);
}
if (pOldDCFont)
pdc->SelectObject(pOldDCFont);
if (hTheme)
g_xpStyle.CloseThemeData(hTheme);
}
void EnsureWindowVisible(const RECT &rcScreen, RECT &rc)
{
// 1st: Move the window towards the left side, in case it exceeds the desktop width.
// 2nd: Move the window towards the right side, in case it exceeds the desktop width.
//
// This order of actions ensures that in case the window is too large for the desktop,
// the user will though see the top-left part of the window.
if (rc.right > rcScreen.right)
{
rc.left -= rc.right - rcScreen.right;
rc.right = rcScreen.right;
}
if (rc.left < rcScreen.left)
{
rc.right += rcScreen.left - rc.left;
rc.left = rcScreen.left;
}
// Same logic for bottom/top
if (rc.bottom > rcScreen.bottom)
{
rc.top -= rc.bottom - rcScreen.bottom;
rc.bottom = rcScreen.bottom;
}
if (rc.top < rcScreen.top)
{
rc.bottom += rcScreen.top - rc.top;
rc.top = rcScreen.top;
}
}
BOOL CToolTipCtrlX::OnTTShow(NMHDR *pNMHDR, LRESULT *pResult)
{
//DebugLog(_T("OnTTShow: rcScreen: %d,%d-%d,%d: styles=%08x exStyles=%08x"), m_rcScreen, GetStyle(), GetWindowLong(m_hWnd, GWL_EXSTYLE));
// Win98/Win2000: The only chance to resize a tooltip window is to do it within the TTN_SHOW notification.
if (theApp.m_ullComCtrlVer <= MAKEDLLVERULL(5,81,0,0))
{
NMTTCUSTOMDRAW nmttcd = {0};
nmttcd.uDrawFlags = DT_NOPREFIX | DT_CALCRECT | DT_EXTERNALLEADING | DT_EXPANDTABS | DT_WORDBREAK;
nmttcd.nmcd.hdr = *pNMHDR;
nmttcd.nmcd.dwDrawStage = CDDS_PREPAINT;
nmttcd.nmcd.hdc = ::GetDC(pNMHDR->hwndFrom);
CustomPaint(&nmttcd);
::ReleaseDC(pNMHDR->hwndFrom, nmttcd.nmcd.hdc);
CRect rcWnd(nmttcd.nmcd.rc);
AdjustRect(&rcWnd);
// Win98/Win2000: We have to explicitly ensure that the tooltip window remains within the visible desktop window.
EnsureWindowVisible(m_rcScreen, rcWnd);
// Win98/Win2000: The only chance to resize a tooltip window is to do it within the TTN_SHOW notification.
// Win98/Win2000: Must *not* specify 'SWP_NOZORDER' - some of the tooltip windows may get drawn behind(!) the application window!
::SetWindowPos(pNMHDR->hwndFrom, NULL, rcWnd.left, rcWnd.top, rcWnd.Width(), rcWnd.Height(), SWP_NOACTIVATE /*| SWP_NOZORDER*/);
*pResult = TRUE; // Windows API: Suppress default positioning
return TRUE; // MFC API: Suppress further routing of this message
}
// If the TTN_SHOW notification is not sent to the subclassed tooltip control, we would loose the
// exact positioning of in-place tooltips which is performed by the tooltip control by default.
// Thus it is important that we tell MFC (not the Windows API in that case) to further route this message.
*pResult = FALSE; // Windows API: Perform default positioning
return FALSE; // MFC API. Perform further routing of this message (to the subclassed tooltip control)
}
void CToolTipCtrlX::OnNmCustomDraw(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTTCUSTOMDRAW pNMCD = reinterpret_cast<LPNMTTCUSTOMDRAW>(pNMHDR);
// For each tooltip which is to be shown Windows invokes the draw function at least 2 times.
// 1st invokation: to get the drawing rectangle
// 2nd invokation: to draw the actual tooltip window contents
//
// 'DrawText' flags for the 1st and 2nd/3rd call
// ---------------------------------------------
// NMTTCUSTOMDRAW 00000e50 DT_NOPREFIX | DT_CALCRECT | DT_EXTERNALLEADING | DT_EXPANDTABS | DT_WORDBREAK
// TTN_SHOW
// NMTTCUSTOMDRAW 00000a50 DT_NOPREFIX | DT_EXTERNALLEADING | DT_EXPANDTABS | DT_WORDBREAK
// --an additional NMTTCUSTOMDRAW may follow which is identical to the 2nd--
// NMTTCUSTOMDRAW 00000a50 DT_NOPREFIX | DT_EXTERNALLEADING | DT_EXPANDTABS | DT_WORDBREAK
//if (pNMCD->nmcd.dwDrawStage == CDDS_PREPAINT && pNMCD->uDrawFlags & DT_CALCRECT)
// DebugLog(_T(""));
//DebugLog(_T("OnNmCustomDraw: DrawFlags=%08x DrawStage=%08x ItemSpec=%08x ItemState=%08x ItemlParam=%08x rc=%4d,%4d,(%4dx%4d), styles=%08x exStyles=%08x"), pNMCD->uDrawFlags, pNMCD->nmcd.dwDrawStage, pNMCD->nmcd.dwItemSpec, pNMCD->nmcd.uItemState, pNMCD->nmcd.lItemlParam, pNMCD->nmcd.rc.left, pNMCD->nmcd.rc.top, pNMCD->nmcd.rc.right - pNMCD->nmcd.rc.left, pNMCD->nmcd.rc.bottom - pNMCD->nmcd.rc.top, GetStyle(), GetWindowLong(m_hWnd, GWL_EXSTYLE));
if (theApp.m_ullComCtrlVer <= MAKEDLLVERULL(5,81,0,0))
{
// Win98/Win2000: Resize and position the tooltip window in TTN_SHOW.
// Win98/Win2000: Customize the tooltip window in CDDS_POSTPAINT.
if (pNMCD->nmcd.dwDrawStage == CDDS_PREPAINT)
{
// PROBLEM: Windows will draw the default tooltip during the non-DT_CALCRECT cycle,
// and if the system is very slow (or when using remote desktop), the default tooltip
// may be visible for a second. However, we need to draw the customized tooltip after
// CDDS_POSTPAINT otherwise it won't be visible at all.
// Cheap solution: Let windows draw the text with the background color, so the glitch
// is not that much visible.
SetTextColor(pNMCD->nmcd.hdc, m_crTooltipBkColor);
*pResult = CDRF_NOTIFYPOSTPAINT;
return;
}
else if (pNMCD->nmcd.dwDrawStage == CDDS_POSTPAINT)
{
CustomPaint(pNMCD);
*pResult = CDRF_SKIPDEFAULT;
return;
}
}
else
{
// XP/Vista: Resize, position and customize the tooltip window all in 'CDDS_PREPAINT'.
if (pNMCD->nmcd.dwDrawStage == CDDS_PREPAINT)
{
CustomPaint(pNMCD);
*pResult = CDRF_SKIPDEFAULT;
return;
}
}
*pResult = CDRF_DODEFAULT;
} | [
"Mike.Ken.S@dd569cc8-ff36-11de-bbca-1111db1fd05b"
] | [
[
[
1,
646
]
]
] |
f59becc507c1b67ae5676129e5dfdb7bacf71517 | b6c9433cefda8cfe76c8cb6550bf92dde38e68a8 | /epoc32/include/networkemulator/cnetworkemulatorsetupcommdb.h | 05a8b9cd11e1a905c41ee472c0293470079734b5 | [] | no_license | fedor4ever/public-headers | 667f8b9d0dc70aa3d52d553fd4cbd5b0a532835f | 3666a83565a8de1b070f5ac0b22cc0cbd59117a4 | refs/heads/master | 2021-01-01T05:51:44.592006 | 2010-03-31T11:33:34 | 2010-03-31T11:33:34 | 33,378,397 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,561 | h | /*
* Copyright (c) 2005-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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
* which accompanies this distribution, and is available
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
* CSetUpCommDb.h
*
*/
#ifndef _CSetUpCommDb_H
#define _CSetUpCommDb_H
/*****************************************************************************
*
* System Includes
*
****************************************************************************/
#include <commdb.h>
/*****************************************************************************
*
* Local Includes
*
****************************************************************************/
/*****************************************************************************
*
* Types
*
****************************************************************************/
typedef enum {
TCommDB_Success,
TCommDB_ErrorInitCommDb,
TCommDB_ErrorTableNotFound,
TCommDB_ErrorUpdatingRecord,
TCommDB_ErrorReadingRecord,
TCommDB_ErrorColNotFound,
TCommDB_ErrorColTypeValueNotSupported,
TCommDB_ErrorConvertingToUnicode,
TCommDB_ErrorUnexpectedColType,
TCommDB_RecNotFound
}TCommDBError;
typedef enum {
TCOMMBD_IDLE,
TCOMMBD_CONNECTED
}TCommDbStatus;
/*****************************************************************************
*
* Class Definition
*
****************************************************************************/
class CSetUpCommDb : public CBase
{
public:
// Constructor sets all member data to null
IMPORT_C CSetUpCommDb();
// Deletes the pointer, sets it to null.
IMPORT_C ~CSetUpCommDb();
// Method to initialise the database.
IMPORT_C TCommDBError initialise(void);
IMPORT_C TCommDBError updateEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
IMPORT_C TCommDBError getAsciiEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes8& aFieldValue, int* aErrCode);
IMPORT_C TCommDBError getUnicodeEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes16& aFieldValue, int* aErrCode);
IMPORT_C TCommDBError getIntEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TUint32& aFieldValue, int* aErrCode);
IMPORT_C TCommDBError getBoolEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TBool& aFieldValue, int* aErrCode);
private:
CCommsDbTableView* openTableL( CCommsDatabase *aDbComms, TPtrC aTable );
TCommDBError FindAndUpdateRecord( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
TCommDBError UpdateField( CCommsDbTableView *aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode );
int SetUnicodeString(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
int SetUnicodeStringLong(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
HBufC16 *ConvertAsciiToUnicode( char *aAsciiString );
TCommDBError FindRecordAndGetType( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, TDbColType *aColType, int* aErrCode );
CCommsDatabase *iDbComms;
TCommDbStatus iStatus;
};
#endif
| [
"[email protected]"
] | [
[
[
1,
101
]
]
] |
2b0811d1bffdd9d282a76584ee906c9797cd0231 | ef356dbd697546b63c1c4c866db4f410ecf1c226 | /CAMultiSignature.hpp | ef88d0da0bce1b3deaad87333e126ddf44c2dfef | [] | no_license | jondos/Mix | d5e7ab0f6ca4858b300341fb17e56af9106ffb65 | 8e0ebd9490542472197eca4b7c9974618df6f1de | refs/heads/master | 2023-09-03T12:55:23.983398 | 2010-01-04T14:52:26 | 2010-01-04T14:52:26 | 425,933,032 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,653 | hpp | /*
Copyright (c) 2000, The JAP-Team
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Neither the name of the University of Technology Dresden, Germany 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 REGENTS 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
*/
/*
* CAMultiSignature.hpp
*
* Created on: 17.07.2008
* Author: zenoxx
*/
#ifndef CAMULTISIGNATURE_HPP_
#define CAMULTISIGNATURE_HPP_
#include "CACertStore.hpp"
#include "CACertificate.hpp"
struct __t_signature
{
CASignature* pSig;
CACertStore* pCerts;
struct __t_signature* next;
};
typedef struct __t_signature SIGNATURE;
class CAMultiSignature
{
public:
CAMultiSignature();
virtual ~CAMultiSignature();
SINT32 addSignature(CASignature* a_signature, CACertStore* a_certs, UINT8* a_ski, UINT32 a_skiLen);
SINT32 signXML(DOMNode* a_node, bool appendCerts);
SINT32 signXML(UINT8* in, UINT32 inlen, UINT8* out, UINT32* outlen, bool appendCerts);
static SINT32 verifyXML(const UINT8* const in, UINT32 inlen, CACertificate* a_cert);
static SINT32 verifyXML(DOMNode* a_node, CACertificate* a_cert);
UINT32 getSignatureCount(){ return m_sigCount; }
SINT32 sign(UINT8* in,UINT32 inlen,UINT8* sig,UINT32* siglen);
SINT32 getXORofSKIs(UINT8* in, UINT32 inlen);
private:
SIGNATURE* m_signatures;
UINT32 m_sigCount;
UINT8* m_xoredID;
};
#endif /* CAMULTISIGNATURE_HPP_ */
| [
"rolf@f4013887-1060-43d1-a937-9d2a4c6f27f8",
"hirschberger@f4013887-1060-43d1-a937-9d2a4c6f27f8"
] | [
[
[
1,
27
]
],
[
[
28,
68
]
]
] |
e4671f57cf1f084d150a20b14f02c0cf44a80fe0 | 50c10c208dc64d362a02d680388a944f7da16cbc | /Principal/interfazRMN2/error.cpp | 73df0633ee4990e1d1338922d82206a4da2d71e9 | [] | no_license | raulmonti/generador-de-pulsos-2011 | c18e9938f9f28651a995677414ebc8d29f0c2dcc | 3634a47bcf2fb01cba4d9f8c84928ca2eb60646c | refs/heads/master | 2020-04-14T15:09:01.914839 | 2011-03-23T22:03:20 | 2011-03-23T22:03:20 | 33,492,955 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,254 | cpp | #include "error.h"
#include <stdlib.h>
char *getMessage(unsigned int error_code){
char *result = NULL;
if(error_code == ERROR_TOO_MANY_SAMPLES)
result =MERROR_TOO_MANY_SAMPLES;
else if(error_code == ERROR_NO_PULSE_SHEET_PATH)
result =MERROR_NO_PULSE_SHEET_PATH;
else if(error_code == ERROR_DDS_FREQ_1)
result =MERROR_DDS_FREQ_1;
else if(error_code == ERROR_DDS_FREQ_2)
result =MERROR_DDS_FREQ_2;
else if(error_code == ERROR_NO_NUMBER_OF_SAMPLES)
result =MERROR_NO_NUMBER_OF_SAMPLES;
else if(error_code == ERROR_NO_AD_BUFFER_SIZE)
result =MERROR_NO_AD_BUFFER_SIZE;
else if(error_code == ERROR_NO_AD_MODE)
result =MERROR_NO_AD_MODE;
else if(error_code == ERROR_NO_CONFIG_PATH)
result =MERROR_NO_CONFIG_PATH;
else if(error_code == ERROR_NO_SAVE_FILE_PATH)
result =MERROR_NO_SAVE_FILE_PATH;
else if(error_code == ERROR_NO_MPS)
result =MERROR_NO_MPS;
else if(error_code == ERROR_DELAYS_MISSING)
result =MERROR_DELAYS_MISSING;
else
result = MDEFAULT;
return result;
}
| [
"[email protected]@d9bf8441-58a9-7046-d6f0-32bbd92d4940"
] | [
[
[
1,
33
]
]
] |
767fe4b76d26b1ac4a596d1028a666ec3d4ae1c6 | b002ebd2938f8d79c6b09fc652064001a2d92887 | /source/CFxC64.h | 49d4e2190e138d339a74437dd2ccfafb2e300176 | [] | no_license | benbaker76/DetectiveDS | 104a175738970dfd12ea8557685a63245b2a3fbe | ca487610b8088a07fc7fe62e345557ccb9663b20 | refs/heads/master | 2022-11-25T17:22:07.218401 | 2011-07-30T13:13:23 | 2011-07-30T13:13:23 | 241,390,011 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 370 | h | #ifndef __CFxC64_H__
#define __CFxC64_H__
#include "CFx.h"
class CFxC64 : public CFx
{
public:
CFxC64(FxType fxType, CFxManager* fxManager) : CFx(fxType, fxManager) { }
~CFxC64() {}
void Initialize();
void Shutdown();
void Reset();
void UpdateVBlank();
void UpdateHBlank();
private:
u32 m_colorWait;
u32 m_colorOffset;
};
#endif
| [
"[email protected]"
] | [
[
[
1,
25
]
]
] |
b0a9c17ddd5e2f7d2a11f62f651817c87211f85b | 709cd826da3ae55945fd7036ecf872ee7cdbd82a | /Term/WildMagic2/Source/Geometry/WmlSphere3.cpp | 1952c91c0d5dead79faa265178ae91431ef59bb6 | [] | 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 | 1,799 | cpp | // Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright (c) 2003. All Rights Reserved
//
// The Wild Magic Library (WML) source code is supplied under the terms of
// the license agreement http://www.magic-software.com/License/WildMagic.pdf
// and may not be copied or disclosed except in accordance with the terms of
// that agreement.
#include "WmlSphere3.h"
using namespace Wml;
//----------------------------------------------------------------------------
template <class Real>
Sphere3<Real>::Sphere3 ()
:
m_kCenter(Vector3<Real>::ZERO)
{
m_fRadius = (Real)0.0;
}
//----------------------------------------------------------------------------
template <class Real>
Vector3<Real>& Sphere3<Real>::Center ()
{
return m_kCenter;
}
//----------------------------------------------------------------------------
template <class Real>
const Vector3<Real>& Sphere3<Real>::Center () const
{
return m_kCenter;
}
//----------------------------------------------------------------------------
template <class Real>
Real& Sphere3<Real>::Radius ()
{
return m_fRadius;
}
//----------------------------------------------------------------------------
template <class Real>
const Real& Sphere3<Real>::Radius () const
{
return m_fRadius;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// explicit instantiation
//----------------------------------------------------------------------------
namespace Wml
{
template class WML_ITEM Sphere3<float>;
template class WML_ITEM Sphere3<double>;
}
//----------------------------------------------------------------------------
| [
"[email protected]"
] | [
[
[
1,
56
]
]
] |
dee4bfa959d5354bbf4b9057aa30db62a0aab1f5 | bf19f77fdef85e76a7ebdedfa04a207ba7afcada | /Tech Demo/TMNT Tactics Tech Demo/Source/Base.h | 10626453c06dffb2d5538ada5c768c323e1fc9ee | [] | no_license | marvelman610/tmntactis | 2aa3176d913a72ed985709843634933b80d7cb4a | a4e290960510e5f23ff7dbc1e805e130ee9bb57d | refs/heads/master | 2020-12-24T13:36:54.332385 | 2010-07-12T08:08:12 | 2010-07-12T08:08:12 | 39,046,976 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 4,191 | h | ////////////////////////////////////////////////////////
// File Name : "Base.h"
//
// Author : Matthew Di Matteo (MD)
//
// Purpose : To encapsulate all shared data and functionality
// for our game objects
////////////////////////////////////////////////////////
#ifndef BASE_H
#define BASE_H
#include "IBaseInterface.h"
#include <vector>
using std::vector;
enum TYPE{ OBJECT_WEAPON, OBJECT_BATTLEITEM, OBJECT_BOSS, OBJECT_NINJA, OBJECT_TURTLE};
class CAnimation;
class CBase : public IBaseInterface
{
private:
int m_nImageID;
int m_nState;
char* m_szName;
//vector<CAnimation> animations;
float m_fPosX;
float m_fPosY;
float m_fVelX;
float m_fVelY;
int m_nWidth;
int m_nHeight;
int m_nHealthMax;
int m_nHealth;
int m_nLevel;
int m_nStrength;
int m_nDefense;
int m_nAccuracy;
int m_nSpeed;
int m_nRange;
int m_nBasePoints;
int m_nCurrPoints;
int m_nExperience;
//CTile m_pTileArray;
CBase* m_pOwner;
protected:
int m_nType;
public:
///////////////////////////////////////////////////////////////////
// Function: "Base(Constructor)"
///////////////////////////////////////////////////////////////////
CBase();
///////////////////////////////////////////////////////////////////
// Function: "~Base(Destructor)"
///////////////////////////////////////////////////////////////////
virtual ~CBase() {}
//////////////////////////////////////
// Function: Accessors
//
// Purpose : To get the specified type
///////////////////////////////////////
inline int GetImageID()const {return m_nImageID;}
inline float GetPosX()const {return m_fPosX;}
inline float GetPosY()const {return m_fPosY;}
inline float GetVelX()const {return m_fVelX;}
inline float GetVelY()const {return m_fVelY;}
inline int GetWidth() const {return m_nWidth;}
inline int GetHeight() const {return m_nHeight;}
inline int GetType(){return m_nType;}
//////////////////////////////////////
// Function: Mutators
//
// Purpose : To set the specified type
///////////////////////////////////////
inline void SetImageID(int nImageID){m_nImageID = nImageID;}
inline void SetPosX(float nPosX){m_fPosX = nPosX;}
inline void SetPosY(float nPosY){m_fPosY = nPosY;}
inline void SetVelX(float nVelX){m_fVelX = nVelX;}
inline void SetVelY(float nVelY){m_fVelY = nVelY;}
inline void SetWidth(int nWidth){m_nWidth = nWidth;}
inline void SetHeight(int nHeight){m_nHeight = nHeight;}
inline void SetBaseAP(int nAP){m_nBasePoints = nAP;}
inline void SetHealthMax(int nHealthMax){m_nHealthMax = nHealthMax;}
inline void SetStrength(int nStrength){m_nStrength = nStrength;}
inline void SetDefense(int nDefense){m_nDefense = nDefense;}
inline void SetAccuracy(int nAccuracy){m_nAccuracy = nAccuracy;}
inline void SetSpeed(int nSpeed){m_nSpeed = nSpeed;}
inline void SetLevel(int nLevel){m_nLevel = nLevel;}
inline void SetExperience(int nExperience){m_nExperience = nExperience;}
////////////////////////////////////////////////////////////////////
// Function: “Update”
//
// Purpose: Updates game objects based on time.
////////////////////////////////////////////////////////////////////
virtual void Update(float fElapsedTime);
////////////////////////////////////////////////////////////////////
// Function: “Render”
//
// Purpose: Draws game objects to the screen.
////////////////////////////////////////////////////////////////////
virtual void Render();
////////////////////////////////////////////////////////////////////
// Function: “Release”
//
// Purpose: Decrements the count varible. If the variable reaches zero,
// the pointer is no longer needed and is deleted.
////////////////////////////////////////////////////////////////////
void Release()
{
}
////////////////////////////////////////////////////////////////////
// Function: “Pathfind”
//
// Purpose: Will be used by all derived objects to do path finding.
//
////////////////////////////////////////////////////////////////////
//vector<CTile> Pathfind(void);
};
#endif | [
"marvelman610@7dc79cba-3e6d-11de-b8bc-ddcf2599578a"
] | [
[
[
1,
146
]
]
] |
04f3ad2e7d66fafe14b9a39cdf6a7b4b9b7c2362 | 7a310d01d1a4361fd06b40a74a2afc8ddc23b4d3 | /src_plugin/PluginMaking/TabMoveBar/StdAfx.cpp | 5d8f3ca65506879135badd7c958a809cafc498bd | [] | no_license | plus7/DonutG | b6fec6111d25b60f9a9ae5798e0ab21bb2fa28f6 | 2d204c36f366d6162eaf02f4b2e1b8bc7b403f6b | refs/heads/master | 2020-06-01T15:30:31.747022 | 2010-08-21T18:51:01 | 2010-08-21T18:51:01 | 767,753 | 1 | 2 | null | null | null | null | SHIFT_JIS | C++ | false | false | 285 | cpp | // stdafx.cpp : 標準インクルードファイルを含むソース ファイル
// TabMoveBar.pch : 生成されるプリコンパイル済ヘッダー
// stdafx.obj : 生成されるプリコンパイル済タイプ情報
#include "stdafx.h"
| [
"[email protected]"
] | [
[
[
1,
8
]
]
] |
f77a9a7770bc89ebe1d255508ebef07a95825b9c | 03f03fa28fc27362bf14a24bab1c6e20ae2b8e50 | /BirthdayApp/UIFadingPic.h | a3b1512496ab86591bef2b4844f4c1267fe7001c | [] | no_license | dannydraper/BirthdayCard | a3ecebf54a4863671e503c5f9507349311ca714b | 36bcbcfe1ac5f81164e5ebc971d48bf81f528c18 | refs/heads/master | 2021-01-17T20:50:34.180339 | 2010-09-27T19:32:50 | 2010-09-27T19:32:50 | 63,404,098 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,323 | h | #pragma once
#include "UIControl.h"
#define BLITMETHOD_STANDARD 0
#define BLITMETHOD_ALPHABLEND 1
#define TMR_FADE 100
#define TMR_WAIT 105
class UIFadingPic : public UIControl
{
public:
UIFadingPic ();
~UIFadingPic ();
void Paint (HDC hdc);
void NotifyMouseMove (int iXPos, int iYPos);
void NotifyMouseDown ();
void NotifyMouseUp ();
void NotifyTimer (unsigned int wParam);
void SetVisible (bool bVisible);
unsigned long GetSize ();
void UIFadingPic::SetBitmapResources (unsigned int wResbase);
void SetBitmapProperties (int c1xStart, int c1xWidth, int c2xStart, int c2xWidth, int c3xStart, int c3xWidth, int Height, int Width);
void SetBitmapProperties (int Width, int Height);
void SetTransparencyKey (COLORREF clTransparentKey);
void LockHighlight (bool bLock);
void SetToggleMode (bool bUsetoggle);
void SetRectHighlight (bool bUseRectHighlight);
void ReleaseToggle ();
void FadeIn (bool extended);
void FadeOut ();
void StopFade ();
bool m_busefadeout;
private:
void DrawRect (HDC hdc);
void DrawClippedButton (HDC hdc, HDC hdcMem, int Method, BLENDFUNCTION blendop);
// Bitmap properties
int g_c1xStart;
int g_c1xWidth;
int g_c2xStart;
int g_c2xWidth;
int g_c3xStart;
int g_c3xWidth;
bool g_bMouseover;
bool g_bHighlighted;
bool g_bDepressed;
bool g_bHighlightlocked;
bool m_bVisible;
bool m_bextendedfade;
bool g_bSinglebitmap;
// Blend variables for highlighting
BLENDFUNCTION g_blendop;
int g_iAlpha;
bool g_bTimeractive;
bool m_bTogglemode;
bool m_bUseRectHighlight;
bool m_bfadein;
//Transparency key for transparent blitting.
// A default transparent key will be set upon instance creation. However the default blitting will be used until the
// SetTransparencyKey method is used. This tells the object to use a different method of blitting.
COLORREF m_clTranskey;
bool m_bUsingTransparency;
///////////////// METHOD DEFINITIONS ///////////////////
void Blit (HDC hdc, int xPos, int yPos, int Width, int Height, HDC srcDC, int srcxPos, int srcyPos, int srcWidth, int srcHeight, int Method, BLENDFUNCTION blendop);
void DrawButton (HDC hdc, HDC hdcMem, int Method, BLENDFUNCTION blendop);
void Fade ();
}; | [
"ddraper@97d7ef0a-6299-8f4c-b136-708a1ee9305e"
] | [
[
[
1,
76
]
]
] |
39e0e6763d55d702a127939a2fbdd280c8f3085a | c6f4fe2766815616b37beccf07db82c0da27e6c1 | /SpotLight.h | c13022f26a5b881c6022d0b04cadbbc9417f8f95 | [] | no_license | fragoulis/gpm-sem1-spacegame | c600f300046c054f7ab3cbf7193ccaad1503ca09 | 85bdfb5b62e2964588f41d03a295b2431ff9689f | refs/heads/master | 2023-06-09T03:43:53.175249 | 2007-12-13T03:03:30 | 2007-12-13T03:03:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 684 | h | #include "GenericLight.h"
class SpotLight : public GenericLight
{
private:
// The light's direction
Vector3f m_vDir;
// The light's cutoff
float m_fCutOff;
// The light's exponent
float m_fExponent;
public:
/**
* Constructor
*/
SpotLight();
/**
* Setter for the light's attributes.
* These functions save the values to the member variables
* and also apply them to the light source.
*/
void setDir( const Vector3f &vDir );
void setCutOff( float fCutOff );
void setExponent( float fExponent );
/**
* Resets the light's attributes
*/
void reset();
}; | [
"john.fragkoulis@201bd241-053d-0410-948a-418211174e54"
] | [
[
[
1,
34
]
]
] |
a06b69e55d2ef1c3bfeec724ebedf21c343e44b1 | 58ef4939342d5253f6fcb372c56513055d589eb8 | /CloverDemo/source/control/inc/ScrollControl.h | 80029023d05b3ba7f8a6730c5242c99bc2d3f9cc | [] | no_license | flaithbheartaigh/lemonplayer | 2d77869e4cf787acb0aef51341dc784b3cf626ba | ea22bc8679d4431460f714cd3476a32927c7080e | refs/heads/master | 2021-01-10T11:29:49.953139 | 2011-04-25T03:15:18 | 2011-04-25T03:15:18 | 50,263,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,704 | h | /*
============================================================================
Name : ScrollControl.h
Author : zengcity
Version : 1.0
Copyright : Your copyright notice
Description : CScrollControl declaration
============================================================================
*/
#ifndef SCROLLCONTROL_H
#define SCROLLCONTROL_H
// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "BaseControl.h"
// CLASS DECLARATION
class CListBoxPainter;
/**
* CScrollControl
*
*/
class CScrollControl : public CBaseControl
{
public:
// Constructors and destructor
/**
* Destructor.
*/
~CScrollControl();
/**
* Two-phased constructor.
*/
static CScrollControl* NewL();
/**
* Two-phased constructor.
*/
static CScrollControl* NewLC();
private:
/**
* Constructor for performing 1st stage construction
*/
CScrollControl();
/**
* EPOC default constructor for performing 2nd stage construction
*/
void ConstructL();
public:
//from base
virtual void Draw(CBitmapContext& gc) const;
//new func
TBool CheckScroll() const;
void SetPainter(CListBoxPainter* aPainter) {iPainter = aPainter;}
void SetPosition(const TInt& aTotal,const TInt& aStart,const TInt& aEnd)
{
iTotal = aTotal;
iStart = aStart;
iEnd = aEnd;
}
void StartAnimationScroll();
TInt AnimationScroll();
static TInt CallbackAnimationScroll( TAny* aThis );
private:
TInt iTotal;
TInt iStart;
TInt iEnd;
CListBoxPainter* iPainter; //not own
TInt iAlpha;
TInt iItemScrollFrame;
TCallBack* iCallFunc; //not own
};
#endif // SCROLLCONTROL_H
| [
"zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494"
] | [
[
[
1,
92
]
]
] |
7357778a4ca7e66dc80087ac79bfd42b2acb9878 | b738fc6ffa2205ea210d10c395ae47b25ba26078 | /TUDT/P2PUdtTest/stdafx.cpp | 2642a8e4d657ade09430d0accee7eacee92f8905 | [] | no_license | RallyWRT/ppsocket | d8609233df9bba8d316a85a3d96919b8618ea4b6 | b4b0b16e2ceffe8a697905b1ef1aeb227595b110 | refs/heads/master | 2021-01-19T16:23:26.812183 | 2009-09-23T06:57:58 | 2009-09-23T06:57:58 | 35,471,076 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 270 | cpp | // stdafx.cpp : 只包括标准包含文件的源文件
// P2PUdtTest.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"
// TODO: 在 STDAFX.H 中
// 引用任何所需的附加头文件,而不是在此文件中引用
| [
"tantianzuo@159e4f46-9839-11de-8efd-97b2a7529d09"
] | [
[
[
1,
8
]
]
] |
fa16c5152993548f20e3192aef479fea3bbbc880 | ad80c85f09a98b1bfc47191c0e99f3d4559b10d4 | /code/src/gfx/nd3d8_adapter.cc | f0fdd79ecdaebdead04f29ce58cbc818464682b5 | [] | no_license | DSPNerd/m-nebula | 76a4578f5504f6902e054ddd365b42672024de6d | 52a32902773c10cf1c6bc3dabefd2fd1587d83b3 | refs/heads/master | 2021-12-07T18:23:07.272880 | 2009-07-07T09:47:09 | 2009-07-07T09:47:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,637 | cc | #define N_IMPLEMENTS nD3D8Server
//-----------------------------------------------------------------------------
// nd3d8_adapter.cc
// (C) 2001 Andre Weissflog
//-----------------------------------------------------------------------------
#include "gfx/nd3d8server.h"
namespace {
// valid DepthStencil formats for fullscreen mode (in priority of use)
struct nDepthStencilFormat
{
D3DFORMAT dsFormat;
int bpp;
int sbpp;
bool tryWbuffer;
};
nDepthStencilFormat g_DepthStencilFormats[] = {
{ D3DFMT_D24S8, 32, 8, false }, // try format with stencil buffer first
{ D3DFMT_D24X4S4, 32, 4, false },
{ D3DFMT_D32, 32, 0, false }, // then, others
{ D3DFMT_D24X8, 32, 0, false },
{ D3DFMT_D16, 16, 0, true }, // in 16/15bit zbuffer try to use Wbuffer (to avoid z buffer artifacts)
{ D3DFMT_D15S1, 16, 1, true },
{ D3DFMT_UNKNOWN, 0, 0, false }
};
} // namespace
extern const char *nd3d8_Error(HRESULT hr);
//-----------------------------------------------------------------------------
/**.
Converts D3DFORMAT enum into its corresponding number of bits.
@param format the D3DFORMAT enumerant
@return the correponding number of bits
history:
- 25-Jan-2001 floh created
*/
int
nD3D8Server::bppFromFormat(D3DFORMAT format)
{
int bpp;
switch (format)
{
case D3DFMT_R8G8B8: bpp = 24; break;
case D3DFMT_A8R8G8B8: bpp = 32; break;
case D3DFMT_X8R8G8B8: bpp = 32; break;
case D3DFMT_R5G6B5: bpp = 16; break;
case D3DFMT_X1R5G5B5: bpp = 16; break;
case D3DFMT_A1R5G5B5: bpp = 16; break;
case D3DFMT_A4R4G4B4: bpp = 16; break;
case D3DFMT_X4R4G4B4: bpp = 16; break;
default: bpp = 0; break;
}
return bpp;
}
//-----------------------------------------------------------------------------
/**.
Check if a display format works with the specified zbuffer.
@param adapter the adapter to be checked
@param mode the display mode to be checked
@param zbuf the zbuffer format to be checked
history:
- 25-Jan-2001 floh created
*/
bool
nD3D8Server::checkZBufferFormat(int adapter, D3DFORMAT mode, D3DFORMAT zbuf)
{
n_assert(this->d3d8);
HRESULT hr;
// check if the device can the zbuffer format at all
hr = this->d3d8->CheckDeviceFormat(adapter,
D3DDEVTYPE_HAL,
mode,
D3DUSAGE_DEPTHSTENCIL,
D3DRTYPE_SURFACE,
zbuf);
if (FAILED(hr))
{
return false;
}
// check if the specific combination is supported
hr = this->d3d8->CheckDepthStencilMatch(adapter,
D3DDEVTYPE_HAL,
mode,
mode,
zbuf);
if (FAILED(hr))
{
return false;
}
return true;
}
//-----------------------------------------------------------------------------
/**.
Enumerate all display modes for an adapter and put those modes into
the display database that can be hardware accelerated.
@param adapter the adapter to be used
@return the number of hardware accelerated display modes
history:
- 24-Jan-2001 floh created
- 17-Jul-2001 floh removed stencil from zbuffer format
- 04-Sep-2003 valen added support of range of valid DepthStencil buffer
formats (as opposed to only D24S8)
*/
int
nD3D8Server::enumDisplayModes(int adapter)
{
HRESULT hr;
// create the mode directory and enumerate modes
nRoot *dir = kernelServer->New("nroot", "modes");
kernelServer->PushCwd(dir);
// enumerate all adapter modes and create a database
// entry for all modes that can be hardware accelerated
int cur_mode;
int accepted_mode = 0;
int num_modes = this->d3d8->GetAdapterModeCount(adapter);
D3DDISPLAYMODE prev_dmode;
D3DDISPLAYMODE dmode;
n_memset(&prev_dmode, 0, sizeof(prev_dmode));
n_memset(&dmode, 0, sizeof(dmode));
for (cur_mode = 0; cur_mode < num_modes; cur_mode++)
{
// get the current adapter mode description
hr = this->d3d8->EnumAdapterModes(adapter, cur_mode, &dmode);
if (FAILED(hr))
{
n_error("nD3D8Server: EnumAdapterModes() failed with '%s'\n", nd3d8_Error(hr));
return 0;
}
// ignore the mode if its size is less then 640x480
if ((dmode.Width >= 640) && (dmode.Height >= 480))
{
// ignore the new mode if it only differs in frequency
if (!((cur_mode > 0) &&
(dmode.Width == prev_dmode.Width) &&
(dmode.Height == prev_dmode.Height) &&
(dmode.Format == prev_dmode.Format)))
{
prev_dmode = dmode;
// check if the mode can be hardware accelerated
hr = this->d3d8->CheckDeviceType(adapter,
D3DDEVTYPE_HAL,
dmode.Format,
dmode.Format,
FALSE);
if (SUCCEEDED(hr))
{
// generally try to get one of valid DepthStencil buffer formats
int i = 0;
while (g_DepthStencilFormats[i].dsFormat != D3DFMT_UNKNOWN)
{
int zbuf_bpp = g_DepthStencilFormats[i].bpp;
int sbuf_bpp = g_DepthStencilFormats[i].sbpp;
D3DFORMAT zbuf_format = g_DepthStencilFormats[i].dsFormat;
if (this->checkZBufferFormat(adapter, dmode.Format, zbuf_format))
{
nEnv *env;
// create a new entry for the mode in the display database
char buf[N_MAXPATH];
sprintf(buf,"%d",accepted_mode++);
dir = kernelServer->New("nroot", buf);
kernelServer->PushCwd(dir);
// get color depth from format
int bpp = this->bppFromFormat(dmode.Format);
// create the various env vars...
sprintf(buf, "type(full)-w(%d)-h(%d)-bpp(%d)-zbuf(%d)-sbuf(%d)",
dmode.Width, dmode.Height, bpp, zbuf_bpp, sbuf_bpp);
env = (nEnv *) kernelServer->New("nenv", "name");
env->SetS(buf);
env = (nEnv *) kernelServer->New("nenv", "w");
env->SetI(dmode.Width);
env = (nEnv *) kernelServer->New("nenv", "h");
env->SetI(dmode.Height);
env = (nEnv *) kernelServer->New("nenv", "bpp");
env->SetI(bpp);
env = (nEnv *) kernelServer->New("nenv", "zbuf");
env->SetI(zbuf_bpp);
env = (nEnv *) kernelServer->New("nenv", "sbuf");
env->SetI(sbuf_bpp);
env = (nEnv *) kernelServer->New("nenv", "d3d8_dsp_format");
env->SetI(dmode.Format);
env = (nEnv *) kernelServer->New("nenv", "d3d8_zbuf_format");
env->SetI(zbuf_format);
env = (nEnv *) kernelServer->New("nenv", "tryWbuffer");
env->SetB( g_DepthStencilFormats[i].tryWbuffer );
kernelServer->PopCwd();
} // if
++i;
} // while
}
}
}
}
kernelServer->PopCwd();
return accepted_mode;
}
//-----------------------------------------------------------------------------
/**.
Enumerate all adapters in the system and built a device database under
/sys/share/display. There is only one device per adapter, the
HAL device. The numbering is as follows:
/sys/share/display/0 - HAL device of adapter 0
/sys/share/display/1 - HAL device of adapter 1
...
Below the device database object, the following objects exist:
nroot modes - database of display modes and compatible zbuffer formats
nenv drv_name - name of driver
nenv drv_desc - description of driver
nenv drv_version - version number of driver
history:
- 24-Jan-2001 floh created
*/
bool
nD3D8Server::queryAdapters()
{
n_assert(this->d3d8);
n_assert(0 == this->d3d8Dev);
HRESULT hr;
this->queryAdaptersCalled = true;
// get number of adapters
this->numAdapters = this->d3d8->GetAdapterCount();
// prepare display database
nRoot *disp = kernelServer->Lookup("/sys/share/display");
if (disp)
{
disp->Release();
}
disp = kernelServer->New("nroot", "/sys/share/display");
kernelServer->PushCwd(disp);
// for each adapter...
int cur_adapter;
int cur_accepted_adapter = 0;
for (cur_adapter = 0; cur_adapter<this->numAdapters; cur_adapter++)
{
// create a new database entry, and make it the current object
char buf[N_MAXNAMELEN];
sprintf(buf,"%d", cur_accepted_adapter);
nRoot *adapt = kernelServer->New("nroot", buf);
// see if this adapter can accelerate any display modes,
// if no, we ignore it!
kernelServer->PushCwd(adapt);
int num_modes = this->enumDisplayModes(cur_adapter);
kernelServer->PopCwd();
if (num_modes == 0)
{
// this adapter is a useless piece of armadillo poop
adapt->Release();
}
else
{
// this adapter is acceptable, query more info about it
D3DADAPTER_IDENTIFIER8 id;
hr = this->d3d8->GetAdapterIdentifier(cur_adapter, D3DENUM_NO_WHQL_LEVEL, &id);
if (FAILED(hr)) {
n_error("nD3D8Server: GetAdapterIdentifier() failed with '%s'\n",
nd3d8_Error(hr));
return false;
}
// write info to device database
kernelServer->PushCwd(adapt);
nEnv *env;
env = (nEnv *) kernelServer->New("nenv","drv_name");
env->SetS(id.Driver);
env = (nEnv *) kernelServer->New("nenv", "drv_desc");
env->SetS(id.Description);
env = (nEnv *) kernelServer->New("nenv", "adapter");
env->SetI(cur_adapter);
kernelServer->PopCwd();
cur_accepted_adapter++;
}
}
kernelServer->PopCwd();
return true;
}
//-----------------------------------------------------------------------------
/**.
Select one of the enumerated adapters. Called by
nD3D8Server::SetDisplayMode() with the contents of the
dev() tag of the display mode descriptor. If the requested number
is invalid, fall back to adapter 0.
This method will valid the following members:
selAdapters
refSelAdapter
@param adapter number of adapter to select
history:
- 25-Jan-2001 floh created
*/
void
nD3D8Server::selectAdapter(int adapter)
{
n_assert(this->queryAdaptersCalled);
// create the filename that points to the adapter
char buf[N_MAXPATH];
sprintf(buf,"/sys/share/display/%d",adapter);
nRoot *dir = kernelServer->Lookup(buf);
if (!dir) {
n_printf("nD3D8Server: no adapter '%d', falling back to default adapter.\n", adapter);
adapter = 0;
dir = kernelServer->Lookup("/sys/share/display/0");
n_assert(dir);
}
this->selAdapter = adapter;
this->refSelAdapter = dir;
this->selectAdapterCalled = true;
}
//-----------------------------------------------------------------------------
| [
"plushe@411252de-2431-11de-b186-ef1da62b6547"
] | [
[
[
1,
363
]
]
] |
cf2a6fb6d2f93a0d6e27dff75d420429154f6812 | ed9ecdcba4932c1adacac9218c83e19f71695658 | /CJAudioEngine/trunk/CJAudioEngine/OGGSound.h | 34a967ade3121ae304ecf3000661612c38f59913 | [] | no_license | karansapra/futurattack | 59cc71d2cc6564a066a8e2f18e2edfc140f7c4ab | 81e46a33ec58b258161f0dd71757a499263aaa62 | refs/heads/master | 2021-01-10T08:47:01.902600 | 2010-09-20T20:25:04 | 2010-09-20T20:25:04 | 45,804,375 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 609 | h | #pragma once
#include "IOpenAL.h"
#include "ISound.h"
class DLL_LOAD OGGSound :
public ISound, public IOpenAL
{
enum PlayingState {PLAY,PAUSE,STOP};
PlayingState _current_playing_state;
OggVorbis_File _ogg_file;
HANDLE _loaded;
static DWORD WINAPI _thread_loading_wrapper(void * data);
void _thread_loading();
HANDLE _state_changed;
static DWORD WINAPI _thread_play_pause_stop_wrapper(void * data);
void _thread_play_pause_stop();
public:
OGGSound();
virtual ~OGGSound(void);
bool Load(const char * filename);
void Play();
void Pause();
void Stop();
};
| [
"clems71@52ecbd26-af3e-11de-a2ab-0da4ed5138bb"
] | [
[
[
1,
31
]
]
] |
9801ca093accd6709c2e1b04a72d8112b54627c0 | 6a925ad6f969afc636a340b1820feb8983fc049b | /librtsp/librtsp/inc/ffmpegutil.h | 8870b837dd982ae60899b73c4627abd0efea000d | [] | no_license | dulton/librtsp | c1ac298daecd8f8008f7ab1c2ffa915bdbb710ad | 8ab300dc678dc05085f6926f016b32746c28aec3 | refs/heads/master | 2021-05-29T14:59:37.037583 | 2010-05-30T04:07:28 | 2010-05-30T04:07:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 176 | h | #pragma once
#include <string>
#define MAX_EXTRADATA_SIZE ((INT_MAX - 10) / 2)
#define MAX_PSET_SIZE 1024
std::string GetConfigByCodecCtx(AVCodecContext *codecCtx);
| [
"TangWentaoHust@95ff1050-1aa1-11de-b6aa-3535bc3264a2"
] | [
[
[
1,
8
]
]
] |
d6d41cd2a6e0bb8c866bbf0ea9a818ae691e0122 | 7956f4ceddbbcbabd3dd0ae211899cfa5934fc7a | /SPHSimLib/SimBufferManager.h | b6ec9b5e90a49ad97b1d977045986eebc9138685 | [] | no_license | pranavsureshpn/gpusphsim | 8d77cde45f5951aee65a13d1ea7edcb5837c6caa | 723d950efbd0d2643edb4b99845bcc658ce38f20 | refs/heads/master | 2021-01-10T05:18:21.705120 | 2011-09-08T01:58:38 | 2011-09-08T01:58:38 | 50,779,129 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,697 | h | #ifndef __SimMemoryManager_h__
#define __SimMemoryManager_h__
#include "SimBuffer.h"
#include "SimCudaAllocator.h"
#include <map>
typedef unsigned int uint;
namespace SimLib
{
template<class T>
class BufferManager
{
private:
SimCudaAllocator* mSimCudaAllocator;
typedef std::map<T, SimBuffer*> MapType;
MapType mBuffers;
public:
BufferManager(SimCudaAllocator* SimCudaAllocator)
: mSimCudaAllocator(SimCudaAllocator)
{
}
~BufferManager()
{
FreeBuffers();
}
SimBuffer* operator[] (T i)
{
return Get(i);
}
SimBuffer* Get(T i)
{
return mBuffers[i];
}
// template<typename D>
// D* GetPtr(T i)
// {
// return mBuffers[i]->GetPtr<D>();
// }
template<class D>
D* GetPtr(T i)
{
SimBuffer* b = mBuffers[i];
assert(sizeof(D) == b->GetElementSize());
return (D*)b->GetPtr();
}
void SetBuffer(T id, SimBuffer* buffer)
{
mBuffers[id] = buffer;
}
void RemoveBuffer(T id)
{
mBuffers.erase(mBuffers.find(id));
}
void AllocBuffers(size_t elements)
{
for(typename MapType::const_iterator it = mBuffers.begin(); it != mBuffers.end(); ++it)
{
SimBuffer *b = it->second;
b->AllocElements(elements);
}
}
void FreeBuffers()
{
for(typename MapType::const_iterator it = mBuffers.begin(); it != mBuffers.end(); ++it)
{
SimBuffer *b = it->second;
b->Free();
}
}
void MemsetBuffers(int val)
{
for(typename MapType::const_iterator it = mBuffers.begin(); it != mBuffers.end(); ++it)
{
SimBuffer *b = it->second;
b->Memset(val);
}
}
};
}
#endif | [
"oystein.krog@cd07e373-eec6-1eb2-8c47-9a5824a9cb26"
] | [
[
[
1,
98
]
]
] |
1eb2a919123171b5930ea5d98b56642be796b931 | b2d46af9c6152323ce240374afc998c1574db71f | /cursovideojuegos/theflostiproject/3rdParty/boost/libs/numeric/ublas/bench4/bench43.cpp | 4540910453e8051d50e27970c1019fa91d1f4c80 | [] | no_license | bugbit/cipsaoscar | 601b4da0f0a647e71717ed35ee5c2f2d63c8a0f4 | 52aa8b4b67d48f59e46cb43527480f8b3552e96d | refs/heads/master | 2021-01-10T21:31:18.653163 | 2011-09-28T16:39:12 | 2011-09-28T16:39:12 | 33,032,640 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,895 | cpp | //
// Copyright (c) 2000-2002
// Joerg Walter, Mathias Koch
//
// Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and
// that both that copyright notice and this permission notice appear
// in supporting documentation. The authors make no representations
// about the suitability of this software for any purpose.
// It is provided "as is" without express or implied warranty.
//
// The authors gratefully acknowledge the support of
// GeNeSys mbH & Co. KG in producing this work.
//
#include <iostream>
#include <string>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/timer.hpp>
#include "bench4.hpp"
template<class T, int N>
struct bench_c_matrix_prod {
typedef T value_type;
void operator () (int runs) const {
try {
static typename c_matrix_traits<T, N, N>::type m1, m2, m3;
initialize_c_matrix<T, N, N> () (m1);
initialize_c_matrix<T, N, N> () (m2);
boost::timer t;
for (int i = 0; i < runs; ++ i) {
for (int j = 0; j < N; ++ j) {
for (int k = 0; k < N; ++ k) {
m3 [j] [k] = 0;
for (int l = 0; l < N; ++ l) {
m3 [j] [k] += m1 [j] [l] * m2 [l] [k];
}
}
}
// sink_c_matrix<T, N, N> () (m3);
}
footer<value_type> () (N * N * N, N * N * (N - 1), runs, t.elapsed ());
}
catch (std::exception &e) {
std::cout << e.what () << std::endl;
}
catch (...) {
std::cout << "unknown exception" << std::endl;
}
}
};
template<class M, int N>
struct bench_my_matrix_prod {
typedef typename M::value_type value_type;
void operator () (int runs, safe_tag) const {
try {
static M m1 (N, N), m2 (N, N), m3 (N, N);
initialize_matrix (m1);
initialize_matrix (m2);
boost::timer t;
for (int i = 0; i < runs; ++ i) {
m3 = ublas::prod (m1, m2);
// sink_matrix (m3);
}
footer<value_type> () (N * N * N, N * N * (N - 1), runs, t.elapsed ());
}
catch (std::exception &e) {
std::cout << e.what () << std::endl;
}
catch (...) {
std::cout << "unknown exception" << std::endl;
}
}
void operator () (int runs, fast_tag) const {
try {
static M m1 (N, N), m2 (N, N), m3 (N, N);
initialize_matrix (m1);
initialize_matrix (m2);
boost::timer t;
for (int i = 0; i < runs; ++ i) {
m3.assign (ublas::prod (m1, m2));
// sink_matrix (m3);
}
footer<value_type> () (N * N * N, N * N * (N - 1), runs, t.elapsed ());
}
catch (std::exception &e) {
std::cout << e.what () << std::endl;
}
catch (...) {
std::cout << "unknown exception" << std::endl;
}
}
};
template<class M, int N>
struct bench_cpp_matrix_prod {
typedef typename M::value_type value_type;
void operator () (int runs) const {
try {
static M m1 (N * N), m2 (N * N), m3 (N * N);
initialize_vector (m1);
initialize_vector (m2);
boost::timer t;
for (int i = 0; i < runs; ++ i) {
for (int j = 0; j < N; ++ j) {
std::valarray<value_type> row (m1 [std::slice (N * j, N, 1)]);
for (int k = 0; k < N; ++ k) {
std::valarray<value_type> column (m2 [std::slice (k, N, N)]);
m3 [N * j + k] = (row * column).sum ();
}
}
// sink_vector (m3);
}
footer<value_type> () (N * N * N, N * N * (N - 1), runs, t.elapsed ());
}
catch (std::exception &e) {
std::cout << e.what () << std::endl;
}
catch (...) {
std::cout << "unknown exception" << std::endl;
}
}
};
// Benchmark O (n ^ 3)
template<class T, int N>
void bench_3<T, N>::operator () (int runs) {
header ("bench_3");
header ("prod (matrix, matrix)");
header ("C array");
bench_c_matrix_prod<T, N> () (runs);
#ifdef USE_C_ARRAY
header ("c_matrix safe");
bench_my_matrix_prod<ublas::c_matrix<T, N, N>, N> () (runs, safe_tag ());
header ("c_matrix fast");
bench_my_matrix_prod<ublas::c_matrix<T, N, N>, N> () (runs, fast_tag ());
#endif
#ifdef USE_BOUNDED_ARRAY
header ("matrix<bounded_array> safe");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, ublas::bounded_array<T, N * N> >, N> () (runs, safe_tag ());
header ("matrix<bounded_array> fast");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, ublas::bounded_array<T, N * N> >, N> () (runs, fast_tag ());
#endif
#ifdef USE_UNBOUNDED_ARRAY
header ("matrix<unbounded_array> safe");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, ublas::unbounded_array<T> >, N> () (runs, safe_tag ());
header ("matrix<unbounded_array> fast");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, ublas::unbounded_array<T> >, N> () (runs, fast_tag ());
#endif
#ifdef USE_STD_VALARRAY
header ("matrix<std::valarray> safe");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, std::valarray<T> >, N> () (runs, safe_tag ());
header ("matrix<std::valarray> fast");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, std::valarray<T> >, N> () (runs, fast_tag ());
#endif
#ifdef USE_STD_VECTOR
header ("matrix<std::vector> safe");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, std::vector<T> >, N> () (runs, safe_tag ());
header ("matrix<std::vector> fast");
bench_my_matrix_prod<ublas::matrix<T, ublas::row_major, std::vector<T> >, N> () (runs, fast_tag ());
#endif
#ifdef USE_STD_VALARRAY
header ("std::valarray");
bench_cpp_matrix_prod<std::valarray<T>, N> () (runs);
#endif
}
#ifdef USE_FLOAT
template struct bench_3<boost::numeric::interval<float>, 3>;
template struct bench_3<boost::numeric::interval<float>, 10>;
template struct bench_3<boost::numeric::interval<float>, 30>;
template struct bench_3<boost::numeric::interval<float>, 100>;
#endif
#ifdef USE_DOUBLE
template struct bench_3<boost::numeric::interval<double>, 3>;
template struct bench_3<boost::numeric::interval<double>, 10>;
template struct bench_3<boost::numeric::interval<double>, 30>;
template struct bench_3<boost::numeric::interval<double>, 100>;
#endif
#ifdef USE_BOOST_COMPLEX
#ifdef USE_FLOAT
template struct bench_3<boost::complex<boost::numeric::interval<float> >, 3>;
template struct bench_3<boost::complex<boost::numeric::interval<float> >, 10>;
template struct bench_3<boost::complex<boost::numeric::interval<float> >, 30>;
template struct bench_3<boost::complex<boost::numeric::interval<float> >, 100>;
#endif
#ifdef USE_DOUBLE
template struct bench_3<boost::complex<boost::numeric::interval<double> >, 3>;
template struct bench_3<boost::complex<boost::numeric::interval<double> >, 10>;
template struct bench_3<boost::complex<boost::numeric::interval<double> >, 30>;
template struct bench_3<boost::complex<boost::numeric::interval<double> >, 100>;
#endif
#endif
| [
"ohernandezba@71d53fa2-cca5-e1f2-4b5e-677cbd06613a"
] | [
[
[
1,
221
]
]
] |
714e329ae26624a0c07651847afa676c4282a716 | fcf03ead74f6dc103ec3b07ffe3bce81c820660d | /AppFramework/UIControls/ControlFramework/inc/ControlFrameworkDocument.h | 6aaeeed63dc15939e3e207085b939e84946cb4e5 | [] | no_license | huellif/symbian-example | 72097c9aec6d45d555a79a30d576dddc04a65a16 | 56f6c5e67a3d37961408fc51188d46d49bddcfdc | refs/heads/master | 2016-09-06T12:49:32.021854 | 2010-10-14T06:31:20 | 2010-10-14T06:31:20 | 38,062,421 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 607 | h | // ControlFrameworkDocument.h
//
// Copyright (c) 2006 Symbian Software Ltd. All rights reserved.
//
#ifndef __CONTROLFRAMEWORKDOCUMENT_H
#define __CONTROLFRAMEWORKDOCUMENT_H
#include <eikdoc.h>
class CEikAppUi;
class CEikApplication;
//Document class
class CControlFrameworkDocument : public CEikDocument
{
public:
static CControlFrameworkDocument* NewL(CEikApplication& aApp);
~CControlFrameworkDocument();
private:
CControlFrameworkDocument(CEikApplication& aApp);
// from CEikDocument
CEikAppUi* CreateAppUiL();
};
#endif // __CONTROLFRAMEWORKDOCUMENT_H
| [
"liuxk99@bdc341c6-17c0-11de-ac9f-1d9250355bca"
] | [
[
[
1,
30
]
]
] |
10191ddd02378a2d2e8a503541801e6f93ebcd66 | 3472e587cd1dff88c7a75ae2d5e1b1a353962d78 | /TestLibssh2/SSH2Utils.h | c1b59b787119ffd2b50430e64f7344566bdf250f | [] | no_license | yewberry/yewtic | 9624d05d65e71c78ddfb7bd586845e107b9a1126 | 2468669485b9f049d7498470c33a096e6accc540 | refs/heads/master | 2021-01-01T05:40:57.757112 | 2011-09-14T12:32:15 | 2011-09-14T12:32:15 | 32,363,059 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,390 | h | /*
* SSH2Utils.h
*
* Created on: 2011-2-25
* Author: Yewberry
*/
#ifndef SSH2UTILS_H_
#define SSH2UTILS_H_
#include <libssh2_config.h>
#include <libssh2.h>
#include <libssh2_sftp.h>
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
# ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
//#include <sys/time.h>
#include <sys/types.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include <string>
class SSH2Utils {
public:
SSH2Utils(void) :
m_errCode(0) {
}
int init(void);
int connect(const char *hostname, const char *username,
const char *password);
void deconnect(void);
int reconnect(const char *hostname, const char *username, const char *password);
int exec(const char *cmd);
public:
~SSH2Utils(void);
int errCode() {
return m_errCode;
}
const char* errMsg() {
return ERR_MSG[m_errCode];
}
std::string execResultStr() {
return m_execResultStr;
}
int channelExitCode() {
return m_channelExitCode;
}
private:
static void kbd_callback(const char *name, int name_len,
const char *instruction, int instruction_len,
int num_prompts,
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
void **abstract);
private:
int waitsocket(void);
const char *commandline;
int m_sock;
LIBSSH2_SESSION* m_session;
int m_channelExitCode;
static const int BUF_SIZE = 0x4000;
std::string m_execResultStr;
/*
1: Libssh2 initialization failed
2: Socket connect failed
3: Session init failed
4: Failure establishing SSH session
5: Authentication by password failed
6: Authentication by keyboard-interactive failed
7: Authentication by public key failed
8: No supported authentication methods found
9: Open channel failed
10: Exec command line Error
*/
int m_errCode;
static char* ERR_MSG[];
const char *keyfile1;
const char *keyfile2;
};
#endif /* SSH2UTILS_H_ */
| [
"[email protected]@5ddc4e96-dffd-11de-b4b3-6d349e4f6f86"
] | [
[
[
1,
106
]
]
] |
d9c267c61efd69e39bd656b01e757854361b5b01 | 9d1cb48ec6f6c1f0e342f0f8f819cbda74ceba6e | /src/proxy/ProxyInfo.cpp | d7d807c792b70ade0eae54055849a4ff0865cecf | [] | no_license | correosdelbosque/veryie | e7a5ad44c68dc0b81d4afcff3be76eb8f83320ff | 6ea5a68d0a6eb6c3901b70c2dc806d1e2e2858f1 | refs/heads/master | 2021-01-10T13:17:59.755108 | 2010-06-16T04:23:26 | 2010-06-16T04:23:26 | 53,365,953 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,770 | cpp | // ProxyInfo.cpp : implementation file
//
#include "stdafx.h"
#include "VeryIE.h"
#include "ProxyInfo.h"
#include "mainfrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CProxyInfo dialog
CProxyInfo::CProxyInfo(CWnd* pParent /*=NULL*/)
: CDialog(CProxyInfo::IDD, pParent)
{
//{{AFX_DATA_INIT(CProxyInfo)
m_ProxyName = _T("");
m_Proxy = _T("");
m_Speed = 3;
//}}AFX_DATA_INIT
}
void CProxyInfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProxyInfo)
DDX_Text(pDX, IDC_NAME, m_ProxyName);
DDX_Text(pDX, IDC_PROXY, m_Proxy);
DDX_CBIndex(pDX, IDC_SPEED, m_Speed);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProxyInfo, CDialog)
//{{AFX_MSG_MAP(CProxyInfo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProxyInfo message handlers
void CProxyInfo::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if (m_ProxyName.GetLength()==0)
{
MSGBOX(IDS_NAME_NULL);
return;
}
else if (m_Proxy.GetLength()==0)
{
MSGBOX(IDS_URL_NULL);
return;
}
CDialog::OnOK();
}
BOOL CProxyInfo::OnInitDialog()
{
#ifdef _WRITE_LNG_FILE_
_WriteDlgString(this,"DialogProxyInfo");
#endif
CDialog::OnInitDialog();
#ifdef _WRITE_LNG_FILE_
_WriteDlgComboBox(this,"DialogProxyInfo");
this->OnCancel();
return TRUE;
#endif
LOADDLG("DialogProxyInfo");
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
| [
"songbohr@af2e6244-03f2-11de-b556-9305e745af9e"
] | [
[
[
1,
83
]
]
] |
6d47f5f76deb6034dc09169e3cb22d10ec0c9c68 | c25bc19757f5cdf030c20c51b5fa85b1867048ec | /Addons/MogreNewt/MogreNewt_Main/src/OgreNewt_BasicJoints.cpp | aff3f53cad170163a48fc7efd338de5574cadc9a | [] | no_license | MogreBindings/Mogre17VS2010 | 99ace77f58548c39f39725b1f7b2ce0157e13079 | 5f204dd7323a7ff64c7324bbb3ce5d2ceb461c30 | refs/heads/master | 2022-11-05T02:51:10.751168 | 2010-05-13T20:53:04 | 2010-05-13T20:53:04 | 276,068,888 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,508 | cpp | #include <Newton.h>
#include <OgreNewt_BasicJoints.h>
#include <OgreNewt_World.h>
#include <OgreNewt_Body.h>
#include "OgreNewt_Math.h"
namespace MogreNewt
{
namespace BasicJoints
{
BallAndSocket::BallAndSocket( World^ world, MogreNewt::Body^ child, MogreNewt::Body^ parent, const Mogre::Vector3 pos ) : Joint()
{
m_world = world;
if (parent)
m_joint = NewtonConstraintCreateBall( world->NewtonWorld, &pos.x, child->NewtonBody, parent->NewtonBody );
else
m_joint = NewtonConstraintCreateBall( world->NewtonWorld, &pos.x, child->NewtonBody, NULL );
m_handle = GCHandle::Alloc(this);
// all constructors inherited from Joint MUST call these 2 functions to make the joint function properly.
NewtonJointSetUserData( m_joint, GCHandle::ToIntPtr(m_handle).ToPointer() );
NewtonJointSetDestructor( m_joint, m_funcptr_destructor );
m_NewtonBallCallBackDelegate = gcnew NewtonBallCallBackDelegate( this, &BallAndSocket::NewtonCallback );
m_funcptr_newtonCallback = (NewtonBallCallBack) Marshal::GetFunctionPointerForDelegate( m_NewtonBallCallBackDelegate ).ToPointer();
}
Mogre::Vector3 BallAndSocket::JointAngle::get()
{
Mogre::Vector3 ret;
NewtonBallGetJointAngle( m_joint, &ret.x );
return ret;
}
Mogre::Vector3 BallAndSocket::JointOmega::get()
{
Mogre::Vector3 ret;
NewtonBallGetJointOmega( m_joint, &ret.x );
return ret;
}
Mogre::Vector3 BallAndSocket::JointForce::get()
{
Mogre::Vector3 ret;
NewtonBallGetJointForce( m_joint, &ret.x );
return ret;
}
void BallAndSocket::WorldUpdated::add(System::EventHandler^ hnd)
{
if (m_worldUpdated == nullptr)
{
SetNewtonCallback( m_funcptr_newtonCallback );
}
m_worldUpdated += hnd;
}
void BallAndSocket::WorldUpdated::remove(System::EventHandler^ hnd)
{
m_worldUpdated -= hnd;
if (m_worldUpdated == nullptr)
{
SetNewtonCallback( NULL );
}
}
void BallAndSocket::SetNewtonCallback( NewtonBallCallBack callback )
{
NewtonBallSetUserCallback(m_joint,callback);
}
void BallAndSocket::NewtonCallback( const NewtonJoint* ball, dFloat timestep )
{
WorldUpdated( this, EventArgs::Empty );
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
HingeSliderBase::HingeSliderBase() : Joint()
{
m_NewtonHingeCallBackDelegate = gcnew NewtonHingeCallBackDelegate( this, &HingeSliderBase::NewtonCallback );
m_funcptr_newtonCallback = (NewtonHingeCallBack) Marshal::GetFunctionPointerForDelegate( m_NewtonHingeCallBackDelegate ).ToPointer();
}
void HingeSliderBase::WorldUpdated::add(System::EventHandler^ hnd)
{
if (m_worldUpdated == nullptr)
{
SetNewtonCallback( m_funcptr_newtonCallback );
}
m_worldUpdated += hnd;
}
void HingeSliderBase::WorldUpdated::remove(System::EventHandler^ hnd)
{
m_worldUpdated -= hnd;
if (m_worldUpdated == nullptr)
{
SetNewtonCallback( NULL );
}
}
unsigned HingeSliderBase::NewtonCallback( const NewtonJoint* hinge, NewtonHingeSliderUpdateDesc* desc )
{
m_desc = desc;
m_retval = 0;
WorldUpdated( this, EventArgs::Empty );
m_desc = NULL;
return m_retval;
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
void Hinge::SetNewtonCallback( NewtonHingeCallBack callback )
{
NewtonHingeSetUserCallback( m_joint, callback );
}
Hinge::Hinge( World^ world, MogreNewt::Body^ child, MogreNewt::Body^ parent, const Mogre::Vector3 pos, const Mogre::Vector3 pin ) : HingeSliderBase()
{
m_world = world;
if (parent)
{
m_joint = NewtonConstraintCreateHinge( world->NewtonWorld, &pos.x, &pin.x,
child->NewtonBody, parent->NewtonBody );
}
else
{
m_joint = NewtonConstraintCreateHinge( world->NewtonWorld, &pos.x, &pin.x,
child->NewtonBody, NULL );
}
m_handle = GCHandle::Alloc(this);
NewtonJointSetUserData( m_joint, GCHandle::ToIntPtr(m_handle).ToPointer() );
NewtonJointSetDestructor( m_joint, m_funcptr_destructor );
}
Hinge::~Hinge()
{
}
Mogre::Vector3 Hinge::JointForce::get()
{
Mogre::Vector3 ret;
NewtonHingeGetJointForce( m_joint, &ret.x );
return ret;
}
/////// CALLBACK FUNCTIONS ///////
void Hinge::SetCallbackAccel( Mogre::Real accel )
{
if (m_desc)
{
m_retval = 1;
m_desc->m_accel = (float)accel;
}
}
void Hinge::SetCallbackFrictionMin( Mogre::Real min )
{
if (m_desc)
{
m_retval = 1;
m_desc->m_minFriction = (float)min;
}
}
void Hinge::SetCallbackFrictionMax( Mogre::Real max )
{
if (m_desc)
{
m_retval = 1;
m_desc->m_maxFriction = (float)max;
}
}
Mogre::Real Hinge::CallbackTimestep::get()
{
if (m_desc)
return (Mogre::Real)m_desc->m_timestep;
else
return 0.0;
}
Mogre::Real Hinge::CalculateStopAlpha( Mogre::Radian angle )
{
if (m_desc)
return (Mogre::Real)NewtonHingeCalculateStopAlpha( m_joint, m_desc, (float)angle.ValueRadians );
else
return 0.0;
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
void Slider::SetNewtonCallback( NewtonHingeCallBack callback )
{
NewtonSliderSetUserCallback( m_joint, callback );
}
Slider::Slider( World^ world, MogreNewt::Body^ child, MogreNewt::Body^ parent, const Mogre::Vector3 pos, const Mogre::Vector3 pin ) : HingeSliderBase()
{
m_world = world;
if (parent)
{
m_joint = NewtonConstraintCreateSlider( world->NewtonWorld, &pos.x, &pin.x,
child->NewtonBody, parent->NewtonBody );
}
else
{
m_joint = NewtonConstraintCreateSlider( world->NewtonWorld, &pos.x, &pin.x,
child->NewtonBody, NULL );
}
m_handle = GCHandle::Alloc(this);
NewtonJointSetUserData( m_joint, GCHandle::ToIntPtr(m_handle).ToPointer() );
NewtonJointSetDestructor( m_joint, m_funcptr_destructor );
}
Slider::~Slider()
{
}
Mogre::Vector3 Slider::JointForce::get()
{
Mogre::Vector3 ret;
NewtonSliderGetJointForce( m_joint, &ret.x );
return ret;
}
/////// CALLBACK FUNCTIONS ///////
void Slider::SetCallbackAccel( Mogre::Real accel )
{
if (m_desc)
{
m_retval = 1;
m_desc->m_accel = (float)accel;
}
}
void Slider::SetCallbackFrictionMin( Mogre::Real min )
{
if (m_desc)
{
m_retval = 1;
m_desc->m_minFriction = (float)min;
}
}
void Slider::SetCallbackFrictionMax( Mogre::Real max )
{
if (m_desc)
{
m_retval = 1;
m_desc->m_maxFriction = (float)max;
}
}
Mogre::Real Slider::CallbackTimestep::get()
{
if (m_desc)
return (Mogre::Real)m_desc->m_timestep;
else
return 0.0;
}
Mogre::Real Slider::CalculateStopAccel( Mogre::Real dist )
{
if (m_desc)
return (Mogre::Real)NewtonSliderCalculateStopAccel( m_joint, m_desc, (float)dist );
else
return 0.0;
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
void Universal::SetNewtonCallback( NewtonHingeCallBack callback )
{
NewtonUniversalSetUserCallback( m_joint, callback );
}
Universal::Universal( World^ world, MogreNewt::Body^ child, MogreNewt::Body^ parent, const Mogre::Vector3 pos, const Mogre::Vector3 pin0, const Mogre::Vector3 pin1 ) : HingeSliderBase()
{
m_world = world;
if (parent)
{
m_joint = NewtonConstraintCreateUniversal( world->NewtonWorld, &pos.x, &pin0.x, &pin1.x,
child->NewtonBody, parent->NewtonBody );
}
else
{
m_joint = NewtonConstraintCreateUniversal( world->NewtonWorld, &pos.x, &pin0.x, &pin1.x,
child->NewtonBody, NULL );
}
m_handle = GCHandle::Alloc(this);
NewtonJointSetUserData( m_joint, GCHandle::ToIntPtr(m_handle).ToPointer() );
NewtonJointSetDestructor( m_joint, m_funcptr_destructor );
}
Universal::~Universal()
{
}
Mogre::Vector3 Universal::JointForce::get()
{
Mogre::Vector3 ret;
NewtonUniversalGetJointForce( m_joint, &ret.x );
return ret;
}
/////// CALLBACK FUNCTIONS ///////
void Universal::SetCallbackAccel( Mogre::Real accel, unsigned int axis )
{
if (axis > 1) { return; }
if (m_desc)
{
m_retval |= axis;
m_desc[axis].m_accel = (float)accel;
}
}
void Universal::SetCallbackFrictionMax( Mogre::Real max, unsigned int axis )
{
if (axis > 1) { return; }
if (m_desc)
{
m_retval |= axis;
m_desc[axis].m_maxFriction = (float)max;
}
}
void Universal::SetCallbackFrictionMin( Mogre::Real min, unsigned int axis )
{
if (axis > 1) { return; }
if (m_desc)
{
m_retval |= axis;
m_desc[axis].m_minFriction = (float)min;
}
}
Mogre::Real Universal::CallbackTimestep::get()
{
if (m_desc)
return (Mogre::Real)m_desc->m_timestep;
else
return 0.0;
}
Mogre::Real Universal::CalculateStopAlpha0( Mogre::Real angle )
{
if (m_desc)
return (Mogre::Real)NewtonUniversalCalculateStopAlpha0( m_joint, m_desc, (float)angle );
else
return 0.0;
}
Mogre::Real Universal::CalculateStopAlpha1( Mogre::Real angle )
{
if (m_desc)
return (Mogre::Real)NewtonUniversalCalculateStopAlpha1( m_joint, m_desc, (float)angle );
else
return 0.0;
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
UpVector::UpVector( World^ world, Body^ body, const Mogre::Vector3 pin )
{
m_world = world;
m_joint = NewtonConstraintCreateUpVector( world->NewtonWorld, &pin.x, body->NewtonBody );
m_handle = GCHandle::Alloc(this);
NewtonJointSetUserData( m_joint, GCHandle::ToIntPtr(m_handle).ToPointer() );
NewtonJointSetDestructor( m_joint, m_funcptr_destructor );
}
UpVector::~UpVector()
{
}
Mogre::Vector3 UpVector::Pin::get()
{
Mogre::Vector3 ret;
NewtonUpVectorGetPin( m_joint, &ret.x );
return ret;
}
} // end NAMESPACE BasicJoints
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
namespace PrebuiltCustomJoints
{
Custom2DJoint::Custom2DJoint(MogreNewt::Body^ body, const Mogre::Vector3 pin ) : CustomJoint( 4, body, nullptr )
{
mPin = pin;
Mogre::Quaternion bodyorient;
Mogre::Vector3 bodypos;
body->GetPositionOrientation( bodypos, bodyorient );
pinAndDirToLocal( bodypos, pin, mLocalOrient0, mLocalPos0, mLocalOrient1, mLocalPos1 );
// initialize variables
mMin = mMax = Mogre::Degree(0);
mLimitsOn = false;
mAccel = 0.0f;
}
void Custom2DJoint::SubmitConstraint(Mogre::Real timeStep, int threadIndex)
{
// get the global orientations.
Mogre::Quaternion globalOrient0, globalOrient1;
Mogre::Vector3 globalPos0, globalPos1;
localToGlobal( mLocalOrient0, mLocalPos0, globalOrient0, globalPos0, 0 );
localToGlobal( mLocalOrient1, mLocalPos1, globalOrient1, globalPos1, 1 );
// calculate all main 6 vectors.
Mogre::Vector3 bod0X = globalOrient0 * Mogre::Vector3( Mogre::Vector3::UNIT_X );
Mogre::Vector3 bod0Y = globalOrient0 * Mogre::Vector3( Mogre::Vector3::UNIT_Y );
Mogre::Vector3 bod0Z = globalOrient0 * Mogre::Vector3( Mogre::Vector3::UNIT_Z );
Mogre::Vector3 bod1X = globalOrient1 * Mogre::Vector3( Mogre::Vector3::UNIT_X );
Mogre::Vector3 bod1Y = globalOrient1 * Mogre::Vector3( Mogre::Vector3::UNIT_Y );
Mogre::Vector3 bod1Z = globalOrient1 * Mogre::Vector3( Mogre::Vector3::UNIT_Z );
//Mogre::LogManager::Singleton->LogMessage(" Submit Constraint bod0X:"+ bod0X +
// " bod1X:"+ bod1X );
// ---------------------------------------------------------------
// first add a linear row to keep the body on the plane.
addLinearRow( globalPos0, globalPos1, bod0X );
// have we strayed from the plane along the normal?
Mogre::Plane thePlane( bod0X, globalPos0 );
Mogre::Real stray = thePlane.GetDistance( globalPos1 );
if (stray > 0.0001f)
{
// we have strayed, apply acceleration to move back to 0 in one timestep.
Mogre::Real accel = (stray / timeStep);
if (thePlane.GetSide( globalPos1 ) == Mogre::Plane::Side::NEGATIVE_SIDE) { accel = -accel; }
setRowAcceleration( accel );
}
// see if the main axis (pin) has wandered off.
Mogre::Vector3 latDir = bod0X.CrossProduct( bod1X );
Mogre::Real latMag = latDir.SquaredLength;
if (latMag > 1.0e-6f)
{
// has wandered a bit, we need to correct. first find the angle off.
latMag = System::Math::Sqrt( latMag );
latDir.Normalise();
Mogre::Radian angle = MogreNewt::Math::ASin( latMag );
// ---------------------------------------------------------------
addAngularRow( angle, latDir );
// ---------------------------------------------------------------
// secondary correction for stability.
Mogre::Vector3 latDir2 = latDir.CrossProduct( bod1X );
addAngularRow( Mogre::Radian(0.0f), latDir2 );
}
else
{
// ---------------------------------------------------------------
// no major change, just add 2 simple constraints.
addAngularRow( Mogre::Radian(0.0f), bod1Y );
addAngularRow( Mogre::Radian(0.0f), bod1Z );
}
// calculate the current angle.
Mogre::Real cos = bod0Y.DotProduct( bod1Y );
Mogre::Real sin = (bod0Y.CrossProduct( bod1Y )).DotProduct( bod0X );
mAngle = Mogre::Radian(System::Math::Atan2( sin, cos));
if (mLimitsOn)
{
if (mAngle > mMax)
{
Mogre::Radian diff = mAngle - mMax;
addAngularRow( diff, bod0X );
setRowStiffness( 1.0f );
}
else if (mAngle < mMin)
{
Mogre::Radian diff = mAngle - mMin;
addAngularRow( diff, bod0X );
setRowStiffness( 1.0f );
}
}
else
{
if (mAccel != 0.0f)
{
addAngularRow( Mogre::Radian(0.0f), bod0X );
setRowAcceleration( mAccel );
mAccel = 0.0f;
}
}
}
CustomRigidJoint::CustomRigidJoint(MogreNewt::Body^ child, MogreNewt::Body^ parent, Mogre::Vector3 dir, Mogre::Vector3 pos) : MogreNewt::CustomJoint(6,child,parent)
{
// calculate local offsets.
pinAndDirToLocal( pos, dir, mLocalOrient0, mLocalPos0, mLocalOrient1, mLocalPos1 );
}
CustomRigidJoint::~CustomRigidJoint()
{
}
void CustomRigidJoint::SubmitConstraint(Mogre::Real timeStep, int threadIndex)
{
// get globals.
Mogre::Vector3 globalPos0, globalPos1;
Mogre::Quaternion globalOrient0, globalOrient1;
localToGlobal( mLocalOrient0, mLocalPos0, globalOrient0, globalPos0, 0 );
localToGlobal( mLocalOrient1, mLocalPos1, globalOrient1, globalPos1, 1 );
// apply the constraints!
addLinearRow( globalPos0, globalPos1, globalOrient0 * Mogre::Vector3::UNIT_X );
addLinearRow( globalPos0, globalPos1, globalOrient0 * Mogre::Vector3::UNIT_Y );
addLinearRow( globalPos0, globalPos1, globalOrient0 * Mogre::Vector3::UNIT_Z );
// now find a point off 10 units away.
globalPos0 = globalPos0 + (globalOrient0 * (Mogre::Vector3::UNIT_X * 10.0f));
globalPos1 = globalPos1 + (globalOrient1 * (Mogre::Vector3::UNIT_X * 10.0f));
// apply the constraints!
addLinearRow( globalPos0, globalPos1, globalOrient0 * Mogre::Vector3::UNIT_Y );
addLinearRow( globalPos0, globalPos1, globalOrient0 * Mogre::Vector3::UNIT_Z );
Mogre::Vector3 xdir0 = globalOrient0 * Mogre::Vector3::UNIT_X;
Mogre::Vector3 xdir1 = globalOrient1 * Mogre::Vector3::UNIT_X;
Mogre::Radian angle = MogreNewt::Math::ACos( xdir0.DotProduct( xdir1 ) );
addAngularRow( angle, globalOrient0 * Mogre::Vector3::UNIT_X );
}
/*
CustomPulleyJoint::CustomPulleyJoint( Mogre::Real gearRatio, Body^ parent, Body^ child, const Mogre::Vector3 parentPin, const Mogre::Vector3 childPin ) : MogreNewt::CustomJoint(1, parent, child)
{
mGearRatio = gearRatio;
Mogre::Vector3 dummyPos;
Mogre::Quaternion dummyOrient;
Mogre::Vector3 pivot(0.0f, 0.0f, 0.0f);
// calculate local matrices. in this case we have 2 pins, so we call twice, once for each body.
pinAndDirToLocal( pivot, parentPin, mLocalOrient0, mLocalPos0, dummyOrient, dummyPos );
pinAndDirToLocal( pivot, childPin, dummyOrient, dummyPos, mLocalOrient1, mLocalPos1 );
}
void CustomPulleyJoint::SubmitConstraint()
{
Mogre::Real w0, w1;
Mogre::Real deltat;
Mogre::Real relAccel, relVel;
Mogre::Vector3 vel0, vel1;
Mogre::Vector3 globalPos0, globalPos1;
Mogre::Quaternion globalOrient0, globalOrient1;
Mogre::Vector3 xdir0, xdir1;
// get global matrices.
localToGlobal( mLocalOrient0, mLocalPos0, globalOrient0, globalPos0, 0);
localToGlobal( mLocalOrient1, mLocalPos1, globalOrient1, globalPos1, 1);
xdir0 = globalOrient0 * Mogre::Vector3(Mogre::Vector3::UNIT_X);
xdir1 = globalOrient1 * Mogre::Vector3(Mogre::Vector3::UNIT_X);
// velocities for both bodies.
vel0 = m_body0->Velocity;
vel1 = m_body1->Velocity;
// relative angular velocity.
w0 = vel0.DotProduct( xdir0 );
w1 = vel1.DotProduct( xdir1 );
// relative velocity.
relVel = w0 + (mGearRatio * w1);
deltat = m_body0->World->TimeStep;
relAccel = relVel / deltat;
addGeneralRow( xdir0, Mogre::Vector3::ZERO, xdir1, Mogre::Vector3::ZERO );
setRowAcceleration( relAccel );
}
CustomGearJoint::CustomGearJoint(Mogre::Real gearRatio, MogreNewt::Body^ parent, MogreNewt::Body^ child, const Mogre::Vector3 parentPin, const Mogre::Vector3 childPin) : MogreNewt::CustomJoint(1, parent, child)
{
mGearRatio = gearRatio;
Mogre::Vector3 dummyPos;
Mogre::Quaternion dummyOrient;
Mogre::Vector3 pivot(0.0f, 0.0f, 0.0f);
// calculate local matrices. in this case we have 2 pins, so we call twice, once for each body.
pinAndDirToLocal( pivot, parentPin, mLocalOrient0, mLocalPos0, dummyOrient, dummyPos );
pinAndDirToLocal( pivot, childPin, dummyOrient, dummyPos, mLocalOrient1, mLocalPos1 );
}
void CustomGearJoint::SubmitConstraint()
{
Mogre::Real w0, w1;
Mogre::Real deltat;
Mogre::Real relAccel, relOmega;
Mogre::Vector3 omega0, omega1;
Mogre::Vector3 globalPos0, globalPos1;
Mogre::Quaternion globalOrient0, globalOrient1;
Mogre::Vector3 xdir0, xdir1;
// get global matrices.
localToGlobal( mLocalOrient0, mLocalPos0, globalOrient0, globalPos0, 0);
localToGlobal( mLocalOrient1, mLocalPos1, globalOrient1, globalPos1, 1);
xdir0 = globalOrient0 * Mogre::Vector3(Mogre::Vector3::UNIT_X);
xdir1 = globalOrient1 * Mogre::Vector3(Mogre::Vector3::UNIT_X);
// velocities for both bodies.
omega0 = m_body0->Omega;
omega1 = m_body1->Omega;
// relative angular velocity.
w0 = omega0.DotProduct( xdir0 );
w1 = omega1.DotProduct( xdir1 );
// relative velocity.
relOmega = w0 + (mGearRatio * w1);
deltat = m_body0->World->TimeStep;
relAccel = - relOmega / deltat;
addGeneralRow( Mogre::Vector3::ZERO, xdir0, Mogre::Vector3::ZERO, xdir1 );
setRowAcceleration( relAccel );
}
*/
} // end NAMESPACE PrebuiltCustomJoints
} // end namespace MogreNewt
| [
"gantz@localhost"
] | [
[
[
1,
745
]
]
] |
07343d1c3f306a8492118fdef36a256e24047476 | fb16850c6d70f89751d75413b9c16a7a72821c39 | /src/modules/graphics/opengl/wrap_Image.cpp | a584fdc98c05e453f569176892fe3243acb9803f | [
"Zlib"
] | permissive | tst2005/love | b5e852cc538c957e773cdf14f76d71263887f066 | bdec6facdf6054d24c89bea10b1f6146d89da11f | refs/heads/master | 2021-01-15T12:36:17.510573 | 2010-05-23T22:30:38 | 2010-05-23T22:30:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,607 | cpp | /**
* Copyright (c) 2006-2010 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.
**/
// LOVE
#include "wrap_Image.h"
namespace love
{
namespace graphics
{
namespace opengl
{
Image * luax_checkimage(lua_State * L, int idx)
{
return luax_checktype<Image>(L, idx, "Image", GRAPHICS_IMAGE_T);
}
int w_Image_getWidth(lua_State * L)
{
Image * t = luax_checkimage(L, 1);
lua_pushnumber(L, t->getWidth());
return 1;
}
int w_Image_getHeight(lua_State * L)
{
Image * t = luax_checkimage(L, 1);
lua_pushnumber(L, t->getHeight());
return 1;
}
int w_Image_setFilter(lua_State * L)
{
Image * t = luax_checkimage(L, 1);
Image::Filter f;
Image::FilterMode min;
Image::FilterMode mag;
const char * minstr = luaL_checkstring(L, 2);
const char * magstr = luaL_checkstring(L, 3);
if (!Image::getConstant(minstr, min))
return luaL_error(L, "Invalid filter mode: %s", minstr);
if (!Image::getConstant(magstr, mag))
return luaL_error(L, "Invalid filter mode: %s", magstr);
f.min = min;
f.mag = mag;
t->setFilter(f);
return 0;
}
int w_Image_getFilter(lua_State * L)
{
Image * t = luax_checkimage(L, 1);
Image::Filter f = t->getFilter();
Image::FilterMode min = f.min;
Image::FilterMode mag = f.mag;
const char * minstr;
const char * magstr;
Image::getConstant(min, minstr);
Image::getConstant(mag, magstr);
lua_pushstring(L, minstr);
lua_pushstring(L, magstr);
return 2;
}
int w_Image_setWrap(lua_State * L)
{
Image * i = luax_checkimage(L, 1);
Image::Wrap w;
Image::WrapMode s;
Image::WrapMode t;
const char * sstr = luaL_checkstring(L, 2);
const char * tstr = luaL_checkstring(L, 3);
if (!Image::getConstant(sstr, s))
return luaL_error(L, "Invalid wrap mode: %s", sstr);
if (!Image::getConstant(tstr, t))
return luaL_error(L, "Invalid wrap mode, %s", tstr);
w.s = s;
w.t = t;
i->setWrap(w);
return 0;
}
int w_Image_getWrap(lua_State * L)
{
Image * i = luax_checkimage(L, 1);
Image::Wrap w = i->getWrap();
Image::WrapMode s = w.s;
Image::WrapMode t = w.t;
const char * sstr;
const char * tstr;
Image::getConstant(s, sstr);
Image::getConstant(t, tstr);
lua_pushstring(L, sstr);
lua_pushstring(L, tstr);
return 2;
}
static const luaL_Reg functions[] = {
{ "getWidth", w_Image_getWidth },
{ "getHeight", w_Image_getHeight },
{ "setFilter", w_Image_setFilter },
{ "getFilter", w_Image_getFilter },
{ "setWrap", w_Image_setWrap },
{ "getWrap", w_Image_getWrap },
{ 0, 0 }
};
int luaopen_image(lua_State * L)
{
return luax_register_type(L, "Image", functions);
}
} // opengl
} // graphics
} // love
| [
"none@none",
"[email protected]"
] | [
[
[
1,
50
],
[
52,
52
],
[
64,
71
],
[
80,
84
],
[
86,
86
],
[
99,
103
],
[
114,
134
]
],
[
[
51,
51
],
[
53,
63
],
[
72,
79
],
[
85,
85
],
[
87,
98
],
[
104,
113
]
]
] |
443e8b9cf18273e55dc822c5a2f1fbf56b6d105a | 2139c9f6c7d201e394631dfd54a3e658269e9e68 | /PostProcessing/PostProcessingException.h | 47eb1578eccd8be3556e19dba0a4883866ff08a8 | [] | no_license | OpenEngineDK/branches-PostProcessing | 294b87604d8d8e73b12ab7a6fd704a83ca33f3c9 | 2497ce3879973c410469618d2cf01b051bd4edbb | refs/heads/master | 2020-12-24T21:10:50.209919 | 2009-04-27T10:12:37 | 2009-04-27T10:12:37 | 58,073,279 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 564 | h | #ifndef __POSTPROCESSINGEXCEPTION_H__
#define __POSTPROCESSINGEXCEPTION_H__
#include <Core/Exceptions.h>
namespace OpenEngine {
namespace PostProcessing {
using OpenEngine::Core::Exception;
using std::string;
/** Exception used by post-processing classes
* @author Bjarke N. Laustsen
*/
class PostProcessingException : public Exception {
public:
PostProcessingException();
PostProcessingException(std::string msg);
virtual ~PostProcessingException() throw () {}
};
} // NS PostProcessing
} // NS OpenEngine
#endif
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
17
],
[
19,
26
]
],
[
[
18,
18
]
]
] |
3b7ad9e86ec00cf82243afd7328803c566a7d6ba | 335783c9e5837a1b626073d1288b492f9f6b057f | /source/fbxcmd/daolib/Model/MAO/MaterialObject.h | 17262dd07eb49290ec49511e3e5169bfb1d815b6 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | code-google-com/fbx4eclipse | 110766ee9760029d5017536847e9f3dc09e6ebd2 | cc494db4261d7d636f8c4d0313db3953b781e295 | refs/heads/master | 2016-09-08T01:55:57.195874 | 2009-12-03T20:35:48 | 2009-12-03T20:35:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,910 | h | /**********************************************************************
*<
FILE: MaterialObject.h
DESCRIPTION: MaterialObject File Format
HISTORY:
*> Copyright (c) 2009, All Rights Reserved.
**********************************************************************/
#pragma once
#include "MAO/MAOCommon.h"
#include "MATFormat.h"
#include "boost/any.hpp"
#include "boost/variant.hpp"
namespace DAO {
typedef std::map<_tstring, boost::any, ltstr> ParameterSet;
typedef std::map<_tstring, ParameterSet, ltstr> ParameterSets;
namespace MAO {
class Texture
{
public:
_tstring resName;
};
class Material
{
public:
_tstring name;
ParameterSets sets;
};
class MaterialObject
{
public:
_tstring Name;
_tstring Material;
_tstring DefaultSemantic;
ParameterSet ParameterDefaults;
ParameterSet ParameterOverrides;
void loadSettingsFromMaterial( DAO::MAT::MaterialRef material );
const boost::any& asAny(LPCTSTR param);
_tstring asText(LPCTSTR param);
signed char asInt8(LPCTSTR param);
unsigned char asUInt8(LPCTSTR param);
signed short asInt16(LPCTSTR param);
unsigned short asUInt16(LPCTSTR param);
signed long asInt32(LPCTSTR param);
unsigned long asUInt32(LPCTSTR param);
signed __int64 asInt64(LPCTSTR param);
unsigned __int64 asUInt64(LPCTSTR param);
float asFloat32(LPCTSTR param);
double asFloat64(LPCTSTR param);
Vector2f asVector2f(LPCTSTR param);
Vector3f asVector3f(LPCTSTR param);
Vector4f asVector4f(LPCTSTR param);
Vector2fArray asVector2fArray(LPCTSTR param);
Vector3fArray asVector3fArray(LPCTSTR param);
Vector4fArray asVector4fArray(LPCTSTR param);
Quaternion asQuat(LPCTSTR param);
Color4 asColor4(LPCTSTR param);
Matrix44 asMatrix4(LPCTSTR param);
Texture asTexture(LPCTSTR param);
};
typedef ValueRef<MaterialObject> MaterialObjectRef;
} // namespace MAO
} // namespace DAO
| [
"tazpn314@ccf8930c-dfc1-11de-9043-17b7bd24f792"
] | [
[
[
1,
80
]
]
] |
048ad2bbfca1be603369f3b0f4b156ded32f7c14 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /SMDK/RTTS/TS_ModelLib/PlugFlowSurge.cpp | 6c34cdb7dd8e1aea2d6cdf5f9962093efe9fd647 | [] | no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,011 | cpp | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
#include "stdafx.h"
#define __PlugFlowSurge_CPP
#include "PlugFlowSurge.h"
//====================================================================================
// Efficiency Curve
//====================================================================================
CSurge_PlugFlow::CSurge_PlugFlow()
{
}
void CSurge_PlugFlow::BuildDataFields(MDataDefn &DB)
{
DB.ObjectBegin("TS_PlugFlow", "PlugFlow");
DB.Text("Plug Flow");
DB.ObjectEnd();
}
//====================================================================================
void CSurge_PlugFlow::EvalProducts(MStream &Feed ,
MStream &Product,
bool bInit)
{
}
//====================================================================================
| [
"[email protected]"
] | [
[
[
1,
41
]
]
] |
45163e505dce02ed4ab2b2fdde9f4b995a65d590 | 164ad25eca017ebc51ae72d46dd1f19f722c0c21 | /include/OsgQtBrowser/QGraphicsViewAdapter.h | 22313a09f3654b9d5e20a444e7e3cd9487bdf9c2 | [] | no_license | jaro-prokop/3dsoftviz | 5cdcaa15158acdb335a441073ca2d26e1cd5b46d | 77332ef847529a8617247754c94621ebc6a90d2c | refs/heads/master | 2021-01-16T20:23:24.894745 | 2011-05-02T09:00:39 | 2011-05-02T09:00:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,172 | h | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* 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
* OpenSceneGraph Public License for more details.
*/
#ifndef QGRAPHICSVIEWADAPTER
#define QGRAPHICSVIEWADAPTER
#include <osg/Image>
#include <osg/observer_ptr>
#include <QtWebKit/QWebSettings>
#include <QtWebKit/QtWebKit>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsView>
#include <QtGui/QApplication>
#include <QtGui/QPainter>
#include <QtGui/QtEvents>
extern QCoreApplication* getOrCreateQApplication();
/**
* \class QGraphicsViewAdapter
* \brief
* \author Adam Pazitnaj
* \date 29. 4. 2010
*/
class QGraphicsViewAdapter : public QObject
{
Q_OBJECT
public:
/**
* \fn public constructor QGraphicsViewAdapter
* \brief
* \param [in, out] image osg::Image *
* \param [in, out] widget QWidget *
*/
QGraphicsViewAdapter(osg::Image* image, QWidget* widget);
/**
* \fn public setUpKeyMap
* \brief
*/
void setUpKeyMap();
/**
* \fn public sendPointerEvent
* \brief
* \param [in] x int
* \param [in] y int
* \param [in] buttonMask int
* \return bool
*/
bool sendPointerEvent(int x, int y, int buttonMask);
/**
* \fn public sendKeyEvent
* \brief
* \param [in] key int
* \param [in] keyDown bool
* \return bool
*/
bool sendKeyEvent(int key, bool keyDown);
/**
* \fn public setFrameLastRendered
* \brief
* \param [in] frameStamp const osg::FrameStamp *
*/
void setFrameLastRendered(const osg::FrameStamp* frameStamp);
/**
* \fn public clearWriteBuffer
* \brief
*/
void clearWriteBuffer();
/**
* \fn public render
* \brief
*/
void render();
/**
* \fn public assignImage
* \brief
* \param [in] i unsigned int
*/
void assignImage(unsigned int i);
protected:
/**
* \fn protected handlePointerEvent
* \brief
* \param [in] x int
* \param [in] y int
* \param [in] buttonMask int
* \return bool
*/
bool handlePointerEvent(int x, int y, int buttonMask);
/**
* \fn protected handleKeyEvent
* \brief
* \param [in] key int
* \param [in] keyDown bool
* \return bool
*/
bool handleKeyEvent(int key, bool keyDown);
/**
* osg::observer_ptr<osg::Image> _image
* \brief
*/
osg::observer_ptr<osg::Image> _image;
/**
* unsigned int _previousButtonMask
* \brief
*/
unsigned int _previousButtonMask;
/**
* int _previousMouseX
* \brief
*/
int _previousMouseX;
/**
* int _previousMouseY
* \brief
*/
int _previousMouseY;
typedef std::map<int, Qt::Key> KeyMap;
/**
* QGraphicsViewAdapter::KeyMap _keyMap
* \brief
*/
KeyMap _keyMap;
/**
* Qt::KeyboardModifiers _qtKeyModifiers
* \brief
*/
Qt::KeyboardModifiers _qtKeyModifiers;
/**
* QColor _backgroundColor
* \brief
*/
QColor _backgroundColor;
/**
* QPointer<QGraphicsView> _graphicsView
* \brief
*/
QPointer<QGraphicsView> _graphicsView;
/**
* QPointer<QGraphicsScene> _graphicsScene
* \brief
*/
QPointer<QGraphicsScene> _graphicsScene;
/**
* OpenThreads::Mutex _qimagesMutex
* \brief
*/
OpenThreads::Mutex _qimagesMutex;
/**
* unsigned int _previousFrameNumber
* \brief
*/
unsigned int _previousFrameNumber;
/**
* bool _newImageAvailable
* \brief
*/
bool _newImageAvailable;
/**
* unsigned int _currentRead
* \brief
*/
unsigned int _currentRead;
/**
* unsigned int _currentWrite
* \brief
*/
unsigned int _currentWrite;
/**
* unsigned int _previousWrite
* \brief
*/
unsigned int _previousWrite;
/**
* QImage [3] _qimages
* \brief
*/
QImage _qimages[3];
/**
* \fn protected virtual customEvent
* \brief
* \param [in, out] event QEvent *
*/
virtual void customEvent ( QEvent * event ) ;
private slots:
/**
* \fn private repaintRequestedSlot
* \brief
* \param [in] regions const QList<QRectF> &
*/
void repaintRequestedSlot(const QList<QRectF> ®ions);
};
#endif | [
"kapec@genepool.(none)"
] | [
[
[
1,
250
]
]
] |
88e69b4d3a561c615dbfa98fe5187a33f0be087e | 38664d844d9fad34e88160f6ebf86c043db9f1c5 | /branches/initialize/infostudio/studio/studio.cpp | 0e5ddf874b9510f073d5c4c1e6e165b1e985ff2d | [] | no_license | cnsuhao/jezzitest | 84074b938b3e06ae820842dac62dae116d5fdaba | 9b5f6cf40750511350e5456349ead8346cabb56e | refs/heads/master | 2021-05-28T23:08:59.663581 | 2010-11-25T13:44:57 | 2010-11-25T13:44:57 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,994 | cpp | // studio.cpp : main source file for studio.exe
//
// #define LOGGING 0
#include "stdafx.h"
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include <atlctrlw.h>
#include <atlsplit.h>
#include "engine/infoengine.h"
#include "engine/wndrunner.h"
#include "data/studiodata.h"
#include "data/basedata.h"
#include "base/logging.h"
#include "data/mutabledata.h"
#include "base/asynchttp.h"
#include "resource.h"
#include "leftv.h"
#include "aboutdlg.h"
#include "MainFrm.h"
CAppModule _Module;
struct foo
{
foo() {
// __asm int 3;
}
};
std::ostream & operator<<(std::ostream & os, const foo& f)
{
return os;
}
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
LogMessage::LogThreads(true);
LogMessage::LogTimestamps(true);
LogMessage::LogToDebug(LS_VERBOSE);
LOG(LS_VERBOSE) << "verbose test";
// env
xnbase::AsyncInet::Init();
// login, config
//
// EngineCrank
// base / mutable data
// 如此多的栈对象,找到更合适的方法
// base / mutable 数据库必须分开
// 1 Data
StudioData data;
bool f = data.Open(L"studio.db");
ASSERT(f);
// BaseData bd(data.basecon_);
// f = bd.Init(data.basecon_);
// ASSERT(f);
//
// MutableData md(data.mutablecon_);
// f = md.Init(data.mutablecon_);
// ASSERT(f);
// 2 Engine
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
WindowPump pump;
HWND h = pump.Create(0);
ATLASSERT(h);
EngineCrank crank;
// crank.Run(&pump);
// 3 UI
CMainFrame wndMain(crank);
wndMain.InitData(&data);
if(wndMain.CreateEx() == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
wndMain.ShowWindow(nCmdShow);
int nRet = theLoop.Run();
// TODO:
// crank.Stop();
pump.DestroyWindow();
_Module.RemoveMessageLoop();
xnbase::AsyncInet::Release();
return nRet;
}
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpstrCmdLine
, int nCmdShow)
{
HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
// add flags to support other controls
AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
::CoUninitialize();
return nRet;
}
int main(int, char**)
{
_tWinMain((HINSTANCE)GetModuleHandle(0), 0, L"", 0);
return 0;
}
| [
"ken.shao@ba8f1dc9-3c1c-0410-9eed-0f8a660c14bd"
] | [
[
[
1,
139
]
]
] |
9acb38dfacb62afeeb6adb288b4c3cbbc98c6c14 | 5399d84eea74f2d848a7fcb2f1c9c33798619ff1 | /src/main.cpp | 408e774490a79d129bd4d84007094e8032cb3e25 | [] | no_license | andriusm/DiskPie | 9045c8d7afffc02e0688973f9d59b52427db4b84 | 2544ad54d72493ddd85849b639d786dd7d1d43f1 | refs/heads/master | 2020-05-29T20:33:18.739327 | 2011-02-03T12:08:50 | 2011-02-03T12:08:50 | 1,316,089 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,908 | cpp | #include <stdio.h>
#include <math.h>
#include <GL/glfw.h>
#include "FileGraph.h"
FileGraph fg;
int maxDepth = 0;
int width, height;
int centerX, centerY;
bool running = true;
const int circleWidth = 60;
const int circleWidthSquared = circleWidth * circleWidth;
void drawGraph(DirList dl);
void drawScene();
void glKill();
bool dirComparator (DirList a, DirList b)
{
return (a.fcount >= b.fcount);
}
void GLFWCALL resizeWindow(int nWidth, int nHeight)
{
width = nWidth;
height = nHeight;
height = height > 0 ? height : 1;
centerX = width / 2;
centerY = height / 2;
//drawScene();
}
void GLFWCALL refreshWindow(void)
{
//drawScene();
}
void checkHover(int mradius, double angle, DirList *dl)
{
int dirCnt = dl->dirs.size();
for(int i=0; i<dirCnt; i++)
{
int inner = (dl->dirs[i].depth + 0) * circleWidth;
inner *= inner;
int outter = (dl->dirs[i].depth + 1) * circleWidth;
outter *= outter;
//cout << inner << " < " << mradius << " < " << outter << " = " << (mradius > inner && mradius < outter) << dl.dirs[i].dirname << endl;
if(mradius > inner && mradius < outter
&& angle > dl->dirs[i].sector.startAngle
&& angle < (dl->dirs[i].sector.startAngle + dl->dirs[i].sector.angle)
)
{
dl->dirs[i].sector.highlighted = TRUE;
}
else
{
dl->dirs[i].sector.highlighted = FALSE;
}
checkHover(mradius, angle, &dl->dirs[i]);
}
}
void GLFWCALL mousePosChanged(int mx, int my)
{
//prepare the squared mouse position values
mx -= centerX;
my -= centerY;
double angle = atan2(my, mx);
mx *= mx;
my *= my;
//get the angle of the mouse pointer position
angle = angle * 180 / M_PI + 90;
angle += 360;
if(angle>=360) angle -= 360;
checkHover(mx + my, angle, &fg.dl);
}
void GLFWCALL keyPressed(int key, int action)
{
if(key==GLFW_KEY_ESC)
{
glKill();
}
}
void drawScene()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluOrtho2D( 0, width, 0, height );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glTranslated(centerX, centerY, -1);
drawGraph(fg.dl);
glPopMatrix();
glfwSwapBuffers();
}
int glInit()
{
glfwInit();
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 0);
if( !glfwOpenWindow( 700, 700, 0, 0, 0, 0, 0, 0, GLFW_WINDOW ) )
{
glfwTerminate();
return -1;
}
glfwSetWindowTitle("Disk Pie");
glfwSwapInterval(1);
glShadeModel(GL_SMOOTH);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glClearColor( 1.0f, 1.0f, 1.0f, 0.0f );
return 0;
}
void glKill()
{
glfwTerminate();
exit(0);
}
void DrawSector( double nStartAngle, double nAngle, double nStartRadius, double nRadius, int nColor, bool bLit )
{
GLUquadricObj *quadObj;
quadObj= gluNewQuadric();
if(quadObj)
{
glPushMatrix();
long slices=(long)(nAngle/3.0);
slices= (slices >1 ?slices:2);
gluQuadricDrawStyle( quadObj, GLU_SILHOUETTE );
glColor3ub(0, 0, 0);
gluPartialDisk( quadObj, nStartRadius, nRadius, slices, 1, nStartAngle, nAngle );
//---
if(!bLit) glColor3ub(255 - nColor, 240, 220 - nColor);
else glColor3ub(255, 0, 0);
//glColor3ub(255, 240 - nColor, 200 - nColor);
gluQuadricDrawStyle (quadObj, GLU_FILL );
gluQuadricNormals( quadObj, GLU_NONE );
gluPartialDisk( quadObj, nStartRadius, nRadius, slices, 1, nStartAngle, nAngle );
glPopMatrix();
gluDeleteQuadric(quadObj);
}
}
void drawGraph(DirList dl)
{
int dirCnt = dl.dirs.size();
for(int i=0; i<dirCnt; i++)
{
DrawSector(dl.dirs[i].sector.startAngle, dl.dirs[i].sector.angle, dl.dirs[i].sector.startRadius, dl.dirs[i].sector.radius, i*30, dl.dirs[i].sector.highlighted);
drawGraph(dl.dirs[i]);
}
}
void prepareGraph(DirList &dl, int startAngle = 0, int endAngle = 360)
{
int tmpCnt = 0;
int angleLength = endAngle - startAngle;
int dirCnt = dl.dirs.size();
sort (dl.dirs.begin(), dl.dirs.end(), dirComparator);
for(int i=0; i<dirCnt; i++)
{
float scale = (float)dl.dirs[i].fcount / (float)dl.fcount;
dl.dirs[i].sector.highlighted = FALSE;
dl.dirs[i].sector.startAngle = (angleLength * (float)tmpCnt / (float)dl.fcount ) + startAngle;
dl.dirs[i].sector.angle = angleLength * scale;
dl.dirs[i].sector.startRadius = circleWidth + (dl.depth) * circleWidth;
dl.dirs[i].sector.radius = circleWidth + (dl.depth+1) * circleWidth;
if(dl.dirs[i].depth > maxDepth) maxDepth = dl.dirs[i].depth;
tmpCnt += dl.dirs[i].fcount;
prepareGraph(dl.dirs[i], dl.dirs[i].sector.startAngle, dl.dirs[i].sector.startAngle + dl.dirs[i].sector.angle);
}
}
int main()
{
//fg.FindFiles(".");
fg.FindFiles("c:\\andrius\\src");
//fg.FindFiles("c:\\downloads\\mybatis\\mybatis-generator-core-1.3.1");
if(glInit() != 0) return -1;
prepareGraph(fg.dl);
//various callbacks
glfwSetWindowSizeCallback(resizeWindow);
glfwSetWindowRefreshCallback(refreshWindow);
glfwSetKeyCallback(keyPressed);
glfwSetMousePosCallback(mousePosChanged);
while(running)
{
drawScene();
//glfwSleep(0.03);
}
return 0;
}
| [
"Andrius@.(none)"
] | [
[
[
1,
229
]
]
] |
0ede7c8eb992f26182186a21360b1e3a6a012602 | 1599a23c594b6d9d19ecaef701d9aafdce17a7a3 | /source/main.cpp | 3f45ade8233a1adfcb8f6389e33e467c8cb5cc05 | [] | no_license | pavelkryukov/plimdp-plus | 6c5a201cc8df2c7a1754320e7305040051d81441 | 953b378f771d22b3a52186e67c1d7eb74b10c71c | refs/heads/master | 2020-05-15T12:31:16.861244 | 2011-11-17T16:41:19 | 2011-11-17T16:41:19 | 32,184,827 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 487 | cpp | /*
* main.cpp
*
* PlimDP+ launcher
*
* Copyright 2009 (C) Boris Belousov
* Copyright 2011 (C) Pavel Kryukov (remastering)
*/
#include <cstdio>
#include <cstring>
#include <string>
#include <plimdp/computer/simple.h>
int main(int ac, char *av[]) {
if (ac != 2) {
std::printf("Syntax error\n");
return 1;
}
PlimDP::Computer::Simple pdp11;
pdp11.load(std::string(av[1]));
pdp11.start();
return 0;
}
| [
"[email protected]"
] | [
[
[
1,
29
]
]
] |
bf1ac2b4832dc2be7e9260a50d921463172299cd | 05869e5d7a32845b306353bdf45d2eab70d5eddc | /soft/application/thirdpartylibs/jwidgets/src/jddex_icon.cpp | c2103c120958888c53f72df428f2743c62a813e9 | [] | no_license | shenfahsu/sc-fix | beb9dc8034f2a8fd9feb384155fa01d52f3a4b6a | ccc96bfaa3c18f68c38036cf68d3cb34ca5b40cd | refs/heads/master | 2020-07-14T16:13:47.424654 | 2011-07-22T16:46:45 | 2011-07-22T16:46:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,273 | cpp | /***************************************************************************
*
* File Name : jdd_icon.cpp
*
* IMPORTANT NOTICE
*
* Please note that any and all title and/or intellectual property rights
* in and to this Software or any part of this (including without limitation
* any images, photographs, animations, video, audio, music, text and/or
* "applets," incorporated into the Software), herein mentioned to as
* "Software", the accompanying printed materials, and any copies of the
* Software, are owned by Jataayu Software (P) Ltd., Bangalore ("Jataayu")
* or Jataayu's suppliers as the case may be. The Software is protected by
* copyright, including without limitation by applicable copyright laws,
* international treaty provisions, other intellectual property laws and
* applicable laws in the country in which the Software is being used.
* You shall not modify, adapt or translate the Software, without prior
* express written consent from Jataayu. You shall not reverse engineer,
* decompile, disassemble or otherwise alter the Software, except and
* only to the extent that such activity is expressly permitted by
* applicable law notwithstanding this limitation. Unauthorized reproduction
* or redistribution of this program or any portion of it may result in severe
* civil and criminal penalties and will be prosecuted to the maximum extent
* possible under the law. Jataayu reserves all rights not expressly granted.
*
* THIS SOFTWARE IS PROVIDED TO YOU "AS IS" WITHOUT WARRANTY OF ANY KIND
* AND ANY AND ALL REPRESENTATION
*
***************************************************************************
*
*
* File Description
* ----------------
*
* Purpose : Implimentation for icon control
*
* Created By :
* Created Date :
*
*
*
* Current Revision :
*
***************************************************************************
*
*
* Revision Details
* ----------------
*
* 1. Modified By :
* Modified Date :
* Purpose :
*
*
*
*
***************************************************************************/
#include "jddex_platformdefines.h"
#include "jddex_icon.h"
#include "jddex_int.h"
#include "jddex_wnddefaults.h"
/**
* @brief default constructor
* @retval None
* initliazes the class members
*/
jddex_icon::jddex_icon()
{
}
/**
* @brief constructor
* @param[in] poParentHwnd Handle of parent window
* @param[in] pstRect control co-ordinates
* @param[in] pstCtrlProperty pointer to JC_CONTROL_PROPERTIES
* @retval None
*
* Calls the base class (widget class) constructor and initliazes
* class members
*/
jddex_icon::jddex_icon(jddex_widget *poParentHwnd,JC_RECT *pstRect, JC_CONTROL_PROPERTIES* pstCtrlProperty)
:jddex_widget(poParentHwnd,pstRect, pstCtrlProperty)
{
m_eControlType = E_ICON;
m_stIconInfo.eType = pstCtrlProperty->typeOfControl.icon.eType ;
if (-1 != pstCtrlProperty->controlStyle.iForegroundColor)
{
m_stControlStyle.iForegroundColor = pstCtrlProperty->controlStyle.iForegroundColor ;
}
else
{
m_stControlStyle.iForegroundColor = JDDEX_DEFAULT_BLACK ;
}
}
/**
* @brief destructor
* @retval None
* frees all the resources allocated
*/
jddex_icon::~jddex_icon()
{
}
/**
* @brief dispalys a icon
* @retval None
* displays the icon based on its state
*/
void jddex_icon::Show()
{
JC_RECT stAbsRect;
GetAbsRect(&stAbsRect);
JC_POINT stCentre ;
switch(m_stIconInfo.eType)
{
case E_DISC:
{
stCentre.uiX = stAbsRect.iLeft + stAbsRect.uiWidth/2;
stCentre.uiY = stAbsRect.iTop + stAbsRect.uiHeight/2;
jddex_FormattedDrawCircle(&stCentre, stAbsRect.uiWidth/2,
m_stControlStyle.iForegroundColor, stAbsRect.uiWidth/2 );
}
break;
case E_CIRCLE:
{
stCentre.uiX = stAbsRect.iLeft + stAbsRect.uiWidth/2;
stCentre.uiY = stAbsRect.iTop + stAbsRect.uiHeight/2;
jddex_FormattedDrawCircle(&stCentre, stAbsRect.uiWidth/2,
m_stControlStyle.iForegroundColor, 1 );
}
break;
case E_SQUARE:
{
jddex_DrawFormattedRect(&stAbsRect,m_stControlStyle.iForegroundColor,
m_stControlStyle.iForegroundColor, JDDEX_DEFAULT_ICON_BORDER_WIDTH);
}
break;
}
}
| [
"windyin@2490691b-6763-96f4-2dba-14a298306784"
] | [
[
[
1,
150
]
]
] |
308ef5f540b5acc9a7a7e37974530d6c10fdbf2e | 5e61787e7adba6ed1c2b5e40d38098ebdf9bdee8 | /sans/models/c_models/CLamellarFFHGModel.cpp | d91ae39ac6ec241f7d365006303cd5fffb3b380b | [] | no_license | mcvine/sansmodels | 4dcba43d18c930488b0e69e8afb04139e89e7b21 | 618928810ee7ae58ec35bbb839eba2a0117c4611 | refs/heads/master | 2021-01-22T13:12:22.721492 | 2011-09-30T14:01:06 | 2011-09-30T14:01:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,921 | cpp | /**
This software was developed by the University of Tennessee as part of the
Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
project funded by the US National Science Foundation.
If you use DANSE applications to do scientific research that leads to
publication, we ask that you acknowledge the use of the software with the
following sentence:
"This work benefited from DANSE software developed under NSF award DMR-0520547."
copyright 2008, University of Tennessee
*/
/** CLamellarFFHGModel
*
* C extension
*
* WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
* DO NOT MODIFY THIS FILE, MODIFY lamellarFF_HG.h
* AND RE-RUN THE GENERATOR SCRIPT
*
*/
#define NO_IMPORT_ARRAY
#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
extern "C" {
#include <Python.h>
#include <arrayobject.h>
#include "structmember.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "lamellarFF_HG.h"
}
#include "models.hh"
#include "dispersion_visitor.hh"
/// Error object for raised exceptions
static PyObject * CLamellarFFHGModelError = NULL;
// Class definition
typedef struct {
PyObject_HEAD
/// Parameters
PyObject * params;
/// Dispersion parameters
PyObject * dispersion;
/// Underlying model object
LamellarFFHGModel * model;
/// Log for unit testing
PyObject * log;
} CLamellarFFHGModel;
static void
CLamellarFFHGModel_dealloc(CLamellarFFHGModel* self)
{
Py_DECREF(self->params);
Py_DECREF(self->dispersion);
Py_DECREF(self->log);
delete self->model;
self->ob_type->tp_free((PyObject*)self);
}
static PyObject *
CLamellarFFHGModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
CLamellarFFHGModel *self;
self = (CLamellarFFHGModel *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
static int
CLamellarFFHGModel_init(CLamellarFFHGModel *self, PyObject *args, PyObject *kwds)
{
if (self != NULL) {
// Create parameters
self->params = PyDict_New();
self->dispersion = PyDict_New();
self->model = new LamellarFFHGModel();
// Initialize parameter dictionary
PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
PyDict_SetItemString(self->params,"h_thickness",Py_BuildValue("d",10.000000000000));
PyDict_SetItemString(self->params,"sld_tail",Py_BuildValue("d",0.000000400000));
PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006000000));
PyDict_SetItemString(self->params,"t_length",Py_BuildValue("d",15.000000000000));
PyDict_SetItemString(self->params,"sld_head",Py_BuildValue("d",0.000003000000));
PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
// Initialize dispersion / averaging parameter dict
DispersionVisitor* visitor = new DispersionVisitor();
PyObject * disp_dict;
disp_dict = PyDict_New();
self->model->t_length.dispersion->accept_as_source(visitor, self->model->t_length.dispersion, disp_dict);
PyDict_SetItemString(self->dispersion, "t_length", disp_dict);
disp_dict = PyDict_New();
self->model->h_thickness.dispersion->accept_as_source(visitor, self->model->h_thickness.dispersion, disp_dict);
PyDict_SetItemString(self->dispersion, "h_thickness", disp_dict);
// Create empty log
self->log = PyDict_New();
}
return 0;
}
static PyMemberDef CLamellarFFHGModel_members[] = {
{"params", T_OBJECT, offsetof(CLamellarFFHGModel, params), 0,
"Parameters"},
{"dispersion", T_OBJECT, offsetof(CLamellarFFHGModel, dispersion), 0,
"Dispersion parameters"},
{"log", T_OBJECT, offsetof(CLamellarFFHGModel, log), 0,
"Log"},
{NULL} /* Sentinel */
};
/** Read double from PyObject
@param p PyObject
@return double
*/
double CLamellarFFHGModel_readDouble(PyObject *p) {
if (PyFloat_Check(p)==1) {
return (double)(((PyFloatObject *)(p))->ob_fval);
} else if (PyInt_Check(p)==1) {
return (double)(((PyIntObject *)(p))->ob_ival);
} else if (PyLong_Check(p)==1) {
return (double)PyLong_AsLong(p);
} else {
return 0.0;
}
}
/**
* Function to call to evaluate model
* @param args: input numpy array q[]
* @return: numpy array object
*/
static PyObject *evaluateOneDim(LamellarFFHGModel* model, PyArrayObject *q){
PyArrayObject *result;
// Check validity of array q , q must be of dimension 1, an array of double
if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
{
//const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
//PyErr_SetString(PyExc_ValueError , message);
return NULL;
}
result = (PyArrayObject *)PyArray_FromDims(q->nd, (int *)(q->dimensions),
PyArray_DOUBLE);
if (result == NULL) {
const char * message= "Could not create result ";
PyErr_SetString(PyExc_RuntimeError , message);
return NULL;
}
for (int i = 0; i < q->dimensions[0]; i++){
double q_value = *(double *)(q->data + i*q->strides[0]);
double *result_value = (double *)(result->data + i*result->strides[0]);
*result_value =(*model)(q_value);
}
return PyArray_Return(result);
}
/**
* Function to call to evaluate model
* @param args: input numpy array [x[],y[]]
* @return: numpy array object
*/
static PyObject * evaluateTwoDimXY( LamellarFFHGModel* model,
PyArrayObject *x, PyArrayObject *y)
{
PyArrayObject *result;
int i,j, x_len, y_len, dims[1];
//check validity of input vectors
if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
|| y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
|| y->dimensions[0] != x->dimensions[0]){
const char * message= "evaluateTwoDimXY expect 2 numpy arrays";
PyErr_SetString(PyExc_ValueError , message);
return NULL;
}
if (PyArray_Check(x) && PyArray_Check(y)) {
x_len = dims[0]= x->dimensions[0];
y_len = dims[0]= y->dimensions[0];
// Make a new double matrix of same dims
result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
if (result == NULL){
const char * message= "Could not create result ";
PyErr_SetString(PyExc_RuntimeError , message);
return NULL;
}
/* Do the calculation. */
for ( i=0; i< x_len; i++) {
double x_value = *(double *)(x->data + i*x->strides[0]);
double y_value = *(double *)(y->data + i*y->strides[0]);
double *result_value = (double *)(result->data +
i*result->strides[0]);
*result_value = (*model)(x_value, y_value);
}
return PyArray_Return(result);
}else{
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.evaluateTwoDimXY couldn't run.");
return NULL;
}
}
/**
* evalDistribution function evaluate a model function with input vector
* @param args: input q as vector or [qx, qy] where qx, qy are vectors
*
*/
static PyObject * evalDistribution(CLamellarFFHGModel *self, PyObject *args){
PyObject *qx, *qy;
PyArrayObject * pars;
int npars ,mpars;
// Get parameters
// Reader parameter dictionary
self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
// Read in dispersion parameters
PyObject* disp_dict;
DispersionVisitor* visitor = new DispersionVisitor();
disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
// Get input and determine whether we have to supply a 1D or 2D return value.
if ( !PyArg_ParseTuple(args,"O",&pars) ) {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.evalDistribution expects a q value.");
return NULL;
}
// Check params
if(PyArray_Check(pars)==1) {
// Length of list should 1 or 2
npars = pars->nd;
if(npars==1) {
// input is a numpy array
if (PyArray_Check(pars)) {
return evaluateOneDim(self->model, (PyArrayObject*)pars);
}
}else{
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.evalDistribution expect numpy array of one dimension.");
return NULL;
}
}else if( PyList_Check(pars)==1) {
// Length of list should be 2 for I(qx,qy)
mpars = PyList_GET_SIZE(pars);
if(mpars!=2) {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.evalDistribution expects a list of dimension 2.");
return NULL;
}
qx = PyList_GET_ITEM(pars,0);
qy = PyList_GET_ITEM(pars,1);
if (PyArray_Check(qx) && PyArray_Check(qy)) {
return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
(PyArrayObject*)qy);
}else{
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.evalDistribution expect 2 numpy arrays in list.");
return NULL;
}
}
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.evalDistribution couln't be run.");
return NULL;
}
/**
* Function to call to evaluate model
* @param args: input q or [q,phi]
* @return: function value
*/
static PyObject * run(CLamellarFFHGModel *self, PyObject *args) {
double q_value, phi_value;
PyObject* pars;
int npars;
// Get parameters
// Reader parameter dictionary
self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
// Read in dispersion parameters
PyObject* disp_dict;
DispersionVisitor* visitor = new DispersionVisitor();
disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
// Get input and determine whether we have to supply a 1D or 2D return value.
if ( !PyArg_ParseTuple(args,"O",&pars) ) {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.run expects a q value.");
return NULL;
}
// Check params
if( PyList_Check(pars)==1) {
// Length of list should be 2 for I(q,phi)
npars = PyList_GET_SIZE(pars);
if(npars!=2) {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.run expects a double or a list of dimension 2.");
return NULL;
}
// We have a vector q, get the q and phi values at which
// to evaluate I(q,phi)
q_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,0));
phi_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,1));
// Skip zero
if (q_value==0) {
return Py_BuildValue("d",0.0);
}
return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
} else {
// We have a scalar q, we will evaluate I(q)
q_value = CLamellarFFHGModel_readDouble(pars);
return Py_BuildValue("d",(*(self->model))(q_value));
}
}
/**
* Function to call to calculate_ER
* @return: effective radius value
*/
static PyObject * calculate_ER(CLamellarFFHGModel *self) {
PyObject* pars;
int npars;
// Get parameters
// Reader parameter dictionary
self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
// Read in dispersion parameters
PyObject* disp_dict;
DispersionVisitor* visitor = new DispersionVisitor();
disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
return Py_BuildValue("d",(*(self->model)).calculate_ER());
}
/**
* Function to call to evaluate model in cartesian coordinates
* @param args: input q or [qx, qy]]
* @return: function value
*/
static PyObject * runXY(CLamellarFFHGModel *self, PyObject *args) {
double qx_value, qy_value;
PyObject* pars;
int npars;
// Get parameters
// Reader parameter dictionary
self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
// Read in dispersion parameters
PyObject* disp_dict;
DispersionVisitor* visitor = new DispersionVisitor();
disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
// Get input and determine whether we have to supply a 1D or 2D return value.
if ( !PyArg_ParseTuple(args,"O",&pars) ) {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.run expects a q value.");
return NULL;
}
// Check params
if( PyList_Check(pars)==1) {
// Length of list should be 2 for I(qx, qy))
npars = PyList_GET_SIZE(pars);
if(npars!=2) {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.run expects a double or a list of dimension 2.");
return NULL;
}
// We have a vector q, get the qx and qy values at which
// to evaluate I(qx,qy)
qx_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,0));
qy_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,1));
return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
} else {
// We have a scalar q, we will evaluate I(q)
qx_value = CLamellarFFHGModel_readDouble(pars);
return Py_BuildValue("d",(*(self->model))(qx_value));
}
}
static PyObject * reset(CLamellarFFHGModel *self, PyObject *args) {
return Py_BuildValue("d",0.0);
}
static PyObject * set_dispersion(CLamellarFFHGModel *self, PyObject *args) {
PyObject * disp;
const char * par_name;
if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.set_dispersion expects a DispersionModel object.");
return NULL;
}
void *temp = PyCObject_AsVoidPtr(disp);
DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
// Ugliness necessary to go from python to C
// TODO: refactor this
if (!strcmp(par_name, "t_length")) {
self->model->t_length.dispersion = dispersion;
} else if (!strcmp(par_name, "h_thickness")) {
self->model->h_thickness.dispersion = dispersion;
} else {
PyErr_SetString(CLamellarFFHGModelError,
"CLamellarFFHGModel.set_dispersion expects a valid parameter name.");
return NULL;
}
DispersionVisitor* visitor = new DispersionVisitor();
PyObject * disp_dict = PyDict_New();
dispersion->accept_as_source(visitor, dispersion, disp_dict);
PyDict_SetItemString(self->dispersion, par_name, disp_dict);
return Py_BuildValue("i",1);
}
static PyMethodDef CLamellarFFHGModel_methods[] = {
{"run", (PyCFunction)run , METH_VARARGS,
"Evaluate the model at a given Q or Q, phi"},
{"runXY", (PyCFunction)runXY , METH_VARARGS,
"Evaluate the model at a given Q or Qx, Qy"},
{"calculate_ER", (PyCFunction)calculate_ER , METH_VARARGS,
"Evaluate the model at a given Q or Q, phi"},
{"evalDistribution", (PyCFunction)evalDistribution , METH_VARARGS,
"Evaluate the model at a given Q or Qx, Qy vector "},
{"reset", (PyCFunction)reset , METH_VARARGS,
"Reset pair correlation"},
{"set_dispersion", (PyCFunction)set_dispersion , METH_VARARGS,
"Set the dispersion model for a given parameter"},
{NULL}
};
static PyTypeObject CLamellarFFHGModelType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"CLamellarFFHGModel", /*tp_name*/
sizeof(CLamellarFFHGModel), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)CLamellarFFHGModel_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"CLamellarFFHGModel objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
CLamellarFFHGModel_methods, /* tp_methods */
CLamellarFFHGModel_members, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)CLamellarFFHGModel_init, /* tp_init */
0, /* tp_alloc */
CLamellarFFHGModel_new, /* tp_new */
};
//static PyMethodDef module_methods[] = {
// {NULL}
//};
/**
* Function used to add the model class to a module
* @param module: module to add the class to
*/
void addCLamellarFFHGModel(PyObject *module) {
PyObject *d;
if (PyType_Ready(&CLamellarFFHGModelType) < 0)
return;
Py_INCREF(&CLamellarFFHGModelType);
PyModule_AddObject(module, "CLamellarFFHGModel", (PyObject *)&CLamellarFFHGModelType);
d = PyModule_GetDict(module);
CLamellarFFHGModelError = PyErr_NewException("CLamellarFFHGModel.error", NULL, NULL);
PyDict_SetItemString(d, "CLamellarFFHGModelError", CLamellarFFHGModelError);
}
| [
"[email protected]",
"[email protected]"
] | [
[
[
1,
23
],
[
26,
28
],
[
30,
91
],
[
99,
144
],
[
196,
196
],
[
198,
198
],
[
251,
251
],
[
294,
297
],
[
299,
363
],
[
369,
369
],
[
395,
499
],
[
505,
554
],
[
558,
576
]
],
[
[
24,
25
],
[
29,
29
],
[
92,
98
],
[
145,
195
],
[
197,
197
],
[
199,
250
],
[
252,
293
],
[
298,
298
],
[
364,
368
],
[
370,
394
],
[
500,
504
],
[
555,
557
]
]
] |
51c27d153011fae48d59857c9e74be3461758c41 | 915d454b5f3099ea8d12f291fd79dab0688f9b6c | /bpa5005/Location.h | 72cc8725607aeb5b46b2208b1f4547f2414cb240 | [] | no_license | johnballantyne/mazegeneration483w | e60593bbbeac2fe4589bace2076c1d8620b8b5d5 | dddbbb8b9e919ba2c7b3977e230c7afd545073cd | refs/heads/master | 2021-01-23T14:03:59.843199 | 2009-12-14T01:56:57 | 2009-12-14T01:56:57 | 39,958,368 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,059 | h | #pragma once
#include <iostream>
#include "Maze.h"
#include "Coordinate.h"
using namespace std;
//outputing coordinates is same as cout
//ostream& operator<<(ostream& output, Coordinates p);
//class has set and get funcitons also has a coordinate struct
//to keep track of location based on x and y
class Location
{
public:
//default constructor
Location(){};
//init constructor
//sets location passed to it from maze
Location(Coordinates newCoordinate)
{
SetCoordinates(newCoordinate);
};
//returns struct of Coordinates type
Coordinates GetCoordinates();
//sets the locaiton of whatever has a location
void SetCoordinates(Coordinates newCoordinate);
//change the X location
void MoveX(int x);
//change the y location
void MoveY(int y);
//change z location
void MoveZ(int z);
//checks if coordinate is a wall
bool IsWall(Coordinates checkCoordinate, Maze myMaze);
//overloaded = operator for locations
Location & operator=(Location &myLocation);
private:
Coordinates myCoordinates;
};
| [
"vash7ehstampede@f1cf40a4-bd93-11de-8784-f7ad4773dbab"
] | [
[
[
1,
43
]
]
] |
7bb97f12df8717498797b45110eb4bb94c28bf41 | fc3691e5b88f10ce159d61fd198f5742fb2f643c | /src/resources/types/cnation.cpp | 279d4d0b957a5e3e45b7a912f609e9e6a12ccaa5 | [] | no_license | hardyx/openpirates | 6f438ed04ec1c64cb1d35e7da4e56aa919c91750 | 5833ee50474398bc7c364902343d3ff52f5306a6 | refs/heads/master | 2020-03-11T09:40:55.969627 | 2010-07-26T00:47:56 | 2010-07-26T00:47:56 | 129,919,203 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,383 | cpp | /***
* openPirates
* Copyright (C) 2010 Scott Smith
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include "cnation.h"
CNation::CNation() :
mTag (0),
mAmnesty (false),
mName (),
mGraphicPath (),
mEconomySettings (),
mRelations ()
{
}
CNation::~CNation()
{
Log( " CNation %d econs to release\n", mEconomySettings.size() );
if ( mEconomySettings.size() > 0 )
{
for ( int16_t i=mEconomySettings.size()-1; i>=0; i-- )
{
delete mEconomySettings.at(i);
}
mEconomySettings.clear();
}
}
void CNation::SetRelations( uint8_t total )
{
mRelations.clear();
mRelations.resize( total, NATION_PEACE );
}
| [
"pickle136@3faa6364-4847-409f-afa2-7fad3069fade"
] | [
[
[
1,
48
]
]
] |
4821598eceee2926739c103f063394d1455f384f | a6d79692cbc9c2b4952d5844d3cf5ae4998ed7d4 | /Other/Source/ThemeSwitcher/FindLitestep.cpp | 6aa9363285302dddc9897fff833472712c4dca11 | [] | no_license | crazy2be/litestepportable | 00735f7a3d0688d6379b4d63e25697d793914457 | 7e0948ee5ac14dc70e4dd5ca70354642176f6470 | refs/heads/master | 2020-04-26T01:17:19.326333 | 2009-03-29T22:12:15 | 2009-03-29T22:12:15 | 173,199,242 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,646 | cpp | #include "FindLitestep.h"
#include "Error.h"
#include "GetSettings.h"
#include "SettingsDialog.h"
void ValidatePaths() {
string Returned;
bool ErrorHappened;
string FilesToFind[1];
FilesToFind[0] = GetValue("Litestep");
if (FindFile(FilesToFind, 1) == 1) {
Returned = FindLiteStepExe();
if (Returned != "ERROR_NOT_FOUND")
SetValue("Litestep", Returned);
else
ErrorHappened = true;
}
FilesToFind[0] = GetValue("LitestepDir");
FilesToFind[0] = FilesToFind[0].substr(0, (FilesToFind[0].length()-1));
if (FindFile(FilesToFind, 1) == 1) {
Returned = FindLiteStepExePath();
if (Returned != "ERROR_NOT_FOUND")
SetValue("LitestepDir", Returned);
else
ErrorHappened = true;
}
FilesToFind[0] = GetValue("ThemesDir");
FilesToFind[0] = FilesToFind[0].substr(0, (FilesToFind[0].length()-1));
if (FindFile(FilesToFind, 1) == 1) {
Returned = FindThemesDirPath();
if (Returned != "ERROR_NOT_FOUND")
SetValue("ThemesDir", Returned);
else
ErrorHappened = true;
}
FilesToFind[0] = GetValue("ThemesDir");
FilesToFind[0] += GetValue("DefaultTheme");
FilesToFind[0] += "\\Theme.rc";
if (FindFile(FilesToFind, 1) == 1) {
Error("Default Theme was not found!\n"
"Change this setting in Settings.ini before\n"
"attempting to switch to another theme.");
}
if (ErrorHappened == true)
DisplaySettingsDialog();
//int FileFindInt = FindFile(FilesToFind
}
string FindLiteStepExe() {
string LiteStepExe;
LiteStepExe = FindLiteStepExePath();
if (LiteStepExe == "ERROR_NOT_FOUND") {
return LiteStepExe;
} else {
LiteStepExe += "Litestep.exe";
return LiteStepExe;
}
}
string FindLiteStepExePath() {
char Path [MAX_PATH];
/* The array of places to search for Litestep */
string FilesToFind[2];
FilesToFind[0] = "..\\Litestep.exe";
FilesToFind[1] = "Litestep.exe";
int FindFileInt = FindFile(FilesToFind, 2);
if (FindFileInt == 0) {
_getcwd(Path, MAX_PATH);
FilesToFind[0] = Path;
FilesToFind[0] = FilesToFind[0].substr(0, FilesToFind[0].rfind("\\"));
FilesToFind[0] += "\\";
return FilesToFind[0];
} else if (FindFileInt == 1) {
_getcwd(Path, MAX_PATH);
FilesToFind[1] = Path;
FilesToFind[1] += "\\";
return FilesToFind[1];
} else {
Error("Unable to find Litestep.exe!\n"
"Please make sure it is in either:\n"
" - ..\\LiteStep.exe\n"
" - LiteStep.exe\n"
"(all paths are relitive)");
return "ERROR_NOT_FOUND";
}
}
string FindThemesDirPath() {
char Path [MAX_PATH];
/* The array of places to search for ThemesList.rc */
string FilesToFind[3];
FilesToFind[0] = "..\\ThemesList.rc";
FilesToFind[1] = "ThemesList.rc";
FilesToFind[2] = "..\\Themes\\ThemesList.rc";
int FindFileInt = FindFile(FilesToFind, 3);
if (FindFileInt == 0) {
_getcwd(Path, MAX_PATH);
FilesToFind[0] = Path;
FilesToFind[0] = FilesToFind[0].substr(0, FilesToFind[0].rfind("\\"));
//FilesToFind[0] += "\\ThemesList.rc";
return FilesToFind[0];
} else if (FindFileInt == 1) {
_getcwd(Path, MAX_PATH);
FilesToFind[1] = Path;
//FilesToFind[1] += "\\ThemesList.rc";
return FilesToFind[1];
} else if (FindFileInt == 2) {
_getcwd(Path, MAX_PATH);
FilesToFind[2] = Path;
FilesToFind[2] = FilesToFind[2].substr(0, FilesToFind[2].rfind("\\"));
FilesToFind[2] += "\\Themes\\";
return FilesToFind[2];
} else {
Error("Unable to find ThemesList.rc!\n"
"Please make sure it is in either:\n"
" - ..\\ThemeList.rc\n"
" - ThemeList.rc\n"
" - ..\\Themes\\ThemeList.rc\n"
"(all paths are relitive)");
return "ERROR_NOT_FOUND";
}
}
int FindFile(string FilesToFind[], unsigned int Length) {
/* Define Variables */
WIN32_FIND_DATA CurFileData;
HANDLE FindFileHandle;
/* Searches for the file in each of the specified search paths */
for (int i = 0; i < Length; i++) {
FindFileHandle = FindFirstFile(FilesToFind[i].c_str(), &CurFileData);
if (FindFileHandle == INVALID_HANDLE_VALUE) {
} else {
// Returns the number that matched
return i;
}
}
return Length;
}
| [
"[email protected]"
] | [
[
[
1,
138
]
]
] |
662a58d80d7254172beda5d47717f5170eff34db | 33cdd09e352529963fe8b28b04e0d2e33483777b | /trunk/ReportAsistent/ReportAsistent.h | e89bb4a0c92fde3a28b1904b365157619434f6c9 | [] | no_license | BackupTheBerlios/reportasistent-svn | 20e386c86b6990abafb679eeb9205f2aef1af1ac | 209650c8cbb0c72a6e8489b0346327374356b57c | refs/heads/master | 2020-06-04T16:28:21.972009 | 2010-05-18T12:06:48 | 2010-05-18T12:06:48 | 40,804,982 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,595 | h | // ReportAsistent.h : main header file for the REPORTASISTENT application
//
/*
This file is part of LM Report Asistent.
Authors: Jan Dedek, Jan Kodym, Martin Chrz, Iva Bartunkova
LM Report Asistent 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.
LM Report Asistent 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 LM Report Asistent; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(AFX_REPORTASISTENT_H__B8BFBABC_4887_44AF_92CC_FD8D82E85539__INCLUDED_)
#define AFX_REPORTASISTENT_H__B8BFBABC_4887_44AF_92CC_FD8D82E85539__INCLUDED_
#endif
#if _MSC_VER > 1000
#pragma once
#endif
// _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
//Iva: constants
//number of pictures for icons in treectrl
#if !defined NUM_PICTURES_TREECTRL
#define NUM_PICTURES_TREECTRL 6
#endif
//IDs from Help file ReportAsistent.hlp
#if !defined IDH_CONTENTS
#define IDH_CONTENTS 77001
#endif
#include "ElementManager.h"
#include "DataSourceManager.h"
#include "WordManager.h"
#include "DirectoriesManager.h" // Added by ClassView
//honza: sem vkaldejte vsechny globalni managery
//konstruuje se v inti instance a nici v Exit instance
/**
* struct CGeneralManager: This manager encapsulate all Manager classes in the LM-RA. It is constructed in InitInstance function and destructed in ExitInstance function.
*
* @author
*/
struct CGeneralManager
{
private:
CString m_strLanguage;
public:
CDirectoriesManager DirectoriesManager;
CElementManager ElementManager;
CDataSourcesManager DataSourcesManager;
CWordManager WordManager;
CGeneralManager() :
WordManager(DirectoriesManager), // kody - pridano kvuli nacitani stylu ze souboru
DataSourcesManager(DirectoriesManager),
ElementManager(DirectoriesManager),
m_strLanguage("en")
{};
/**
* getLanguage:
*
* @return LPCTSTR
*/
LPCTSTR getLanguage() // vrati retezec s identifikatorem jazyka
{
return m_strLanguage;
};
/**
* setLanguage:
*
* @param lng
* @return void
*/
void setLanguage(LPCTSTR lng)
{
if((lng != CString("en")) && (lng != CString("cz"))) return;
m_strLanguage = lng;
};
};
/////////////////////////////////////////////////////////////////////////////
// CReportAsistentApp:
// See ReportAsistent.cpp for the implementation of this class
//
/**
* class CSkeletonDoc: Thr
*
* @author
*/
class CSkeletonDoc;
/**
* class CReportAsistentApp: The class of all the LM-RA application.
*
* @author
*/
class CReportAsistentApp : public CWinApp
{
public:
/**
* ReportError: Function for standardized reporting of errors that can occur during work with LM-RA.
*
* @param nResourceErrorStringID
* @param
* @return int static
*/
int static ReportError(UINT nResourceErrorStringID, ...);
/**
* FirstDocumentInFirstTemplate: Returns the active document.
*
* @return CSkeletonDoc*
*/
CSkeletonDoc * FirstDocumentInFirstTemplate();
CGeneralManager * m_pGeneralManager;
/**
* CReportAsistentApp: constructor.
*
* @return
*/
CReportAsistentApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportAsistentApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CReportAsistentApp)
afx_msg void OnAppAbout();
afx_msg void OnMmsources();
afx_msg void OnFileOptions();
afx_msg void OnOpenWordEditor();
afx_msg void OnHlpTopics();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
BOOL m_bMarkOrphans;
BOOL m_bIdInItemName; // 0/1.. whether or not to show id at the Tree item name
int m_iTreeItemHeight;
int m_iTreeItemIndent;
BOOL m_bTreeHasLines;
BOOL m_bTreeHasButtons;
BOOL m_bWordPluginMode;
public:
int m_iTextEditSize;
int m_iTreeItemNameLength;
public:
virtual int DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt);
};
| [
"dedej1am@fded5620-0c03-0410-a24c-85322fa64ba0",
"chrzm@fded5620-0c03-0410-a24c-85322fa64ba0",
"ibart@fded5620-0c03-0410-a24c-85322fa64ba0",
"kodyj1am@fded5620-0c03-0410-a24c-85322fa64ba0"
] | [
[
[
1,
2
],
[
5,
5
],
[
22,
23
],
[
25,
27
],
[
30,
36
],
[
50,
57
],
[
63,
64
],
[
67,
67
],
[
69,
69
],
[
71,
76
],
[
78,
81
],
[
88,
92
],
[
99,
111
],
[
117,
118
],
[
124,
126
],
[
134,
135
],
[
141,
142
],
[
148,
163
],
[
165,
166
],
[
174,
176
],
[
182,
184
]
],
[
[
3,
4
],
[
6,
21
],
[
58,
58
],
[
60,
62
],
[
83,
87
],
[
93,
98
],
[
112,
112
],
[
114,
116
],
[
119,
119
],
[
121,
123
],
[
127,
127
],
[
129,
133
],
[
136,
136
],
[
138,
140
],
[
143,
143
],
[
145,
147
]
],
[
[
24,
24
],
[
28,
29
],
[
37,
49
],
[
59,
59
],
[
113,
113
],
[
120,
120
],
[
128,
128
],
[
137,
137
],
[
144,
144
],
[
164,
164
],
[
167,
173
],
[
177,
181
]
],
[
[
65,
66
],
[
68,
68
],
[
70,
70
],
[
77,
77
],
[
82,
82
]
]
] |
473fd9533bc1492fa5ae7025cd3b00d1eb78ae08 | 0b23115a0b7d738df12d0dc6c149e76f0c71992e | /Confwiz32/Confwiz32.cpp | 85e466ec0d630539119b63cda78b468f8b19947a | [] | no_license | BackupTheBerlios/kinneret | 7bbcaa4d6e00a600c6d504471c0df7d65a843647 | 1a7abb40267e87b4a8b2202de28943ec409e13a8 | refs/heads/master | 2021-01-01T17:56:36.375082 | 2006-02-18T11:12:25 | 2006-02-18T11:12:25 | 40,069,588 | 0 | 0 | null | null | null | null | WINDOWS-1255 | C++ | false | false | 7,255 | cpp | // Confwiz32.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include <commctrl.h>
#include <commdlg.h>
#include <stdio.h>
#include <fstream>
using namespace std;
void Init(HWND hDlg)
{
// set text
char szText[] = "יש באפשרותך להפעיל את גנו/לינוקס כנרת מהתקליטור וללא התקנה או הגדרות כלשהן, על-מנת להתרשם מיכולות המערכת.\r\nעל-מנת לאפשר לעבודתך עם גנו/לינוקס כינרת להיות יעילה ככל האפשר, וכן לאפשר לך לשמור הגדרות התאמה-אישית וכן מסמכים לכונן הקשיח, עליך להקדיש מספר דקות מעטות להשלמת פעולת אשף זה.\r\n\r\nיש לבחור את המחיצה שבה יישמרו קבצי ההגדרות והמסמכים שלך. על מחיצה זו תיווצר תת תיקיה בשם kinneret שתכיל שני קבצים, קובץ תיקיית הבית, שם יישמרו העדפותיך האישיות וקבצים מערכת, וקובץ החלפה, לשיפור ביצועי המערכת.\r\n\r\nערכי ברירת המחדל לקבצים אלו אמורים להתאים לכל צרכיו של המשתמש הביתי. אם אין ברשותך מקום פנוי רב בדיסק, ניתן לשנות ערכים אלו, כמו גם במקרה וקיים מקום פנוי רק אותו ברצונך להקצות לכנרת.\r\n\r\nלאחר קביעת הערכים יש ללחוץ על \"בצע\". פעולה זו עלולה לקחת זמן מה. לאחר סיום הפעולה, יש לאתחל את המחשב מחדש, הפעם מדיסק כנרת, על מנת לסיים את תהליך ההתקנה.";
SetDlgItemText(hDlg, IDC_TEXT, szText);
// set home to 100
SetDlgItemInt(hDlg, IDC_HOME, 100, false);
// set swap to 256
SetDlgItemInt(hDlg, IDC_SWAP, 256, false);
// set spins
SendDlgItemMessage(hDlg, IDC_SPIN_HOME, UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)4096, (short)100));
SendDlgItemMessage(hDlg, IDC_SPIN_SWAP, UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)4096, (short)0));
// fill combo with partitions and free space, e.g.
// C: (1GB Free)
DWORD dwDrives = GetLogicalDrives();
DWORD dwMask = 1;
char chLetter = 'A';
for (int j = 1 ; j < 32 ; j++, dwMask <<= 1, chLetter++)
{
if (dwDrives & dwMask)
{
char szBuffer[0xFF];
ULARGE_INTEGER bigFree;
sprintf(szBuffer, "%c:\\", chLetter);
if (GetDriveType(szBuffer) != DRIVE_FIXED) continue;
GetDiskFreeSpaceEx(szBuffer, &bigFree, 0, 0);
char exts[][3] =
{
{ 'b', 0, 0 }, // bytes 1024^0
{ 'K', 'B', 0 }, // kilobytes 1024^1
{ 'M', 'B', 0 }, // megabytes 1024^2
{ 'G', 'B', 0 }, // gigabytes 1024^3
{ 'T', 'B', 0 }, // terabytes 1024^4
{ 'P', 'B', 0 }, // petabytes 1024^5
{ 'E', 'B', 0 }, // exabytes 1024^6
};
int i = 0;
while (bigFree.QuadPart > 1024 * 1204)
{
bigFree.QuadPart /= 1024;
i++;
}
DWORD dw = (DWORD)bigFree.QuadPart;
sprintf(szBuffer, "%c:\\ (%.2f%s Free)", chLetter, dw / 1024.0f, exts[i + 1]);
SendDlgItemMessage(hDlg, IDC_COMBO, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBuffer);
}
}
// select the first
SendDlgItemMessage(hDlg, IDC_COMBO, CB_SETCURSEL, 0, 0);
}
void Do(HWND hDlg)
{
EnableWindow(GetDlgItem(hDlg, IDC_COMBO), false);
EnableWindow(GetDlgItem(hDlg, IDC_HOME), false);
EnableWindow(GetDlgItem(hDlg, IDC_SWAP), false);
EnableWindow(GetDlgItem(hDlg, IDC_SPIN_HOME), false);
EnableWindow(GetDlgItem(hDlg, IDC_SPIN_SWAP), false);
EnableWindow(GetDlgItem(hDlg, IDOK), false);
SetDlgItemText(hDlg, IDC_STAT, "יוצר תיקייה בשם kinneret בשורש המחיצה...");
char buff[0xFF];
long l = SendDlgItemMessage(hDlg, IDC_COMBO, CB_GETCURSEL, 0, 0);
SendDlgItemMessage(hDlg, IDC_COMBO, CB_GETLBTEXT, l, (LPARAM)(LPSTR)buff);
buff[3] = 0;
strcat(buff, "kinneret");
if (CreateDirectory(buff, 0) == 0)
{
MessageBox(hDlg, "שגיאה בעת יצירת תיקיה", "שגיאה", MB_ICONERROR);
PostQuitMessage(-1);
}
strcat(buff, "\\.config");
HANDLE out = CreateFile(buff, GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
if (out == INVALID_HANDLE_VALUE)
{
MessageBox(hDlg, "שגיאה בעת יצירת קובץ", "שגיאה", MB_ICONERROR);
PostQuitMessage(-1);
}
char *mega;
try
{
mega = new char[1024 * 1024];
}
catch (bad_alloc)
{
MessageBox(hDlg, "שגיאה בעת יצירת קובץ", "שגיאה", MB_ICONERROR);
PostQuitMessage(-1);
}
memset(mega, 0, 1024 * 1024);
MSG msg;
SetTimer(hDlg, 0, 50, 0);
int size = GetDlgItemInt(hDlg, IDC_HOME, 0, false);
for (long j = 0 ; j < size ; j++)
{
DWORD dw2;
WriteFile(out, mega, 1024 * 1024, &dw2, 0);
if (dw2 != 1024 * 1024)
{
MessageBox(hDlg, "שגיאה בעת יצירת קובץ", "שגיאה", MB_ICONERROR);
PostQuitMessage(-1);
}
if (GetMessage(&msg, hDlg, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
char sz[0xFF];
sprintf(sz, "יוצר קובץ בית... [%d / %d]", j + 1, size);
SetDlgItemText(hDlg, IDC_STAT, sz);
}
CloseHandle(out);
buff[3] = 0;
strcat(buff, "kinneret");
strcat(buff, "\\.swap");
out = CreateFile(buff, GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
if (out == INVALID_HANDLE_VALUE)
{
MessageBox(hDlg, "שגיאה בעת יצירת קובץ", "שגיאה", MB_ICONERROR);
PostQuitMessage(-1);
}
size = GetDlgItemInt(hDlg, IDC_SWAP, 0, false);
for (j = 0 ; j < size ; j++)
{
DWORD dw2;
WriteFile(out, mega, 1024 * 1024, &dw2, 0);
if (dw2 != 1024 * 1024)
{
MessageBox(hDlg, "שגיאה בעת יצירת קובץ", "שגיאה", MB_ICONERROR);
PostQuitMessage(-1);
}
if (GetMessage(&msg, hDlg, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
char sz[0xFF];
sprintf(sz, "יוצר קובץ החלפה... [%d / %d]", j + 1, size);
SetDlgItemText(hDlg, IDC_STAT, sz);
}
delete mega;
CloseHandle(out);
SetDlgItemText(hDlg, IDCANCEL, "יציאה");
}
LONG FAR CALLBACK MainDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
Init(hDlg);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
MessageBox(hDlg, ".תהליך זה עלול לארוך דקות אחדות", "...לידיעתך", MB_OK);
Do(hDlg);
MessageBox(hDlg, ".התהליך הסתיים בהצלחה, יש לאתחל את המחשב מהדיסק על מנת להשלים את ההתקנה", "הצלחה", MB_OK);
break;
case IDCANCEL:
PostQuitMessage(0);
EndDialog(hDlg, IDCANCEL);
break;
}
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
InitCommonControls();
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)MainDlgProc);
}
| [
"z9u2k"
] | [
[
[
1,
231
]
]
] |
98eb4a70559d30df11e0e8a7a6d30726632047a9 | 0bc54f5f742e587e40c4212445abe1600ba1eedd | /QSW/Main.cpp | 9cedb6f9323b15b2caa4de7079f1b542b0f6ee8f | [] | no_license | Dramacydal/QSW | c9c4b4e074d4f22044c1e4cd7958f627a9f71d3a | 32ea86770fe6ed80802ad829c32db2a2507ffaad | refs/heads/master | 2021-01-19T03:23:37.128543 | 2011-01-30T21:31:18 | 2011-01-30T21:31:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 197 | cpp | #include "SpellWork.h"
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
SpellWork *sw = new SpellWork;
sw->show();
return app.exec();
}
| [
"devnull@localhost"
] | [
[
[
1,
10
]
]
] |
85f67deb32e3f4eef0ade77dfb5f6028ab552ca5 | 6d680e20e4a703f0aa0d4bb5e50568143241f2d5 | /src/MobiHealth/ui_NoteWidget.h | 95f2064657b92424dc1245f4c4c53351b0fa4112 | [] | no_license | sirnicolaz/MobiHealt | f7771e53a4a80dcea3d159eca729e9bd227e8660 | bbfd61209fb683d5f75f00bbf81b24933922baac | refs/heads/master | 2021-01-20T12:21:17.215536 | 2010-04-21T14:21:16 | 2010-04-21T14:21:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,411 | h | /********************************************************************************
** Form generated from reading UI file 'NoteWidget.ui'
**
** Created: Sun Apr 11 11:47:53 2010
** by: Qt User Interface Compiler version 4.6.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_NOTEWIDGET_H
#define UI_NOTEWIDGET_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHeaderView>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_NoteWidgetClass
{
public:
void setupUi(QWidget *NoteWidgetClass)
{
if (NoteWidgetClass->objectName().isEmpty())
NoteWidgetClass->setObjectName(QString::fromUtf8("NoteWidgetClass"));
NoteWidgetClass->resize(400, 300);
retranslateUi(NoteWidgetClass);
QMetaObject::connectSlotsByName(NoteWidgetClass);
} // setupUi
void retranslateUi(QWidget *NoteWidgetClass)
{
NoteWidgetClass->setWindowTitle(QApplication::translate("NoteWidgetClass", "NoteWidget", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class NoteWidgetClass: public Ui_NoteWidgetClass {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_NOTEWIDGET_H
| [
"[email protected]"
] | [
[
[
1,
50
]
]
] |
cb04305f0a5c2991008ea9530005bf29da10408a | b505ef7eb1a6c58ebcb73267eaa1bad60efb1cb2 | /source/graphics/core/win32/direct3d10/samplerstated3d10.h | 6eda742cffb28be435a1d8fd8ffb3171647cde78 | [] | no_license | roxygen/maid2 | 230319e05d6d6e2f345eda4c4d9d430fae574422 | 455b6b57c4e08f3678948827d074385dbc6c3f58 | refs/heads/master | 2021-01-23T17:19:44.876818 | 2010-07-02T02:43:45 | 2010-07-02T02:43:45 | 38,671,921 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 545 | h | #ifndef maid2_graphics_core_win32_direct3d10_samplerstated3d10_h
#define maid2_graphics_core_win32_direct3d10_samplerstated3d10_h
#include"../../../../config/define.h"
#include"../../isamplerstate.h"
#include"common.h"
namespace Maid { namespace Graphics {
class SamplerStateD3D10 : public ISamplerState
{
public:
SamplerStateD3D10( const SAMPLERSTATEPARAM& param, const SPD3D10SAMPLERSTATE& p )
:ISamplerState(param)
,pState(p)
{
}
SPD3D10SAMPLERSTATE pState;
};
}}
#endif | [
"[email protected]"
] | [
[
[
1,
26
]
]
] |
84e0a9dbc71ca954254d1a5fbfdf2fa52a31615a | 8a3fce9fb893696b8e408703b62fa452feec65c5 | /SendMail/SendMail/SendMail.cpp | af482adca3bc6a8882c3de2a5eb4ab25e97aabf7 | [] | no_license | win18216001/tpgame | bb4e8b1a2f19b92ecce14a7477ce30a470faecda | d877dd51a924f1d628959c5ab638c34a671b39b2 | refs/heads/master | 2021-04-12T04:51:47.882699 | 2011-03-08T10:04:55 | 2011-03-08T10:04:55 | 42,728,291 | 0 | 2 | null | null | null | null | GB18030 | C++ | false | false | 3,409 | cpp | // SendMail.cpp : 定义应用程序的类行为。
//
#include "stdafx.h"
#include "SendMail.h"
#include "SendMailDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CSendMailApp
BEGIN_MESSAGE_MAP(CSendMailApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CSendMailApp 构造
CSendMailApp::CSendMailApp()
{
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的一个 CSendMailApp 对象
CSendMailApp theApp;
const GUID CDECL BASED_CODE _tlid =
{ 0x67182603, 0xAAB0, 0x47E7, { 0x9D, 0xA0, 0x2C, 0x83, 0x17, 0x7D, 0x2C, 0x46 } };
const WORD _wVerMajor = 1;
const WORD _wVerMinor = 0;
// CSendMailApp 初始化
BOOL CSendMailApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
// 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
// 分析自动化开关或注册/注销开关的命令行。
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 应用程序是用 /Embedding 或 /Automation 开关启动的。
//使应用程序作为自动化服务器运行。
if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
{
// 通过 CoRegisterClassObject() 注册类工厂。
COleTemplateServer::RegisterAll();
}
// 应用程序是用 /Unregserver 或 /Unregister 开关启动的。移除
// 注册表中的项。
else if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
{
COleObjectFactory::UpdateRegistryAll(FALSE);
AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor);
return FALSE;
}
// 应用程序是以独立方式或用其他开关(如 /Register
// 或 /Regserver)启动的。更新注册表项,包括类型库。
else
{
COleObjectFactory::UpdateRegistryAll();
AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid);
if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppRegister)
return FALSE;
}
CSendMailDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置处理何时用
// “确定”来关闭对话框的代码
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置处理何时用
// “取消”来关闭对话框的代码
}
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
// 而不是启动应用程序的消息泵。
return FALSE;
}
| [
"[email protected]"
] | [
[
[
1,
124
]
]
] |
088582f4a37aa328dc157633cab40a8b17046a5f | ab41c2c63e554350ca5b93e41d7321ca127d8d3a | /glm/gtx/verbose_operator.inl | 08c0aae656418a07fc4265aa1a758294299f9fb0 | [] | no_license | burner/e3rt | 2dc3bac2b7face3b1606ee1430e7ecfd4523bf2e | 775470cc9b912a8c1199dd1069d7e7d4fc997a52 | refs/heads/master | 2021-01-11T08:08:00.665300 | 2010-04-26T11:42:42 | 2010-04-26T11:42:42 | 337,021 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,510 | inl | ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2006-04-20
// Updated : 2008-09-29
// Licence : This source is under MIT License
// File : glm/gtx/verbose_operator.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace gtx{
namespace verbose_operator{
template <typename genType>
inline genType add(genType const & a, genType const & b)
{
return a + b;
}
template <typename genType>
inline genType sub(genType const & a, genType const & b)
{
return a - b;
}
template <typename T>
inline detail::tmat2x2<T> mul
(
detail::tmat2x2<T> const & a,
detail::tmat2x2<T> const & b
)
{
return a * b;
}
template <typename T>
inline detail::tmat3x3<T> mul
(
detail::tmat3x3<T> const & a,
detail::tmat3x3<T> const & b
)
{
return a * b;
}
template <typename T>
inline detail::tmat4x4<T> mul
(
detail::tmat4x4<T> const & a,
detail::tmat4x4<T> const & b
)
{
return a * b;
}
template <typename T>
inline detail::tvec2<T> mul
(
detail::tmat2x2<T> const & m,
detail::tvec2<T> const & v
)
{
return m * v;
}
template <typename T>
inline detail::tvec3<T> mul
(
detail::tmat3x3<T> const & m,
detail::tvec3<T> const & v)
{
return m * v;
}
template <typename T>
inline detail::tvec4<T> mul
(
detail::tmat4x4<T> const & m,
detail::tvec4<T> const & v
)
{
return m * v;
}
template <typename T>
inline detail::tvec2<T> mul
(
detail::tvec2<T> const & v,
detail::tmat2x2<T> const & m
)
{
return v * m;
}
template <typename T>
inline detail::tvec3<T> mul
(
detail::tvec3<T> const & v,
detail::tmat3x3<T> const & m
)
{
return v * m;
}
template <typename T>
inline detail::tvec4<T> mul
(
detail::tvec4<T> const & v,
detail::tmat4x4<T> const & m
)
{
return v * m;
}
template <typename genType>
inline genType div(genType const & a, genType const & b)
{
return a / b;
}
template <typename genTypeT, typename genTypeU, typename genTypeV>
inline genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV const & c)
{
return a * b + c;
}
}//namespace verbose_operator
}//namespace gtx
}//namespace glm
| [
"[email protected]"
] | [
[
[
1,
129
]
]
] |
818e292dc52ba7bb0b53bbcafde6dfa5810d86f8 | 27d5670a7739a866c3ad97a71c0fc9334f6875f2 | /CPP/include/GuiProt/AccountStatus.h | da1cea075ef1b1dd4357221b5f741aab645d397c | [
"BSD-3-Clause"
] | permissive | ravustaja/Wayfinder-S60-Navigator | ef506c418b8c2e6498ece6dcae67e583fb8a4a95 | 14d1b729b2cea52f726874687e78f17492949585 | refs/heads/master | 2021-01-16T20:53:37.630909 | 2010-06-28T09:51:10 | 2010-06-28T09:51:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,794 | h | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GUI_PROT_ACCOUNT_STATUS_H
#define GUI_PROT_ACCOUNT_STATUS_H
namespace isab {
namespace GuiProtEnums {
enum AccountStatus {
AS_Unknown,
AS_Normal,
AS_Expired
};
}
}
#endif
| [
"[email protected]"
] | [
[
[
1,
31
]
]
] |
8b4c3bca843969b16fafa34d235de9a28c4428a6 | 1e01b697191a910a872e95ddfce27a91cebc57dd | /GrfSetGenerationHeader.cpp | 0a8e2fe6bdb547693f3a1767cd336caf9d7fe03a | [] | no_license | canercandan/codeworker | 7c9871076af481e98be42bf487a9ec1256040d08 | a68851958b1beef3d40114fd1ceb655f587c49ad | refs/heads/master | 2020-05-31T22:53:56.492569 | 2011-01-29T19:12:59 | 2011-01-29T19:12:59 | 1,306,254 | 7 | 5 | null | null | null | null | IBM852 | C++ | false | false | 1,712 | cpp | /* "CodeWorker": a scripting language for parsing and generating text.
Copyright (C) 1996-1997, 1999-2010 CÚdric Lemaire
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To contact the author: [email protected]
*/
#ifdef WIN32
#pragma warning (disable : 4786)
#endif
#include "ScpStream.h"
#include "CppCompilerEnvironment.h"
#include "CGRuntime.h"
#include "ExprScriptExpression.h"
#include <string>
#include "GrfSetGenerationHeader.h"
namespace CodeWorker {
GrfSetGenerationHeader::~GrfSetGenerationHeader() {
delete _pComment;
}
SEQUENCE_INTERRUPTION_LIST GrfSetGenerationHeader::executeInternal(DtaScriptVariable& visibility) {
std::string sComment = _pComment->getValue(visibility);
return CGRuntime::setGenerationHeader(sComment);
}
void GrfSetGenerationHeader::compileCpp(CppCompilerEnvironment& theCompilerEnvironment) const {
CW_BODY_INDENT << "CGRuntime::setGenerationHeader(";
_pComment->compileCppString(theCompilerEnvironment);
CW_BODY_STREAM << ");";
CW_BODY_ENDL;
}
}
| [
"cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4"
] | [
[
[
1,
49
]
]
] |
9bb77f825bf0088ecdb73b31a8773feff727b53b | cd387cba6088f351af4869c02b2cabbb678be6ae | /src/device/include/sensor.h | b88811910647eb0aafe63a913cb78edeffd2c16e | [] | no_license | 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 | 2,227 | h | /*
* sensor.h
*
* Created on: 15-Feb-2009
* Author: Hok Shun Poon
*/
#ifndef SENSOR_H_
#define SENSOR_H_
/*
* This is messy, but it saves a function call or code duplication.
*/
#define EULER_INTEGRATION(duration, velocity, rotation) \
position.x += (velocity).x*duration; \
position.y += (velocity).y*duration; \
orientation += (rotation)*duration; \
orientation = real_mod_real(orientation, M_2PI);
/*
* Kinematic datatype, it is capable of completing
* Beeman integration. Error terms are ignored. NOTE: not done for orientation/rotations.
*/
#define BEEMAN_INTEGRATION(duration, position, velocity, newAcceleration, acceleration, oldAcceleration) \
position.x += velocity.x*duration + (2*acceleration.x*duration*duration)/3 \
- (oldAcceleration.x*duration*duration)/6; \
position.y += veloctiy.y*duration + (2*acceleration.x*duration*duration)/3 \
- (oldAcceleration.y*duration*duration)/6; \
oldVelocity = velocity; \
velocity.x += (newAcceleration.x*duration)/3 + (5*acceleration.x*duration)/6 \
- (oldAcceleration.x*duration)/6; \
velocity.y += (newAcceleration.y*duration)/3 + (5*acceleration.y*duration)/6 \
- (oldAcceleration.y*duration)/6; \
oldAccleration = accleration; \
acceleration = newAcceleration
#include <core.h>
#include "actuator.h"
using namespace mew::core;
namespace mew {
namespace perception {
/**
* DifferentialOdometricLocator
*
* Uses odometry to provide an estimate of the location at the
* current time.
* This is done by keeping track of old kinematic values.
*/
class DifferentialOdometricLocator : public ILocator {
public:
DifferentialOdometricLocator(DifferentialDriveSystem *drivesys)
: drivesys(drivesys) {
}
private:
DifferentialDriveSystem * drivesys;
};
/**
* DifferntialOdometricOrientator
*
* Uses odometry
*/
class DifferentialOdometricOrientator : public IOrientator {
public:
DifferentialOdometricOrientator(DifferentialDriveSystem *drivesys)
: drivesys(drivesys){
}
private:
DifferentialDriveSystem *drivesys;
};
} /// END of namespace perception
} /// END of namespace mew
#endif /* SENSOR_H_ */
| [
"fushunpoon@1fd432d8-e285-11dd-b2d9-215335d0b316"
] | [
[
[
1,
86
]
]
] |
7a9d5631a4f626797a38aadde523e148553b0734 | b14d5833a79518a40d302e5eb40ed5da193cf1b2 | /cpp/extern/xercesc++/2.6.0/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp | 17b84f4c5c5542ff49b3c68ee559cc4bad9b408d | [
"Apache-2.0"
] | permissive | andyburke/bitflood | dcb3fb62dad7fa5e20cf9f1d58aaa94be30e82bf | fca6c0b635d07da4e6c7fbfa032921c827a981d6 | refs/heads/master | 2016-09-10T02:14:35.564530 | 2011-11-17T09:51:49 | 2011-11-17T09:51:49 | 2,794,411 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,595 | cpp | /*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* $Id: OS400PlatformUtils.cpp,v 1.20 2004/09/23 21:44:13 cargilld Exp $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#define MY_XP_CPLUSPLUS
#include <pthread.h>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/RuntimeException.hpp>
#include <xercesc/util/Janitor.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xercesc/util/PanicHandler.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <qp0z1170.h>
#include <mimchint.h>
#include <string.h>
#include <qmhsndpm.h>
#include <qmhrtvm.h>
#include <qusec.h>
#include <unistd.h>
#include <string.h>
#include <except.h>
#include <mih/cmpswp.h>
#include "OS400PlatformUtils.hpp"
#include <xercesc/util/OutOfMemoryException.hpp>
#if defined (XML_USE_ICONV400_TRANSCODER)
#include <xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp>
void cleanupDefaultConverter();
#elif defined (XML_USE_ICU_TRANSCODER)
#include <xercesc/util/Transcoders/ICU/ICUTransService.hpp>
#else
Transcoder not Specified - For OS/400 must be either ICU or Iconv400
#endif
#if defined(XML_USE_MSGFILE_MESSAGELOADER)
#include <xercesc/util/MsgLoaders/MsgFile/MsgLoader.hpp>
#elif defined(XML_USE_INMEM_MESSAGELOADER)
#include <xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp>
#else
#include <xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp>
#endif
#if defined (XML_USE_NETACCESSOR_SOCKET)
#include <xercesc/util/NetAccessors/Socket/SocketNetAccessor.hpp>
#endif
XERCES_CPP_NAMESPACE_BEGIN
char* PackingRepText(const char * const repText1,
const char * const repText2,
const char * const repText3,
const char * const repText4);
// ---------------------------------------------------------------------------
// XMLPlatformUtils: Platform init method
// ---------------------------------------------------------------------------
XMLNetAccessor* XMLPlatformUtils::makeNetAccessor()
{
#if defined (XML_USE_NETACCESSOR_SOCKET)
return new SocketNetAccessor();
#else
return 0;
#endif
}
//
// This method is called very early in the bootstrapping process. This guy
// must create a transcoding service and return it. It cannot use any string
// methods, any transcoding services, throw any exceptions, etc... It just
// makes a transcoding service and returns it, or returns zero on failure.
//
XMLTransService* XMLPlatformUtils::makeTransService()
#if defined (XML_USE_ICU_TRANSCODER)
{
return new ICUTransService;
}
#elif defined (XML_USE_ICONV400_TRANSCODER)
{
return new Iconv400TransService;
}
#else
{
return new IconvTransService;
}
#endif
//
// This method is called by the platform independent part of this class
// when client code asks to have one of the supported message sets loaded.
// In our case, we use the ICU based message loader mechanism.
//
XMLMsgLoader* XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain)
{
XMLMsgLoader* retVal;
try
{
#if defined(XML_USE_MSGFILE_MESSAGELOADER)
retVal = new MsgCatalogLoader(msgDomain);
#elif defined (XML_USE_ICU_MESSAGELOADER)
retVal = new ICUMsgLoader(msgDomain);
#elif defined (XML_USE_ICONV_MESSAGELOADER)
retVal = new MsgCatalogLoader(msgDomain);
#else
retVal = new InMemMsgLoader(msgDomain);
#endif
}
catch(const OutOfMemoryException&)
{
throw;
}
catch(...)
{
panic( PanicHandler::Panic_CantLoadMsgDomain );
}
return retVal;
}
// ---------------------------------------------------------------------------
// XMLPlatformUtils: The panic method
// ---------------------------------------------------------------------------
void XMLPlatformUtils::panic(const PanicHandler::PanicReasons reason)
{
if (fgUserPanicHandler)
{
fgUserPanicHandler->panic(reason);
}
//
// We just print a message and exit, Note we are currently dependent on
// the number of reasons being under 10 for this teo work
//
else
{
struct reason_code
{
char reason_char;
char endofstring;
}reason_code;
reason_code.reason_char = '0';
reason_code.endofstring = '\0';
reason_code.reason_char = reason_code.reason_char + reason;
send_message((char*)&reason_code,GENERAL_PANIC_MESSAGE,'e');
}
}
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File Methods
// ---------------------------------------------------------------------------
unsigned int XMLPlatformUtils::curFilePos(FileHandle theFile
, MemoryManager* const manager)
{
// Get the current position
int curPos = ftell( (FILE*)theFile);
if (curPos == -1)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetSize, manager);
return (unsigned int)curPos;
}
void XMLPlatformUtils::closeFile(FileHandle theFile
, MemoryManager* const manager)
{
if (fclose((FILE*)theFile))
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotCloseFile, manager);
}
unsigned int XMLPlatformUtils::fileSize(FileHandle theFile
, MemoryManager* const manager)
{
// Get the current position
long int curPos = ftell((FILE*)theFile);
if (curPos == -1)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager);
// Seek to the end and save that value for return
if (fseek( (FILE*)theFile, 0, SEEK_END) )
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotSeekToEnd, manager);
long int retVal = ftell( (FILE*)theFile);
if (retVal == -1)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotSeekToEnd, manager);
// And put the pointer back
if (fseek( (FILE*)theFile, curPos, SEEK_SET) )
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotSeekToPos, manager);
return (unsigned int)retVal;
}
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName
, MemoryManager* const manager)
{ char errno_id[7];
const char* tmpFileName = XMLString::transcode(fileName, manager);
ArrayJanitor<char> janText((char*)tmpFileName, manager);
errno = 0;
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
{
send_message((char*)tmpFileName,FILE_OPEN_PROBLEMS,'d');
convert_errno(errno_id,errno);
send_message(NULL,errno_id,'d');
return 0;
}
return retVal;
}
FileHandle XMLPlatformUtils::openFile(const char* const fileName
, MemoryManager* const manager)
{ char errno_id[7];
errno = 0;
FileHandle retVal = (FILE*)fopen( fileName , "rb" );
if (retVal == NULL)
{
send_message((char*)fileName,FILE_OPEN_PROBLEMS,'d');
convert_errno(errno_id,errno);
send_message(NULL,errno_id,'d');
return 0;
}
return retVal;
}
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName
, MemoryManager* const manager)
{
const char* tmpFileName = XMLString::transcode(fileName, manager);
ArrayJanitor<char> janText((char*)tmpFileName, manager);
return openFileToWrite(tmpFileName);
}
FileHandle XMLPlatformUtils::openFileToWrite(const char* const fileName
, MemoryManager* const manager)
{
char errno_id[7];
errno = 0;
FileHandle retVal = (FILE*)fopen( fileName , "wb" );
if (retVal == NULL)
{
send_message((char*)fileName,FILE_OPEN_PROBLEMS,'d');
convert_errno(errno_id,errno);
send_message(NULL,errno_id,'d');
return 0;
}
return retVal;
}
unsigned int
XMLPlatformUtils::readFileBuffer( FileHandle theFile
, const unsigned int toRead
, XMLByte* const toFill
, MemoryManager* const manager)
{
size_t noOfItemsRead = fread( (void*) toFill, 1, toRead, (FILE*)theFile);
if(ferror((FILE*)theFile))
{
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotReadFromFile, manager);
}
return (unsigned int)noOfItemsRead;
}
void
XMLPlatformUtils::writeBufferToFile( FileHandle const theFile
, long toWrite
, const XMLByte* const toFlush
, MemoryManager* const manager)
{
if (!theFile ||
(toWrite <= 0 ) ||
!toFlush )
return;
const XMLByte* tmpFlush = (const XMLByte*) toFlush;
size_t bytesWritten = 0;
while (true)
{
bytesWritten=fwrite(tmpFlush, sizeof(XMLByte), toWrite, (FILE*)theFile);
if(ferror((FILE*)theFile))
{
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotWriteToFile, manager);
}
if (bytesWritten < toWrite) //incomplete write
{
tmpFlush+=bytesWritten;
toWrite-=bytesWritten;
bytesWritten=0;
}
else
return;
}
return;
}
void XMLPlatformUtils::resetFile(FileHandle theFile
, MemoryManager* const manager)
{
// Seek to the start of the file
if (fseek((FILE*)theFile, 0, SEEK_SET) )
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotResetFile, manager);
}
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
/* since we do not have the realpath function on AS/400 and it appears
to no be important that we convert the name to the real path we will
only verify that the path exists - note that this may make AS/400 output a different error for the pathname but customer should
be able to determine what the name is suppose to be*/
char *realpath(const char *file_name, char *resolved_name)
{
if (file_name== NULL)
{
errno = EINVAL;
return(NULL);
}
if (access(file_name,F_OK)) /* verify that the file exists*/
{
errno = EACCES;
return(NULL);
}
else
/* code says that we make a copy of the file name so do it */
strcpy(resolved_name,file_name);
return(resolved_name);
}
XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
MemoryManager* const manager)
{
//
// NOTE: THe path provided has always already been opened successfully,
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
char* newSrc = XMLString::transcode(srcPath, manager);
ArrayJanitor<char> janText(newSrc, manager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
//get the absolute path
char* retPath = realpath(newSrc, &absPath[0]);
if (!retPath)
{
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager);
}
return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
, MemoryManager* const manager)
{
// Check for pathological case of empty path
if (!toCheck[0])
return false;
//
// If it starts with a slash, then it cannot be relative. This covers
// both something like "\Test\File.xml" and an NT Lan type remote path
// that starts with a node like "\\MyNode\Test\File.xml".
//
if (*toCheck == chForwardSlash)
return false;
// Else assume its a relative path
return true;
}
XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 2];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
if (!curDir)
{
ThrowXMLwithMemMgr(XMLPlatformUtilsException,
XMLExcepts::File_CouldNotGetBasePathName, manager);
}
return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
{
return ( chBackSlash == c || chForwardSlash == c);
}
void send_message (char * text, char * messageid, char type)
{
short textsize;
char* buffer;
char* anchor;
char* id;
char message_id[8] = "CPF9897";/* id for raw txt
message */
char message_file_name[21];
char message_type[11] ="*DIAG ";/* send diagnostic
message */
char call_stack[11] ="* " ;/* current callstack*/
int call_stack_counter= 0;/* sent to current call stack */
char message_key[4]; /* return value - not used */
struct {
int bytes_available;
int bytes_used;
char exception_id[7];
char reserved;
char exception_data[1];
} error_code;
int msg_size;
char* msg_type;
error_code.bytes_available = sizeof(error_code);
/* check input parameters and set up the message information */
if (messageid != 0) /* was a message id passed */
{
if (strncmp(messageid,"CPF",3) &&
strncmp(messageid,"CPE",3))
strcpy(message_file_name,"QXMLMSG *LIBL ");
else
strcpy(message_file_name,"QCPFMSG QSYS ");
id = messageid; /* yes - use the id, will be
in QCPFMSG */
}
else /* just use what we have for immediate text */
{
id = &message_id[0];
strcpy(message_file_name,"QCPFMSG QSYS ");
}
if (type == 'e') /* is this the terminating exception */
msg_type = "*COMP ";/* set it as completion */
else /* currently all other messages are
diagnostics */
msg_type = "*DIAG ";
if (text != 0) /* was a text field passed */
{
textsize = strlen(text);
msg_size = textsize + sizeof(short);
buffer = (char*)malloc(msg_size);
anchor = buffer;
memcpy(buffer, (void*)&textsize, sizeof(short));
buffer +=sizeof(short);
memcpy(buffer, text, textsize);
}
else
msg_size = 0;
#pragma exception_handler(jsendprob, 0, _C1_ALL, _C2_ALL,_CTLA_HANDLE)
QMHSNDPM((char *)id,&message_file_name,anchor,
msg_size,(char*)msg_type,(char*)&call_stack,
call_stack_counter,&message_key,&error_code);
jsendprob:
#pragma disable_handler
return ;
}
void abnormal_termination(int termcode)
{
send_message(NULL,"CPF9899",'e'); /* send final exception that we have terminated*/
}
// ---------------------------------------------------------------------------
// XMLPlatformUtils: Timing Methods
// ---------------------------------------------------------------------------
unsigned long XMLPlatformUtils::getCurrentMillis()
{
_MI_Time mt;
struct timeval tv;
int rc;
mattod(mt);
rc = Qp0zCvtToTimeval(&tv, mt, QP0Z_CVTTIME_TO_TIMESTAMP);
return((tv.tv_sec*1000 )+ (tv.tv_usec/1000));
}
// -----------------------------------------------------------------------
// Mutex methods
// -----------------------------------------------------------------------
#if !defined (APP_NO_THREADS)
static pthread_mutex_t* gAtomicOpMutex =0 ;
void XMLPlatformUtils::platformInit()
{
//
// The gAtomicOpMutex mutex needs to be created
// because compareAndSwap and incrementlocation and decrementlocation
// does not have the atomic system calls for usage
// Normally, mutexes are created on first use, but there is a
// circular dependency between compareAndExchange() and
// mutex creation that must be broken.
gAtomicOpMutex = new pthread_mutex_t;
if (pthread_mutex_init(gAtomicOpMutex, NULL)) {
delete gAtomicOpMutex;
gAtomicOpMutex = 0;
panic( PanicHandler::Panic_SystemInit );
}
}
class RecursiveMutex : public XMemory
{
public:
pthread_mutex_t mutex;
int recursionCount;
pthread_t tid;
RecursiveMutex() {
if (pthread_mutex_init(&mutex, NULL))
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotCreate, XMLPlatformUtils::fgMemoryManager);
recursionCount = 0;
tid.reservedHiId = 0;
tid.reservedLoId = 0;
tid.reservedHandle = 0;
}
~RecursiveMutex() {
if (pthread_mutex_destroy(&mutex))
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotDestroy, XMLPlatformUtils::fgMemoryManager);
}
void lock() {
if (pthread_equal(tid, pthread_self()))
{
recursionCount++;
return;
}
if (pthread_mutex_lock(&mutex) != 0)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotLock, XMLPlatformUtils::fgMemoryManager);
tid = pthread_self();
recursionCount = 1;
}
void unlock() {
if (--recursionCount > 0)
return;
if (pthread_mutex_unlock(&mutex) != 0)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotUnlock, XMLPlatformUtils::fgMemoryManager);
tid.reservedHandle= 0;
tid.reservedHiId = 0;
tid.reservedLoId = 0;
}
};
void* XMLPlatformUtils::makeMutex()
{
return new RecursiveMutex;
}
void XMLPlatformUtils::closeMutex(void* const mtxHandle)
{
if (mtxHandle == NULL)
return;
RecursiveMutex *rm = (RecursiveMutex *)mtxHandle;
delete rm;
}
void XMLPlatformUtils::lockMutex(void* const mtxHandle)
{
if (mtxHandle == NULL)
return;
RecursiveMutex *rm = (RecursiveMutex *)mtxHandle;
rm->lock();
}
void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
{
if (mtxHandle == NULL)
return;
RecursiveMutex *rm = (RecursiveMutex *)mtxHandle;
rm->unlock();
}
// -----------------------------------------------------------------------
// Miscellaneous synchronization methods
// -----------------------------------------------------------------------
//atomic system calls in Solaris is only restricted to kernel libraries
//So, to make operations thread safe we implement static mutex and lock
//the atomic operations. It makes the process slow but what's the alternative!
void* XMLPlatformUtils::compareAndSwap ( void** toFill ,
const void* const newValue ,
const void* const toCompare)
{
//return ((void*)cas32( (uint32_t*)toFill, (uint32_t)toCompare, (uint32_t)newValue) );
// the below calls are temporarily made till the above functions are part of user library
// Currently its supported only in the kernel mode
if (pthread_mutex_lock( gAtomicOpMutex))
panic(PanicHandler::Panic_SynchronizationErr);
void *retVal = *toFill;
if (*toFill == toCompare)
*toFill = (void *)newValue;
if (pthread_mutex_unlock( gAtomicOpMutex))
panic(PanicHandler::Panic_SynchronizationErr);
return retVal;
}
int XMLPlatformUtils::atomicIncrement(int &location)
{
int current = location;
int new_loc = current+1;
while (_CMPSWP(¤t,
&location,
new_loc) == 0)
new_loc = current+1;
int tmp = new_loc;
return tmp;
}
int XMLPlatformUtils::atomicDecrement(int &location)
{
int current = location;
int new_loc = current-1;
while (_CMPSWP(¤t,
&location,
new_loc) == 0)
new_loc = current-1;
int tmp = new_loc;
return tmp;
}
#else // #if !defined (APP_NO_THREADS)
void XMLPlatformUtils::platformInit()
{
// do nothing
}
void XMLPlatformUtils::closeMutex(void* const mtxHandle)
{
}
void XMLPlatformUtils::lockMutex(void* const mtxHandle)
{
}
void* XMLPlatformUtils::makeMutex()
{
return 0;
}
void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
{
}
void* XMLPlatformUtils::compareAndSwap ( void** toFill,
const void* const newValue,
const void* const toCompare)
{
void *retVal = *toFill;
if (*toFill == toCompare)
*toFill = (void *)newValue;
return retVal;
}
int XMLPlatformUtils::atomicIncrement(int &location)
{
return ++location;
}
int XMLPlatformUtils::atomicDecrement(int &location)
{
return --location;
}
#endif // APP_NO_THREADS
/*
* convert the errno value to a cpf message identifier by converting the
* error to its decimal equivalent and appending "CPE" to the front
* note that the caller passes the storage for the message id as a parm
*/
void convert_errno(char* errno_id,int errnum)
{
sprintf(errno_id,"CPE%d04" ,errnum );
return;
}
FileHandle XMLPlatformUtils::openStdInHandle(MemoryManager* const manager)
{
return (FileHandle)fdopen(dup(0), "rb");
}
void XMLPlatformUtils::platformTerm()
{
#if !defined (APP_NO_THREADS)
pthread_mutex_destroy(gAtomicOpMutex);
delete gAtomicOpMutex;
gAtomicOpMutex = 0;
#endif
#if defined (XML_USE_ICONV400_TRANSCODER)
cleanupDefaultConverter();
#endif
}
#include <xercesc/util/LogicalPath.c>
XERCES_CPP_NAMESPACE_END
| [
"[email protected]"
] | [
[
[
1,
767
]
]
] |
ad367c99938ec4463ab01cabccf68fce3f103f88 | 028d79ad6dd6bb4114891b8f4840ef9f0e9d4a32 | /src/drivers/mrdo.cpp | 29fbc3a0cba36fa74125c0738b50598d327c9975 | [] | no_license | neonichu/iMame4All-for-iPad | 72f56710d2ed7458594838a5152e50c72c2fb67f | 4eb3d4ed2e5ccb5c606fcbcefcb7c5a662ace611 | refs/heads/master | 2020-04-21T07:26:37.595653 | 2011-11-26T12:21:56 | 2011-11-26T12:21:56 | 2,855,022 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,373 | cpp | #include "../vidhrdw/mrdo.cpp"
/***************************************************************************
Mr Do! memory map (preliminary)
driver by Nicola Salmoria
0000-7fff ROM
8000-83ff color RAM 1
8400-87ff video RAM 1
8800-8bff color RAM 2
8c00-8fff video RAM 2
e000-efff RAM
memory mapped ports:
read:
9803 SECRE 1/6-J2-11
a000 IN0
a001 IN1
a002 DSW1
a003 DSW2
write:
9000-90ff sprites, 64 groups of 4 bytes.
9800 flip (bit 0) playfield priority selector? (bits 1-3)
9801 sound port 1
9802 sound port 2
f000 playfield 0 Y scroll position (not used by Mr. Do!)
f800 playfield 0 X scroll position
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
#include "cpu/z80/z80.h"
extern unsigned char *mrdo_bgvideoram,*mrdo_fgvideoram;
WRITE_HANDLER( mrdo_bgvideoram_w );
WRITE_HANDLER( mrdo_fgvideoram_w );
WRITE_HANDLER( mrdo_scrollx_w );
WRITE_HANDLER( mrdo_scrolly_w );
WRITE_HANDLER( mrdo_flipscreen_w );
void mrdo_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
int mrdo_vh_start(void);
void mrdo_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
/* this looks like some kind of protection. The game doesn't clear the screen */
/* if a read from this address doesn't return the value it expects. */
READ_HANDLER( mrdo_SECRE_r )
{
unsigned char *RAM = memory_region(REGION_CPU1);
return RAM[ cpu_get_reg(Z80_HL) ];
}
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x7fff, MRA_ROM },
{ 0x8000, 0x8fff, MRA_RAM }, /* video and color RAM */
{ 0x9803, 0x9803, mrdo_SECRE_r },
{ 0xa000, 0xa000, input_port_0_r }, /* IN0 */
{ 0xa001, 0xa001, input_port_1_r }, /* IN1 */
{ 0xa002, 0xa002, input_port_2_r }, /* DSW1 */
{ 0xa003, 0xa003, input_port_3_r }, /* DSW2 */
{ 0xe000, 0xefff, MRA_RAM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x7fff, MWA_ROM },
{ 0x8000, 0x87ff, mrdo_bgvideoram_w, &mrdo_bgvideoram },
{ 0x8800, 0x8fff, mrdo_fgvideoram_w, &mrdo_fgvideoram },
{ 0x9000, 0x90ff, MWA_RAM, &spriteram, &spriteram_size },
{ 0x9800, 0x9800, mrdo_flipscreen_w }, /* screen flip + playfield priority */
{ 0x9801, 0x9801, SN76496_0_w },
{ 0x9802, 0x9802, SN76496_1_w },
{ 0xe000, 0xefff, MWA_RAM },
{ 0xf000, 0xf7ff, mrdo_scrollx_w },
{ 0xf800, 0xffff, mrdo_scrolly_w },
{ -1 } /* end of table */
};
INPUT_PORTS_START( mrdo )
PORT_START /* IN0 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
PORT_START /* IN1 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_START /* DSW0 */
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
PORT_DIPSETTING( 0x03, "Easy" )
PORT_DIPSETTING( 0x02, "Medium" )
PORT_DIPSETTING( 0x01, "Hard" )
PORT_DIPSETTING( 0x00, "Hardest" )
PORT_BITX( 0x04, 0x04, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x08, "Special" )
PORT_DIPSETTING( 0x08, "Easy" )
PORT_DIPSETTING( 0x00, "Hard" )
PORT_DIPNAME( 0x10, 0x10, "Extra" )
PORT_DIPSETTING( 0x10, "Easy" )
PORT_DIPSETTING( 0x00, "Hard" )
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
PORT_DIPSETTING( 0x00, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_DIPSETTING( 0x40, "5" )
PORT_START /* DSW1 */
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_B ) )
PORT_DIPSETTING( 0x06, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x09, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
/* settings 0x01 thru 0x05 all give 1 Coin/1 Credit */
PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_A ) )
PORT_DIPSETTING( 0x60, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x70, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x90, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
/* settings 0x10 thru 0x50 all give 1 Coin/1 Credit */
INPUT_PORTS_END
static struct GfxLayout charlayout =
{
8,8, /* 8*8 characters */
512, /* 512 characters */
2, /* 2 bits per pixel */
{ 0, 512*8*8 }, /* the two bitplanes are separated */
{ 7, 6, 5, 4, 3, 2, 1, 0 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8 /* every char takes 8 consecutive bytes */
};
static struct GfxLayout spritelayout =
{
16,16, /* 16*16 sprites */
128, /* 128 sprites */
2, /* 2 bits per pixel */
{ 4, 0 }, /* the two bitplanes for 4 pixels are packed into one byte */
{ 3, 2, 1, 0, 8+3, 8+2, 8+1, 8+0,
16+3, 16+2, 16+1, 16+0, 24+3, 24+2, 24+1, 24+0 },
{ 0*16, 2*16, 4*16, 6*16, 8*16, 10*16, 12*16, 14*16,
16*16, 18*16, 20*16, 22*16, 24*16, 26*16, 28*16, 30*16 },
64*8 /* every sprite takes 64 consecutive bytes */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
{ REGION_GFX1, 0, &charlayout, 0, 64 }, /* colors 0-255 directly mapped */
{ REGION_GFX2, 0, &charlayout, 0, 64 },
{ REGION_GFX3, 0, &spritelayout, 4*64, 16 },
{ -1 } /* end of array */
};
static struct SN76496interface sn76496_interface =
{
2, /* 2 chips */
{ 4000000, 4000000 }, /* 4 MHz */
{ 50, 50 }
};
static struct MachineDriver machine_driver_mrdo =
{
/* basic machine hardware */
{
{
CPU_Z80,
4000000, /* 4 Mhz */
readmem,writemem,0,0,
interrupt,1
}
},
60, DEFAULT_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* single CPU, no need for interleaving */
0,
/* video hardware */
32*8, 32*8, { 1*8, 31*8-1, 4*8, 28*8-1 },
gfxdecodeinfo,
256,64*4+16*4,
mrdo_vh_convert_color_prom,
VIDEO_TYPE_RASTER,
0,
mrdo_vh_start,
0,
mrdo_vh_screenrefresh,
/* sound hardware */
0,0,0,0,
{
{
SOUND_SN76496,
&sn76496_interface
}
}
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( mrdo )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "a4-01.bin", 0x0000, 0x2000, 0x03dcfba2 )
ROM_LOAD( "c4-02.bin", 0x2000, 0x2000, 0x0ecdd39c )
ROM_LOAD( "e4-03.bin", 0x4000, 0x2000, 0x358f5dc2 )
ROM_LOAD( "f4-04.bin", 0x6000, 0x2000, 0xf4190cfc )
ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "s8-09.bin", 0x0000, 0x1000, 0xaa80c5b6 )
ROM_LOAD( "u8-10.bin", 0x1000, 0x1000, 0xd20ec85b )
ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "r8-08.bin", 0x0000, 0x1000, 0xdbdc9ffa )
ROM_LOAD( "n8-07.bin", 0x1000, 0x1000, 0x4b9973db )
ROM_REGION( 0x2000, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "h5-05.bin", 0x0000, 0x1000, 0xe1218cc5 )
ROM_LOAD( "k5-06.bin", 0x1000, 0x1000, 0xb1f68b04 )
ROM_REGION( 0x0060, REGION_PROMS )
ROM_LOAD( "u02--2.bin", 0x0000, 0x0020, 0x238a65d7 ) /* palette (high bits) */
ROM_LOAD( "t02--3.bin", 0x0020, 0x0020, 0xae263dc0 ) /* palette (low bits) */
ROM_LOAD( "f10--1.bin", 0x0040, 0x0020, 0x16ee4ca2 ) /* sprite color lookup table */
ROM_END
ROM_START( mrdot )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "d1", 0x0000, 0x2000, 0x3dcd9359 )
ROM_LOAD( "d2", 0x2000, 0x2000, 0x710058d8 )
ROM_LOAD( "d3", 0x4000, 0x2000, 0x467d12d8 )
ROM_LOAD( "d4", 0x6000, 0x2000, 0xfce9afeb )
ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "d9", 0x0000, 0x1000, 0xde4cfe66 )
ROM_LOAD( "d10", 0x1000, 0x1000, 0xa6c2f38b )
ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "r8-08.bin", 0x0000, 0x1000, 0xdbdc9ffa )
ROM_LOAD( "n8-07.bin", 0x1000, 0x1000, 0x4b9973db )
ROM_REGION( 0x2000, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "h5-05.bin", 0x0000, 0x1000, 0xe1218cc5 )
ROM_LOAD( "k5-06.bin", 0x1000, 0x1000, 0xb1f68b04 )
ROM_REGION( 0x0060, REGION_PROMS )
ROM_LOAD( "u02--2.bin", 0x0000, 0x0020, 0x238a65d7 ) /* palette (high bits) */
ROM_LOAD( "t02--3.bin", 0x0020, 0x0020, 0xae263dc0 ) /* palette (low bits) */
ROM_LOAD( "f10--1.bin", 0x0040, 0x0020, 0x16ee4ca2 ) /* sprite color lookup table */
ROM_END
ROM_START( mrdofix )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "d1", 0x0000, 0x2000, 0x3dcd9359 )
ROM_LOAD( "d2", 0x2000, 0x2000, 0x710058d8 )
ROM_LOAD( "dofix.d3", 0x4000, 0x2000, 0x3a7d039b )
ROM_LOAD( "dofix.d4", 0x6000, 0x2000, 0x32db845f )
ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "d9", 0x0000, 0x1000, 0xde4cfe66 )
ROM_LOAD( "d10", 0x1000, 0x1000, 0xa6c2f38b )
ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "r8-08.bin", 0x0000, 0x1000, 0xdbdc9ffa )
ROM_LOAD( "n8-07.bin", 0x1000, 0x1000, 0x4b9973db )
ROM_REGION( 0x2000, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "h5-05.bin", 0x0000, 0x1000, 0xe1218cc5 )
ROM_LOAD( "k5-06.bin", 0x1000, 0x1000, 0xb1f68b04 )
ROM_REGION( 0x0060, REGION_PROMS )
ROM_LOAD( "u02--2.bin", 0x0000, 0x0020, 0x238a65d7 ) /* palette (high bits) */
ROM_LOAD( "t02--3.bin", 0x0020, 0x0020, 0xae263dc0 ) /* palette (low bits) */
ROM_LOAD( "f10--1.bin", 0x0040, 0x0020, 0x16ee4ca2 ) /* sprite color lookup table */
ROM_END
ROM_START( mrlo )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "mrlo01.bin", 0x0000, 0x2000, 0x6f455e7d )
ROM_LOAD( "d2", 0x2000, 0x2000, 0x710058d8 )
ROM_LOAD( "dofix.d3", 0x4000, 0x2000, 0x3a7d039b )
ROM_LOAD( "mrlo04.bin", 0x6000, 0x2000, 0x49c10274 )
ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "mrlo09.bin", 0x0000, 0x1000, 0xfdb60d0d )
ROM_LOAD( "mrlo10.bin", 0x1000, 0x1000, 0x0492c10e )
ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "r8-08.bin", 0x0000, 0x1000, 0xdbdc9ffa )
ROM_LOAD( "n8-07.bin", 0x1000, 0x1000, 0x4b9973db )
ROM_REGION( 0x2000, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "h5-05.bin", 0x0000, 0x1000, 0xe1218cc5 )
ROM_LOAD( "k5-06.bin", 0x1000, 0x1000, 0xb1f68b04 )
ROM_REGION( 0x0060, REGION_PROMS )
ROM_LOAD( "u02--2.bin", 0x0000, 0x0020, 0x238a65d7 ) /* palette (high bits) */
ROM_LOAD( "t02--3.bin", 0x0020, 0x0020, 0xae263dc0 ) /* palette (low bits) */
ROM_LOAD( "f10--1.bin", 0x0040, 0x0020, 0x16ee4ca2 ) /* sprite color lookup table */
ROM_END
ROM_START( mrdu )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "d1", 0x0000, 0x2000, 0x3dcd9359 )
ROM_LOAD( "d2", 0x2000, 0x2000, 0x710058d8 )
ROM_LOAD( "d3", 0x4000, 0x2000, 0x467d12d8 )
ROM_LOAD( "du4.bin", 0x6000, 0x2000, 0x893bc218 )
ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "du9.bin", 0x0000, 0x1000, 0x4090dcdc )
ROM_LOAD( "du10.bin", 0x1000, 0x1000, 0x1e63ab69 )
ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "r8-08.bin", 0x0000, 0x1000, 0xdbdc9ffa )
ROM_LOAD( "n8-07.bin", 0x1000, 0x1000, 0x4b9973db )
ROM_REGION( 0x2000, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "h5-05.bin", 0x0000, 0x1000, 0xe1218cc5 )
ROM_LOAD( "k5-06.bin", 0x1000, 0x1000, 0xb1f68b04 )
ROM_REGION( 0x0060, REGION_PROMS )
ROM_LOAD( "u02--2.bin", 0x0000, 0x0020, 0x238a65d7 ) /* palette (high bits) */
ROM_LOAD( "t02--3.bin", 0x0020, 0x0020, 0xae263dc0 ) /* palette (low bits) */
ROM_LOAD( "f10--1.bin", 0x0040, 0x0020, 0x16ee4ca2 ) /* sprite color lookup table */
ROM_END
ROM_START( mrdoy )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "dosnow.1", 0x0000, 0x2000, 0xd3454e2c )
ROM_LOAD( "dosnow.2", 0x2000, 0x2000, 0x5120a6b2 )
ROM_LOAD( "dosnow.3", 0x4000, 0x2000, 0x96416dbe )
ROM_LOAD( "dosnow.4", 0x6000, 0x2000, 0xc05051b6 )
ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "dosnow.9", 0x0000, 0x1000, 0x85d16217 )
ROM_LOAD( "dosnow.10", 0x1000, 0x1000, 0x61a7f54b )
ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "dosnow.8", 0x0000, 0x1000, 0x2bd1239a )
ROM_LOAD( "dosnow.7", 0x1000, 0x1000, 0xac8ffddf )
ROM_REGION( 0x2000, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "dosnow.5", 0x0000, 0x1000, 0x7662d828 )
ROM_LOAD( "dosnow.6", 0x1000, 0x1000, 0x413f88d1 )
ROM_REGION( 0x0060, REGION_PROMS )
ROM_LOAD( "u02--2.bin", 0x0000, 0x0020, 0x238a65d7 ) /* palette (high bits) */
ROM_LOAD( "t02--3.bin", 0x0020, 0x0020, 0xae263dc0 ) /* palette (low bits) */
ROM_LOAD( "f10--1.bin", 0x0040, 0x0020, 0x16ee4ca2 ) /* sprite color lookup table */
ROM_END
ROM_START( yankeedo )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "a4-01.bin", 0x0000, 0x2000, 0x03dcfba2 )
ROM_LOAD( "yd_d2.c4", 0x2000, 0x2000, 0x7c9d7ce0 )
ROM_LOAD( "e4-03.bin", 0x4000, 0x2000, 0x358f5dc2 )
ROM_LOAD( "f4-04.bin", 0x6000, 0x2000, 0xf4190cfc )
ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "s8-09.bin", 0x0000, 0x1000, 0xaa80c5b6 )
ROM_LOAD( "u8-10.bin", 0x1000, 0x1000, 0xd20ec85b )
ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "r8-08.bin", 0x0000, 0x1000, 0xdbdc9ffa )
ROM_LOAD( "n8-07.bin", 0x1000, 0x1000, 0x4b9973db )
ROM_REGION( 0x2000, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "yd_d5.h5", 0x0000, 0x1000, 0xf530b79b )
ROM_LOAD( "yd_d6.k5", 0x1000, 0x1000, 0x790579aa )
ROM_REGION( 0x0060, REGION_PROMS )
ROM_LOAD( "u02--2.bin", 0x0000, 0x0020, 0x238a65d7 ) /* palette (high bits) */
ROM_LOAD( "t02--3.bin", 0x0020, 0x0020, 0xae263dc0 ) /* palette (low bits) */
ROM_LOAD( "f10--1.bin", 0x0040, 0x0020, 0x16ee4ca2 ) /* sprite color lookup table */
ROM_END
GAME( 1982, mrdo, 0, mrdo, mrdo, 0, ROT270, "Universal", "Mr. Do! (Universal)" )
GAME( 1982, mrdot, mrdo, mrdo, mrdo, 0, ROT270, "Universal (Taito license)", "Mr. Do! (Taito)" )
GAME( 1982, mrdofix, mrdo, mrdo, mrdo, 0, ROT270, "Universal (Taito license)", "Mr. Do! (bugfixed)" )
GAME( 1982, mrlo, mrdo, mrdo, mrdo, 0, ROT270, "bootleg", "Mr. Lo!" )
GAME( 1982, mrdu, mrdo, mrdo, mrdo, 0, ROT270, "bootleg", "Mr. Du!" )
GAME( 1982, mrdoy, mrdo, mrdo, mrdo, 0, ROT270, "bootleg", "Mr. Do! (Yukidaruma)" )
GAME( 1982, yankeedo, mrdo, mrdo, mrdo, 0, ROT270, "hack", "Yankee DO!" )
| [
"[email protected]"
] | [
[
[
1,
440
]
]
] |
5cc017d7260ec8093885f84369e658210b44a05b | aab4c401149d8cdee10094d4fb4de98f490be3b6 | /src/modules/qTexturer.cpp | d95ff954b9573a4627c8acb534b28117694b9a4a | [] | no_license | soulik/quads | a7a49e32dcd137fd32fd45b60fa26b5c0747bd03 | ce440c5d35448908fd936797bff0cb7a9ff78b6e | refs/heads/master | 2016-09-08T00:18:28.704939 | 2008-09-01T14:18:42 | 2008-09-01T14:18:42 | 32,122,815 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,378 | cpp | #include "modules/qTexturer.h"
#include "errors/exception.h"
qTexturer::qTexturer(cBase * parent): cModule(parent){
#ifndef NO_MUTEX
tex_mutex = SDL_CreateMutex();
#endif
setName("qTexturer");
base_dir = (char*)malloc(512);
#ifdef DEBUGGING
dprintf("qTexturer()\n");
#endif
}
qTexturer::~qTexturer(){
for (unsigned int i=0; i<images.size() ; i++){
delete images[i];
}
free(base_dir);
images.clear();
#ifndef NO_MUTEX
SDL_DestroyMutex(tex_mutex);
#endif
}
void qTexturer::setBaseDir(const char * dir){
if (dir){
strcpy(base_dir,dir);
}else{
dprintf("Tried to set NULL base dir\n");
}
}
unsigned int qTexturer::addImage(float width, float height, int flags, const char * name){
#ifndef NO_MUTEX
SDL_mutexP(tex_mutex);
#endif
qImage * img = new qImage();
img->createEmpty(width, height,flags);
images.push_back(img);
image_names[name] = images.size()-1;
#ifndef NO_MUTEX
SDL_mutexV(tex_mutex);
#endif
return (uint)images.size();
}
unsigned int qTexturer::loadImage(const char *fname, unsigned int flags){
#ifndef NO_MUTEX
SDL_mutexP(tex_mutex);
#endif
if (!fname) return 0;
qImage * img = new qImage();
char temp[512];
strcpy(temp,base_dir);
if (img->load(strcat(temp,fname),flags)!=1) return 0;
images.push_back(img);
image_names[fname] = images.size()-1;
#ifndef NO_MUTEX
SDL_mutexV(tex_mutex);
#endif
return (uint)images.size();
}
qImage * qTexturer::getImage(unsigned int id){
#ifndef NO_MUTEX
SDL_mutexP(tex_mutex);
#endif
if (id>=images.size()) return 0;
if (!images[id]) throw (cException("Image NULL"));
#ifndef NO_MUTEX
SDL_mutexV(tex_mutex);
#endif
//temporary solution
while (!images[id]->state){
SDL_Delay(1);
}
return images[id];
}
qImage * qTexturer::getImage(const char * name){
#ifndef NO_MUTEX
SDL_mutexP(tex_mutex);
#endif
if (!name) return 0;
size_t id=0;
map<string, uint>::iterator found = image_names.find(name);
if (found != image_names.end()){
id = found->second;
}else throw (cException("Can't find image"));
if (!images[id]) throw (cException("Image NULL"));
#ifndef NO_MUTEX
SDL_mutexV(tex_mutex);
#endif
//temporary solution
while (!images[id]->state){
SDL_Delay(1);
}
return images[id];
}
void qTexturer::init(){
status = TS_RUNNING;
}
void qTexturer::stop(){
status = 0;
} | [
"soulik42@89f801e3-d555-0410-a9c1-35b9be595399"
] | [
[
[
1,
108
]
]
] |
6f8541db2f73d12fd0b9569f6c9868f27ae1ec96 | 38926bfe477f933a307f51376dd3c356e7893ffc | /Source/GameDLL/Menus/MPHub.cpp | 527902257606d7bcc2b2c80374a8414e987e8cb7 | [] | no_license | richmondx/dead6 | b0e9dd94a0ebb297c0c6e9c4f24c6482ef4d5161 | 955f76f35d94ed5f991871407f3d3ad83f06a530 | refs/heads/master | 2021-12-05T14:32:01.782047 | 2008-01-01T13:13:39 | 2008-01-01T13:13:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 25,196 | cpp | #include "StdAfx.h"
#include "INetwork.h"
#include "INetworkService.h"
#include "MPHub.h"
#include "MultiplayerMenu.h"
#include "QuickGame.h"
#include "GameNetworkProfile.h"
#include "Game.h"
#include "IGameFramework.h"
#include "IPlayerProfiles.h"
#include "OptionsManager.h"
#include "FlashMenuObject.h"
#include <IVideoPlayer.h>
static TKeyValuePair<EGsUiCommand,const char*>
gUiCommands[] = {
{eGUC_none,""},
{eGUC_opened,"MenuOpened"},
{eGUC_back,"Back"},
{eGUC_cancel,"LoginCancelled"},
{eGUC_login,"Login"},
{eGUC_logoff,"AccountDisconnect"},
{eGUC_accountInfo,"ShowAcountInfo"},
{eGUC_disableAutoLogin,"AutoDisconnect"},
{eGUC_rememberPassword,"MPLogin_RememberPassword"},
{eGUC_forgotPassword,"MPLogin_ForgotPassword"},
{eGUC_autoLogin,"MPLogin_AutoLogin"},
{eGUC_internetGame,"MP_InternetGame"},
{eGUC_recordedGames,"MP_RecordedGames"},
{eGUC_enterlobby,"LobbyEnter"},
{eGUC_leavelobby,"LobbyLeave"},
{eGUC_enterLANlobby,"LanLobbyEnter"},
{eGUC_leaveLANlobby,"LanLobbyLeave"},
{eGUC_enterLoginScreen,"EnterLoginScreen"},
{eGUC_leaveLoginScreen,"LeaveLoginScreen"},
{eGUC_update,"UpdateServerList"},
{eGUC_stop,"StopUpdate"},
{eGUC_setVisibleServers,"SetVisibleServers"},
{eGUC_displayServerList,"GetServerList"},
{eGUC_serverScrollBarPos,"ServerScrollbarPos"},
{eGUC_serverScroll,"ScrollServerList"},
{eGUC_refreshServer,"RefreshServerList"},
{eGUC_selectServer,"SetSelectServer"},
{eGUC_addFavorite,"AddToFavourites"},
{eGUC_removeFavorite,"RemoveFromFavourites"},
{eGUC_sortColumn,"SetSortColumn"},
{eGUC_join,"JoinServer"},
{eGUC_joinIP,"ConnectToServerIP"},
{eGUC_joinPassword,"JoinServerWithPassword"},
{eGUC_disconnect,"Disconnect"},
{eGUC_tab,"TabEnter"},
{eGUC_chatClick,"OnBuddyClick"},
{eGUC_chatOpen,"OnBuddyOpen"},
{eGUC_chat,"EnteredMessage"},
{eGUC_find,"UserFind"},
{eGUC_addBuddy,"AddToBuddies"},
{eGUC_addIgnore,"AddToIgnore"},
{eGUC_addBuddyFromFind,"FindAddToBuddies"},
{eGUC_addBuddyFromInfo,"InfoAddToBuddies"},
{eGUC_addIgnoreFromInfo,"InfoAddToIgnore"},
{eGUC_removeBuddy,"RemoveFromBuddies"},
{eGUC_inviteBuddy,"sendinvitation"},
{eGUC_stopIgnore,"StopIgnoring"},
{eGUC_acceptBuddy,"AddFriendAccepted"},
{eGUC_declineBuddy,"AddFriendDeclined"},
{eGUC_displayInfo,"ShowInfoOn"},
{eGUC_displayInfoInList,"ShowBuddyListInfoOn"},
{eGUC_joinBuddy,"JoinBuddy"},
{eGUC_userScrollBarPos,"BuddyScrollbarPos"},
{eGUC_userScroll,"ScrollBuddyList"},
{eGUC_chatScrollBarPos,"ChatScrollbarPos"},
{eGUC_chatScroll,"ScrollChatList"},
{eGUC_register,"MPAccount_START"},
{eGUC_registerNick,"MPAccount_LOGIN"},
{eGUC_registerEmail,"MPAccount_EMAIL"},
{eGUC_registerDateMM,"MPAccount_DATE_MONTH"},
{eGUC_registerDateDD,"MPAccount_DATE_DAY"},
{eGUC_registerDateYY,"MPAccount_DATE_YEAR"},
{eGUC_registerCountry,"MPAccount_COUNTRY"},
{eGUC_registerEnd,"MPAccount_END"},
{eGUC_quickGame,"MP_QuickGame"},
{eGUC_createServerStart,"StartServer"},
{eGUC_createServerUpdateLevels,"CreateServer_GameMode"},
{eGUC_createServerOpened,"CreateGameOpened"},
{eGUC_createServerParams,"GetGlobalSettings"},
{eGUC_dialogClosed,"LoadingCanceled"},
{eGUC_dialogYes,"ErrorBoxYes"},
{eGUC_dialogNo,"ErrorBoxNo"},
{eGUC_filtersDisplay,"FiltersOpened"},
{eGUC_filtersEnable,"MPFilter_Enabled"},
{eGUC_filtersMode,"MPFilter_GameMode"},
{eGUC_filtersMap,"MPFilter_Mapname"},
{eGUC_filtersPing,"MPFilter_Ping"},
{eGUC_filtersNotFull,"MPFilter_NotFull"},
{eGUC_filtersNotEmpty,"MPFilter_NotEmpty"},
{eGUC_filtersNoPassword,"MPFilter_NoPassword"},
{eGUC_filtersAutoTeamBalance,"MPFilter_AutoTeam"},
{eGUC_filtersAntiCheat,"MPFilter_AntiCheat"},
{eGUC_filtersFriendlyFire,"MPFilter_FriendlyFire"},
{eGUC_filtersGamepadsOnly,"MPFilter_GamepadsOnly"},
{eGUC_filtersNoVoiceComms,"MPFilter_NoVoiceComms"},
{eGUC_filtersDedicated,"MPFilter_DecicatedServer"},
{eGUC_filtersDX10,"MPFilter_DirectX"}
};
static TKeyValuePair<EDisconnectionCause,const char*>
gDisconnectErrors[] = { {eDC_Unknown,"@ui_menu_disconnect_Generic"},
{eDC_Timeout,"@ui_menu_disconnect_Timeout"},
{eDC_ProtocolError,"@ui_menu_disconnect_Generic"},
{eDC_ResolveFailed,"@ui_menu_disconnect_Unreachable"},
{eDC_VersionMismatch,"@ui_menu_disconnect_VersionMismatch"},
{eDC_ServerFull,"@ui_menu_disconnect_ServerFull"},
{eDC_Kicked,"@ui_menu_disconnect_Kicked"},
{eDC_Banned,"@ui_menu_disconnect_Banned"},
{eDC_ContextCorruption,"@ui_menu_disconnect_Generic"},
{eDC_AuthenticationFailed,"@ui_menu_disconnect_AuthenticationFailed"},
{eDC_GameError,"@ui_menu_disconnect_Generic"},
{eDC_NotDX10Capable,"@ui_menu_disconnect_DX10"},
{eDC_NubDestroyed,"@ui_menu_disconnect_ServerQuit"},
{eDC_ICMPError,"@ui_menu_disconnect_Unreachable"},
{eDC_NatNegError,"@ui_menu_disconnect_Unreachable"},
{eDC_PunkDetected,"@ui_menu_disconnect_Generic"},
{eDC_DemoPlaybackFinished,"@ui_menu_disconnect_Generic"},
{eDC_DemoPlaybackFileNotFound,"@ui_menu_disconnect_Generic"},
{eDC_UserRequested,"@ui_menu_disconnect_Generic"},
{eDC_NoController,"@ui_menu_disconnect_Controller"},
{eDC_CantConnect,"@ui_menu_disconnect_CantConnect"}
};
CMPHub::CMPHub():
m_menu(0),
m_currentScreen(0),
m_currentStartScreen(0),
m_currentIngameScreen(0),
m_loggingIn(false),
m_enteringLobby(false),
m_searchingQuickGame(false),
m_menuOpened(false),
m_lastMenu(0),
m_isInLogin(false)
{
gEnv->pNetwork->GetService("GameSpy");
}
CMPHub::~CMPHub()
{
// m_menu.reset(0);
// m_profile.reset(0);
}
bool CMPHub::HandleFSCommand(const char* pCmd, const char* pArgs)
{
EGsUiCommand cmd = KEY_BY_VALUE(string(pCmd),gUiCommands);
for(int i=m_dialogs.size()-1;i>=0;--i)
{
if(m_dialogs[i]->OnCommand(cmd,pArgs))
{
return true;
}
}
bool handled = true;
switch(cmd)
{
case eGUC_opened:
OnMenuOpened();
break;
case eGUC_register:
m_reginfo = SRegisterInfo();
break;
case eGUC_registerNick:
m_reginfo.nick = pArgs;
break;
case eGUC_registerEmail:
m_reginfo.email = pArgs;
break;
case eGUC_registerDateDD:
m_reginfo.day = atoi(pArgs);
break;
case eGUC_registerDateMM:
m_reginfo.month = atoi(pArgs);
break;
case eGUC_registerDateYY:
m_reginfo.year = atoi(pArgs);
break;
case eGUC_registerCountry:
m_reginfo.country = pArgs;
if(m_reginfo.country.size()>2)
m_reginfo.country = "";
break;
case eGUC_registerEnd:
{
{
INetworkService *serv = gEnv->pNetwork->GetService("GameSpy");
if(!serv || serv->GetState()!= eNSS_Ok)
break;
}
SFlashVarValue val("");
m_currentScreen->GetVariable("_root.MPAccount_Password",&val);
string pass = val.GetConstStrPtr();
m_profile.reset(new CGameNetworkProfile(this));
if(!m_profile->IsDead())
{
m_loggingIn = true;
m_enteringLobby = true;
ShowLoadingDlg("@ui_menu_register");
m_profile->Register(m_reginfo.nick, m_reginfo.email, pass, m_reginfo.country, SRegisterDayOfBirth(m_reginfo.day,m_reginfo.month,m_reginfo.year));
}
}
break;
case eGUC_rememberPassword:
m_options.remeber = atoi(pArgs)!=0;
if(!m_options.remeber)
m_options.autologin = false;
if(m_profile.get() && m_profile->IsLoggedIn() && m_options.remeber)
{
m_options.login = m_profile->GetLogin();
m_options.password = m_profile->GetPassword();
}
SaveOptions();
break;
case eGUC_autoLogin:
m_options.autologin = atoi(pArgs)!=0;
SaveOptions();
break;
case eGUC_login:
{
{
INetworkService *serv = gEnv->pNetwork->GetService("GameSpy");
if(!serv || serv->GetState()!= eNSS_Ok)
break;
}
SFlashVarValue val("");
m_currentScreen->GetVariable("_root.MPAccount_Password",&val);
string pass = val.GetConstStrPtr();
string login(pArgs);
if(m_options.remeber || m_options.autologin)
{
m_options.login = login;
m_options.password = pass;
}
DoLogin(login,pass);
}
break;
case eGUC_accountInfo:
{
SFlashVarValue infoArgs[2] = {m_options.remeber, m_options.autologin};
m_currentScreen->Invoke("showAccountInfo",infoArgs,2);
if(m_profile.get() && m_profile->IsLoggedIn())
{
SUserStats stats = m_profile->GetMyStats();
static string country;
if(strlen(m_profile->GetCountry()))
{
country = "@ui_country_";
country += m_profile->GetCountry();
}
else
country = "";
static string played, accuracy, kills, kpm;
if(stats.m_played)
played.Format("%d",stats.m_played/60);
else
played.resize(0);
if(stats.m_accuracy)
accuracy.Format("%.2f%%",stats.m_accuracy);
else
accuracy.resize(0);
if(stats.m_kills)
kills.Format("%d",stats.m_kills);
else
kills.resize(0);
if(stats.m_killsPerMinute)
kpm.Format("%.2f",stats.m_killsPerMinute);
else
kpm.resize(0);
SFlashVarValue args[] = { m_profile->GetLogin(),
country.c_str(),
played.c_str(),
stats.m_gameMode.c_str(),
stats.m_map.c_str(),
stats.m_weapon.c_str(),
stats.m_vehicle.c_str(),
stats.m_suitMode.c_str(),
accuracy.c_str(),
kpm.c_str(),
kills.c_str()};
m_currentScreen->Invoke("setAccountInfo",args,sizeof(args)/sizeof(args[0]));
}
}
break;
case eGUC_disableAutoLogin:
if(!strcmp(pArgs,"On"))
{
m_options.autologin = false;
}
else
{
m_options.autologin = true;
if(m_profile.get() && m_profile->IsLoggedIn())
{
//just to be sure
m_options.login = m_profile->GetLogin();
m_options.password = m_profile->GetPassword();
}
}
SaveOptions();
break;
case eGUC_logoff:
DoLogoff();
break;
case eGUC_enterlobby:
if(m_currentScreen)
{
m_menu.reset(0);
m_menu.reset(new CMultiPlayerMenu(false,m_currentScreen,this));
if(!IsIngame())
m_lastMenu = 2;
}
break;
case eGUC_leavelobby:
case eGUC_leaveLANlobby:
if(!IsIngame())
m_lastMenu = 0;
m_menu.reset(0);
break;
case eGUC_internetGame:
{
INetworkService *serv = gEnv->pNetwork->GetService("GameSpy");
if(!serv || serv->GetState() == eNSS_Initializing)
break;
if(serv->GetState() == eNSS_Failed)
{
ShowError("Online support for Crysis is no longer available.");
break;
}
IPatchCheck* pc = serv->GetPatchCheck();
if(pc->IsUpdateAvailable())
{
ShowYesNoDialog("@ui_patch_warning","patch");
break;
}
}
if(!m_profile.get() || !m_profile->IsLoggedIn())
{
TryLogin(true);
}
else
SwitchToLobby();
break;
case eGUC_recordedGames:
SAFE_MENU_FUNC(PlayTutorialVideo());
break;
case eGUC_enterLANlobby:
{
INetworkService *serv = gEnv->pNetwork->GetService("GameSpy");
if(!serv || serv->GetState()!= eNSS_Ok)
break;
}
if(!IsIngame())
m_lastMenu = 3;
if(m_currentScreen)
{
m_menu.reset(0);
m_menu.reset(new CMultiPlayerMenu(true,m_currentScreen,this));
}
break;
case eGUC_quickGame:
OnQuickGame();
break;
case eGUC_back:
if(m_quickGame.get())
{
m_quickGame->Cancel();
m_quickGame.reset(0);
}
break;
case eGUC_forgotPassword:
//gEnv->pGame->GetIGameFramework()->ShowPageInBrowser("http://login.gamespy.com/lostpassword.aspx");
if(m_currentScreen)
{
CGameNetworkProfile p(this);
SFlashVarValue val("");
m_currentScreen->GetVariable("_root.Root.MainMenu.ForgotPassword_POPUP_M.ForgotPassword_POPUP.Texts.Colorset.CA_EMAILADDY.text",&val);
p.RetrievePassword(val.GetConstStrPtr());
}
break;
case eGUC_dialogClosed:
if(m_profile.get() && m_profile->IsLoggingIn())
{
m_profile->Logoff();
m_profile.reset(0);
}
else
gEnv->pGame->GetIGameFramework()->ExecuteCommandNextFrame("disconnect");
break;
case eGUC_dialogYes:
if(!strcmp(pArgs,"tutorial"))
{
g_pGame->GetIGameFramework()->ShowPageInBrowser("Power Struggle Tutorial.wmv");
}
else if(!strcmp(pArgs,"patch"))
{
INetworkService* gs = gEnv->pNetwork->GetService("GameSpy");
if(gs)
{
IPatchCheck* pc = gs->GetPatchCheck();
if(pc->IsUpdateAvailable())
{
g_pGame->GetIGameFramework()->ShowPageInBrowser(pc->GetPatchURL());
g_pGame->GetIGameFramework()->ExecuteCommandNextFrame("quit");
}
}
}
else if(!strcmp(pArgs,"quickgame"))
{
gEnv->pConsole->ExecuteString("disconnect");
OnQuickGame();
}
else
{
handled = false;
}
break;
default:
handled = false;
}
if(m_menu.get() && !handled)
{
handled = m_menu->HandleFSCommand(cmd,pArgs);
}
return handled;
}
void CMPHub::OnUIEvent(const SUIEvent& event)
{
switch(event.event)
{
case eUIE_disconnect:
if(int(eDC_NubDestroyed) == event.param)
{
if(!gEnv->bServer)
ShowError("@ui_menu_disconnect_ServerQuit");
}
else if(int(eDC_UserRequested) != event.param)
DisconnectError(EDisconnectionCause(event.param),false);
CloseLoadingDlg();
break;
}
if(m_menu.get())
m_menu->OnUIEvent(event);
for(int i=m_dialogs.size()-1;i>=0;--i)
{
m_dialogs[i]->OnUIEvent(event);
}
}
void CMPHub::SetCurrentFlashScreen(IFlashPlayer* screen, bool ingame)
{
if(m_currentScreen && !screen)
{
//hack to determine if we just closed current screen
if((m_currentIngameScreen == m_currentScreen && ingame)
|| (m_currentStartScreen == m_currentScreen && !ingame))
{
OnUIEvent(SUIEvent(eUIE_destroy,ingame?0:1));
for(int i=m_dialogs.size()-1;i>=0;--i)
m_dialogs[i]->Close();
m_menu.reset(0);
}
}
if(ingame)
{
m_currentIngameScreen = screen;
}
else
{
m_currentStartScreen = screen;
}
m_menuOpened = false;
m_currentScreen = screen?screen:(m_currentStartScreen?m_currentStartScreen:m_currentIngameScreen);
if(m_currentScreen)
{
if(gEnv->bMultiplayer)
{
OnShowIngameMenu();
}
}
}
void CMPHub::ConnectFailed(EDisconnectionCause cause, const char * description)
{
OnUIEvent(SUIEvent(eUIE_connectFailed,int(cause),description));
}
void CMPHub::OnLoginSuccess(const char* nick)
{
m_loggingIn = false;
CloseLoadingDlg();
CloseLoginDlg();
m_login = nick;
SetLoginInfo(nick);
SaveOptions();
if(m_enteringLobby)
{
SwitchToLobby();
m_enteringLobby = false;
}
if(m_searchingQuickGame)
{
OnQuickGame();
m_searchingQuickGame = false;
}
}
void CMPHub::OnLoginFailed(const char* reason)
{
m_loggingIn = false;
CloseLoadingDlg();
m_profile.reset(0);
ShowError(reason,true);
m_options.autologin = false;
m_options.remeber = false;
m_options.password = "";
SaveOptions();
//ShowLoginDlg();
}
void CMPHub::TryLogin( bool lobby )
{
ReadOptions();
m_enteringLobby = lobby;
m_searchingQuickGame = !lobby;
if(m_options.autologin)
{
if(m_options.login.empty())
{
m_options.autologin = false;
ShowLoginDlg();
}
else
{
DoLogin(m_options.login,m_options.password);
}
}
else
ShowLoginDlg();
}
void CMPHub::ShowLoginDlg()
{
if(!m_currentScreen)
return;
SFlashVarValue params[] = {"1",m_options.remeber,m_options.autologin};
m_currentScreen->Invoke("_root.Root.MainMenu.MultiPlayer.openLoginScreen",params,sizeof(params)/sizeof(params[0]));
m_currentScreen->SetVariable("_root.Root.MainMenu.MultiPlayer.LoginScreen.Login_Controls.LoginStats.Colorset.Nickname.text",m_options.login.c_str());
if(m_options.remeber)
m_currentScreen->SetVariable("_root.Root.MainMenu.MultiPlayer.LoginScreen.Login_Controls.LoginStats.Colorset.Password.text",m_options.password.c_str());
else
m_currentScreen->SetVariable("_root.Root.MainMenu.MultiPlayer.LoginScreen.Login_Controls.LoginStats.Colorset.Password.text","");
m_currentScreen->Invoke0("_root.Root.MainMenu.MultiPlayer.updateLoginScreen");
}
void CMPHub::CloseLoginDlg()
{
if(m_currentScreen)
m_currentScreen->Invoke1("_root.Root.MainMenu.MultiPlayer.openLoginScreen", false);
}
void CMPHub::SwitchToLobby()
{
if(m_currentScreen)
{
m_currentScreen->Invoke1("_root.Root.MainMenu.MultiPlayer.MultiPlayer.gotoAndPlay", "internetgame");
if(!IsIngame())
m_lastMenu = 2;
}
}
void CMPHub::ShowLoadingDlg(const char* message)
{
if(m_currentScreen)
m_currentScreen->Invoke1("showLOADING",true);
//TODO : set header
SetLoadingDlgText(message,true);
}
void CMPHub::ShowLoadingDlg(const char* message, const char* param)
{
if(m_currentScreen)
m_currentScreen->Invoke1("showLOADING",true);
//TODO : set header
SetLoadingDlgText(message, param);
}
void CMPHub::SetLoadingDlgText(const char* text, bool localize)
{
SFlashVarValue args[]={text,localize};
if(m_currentScreen)
m_currentScreen->Invoke("setLOADINGText",args,sizeof(args)/sizeof(args[0]));
}
void CMPHub::SetLoadingDlgText(const char* fmt, const char* param)
{
static wstring tmp, tmp2;
gEnv->pSystem->GetLocalizationManager()->LocalizeLabel(fmt, tmp);
StrToWstr(param,tmp2);
static wstring text;
text.resize(0);
gEnv->pSystem->GetLocalizationManager()->FormatStringMessage(text,tmp,tmp2.c_str());
SFlashVarValue args[]={text.c_str(),true};
if(m_currentScreen)
m_currentScreen->Invoke("setLOADINGText",args,sizeof(args)/sizeof(args[0]));
}
void CMPHub::CloseLoadingDlg()
{
if(m_currentScreen)
m_currentScreen->Invoke1("showLOADING",false);
}
void CMPHub::OnQuickGame()
{
INetworkService *serv = gEnv->pNetwork->GetService("GameSpy");
if(!serv || serv->GetState()!= eNSS_Ok)
return;
if(IsIngame())
{
ShowYesNoDialog("@ui_disconnect_warning","quickgame");
}
else
{
m_quickGame.reset(new CQuickGame());
m_quickGame->StartSearch(this);
}
}
void CMPHub::SetLoginInfo(const char* nick)
{
if(!m_menuOpened || !m_currentScreen)
return;
if(nick)
{
m_currentScreen->Invoke0("GSConnect");
}
else
{
m_currentScreen->Invoke0("GSDisconnect");
}
}
void CMPHub::DisconnectError(EDisconnectionCause dc, bool connecting)
{
ShowError(VALUE_BY_KEY(dc,gDisconnectErrors),true);
}
void CMPHub::ShowError(const char* msg, bool translate)
{
if(!m_currentScreen)
{
m_errrorText = msg;//will be shown next time
return;
}
if(translate)
m_currentScreen->Invoke1("setErrorText",msg);
else
m_currentScreen->Invoke1("setErrorTextNonLocalized",msg);
m_currentScreen->Invoke1("showErrorMessage","Box1");
m_errrorText.resize(0);
}
void CMPHub::DoLogin(const char* nick, const char* pwd)
{
if(!nick || !*nick)
{
ShowError("@ui_Enter_Login", true);
return;
}
m_profile.reset(new CGameNetworkProfile(this));
if(!m_profile->IsDead())
{
ShowLoadingDlg("@ui_menu_login");
m_loggingIn = true;
m_profile->Login(nick,pwd);
}
}
void CMPHub::DoLoginProfile(const char* email, const char* pwd, const char* profile)
{
m_profile.reset(new CGameNetworkProfile(this));
if(!m_profile->IsDead())
{
ShowLoadingDlg("@ui_menu_login");
m_loggingIn = true;
m_profile->LoginProfile(email,pwd,profile);
}
}
void CMPHub::DoLogoff()
{
if(!m_profile.get())
return;
m_login.resize(0);
m_profile->Logoff();
m_profile.reset(0);
SetLoginInfo(0);
if(m_menu.get())
SwitchToMainScreen();
m_menu.reset(0);
if(m_lastMenu == 2)
m_lastMenu = 0;
if(IsIngame() && gEnv->bMultiplayer)
{
g_pGame->GetIGameFramework()->ExecuteCommandNextFrame("disconnect");
}
}
void CMPHub::SwitchToMainScreen()
{
if(m_currentScreen)
{
m_currentScreen->Invoke0("closeMultiplayerMenu");
}
}
static const char * hexchars = "0123456789abcdef";
static const char xor_code[16] = {17, 36, -75, -13,
120, 42, 23, 16,
-46, 11, 3, 67,
-41, -19, -64, -8};//some random mask
static ILINE string EncodeStr(const char * x, int len)
{
string out;
int i=0;
for (; i<len; i++)
{
uint8 c = x[i]^xor_code[i&15];
out += hexchars[c >> 4];
out += hexchars[c & 0xf];
}
//zero
uint8 c = xor_code[i&15];
out += hexchars[c >> 4];
out += hexchars[c & 0xf];
++i;
//padding to some length, so they always
for(; i<32; i++)
{
uint8 c = uint8((rand()%0xFE)+1)^xor_code[i&15];
out += hexchars[c >> 4];
out += hexchars[c & 0xf];
}
assert(out.size()>=64);
return out;
}
static ILINE bool DecodeStr(string& x)
{
string out;
uint8 cur;
if(x.length()<64)
return false;
for (int i=0; i<x.length(); i++)
{
int j;
for (j=0; hexchars[j]; j++)
if (hexchars[j] == x[i])
break;
if (!hexchars[j])
return false;
cur = (cur << 4) | j;
if (i&1)
{
uint8 c = cur ^ xor_code[(i>>1)&15];
if(!c)
break;
out += c;
}
}
x.swap(out);
return true;
}
void CMPHub::ReadOptions()
{
m_options.autologin = false;
m_options.remeber = false;
g_pGame->GetOptions()->GetProfileValue("Multiplayer.Login.AutoLogin",m_options.autologin);
g_pGame->GetOptions()->GetProfileValue("Multiplayer.Login.RememberPassword",m_options.remeber);
g_pGame->GetOptions()->GetProfileValue("Multiplayer.Login.Login",m_options.login);
g_pGame->GetOptions()->GetProfileValue("Multiplayer.Login.Password",m_options.password);
if(!DecodeStr(m_options.password))
{
if(m_options.password.size()>20)//it can be old-format password so we'll keep it
{
m_options.password = "";
m_options.remeber = false;
m_options.autologin = false;
}
}
}
void CMPHub::SaveOptions()
{
g_pGame->GetOptions()->SaveValueToProfile("Multiplayer.Login.AutoLogin",m_options.autologin);
g_pGame->GetOptions()->SaveValueToProfile("Multiplayer.Login.RememberPassword",m_options.remeber);
g_pGame->GetOptions()->SaveValueToProfile("Multiplayer.Login.Login",m_options.login);
string pwd = EncodeStr(m_options.password,m_options.password.size());
g_pGame->GetOptions()->SaveValueToProfile("Multiplayer.Login.Password",pwd);
g_pGame->GetOptions()->SaveProfile();
}
bool CMPHub::IsLoggingIn()const
{
return m_loggingIn;
}
void CMPHub::OnMenuOpened()
{
INetworkService* gs = gEnv->pNetwork->GetService("GameSpy");
if(gs)
{
IPatchCheck* pc = gs->GetPatchCheck();
pc->TrackUsage();
pc->CheckForUpdate();
}
m_menuOpened = true;
if(!m_login.empty())
SetLoginInfo(m_login);
if(!m_errrorText.empty())
{
ShowError(m_errrorText);
m_errrorText.empty();
}
}
void CMPHub::OnShowIngameMenu()
{
if(!m_currentScreen)
return;
m_currentScreen->SetVariable("MainWindow",2);
if(m_lastMenu)
m_currentScreen->SetVariable("SubWindow",m_lastMenu);
}
bool CMPHub::IsIngame()const
{
return gEnv->pGame->GetIGameFramework()->IsGameStarted();
}
void CMPHub::ShowYesNoDialog(const char* str, const char* name)
{
if(!m_currentScreen)
return;
SFlashVarValue args[]={"Box2",name};
m_currentScreen->Invoke("showErrorMessage",args,sizeof(args)/sizeof(args[0]));
m_currentScreen->Invoke1("setErrorText",str);
}
CGameNetworkProfile* CMPHub::GetProfile()const
{
return m_profile.get();
}
void CMPHub::AddGameModToList(const char* mod)
{
if(m_currentScreen)
{
//_root.Root.MainMenu.MultiPlayer.ClearGameModeList() - clear
m_currentScreen->Invoke1("_root.Root.MainMenu.MultiPlayer.AddGameMode",mod);
}
}
CMPHub::CDialog::CDialog():
m_hub(0)
{
}
CMPHub::CDialog::~CDialog()
{
Close();
}
void CMPHub::CDialog::Show(CMPHub* hub)
{
m_hub = hub;
m_hub->m_dialogs.push_back(this);
//show in UI
OnShow();
}
void CMPHub::CDialog::Close()
{
if(!m_hub)//m_hub !=0
return;
OnClose();
//hide in UI
assert(m_hub->m_dialogs.back() == this);
m_hub->m_dialogs.pop_back();
m_hub = 0;
}
bool CMPHub::CDialog::OnCommand(EGsUiCommand cmd, const char* pArgs)
{
return false;
}
void CMPHub::CDialog::OnUIEvent(const SUIEvent& event)
{
}
void CMPHub::CDialog::OnClose()
{
}
void CMPHub::CDialog::OnShow()
{
}
bool CMPHub::IsInLobby() const
{
return m_menu.get() != 0;
}
bool CMPHub::IsInLogin() const
{
return m_isInLogin;
}
void CMPHub::SetIsInLogin(bool isInLogin)
{
m_isInLogin = isInLogin;
}
| [
"[email protected]",
"kkirst@c5e09591-5635-0410-80e3-0b71df3ecc31"
] | [
[
[
1,
19
],
[
21,
25
],
[
29,
37
],
[
40,
60
],
[
63,
79
],
[
84,
109
],
[
134,
136
],
[
139,
140
],
[
142,
143
],
[
145,
191
],
[
197,
207
],
[
215,
218
],
[
227,
229
],
[
231,
250
],
[
322,
324
],
[
334,
334
],
[
337,
341
],
[
343,
343
],
[
356,
356
],
[
358,
358
],
[
360,
364
],
[
366,
372
],
[
381,
391
],
[
402,
402
],
[
410,
415
],
[
417,
428
],
[
438,
453
],
[
455,
457
],
[
459,
460
],
[
463,
476
],
[
478,
478
],
[
488,
489
],
[
499,
499
],
[
501,
510
],
[
512,
518
],
[
520,
520
],
[
527,
527
],
[
535,
541
],
[
543,
544
],
[
547,
549
],
[
571,
579
],
[
582,
587
],
[
589,
594
],
[
598,
603
],
[
605,
608
],
[
617,
623
],
[
638,
649
],
[
659,
674
],
[
681,
686
],
[
691,
698
],
[
700,
702
],
[
720,
731
],
[
739,
743
],
[
807,
815
],
[
826,
832
],
[
836,
841
],
[
843,
848
],
[
853,
948
]
],
[
[
20,
20
],
[
26,
28
],
[
38,
39
],
[
61,
62
],
[
80,
83
],
[
110,
133
],
[
137,
138
],
[
141,
141
],
[
144,
144
],
[
192,
196
],
[
208,
214
],
[
219,
226
],
[
230,
230
],
[
251,
321
],
[
325,
333
],
[
335,
336
],
[
342,
342
],
[
344,
355
],
[
357,
357
],
[
359,
359
],
[
365,
365
],
[
373,
380
],
[
392,
401
],
[
403,
409
],
[
416,
416
],
[
429,
437
],
[
454,
454
],
[
458,
458
],
[
461,
462
],
[
477,
477
],
[
479,
487
],
[
490,
498
],
[
500,
500
],
[
511,
511
],
[
519,
519
],
[
521,
526
],
[
528,
534
],
[
542,
542
],
[
545,
546
],
[
550,
570
],
[
580,
581
],
[
588,
588
],
[
595,
597
],
[
604,
604
],
[
609,
616
],
[
624,
637
],
[
650,
658
],
[
675,
680
],
[
687,
690
],
[
699,
699
],
[
703,
719
],
[
732,
738
],
[
744,
806
],
[
816,
825
],
[
833,
835
],
[
842,
842
],
[
849,
852
],
[
949,
964
]
]
] |
8fa89ff41d75b4374567b5fc75556d112d8674e1 | a36d7a42310a8351aa0d427fe38b4c6eece305ea | /render_win32/my_render_win32_imp.h | 292e467dc574fef5eba4306b4f1634a8f441c26b | [] | no_license | newpolaris/mybilliard01 | ca92888373c97606033c16c84a423de54146386a | dc3b21c63b5bfc762d6b1741b550021b347432e8 | refs/heads/master | 2020-04-21T06:08:04.412207 | 2009-09-21T15:18:27 | 2009-09-21T15:18:27 | 39,947,400 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 542 | h | #pragma once
#include "my_render_win32.h"
#include "../core_billiard/my_render_imp.h"
#define NOMINMAX
#include <windows.h>
namespace my_render_win32_imp {
using namespace std;
using namespace std::tr1;
using namespace my_utility;
using namespace my_render;
using namespace my_render_win32;
using namespace my_render_imp;
class ApplicationWin32Imp;
MY_SMART_PTR( ApplicationWin32Imp );
}
#include "ApplicationWin32Imp.h"
#include "FileSystemHelper.h"
#include "DebugHelper.hpp"
| [
"wrice127@af801a76-7f76-11de-8b9f-9be6f49bd635"
] | [
[
[
1,
25
]
]
] |
1b70313fa8a407eada30241d4f108a05baf79f6b | 15732b8e4190ae526dcf99e9ffcee5171ed9bd7e | /INC/ElementCustom.h | 92cee834fe862d0e78ee261cad9339f34c111470 | [] | 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 | GB18030 | C++ | false | false | 1,376 | h | #ifndef ELEMENTCUSTOM_H_
#define ELEMENTCUSTOM_H_
#include <vector>
#include "ExpressionParse.h"
#include "ExpCondition.h"
#include "ErrorHandler.h"
#include "node.h"
using namespace std;
#define ERROR_CUSTOM_SUCCESS ERROR_CONDITION_SUCCESS
#define ERROR_CUSTOM_NOT_INITAILIZED 0x00030301
#define ERROR_CON_UNMATCH_EXP 0x00030302
class CElementCustom : public CErrorHandler
{
public:
CElementCustom(void);
//CElementCustom(map<CExpCondition,CExpressionParse>& t,
// double d);
CElementCustom(vector<CExpCondition>& t_con,
vector<CExpressionParse>& t_exp,
double d);
~CElementCustom(void);
public:
double GetValue();
void initail(vector<CExpCondition>& t_con,
vector<CExpressionParse>& t_exp,
double d);
virtual Error_str GetLastErrorEx() {return GetLastErrorStr();}
private:
double dwDefault;
//map<CExpCondition, CExpressionParse> custom_table;
vector<CExpressionParse> custom_table_exp;
vector<CExpCondition> custom_table_con;
bool RevelantToNode;//该自定义部件是否和结点相关
Node *node;
public:
bool GetRevelantToNode() { return RevelantToNode; }
void AttachNode(Node *n);
void SetRevelantToNode(bool revelantToNode) { RevelantToNode = revelantToNode; }
};
#endif //end of ELEMENTCUSTOM_H_ | [
"pengelmer@f37e807c-cba8-11de-937e-2741d7931076"
] | [
[
[
1,
65
]
]
] |
ba3bc11b77dbc93f0fd0bad7150a88f891c0cffc | da48afcbd478f79d70767170da625b5f206baf9a | /tbmessage/src5.75/Dlg/EditUserDlg.h | e063092d5974c1d68b17ded7a7af88f7e391e5d1 | [] | no_license | haokeyy/fahister | 5ba50a99420dbaba2ad4e5ab5ee3ab0756563d04 | c71dc56a30b862cc4199126d78f928fce11b12e5 | refs/heads/master | 2021-01-10T19:09:22.227340 | 2010-05-06T13:17:35 | 2010-05-06T13:17:35 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 485 | h | #pragma once
// CEditUserDlg 对话框
class CEditUserDlg : public CDialog
{
DECLARE_DYNAMIC(CEditUserDlg)
public:
CEditUserDlg(CWnd* pParent = NULL); // 标准构造函数
virtual ~CEditUserDlg();
// 对话框数据
enum { IDD = IDD_DLG_EDIT_USER };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
CString m_UserId;
afx_msg void OnBnClickedOk();
CString m_Password;
};
| [
"[email protected]@d41c10be-1f87-11de-a78b-a7aca27b2395"
] | [
[
[
1,
25
]
]
] |
f1bbab20f7aab37d59a54c5b2bac7477f7b80dad | d8f64a24453c6f077426ea58aaa7313aafafc75c | /project.cpp | a53512807db23bf356f18ca5bb87fb9c48886ace | [] | no_license | dotted/wfto | 5b98591645f3ddd72cad33736da5def09484a339 | 6eebb66384e6eb519401bdd649ae986d94bcaf27 | refs/heads/master | 2021-01-20T06:25:20.468978 | 2010-11-04T21:01:51 | 2010-11-04T21:01:51 | 32,183,921 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,873 | cpp | #define _CRTDBG_MAP_ALLOC
#define NOMINMAX
#include "GameManager.h"
#include "commons.h"
#include <windows.h>
#include <windowsx.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <crtdbg.h>
#include <stdio.h>
#include <time.h>
#include "Resource.h"
#include "BugTrap\BugTrap.h"
HDC hDC=NULL;
HGLRC hRC=NULL;
HWND hWnd=NULL;
HINSTANCE hInstance;
bool active=true,
fullscreen=false,
esc=false;
/********************************************************************************************/
#include <string>
#include "Conversions.h"
#include "OGLUtils.h"
#include "DeltaTime.h"
#include "LUA/lua_common.h"
#include "utils.h"
using namespace std;
using namespace game_utils;
//using namespace game_utils::managers;
using namespace utils;
using namespace control;
#define WINDOW_TITLE "War for the Overworld"
managers::CGameManager *game_utils::CV_GAME_MANAGER = NULL;
bool allInited = false;
std::string G_startDir = "";
/********************************************************************************************/
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
GLvoid ReSizeGLScene(GLsizei width, GLsizei height)
{
if (height==0)
{
height=1;
}
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(CV_SETTINGS_FOV,(GLfloat)width/(GLfloat)height,0.01f,10000.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if (allInited)
{
CV_GAME_MANAGER->getControlManager()->getViewFrustum()->updateRatio((GLfloat)width/(GLfloat)height);
//CV_GAME_MANAGER->getConsole()->writeLine("Ratio changed: "+CConversions::floatToStr((GLfloat)width/(GLfloat)height));
CV_GAME_MANAGER->getGUIManager()->getPlayGUI()->get_active_gui()->updateRatio(width,height);
game_utils::CV_SETTINGS_WINDOW_WIDTH = width;
game_utils::CV_SETTINGS_WINDOW_HEIGHT = height;
game_utils::CV_SETTINGS_WINDOW_WIDTH_HALF = CV_SETTINGS_WINDOW_WIDTH/2;
game_utils::CV_SETTINGS_WINDOW_HEIGHT_HALF = CV_SETTINGS_WINDOW_HEIGHT/2;
}
}
void DetectMemoryLeaks()
{
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);
_CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);
}
// extern from commons
HWND game_utils::CV_WINDOW_HANDLE;
HDC game_utils::CV_DEVICE_CONTEXT;
GLint game_utils::CV_SETTINGS_WINDOW_WIDTH;
GLint game_utils::CV_SETTINGS_WINDOW_HEIGHT;
GLint game_utils::CV_SETTINGS_WINDOW_WIDTH_HALF;
GLint game_utils::CV_SETTINGS_WINDOW_HEIGHT_HALF;
//TODO: remove LUA, add lighting with fixed functionality
BOOL initGameSystems()
{
// toggle VSYNC
COGLUtils::setVSync(false);
// set global hwnd
CV_WINDOW_HANDLE = hWnd;
CV_DEVICE_CONTEXT = hDC;
// used for particle system init
G_startDir = utils::sGeneralUtils::getCurrentDirectory();
// initialize game manager which initializes all other managers
CV_GAME_MANAGER = new managers::CGameManager();
if (!CV_GAME_MANAGER->init())
{
MessageBox(hWnd,"ERROR INITIALIZING GAME SYSTEMS!","ERROR",MB_OK|MB_ICONERROR);
return FALSE;
}
allInited = true;
return TRUE;
}
BOOL cleanupGameSystems()
{
CV_GAME_MANAGER->shutdown();
delete CV_GAME_MANAGER;
return TRUE;
}
int InitGL(GLvoid)
{
DetectMemoryLeaks();
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glAlphaFunc(GL_GREATER,0.1f);
glEnable(GL_ALPHA_TEST);
return initGameSystems();
}
int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
//glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
CV_GAME_MANAGER->update();
// TODO: rooms || lighting system
// TODO: collision detection
return TRUE;
}
GLvoid KillGLWindow(GLvoid)
{
if (fullscreen)
{
ChangeDisplaySettings(NULL,0);
ShowCursor(TRUE);
}
if (hRC)
{
if (!wglMakeCurrent(NULL,NULL))
{
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
if (!wglDeleteContext(hRC))
{
MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
hRC=NULL;
}
if (hDC && !ReleaseDC(hWnd,hDC))
{
MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hDC=NULL;
}
if (hWnd && !DestroyWindow(hWnd))
{
MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hWnd=NULL;
}
if (!UnregisterClass("OpenGL",hInstance))
{
MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hInstance=NULL;
}
}
BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{
GLuint PixelFormat;
WNDCLASS wc;
DWORD dwExStyle;
DWORD dwStyle;
RECT WindowRect;
WindowRect.left=(long)0;
WindowRect.right=(long)width;
WindowRect.top=(long)0;
WindowRect.bottom=(long)height;
fullscreen=fullscreenflag;
hInstance = GetModuleHandle(NULL);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = "OpenGL";
if (!RegisterClass(&wc))
{
MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if (fullscreen)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = width;
dmScreenSettings.dmPelsHeight = height;
dmScreenSettings.dmBitsPerPel = bits;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
{
if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
{
fullscreen=FALSE;
}
else
{
MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);
return FALSE;
}
}
}
if (fullscreen)
{
dwExStyle=WS_EX_APPWINDOW;
dwStyle=WS_POPUP;
//ShowCursor(FALSE);
}
else
{
dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle=WS_OVERLAPPEDWINDOW;
}
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);
if (!(hWnd=CreateWindowEx( dwExStyle,
"OpenGL",
title,
dwStyle |
WS_CLIPSIBLINGS |
WS_CLIPCHILDREN,
0, 0,
WindowRect.right-WindowRect.left,
WindowRect.bottom-WindowRect.top,
NULL,
NULL,
hInstance,
NULL)))
{
KillGLWindow();
MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
static PIXELFORMATDESCRIPTOR pfd=
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
bits,
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
16,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0
};
if (!(hDC=GetDC(hWnd)))
{
KillGLWindow();
MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))
{
KillGLWindow();
MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if(!SetPixelFormat(hDC,PixelFormat,&pfd))
{
KillGLWindow();
MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if (!(hRC=wglCreateContext(hDC)))
{
KillGLWindow();
MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if(!wglMakeCurrent(hDC,hRC))
{
KillGLWindow();
MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
ShowWindow(hWnd,SW_SHOW);
SetForegroundWindow(hWnd);
SetFocus(hWnd);
ReSizeGLScene(width, height);
if (!InitGL())
{
KillGLWindow();
MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Update input manager, no KB hook needed.
if (allInited)
{
CV_GAME_MANAGER->getControlManager()->getInput()->update(uMsg,wParam,lParam);
CV_GAME_MANAGER->getGUIManager()->getPlayGUI()->get_active_gui()->get_input_controler()->update(uMsg,wParam,lParam);
}
switch (uMsg)
{
case WM_ACTIVATE:
{
if ((LOWORD(wParam) != WA_INACTIVE) && !((BOOL)HIWORD(wParam)))
active=TRUE;
else
active=FALSE;
return 0;
}
case WM_SYSCOMMAND:
{
switch (wParam)
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
}
break;
}
case WM_CLOSE:
{
PostQuitMessage(0);
return 0;
}
case WM_KEYDOWN:
{
esc = (wParam == VK_ESCAPE);
return 0;
}
case WM_KEYUP:
{
return 0;
}
case WM_SIZE:
{
ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));
return 0;
}
}
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// Setup exception handler
BT_SetAppName("wfto");
BT_SetSupportEMail("[email protected]");
BT_SetFlags(BTF_DETAILEDMODE | BTF_DESCRIBEERROR | BTF_INTERCEPTSUEF | BTF_EDITMAIL | BTF_ATTACHREPORT | BTF_SCREENCAPTURE);
BT_SetSupportURL("http://forum.keeperklan.com");
BT_SetSupportServer("bugs.keeperklan.com", 9999);
BT_InstallSehFilter();
MSG msg;
BOOL done=FALSE;
CV_SETTINGS_WINDOW_WIDTH = 1024;
CV_SETTINGS_WINDOW_HEIGHT = 768;
CV_SETTINGS_WINDOW_WIDTH_HALF = CV_SETTINGS_WINDOW_WIDTH/2;
CV_SETTINGS_WINDOW_HEIGHT_HALF = CV_SETTINGS_WINDOW_HEIGHT/2;
if (!CreateGLWindow(WINDOW_TITLE,CV_SETTINGS_WINDOW_WIDTH,CV_SETTINGS_WINDOW_HEIGHT,32,CV_SETTINGS_WINDOW_FULLSCREEN))
{
return 0;
}
while(!done)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message==WM_QUIT)
{
done=TRUE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else
{
if ((active && !DrawGLScene()) || esc)
{
done=TRUE;
}
else
{
SwapBuffers(hDC);
}
}
}
KillGLWindow();
// cleanup
cleanupGameSystems();
return (msg.wParam);
} | [
"[email protected]",
"[email protected]"
] | [
[
[
1,
14
],
[
16,
43
],
[
45,
67
],
[
81,
93
],
[
99,
428
],
[
430,
431
],
[
434,
434
],
[
437,
439
],
[
444,
444
],
[
446,
483
]
],
[
[
15,
15
],
[
44,
44
],
[
68,
80
],
[
94,
98
],
[
429,
429
],
[
432,
433
],
[
435,
436
],
[
440,
443
],
[
445,
445
]
]
] |
d71914bf9bf9ca4538dd0bca017d6faa2c6f9eb3 | a36d7a42310a8351aa0d427fe38b4c6eece305ea | /render_win32/ShaderVariableDX9.h | d2304e76cd15d828c4b93c668910733fd700edf9 | [] | no_license | newpolaris/mybilliard01 | ca92888373c97606033c16c84a423de54146386a | dc3b21c63b5bfc762d6b1741b550021b347432e8 | refs/heads/master | 2020-04-21T06:08:04.412207 | 2009-09-21T15:18:27 | 2009-09-21T15:18:27 | 39,947,400 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 242 | h | #pragma once
namespace my_render_win32_dx9 {
MY_INTERFACE ShaderVariableDX9
: EXTENDS_INTERFACE( ShaderVariable )
, EXTENDS_INTERFACE( ShaderVariableHandleDX9 )
, EXTENDS_INTERFACE( ReleasableResourceDX9 )
{
};
} | [
"wrice127@af801a76-7f76-11de-8b9f-9be6f49bd635"
] | [
[
[
1,
14
]
]
] |
4c59705025fa3ab10e6b35540e1c0558881c07d2 | fb7d4d40bf4c170328263629acbd0bbc765c34aa | /SpaceBattle/SpaceBattleLib/GeneratedCode/Controleur/Command/DeplacerVaisseau.h | 1b8d96bbc29c9667920661d62b1d702078bf90a3 | [] | no_license | bvannier/SpaceBattle | e146cda9bac1608141ad8377620623514174c0cb | 6b3e1a8acc5d765223cc2b135d2b98c8400adf06 | refs/heads/master | 2020-05-18T03:40:16.782219 | 2011-11-28T22:49:36 | 2011-11-28T22:49:36 | 2,659,535 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 965 | h | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file will be lost if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#pragma once
#define WANTDLLEXP
#ifdef WANTDLLEXP //exportation dll
#define DLL __declspec( dllexport )
#define EXTERNC extern "C"
#else
#define DLL //standard
#define EXTERNC
#endif
#include "Command.h"
using namespace ControleurCommand;
#include<vector>
namespace ControleurCommand
{
class DeplacerVaisseau : public Command
{
private :
protected :
public :
private :
protected :
public :
override void doIt();
virtual void canDo();
};
EXTERNC DLL void DEPLACERVAISSEAU_doIt(DeplacerVaisseau*);
EXTERNC DLL void DEPLACERVAISSEAU_canDo(DeplacerVaisseau*);
}
| [
"[email protected]"
] | [
[
[
1,
48
]
]
] |
9d43f26d9cb51b68b66768053fefc09944a85a77 | cde1dd6cf288c4ef62e980e4e208bc56703d4373 | /src/UiEditor.cpp | abfb357c708dbe99549dc8a8165a4104715a23ec | [] | no_license | TheProjecter/simple-gui | 3c355834549292a9cd5bbd03b7ef2f3f24c58a15 | c00313dd1d4299e00b11369ae31c58b96e73eb4c | refs/heads/master | 2021-01-10T15:12:57.104734 | 2011-06-21T14:38:29 | 2011-06-21T14:38:29 | 45,961,332 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 63 | cpp | #include "../include/gui/UiEditor.hpp"
namespace gui
{
} | [
"[email protected]"
] | [
[
[
1,
6
]
]
] |
91cbfa80c2485e6f9c45ee0ca8793270ecc04eda | 67b7d5b1976895d014f96a3981af20947f10b879 | /misc/uart_binary.cpp | c82d666e1b8d23249d8b53ba3bce846153113bec | [] | no_license | usuyama/yjfactory | d31395277eb79ec9d4f3c222a5c62e9471718e8c | 2a53ac8111f70966f312b87a11f29c89f3ed61b2 | refs/heads/master | 2021-01-22T08:20:07.633109 | 2011-03-08T02:49:19 | 2011-03-08T02:49:19 | 1,094,046 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,111 | cpp | #include <sys/types.h>
#include <sys/stat.h>
#include <sys/signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
// 解放が面倒なのでbuffer用
#include <vector>
namespace {
const char* Opts = "f:a:s:r:cb:hv";
const size_t DefaultBufferSize = 1024;
const size_t DefaultBaudRate = 9600;
const size_t DefaultSize = 1024;
const char* Version = "version 1.2";
struct Option{
bool isSucceeded;
char* filename;
int baudRate;
size_t bufferSize;
size_t sendSize;
size_t receiveSize;
bool isCompareEnabled;
int fdUSB;
struct termios oldOptions, newOptions;
Option(){
isSucceeded = false;
filename = NULL;
baudRate = DefaultBaudRate;
bufferSize = DefaultBufferSize;
sendSize = receiveSize = DefaultSize;
isCompareEnabled = false;
fdUSB = -1;
}
};
void usage(){
fprintf(stderr, "Usage : uart [option]...\n");
fprintf(stderr, "\t-f arg\t\t: ファイル名(指定の無い場合標準入力)\n");
fprintf(stderr, "\t-a arg=9600\t: ボーレート\n");
fprintf(stderr, "\t-c\t\t: 1byteずつの比較を行う\n");
fprintf(stderr, "\t-s arg=1024\t: 送信するサイズ\n");
fprintf(stderr, "\t-r arg=1024\t: 受信するサイズ\n");
fprintf(stderr, "\t-b arg=1024\t: バッファサイズ\n");
fprintf(stderr, "\t-h\t\t: help\n");
fprintf(stderr, "\t-v\t\t: version\n");
exit(EXIT_FAILURE);
}
unsigned int getBaudRate(int baudRate){
if (baudRate < 14400){
return B9600;
}
else if (baudRate < 28800){
return B19200;
}
else if (baudRate < 48000){
return B38400;
}
else if (baudRate < 86400){
return B57600;
}
else if (baudRate < 122800){
return B115200;
}
else if (baudRate < 345600){
return B230400;
}
else {
return B460800;
}
return B0;
}
Option processArgs(int argc, char* argv[]){
int c;
Option opt;
while ((c = getopt(argc, argv, Opts)) != -1){
switch (c){
case 'f': // file name
opt.filename = optarg;
break;
case 'a': // baudrate
opt.baudRate = atoi(optarg);
break;
case 'c': // compare enable
opt.isCompareEnabled = true;
break;
case 's': // send size
opt.sendSize = atoi(optarg);
break;
case 'r': // receive size
opt.receiveSize = atoi(optarg);
break;
case 'b': // buffer size
opt.bufferSize = atoi(optarg);
break;
case 'h': // help
usage();
break;
case 'v': // help
fprintf(stderr, "%s\n", Version);
exit(1);
break;
default :
usage();
break;
}
}
return opt;
}
Option init(int argc, char* argv[]){
Option opt = processArgs(argc, argv);
argc -= optind;
argv += optind;
if (argc != 0){
usage();
}
int fd;
for (int i = 0; i < 3; ++i){
char filename[16];
sprintf(filename, "/dev/ttyUSB%d", i);
fd = open(filename, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd < 0){
perror("open");
}
if (fd > 0){
fprintf(stderr, "%s open", filename);
break;
}
}
if (fd < 0){
return opt;
}
else {
opt.fdUSB = fd;
if (tcgetattr(fd, &opt.oldOptions) < 0){
close(fd);
perror("tcgetattr");
return opt;
}
bzero(&opt.newOptions, sizeof(opt.newOptions));
struct termios& newOptions = opt.newOptions;
newOptions.c_cflag = getBaudRate(opt.baudRate) | CS8 | CLOCAL | CREAD;
newOptions.c_iflag = IGNPAR;
newOptions.c_oflag = 0;
newOptions.c_lflag = 0;
newOptions.c_cc[VTIME] = 0;
newOptions.c_cc[VMIN] = 1;
tcflush(fd, TCIFLUSH);
if (tcsetattr(fd, TCSANOW, &newOptions) < 0){
close(fd);
perror("tcsetattr");
return opt;
}
fcntl(fd, F_SETFL, FNDELAY);
}
opt.isSucceeded = true;
return opt;
}
// init <=> unit ...?www
int unit(const Option& opt){
int ret = tcsetattr(opt.fdUSB, TCSANOW, &opt.oldOptions);
if (ret < 0){
perror("tcsetattr");
}
if (opt.fdUSB > 0){
close(opt.fdUSB);
}
return ret;
}
void compareData(const char* sent, const char* received, const size_t begin, const size_t size){
for (size_t i = 0; i < size; ++i){
if (sent[i] != received[i]){
printf("[ERROR] ");
}
printf("%d : %c => %c\n", begin+i, sent[i], received[i]);
}
}
int sendData(const Option& opt, const char* buf, size_t size){
ssize_t nwrite;
size_t written = 0;
do {
nwrite = write(opt.fdUSB, buf+written, size-written);
if (nwrite < 0){
// USBに対するwriteは割と失敗することが多い
// 本当はちゃんと無視するエラーメッセージを指定するべき
// perror("nwrite");
// return nwrite;
}
else if (nwrite == 0){
}
else {
written += nwrite;
}
} while (written < size);
return 0;
}
int receiveData(const Option& opt, char* buf, size_t size){
ssize_t nread;
size_t already_read = 0;
do {
nread = read(opt.fdUSB, buf+already_read, size-already_read);
if (nread < 0){
}
else if (nread == 0){
}
else {
already_read += nread;
}
} while (already_read < size);
return 0;
}
int writeData(int fd, const char* buf, size_t size){
size_t written = 0;
do {
char c = *(buf + written);
for(int k=7;k>-1;k--)
printf("%d", (c & (1 << k)) > 0);
printf("\n");
fflush(stdout);
written ++;
} while (written < size);
return written;
}
// 入力
int input(const Option& opt){
// malloc(bufferSize) ... -> free の代わりに使っているだけ
std::vector<char> buf_vector(opt.bufferSize), receiveBuf_vector(opt.bufferSize);
char* buf = &(buf_vector[0]);
char* receiveBuf = &(receiveBuf_vector[0]);
int input_fd = STDIN_FILENO;
int output_fd = STDOUT_FILENO;
if (opt.filename){
int fd = open(opt.filename, O_RDONLY);
if (fd < 0){
perror("open");
return fd;
}
input_fd = fd;
}
size_t readSize = 0;
size_t writeSize = 0;
do {
const size_t SendSize = ((readSize+opt.bufferSize > opt.sendSize)? opt.sendSize-readSize: opt.bufferSize);
ssize_t nread;
nread = read(input_fd, buf, SendSize);
if (nread < 0){
perror("read");
return nread;
}
else if (nread == 0){
return 0;
}
int ret = sendData(opt, buf, nread);
if (ret < 0){
return ret;
}
ret = receiveData(opt, receiveBuf, nread);
if (ret < 0){
return ret;
}
const ssize_t LeftSize = opt.receiveSize - writeSize;
writeSize += nread;
if (opt.isCompareEnabled){
compareData(buf, receiveBuf, readSize, nread);
}
else if (LeftSize > 0) {
const size_t WriteSize = ((LeftSize < nread)? LeftSize: nread);
writeData(output_fd, receiveBuf, WriteSize);
}
readSize += nread;
} while (readSize < opt.sendSize);
return 0;
}
}
int main(int argc, char* argv[]){
const ::Option opt = ::init(argc, argv);
if (!opt.isSucceeded){
exit(EXIT_FAILURE);
}
const int ret = ::input(opt);
const int ret2 = ::unit(opt);
if (ret<0 || ret2<0){
exit(EXIT_FAILURE);
}
return 0;
}
| [
"usuyama@UoT-IST-Ub.(none)"
] | [
[
[
1,
338
]
]
] |
494320d47105274c32cff6aa43bf5c3bd7fec78c | 81ea71bd0cd9eba88abccfa1b112d7bd7dba661e | /tests/testwordgrid/TestGrid.cpp | d29d60a4bcb00bd6d255e49cf4eb8d9fc75bd77d | [] | no_license | Mokona/La-Grille | 83751b5a25a21d3dc71b02f9a36e3038f159ab15 | 6a1d1d15601e04eed8b62fce287e16be16dd5157 | refs/heads/master | 2016-08-03T12:42:11.787930 | 2010-02-12T22:25:09 | 2010-02-12T22:25:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,831 | cpp | #include "Framework.h"
#include "wordgrid/Grid.h"
#include "wordgrid/Square.h"
BOOST_AUTO_TEST_SUITE(TestGrid)
using namespace Wordgrid;
BOOST_AUTO_TEST_CASE( grid_instantiation )
{
Grid grid;
// No check. Should just not crash
}
BOOST_AUTO_TEST_CASE( grid_init_with_size )
{
Grid grid;
grid.Init(Vector2(3,4));
BOOST_CHECK_EQUAL(3, grid.GetWidth());
BOOST_CHECK_EQUAL(4, grid.GetHeight());
}
BOOST_AUTO_TEST_CASE( grid_too_big_throws )
{
Grid grid;
BOOST_CHECK_THROW(grid.Init(Vector2(400, 400)), Exception::WrongSize);
}
BOOST_AUTO_TEST_CASE ( gets_size_in_vector2 )
{
Grid grid;
grid.Init(Vector2(3,4));
BOOST_CHECK(Vector2(3,4) == grid.GetSize());
}
BOOST_AUTO_TEST_CASE( grid_init_width_cannot_be_negative )
{
Grid grid;
BOOST_CHECK_THROW(grid.Init(Vector2(-3,4)), Exception::WrongSize);
}
BOOST_AUTO_TEST_CASE( grid_init_height_cannot_be_negative )
{
Grid grid;
BOOST_CHECK_THROW(grid.Init(Vector2(3,-4)), Exception::WrongSize);
}
BOOST_AUTO_TEST_CASE( grid_no_init_cannot_get_content )
{
Grid grid;
BOOST_CHECK_THROW(grid.GetSquare(Vector2(0,0)), Exception::Uninitialized);
}
BOOST_AUTO_TEST_CASE( grid_cannot_get_content_outside_the_grid )
{
Grid grid;
grid.Init(Vector2(3, 5));
BOOST_CHECK_THROW(grid.GetSquare(Vector2(-1 ,-5)), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.GetSquare(Vector2(-1 ,3)), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.GetSquare(Vector2(1 ,-3)), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.GetSquare(Vector2(1 ,13)), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.GetSquare(Vector2(16 ,3)), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.GetSquare(Vector2(16 ,30)), Exception::WrongPosition);
// Limits
BOOST_CHECK_THROW(grid.GetSquare(Vector2(3 ,5)), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.GetSquare(Vector2(0 ,5)), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.GetSquare(Vector2(3 ,0)), Exception::WrongPosition);
}
BOOST_AUTO_TEST_CASE( grid_no_init_cannot_set_content )
{
Square content;
Grid grid;
BOOST_CHECK_THROW(grid.SetSquare(Vector2(0,0), content), Exception::Uninitialized);
}
BOOST_AUTO_TEST_CASE( grid_cannot_set_content_outside_the_grid )
{
Square content;
Grid grid;
grid.Init(Vector2(3, 5));
BOOST_CHECK_THROW(grid.SetSquare(Vector2(-1 ,-5), content), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.SetSquare(Vector2(-1 ,3), content), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.SetSquare(Vector2(1 ,-3), content), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.SetSquare(Vector2(1 ,13), content), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.SetSquare(Vector2(16 ,3), content), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.SetSquare(Vector2(16 ,30), content), Exception::WrongPosition);
// Limits
BOOST_CHECK_THROW(grid.SetSquare(Vector2(3 ,5), content), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.SetSquare(Vector2(0 ,5), content), Exception::WrongPosition);
BOOST_CHECK_THROW(grid.SetSquare(Vector2(3 ,0), content), Exception::WrongPosition);
}
BOOST_AUTO_TEST_CASE ( setting_content_and_getting_it_gives_equal_object )
{
Square contentOrig;
Square contentDest;
Grid grid;
grid.Init(Vector2(3, 5));
grid.SetSquare(Vector2(0,1), contentOrig);
contentDest = grid.GetSquare(Vector2(0, 1));
BOOST_CHECK( contentOrig == contentDest );
}
// Iterator on squares
BOOST_AUTO_TEST_CASE( grid_distance_is_grid_size )
{
Grid grid;
grid.Init(Vector2(4,6));
BOOST_CHECK_EQUAL(grid.GetWidth() * grid.GetHeight(), std::distance(grid.begin(), grid.end()));
}
BOOST_AUTO_TEST_CASE( test_grid_not_full )
{
Grid grid;
grid.Init(Vector2(4,6));
BOOST_CHECK_EQUAL( false, grid.IsFull());
}
BOOST_AUTO_TEST_CASE( test_grid_full )
{
Grid grid;
grid.Init(Vector2(2,1));
grid.SetSquare(Vector2(0,0),Square('A'));
grid.SetSquare(Vector2(1,0),Square('B'));
BOOST_CHECK_EQUAL( true, grid.IsFull());
}
BOOST_AUTO_TEST_CASE( test_grid_full_with_several_write_at_the_same_place )
{
Grid grid;
grid.Init(Vector2(2,1));
grid.SetSquare(Vector2(0,0),Square('A'));
grid.SetSquare(Vector2(1,0),Square('B'));
grid.SetSquare(Vector2(1,0),Square('C'));
grid.SetSquare(Vector2(0,0),Square::EmptySquare());
grid.SetSquare(Vector2(0,0),Square('D'));
BOOST_CHECK(grid.IsFull());
}
BOOST_AUTO_TEST_CASE( test_grid_full_with_several_write_at_the_same_place_and_an_empty_square )
{
Grid grid;
grid.Init(Vector2(2,1));
grid.SetSquare(Vector2(0,0),Square('A'));
grid.SetSquare(Vector2(1,0),Square('B'));
grid.SetSquare(Vector2(1,0),Square('C'));
grid.SetSquare(Vector2(0,0),Square::EmptySquare());
BOOST_CHECK(!grid.IsFull());
}
BOOST_AUTO_TEST_CASE(grid_equality)
{
Grid grid;
grid.Init(Vector2(3,4));
grid.SetSquare(Vector2(1,2), Square('A'));
Grid grid2(grid);
BOOST_CHECK(grid == grid2);
}
BOOST_AUTO_TEST_CASE(grid_inequality_by_size)
{
Grid grid;
grid.Init(Vector2(3,4));
grid.SetSquare(Vector2(1,2), Square('A'));
Grid grid2;
grid2.Init(Vector2(4,4));
grid.SetSquare(Vector2(1,2), Square('A'));
BOOST_CHECK(grid != grid2);
}
BOOST_AUTO_TEST_CASE(grid_inequality_by_content)
{
Grid grid;
grid.Init(Vector2(3,4));
grid.SetSquare(Vector2(1,2), Square('A'));
Grid grid2;
grid2.Init(Vector2(3,4));
grid.SetSquare(Vector2(2,2), Square('B'));
BOOST_CHECK(grid != grid2);
}
BOOST_AUTO_TEST_SUITE_END()
| [
"[email protected]"
] | [
[
[
1,
216
]
]
] |
1a8016b61abf1c94610dc9ee6049d9d183e007fa | 7a8153e3fde0807462b6b6696b796d772639fa74 | /src/game/lifeforms/Player.cpp | 7b01811e102990bea8e227124f9fd6599c22ba3b | [] | no_license | qaze/violetland | 7183f9670676d05da3970cd2fbd8cf7e5f5197c2 | 9f0fc9aff4ca1a4111b45fb105fc33fd9ae97dad | refs/heads/master | 2021-01-02T22:38:01.687080 | 2011-10-10T12:35:36 | 2011-10-10T12:35:36 | 32,754,552 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,740 | cpp | #ifdef _WIN32
#define _USE_MATH_DEFINES
#endif //_WIN32W
#include "Player.h"
#include "../../system/utility/Templates.h"
namespace violetland {
Player::Player(float x, float y, Sprite *legsSprite, Sprite *deathSprite,
std::vector<Sound*> hitSounds, Sound* dyingSound) :
LifeForm(x, y, 128, 128) {
Id = "20-" + Id;
Xp = 0;
LastLevelXp = 0;
NextLevelXp = 100;
Kills = 0;
LevelPoints = 0;
ActionMode = PLAYER_ACT_MODE_FIRE;
AccuracyDeviation = 0.0f;
Grenades = 2;
Teleports = 1;
Acceleration = 0.0004f;
Type = LIFEFORM_PLAYER;
m_hitSndPlaying = 0;
m_walkTime = 0;
m_walkDelay = 0;
m_weapon = NULL;
m_light = m_laser = false;
Unstoppable = PoisonBullets = BigCalibre = Telekinesis = NightVision
= Looting = WideSight = Magneto = false;
for (int i = PLAYER_BONUS_FIRST; i < PLAYER_BONUS_COUNT; i++)
bonusTimes[i] = 0;
processTelekinesis(0, true);
TargetX = x;
TargetY = y;
m_weapon = NULL;
m_arms = NULL;
m_body = new DynamicObject(x, y, legsSprite);
m_body->Frame = 8;
m_deathSprite = deathSprite;
m_hitSounds = hitSounds;
m_dyingSound = dyingSound;
}
float Player::getStrength() const {
return Strength * ((bonusTimes[PLAYER_BONUS_STRENGTHBOOST] > 0) ? 1.2f
: 1.0f);
}
float Player::getAgility() const {
return Agility
* ((bonusTimes[PLAYER_BONUS_AGILITYBOOST] > 0) ? 1.2f : 1.0f);
}
float Player::getVitality() const {
return Vitality * ((bonusTimes[PLAYER_BONUS_VITALITYBOOST] > 0) ? 1.2f
: 1.0f);
}
Sound* Player::hit(float damage, bool poison) {
LifeForm::hit(damage, poison);
setMask(1.0f, 0.0f, 0.0f, 1.0f);
if (!Unstoppable)
Speed = 0.0f;
if (!m_hitSounds[m_hitSndPlaying]->isPlaying()) {
m_hitSndPlaying = (getHealth() < MaxHealth() ? getHealth()
: getHealth() - 0.01f) / MaxHealth() * m_hitSounds.size();
return m_hitSounds[m_hitSndPlaying];
}
return NULL;
}
std::vector<Bullet*>* Player::fire() {
const float rad = (getArmsAngle() - 90) * M_PI / 180;
std::vector<Bullet*> *newBullets = m_weapon->fire(m_arms->X, m_arms->Y,
m_arms->X + m_weapon->XDiff * cos(rad) + m_weapon->YDiff
* sin(-rad), m_arms->Y + m_weapon->XDiff * sin(rad)
+ m_weapon->YDiff * cos(-rad));
if (!newBullets->empty()) {
std::vector<Bullet*>::iterator it;
if (AccuracyDeviation < 25)
AccuracyDeviation
+= m_weapon->BulletsAtOnce > 1 ? m_weapon->ReturnForce
: m_weapon->ReturnForce * WeaponRetForceMod();
for (it = newBullets->begin(); it != (newBullets->end()); it++) {
Bullet* bullet = *(it);
bullet->Poisoned = m_weapon->Type == BULLET_STANDARD
&& PoisonBullets;
bullet->BigCalibre = m_weapon->Type == BULLET_STANDARD
&& BigCalibre;
if (BigCalibre) {
bullet->Damage *= 1.1f;
}
bullet->Penetrating = m_weapon->Type == BULLET_STANDARD
&& bonusTimes[PLAYER_BONUS_PENBULLETS] > 0;
bullet->Angle = AccuracyDeviation < 1 ? m_arms->Angle
: m_arms->Angle + (rand() % (int) (AccuracyDeviation * 2))
- AccuracyDeviation;
bullet->OwnerId = Id;
}
if (m_weapon->BulletsAtOnce > 1)
AccuracyDeviation = 0;
if (m_weapon->ShellSprite)
{
DynamicObject* shell = new DynamicObject(X, Y, m_weapon->ShellSprite);
shell->Angle = m_arms->Angle;
m_shells.push_back(shell);
}
}
return newBullets;
}
Bullet* Player::throwGrenade(Sprite* grenadeSprite) {
Bullet* newBullet =
new GrenadeBullet(X, Y, TargetX, TargetY, grenadeSprite);
newBullet->Damage = 5.0f;
newBullet->Speed = MaxSpeed() * 5.0f;
newBullet->MaxRange = 1500;
Grenades--;
return newBullet;
}
void Player::reload() {
if (m_weapon->reload(ReloadSpeedMod()))
AccuracyDeviation = 0;
}
void Player::processState(int deltaTime) {
if (State == LIFEFORM_STATE_ALIVE) {
m_arms->X = m_body->X = X;
m_arms->Y = m_body->Y = Y;
m_body->Angle = Angle;
if (Speed > MaxSpeed() / 4) {
m_body->rollFrame(true);
} else {
if (!(m_body->Frame == 8 || m_body->Frame == 20)) {
if ((m_body->Frame > 8 && m_body->Frame < 16) || m_body->Frame
> 20)
m_body->rollFrame(false);
else
m_body->rollFrame(true);
}
}
}
if (State == LIFEFORM_STATE_DYING) {
if (m_body->Frame == m_body->AnimSprite->getFramesCount() - 1)
State = LIFEFORM_STATE_DIED;
m_body->rollFrame(true);
}
if (State == LIFEFORM_STATE_SMITTEN) {
const float angle = m_body->Angle;
delete m_body;
m_body = new DynamicObject(X, Y, m_deathSprite);
m_body->Angle = angle;
State = LIFEFORM_STATE_DYING;
if (m_hitSounds[m_hitSndPlaying]->isPlaying())
m_hitSounds[m_hitSndPlaying]->stop(0);
m_dyingSound->play(5, 0, 0);
}
}
void Player::processArms(int deltaTime) {
m_arms->Angle = Object::calc_angle(X, Y, TargetX, TargetY);
m_weapon->process(deltaTime);
AccuracyDeviation -= deltaTime * 0.01f;
if (AccuracyDeviation < 0)
AccuracyDeviation = 0;
}
void Player::process(int deltaTime) {
// Base processing
LifeForm::process(deltaTime);
// State and animation
processState(deltaTime);
// Hit animation
fadeColor(deltaTime);
// Weapon and targeting
processArms(deltaTime);
// Bonuses
processBonus(deltaTime);
}
void Player::processBonus(int deltaTime) {
for (int i = PLAYER_BONUS_FIRST; i < PLAYER_BONUS_COUNT; i++) {
bonusTimes[i] -= deltaTime;
if (bonusTimes[i] < 0)
bonusTimes[i] = 0;
}
}
void Player::fadeColor(int deltaTime) {
m_arms->setMask(RMask, GMask, BMask, AMask);
m_body->setMask(RMask, GMask, BMask, AMask);
if (RMask < 1.0f)
RMask += 0.01f;
if (GMask < 1.0f)
GMask += 0.01f;
if (BMask < 1.0f)
BMask += 0.01f;
if (AMask < 1.0f)
AMask += 0.01f;
}
void Player::draw() {
m_body->draw(X, Y, Angle, Scale, RMask, GMask, BMask, AMask);
if (State == LIFEFORM_STATE_ALIVE)
m_arms->draw(false, false);
for (int i = m_shells.size() - 1; i >= 0; i--) {
m_shells[i]->draw();
if (m_shells[i]->Frame == m_shells[i]->AnimSprite->getFramesCount() - 1) {
delete m_shells[i];
m_shells .erase(m_shells.begin() + i);
continue;
}
m_shells[i]->rollFrame(true);
}
}
StaticObject* Player::getCorpse() {
StaticObject * corpse = new StaticObject(X, Y, m_width, m_height,
m_body->getFrame(), false);
corpse->Scale = m_body->Scale;
corpse->Angle = Object::fixAngle(180 - m_body->Angle);
return corpse;
}
void Player::setX(float value) {
X = m_arms->X = m_body->X = value;
}
void Player::setY(float value) {
Y = m_arms->Y = m_body->Y = value;
}
void Player::teleport() {
Teleports--;
setX(TargetX);
setY(TargetY);
}
void Player::setWeapon(Weapon *value) {
float angle = 0;
if (m_weapon) {
angle = getArmsAngle();
delete m_arms;
delete m_weapon;
}
m_weapon = new Weapon(*value);
m_arms = new StaticObject(X, Y, 128, 128, m_weapon->getPlayerTex(), false);
m_arms->Angle = angle;
AccuracyDeviation = 0;
}
// Controls telekinesis ability
// Reset = true to reset timer (obvious!), deltaTime will be ignored, will return 0
// Reset = false and deltaTime >= 0 to evaluate timer, returns percentage of telekinesis process (100 or more to complete)
unsigned Player::processTelekinesis(int deltaTime, bool reset)
{
if (reset)
{
m_telekinesisDelay = TELEKINESIS_DELAY;
return 0;
}
else
{
m_telekinesisDelay -= deltaTime;
return (unsigned)((float)(TELEKINESIS_DELAY - m_telekinesisDelay) / TELEKINESIS_DELAY * 10) * 10;
}
}
Player::~Player() {
if (m_body)
delete m_body;
if (m_arms)
delete m_arms;
if (m_weapon)
delete m_weapon;
clearVector<DynamicObject*> (&m_shells);
}
}
| [
"5253450@c5058ba8-c010-11de-a759-a54c9d3330c2",
"[email protected]@c5058ba8-c010-11de-a759-a54c9d3330c2",
"[email protected]@c5058ba8-c010-11de-a759-a54c9d3330c2"
] | [
[
[
1,
4
],
[
6,
6
],
[
12,
31
],
[
34,
36
],
[
39,
42
],
[
45,
51
],
[
53,
56
],
[
58,
61
],
[
63,
66
],
[
68,
83
],
[
85,
100
],
[
102,
102
],
[
104,
105
],
[
107,
107
],
[
109,
118
],
[
125,
129
],
[
131,
142
],
[
144,
147
],
[
149,
175
],
[
177,
186
],
[
188,
189
],
[
191,
194
],
[
196,
211
],
[
214,
219
],
[
221,
232
],
[
234,
249
],
[
251,
257
],
[
259,
261
],
[
263,
265
],
[
267,
270
],
[
274,
274
],
[
276,
280
],
[
282,
284
],
[
304,
304
],
[
307,
307
],
[
310,
310
],
[
315,
315
]
],
[
[
5,
5
],
[
52,
52
],
[
57,
57
],
[
62,
62
],
[
176,
176
]
],
[
[
7,
11
],
[
32,
33
],
[
37,
38
],
[
43,
44
],
[
67,
67
],
[
84,
84
],
[
101,
101
],
[
103,
103
],
[
106,
106
],
[
108,
108
],
[
119,
124
],
[
130,
130
],
[
143,
143
],
[
148,
148
],
[
187,
187
],
[
190,
190
],
[
195,
195
],
[
212,
213
],
[
220,
220
],
[
233,
233
],
[
250,
250
],
[
258,
258
],
[
262,
262
],
[
266,
266
],
[
271,
273
],
[
275,
275
],
[
281,
281
],
[
285,
303
],
[
305,
306
],
[
308,
309
],
[
311,
314
]
]
] |
3834e328b33855ae4dfeb0b2e567346d467e034a | 15e36fc51a93940fbe26a38cc9456dbda587bf9a | /src/re330/VertexData.cpp | 7b579f0a51c73f54be48d744b4eabf310f5a832f | [] | no_license | navsk13/Graphics-Project-1 | 519b3c79c7f45d323128d707ed8746fc87ce182e | 237359b44b06fd0cdcba5acb491ba10f7f2a4802 | refs/heads/master | 2021-01-24T01:47:14.243135 | 2010-02-24T15:11:04 | 2010-02-24T15:11:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 702 | cpp | #include "VertexData.h"
#include "VertexDeclaration.h"
using namespace RE330;
VertexData::VertexData()
: mIndexCount(0), mIndexBuffer(0)
{
}
VertexData::~VertexData()
{
if(mIndexBuffer!=0)
{
delete[] mIndexBuffer;
}
}
void VertexData::createVertexBuffer(int bufferIndex, int vertexBufferSize, unsigned char *data)
{
VertexBuffer *buf = new VertexBuffer();
buf->loadBuffer(vertexBufferSize, data);
vertexBufferBinding.setBinding(bufferIndex, *buf);
}
void VertexData::createIndexBuffer(int indexCount, int *data)
{
mIndexCount = indexCount;
mIndexBuffer = new int[indexCount];
for(int i=0; i<mIndexCount; i++)
{
mIndexBuffer[i] = data[i];
}
}
| [
"[email protected]"
] | [
[
[
1,
36
]
]
] |
472391e477575beb7fe8a746c508b054074c6a52 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/mpl/test/empty.cpp | 205cb14cec16e9af8c2cafc0d70d3e1430161828 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | willrebuild/flyffsf | e5911fb412221e00a20a6867fd00c55afca593c7 | d38cc11790480d617b38bb5fc50729d676aef80d | refs/heads/master | 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 608 | cpp |
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/libs/mpl/test/empty.cpp,v $
// $Date: 2004/09/02 15:41:35 $
// $Revision: 1.4 $
#include <boost/mpl/empty.hpp>
#include <boost/mpl/list/list10.hpp>
#include <boost/mpl/aux_/test.hpp>
MPL_TEST_CASE()
{
MPL_ASSERT(( empty< list0<> > ));
MPL_ASSERT_NOT(( empty< list1<char> > ));
}
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] | [
[
[
1,
23
]
]
] |
fe0141a106e85ab1d43a13d3e636f418682081d3 | 7f4230cae41e0712d5942960674bfafe4cccd1f1 | /code/Exporter.cpp | d5a6f3e6dc66245d76efd494fca711768263b4bf | [
"BSD-3-Clause"
] | permissive | tonttu/assimp | c6941538b3b3c3d66652423415dea098be21f37a | 320a7a7a7e0422e4d8d9c2a22b74cb48f74b14ce | refs/heads/master | 2021-01-16T19:56:09.309754 | 2011-06-07T20:00:41 | 2011-06-07T20:00:41 | 1,295,427 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,918 | cpp | /*
---------------------------------------------------------------------------
Open Asset Import Library (ASSIMP)
---------------------------------------------------------------------------
Copyright (c) 2006-2010, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
/** @file Exporter.cpp
Assimp export interface. While it's public interface bears many similarities
to the import interface (in fact, it is largely symmetric), the internal
implementations differs a lot. Exporters are considered stateless and are
simple callbacks which we maintain in a global list along with their
description strings.
Here we implement only the C++ interface (Assimp::Exporter).
*/
#include "AssimpPCH.h"
#ifndef ASSIMP_BUILD_NO_EXPORT
#include "DefaultIOSystem.h"
#include "BlobIOSystem.h"
namespace Assimp {
// ------------------------------------------------------------------------------------------------
// Exporter worker function prototypes. Should not be necessary to #ifndef them, it's just a prototype
void ExportSceneCollada(const char*,IOSystem*, const aiScene*);
void ExportScene3DS(const char*, IOSystem*, const aiScene*) {}
/// Function pointer type of a Export worker function
typedef void (*fpExportFunc)(const char*,IOSystem*,const aiScene*);
// ------------------------------------------------------------------------------------------------
/// Internal description of an Assimp export format option
struct ExportFormatEntry
{
/// Public description structure to be returned by aiGetExportFormatDescription()
aiExportFormatDesc mDescription;
// Worker function to do the actual exporting
fpExportFunc mExportFunction;
// Constructor to fill all entries
ExportFormatEntry( const char* pId, const char* pDesc, const char* pExtension, fpExportFunc pFunction)
{
mDescription.id = pId;
mDescription.description = pDesc;
mDescription.fileExtension = pExtension;
mExportFunction = pFunction;
}
};
// ------------------------------------------------------------------------------------------------
// global array of all export formats which Assimp supports in its current build
ExportFormatEntry gExporters[] =
{
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada),
#endif
#ifndef ASSIMP_BUILD_NO_3DS_EXPORTER
ExportFormatEntry( "3ds", "Autodesk 3DS (legacy format)", "3ds" , &ExportScene3DS),
#endif
};
class ExporterPimpl {
public:
ExporterPimpl()
: blob()
, mIOSystem(new Assimp::DefaultIOSystem())
, mIsDefaultIOHandler(true)
{
}
~ExporterPimpl()
{
delete blob;
}
public:
aiExportDataBlob* blob;
boost::shared_ptr< Assimp::IOSystem > mIOSystem;
bool mIsDefaultIOHandler;
};
#define ASSIMP_NUM_EXPORTERS (sizeof(gExporters)/sizeof(gExporters[0]))
} // end of namespace Assimp
using namespace Assimp;
// ------------------------------------------------------------------------------------------------
Exporter :: Exporter()
: pimpl(new ExporterPimpl())
{
}
// ------------------------------------------------------------------------------------------------
Exporter :: ~Exporter()
{
delete pimpl;
}
// ------------------------------------------------------------------------------------------------
void Exporter :: SetIOHandler( IOSystem* pIOHandler)
{
pimpl->mIsDefaultIOHandler = !pIOHandler;
pimpl->mIOSystem.reset(pIOHandler);
}
// ------------------------------------------------------------------------------------------------
IOSystem* Exporter :: GetIOHandler() const
{
return pimpl->mIOSystem.get();
}
// ------------------------------------------------------------------------------------------------
bool Exporter :: IsDefaultIOHandler() const
{
return pimpl->mIsDefaultIOHandler;
}
// ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const char* pFormatId )
{
if (pimpl->blob) {
delete pimpl->blob;
pimpl->blob = NULL;
}
boost::shared_ptr<IOSystem> old = pimpl->mIOSystem;
BlobIOSystem* blobio = new BlobIOSystem();
pimpl->mIOSystem = boost::shared_ptr<IOSystem>( blobio );
if (AI_SUCCESS != Export(pScene,pFormatId,blobio->GetMagicFileName())) {
pimpl->mIOSystem = old;
return NULL;
}
pimpl->blob = blobio->GetBlobChain();
pimpl->mIOSystem = old;
return pimpl->blob;
}
// ------------------------------------------------------------------------------------------------
aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const char* pPath )
{
ASSIMP_BEGIN_EXCEPTION_REGION();
for (size_t i = 0; i < ASSIMP_NUM_EXPORTERS; ++i) {
if (!strcmp(gExporters[i].mDescription.id,pFormatId)) {
try {
gExporters[i].mExportFunction(pPath,pimpl->mIOSystem.get(),pScene);
}
catch (DeadlyExportError& err) {
// XXX what to do with the error message? Maybe introduce extra member to hold it, similar to Assimp.Importer
DefaultLogger::get()->error(err.what());
return AI_FAILURE;
}
return AI_SUCCESS;
}
}
ASSIMP_END_EXCEPTION_REGION(aiReturn);
return AI_FAILURE;
}
// ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter :: GetBlob() const
{
return pimpl->blob;
}
// ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter :: GetOrphanedBlob() const
{
const aiExportDataBlob* tmp = pimpl->blob;
pimpl->blob = NULL;
return tmp;
}
// ------------------------------------------------------------------------------------------------
size_t Exporter :: GetExportFormatCount() const
{
return ASSIMP_NUM_EXPORTERS;
}
// ------------------------------------------------------------------------------------------------
const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex ) const
{
if (pIndex >= ASSIMP_NUM_EXPORTERS) {
return NULL;
}
return &gExporters[pIndex].mDescription;
}
#endif // !ASSIMP_BUILD_NO_EXPORT
| [
"aramis_acg@67173fc5-114c-0410-ac8e-9d2fd5bffc1f",
"ulfjorensen@67173fc5-114c-0410-ac8e-9d2fd5bffc1f"
] | [
[
[
1,
54
],
[
57,
59
],
[
61,
62
],
[
64,
66
],
[
68,
70
],
[
76,
76
],
[
79,
79
],
[
81,
81
],
[
85,
85
],
[
89,
89
],
[
95,
95
],
[
99,
99
],
[
103,
128
],
[
130,
248
],
[
252,
255
]
],
[
[
55,
56
],
[
60,
60
],
[
63,
63
],
[
67,
67
],
[
71,
75
],
[
77,
78
],
[
80,
80
],
[
82,
84
],
[
86,
88
],
[
90,
94
],
[
96,
98
],
[
100,
102
],
[
129,
129
],
[
249,
251
],
[
256,
256
]
]
] |
fea2cfaa4ef204c6022917565472484840df0a31 | 0b66a94448cb545504692eafa3a32f435cdf92fa | /branches/nn/cbear.berlios.de/bit/range.hpp | c88abbc918776cc0ed3165f3eb218b4ebe46bf24 | [
"MIT"
] | permissive | BackupTheBerlios/cbear-svn | e6629dfa5175776fbc41510e2f46ff4ff4280f08 | 0109296039b505d71dc215a0b256f73b1a60b3af | refs/heads/master | 2021-03-12T22:51:43.491728 | 2007-09-28T01:13:48 | 2007-09-28T01:13:48 | 40,608,034 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,294 | hpp | #ifndef CBEAR_BERLIOS_DE_BIT_RANGE_HPP_INCLUDED
#define CBEAR_BERLIOS_DE_BIT_RANGE_HPP_INCLUDED
// std::size_t
#include <cstddef>
// boost::noncopyable
#include <boost/noncopyable.hpp>
#include <cbear.berlios.de/base/integer.hpp>
namespace cbear_berlios_de
{
namespace bit
{
namespace detail
{
// To avoid conversion warnings.
template<class To>
struct casting
{
template<class From>
static To cast(From X) { return To(X); }
};
// To avoid conversion warnings.
template<>
struct casting<bool>
{
template<class From>
static bool cast(From X) { return X != 0; }
};
}
template<
class Type, std::size_t First, std::size_t Last, class ValueType = Type>
struct range
{
typedef Type type;
typedef ValueType value_type;
typedef typename base::make_unsigned<type>::type unsigned_type;
static const std::size_t first = First;
static const std::size_t last = Last;
static const std::size_t size = last - first + 1;
static const unsigned_type mask =
((unsigned_type(1) << size) - unsigned_type(1)) << first;
static const unsigned_type inverse_mask = ~mask;
static value_type get(type X)
{
return detail::casting<value_type>::cast(
(unsigned_type(X) & mask) >> first);
}
static void set(type &D, value_type S)
{
D =
(unsigned_type(D) & inverse_mask) |
((unsigned_type(S) << first) & mask);
}
class reference
{
public:
explicit reference(type &X): X(&X) {}
operator value_type() const
{
return get(*this->X);
}
const reference &operator=(value_type V) const
{
set(*this->X, V); return *this;
}
private:
type *X;
};
static reference make_reference(type &X) { return reference(X); }
};
/* Because of
4.7 4
If the destination type is bool, see 4.12. If the source type is bool, the
value false is converted to zero and the value true is converted to one.
4.12
An rvalue of arithmetic, enumeration, pointer, or pointer to member type can
be converted to an rvalue of type bool. A zero value, null pointer value, or
null member pointer value is converted to false; any other value is converted
to true.
*/
template<class Type, std::size_t Number>
struct one: range<Type, Number, Number, bool> {};
}
}
#endif
| [
"nn0@e6e9985e-9100-0410-869a-e199dc1b6838"
] | [
[
[
1,
102
]
]
] |
10fa35260b7be431ad9e0dc2c69c3fe46c257ebc | 3e1e78cd64328f947fdd721213f75b47a810d68c | /windows/src/MemSegment.cpp | 7615975f9e82be98c67d578617062a2cbe46dec7 | [] | no_license | phuonglelephuong/dynamicipupdate | daeb10b891a06da80d345ced677cd96bdaa62d8f | 58eb721427f132900d81ee95acf3cb09ea133f59 | refs/heads/master | 2021-01-15T20:53:17.046848 | 2011-12-06T18:41:32 | 2011-12-06T18:45:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,055 | cpp | // Copyright (c) 2009 OpenDNS Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "stdafx.h"
#include "MemSegment.h"
// caller needs to free() the result
void *MemSegment::getData(DWORD *sizeOut)
{
DWORD totalSize = dataSize;
MemSegment *curr = next;
while (curr) {
totalSize += curr->dataSize;
curr = curr->next;
}
if (0 == dataSize)
return NULL;
char *buf = (char*)malloc(totalSize + 1); // +1 for 0 termination
if (!buf)
return NULL;
buf[totalSize] = 0;
// the chunks are linked in reverse order, so we must reassemble them properly
char *end = buf + totalSize;
curr = next;
while (curr) {
end -= curr->dataSize;
memcpy(end, curr->data, curr->dataSize);
curr = curr->next;
}
end -= dataSize;
memcpy(end, data, dataSize);
assert(end == buf);
if (sizeOut)
*sizeOut = totalSize;
return (void*)buf;
}
| [
"[email protected]"
] | [
[
[
1,
38
]
]
] |
34051292bf8c2aae5e6dc6edfb1c90f903f50770 | 028d6009f3beceba80316daa84b628496a210f8d | /uidesigner/com.nokia.sdt.referenceprojects.test/data2/settings_list_3_0/reference/inc/Settings_list_3_0SettingItemListView.h | 3e7eac042f517870ae117b8d2a07d0aca11a0e52 | [] | no_license | JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp | fa50cafa69d3e317abf0db0f4e3e557150fd88b3 | 4420f338bc4e522c563f8899d81201857236a66a | refs/heads/master | 2020-12-30T16:45:28.474973 | 2010-10-20T16:19:31 | 2010-10-20T16:19:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,700 | h | #ifndef SETTINGS_LIST_3_0SETTINGITEMLISTVIEW_H
#define SETTINGS_LIST_3_0SETTINGITEMLISTVIEW_H
// [[[ begin generated region: do not modify [Generated Includes]
#include <aknview.h>
#include "Settings_list_3_0SettingItemListSettings.h"
// ]]] end generated region [Generated Includes]
// [[[ begin [Event Handler Includes]
// ]]] end [Event Handler Includes]
// [[[ begin generated region: do not modify [Generated Constants]
// ]]] end generated region [Generated Constants]
// [[[ begin generated region: do not modify [Generated Forward Declarations]
class CSettings_list_3_0SettingItemList;
// ]]] end generated region [Generated Forward Declarations]
/**
* Avkon view class for Settings_list_3_0SettingItemListView. It is register with the view server
* by the AppUi. It owns the container control.
* @class CSettings_list_3_0SettingItemListView Settings_list_3_0SettingItemListView.h
*/
class CSettings_list_3_0SettingItemListView : public CAknView
{
// [[[ begin [Public Section]
public:
// constructors and destructor
CSettings_list_3_0SettingItemListView();
static CSettings_list_3_0SettingItemListView* NewL();
static CSettings_list_3_0SettingItemListView* NewLC();
void ConstructL();
virtual ~CSettings_list_3_0SettingItemListView();
// from base class CAknView
TUid Id() const;
void HandleCommandL( TInt aCommand );
// [[[ begin generated region: do not modify [Generated Methods]
// ]]] end generated region [Generated Methods]
// ]]] end [Public Section]
// [[[ begin [Protected Section]
protected:
// from base class CAknView
void DoActivateL(
const TVwsViewId& aPrevViewId,
TUid aCustomMessageId,
const TDesC8& aCustomMessage );
void DoDeactivate();
void HandleStatusPaneSizeChange();
// [[[ begin generated region: do not modify [Overridden Methods]
// ]]] end generated region [Overridden Methods]
// [[[ begin [User Handlers]
TBool HandleChangeSelectedSettingItemL( TInt aCommand );
// ]]] end [User Handlers]
// ]]] end [Protected Section]
// [[[ begin [Private Section]
private:
void SetupStatusPaneL();
void CleanupStatusPane();
// [[[ begin generated region: do not modify [Generated Instance Variables]
CSettings_list_3_0SettingItemList* iSettings_list_3_0SettingItemList;
TSettings_list_3_0SettingItemListSettings* iSettings;
// ]]] end generated region [Generated Instance Variables]
// [[[ begin generated region: do not modify [Generated Methods]
// ]]] end generated region [Generated Methods]
// ]]] end [Private Section]
};
#endif // SETTINGS_LIST_3_0SETTINGITEMLISTVIEW_H
| [
"[email protected]"
] | [
[
[
1,
87
]
]
] |
fcd0ff5f6205b32123df331cc5c326a1c783b83c | 5c4e36054f0752a610ad149dfd81e6f35ccb37a1 | /libs/src2.75/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h | 3be8cc0388a489e6d05cd2d9302f6eb2c7da3f4b | [] | no_license | Akira-Hayasaka/ofxBulletPhysics | 4141dc7b6dff7e46b85317b0fe7d2e1f8896b2e4 | 5e45da80bce2ed8b1f12de9a220e0c1eafeb7951 | refs/heads/master | 2016-09-15T23:11:01.354626 | 2011-09-22T04:11:35 | 2011-09-22T04:11:35 | 1,152,090 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,411 | h | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SIMPLE_BROADPHASE_H
#define SIMPLE_BROADPHASE_H
#include "btOverlappingPairCache.h"
struct btSimpleBroadphaseProxy : public btBroadphaseProxy
{
int m_nextFree;
// int m_handleId;
btSimpleBroadphaseProxy() {};
btSimpleBroadphaseProxy(const btVector3& minpt,const btVector3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,void* multiSapProxy)
:btBroadphaseProxy(minpt,maxpt,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy)
{
(void)shapeType;
}
SIMD_FORCE_INLINE void SetNextFree(int next) {m_nextFree = next;}
SIMD_FORCE_INLINE int GetNextFree() const {return m_nextFree;}
};
///The SimpleBroadphase is just a unit-test for btAxisSweep3, bt32BitAxisSweep3, or btDbvtBroadphase, so use those classes instead.
///It is a brute force aabb culling broadphase based on O(n^2) aabb checks
class btSimpleBroadphase : public btBroadphaseInterface
{
protected:
int m_numHandles; // number of active handles
int m_maxHandles; // max number of handles
int m_LastHandleIndex;
btSimpleBroadphaseProxy* m_pHandles; // handles pool
void* m_pHandlesRawPtr;
int m_firstFreeHandle; // free handles list
int allocHandle()
{
btAssert(m_numHandles < m_maxHandles);
int freeHandle = m_firstFreeHandle;
m_firstFreeHandle = m_pHandles[freeHandle].GetNextFree();
m_numHandles++;
if(freeHandle > m_LastHandleIndex)
{
m_LastHandleIndex = freeHandle;
}
return freeHandle;
}
void freeHandle(btSimpleBroadphaseProxy* proxy)
{
int handle = int(proxy-m_pHandles);
btAssert(handle >= 0 && handle < m_maxHandles);
if(handle == m_LastHandleIndex)
{
m_LastHandleIndex--;
}
proxy->SetNextFree(m_firstFreeHandle);
m_firstFreeHandle = handle;
proxy->m_clientObject = 0;
m_numHandles--;
}
btOverlappingPairCache* m_pairCache;
bool m_ownsPairCache;
int m_invalidPair;
inline btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBroadphaseProxy* proxy)
{
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxy);
return proxy0;
}
inline const btSimpleBroadphaseProxy* getSimpleProxyFromProxy(btBroadphaseProxy* proxy) const
{
const btSimpleBroadphaseProxy* proxy0 = static_cast<const btSimpleBroadphaseProxy*>(proxy);
return proxy0;
}
///reset broadphase internal structures, to ensure determinism/reproducability
virtual void resetPool(btDispatcher* dispatcher);
void validate();
protected:
public:
btSimpleBroadphase(int maxProxies=16384,btOverlappingPairCache* overlappingPairCache=0);
virtual ~btSimpleBroadphase();
static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1);
virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy);
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher);
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0),const btVector3& aabbMax=btVector3(0,0,0));
btOverlappingPairCache* getOverlappingPairCache()
{
return m_pairCache;
}
const btOverlappingPairCache* getOverlappingPairCache() const
{
return m_pairCache;
}
bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1);
///getAabb returns the axis aligned bounding box in the 'global' coordinate frame
///will add some transform later
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
{
aabbMin.setValue(-BT_LARGE_FLOAT,-BT_LARGE_FLOAT,-BT_LARGE_FLOAT);
aabbMax.setValue(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT);
}
virtual void printStats()
{
// printf("btSimpleBroadphase.h\n");
// printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles);
}
};
#endif //SIMPLE_BROADPHASE_H
| [
"[email protected]"
] | [
[
[
1,
170
]
]
] |
b47041679aa363648951f984b39e16fa6d5b8bf2 | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/addons/pa/ParticleUniverse/include/ParticleUniverseExtern.h | e04bb0057adcfb313f02968f4d055fe92ccc42c1 | [] | no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,996 | h | /*
-----------------------------------------------------------------------------------------------
This source file is part of the Particle Universe product.
Copyright (c) 2010 Henry van Merode
Usage of this program is licensed under the terms of the Particle Universe Commercial License.
You can find a copy of the Commercial License in the Particle Universe package.
-----------------------------------------------------------------------------------------------
*/
#ifndef __PU_EXTERN_H__
#define __PU_EXTERN_H__
#include "ParticleUniversePrerequisites.h"
#include "ParticleUniverseIAlias.h"
#include "ParticleUniverseIElement.h"
#include "OgreVector3.h"
namespace ParticleUniverse
{
/** The Extern class is the abstract class for all extern components. Each subclass of Extern wraps a
particular external component and forms a bridge between the external component and the
ParticleUniverse (or to be more specific, the ParticleTechnique).
@remarks
External components can be used to add functionality to the ParticleUniverse plugin. An example is
the addition of a physics library. Settings up the library is typically done within a dedicated
subclass of Extern.
*/
class _ParticleUniverseExport Extern : public IAlias, public IElement, public Ogre::FXAlloc
{
protected:
// Type of extern
Ogre::String mExternType;
// Name of the extern (optional)
Ogre::String mName;
// Parent
ParticleTechnique* mParentTechnique;
/** Although the scale is on a Particle System level, the extern can also be scaled.
*/
Ogre::Vector3 _mExternScale;
public:
Extern(void) :
IElement(),
mExternType(Ogre::StringUtil::BLANK),
mParentTechnique(0),
_mExternScale(Ogre::Vector3::UNIT_SCALE){};
virtual ~Extern(void){};
/** Todo
*/
const Ogre::String& getName(void) const {return mName;};
void setName(const Ogre::String& name) {mName = name;};
/** Todo
*/
const Ogre::String& getExternType(void) const {return mExternType;};
void setExternType(const Ogre::String& externType) {mExternType = externType;};
/** Todo
*/
ParticleTechnique* getParentTechnique(void) const {return mParentTechnique;};
void setParentTechnique(ParticleTechnique* parentTechnique) {mParentTechnique = parentTechnique;};
/** Notify that the Particle System is rescaled.
*/
virtual void _notifyRescaled(const Ogre::Vector3& scale);
/** Copy attributes to another extern object.
*/
virtual void copyAttributesTo (Extern* externObject);
/** Copy parent attributes to another extern object.
*/
virtual void copyParentAttributesTo (Extern* externObject);
/** Perform initialisation actions.
@remarks
The _prepare() function is automatically called during initialisation activities of a ParticleTechnique.
Each subclass should implement this function to perform initialisation actions needed for the external
component.
@par
This is a pure virtual function, to be sure that developers of an extern component don't forget to
override this functions and perform setup/initialisation of the component. This is to prevent that
unexplainable errors occur because initialisation tasks where forgotten.
*/
virtual void _prepare(ParticleTechnique* technique) = 0;
/** Reverse the actions from the _prepare.
*/
virtual void _unprepare(ParticleTechnique* particleTechnique){/* No implementation */};
/** Perform activities when an Extern is started.
*/
virtual void _notifyStart (void){/* Do nothing */};
/** Perform activities when an Extern is paused.
*/
virtual void _notifyPause (void){/* Do nothing */};
/** Perform activities when an Extern is resumed.
*/
virtual void _notifyResume (void){/* Do nothing */};
/** Perform activities when an Extern is stopped.
*/
virtual void _notifyStop (void){/* Do nothing */};
/** Perform activities before the individual particles are processed.
@remarks
This function is called before the ParticleTechnique update-loop where all particles are traversed.
the preProcess is typically used to perform calculations where the result must be used in
processing each individual particle.
*/
virtual void _preProcessParticles(ParticleTechnique* technique, Ogre::Real timeElapsed){/* Do nothing */};
/** Initialise a newly emitted particle.
@param
particle Pointer to a Particle to initialise.
*/
virtual void _initParticleForEmission(Particle* particle) { /* by default do nothing */ }
/** Perform actions if a particle gets expired.
*/
virtual void _initParticleForExpiration(Particle* particle) { /* by default do nothing */ }
/** Perform precalculations if the first Particle in the update-loop is processed.
*/
virtual void _firstParticle(ParticleTechnique* particleTechnique,
Particle* particle,
Ogre::Real timeElapsed) { /* by default do nothing */ }
/** Processes a particle.
@remarks
Some processing on a particle can be performed. This function is automatically called in the
ParticleTechnique update-loop where all particles are traversed.
*/
virtual void _processParticle(ParticleTechnique* technique, Particle* particle, Ogre::Real timeElapsed, bool firstParticle);
/** Actually processes a particle.
*/
virtual void _interface(ParticleTechnique* technique,
Particle* particle,
Ogre::Real timeElapsed) = 0;
/** Perform activities after the individual particles are processed.
@remarks
This function is called after the ParticleTechnique update-loop where all particles are traversed.
*/
virtual void _postProcessParticles(ParticleTechnique* technique, Ogre::Real timeElapsed){/* Do nothing */};
};
}
#endif
| [
"[email protected]"
] | [
[
[
1,
158
]
]
] |
616a799e9a2db4ae2d6c21e08dbabe400e5a4b67 | 847cccd728e768dc801d541a2d1169ef562311cd | /doc/scriptReference/src/Project.h | 947d88565100b29b06483f4e99db574fec97241d | [] | no_license | aadarshasubedi/Ocerus | 1bea105de9c78b741f3de445601f7dee07987b96 | 4920b99a89f52f991125c9ecfa7353925ea9603c | refs/heads/master | 2021-01-17T17:50:00.472657 | 2011-03-25T13:26:12 | 2011-03-25T13:26:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 862 | h | /// Representation of the current game project. It is registered as a no-handle reference. So, the only
/// way you can access it is to use the ::gProject global variable.
class Project
{
public:
/// Opens a scene with the given filename.
bool OpenScene(const string& name);
/// Opens the scene at the given index in the scene list.
bool OpenSceneAtIndex(int32 index);
/// Returns the number of scenes in the scene list.
uint32 GetSceneCount() const;
/// Returns the index of the scene with the given name. Returns -1 if it doesn't exist.
int32 GetSceneIndex(const string& name) const;
/// Returns the name of the opened scene. Returns empty string if no scene is opened.
string GetOpenedSceneName() const;
/// Returns the name of the scene at the given index in the scene list.
string GetSceneName(int32 index) const;
}; | [
"[email protected]"
] | [
[
[
1,
24
]
]
] |
67a43b356a0e694623b87ff105b65976eba94349 | 974a20e0f85d6ac74c6d7e16be463565c637d135 | /trunk/packages/dScene/dScene.cpp | 4bff6dee0f3b64a6ce880f38dd82045b1e64a440 | [] | no_license | Naddiseo/Newton-Dynamics-fork | cb0b8429943b9faca9a83126280aa4f2e6944f7f | 91ac59c9687258c3e653f592c32a57b61dc62fb6 | refs/heads/master | 2021-01-15T13:45:04.651163 | 2011-11-12T04:02:33 | 2011-11-12T04:02:33 | 2,759,246 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,809 | cpp | /////////////////////////////////////////////////////////////////////////////
// Name: dScene.h
// Purpose:
// Author: Julio Jerez
// Modified by:
// Created: 22/05/2010 08:02:08
// RCS-ID:
// Copyright: Copyright (c) <2010> <Newton Game Dynamics>
// License:
// 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
/////////////////////////////////////////////////////////////////////////////
#include "dPluginStdafx.h"
#include "dScene.h"
#include "dCameraNodeInfo.h"
#include "dRootNodeInfo.h"
#include "dBoneNodeInfo.h"
#include "dSceneNodeInfo.h"
#include "dMeshNodeInfo.h"
#include "dTextureNodeInfo.h"
#include "dMaterialNodeInfo.h"
#include "dRigidbodyNodeInfo.h"
#include "dCollisionBoxNodeInfo.h"
#include "dCollisionConeNodeInfo.h"
#include "dCollisionSphereNodeInfo.h"
#include "dCollisionCapsuleNodeInfo.h"
#include "dCollisionCylinderNodeInfo.h"
#include "dCollisionCompoundNodeInfo.h"
#include "dCollisionConvexHullNodeInfo.h"
#include "dGeometryNodeSkinModifierInfo.h"
#include "dCollisionChamferCylinderNodeInfo.h"
// this constructor is for the editor only
dScene::dScene(NewtonWorld* newton)
:dSceneGraph(new dRootNodeInfo()), m_newton (newton)
{
// create one camera for each view port
dTreeNode* root = GetRootNode();
for (int i = 0; i < 4; i ++) {
dTreeNode* const node = CreateNode ("dCameraNodeInfo", root);
dCameraNodeInfo* const camera = (dCameraNodeInfo*) GetInfoFromNode(node);
char name[32];
sprintf (name, "viewport%d", i);
camera->SetName (name);
camera->m_viewportIndex = i;
}
}
dScene::dScene(const dScene& me)
:dSceneGraph(me), m_newton (me.m_newton)
{
}
dScene::~dScene(void)
{
}
void dScene::CleanUp()
{
dSceneGraph::Cleanup();
}
dScene::dTreeNode* dScene::GetRootNode() const
{
return dSceneGraph::GetRootNode();
}
void dScene::AddReference(dTreeNode* const parent, dTreeNode* const child)
{
AddEdge (parent, child);
}
void dScene::RemoveReference(dTreeNode* const node1, dTreeNode* const node2)
{
DeleteEdge (node1, node2);
}
dScene::dTreeNode* dScene::CreateNode (const char* className, dTreeNode* const parent)
{
dTreeNode* node = NULL;
dNodeInfo* const info = dNodeInfo::CreateFromClassName (className, this);
if (info) {
node = AddNode(info, parent);
info->Release();
}
return node;
}
dScene::dTreeNode* dScene::CreateCollisionFromNewtonCollision(dTreeNode* const parent, NewtonCollision* collision)
{
NewtonCollisionInfoRecord record;
NewtonCollisionGetInfo(collision, & record);
dNodeInfo* info = NULL;
switch (record.m_collisionType)
{
case SERIALIZE_ID_SPHERE:
{
info = new dCollisionSphereNodeInfo(collision);
break;
}
case SERIALIZE_ID_BOX:
{
info = new dCollisionBoxNodeInfo(collision);
break;
}
case SERIALIZE_ID_CONE:
{
info = new dCollisionConeNodeInfo(collision);
break;
}
case SERIALIZE_ID_CAPSULE:
{
info = new dCollisionCapsuleNodeInfo(collision);
break;
}
case SERIALIZE_ID_CYLINDER:
{
info = new dCollisionCylinderNodeInfo(collision);
break;
}
case SERIALIZE_ID_CHAMFERCYLINDER:
{
info = new dCollisionChamferCylinderNodeInfo(collision);
break;
}
case SERIALIZE_ID_CONVEXHULL:
{
info = new dCollisionConvexHullNodeInfo(collision);
break;
}
case SERIALIZE_ID_COMPOUND:
{
info = new dCollisionCompoundNodeInfo(collision);
break;
}
case SERIALIZE_ID_CONVEXMODIFIER:
case SERIALIZE_ID_TREE:
case SERIALIZE_ID_NULL:
case SERIALIZE_ID_HEIGHTFIELD:
case SERIALIZE_ID_USERMESH:
case SERIALIZE_ID_SCENE:
case SERIALIZE_ID_COMPOUND_BREAKABLE:
{
_ASSERTE(0);
break;
}
}
dTreeNode* const node = AddNode(info, parent);
info->Release();
return node;
}
dScene::dTreeNode* dScene::AddNode(dNodeInfo* const sceneInfo, dTreeNode* const parent)
{
dTreeNode* const node = dSceneGraph::AddNode (sceneInfo, parent);
return node;
}
dScene::dTreeNode* dScene::CreateSceneNode(dTreeNode* const parent)
{
return CreateNode ("dSceneNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateBoneNode(dTreeNode* const parent)
{
return CreateNode ("dBoneNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateRigidbodyNode(dTreeNode* const parent)
{
return CreateNode ("dRigidbodyNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionBoxNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionBoxNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionConeNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionConeNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionSphereNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionSphereNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionCapsuleNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionCapsuleNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionCylinderNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionCylinderNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionCompoundNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionCompoundNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionChamferCylinderNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionChamferCylinderNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateCollisionConvexHullNode(dTreeNode* const parent)
{
return CreateNode ("dCollisionConvexHullNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateMeshNode(dTreeNode* const parent)
{
return CreateNode ("dMeshNodeInfo", parent);
}
dScene::dTreeNode* dScene::CreateSkinModifierNode(dTreeNode* const parent)
{
return CreateNode ("dGeometryNodeSkinModifierInfo", parent);
}
dScene::dTreeNode* dScene::CreateTextureNode (const char* const pathName)
{
dTreeNode* root = GetRootNode();
// see if this texture is already exist
dCRCTYPE crc = dCRC64 (dGetNameFromPath(pathName));
for (void* ptr = GetFirstChild(root); ptr; ptr = GetNextChild(root, ptr)) {
dNodeInfo* const info = GetInfoFromNode(GetNodeFromLink (ptr));
if (info->IsType(dTextureNodeInfo::GetRttiType())) {
dTextureNodeInfo* texture = (dTextureNodeInfo*) info;
if (crc == texture->GetId()) {
// we found a texture, return the node
return GetNodeFromLink (ptr);
}
}
}
dTreeNode* const node = CreateNode ("dTextureNodeInfo", root);
((dTextureNodeInfo*) GetInfoFromNode(node))->SetPathName (pathName);
return node;
}
dScene::dTreeNode* dScene::CreateMaterialNode (dTreeNode* const parent, int id)
{
dScene::dTreeNode* const node = CreateNode ("dMaterialNodeInfo", parent);
((dMaterialNodeInfo*) GetInfoFromNode(node))->m_id = id;
return node;
}
dScene::dTreeNode* dScene::GetFirstNode () const
{
Iterator iter (*this);
iter.Begin();
return iter.GetNode();
}
dScene::dTreeNode* dScene::FindNode (dNodeInfo* const info) const
{
return Find (info->GetUniqueID());
}
dScene::dTreeNode* dScene::GetNextNode (dTreeNode* const node) const
{
Iterator iter (*this);
iter.Set (node);
iter++;
return iter.GetNode();
}
void* dScene::GetFirstChild(dTreeNode* const parentNode) const
{
dGraphNode& root = parentNode->GetInfo();
return root.m_children.GetFirst();
}
void* dScene::GetNextChild(dTreeNode* const parentNode, void* const link) const
{
dGraphNode::dLink::dListNode* const node = (dGraphNode::dLink::dListNode*) link;
return node->GetNext();
}
void* dScene::GetFirstParent(dTreeNode* const childNode) const
{
dGraphNode& root = childNode->GetInfo();
return root.m_parents.GetFirst();
}
void* dScene::GetNextParent(dTreeNode* const childNode, void* const link) const
{
dGraphNode::dLink::dListNode* const node = (dGraphNode::dLink::dListNode*) link;
return node->GetNext();
}
dScene::dTreeNode* dScene::GetNodeFromLink (void* const child) const
{
dGraphNode::dLink::dListNode* const node = (dGraphNode::dLink::dListNode*) child;
return node->GetInfo();
}
dNodeInfo* dScene::GetInfoFromNode(dTreeNode* const node) const
{
return node->GetInfo().GetNode();
}
void dScene::CloneInfoFromNode(dTreeNode* const node)
{
dNodeInfo* copy = node->GetInfo().GetNode()->MakeCopy();
// dNodeInfo* copy = GetInfoFromNode (node)->MakeCopy();
_ASSERTE (copy->GetUniqueID() == GetInfoFromNode (node)->GetUniqueID());
_ASSERTE (copy->GetTypeId() == GetInfoFromNode(node)->GetTypeId()) ;
node->GetInfo().SetNode(copy);
copy->Release();
// ReplaceKey (node, copy);
}
dScene::dTreeNode* dScene::FindCameraNode(int camIndex) const
{
int index = 0;
dTreeNode* camera = NULL;
dTreeNode* const rootNode = GetRootNode();
for (void* child = GetFirstChild (rootNode); child; child = GetNextChild(rootNode, child)) {
dTreeNode* camNode = GetNodeFromLink (child);
dNodeInfo* const info = GetInfoFromNode(camNode);
if (info->IsType(dCameraNodeInfo::GetRttiType())) {
if (index < camIndex) {
index ++;
} else {
camera = camNode;
break;
}
}
}
_ASSERTE (camera);
_ASSERTE (GetInfoFromNode(camera)->IsType(dCameraNodeInfo::GetRttiType()));
return camera;
}
dScene::dTreeNode* dScene::FindTextureByTextId(dTreeNode* const parentNode, dCRCTYPE textId) const
{
for (void* ptr = GetFirstChild(parentNode); ptr; ptr = GetNextChild(parentNode, ptr)) {
dScene::dTreeNode* const node = GetNodeFromLink(ptr);
dNodeInfo* const info = GetInfoFromNode(node);
if (info->IsType(dTextureNodeInfo::GetRttiType())) {
const dTextureNodeInfo* const texture = (dTextureNodeInfo*) info;
if (texture->GetId() == textId) {
return node;
}
}
}
{
// hack!! return any texture if this was an old id
// maybe it is no god idea to make the texture ID form the texture name
// because change the texture cause the file to be invalid
for (void* ptr = GetFirstChild(parentNode); ptr; ptr = GetNextChild(parentNode, ptr)) {
dScene::dTreeNode* const node = GetNodeFromLink(ptr);
dNodeInfo* const info = GetInfoFromNode(node);
if (info->IsType(dTextureNodeInfo::GetRttiType())) {
return node;
}
}
}
return NULL;
}
dScene::dTreeNode* dScene::FindChildByType(dTreeNode* const parentNode, dCRCTYPE type) const
{
for (void* child = GetFirstChild (parentNode); child; child = GetNextChild(parentNode, child)) {
dTreeNode* const tmpNode = GetNodeFromLink (child);
dNodeInfo* const info = GetInfoFromNode(tmpNode);
if (info->IsType(type)) {
return tmpNode;
}
}
return NULL;
}
dScene::dTreeNode* dScene::FindParentByType(dTreeNode* const childNode, dCRCTYPE type) const
{
for (void* parent = GetFirstParent(childNode); parent; parent = GetNextChild(childNode, parent)) {
dTreeNode* const tmpNode = GetNodeFromLink (parent);
dNodeInfo* const info = GetInfoFromNode(tmpNode);
if (info->IsType(type)) {
return tmpNode;
}
}
return NULL;
}
/*
void dScene::BakeSceneNodeTransform (dTreeNode* sceneNode, dMatrix& matrix) const
{
_ASSERTE (GetInfoFromNode(sceneNode)->IsType(dSceneNodeInfo::GetRttiType()));
dSceneNodeInfo* sceneInfo = (dSceneNodeInfo*) GetInfoFromNode(sceneNode);
sceneInfo->BakeTransform (matrix);
for (void* ptr = GetFirstChild(sceneNode); ptr; ptr = GetNextChild(sceneNode, ptr)) {
dTreeNode* geomNode = GetNodeFromLink(ptr);
if (GetInfoFromNode(geomNode)->IsType(dGeometryNodeInfo::GetRttiType())) {
dGeometryNodeInfo* geom = (dGeometryNodeInfo*)GetInfoFromNode(geomNode);
geom->BakeTransform(matrix);
}
}
}
void dScene::BakeSceneNodeTransformRecursive (dTreeNode* sceneNode, dMatrix& matrix) const
{
BakeSceneNodeTransform (sceneNode, matrix);
for (void* ptr = GetFirstChild(sceneNode); ptr; ptr = GetNextChild(sceneNode, ptr)) {
sceneNode = GetNodeFromLink(ptr);
if (GetInfoFromNode(sceneNode)->IsType(dSceneNodeInfo::GetRttiType())) {
BakeSceneNodeTransformRecursive (sceneNode, matrix);
}
}
}
*/
void dScene::BakeTransform (dMatrix& matrix) const
{
Iterator iter (*this);
for (iter.Begin(); iter; iter ++) {
dTreeNode* const node = iter.GetNode();
dNodeInfo* const nodeInfo = GetInfoFromNode(node);
nodeInfo->BakeTransform (matrix);
}
// for (void* ptr = GetFirstChild(root); ptr; ptr = GetNextChild(root, ptr)) {
// dTreeNode* sceneNode = GetNodeFromLink(ptr);
// if (GetInfoFromNode(sceneNode)->IsType(dSceneNodeInfo::GetRttiType())) {
// BakeSceneNodeTransformRecursive (sceneNode, matrix);
// }
// }
}
void dScene::Serialize (const char* const fileName)
{
TiXmlDocument asciifile;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
asciifile.LinkEndChild (decl);
TiXmlElement* parentNode = new TiXmlElement ("alchemedia");
asciifile.LinkEndChild(parentNode);
// save the file description and version
TiXmlElement* header = new TiXmlElement ("header");
parentNode->LinkEndChild(header);
// save configuration for the main frame window
header->SetAttribute ("description", "alchemedia file format");
header->SetAttribute ("revision", m_currentRevision);
// need to remove unused vertices before saving, otherwise Deserialize will not work,
RemoveUnusedVertex();
// save file content
dSceneGraph::Serialize (parentNode);
// save the file
asciifile.SaveFile (fileName);
}
bool dScene::Deserialize (const char* const fileName)
{
// apply last Configuration
TiXmlDocument doc (fileName);
doc.LoadFile();
bool state = true;
const TiXmlElement* root = doc.RootElement();
if (root && doc.FirstChild ("alchemedia") ){
TiXmlElement* root = (TiXmlElement*) doc.FirstChild ("alchemedia");
_ASSERTE (root);
TiXmlElement* header = (TiXmlElement*) root->FirstChild ("header");
_ASSERTE (header);
int revision;
header->Attribute("revision", &revision);
TiXmlElement* nodes = (TiXmlElement*) root->FirstChild ("nodes");
_ASSERTE (nodes);
state = dSceneGraph::Deserialize (nodes, revision);
}
return state;
}
void dScene::SerializeBinary(const char* const fileName)
{
_ASSERTE (0);
/*
FILE* file = fopen (fileName, "wb");
if (file) {
fprintf (file, "alchemedia\n");
fprintf (file, "header\n");
fprintf (file, "description: alchemedia file format\n");
fprintf (file, "revision\n");
int revision = m_currentRevision;
fwrite (&revision, 1, sizeof (int), file);
dSceneGraph::SerializeBinary (file);
fclose (file);
}
*/
}
void dScene::MergeScene (dScene* const scene)
{
dTree<dTreeNode*,dTreeNode*> map;
Iterator iter (*scene);
map.Insert(GetRootNode(), scene->GetRootNode());
for (iter.Begin(); iter; iter ++) {
dTreeNode* const node = iter.GetNode();
dNodeInfo* const info = scene->GetInfoFromNode(node);
if (!(info->IsType(dCameraNodeInfo::GetRttiType()) || info->IsType(dRootNodeInfo::GetRttiType()))) {
_ASSERTE (!Find (info->GetUniqueID()));
dTreeNode* newNode = AddNode (info, NULL);
map.Insert(newNode, node);
}
}
//now connect all edges
dTree<dTreeNode*,dTreeNode*>::Iterator mapIter (map);
for (mapIter.Begin(); mapIter; mapIter ++) {
dTreeNode* srcNode = mapIter.GetKey();
dGraphNode& srcInfoHeader = mapIter.GetNode()->GetInfo()->GetInfo();
for (void* ptr = scene->GetFirstChild (srcNode); ptr; ptr = scene->GetNextChild(srcNode, ptr)) {
dTreeNode* srcLinkNode = scene->GetNodeFromLink(ptr);
dTree<dTreeNode*,dTreeNode*>::dTreeNode* mapSaved = map.Find(srcLinkNode);
if (mapSaved) {
dTreeNode* const node = mapSaved->GetInfo();
srcInfoHeader.m_children.Append(node);
}
}
for (void* ptr = scene->GetFirstParent (srcNode); ptr; ptr = scene->GetNextParent(srcNode, ptr)) {
dTreeNode* srcLinkNode = scene->GetNodeFromLink(ptr);
dTree<dTreeNode*,dTreeNode*>::dTreeNode* mapSaved = map.Find(srcLinkNode);
if (mapSaved) {
dTreeNode* const node = mapSaved->GetInfo();
srcInfoHeader.m_parents.Append(node);
}
}
}
}
void dScene::DeleteNode (dTreeNode* const node)
{
dSceneGraph::DeleteNode (node);
}
void dScene::MergeDuplicateTextures()
{
return;
dTreeNode* const root = GetRootNode();
for (void* ptr0 = GetFirstChild (root); ptr0; ptr0 = GetNextChild(root, ptr0)) {
dTreeNode* texNode0 = GetNodeFromLink(ptr0);
dNodeInfo* const info = GetInfoFromNode(texNode0);
if (info->IsType(dTextureNodeInfo::GetRttiType())) {
dTextureNodeInfo* const tex0 = (dTextureNodeInfo*) info;
const char* const texName0 = tex0->GetPathName();
void* next = NULL;
for (void* ptr1 = GetNextChild(root, ptr0); ptr1; ptr1 = next) {
next = GetNextChild(root, ptr1);
dTreeNode* texNode1 = GetNodeFromLink(ptr1);
dNodeInfo* const info1 = GetInfoFromNode(texNode1);
if (info1->IsType(dTextureNodeInfo::GetRttiType())) {
dTextureNodeInfo* const tex1 = (dTextureNodeInfo*) info1;
const char* const texName1 = tex1->GetPathName();
if (!stricmp(texName0, texName1)) {
for (void* ptr3 = GetFirstChild(texNode1); ptr3; ptr3 = GetNextChild(texNode1, ptr3)) {
dTreeNode* const matNode = GetNodeFromLink(ptr3);
dNodeInfo* const info3 = GetInfoFromNode(matNode);
if (info3->IsType(dMaterialNodeInfo::GetRttiType())) {
AddReference(matNode, texNode0);
}
}
DeleteNode(texNode1);
}
}
}
}
}
}
void dScene::RemoveUnusedVertex()
{
Iterator iter (*this);
for (iter.Begin(); iter; iter ++) {
dTreeNode* const node = iter.GetNode();
dNodeInfo* const info = node->GetInfo().GetNode();
if (info->IsType(dMeshNodeInfo::GetRttiType())) {
dMeshNodeInfo* const mesh = (dMeshNodeInfo*) info;
mesh->RemoveUnusedVertices(this, node);
}
}
}
void dScene::SetNodeLRU (dTreeNode* const node, int lru)
{
node->GetInfo().SetLRU(lru);
}
int dScene::GetNodeLRU (dTreeNode* const node) const
{
return node->GetInfo().GetLRU();
}
void dScene::UpdateAllOOBB ()
{
Iterator iter (*this);
for (iter.Begin(); iter; iter ++) {
dTreeNode* const node = iter.GetNode();
dNodeInfo* const info = GetInfoFromNode(node);
if (info->IsType(dSceneNodeInfo::GetRttiType())){
dSceneNodeInfo* sceneInfo = (dSceneNodeInfo*) GetInfoFromNode(node);
dScene::dTreeNode* geomNode = FindChildByType(node, dGeometryNodeInfo::GetRttiType());
dGeometryNodeInfo* geom = NULL;
if (geomNode) {
geom = (dGeometryNodeInfo*) GetInfoFromNode(geomNode);
}
sceneInfo->UpdateOOBB(geom);
}
}
}
dScene::dTreeNode* dScene::RayCast (const dVector& p0, const dVector& p1) const
{
dFloat t = 1.2f;
dTreeNode* sceneNode = NULL;
dVector p2 (p1) ;
Iterator iter (*this);
for (iter.Begin(); iter; iter ++) {
dTreeNode* const node = iter.GetNode();
dNodeInfo* const info = GetInfoFromNode(node);
if (info->IsType(dSceneNodeInfo::GetRttiType())){
dSceneNodeInfo* sceneInfo = (dSceneNodeInfo*) GetInfoFromNode(node);
dFloat t1 = sceneInfo->RayCast(p0, p2);
if (t1 < t) {
dScene::dTreeNode* geomNode = FindChildByType(node, dGeometryNodeInfo::GetRttiType());
if (geomNode) {
dMatrix matrix (sceneInfo->GetTransform().Inverse4x4());
dVector q0 (matrix.RotateVector4x4(p0));
dVector q1 (matrix.RotateVector4x4(p2));
dGeometryNodeInfo* geom = (dGeometryNodeInfo*) GetInfoFromNode(geomNode);
t1 = geom->RayCast(q0, q1);
}
if (t1 < t) {
t = t1;
p2 = p0 + (p2 - p0).Scale (t);
sceneNode = node;
}
}
}
}
return sceneNode;
}
void dScene::SceneToNewtonWorld (NewtonWorld* world, dList<NewtonBody*>& loadedBodies)
{
// Load the Physics scene
for (dTreeNode* node = GetFirstNode (); node; node = GetNextNode (node)) {
dNodeInfo* const info = GetInfoFromNode(node);
if (info->GetTypeId() == dRigidbodyNodeInfo::GetRttiType()) {
dRigidbodyNodeInfo* const bodyData = (dRigidbodyNodeInfo*) info;
NewtonBody* const rigidBody = bodyData->CreateNewtonBody(world, this, node);
loadedBodies.Append(rigidBody);
}
}
}
struct dSceneNodeCollisionPair
{
dScene::dTreeNode* m_mesh;
dScene::dTreeNode* m_collision;
};
void dScene::NewtonWorldToScene (const NewtonWorld* const world)
{
// search for all collision mesh and create make a dictionary
dTree<dSceneNodeCollisionPair, NewtonCollision*> dictionary;
dScene::dTreeNode* materialNode = CreateMaterialNode (GetRootNode(), 0);
for (NewtonBody* body = NewtonWorldGetFirstBody(world); body; body = NewtonWorldGetNextBody(world, body)) {
NewtonCollision* collision = NewtonBodyGetCollision(body);
dTree<dSceneNodeCollisionPair, NewtonCollision*>::dTreeNode* node = dictionary.Find(collision);
if (!node) {
NewtonMesh* const mesh = NewtonMeshCreateFromCollision(collision);
dScene::dTreeNode* const meshNode = CreateMeshNode(GetRootNode());
AddReference(meshNode, materialNode);
dMeshNodeInfo* const info = (dMeshNodeInfo*)GetInfoFromNode(meshNode);
info->ReplaceMesh (mesh);
NewtonCollisionInfoRecord collsionRecord;
NewtonCollisionGetInfo(collision, &collsionRecord);
// extract the offset matrix form the collision
dMatrix& offsetMatrix = *((dMatrix*)&collsionRecord.m_offsetMatrix[0][0]);
info->BakeTransform (offsetMatrix.Inverse());
info->SetPivotMatrix(offsetMatrix * info->GetPivotMatrix());
dScene::dTreeNode* collisionNode = CreateCollisionFromNewtonCollision(GetRootNode(), collision);
dSceneNodeCollisionPair pair;
pair.m_mesh = meshNode;
pair.m_collision = collisionNode;
node = dictionary.Insert(pair, collision);
}
// add a visual mesh
dSceneNodeCollisionPair& info = node->GetInfo();
dScene::dTreeNode* const sceneNode = CreateSceneNode(GetRootNode());
dSceneNodeInfo* const sceneInfo = (dSceneNodeInfo*) GetInfoFromNode(sceneNode);
dMatrix matrix;
NewtonBodyGetMatrix(body, &matrix[0][0]);
sceneInfo->SetTransform(matrix);
AddReference(sceneNode, info.m_mesh);
// add a rigid body
dScene::dTreeNode* const sceneBody = CreateRigidbodyNode(sceneNode);
AddReference(sceneBody, info.m_collision);
dRigidbodyNodeInfo* const bodyInfo = (dRigidbodyNodeInfo*) GetInfoFromNode(sceneBody);
dVector com;
NewtonBodyGetCentreOfMass(body, &com[0]);
bodyInfo->SetCenterOfMass(com);
dVector massMatrix;
NewtonBodyGetMassMatrix(body, &massMatrix.m_w, &massMatrix.m_x, &massMatrix.m_y, &massMatrix.m_z);
bodyInfo->SetMassMatrix(massMatrix);
dVector veloc;
NewtonBodyGetVelocity(body, &veloc[0]);
bodyInfo->SetVelocity(veloc);
dVector omega;
NewtonBodyGetOmega(body, &omega[0]);
bodyInfo->SetOmega(omega);
dVariable* var = bodyInfo->CreateVariable ("rigidBodyType");
var->SetValue("default gravity");
}
void* nextPtr = NULL;
for (void* ptr = GetFirstChild (GetRootNode()); ptr; ptr = nextPtr) {
nextPtr = GetNextChild(GetRootNode(), ptr);
dScene::dTreeNode* const node = GetNodeFromLink(ptr);
dNodeInfo* const info = GetInfoFromNode(node);
if ((info->IsType(dMeshNodeInfo::GetRttiType())) || (info->IsType(dCollisionNodeInfo::GetRttiType()))) {
RemoveReference(node, GetRootNode());
}
}
RemoveReference(materialNode, GetRootNode());
} | [
"[email protected]@b7a2f1d6-d59d-a8fe-1e9e-8d4888b32692"
] | [
[
[
1,
815
]
]
] |
5116025d1645649c64385ee1ec80a1d9e9e9f60b | 6630a81baef8700f48314901e2d39141334a10b7 | /1.4/Testing/Cxx/swWxGuiTesting/swCRWindowHierarchyHandler.h | 65da6d9e2df478fb45bfafcc90490988e81afd51 | [] | no_license | jralls/wxGuiTesting | a1c0bed0b0f5f541cc600a3821def561386e461e | 6b6e59e42cfe5b1ac9bca02fbc996148053c5699 | refs/heads/master | 2021-01-10T19:50:36.388929 | 2009-03-24T20:22:11 | 2009-03-26T18:51:24 | 623,722 | 1 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 4,292 | h | ///////////////////////////////////////////////////////////////////////////////
// Name: swWxGuiTesting/swCRWindowHierarchyHandler.h
// Author: Reinhold Füreder
// Created: 2004
// Copyright: (c) 2005 Reinhold Füreder
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef SWCRWINDOWHIERARCHYHANDLER_H
#define SWCRWINDOWHIERARCHYHANDLER_H
#ifdef __GNUG__
#pragma interface "swCRWindowHierarchyHandler.h"
#endif
#include "Common.h"
#include <map>
namespace sw {
class ConfigInterface;
}
namespace swTst {
class CRXRCNode;
class CRXRCResource;
/*! \class CRWindowHierarchyHandler
\brief Handles queries about window hierarchy allowing to uniquely
symbolically identify controls for C&R (Singleton pattern).
*/
class CRWindowHierarchyHandler
{
public:
/*! \fn static CRWindowHierarchyHandler * GetInstance ()
\brief Get single private instance (Singleton pattern).
\return single private instance
*/
static CRWindowHierarchyHandler * GetInstance ();
/*! \fn static void Destroy ()
\brief Threadsafe destruction of static singleton instance.
*/
static void Destroy ();
/*! \fn virtual wxString FindContainerName (wxWindow *window, bool isUnknownCtrl = false)
\brief Find name of container holding given window.
\param window window to find container name for
\param isUnknownCtrl must be set to true for handling unknown/foreign
controls
\return name of first container being holding given window
*/
virtual wxString FindContainerName (wxWindow *window,
bool isUnknownCtrl = false);
/*! \fn virtual CRXRCNode * FindXRCNode (wxWindow *window, bool isUnknownCtrl = false)
\brief Find window specific XRC node in read-in XRC files.
\param window window to find XRC node for
\param isUnknownCtrl must be set to true for handling unknown/foreign
controls
\return XRC node in read-in XRC files
*/
virtual CRXRCNode * FindXRCNode (wxWindow *window,
bool isUnknownCtrl = false);
/*! \fn virtual CRXRCNode * FindContainerXRCNode (wxWindow *window, bool isUnknownCtrl = false)
\brief Find XRC node of container holding given window.
\param window window to find container XRC node for
\param isUnknownCtrl must be set to true for handling unknown/foreign
controls
\return container XRC node in read-in XRC files
*/
virtual CRXRCNode * FindContainerXRCNode (wxWindow *window,
bool isUnknownCtrl = false);
protected:
/*! \fn CRWindowHierarchyHandler ()
\brief Constructor
*/
CRWindowHierarchyHandler ();
/*! \fn virtual ~CRWindowHierarchyHandler ()
\brief Destructor
*/
virtual ~CRWindowHierarchyHandler ();
/*! \fn virtual void ParseXRC ()
\brief Read-in XRC files from resource directory identified with global Config.
*/
virtual void ParseXRC ();
/*! \fn virtual CRXRCNode * FindXRCNode (CRXRCNode *parent, wxWindow *window, bool isUnknownCtrl = false)
\brief Find window specific XRC node as child of given parent.
\param parent parent XRC node to start search
\param window window to find XRC node for
\param isUnknownCtrl must be set to true for handling unknown/foreign
controls
\return XRC node in read-in XRC files
*/
virtual CRXRCNode * FindXRCNode (CRXRCNode *parent, wxWindow *window,
bool isUnknownCtrl = false);
private:
static CRWindowHierarchyHandler *ms_instance;
CRXRCResource *m_xrcResource;
sw::ConfigInterface *m_configCached;
wxString m_resDirCached;
typedef std::map< wxString, wxString > ContainerMap;
ContainerMap m_contMap;
private:
// No copy and assignment constructor:
CRWindowHierarchyHandler (const CRWindowHierarchyHandler &rhs);
CRWindowHierarchyHandler & operator= (const CRWindowHierarchyHandler &rhs);
};
} // End namespace swTst
#endif // SWCRWINDOWHIERARCHYHANDLER_H
| [
"john@64288482-8357-404e-ad65-de92a562ee98"
] | [
[
[
1,
136
]
]
] |
9a3fdbb414d27b10091adad53199584b5b9d796f | 6629f18d84dc8d5a310b95fedbf5be178b00da92 | /SDK-2008-05-27/foobar2000/SDK/dsp.h | 4817a10a40278faf1cc9bb68a29af1d4f44ac82a | [] | no_license | thenfour/WMircP | 317f7b36526ebf8061753469b10f164838a0a045 | ad6f4d1599fade2ae4e25656a95211e1ca70db31 | refs/heads/master | 2021-01-01T17:42:20.670266 | 2008-07-11T03:10:48 | 2008-07-11T03:10:48 | 16,931,152 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,408 | h | class NOVTABLE dsp_chunk_list {
public:
virtual t_size get_count() const = 0;
virtual audio_chunk * get_item(t_size n) const = 0;
virtual void remove_by_idx(t_size idx) = 0;
virtual void remove_mask(const bit_array & mask) = 0;
virtual audio_chunk * insert_item(t_size idx,t_size hint_size=0) = 0;
audio_chunk * add_item(t_size hint_size=0) {return insert_item(get_count(),hint_size);}
void remove_all() {remove_mask(bit_array_true());}
double get_duration() {
double rv = 0;
t_size n,m = get_count();
for(n=0;n<m;n++) rv += get_item(n)->get_duration();
return rv;
}
void add_chunk(const audio_chunk * chunk) {
audio_chunk * dst = insert_item(get_count(),chunk->get_data_length());
if (dst) dst->copy(*chunk);
}
void remove_bad_chunks();
protected:
dsp_chunk_list() {}
~dsp_chunk_list() {}
};
class dsp_chunk_list_impl : public dsp_chunk_list//implementation
{
pfc::list_t<pfc::rcptr_t<audio_chunk> > m_data, m_recycled;
public:
t_size get_count() const;
audio_chunk * get_item(t_size n) const;
void remove_by_idx(t_size idx);
void remove_mask(const bit_array & mask);
audio_chunk * insert_item(t_size idx,t_size hint_size=0);
};
//! Instance of a DSP.\n
//! Implementation: Derive from dsp_impl_base instead of deriving from dsp directly.\n
//! Instantiation: Use dsp_entry static helper methods to instantiate DSPs, or dsp_chain_config / dsp_manager to deal with entire DSP chains.
class NOVTABLE dsp : public service_base {
public:
enum {
//! Flush whatever you need to when tracks change.
END_OF_TRACK = 1,
//! Flush everything.
FLUSH = 2
};
//! @param p_chunk_list List of chunks to process. The implementation may alter the list in any way, inserting chunks of different sample rate / channel configuration etc.
//! @param p_cur_file Optional, location of currently decoded file. May be null.
//! @param p_flags Flags. Can be null, or a combination of END_OF_TRACK and FLUSH constants.
virtual void run(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags)=0;
//! Flushes the DSP (reinitializes / drops any buffered data). Called after seeking, etc.
virtual void flush() = 0;
//! Retrieves amount of data buffered by the DSP, for syncing visualisation.
//! @returns Amount of buffered audio data, in seconds.
virtual double get_latency() = 0;
//! Returns true if DSP needs to know exact track change point (eg. for crossfading, removing silence).\n
//! Signaling this will force-flush any DSPs placed before this DSP so when it gets END_OF_TRACK, relevant chunks contain last samples of the track.\n
//! Signaling this will often break regular gapless playback so don't use it unless you have reasons to.
virtual bool need_track_change_mark() = 0;
void run_abortable(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort);
FB2K_MAKE_SERVICE_INTERFACE(dsp,service_base);
};
//! Backwards-compatible extension to dsp interface, allows abortable operation. Introduced in 0.9.2.
class NOVTABLE dsp_v2 : public dsp {
public:
//! Abortable version of dsp::run(). See dsp::run() for descriptions of parameters.
virtual void run_v2(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) = 0;
private:
void run(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags) {
run_v2(p_chunk_list,p_cur_file,p_flags,abort_callback_impl());
}
FB2K_MAKE_SERVICE_INTERFACE(dsp_v2,dsp);
};
//! Helper class for implementing dsps. You should derive from dsp_impl_base instead of from dsp directly.\n
//! The dsp_impl_base_t template allows you to use a custom interface class as a base class for your implementation, in case you provide extended functionality.\n
//! Use dsp_factory_t<> template to register your dsp implementation.
//! The implementation - as required by dsp_factory_t<> template - must also provide following methods:\n
//! A constructor taking const dsp_preset&, initializing the DSP with specified preset data.\n
//! static void g_get_name(pfc::string_base &); - retrieving human-readable name of the DSP to display.\n
//! static bool g_get_default_preset(dsp_preset &); - retrieving default preset for this DSP. Return value is reserved for future use and should always be true.\n
//! static GUID g_get_guid(); - retrieving GUID of your DSP implementation, to be used to identify it when storing DSP chain configuration.\n
//! static bool g_have_config_popup(); - retrieving whether your DSP implementation supplies a popup dialog for configuring it.\n
//! static void g_show_config_popup(const dsp_preset & p_data,HWND p_parent, dsp_preset_edit_callback & p_callback); - displaying your DSP's settings dialog; called only when g_have_config_popup() returns true; call p_callback.on_preset_changed() whenever user has made adjustments to the preset data.\n
template<class t_baseclass>
class dsp_impl_base_t : public t_baseclass {
private:
typedef dsp_impl_base_t<t_baseclass> t_self;
dsp_chunk_list * m_list;
t_size m_chunk_ptr;
metadb_handle* m_cur_file;
void run_v2(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort);
protected:
bool get_cur_file(metadb_handle_ptr & p_out) {p_out = m_cur_file; return p_out.is_valid();}// call only from on_chunk / on_endoftrack (on_endoftrack will give info on track being finished); may return null !!
dsp_impl_base_t() : m_list(NULL), m_cur_file(NULL), m_chunk_ptr(0) {}
audio_chunk * insert_chunk(t_size p_hint_size = 0) //call only from on_endoftrack / on_endofplayback / on_chunk
{//hint_size - optional, amout of buffer space you want to use
PFC_ASSERT(m_list != NULL);
return m_list->insert_item(m_chunk_ptr++,p_hint_size);
}
//! To be overridden by a DSP implementation.\n
//! Called on track change. You can use insert_chunk() to dump any data you have to flush. \n
//! Note that you must implement need_track_change_mark() to return true if you need this method called.
virtual void on_endoftrack(abort_callback & p_abort) = 0;
//! To be overridden by a DSP implementation.\n
//! Called at the end of played stream, typically at the end of last played track, to allow the DSP to return all data it has buffered-ahead.\n
//! Use insert_chunk() to return any data you have buffered.\n
//! Note that this call does not imply that the DSP will be destroyed next. \n
//! This is also called on track changes if some DSP placed after your DSP requests track change marks.
virtual void on_endofplayback(abort_callback & p_abort) = 0;
//! To be overridden by a DSP implementation.\n
//! Processes a chunk of audio data.\n
//! You can call insert_chunk() from inside on_chunk() to insert any audio data before currently processed chunk.\n
//! @param p_chunk Current chunk being processed. You can alter it in any way you like.
//! @returns True to keep p_chunk (with alterations made inside on_chunk()) in the stream, false to remove it.
virtual bool on_chunk(audio_chunk * p_chunk,abort_callback & p_abort) = 0;
public:
//! To be overridden by a DSP implementation.\n
//! Flushes the DSP (reinitializes / drops any buffered data). Called after seeking, etc.
virtual void flush() = 0;
//! To be overridden by a DSP implementation.\n
//! Retrieves amount of data buffered by the DSP, for syncing visualisation.
//! @returns Amount of buffered audio data, in seconds.
virtual double get_latency() = 0;
//! To be overridden by a DSP implementation.\n
//! Returns true if DSP needs to know exact track change point (eg. for crossfading, removing silence).\n
//! Signaling this will force-flush any DSPs placed before this DSP so when it gets on_endoftrack(), relevant chunks contain last samples of the track.\n
//! Signaling this may interfere with gapless playback in certain scenarios (forces flush of DSPs placed before you) so don't use it unless you have reasons to.
virtual bool need_track_change_mark() = 0;
private:
dsp_impl_base_t(const t_self&) {throw pfc::exception_bug_check_v2();}
const t_self & operator=(const t_self &) {throw pfc::exception_bug_check_v2();}
};
template<class t_baseclass>
void dsp_impl_base_t<t_baseclass>::run_v2(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) {
pfc::vartoggle_t<dsp_chunk_list*> l_list_toggle(m_list,p_list);
pfc::vartoggle_t<metadb_handle*> l_cur_file_toggle(m_cur_file,p_cur_file.get_ptr());
for(m_chunk_ptr = 0;m_chunk_ptr<m_list->get_count();m_chunk_ptr++) {
audio_chunk * c = m_list->get_item(m_chunk_ptr);
if (c->is_empty() || !on_chunk(c,p_abort))
m_list->remove_by_idx(m_chunk_ptr--);
}
if (p_flags & FLUSH) {
on_endofplayback(p_abort);
} else if (p_flags & END_OF_TRACK) {
if (need_track_change_mark()) on_endoftrack(p_abort);
}
}
typedef dsp_impl_base_t<dsp_v2> dsp_impl_base;
class NOVTABLE dsp_preset {
public:
virtual GUID get_owner() const = 0;
virtual void set_owner(const GUID & p_owner) = 0;
virtual const void * get_data() const = 0;
virtual t_size get_data_size() const = 0;
virtual void set_data(const void * p_data,t_size p_data_size) = 0;
virtual void set_data_from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort) = 0;
const dsp_preset & operator=(const dsp_preset & p_source) {copy(p_source); return *this;}
void copy(const dsp_preset & p_source) {set_owner(p_source.get_owner());set_data(p_source.get_data(),p_source.get_data_size());}
void contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const;
void contents_from_stream(stream_reader * p_stream,abort_callback & p_abort);
static void g_contents_from_stream_skip(stream_reader * p_stream,abort_callback & p_abort);
bool operator==(const dsp_preset & p_other) const {
if (get_owner() != p_other.get_owner()) return false;
if (get_data_size() != p_other.get_data_size()) return false;
if (memcmp(get_data(),p_other.get_data(),get_data_size()) != 0) return false;
return true;
}
bool operator!=(const dsp_preset & p_other) const {
return !(*this == p_other);
}
protected:
dsp_preset() {}
~dsp_preset() {}
};
class dsp_preset_writer : public stream_writer {
public:
void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
p_abort.check();
m_data.append_fromptr((const t_uint8 *) p_buffer,p_bytes);
}
void flush(dsp_preset & p_preset) {
p_preset.set_data(m_data.get_ptr(),m_data.get_size());
m_data.set_size(0);
}
private:
pfc::array_t<t_uint8,pfc::alloc_fast_aggressive> m_data;
};
class dsp_preset_reader : public stream_reader {
public:
dsp_preset_reader() : m_walk(0) {}
dsp_preset_reader(const dsp_preset_reader & p_source) : m_walk(0) {*this = p_source;}
void init(const dsp_preset & p_preset) {
m_data.set_data_fromptr( (const t_uint8*) p_preset.get_data(), p_preset.get_data_size() );
m_walk = 0;
}
t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
p_abort.check();
t_size todo = pfc::min_t<t_size>(p_bytes,m_data.get_size()-m_walk);
memcpy(p_buffer,m_data.get_ptr()+m_walk,todo);
m_walk += todo;
return todo;
}
bool is_finished() {return m_walk == m_data.get_size();}
private:
t_size m_walk;
pfc::array_t<t_uint8> m_data;
};
class dsp_preset_impl : public dsp_preset
{
public:
dsp_preset_impl() {}
dsp_preset_impl(const dsp_preset_impl & p_source) {copy(p_source);}
dsp_preset_impl(const dsp_preset & p_source) {copy(p_source);}
const dsp_preset_impl& operator=(const dsp_preset_impl & p_source) {copy(p_source); return *this;}
const dsp_preset_impl& operator=(const dsp_preset & p_source) {copy(p_source); return *this;}
GUID get_owner() const {return m_owner;}
void set_owner(const GUID & p_owner) {m_owner = p_owner;}
const void * get_data() const {return m_data.get_ptr();}
t_size get_data_size() const {return m_data.get_size();}
void set_data(const void * p_data,t_size p_data_size) {m_data.set_data_fromptr((const t_uint8*)p_data,p_data_size);}
void set_data_from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort);
private:
GUID m_owner;
pfc::array_t<t_uint8> m_data;
};
class NOVTABLE dsp_preset_edit_callback {
public:
virtual void on_preset_changed(const dsp_preset &) = 0;
private:
dsp_preset_edit_callback(const dsp_preset_edit_callback&) {throw pfc::exception_not_implemented();}
const dsp_preset_edit_callback & operator=(const dsp_preset_edit_callback &) {throw pfc::exception_not_implemented();}
protected:
dsp_preset_edit_callback() {}
~dsp_preset_edit_callback() {}
};
class NOVTABLE dsp_entry : public service_base {
public:
virtual void get_name(pfc::string_base & p_out) = 0;
virtual bool get_default_preset(dsp_preset & p_out) = 0;
virtual bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) = 0;
virtual GUID get_guid() = 0;
virtual bool have_config_popup() = 0;
virtual bool show_config_popup(dsp_preset & p_data,HWND p_parent) = 0;
static bool g_get_interface(service_ptr_t<dsp_entry> & p_out,const GUID & p_guid);
static bool g_instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset);
static bool g_instantiate_default(service_ptr_t<dsp> & p_out,const GUID & p_guid);
static bool g_name_from_guid(pfc::string_base & p_out,const GUID & p_guid);
static bool g_dsp_exists(const GUID & p_guid);
static bool g_get_default_preset(dsp_preset & p_out,const GUID & p_guid);
static bool g_have_config_popup(const GUID & p_guid);
static bool g_have_config_popup(const dsp_preset & p_preset);
static bool g_show_config_popup(dsp_preset & p_preset,HWND p_parent);
static void g_show_config_popup_v2(const dsp_preset & p_preset,HWND p_parent,dsp_preset_edit_callback & p_callback);
FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(dsp_entry);
};
class NOVTABLE dsp_entry_v2 : public dsp_entry {
public:
virtual void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) = 0;
private:
bool show_config_popup(dsp_preset & p_data,HWND p_parent);
FB2K_MAKE_SERVICE_INTERFACE(dsp_entry_v2,dsp_entry);
};
template<class T,class t_entry = dsp_entry>
class dsp_entry_impl_nopreset_t : public t_entry {
public:
void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
bool get_default_preset(dsp_preset & p_out)
{
p_out.set_owner(T::g_get_guid());
p_out.set_data(0,0);
return true;
}
bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset)
{
if (p_preset.get_owner() == T::g_get_guid() && p_preset.get_data_size() == 0)
{
p_out = new service_impl_t<T>();
return p_out.is_valid();
}
else return false;
}
GUID get_guid() {return T::g_get_guid();}
bool have_config_popup() {return false;}
bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return false;}
};
template<class T, class t_entry = dsp_entry_v2>
class dsp_entry_impl_t : public t_entry {
public:
void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
bool get_default_preset(dsp_preset & p_out) {return T::g_get_default_preset(p_out);}
bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) {
if (p_preset.get_owner() == T::g_get_guid()) {
p_out = new service_impl_t<T>(p_preset);
return true;
}
else return false;
}
GUID get_guid() {return T::g_get_guid();}
bool have_config_popup() {return T::g_have_config_popup();}
bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return T::g_show_config_popup(p_data,p_parent);}
//void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) {T::g_show_config_popup(p_data,p_parent,p_callback);}
};
template<class T, class t_entry = dsp_entry_v2>
class dsp_entry_v2_impl_t : public t_entry {
public:
void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
bool get_default_preset(dsp_preset & p_out) {return T::g_get_default_preset(p_out);}
bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) {
if (p_preset.get_owner() == T::g_get_guid()) {
p_out = new service_impl_t<T>(p_preset);
return true;
}
else return false;
}
GUID get_guid() {return T::g_get_guid();}
bool have_config_popup() {return T::g_have_config_popup();}
//bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return T::g_show_config_popup(p_data,p_parent);}
void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) {T::g_show_config_popup(p_data,p_parent,p_callback);}
};
template<class T>
class dsp_factory_nopreset_t : public service_factory_single_t<dsp_entry_impl_nopreset_t<T> > {};
template<class T>
class dsp_factory_t : public service_factory_single_t<dsp_entry_v2_impl_t<T> > {};
class NOVTABLE dsp_chain_config
{
public:
virtual t_size get_count() const = 0;
virtual const dsp_preset & get_item(t_size p_index) const = 0;
virtual void replace_item(const dsp_preset & p_data,t_size p_index) = 0;
virtual void insert_item(const dsp_preset & p_data,t_size p_index) = 0;
virtual void remove_mask(const bit_array & p_mask) = 0;
void remove_item(t_size p_index);
void remove_all();
void add_item(const dsp_preset & p_data);
void copy(const dsp_chain_config & p_source);
const dsp_chain_config & operator=(const dsp_chain_config & p_source) {copy(p_source); return *this;}
void contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const;
void contents_from_stream(stream_reader * p_stream,abort_callback & p_abort);
void instantiate(service_list_t<dsp> & p_out);
void get_name_list(pfc::string_base & p_out) const;
};
class dsp_chain_config_impl : public dsp_chain_config
{
public:
dsp_chain_config_impl() {}
dsp_chain_config_impl(const dsp_chain_config & p_source) {copy(p_source);}
dsp_chain_config_impl(const dsp_chain_config_impl & p_source) {copy(p_source);}
t_size get_count() const;
const dsp_preset & get_item(t_size p_index) const;
void replace_item(const dsp_preset & p_data,t_size p_index);
void insert_item(const dsp_preset & p_data,t_size p_index);
void remove_mask(const bit_array & p_mask);
const dsp_chain_config_impl & operator=(const dsp_chain_config & p_source) {copy(p_source); return *this;}
const dsp_chain_config_impl & operator=(const dsp_chain_config_impl & p_source) {copy(p_source); return *this;}
~dsp_chain_config_impl();
private:
pfc::ptr_list_t<dsp_preset_impl> m_data;
};
class cfg_dsp_chain_config : public cfg_var {
protected:
void get_data_raw(stream_writer * p_stream,abort_callback & p_abort);
void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort);
public:
void reset();
inline cfg_dsp_chain_config(const GUID & p_guid) : cfg_var(p_guid) {}
t_size get_count() const {return m_data.get_count();}
const dsp_preset & get_item(t_size p_index) const {return m_data.get_item(p_index);}
bool get_data(dsp_chain_config & p_data) const;
void set_data(const dsp_chain_config & p_data);
private:
dsp_chain_config_impl m_data;
};
| [
"carl@72871cd9-16e1-0310-933f-800000000000"
] | [
[
[
1,
435
]
]
] |
a035adeca9ad340608d2489c1fbe49e1c52c574f | 81e6d1e17c9c4aa3ab98ab84b61d4d4de3e6803b | /NetUsbDemo4VC6/NetUsbDemo4VC6Dlg.cpp | 853247289a8b86e4f55e8bbdfcd1613c7a72773c | [] | no_license | robomotic/NorduinoUsb-Adapter-C8051 | 762464a8e2c1a46837795a8adda1685283ce20b6 | 9c954528d7579d903141249d0e6f3b46352b8b4e | refs/heads/master | 2016-08-07T02:13:48.745726 | 2011-03-16T13:26:31 | 2011-03-16T13:26:31 | 1,487,188 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 13,374 | cpp | // NetUsbDemo4VC6Dlg.cpp : implementation file
//
/* This file is part of NetUsbDemo.
NetUsbDemo 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.
NetUsbDemo 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
Editors: Paolo & Elio @ www.norduino.com
*/
#include "stdafx.h"
#include "NetUsbDemo4VC6.h"
#include "NetUsbDemo4VC6Dlg.h"
#include "netusb.h"
#include "dbt.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// CNetusbDemo4VCDlg dialog
#define RCV_MSG (WM_USER + 0x0800)
extern HWND hwnd=NULL;
static void __stdcall TheCallbackFunc(unsigned char* buf, size_t n)
{
// this post the message in the text area
// buf contains the payload and n is the payload length
PostMessage(hwnd,RCV_MSG,(WPARAM)buf,(LPARAM)(n) );
}
/////////////////////////////////////////////////////////////////////////////
// CNetUsbDemo4VC6Dlg dialog
CNetUsbDemo4VC6Dlg::CNetUsbDemo4VC6Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CNetUsbDemo4VC6Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNetUsbDemo4VC6Dlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CNetUsbDemo4VC6Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNetUsbDemo4VC6Dlg)
DDX_Control(pDX, IDC_BUTTON_TX2, m_btntx2);
DDX_Control(pDX, IDC_BUTTON_TX1, m_btntx1);
DDX_Control(pDX, IDC_BUTTON_RX2, m_btnrx2);
DDX_Control(pDX, IDC_BUTTON_RX1, m_btnrx1);
DDX_Control(pDX, IDC_BUTTON_LINK, m_btnlink);
DDX_Control(pDX, IDC_BUTTON_FRE2, m_btnfre2);
DDX_Control(pDX, IDC_BUTTON_FRE1, m_btnfre1);
DDX_Control(pDX, IDC_BUTTON_CLR, m_btnclr);
DDX_Control(pDX, IDC_STATIC_Text, m_status);
DDX_Control(pDX, IDC_BUTTON_LED2, m_led2);
DDX_Control(pDX, IDC_BUTTON_LED1, m_led1);
DDX_Control(pDX, IDC_LIST_RECI, m_RecivedData);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNetUsbDemo4VC6Dlg, CDialog)
//{{AFX_MSG_MAP(CNetUsbDemo4VC6Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_BUTTON_LED1, OnBnClickedBtnLed1)
ON_BN_CLICKED(IDC_BUTTON_LED2, OnBnClickedBtnLed2)
ON_BN_CLICKED(IDC_BUTTON_LINK, OnBnClickedBtnLink)
ON_BN_CLICKED(IDC_BUTTON_CLR, OnBnClickedBtnClr)
ON_BN_CLICKED(IDC_BUTTON_TX1, OnButtonTx1)
ON_BN_CLICKED(IDC_BUTTON_TX2, OnButtonTx2)
ON_BN_CLICKED(IDC_BUTTON_RX1, OnButtonRx1)
ON_BN_CLICKED(IDC_BUTTON_RX2, OnButtonRx2)
ON_BN_CLICKED(IDC_BUTTON_FRE1, OnButtonFre1)
ON_BN_CLICKED(IDC_BUTTON_FRE2, OnButtonFre2)
//}}AFX_MSG_MAP
ON_MESSAGE(RCV_MSG, OnNewMsg)
ON_WM_DEVICECHANGE()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNetUsbDemo4VC6Dlg message handlers
BOOL CNetUsbDemo4VC6Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
DisableLedButton();
NetusbRegisterNotification(GetSafeHwnd());
hwnd=GetSafeHwnd();
return TRUE; // return TRUE unless you set the focus to a control
}
void CNetUsbDemo4VC6Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CNetUsbDemo4VC6Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CNetUsbDemo4VC6Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
/********************************************************/
//May be some of variables need change its name,
//for this version is not critically the same with version of VC7
/********************************************************/
void CNetUsbDemo4VC6Dlg::AttemptConnection(void)
{
if (m_IsConnected ==true)
{
MessageBox(_T("Already connected!"));
return;
}
DWORD results;
// Check for connected devices
results = NetusbGetNumDevices(VID_NETUSB, PID_NETUSB24L01);
// Only proceed if 1 device is found
if (results ==1)
{
// Open connection to device
results = NetusbOpen(0,VID_NETUSB, PID_NETUSB24L01);
// If device connection not established, output failure
if (results != HID_DEVICE_SUCCESS)
{
MessageBox(_T("Error in connecting to device."));
}
else
{
m_IsConnected = true;
//m_nTimer =SetTimer (1,10,NULL); // Create timer to be used to
EnableLedButton();
//HID_RX_THREAD = CreateThread (NULL,NULL,InterruptThreadProc,this,0,0);
}
}
else
{
MessageBox(_T("No device found."));
}
}
/*******************************************************/
/*
CButton m_btntx2;
CButton m_btntx1;
CButton m_btnrx2;
CButton m_btnrx1;
CButton m_btnlink;
CButton m_btnfre2;
CButton m_btnfre1;
CButton m_btnclr;
CStatic m_status;
CButton m_led2;
CButton m_led1;
CListBox m_RecivedData;
*/
/*******************************************************/
void CNetUsbDemo4VC6Dlg::EnableLedButton()
{
m_btnfre1.EnableWindow(true);
m_btnfre2.EnableWindow(true);
m_btntx1.EnableWindow(true);
m_btntx2.EnableWindow(true);
m_btnrx1.EnableWindow(true);
m_btnrx2.EnableWindow(true);
m_led1.EnableWindow(true);
m_led2.EnableWindow(true);
m_status.SetWindowText(_T("Already connected!"));
//m_nTimer =SetTimer(1,200,0);
m_IsConnected = true ;
NetusbSetCallback(TheCallbackFunc);
NetusbStartListen();
}
void CNetUsbDemo4VC6Dlg::DisableLedButton()
{
m_btnfre1.EnableWindow(false);
m_btnfre2.EnableWindow(false);
m_btntx1.EnableWindow(false);
m_btntx2.EnableWindow(false);
m_btnrx1.EnableWindow(false);
m_btnrx2.EnableWindow(false);
m_led1.EnableWindow(false);
m_led2.EnableWindow(false);
m_status.SetWindowText(_T("Disconnect"));
m_IsConnected = false;
NetusbStopListen();
//KillTimer(m_nTimer);
}
BOOL CNetUsbDemo4VC6Dlg::OnDeviceChange(UINT nEventType, DWORD dwData)
{
DWORD results;
switch(nEventType)
{
// A device has been inserted and is now available.
case DBT_DEVICEARRIVAL:
AttemptConnection();
break;
// A device has been removed from USB.
case DBT_DEVICEREMOVECOMPLETE:
// Check for devices
results = NetusbGetNumDevices(VID_NETUSB, PID_NETUSB24L01);
if (results == 0)
{
// Close device if found
//RXthreadmaycontinue =false;
Sleep(10);
DisableLedButton();
NetusbClose();
//HID_RX_THREAD =NULL;
}
break;
default:
break;
}
return TRUE;
}
void CNetUsbDemo4VC6Dlg::AddRecievedData(CString NewData)
{
m_RecivedData.AddString( NewData );
// display only last 100 messages recieved
if(m_RecivedData.GetCount()>100) {
m_RecivedData.DeleteString(0);
}
// Set Focus on Last Element
int nCount = m_RecivedData.GetCount();
if (nCount > 0) m_RecivedData.SetCurSel(nCount-1);
}
static DWORD WINAPI InterruptThreadProc(LPVOID lpParameter)
{
CNetUsbDemo4VC6Dlg* dlg;
dlg = (CNetUsbDemo4VC6Dlg*)lpParameter;
BYTE reportbuffer[255];
DWORD status;
BYTE byteReceved;
dlg->RXthreadmaycontinue = TRUE; // Variable will be cleared whenever
// device is disconnected
while (dlg->RXthreadmaycontinue == TRUE)
{
// Attempt to retrieve a report
status = NetusbGetData(reportbuffer,&byteReceved);
// If a report has been recieved, call the callback routine
// to process the data stored in reportbuffer
if (status == HID_DEVICE_SUCCESS)
{
dlg->HIDcallback (reportbuffer);
}
else
{
Sleep(5);
}
}
return 1;
}
void CNetUsbDemo4VC6Dlg::HIDcallback (BYTE* reportbuffer)
{
if(reportbuffer[1]==1)
{
AddRecievedData(_T("Button1 has been pressed"));
}
if(reportbuffer[2]==1)
{
AddRecievedData(_T("Button2 has been pressed"));
}
}
void CNetUsbDemo4VC6Dlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
NetusbUnregisterNotification();
NetusbClose();
CDialog::OnClose();
}
LRESULT CNetUsbDemo4VC6Dlg::OnNewMsg (WPARAM wParam, LPARAM lParam)
{
BYTE* reportbuffer =(BYTE* )wParam;
/*
if(reportbuffer[1]==1)
{
AddRecievedData(_T("Button1 has been pressed"));
}
if(reportbuffer[2]==1)
{
AddRecievedData(_T("Button2 has been pressed"));
}
*/
char temp[128] = "";
char temp2[128] = "";
ULONG i;
//ULONG j;
PUCHAR ptr;
unsigned char* buf=(unsigned char*)wParam;
ptr = (PUCHAR) (buf);
unsigned length=(size_t)32;
for(i=1;i<length;++i)
{
wsprintf(temp2,"%02X ",*ptr++);
strcat(temp,temp2);
}
AddRecievedData(temp);
UpdateData(FALSE);
return 0;
}
void CNetUsbDemo4VC6Dlg::OnBnClickedBtnLed1()
{
// TODO: Add your control notification handler code here
unsigned char buf[32];
memset(buf,0,32);
//buf[0]=0xaa;
buf[30]=1;
buf[31]=0;
// for(int i=0;i<32;i++)
// {
// buf[i]=1;
// }
buf[1]=1;
buf[2]=0;
DWORD r =NetusbSendData(buf,32);
}
void CNetUsbDemo4VC6Dlg::OnBnClickedBtnLed2()
{
// TODO: Add your control notification handler code here
unsigned char buf[32];
memset(buf,0,32);
buf[30]=0;
buf[31]=1;
buf[1]=0;
buf[2]=1;
NetusbSendData(buf,32);
}
void CNetUsbDemo4VC6Dlg::OnBnClickedBtnLink()
{
// TODO: Add your control notification handler code here
AttemptConnection();
}
void CNetUsbDemo4VC6Dlg::OnBnClickedBtnClr()
{
// TODO: Add your control notification handler code here
while(m_RecivedData.GetCount()>0) {
m_RecivedData.DeleteString(0);
}
}
void CNetUsbDemo4VC6Dlg::OnButtonTx1()
{
// TODO: Add your control notification handler code here
NetusbSetTxaddr(0x34,0x43,0x10,0x10);
}
void CNetUsbDemo4VC6Dlg::OnButtonTx2()
{
// TODO: Add your control notification handler code here
NetusbSetTxaddr(0XCC,0XCC,0XCC,0XCC);
}
void CNetUsbDemo4VC6Dlg::OnButtonRx1()
{
// TODO: Add your control notification handler code here
NetusbSetRxaddr(0x34,0x43,0x10,0x10);
}
void CNetUsbDemo4VC6Dlg::OnButtonRx2()
{
// TODO: Add your control notification handler code here
NetusbSetRxaddr(0XCC,0XCC,0XCC,0XCC);
}
void CNetUsbDemo4VC6Dlg::OnButtonFre1()
{
// TODO: Add your control notification handler code here
NetusbSetFrequence(1); //433
}
void CNetUsbDemo4VC6Dlg::OnButtonFre2()
{
// TODO: Add your control notification handler code here
NetusbSetFrequence(8); //433
}
| [
"[email protected]"
] | [
[
[
1,
557
]
]
] |
3735accb367db80aed573a04d8d62ffd6622e373 | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/nGENE Proj/JointCylinder.h | 4d06bfd8efdf7d7ac7b042facfefa7c5347b39f3 | [] | no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,125 | h | /*
---------------------------------------------------------------------------
This source file is part of nGENE Tech.
Copyright (c) 2006- Wojciech Toman
This program is free software.
File: JointCylinder.h
Version: 0.01
---------------------------------------------------------------------------
*/
#pragma once
#ifndef __INC_JOINTCYLINDER_H_
#define __INC_JOINTCYLINDER_H_
#include "Joint.h"
#include "JointFactory.h"
namespace nGENE
{
/** Cylindrical joint.
@remarks
It is a "sliding" joint.
*/
class nGENEDLL JointCylinder: public Joint
{
EXPOSE_TYPE
private:
/// PhysX box descriptor
NxCylindricalJointDesc* m_pCylinderDesc;
public:
JointCylinder(NxScene* _scene, SJointDesc& _desc);
virtual ~JointCylinder();
void init();
void cleanup();
NxJointDesc* getJointDesc();
};
/// Factory to be used for creating spherical joints.
class nGENEDLL JointCylinderFactory: public JointFactory
{
public:
JointCylinderFactory();
~JointCylinderFactory();
Joint* createJoint(NxScene* _scene, JOINT_DESC& _desc);
};
}
#endif | [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
] | [
[
[
1,
58
]
]
] |
abd48cacb3a0adc0063bed67dde5f640f030e88c | 6dac9369d44799e368d866638433fbd17873dcf7 | /src/branches/01032005/graphics/opengl/OGLTexture.cpp | 085945a6a1ce2936eb72cca9c538d5312b75fd6a | [] | 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 | 3,209 | cpp | #include <OGLTexture.h>
#include <OpenGL12.h>
OGLTexture::OGLTexture(int width, int height, int numcomp, std::string filename)
{
m_tbid = -1;
m_width = width;
m_height = height;
m_numcomp = numcomp;
SetFilename(filename);
}
OGLTexture::~OGLTexture()
{
DeleteTexture();
}
/** Sets the filename of the texture
*
* @param filename The filename of the texture
*/
void OGLTexture::SetFilename(std::string filename)
{
m_filename = filename;
}
/** Creates the opengl texture object
*
* @param buffer The buffer containing the texture image data
*
* Operation:
* -# Generate an opengl texture
* -# Enable GL_TEXTURE_2D
* -# Load the buffer containing the 32bit image data into an opengl texture object (This is not the same as a Fusion Texture object)
* -# Sets some standard texture parameters, 2D Texture, Min filter is linear, Max filter is linear
*/
void OGLTexture::CreateTexture(unsigned char *buffer)
{
// Create The Texture
glGenTextures(1, (GLuint*)&m_tbid);
glEnable(GL_TEXTURE_2D);
// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, m_tbid);
// Explanation of:
// GL_RGB+(m_numcomp-3)
//
// since m_numcomp will be 3 or 4, depending on whether you want RGB or RGBA if you subtract 3 from the number of components
// you'll get a 0 or 1 value, add this to GL_BGR and you get the required opengl identifier for the texture you are creating
glTexImage2D(GL_TEXTURE_2D,0,m_numcomp,m_width,m_height,0,GL_RGB+(m_numcomp-3),GL_UNSIGNED_BYTE,buffer);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
/** Deletes the opengl texture object
*
* Operation:
* -# Test whether the texture is valid (there is a texture object to delete)
* -# If so, make the tbid (texture buffer id) into an array, opengl
* requires an array of texture id's, rather than one texture id at a time
* -# Call opengl to delete the texture object
* -# Reset the tbid to -1
*/
void OGLTexture::DeleteTexture(void)
{
if(m_tbid != -1){
const unsigned int t[1] = {m_tbid};
glDeleteTextures(1,t);
m_tbid = -1;
}
}
/** Sets the texture to current rendering source
*
* This tells opengl to use this texture when rendering any texturemaps
*/
void OGLTexture::Set(void)
{
glBindTexture(GL_TEXTURE_2D, m_tbid);
}
/** Reload the image
*
* @returns The texture buffer ID of this object
*
* This attempts to reload the image from the file, if for example, the opengl texture object was lost
*/
int OGLTexture::Reload(void)
{
return UpdateTexture();
}
/** Retrieves the dimensions of the file
*
* @param x The width of the image
* @param y The height of the image
*/
void OGLTexture::GetDimensions(int &x, int &y)
{
x = m_width;
y = m_height;
}
/** Retrieves the width of the texture
*
* @returns The width of the texture
*/
int OGLTexture::GetWidth(void)
{
return m_width;
}
/** Retrieves the height of the texture
*
* @returns The height of the texture
*/
int OGLTexture::GetHeight(void)
{
return m_height;
}
| [
"chris_a_thomas@1bf15c89-c11e-0410-aefd-b6ca7aeaabe7"
] | [
[
[
1,
124
]
]
] |
b383af6fc3c05ac87b14622ccc97c9bb0bc637d2 | 222bc22cb0330b694d2c3b0f4b866d726fd29c72 | /src/brookbox/wm2/WmlIntrLin3Tor3.h | 8e647ad5f4d260c29eb1fd9757ae40507985257f | [
"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 | 916 | h | // Magic Software, Inc.
// http://www.magic-software.com
// http://www.wild-magic.com
// Copyright (c) 2003. All Rights Reserved
//
// The Wild Magic Library (WML) source code is supplied under the terms of
// the license agreement http://www.magic-software.com/License/WildMagic.pdf
// and may not be copied or disclosed except in accordance with the terms of
// that agreement.
#ifndef WMLINTRLIN3TOR3_H
#define WMLINTRLIN3TOR3_H
#include "WmlRay3.h"
#include "WmlTorus3.h"
namespace Wml
{
// The ray is p*dir+eye, p >= 0. The intersection is determined by
// p^4+c3*p^3+c2*p^2+c1*p+c0 = 0. The direction is assumed to be towards
// the object from the observer so that the minimum p solution gives the
// nearest intersection.
template <class Real>
WML_ITEM bool FindIntersection (const Ray3<Real>& rkRay,
const Torus3<Real>& rkTorus, Real& rfS, Real& rfT);
}
#endif
| [
"[email protected]"
] | [
[
[
1,
31
]
]
] |
32815a0684d27228018213fed912be6a4555addd | 2aff7486e6c7afdbda48b7a5f424b257d47199df | /src/Camera/CameraSource_old.h | 66439de71c742f8d74770af40a89cfe7bbd15c63 | [] | no_license | offlinehacker/LDI_test | 46111c60985d735c00ea768bdd3553de48ba2ced | 7b77d3261ee657819bae3262e3ad78793b636622 | refs/heads/master | 2021-01-10T20:44:55.324019 | 2011-08-17T16:41:43 | 2011-08-17T16:41:43 | 2,220,496 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,387 | h | #ifndef __CAMERASOURCEH__
#define __CAMERASOURCEH__
#include "highgui.h"
#include "cv.h"
#include "cvaux.h"
#include "cxcore.h"
#include "CyclicBuffer.h"//Za zapisovanje video podatkov
#include "RecordVideo.h"
#define WIN32_LARRY
#define LAST_FRAMES_COUNT 100
#define CAMERA_SOURCE_TYPE_CAM 0
#define CAMERA_SOURCE_TYPE_VIDEO 1
//Glavni class za video source
class CameraSource//Predstavlja doloceno kamero in ne vec kamer
{
protected:
CyclicImageBuffer *LastFrames;//Sem se shranjujejo zadnji prebrani frejmi, v primeru ce video ustavimo
char CameraSourceType;
int Width;
int Height;
int Fps;
int Depth;
int Channels;
public:
bool opened;
CameraSource( int LastFramesCount );
~CameraSource();
virtual void OpenVideoSoruce(){}
virtual void CloseVideoSource(){}
virtual void PauseVideo(){}
virtual IplImage *GetFrame(){ return NULL; }//Dobi naslednji frame in tega obenem shrani v spomin
virtual IplImage *GetLastFrame();//Dobi zadnji ze prebrani frame
virtual int GetWidth(){ if(opened) return Width; }
virtual int GetHeight(){ if(opened) return Height; }
virtual int GetDepth(){ if(opened) return Depth; }
virtual int GetChannels(){ if(opened) return Channels; }
virtual int GetFps(){ if(opened) return Fps; }
};
#define MAX_CV_CAMERAS 20
class CameraSourceVideo: public CameraSource//Dela preko opencv metod za kamere
{
private:
struct CvCapture *CameraCapture;
int cam_id;//id kamere iz katere pobiramo video
bool pause;
public:
bool flip;
bool swap_rgb;
public:
void OpenVideoSoruce();
void CloseVideoSource();
void Pause();
IplImage *GetFrame();//Dobi naslednji frame in tega obenem shrani v spomin
//IplImage *GetLastFrame();//Dobi zadnji ze prebrani frame
void SetCamId( int id );
int GetCamId();
void SetCameraCapture( CvCapture* lCameraCapture );
void ExportVideoToFile( char* filename );
~CameraSourceVideo();
CameraSourceVideo( int LastFramesCount );
};
CameraSourceVideo **RetriveCVCameras();//Dobi "handlerje" za vse OpenCv kamere
void DestroyCVCameras( CameraSourceVideo** lCameraSourceVideo );//Klice delte na vse "handlerje"
class CameraSourceAVI: public CameraSource
{
private:
char* filename;
public:
/*void OpenVideoSource();
void CloseVideoSource();
void Pause();
IplImage *GetFrame();
IplImage *GetLastFrame();*/
};
#endif | [
"[email protected]"
] | [
[
[
1,
89
]
]
] |
6619f745d22ab73cde597bb271cb70e3d03a8b31 | 741b36f4ddf392c4459d777930bc55b966c2111a | /incubator/happylib/HappyLib/LWPRender.cpp | fba0b9ef4650a56ff917f14d9c94bb5c6e1fffe1 | [] | no_license | BackupTheBerlios/lwpp-svn | d2e905641f60a7c9ca296d29169c70762f5a9281 | fd6f80cbba14209d4ca639f291b1a28a0ed5404d | refs/heads/master | 2021-01-17T17:01:31.802187 | 2005-10-16T22:12:52 | 2005-10-16T22:12:52 | 40,805,554 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,280 | cpp |
#include "LWPRender.h"
#include "LWPScene.h"
int LWPRender::callBackUsers = 0;
// acquisitions
LWBoneInfo * LWPRender::boneInfo = 0;
LWCameraInfo * LWPRender::cameraInfo = 0;
LWGlobalPool * LWPRender::globalPool = 0;
LWItemInfo * LWPRender::itemInfo = 0;
LWLightInfo * LWPRender::lightInfo = 0;
LWObjectInfo * LWPRender::objectInfo = 0;
LWPSysFuncs * LWPRender::particleFuncs = 0;
LWCommandFunc LWPRender::commandFunc = 0;
// transients
LWBackdropInfo * LWPRender::backdropInfo = 0;
LWCompInfo * LWPRender::compInfo = 0;
LWFogInfo * LWPRender::fogInfo = 0;
LWInterfaceInfo * LWPRender::interfaceInfo = 0;
LWSceneInfo * LWPRender::sceneInfo = 0;
LWTimeInfo * LWPRender::timeInfo = 0;
//// LWPRender implementation ////
#ifdef LW6
Queue<LWPRender::LightPos> LWPRender::LightPosQ;
#endif
Matrix4X4 LWPRender::TransW2S;
XCALL_(void) LWPRender::Destroy(void * inst)
{
delete (LWPRender *)inst;
freeCallBacks();
}
XCALL_(LWError) LWPRender::Copy(void * to, void * from)
{
return ((LWPRender *)to)->copy((LWPRender *)from);
}
XCALL_(LWError) LWPRender::Load(void * inst, LWLoadState const * ls)
{
return ((LWPRender *)inst)->load((LWPLoadState const*)ls);
}
XCALL_(LWError) LWPRender::Save(void * inst, LWSaveState const * ss)
{
return ((LWPRender *)inst)->save((LWPSaveState const*)ss);
}
XCALL_(char const *) LWPRender::DescLn(void * inst)
{
return ((LWPRender *)inst)->descLn();
}
XCALL_(LWError) LWPRender::Init(void * inst, int mode)
{
return ((LWPRender *)inst)->init(mode);
}
XCALL_(void) LWPRender::CleanUp(void * inst)
{
((LWPRender *)inst)->cleanUp();
}
XCALL_(LWError) LWPRender::NewTime(void * inst, LWFrame f, LWTime t)
{
// get transients each NewTime
if (!(backdropInfo = (LWBackdropInfo *)globalFunc(LWBACKDROPINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Backdrop Info";
if (!(compInfo = (LWCompInfo *)globalFunc(LWCOMPINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Compositing Info";
if (!(fogInfo = (LWFogInfo *)globalFunc(LWFOGINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Fog Info";
if (!(sceneInfo = (LWSceneInfo *)globalFunc(LWSCENEINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Scene Info";
if (!(timeInfo = (LWTimeInfo *)globalFunc(LWTIMEINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Time Info";
if (!systemIsScreamerNet)
{
if (!(interfaceInfo = (LWInterfaceInfo *)globalFunc(LWINTERFACEINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Interface Info";
}
#ifdef LW6
// read light positions [NOTE] to work around wPosition bug in LW
LightPosQ.clear();
for (LWPLight l = LWPLight::first(); l; l = l.next())
{
Point v;
l.param(LWIP_W_POSITION, t, v);
LightPosQ << LightPos(l, v);
}
#endif
// get world to screen matrix
TransW2S = LWPCamera::renderCamera().w2sMatrix(t);
return ((LWPRender *)inst)->newTime(f, t);
}
XCALL_(const LWItemID *) LWPRender::UseItems(void * inst)
{
return ((LWPRender *)inst)->useItems();
}
XCALL_(void) LWPRender::ChangeID(void * inst, LWItemID const * ids)
{
((LWPRender *)inst)->changeID(ids);
}
void LWPRender::QuietlyGetTransients()
{
// get transients and don't complain if any failed (for layout-modeler plugins)
backdropInfo = (LWBackdropInfo *)globalFunc(LWBACKDROPINFO_GLOBAL, GFUSE_TRANSIENT);
compInfo = (LWCompInfo *)globalFunc(LWCOMPINFO_GLOBAL, GFUSE_TRANSIENT);
fogInfo = (LWFogInfo *)globalFunc(LWFOGINFO_GLOBAL, GFUSE_TRANSIENT);
sceneInfo = (LWSceneInfo *)globalFunc(LWSCENEINFO_GLOBAL, GFUSE_TRANSIENT);
timeInfo = (LWTimeInfo *)globalFunc(LWTIMEINFO_GLOBAL, GFUSE_TRANSIENT);
if (!systemIsScreamerNet) interfaceInfo = (LWInterfaceInfo *)globalFunc(LWINTERFACEINFO_GLOBAL, GFUSE_TRANSIENT);
#ifdef LW6
// read light positions [NOTE] to work around wPosition bug in LW
LightPosQ.clear();
for (LWPLight l = LWPLight::first(); l; l = l.next())
{
Point v;
l.param(LWIP_W_POSITION, timeInfo->time, v);
LightPosQ << LightPos(l, v);
}
#endif
}
// [FIXME] make this pretty
LWCompInfo ModelerCompInfo = { 0, 0, 0 };
LWTimeInfo ModelerTimeInfo = { 0.0, 0 };
LWError LWPRender::getCallBacks()
{
LWError err = LWPPlugin::getCallBacks();
if (err) return err;
// transients
if (systemIsModeler) // fake transients for modeler
{
//backdropInfo = (LWBackdropInfo *); [FIXME]
compInfo = &ModelerCompInfo;
//fogInfo = (LWFogInfo *); [FIXME]
//sceneInfo = (LWSceneInfo *); [FIXME]
timeInfo = &ModelerTimeInfo;
return 0; // don't try getting render-specifics in Modeler
}
if (!(backdropInfo = (LWBackdropInfo *)globalFunc(LWBACKDROPINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Backdrop Info";
if (!(compInfo = (LWCompInfo *)globalFunc(LWCOMPINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Compositing Info";
if (!(fogInfo = (LWFogInfo *)globalFunc(LWFOGINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Fog Info";
if (!(sceneInfo = (LWSceneInfo *)globalFunc(LWSCENEINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Scene Info";
if (!(timeInfo = (LWTimeInfo *)globalFunc(LWTIMEINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Time Info";
// non-screamy transients
if (!systemIsScreamerNet)
{
if (!(interfaceInfo = (LWInterfaceInfo *)globalFunc(LWINTERFACEINFO_GLOBAL, GFUSE_TRANSIENT)))
return "Couldn't get Interface Info";
}
// acquisitions
if (callBackUsers ++) return 0; // already got them
if (!(boneInfo = (LWBoneInfo *)globalFunc(LWBONEINFO_GLOBAL, GFUSE_ACQUIRE)))
return "Couldn't get Bone Info";
if (!(cameraInfo = (LWCameraInfo *)globalFunc(LWCAMERAINFO_GLOBAL, GFUSE_ACQUIRE)))
return "Couldn't get Camera Info";
if (!(globalPool = (LWGlobalPool *)globalFunc(LWGLOBALPOOL_GLOBAL, GFUSE_ACQUIRE)))
return "Couldn't get Global Pool";
if (!(itemInfo = (LWItemInfo *)globalFunc(LWITEMINFO_GLOBAL, GFUSE_ACQUIRE)))
return "Couldn't get Item Info";
if (!(lightInfo = (LWLightInfo *)globalFunc(LWLIGHTINFO_GLOBAL, GFUSE_ACQUIRE)))
return "Couldn't get Light Info";
if (!(objectInfo = (LWObjectInfo *)globalFunc(LWOBJECTINFO_GLOBAL, GFUSE_ACQUIRE)))
return "Couldn't get Object Info";
if (!(particleFuncs = (LWPSysFuncs *)globalFunc(LWPSYSFUNCS_GLOBAL, GFUSE_ACQUIRE)))
return "Couldn't get Particle Functions";
// non-screamy acquisitions
if (!systemIsScreamerNet)
{
if (!(commandFunc = (LWCommandFunc)globalFunc("LW Command Interface", GFUSE_ACQUIRE)))
return "Couldn't get LW Command Interface";
}
return 0;
}
void LWPRender::freeCallBacks()
{
LWPPlugin::freeCallBacks();
if (systemIsModeler) return; // don't try freeing render-specifics in Modeler
if (-- callBackUsers) return; // still need them
globalFunc(LWBONEINFO_GLOBAL, GFUSE_RELEASE);
globalFunc(LWCAMERAINFO_GLOBAL, GFUSE_RELEASE);
globalFunc(LWGLOBALPOOL_GLOBAL, GFUSE_RELEASE);
globalFunc(LWITEMINFO_GLOBAL, GFUSE_RELEASE);
globalFunc(LWOBJECTINFO_GLOBAL, GFUSE_RELEASE);
globalFunc(LWPSYSFUNCS_GLOBAL, GFUSE_RELEASE);
if (systemIsScreamerNet) return;
globalFunc("LW Command Interface", GFUSE_RELEASE);
}
// default virtuals
LWError LWPRender::load(LWPLoadState const * ls) { return serialization.load(ls); }
LWError LWPRender::save(LWPSaveState const * ss) const { return serialization.save(ss); }
LWError LWPRender::copy(LWPRender const * r) { return serialization.copy(r->serialization); }
char const * LWPRender::descLn() const
{
sprintf(desc, name());
return desc;
}
LWError LWPRender::init(int) { return 0; }
void LWPRender::cleanUp() {}
LWError LWPRender::newTime(LWFrame, LWTime) { return 0; }
LWItemID const * LWPRender::useItems() const
{
// return an array of items we depend on
static LWItemID id[1] = { 0 };
return id;
}
void LWPRender::changeID(LWItemID const * id)
{
// re-id any references to LWItems using the given array.
// This would look something like the following in your object:
/* [EXAMPLE]
for (int i = 0; id[i]; i += 2)
{
if (some_member == id[i]) some_member = id[i + 1];
if (some_other_member == id[i]) some_other_member = id[i + 1];
...
}
*/
}
| [
"lightwolf@dac1304f-7ce9-0310-a59f-f2d444f72a61"
] | [
[
[
1,
280
]
]
] |
99bdc28ff46ddc60309ea2da3d17717e343d4e16 | 3761dcce2ce81abcbe6d421d8729af568d158209 | /include/cybergarage/upnp/device/ST.h | e1783e214b98a9c6806e949a5b9e52837ec05d1a | [
"BSD-3-Clause"
] | permissive | claymeng/CyberLink4CC | af424e7ca8529b62e049db71733be91df94bf4e7 | a1a830b7f4caaeafd5c2db44ad78fbb5b9f304b2 | refs/heads/master | 2021-01-17T07:51:48.231737 | 2011-04-08T15:10:49 | 2011-04-08T15:10:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 852 | h | /******************************************************************
*
* CyberLink for C++
*
* Copyright (C) Satoshi Konno 2002-2003
*
* File: ST.h
*
* Revision;
*
* 07/08/03
* - first revision
*
******************************************************************/
#ifndef _CLINK_ST_H_
#define _CLINK_ST_H_
#include <sstream>
namespace CyberLink {
namespace ST {
const char ALL_DEVICE[] = "ssdp:all";
const char ROOT_DEVICE[] = "upnp:rootdevice";
const char UUID_DEVICE[] = "uuid";
const char URN_DEVICE[] = "urn:schemas-upnp-org:device:";
const char URN_SERVICE[] = "urn:schemas-upnp-org:service:";
bool IsAllDevice(const char *value);
bool IsRootDevice(const char *value);
bool IsUUIDDevice(const char *value);
bool IsURNDevice(const char *value);
bool IsURNService(const char *value);
}
}
#endif
| [
"skonno@b944b01c-6696-4570-ab44-a0e08c11cb0e"
] | [
[
[
1,
43
]
]
] |
f0bc8ed56a1c3eb09918dd57946c0d6842d528b9 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/boost_1_34_1/boost_1_34_1/libs/serialization/test/test_list.cpp | fc8ab20c86790907164c51d2384522c08596bb50 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | willrebuild/flyffsf | e5911fb412221e00a20a6867fd00c55afca593c7 | d38cc11790480d617b38bb5fc50729d676aef80d | refs/heads/master | 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,151 | cpp | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_list.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// should pass compilation and execution
#include <fstream>
#include <cstdio> // remove
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::remove;
}
#endif
#include <boost/archive/archive_exception.hpp>
#include "test_tools.hpp"
#include <boost/preprocessor/stringize.hpp>
#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
#include <boost/serialization/list.hpp>
#ifdef BOOST_HAS_SLIST
#include <boost/serialization/slist.hpp>
#endif
#include "A.hpp"
int test_main( int /* argc */, char* /* argv */[] )
{
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A> alist;
alist.push_back(A());
alist.push_back(A());
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os);
oa << boost::serialization::make_nvp("alist",alist);
}
std::list<A> alist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is);
ia >> boost::serialization::make_nvp("alist",alist1);
}
BOOST_CHECK(alist == alist1);
#ifdef BOOST_HAS_SLIST
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist;
aslist.push_front(A());
aslist.push_front(A());
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os);
oa << boost::serialization::make_nvp("aslist", aslist);
}
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist1;{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is);
ia >> boost::serialization::make_nvp("aslist", aslist1);
}
BOOST_CHECK(aslist == aslist1);
#endif
std::remove(testfile);
return EXIT_SUCCESS;
}
// EOF
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
] | [
[
[
1,
77
]
]
] |
Subsets and Splits