本文整理汇总了C++中Sign类的典型用法代码示例。如果您正苦于以下问题:C++ Sign类的具体用法?C++ Sign怎么用?C++ Sign使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sign类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLaterByIndex
std::string SignFactory::getLaterByIndex(int inx)
{
SignMap::iterator iter = m_SignMap.find(inx);
Sign* pSign = iter->second;
std::string latter = pSign->getLatter();
return latter;
}
示例2: run
void RandomScroll::run(Sign &sign, uint8_t layer){
sign.textChanged = true;
char random_char = char(' ' + random8(95) );
sign.pushChar(random_char);
sign.setCharacters();
}
示例3: UpdateAllSignVirtCoords
/** Update the coordinates of all signs */
void UpdateAllSignVirtCoords()
{
Sign *si;
FOR_ALL_SIGNS(si) {
si->UpdateVirtCoord();
}
}
示例4: Sign
Sign* Sign::create(cocos2d::Vec2* points, int nbrPoints, std::string spriteFile)
{
Sign * node = new Sign();
if (node) {
node->init(points, nbrPoints, spriteFile);
node->autorelease();
return node;
}
CC_SAFE_DELETE(node);
return NULL;
}
示例5: run
void RandomLetters::run(Sign &sign, EffectData &data, uint8_t layer){
sign.textChanged = true;
uint8_t letters_count = sign.letterCount();
char random_char;
for(uint8_t i=0; i < letters_count; i++){
random_char = ' ' + random(95);
sign.letter(i) -> setChar(random_char);
}
}
示例6: assert
RETCODE World::EntityLoad_Sign(hQBSP qbsp, const EntityParse & entityDat)
{
hTXT txt;
int r,g,b,a;
//create new sign
Sign *newObj = new Sign; assert(newObj);
///////////////////////////////////////////////////////
//load up the common stuff
EntityLoad_CommonObject(qbsp, entityDat, dynamic_cast<Object *>(newObj));
const char *pStr;
///////////////////////////////////////////////////////
//load image
pStr = entityDat.GetVal("image");
if(pStr)
{
string imgPath = GAMEFOLDER;
imgPath += "\\";
imgPath += pStr;
txt = TextureCreate(0, imgPath.c_str(), false, 0);
}
///////////////////////////////////////////////////////
//get color
pStr = entityDat.GetVal("color");
if(pStr)
{
sscanf(pStr, "%d %d %d %d", &r,&g,&b,&a);
}
if(txt)
{
float sX = (SCRN_W/2) - (TextureGetWidth(txt)/2);
float sY = (SCRN_H/2) - (TextureGetHeight(txt)/2);
float eX = sX + TextureGetWidth(txt);
float eY = sY + TextureGetHeight(txt);
sX /= SCRN_W; sY /= SCRN_H;
eX /= SCRN_W; eY /= SCRN_H;
newObj->SetImageDisplay(ImageDisplayAdd(txt, sX,sY,eX,eY, r,g,b,a));
TextureDestroy(&txt);
}
return RETCODE_SUCCESS;
}
示例7: run
void WavePixels::run(Sign &sign, EffectData &data, uint8_t ci){
uint16_t angle = (millis() % cycleTime[ci])*UINT16_MAX/cycleTime[ci];
int16_t delta_hue = hueA[ci] * sin16(angle)/UINT16_MAX;
uint16_t seg_count = sign.segmentCount();
bool on = (ci == 0);
for(uint8_t i=0; i < seg_count; i++){
Segment *curr_seg = sign.segments[i];
if(curr_seg -> isOn == on){
curr_seg -> setColor(color[ci]);
delta_hue = -delta_hue;
int16_t hue_add = delta_hue;
uint8_t pixel_count = curr_seg -> pixelCount();
for(uint8_t j = 0; j < pixel_count; j++ ){
Pixel *currPixel = curr_seg -> pixels[j];
currPixel -> addHue16(hue_add);
hue_add += delta_hue;
}
}
}
}
示例8: main
int main (int argc, char * argv[])
{
QApplication app(argc,argv);
Signfactory sf;
Sign *s = sf.createSign("/");
s->setA(1);s->setB(0);
try{
qDebug()<<s->getResult();
}
catch(...)
{}
delete s;
#ifdef use_origin
std::shared_ptr<caculate> c(new caculate);
#else
QSharedPointer<caculate> c(new caculate);
#endif
c->show();
return app.exec();
}
示例9: run
void RainbowSegment::run(Sign &sign, uint8_t layer){
if( sign.textChanged ){ this -> signWasUpdated(sign);}
uint8_t segment_count = sign.segmentCount();
CHSV curr_color = color[layer];
if(changeOnBeat && sign.onBeat){
color[layer].hue += beatStep[layer];
}
for(uint8_t i=0; i<segment_count; i++){
Segment* curr_segment = sign.segments[i];
curr_segment -> setColor(layer, curr_color);
curr_color.hue += hueStep[layer];
}
}
示例10: run
void Scrolling::run(Sign &sign, EffectData &data, uint8_t layer){
if(beatIdx++ % numBeats > 0){ return;}
sign.textChanged = true;
char word[4];
if(randomLetterIdx >= 0){
this->setRandomLetter(word);
}else{
for(uint8_t i=0; i< LETTERS_COUNT; i++){
uint8_t idx = (beatIdx+i) % charCount;
word[i] = buffer[idx];
}
}
sign.setWord( String( word ) );
}
示例11:
inline
UnitVector3d
operator*(Sign sign, const UnitVector3d& unitVector) {
return UnitVector3d(sign.value() * unitVector.components());
}
示例12: sprintf
//invoke only once
void SignFactory::fillSignMap()
{
int soundType = SIGN_SOUND_DEFAULT;
//latters
for(int i=0;i<LETTERS_LENGTH;i++)
{
char stringSignName[20] = { 0 };
sprintf(stringSignName,"%s%d.png",LatterfileNameByRez.c_str(), i);
Sign* pSign = Sign::create(stringSignName);
pSign->setAnchorPoint(Vec2(0.0,0.0));
//char ch = m_LatersStr[i-1];
std::string latter = pUT->int_to_string(i);
pSign->setLatterInx((i));
pSign->setLatter(latter);
pSign->setTag(sign_tags::LETTER_SIGH);
if(soundType == IS_FALSE)
{
char stringSignSoundName[50] = { 0 };
sprintf(stringSignSoundName,"%s/%s%d.mp3",lang_sound.c_str(),
sLetterfileSounds_fnt_to_slc.c_str(),
i);
//std::string stringSignSoundName ="x";
std::string stdstringSignSoundName(stringSignSoundName);
pSign->setFontToSolutionSound(stdstringSignSoundName);
pSign->setSolutionToFontSound(core::Settings::getInstance()->getSoundManager()
.soundEffectClick_FromSolutionToFont);
//delete stringSignSoundName;
}
else
{
pSign->setSolutionToFontSound(core::Settings::getInstance()->getSoundManager()
.soundEffectClick_FromSolutionToFont);
pSign->setFontToSolutionSound(core::Settings::getInstance()->getSoundManager()
.soundEffectClick_FromSolutionToFont);
}
pSign->retain();
m_SignMap.insert(std::pair<int, Sign*>((i),pSign));
//m_SignToNumMap.insert(std::pair<std::string,int>(latter,(i-1)));
}
//image container
Sign* pSignContainer = Sign::create(LatterContainerfileNameByRez);
pSignContainer->setAnchorPoint(Vec2(0.0,0.0));
pSignContainer->setLatterInx(sign_tags::CONTAINER_SIGH);
pSignContainer->retain();
m_SignMap.insert(std::pair<int, Sign*>(sign_tags::CONTAINER_SIGH,pSignContainer));
//line break
Sign* pSignLineBreak = Sign::create(LatterContainerfileNameByRez);
pSignLineBreak->setAnchorPoint(Vec2(0.0,0.0));
pSignLineBreak->setLatterInx(sign_tags::SEPERATOR_SIGH);
pSignLineBreak->retain();
m_SignMap.insert(std::pair<int, Sign*>(sign_tags::SEPERATOR_SIGH,pSignLineBreak));
//scalefactor
Sign* SignTest = getSign(1);
Size LatterOrigSize = SignTest->getBoundingBox().size;
// must be set first TODO fix this...
float winWidth = m_Parent->pFontSelectionContainer->visibleSize.width;
float locallatterScaleFactor = pUT->getScaleFactorBasedOnWinWidth(winWidth,LatterOrigSize);
setLatterScaleFactor(locallatterScaleFactor);
//SignTest->setScale(getLatterScaleFactor());
pUT->setSignScalefactor(SignTest);
setLatterScalledSize(SignTest->getBoundingBox().size);
}
示例13: CHECK_NOTNULL
void SymplecticRungeKuttaNyströmIntegrator<Position, order, time_reversible,
evaluations, composition>::Solve(
IntegrationProblem<ODE> const& problem,
Time const& step) const {
using Displacement = typename ODE::Displacement;
using Velocity = typename ODE::Velocity;
using Acceleration = typename ODE::Acceleration;
// Argument checks.
CHECK_NOTNULL(problem.initial_state);
int const dimension = problem.initial_state->positions.size();
CHECK_EQ(dimension, problem.initial_state->velocities.size());
CHECK_NE(Time(), step);
Sign const integration_direction = Sign(step);
if (integration_direction.Positive()) {
// Integrating forward.
CHECK_LT(problem.initial_state->time.value, problem.t_final);
} else {
// Integrating backward.
CHECK_GT(problem.initial_state->time.value, problem.t_final);
}
typename ODE::SystemState current_state = *problem.initial_state;
// Time step.
Time const& h = step;
Time const abs_h = integration_direction * h;
// Current time. This is a non-const reference whose purpose is to make the
// equations more readable.
DoublePrecision<Instant>& t = current_state.time;
// Position increment.
std::vector<Displacement> Δq(dimension);
// Velocity increment.
std::vector<Velocity> Δv(dimension);
// Current position. This is a non-const reference whose purpose is to make
// the equations more readable.
std::vector<DoublePrecision<Position>>& q = current_state.positions;
// Current velocity. This is a non-const reference whose purpose is to make
// the equations more readable.
std::vector<DoublePrecision<Velocity>>& v = current_state.velocities;
// Current Runge-Kutta-Nyström stage.
std::vector<Position> q_stage(dimension);
// Accelerations at the current stage.
std::vector<Acceleration> g(dimension);
// The first full stage of the step, i.e. the first stage where
// exp(bᵢ h B) exp(aᵢ h A) must be entirely computed.
// Always 0 in the non-FSAL kBA case, always 1 in the kABA case since b₀ = 0,
// means the first stage is only exp(a₀ h A), and 1 after the first step
// in the kBAB case, since the last right-hand-side evaluation can be used for
// exp(bᵢ h B).
int first_stage = composition == kABA ? 1 : 0;
while (abs_h <= Abs((problem.t_final - t.value) - t.error)) {
std::fill(Δq.begin(), Δq.end(), Displacement{});
std::fill(Δv.begin(), Δv.end(), Velocity{});
if (first_stage == 1) {
for (int k = 0; k < dimension; ++k) {
if (composition == kBAB) {
// exp(b₀ h B)
Δv[k] += h * b_[0] * g[k];
}
// exp(a₀ h A)
Δq[k] += h * a_[0] * (v[k].value + Δv[k]);
}
}
for (int i = first_stage; i < stages_; ++i) {
for (int k = 0; k < dimension; ++k) {
q_stage[k] = q[k].value + Δq[k];
}
problem.equation.compute_acceleration(t.value + c_[i] * h, q_stage, &g);
for (int k = 0; k < dimension; ++k) {
// exp(bᵢ h B)
Δv[k] += h * b_[i] * g[k];
// exp(aᵢ h A)
Δq[k] += h * a_[i] * (v[k].value + Δv[k]);
}
}
if (composition == kBAB) {
first_stage = 1;
}
// Increment the solution.
t.Increment(h);
for (int k = 0; k < dimension; ++k) {
q[k].Increment(Δq[k]);
v[k].Increment(Δv[k]);
}
problem.append_state(current_state);
}
}
示例14: mainCryptopp
//.........这里部分代码省略.........
printf("outdata(hex)=");
dump(outdata, outlen);
delete[] outdata;
}
// one time digest.
{
char * outdata = new char[sha1.getCipherLen(inlen)];
int outlen = sha1.digest(indata, inlen, outdata);
printf("outlen=%d\n", outlen);
printf("outdata(hex)=");
dump(outdata, outlen);
delete[] outdata;
}
// serval times
{
char * outdata = new char[sha1.getCipherLen(inlen)];
sha1.update(indata, 5);
sha1.update(indata+5, inlen-5);
int outlen = sha1.final(outdata);
printf("outlen=%d\n", outlen);
printf("outdata(hex)=");
dump(outdata, outlen);
delete[] outdata;
}
}
// RSA-SHA1 Sign testing.
{
printf("\n=======================RSA-SHA1 Sign=====================\n");
// key
// N factor in RSA, aslo called modulus.
const char * N = "90755611487566208138950675092879865387596685014726501531250157258482495478524769456222913843665634824684037468817980814231054856125127115894189385717148934026931120932481402379431731629550862846041784305274651476086892165805223719552575599962253392248079811268061946102234935422772131475340988882825043233323";
// e factor in RSA, aslo called public exponent.
const char * e = "65537";
// d factor in RSA, aslo called private exponent
const char * d = "17790520481266507102264359414044396762660094486842415203197747383916331528947124726552875080482359744765793816651732601742929364124685415229452844016482477236658413327331659722342187036963943428678684677279032263501011143882814728160215380051287503219732737197808611144507720521201393129692996926599975297921";
// input data.
const char * indata = "bsmith is a good guy.";
int inlen = (int)strlen(indata);
printf("inlen=%d\n", inlen);
printf("indata(hex)=");
dump(indata, inlen);
Sign sign;
// private key for signer.
sign.initPrivateKey(N, e, d);
// sign.
int maxoutlen = sign.getCipherLen(inlen);
printf("maxoutlen=%d\n", maxoutlen);
char * outdata = new char[maxoutlen];
int outlen = sign.sign(indata, inlen, outdata);
printf("outlen=%d\n", outlen);
printf("outdata(hex)=");
dump(outdata, outlen);
// public key for verifier.
sign.initPublicKey(N, e);
示例15: DebugString
inline std::string DebugString(Sign const& sign) {
return sign.Negative() ? "-" : "+";
}