MapilVoid D3DSprite::DrawTexture( SharedPointer < Texture > pTexture, const Matrix4x4 < MapilFloat32 >& mat, MapilUInt32 color ) { Assert( m_IsUsed, CURRENT_POSITION, TSTR( "The sprite isn't created yet." ), -1 ); D3DXMATRIXA16 matWorld; for( MapilInt32 i = 0; i < 4; ++i ) { for( MapilInt32 j = 0; j < 4; ++j ) { matWorld.m[ i ][ j ] = mat.m_Elm[ i ][ j ]; } } //World coordinate transformation m_pD3DSprite->SetTransform( &matWorld ); //Set range of drawing RECT rc; rc.top = 0; rc.bottom = pTexture->GetSize().m_Y; rc.left = 0; rc.right = pTexture->GetSize().m_X; //Draw if( FAILED( m_pD3DSprite->Draw( reinterpret_cast < LPDIRECT3DTEXTURE9 > ( pTexture.GetPointer()->Get() ), &rc, NULL, NULL, color ) ) ) { throw MapilException( CURRENT_POSITION, TSTR( "Failed to draw." ), -1 ); } }
bool VariableValue::equals(SharedPointer<IVariableValue> obj) { //SharedPointer<VariableValue> ptr = dynamic_pointer_cast<VariableValue>(obj); //return valueName.compare(ptr->valueName) == 0; assert (this->getVariableName() == obj->getVariableName()); return getIndex() == obj->getIndex(); }
void CGraphicsContext::InternalDrawTeardown(SharedPointer<IPipelineState> State) { SharedPointer<GL::CPipelineState> PipelineState = std::dynamic_pointer_cast<GL::CPipelineState>(State); if (PipelineState->DrawWireframe) { CheckedGLCall(glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)); } if (PipelineState->CullFront || PipelineState->CullBack) { CheckedGLCall(glDisable(GL_CULL_FACE)); CheckedGLCall(glCullFace(GL_BACK)); // Default value } if (PipelineState->DisableDepthTest) { CheckedGLCall(glEnable(GL_DEPTH_TEST)); } if (PipelineState->DisableDepthWrite) { CheckedGLCall(glDepthMask(GL_TRUE)); } if (PipelineState->BlendMode != EBlendMode::None) { CheckedGLCall(glDisable(GL_BLEND)); } int TextureIndex = 0; for (auto const & it : PipelineState->BoundTextures) { CheckedGLCall(glActiveTexture(GL_TEXTURE0 + TextureIndex++)); SharedPointer<CTexture const> Texture = std::dynamic_pointer_cast<CTexture const>(it.second); CheckedGLCall(glBindTexture(Texture->GetGLBindTextureTarget(), 0)); } CheckedGLCall(glBindVertexArray(0)); }
void Department::AddCourse(SharedPointer<Course> crs){ cvec.push_back(crs); cout << endl; cout << crs->GetCid() << " is added to " << name << " department" << endl; cout << endl; log.log("Course added to department: ", to_string((long long)crs->GetCid()), name); }
void ScenarioRenderer::loadGroundBasedComplexModel(ComplexModel &cm) { SharedPointer<istream> in = m_scnxArchive->getModelData(cm.getModelFile()); if (in.isValid()) { // Load model. OBJXArchive *objxArchive = NULL; if (cm.getModelFile().find(".objx") != string::npos) { objxArchive = OBJXArchiveFactory::getInstance().getOBJXArchive(*in); } else if (cm.getModelFile().find(".obj") != string::npos) { objxArchive = OBJXArchiveFactory::getInstance().getOBJXArchiveFromPlainOBJFile(*in); } if (objxArchive != NULL) { m_listOfLoadedOBJXArchives.push_back(objxArchive); vector<TriangleSet> listOfTriangleSets = objxArchive->getListOfTriangleSets(); if (listOfTriangleSets.size() > 0) { clog << "OBJ model successfully opened (containing " << listOfTriangleSets.size() << " sets of triangles)." << endl; clog << " Translation: " << cm.getPosition().toString() << endl; clog << " Rotation: " << cm.getRotation().toString() << endl; m_mapOfGroundBasedComplexModels[cm.toString()] = listOfTriangleSets; } else { clog << "OBJ model could not be opened." << endl; } } } }
/* * Class: bgcc_Transaction * Method: getCurrentTicketId * Signature: (Lbgcc/Protocol;ILjava/lang/String;)I */ JNIEXPORT jint JNICALL Java_bgcc_Transaction_getCurrentTicketId (JNIEnv *env, jobject transaction, jobject protocol, jint threadId, jstring fnName) { BGCC_TRACE("bgcc", "Transaction::getCurrentTicketId begin"); jclass transactionCls = env->GetObjectClass(transaction); jfieldID transactionAddressFid = env->GetFieldID(transactionCls, "transactionAddress", "J"); jclass protocolCls = env->GetObjectClass(protocol); jfieldID protocolAddressFid = env->GetFieldID(protocolCls, "protocolAddress", "J"); SharedPointer<IProtocol>* pProtocol = (SharedPointer<IProtocol>*)env->GetLongField(protocol, protocolAddressFid); if (!pProtocol || pProtocol->is_valid()) { BGCC_WARN("bgcc", "protocol is null"); return 0; } const char* pFnName = env->GetStringUTFChars(fnName, NULL); if (pFnName == NULL) { BGCC_WARN("bgcc", "Allocate fnName failed"); return 0; } Transaction* pTransaction = (Transaction*)env->GetLongField(transaction, transactionAddressFid); if (!pTransaction) { BGCC_WARN("bgcc", "transaction is null"); return 0; } int32_t ticketId = pTransaction->getCurrentTicketId(*pProtocol, (int32_t)threadId, pFnName); env->ReleaseStringUTFChars(fnName, pFnName); BGCC_TRACE("bgcc", "Transaction::getCurrentTicketId end\n"); return ticketId; }
MapilVoid GLSprite::DrawTexture( SharedPointer < Texture > pTexture ) { GLfloat texCoord[ 8 ] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f }; GLfloat vertexCoord[ 8 ] = { 0.0f, 0.0f, 0.0f, static_cast < MapilFloat32 > ( pTexture->GetSize().m_Y ), static_cast < MapilFloat32 > ( pTexture->GetSize().m_X ), static_cast < MapilFloat32 > ( pTexture->GetSize().m_Y ), static_cast < MapilFloat32 > ( pTexture->GetSize().m_X ), 0.0f }; glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); // When the different texture is set, calls glBindTexture. MapilBool isNewTexture = ( !( m_pPrevTexture.GetPointer() ) || m_pPrevTexture->Get() != pTexture->Get() ); if( isNewTexture ){ glBindTexture( GL_TEXTURE_2D, 0 ); m_pPrevTexture = pTexture; glBindTexture( GL_TEXTURE_2D, pTexture->Get() ); } glVertexPointer( 2, GL_FLOAT, 0, vertexCoord ); glTexCoordPointer( 2, GL_FLOAT, 0, texCoord ); glDrawArrays( GL_QUADS, 0, 4 ); }
int32_t ServiceManager::add_service(SharedPointer<IProcessor> processor) { BGCC_TRACE("bgcc", "ServiceManager::add_service"); std::string name; bool exist; if (processor.is_valid()) { name = processor->get_name(); } else { BGCC_NOTICE("bgcc", "Failed to add service, because param is NULL"); return -1; } Guard<Mutex> guard(&_mutex); if (!guard.is_locked()) { BGCC_WARN("bgcc", "Failed to lock mutex"); return -1; } exist = _name2service.find(name) != _name2service.end(); if (!exist) { std::pair<name2service_map::iterator, bool> v = _name2service.insert(std::make_pair(name, processor)); if (false == v.second) { return -1; } } return 0; }
//---------------------------------------------------------------------------------------------------- void UISearchTextField::drawClearMark (CDrawContext* context) const { if (getText ().empty ()) return; SharedPointer<CGraphicsPath> path = owned (context->createGraphicsPath ()); if (path == 0) return; CRect r = getClearMarkRect (); CColor color (fontColor); color.alpha /= 2; context->setFillColor (color); context->setDrawMode (kAntiAliasing); context->drawEllipse (r, kDrawFilled); double h,s,v; color.toHSV (h, s, v); v = 1. - v; color.fromHSV (h, s, v); context->setFrameColor (color); context->setLineWidth (2.); r.inset (r.getWidth () / (M_PI * 2.) + 1, r.getHeight () / (M_PI * 2.) + 1); path->beginSubpath (r.getTopLeft ()); path->addLine (r.getBottomRight ()); path->beginSubpath (r.getBottomLeft ()); path->addLine (r.getTopRight ()); context->setDrawMode (kAntiAliasing|kNonIntegralMode); context->drawGraphicsPath (path, CDrawContext::kPathStroked); }
bool QueryCursorImpl::GetNextBatchIfNeeded(IgniteError& err) { assert(iterCalled); if (endReached || (batch && batch->Left() > 0)) return true; endReached = !IteratorHasNext(err); if (endReached) return true; JniErrorInfo jniErr; SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory(); env.Get()->Context()->TargetOutStream( javaRef, OP_GET_BATCH, inMem.Get()->PointerLong(), &jniErr); IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); if (jniErr.code != IGNITE_JNI_ERR_SUCCESS) return false; delete batch; // Needed for exception safety. batch = 0; batch = new QueryBatch(*env.Get(), inMem); endReached = batch->IsEmpty(); return true; }
void EmitterFactory::CreateEmitterViaXML(const std::string& aName) { std::string name = WF::GetFileNameWithoutExtension(aName); SharedPointer<EmitterData> newEmitter = new EmitterData[1]; newEmitter->LoadFile(aName); myEmitterData.Insert(name, newEmitter); myEmitterDataNames.Add(name); }
//----------------------------------------------------------------------------- CBitmap::CBitmap (const CResourceDescription& desc) : resourceDesc (desc) { SharedPointer<IPlatformBitmap> platformBitmap = owned (IPlatformBitmap::create ()); if (platformBitmap && platformBitmap->load (desc)) { bitmaps.push_back (platformBitmap); } }
TransformGroup* GroundBasedComplexModelLoader::getGroundBasedComplexModels(const SCNXArchive &scnxArchive) const { TransformGroup *complexModels = new TransformGroup(); // Get list of all ground based complex models. vector<ComplexModel*> listOfComplexModels = scnxArchive.getListOfGroundBasedComplexModels(); // Iterate over all ground based complex models and try to build a transform group. vector<ComplexModel*>::iterator jt = listOfComplexModels.begin(); while (jt != listOfComplexModels.end()) { ComplexModel *cm = (*jt++); SharedPointer<istream> in = scnxArchive.getModelData(cm->getModelFile()); if (in.isValid()) { Node *model = NULL; // Check model. OBJXArchive *objxArchive = NULL; if (cm->getModelFile().find(".objx") != string::npos) { objxArchive = OBJXArchiveFactory::getInstance().getOBJXArchive(*in); } else if (cm->getModelFile().find(".obj") != string::npos) { objxArchive = OBJXArchiveFactory::getInstance().getOBJXArchiveFromPlainOBJFile(*in); } if (objxArchive != NULL) { model = objxArchive->createTransformGroup(NodeDescriptor(cm->getName())); if (model != NULL) { clog << "OBJ model successfully opened." << endl; clog << " Translation: " << cm->getPosition().toString() << endl; clog << " Rotation: " << cm->getRotation().toString() << endl; TransformGroup *complexModel = new TransformGroup(); // Translation. Point3 translation(cm->getPosition()); complexModel->setTranslation(translation); // TODO: Achsenprüfung!! Point3 rotation(cm->getRotation().getX(), cm->getRotation().getZ(), cm->getRotation().getY()); complexModel->setRotation(rotation); complexModel->addChild(model); complexModels->addChild(complexModel); } else { clog << "OBJ model could not be opened." << endl; } OPENDAVINCI_CORE_DELETE_POINTER(objxArchive); } } } return complexModels; }
int32_t ServiceManager::remove_service(SharedPointer<IProcessor> processor) { //NOTE: 本函数不用加锁 std::string name; if (processor.is_valid()) { name = processor->get_name(); } else { return -1; } return remove_service(name); }
//----------------------------------------------------------------------------- void CSegmentButton::drawRect (CDrawContext* pContext, const CRect& dirtyRect) { bool isHorizontal = style == kHorizontal; SharedPointer<CGraphicsPath> path; if (gradient || gradientHighlighted || (getFrameWidth () > 0. && getFrameColor ().alpha != 0)) { CRect r (getViewSize ()); r.inset (getFrameWidth () / 2., getFrameWidth () / 2.); path = owned (pContext->createGraphicsPath ()); path->addRoundRect (r, getRoundRadius ()); } pContext->setDrawMode (kAntiAliasing); bool drawLines = getFrameWidth () > 0. && getFrameColor ().alpha != 0; if (drawLines) { pContext->setLineStyle (kLineSolid); pContext->setLineWidth (getFrameWidth ()); pContext->setFrameColor (getFrameColor ()); } if (gradient) { pContext->fillLinearGradient (path, *gradient, getViewSize ().getTopLeft (), getViewSize ().getBottomLeft ()); } uint32_t selectedIndex = getSelectedSegment (); for (uint32_t index = 0; index < segments.size (); ++index) { Segment& segment = segments[index]; if (!dirtyRect.rectOverlap (segment.rect)) continue; CRect oldClip; pContext->getClipRect (oldClip); CRect clipRect (segment.rect); clipRect.bound (oldClip); pContext->setClipRect (clipRect); bool selected = selectedIndex == index; if (selected && gradientHighlighted) pContext->fillLinearGradient (path, *gradientHighlighted, segment.rect.getTopLeft (), segment.rect.getBottomLeft ()); if (selected && segment.backgroundHighlighted) segment.backgroundHighlighted->draw (pContext, segment.rect); else if (segment.background) segment.background->draw (pContext, segment.rect); CDrawMethods::drawIconAndText (pContext, selected ? segment.iconHighlighted : segment.icon, segment.iconPosition, textAlignment, textMargin, segment.rect, segment.name, font, selected ? textColorHighlighted : textColor); pContext->setClipRect (oldClip); if (drawLines && index > 0 && index < segments.size ()) { path->beginSubpath (segment.rect.getTopLeft ()); path->addLine (isHorizontal ? segment.rect.getBottomLeft () : segment.rect.getTopRight ()); } } if (drawLines) pContext->drawGraphicsPath (path, CDrawContext::kPathStroked); setDirty (false); }
SCNXArchive& SCNXArchiveFactory::getSCNXArchive(const URL &url) throw (InvalidArgumentException) { if (!(url.isValid())) { OPENDAVINCI_CORE_THROW_EXCEPTION(InvalidArgumentException, "URL is invalid."); } SCNXArchive *scnxArchive = NULL; // Try to find an existing SCNXArchive in the map using the URL as key. map<string, SCNXArchive*, core::strings::StringComparator>::iterator it = m_mapOfSCNXArchives.find(url.toString()); if (it != m_mapOfSCNXArchives.end()) { clog << "Found already constructed data structure." << endl; scnxArchive = it->second; } if (scnxArchive == NULL) { clog << "Creating new SCNXArchive from " << url.toString() << endl; string fileName = url.getResource(); fstream fin(fileName.c_str(), ios::binary | ios::in); core::SharedPointer<core::wrapper::DecompressedData> data = core::wrapper::CompressionFactory::getContents(fin); fin.close(); if (data.isValid()) { Scenario scenario; SharedPointer<istream> stream = data->getInputStreamFor("scenario.scn"); if (stream.isValid()) { stringstream s; char c; while (stream->good()) { stream->get(c); s << c; } // Trying to parse the input. scenario = ScenarioFactory::getInstance().getScenario(s.str()); } else { OPENDAVINCI_CORE_THROW_EXCEPTION(InvalidArgumentException, "Archive from the given URL does not contain a valid SCN file."); } // Create SCNXArchive. scnxArchive = new SCNXArchive(scenario, data); // Store SCNXArchive for further usage. // Somehow, there seems to be a bug because the data structure got corrupt... // m_mapOfSCNXArchives[url.toString()] = scnxArchive; } else { OPENDAVINCI_CORE_THROW_EXCEPTION(InvalidArgumentException, "URL could not be used to read input data."); } } return *scnxArchive; }
AbstractConferenceClientModule::AbstractConferenceClientModule(const int32_t &argc, char **argv, const string &name) throw (InvalidArgumentException) : ManagedClientModule(argc, argv, name) { SharedPointer<ContainerConference> containerConference = ContainerConferenceFactory::getInstance().getContainerConference(getMultiCastGroup()); if (!containerConference.isValid()) { OPENDAVINCI_CORE_THROW_EXCEPTION(InvalidArgumentException, "ContainerConference invalid!"); } setContainerConference(containerConference); // Register ourselves as ContainerListener. getContainerConference()->setContainerListener(this); SerializationFactory::getInstance(); }
SharedPointer<ConnInfo> BaseProxy::create_Conn(){ SharedPointer<bgcc::ClientSocket> client = SharedPointer<bgcc::ClientSocket>( new ClientSocket(_serverinfo.getIP(),_serverinfo.getPort())); if (client.is_valid()) { if(client->open()==0){ SharedPointer<BinaryProtocol> prot = SharedPointer<BinaryProtocol>(new bgcc::BinaryProtocol(client)); return SharedPointer<ConnInfo>(new ConnInfo(prot)); } } return SharedPointer<ConnInfo>(NULL); }
int main(int argc, char **argv) { SolverParams* p = &GlobalResource::getInstance()->solverParams; bool parseCorrect = SolverParams::parseCommandLineOption(argc, argv, *p); if (p->policyFile == "") { cout<<"Invalid params\n"; return 0; } cout<<"\nLoading the model ...\n "; SharedPointer<MOMDP> problem = ParserSelector::loadProblem(p->problemName, *p); SharedPointer<AlphaVectorPolicy> policy = new AlphaVectorPolicy(problem); cout<<"\nLoading the policy ... input file : "<<p->policyFile<<"\n"; bool policyRead = policy->readFromFile(p->policyFile); if (p->useLookahead) { cout<<" action selection : one-step look ahead\n"; } Controller control(problem, policy, p, -1); cout<<"\nInitialized the controller\n"; // In the Tiger problem, X = 0 // dummy obs for first action int firstAction = control.nextAction(1, 0); cout<<"\nFirst action : "<<firstAction<<endl; // obs-left int action = control.nextAction(0, 0); cout<<"Obs-left => Action : "<<action<<endl; // obs-left => open right action = control.nextAction(0, 0); cout<<"Obs-left => Action : "<<action<<endl; // reset action = control.nextAction(1, 0); cout<<"\nReset ...\nFirst action : "<<action<<endl; // obs-right action = control.nextAction(1, 0); cout<<"Obs-right => Action : "<<action<<endl; // obs-right => open left action = control.nextAction(1, 0); cout<<"Obs-right => Action : "<<action<<endl; return 0; }
void Group::attachNode( SharedPointer< Node > const &node ) { if ( node->getParent() == this ) { // the node is already attach to this group return; } if ( node->getParent() != nullptr ) { throw HasParentException( node->getName(), this->getName(), node->getParent()->getName() ); } node->setParent( this ); _nodes.add( node ); }
MapilVoid D3DSprite::DrawClipedTexture( SharedPointer < Texture > pTexture, MapilFloat32 x, MapilFloat32 y, MapilFloat32 sx, MapilFloat32 sy, MapilFloat32 angle, MapilFloat32 cx1, MapilFloat32 cy1, MapilFloat32 cx2, MapilFloat32 cy2, MapilBool centerize, MapilUInt32 color ) { Assert( m_IsUsed, CURRENT_POSITION, TSTR( "The sprite isn't created yet." ), -1 ); MapilFloat32 width = cx2 - cx1; MapilFloat32 height = cy2 - cy1; D3DXMATRIXA16 matWorld; ::D3DXMatrixIdentity( &matWorld ); ::D3DXMATRIXA16 trans; ::D3DXMATRIXA16 scale; ::D3DXMATRIXA16 rot; ::D3DXMatrixIdentity( &trans ); ::D3DXMatrixIdentity( &scale ); ::D3DXMatrixIdentity( &rot ); // World coordinate transformation trans._41 = x; trans._42 = y; scale._11 = sx; scale._22 = sy; ::D3DXMatrixRotationZ( &rot, -angle ); if( centerize ) { ::D3DXMATRIXA16 offset; ::D3DXMatrixIdentity( &offset ); offset._41 = - width / 2.0f; offset._42 = - height / 2.0f; matWorld = offset * scale * rot * trans; // Centering -> Scaling -> Rotation -> Translation. } else { matWorld = scale * rot * trans; } m_pD3DSprite->SetTransform( &matWorld ); // Set range of drawing. RECT rc; rc.top = static_cast < MapilInt32 > ( cy1 ); rc.bottom = static_cast < MapilInt32 > ( cy2 ); rc.left = static_cast < MapilInt32 > ( cx1 ); rc.right = static_cast < MapilInt32 > ( cx2 ); // Draw if( FAILED( m_pD3DSprite->Draw( reinterpret_cast < LPDIRECT3DTEXTURE9 > ( pTexture.GetPointer()->Get() ), &rc, NULL, NULL, color ) ) ) { throw MapilException( CURRENT_POSITION, TSTR( "Failed to draw." ), -1 ); } }
// Draw texture. MapilVoid GLSprite::DrawTexture( SharedPointer < Texture > pTexture, ImageTransformationMethod method, const Vector2 < MapilFloat32 >& v ) { // If texture hasn't been created, this function returns immediately. if( !pTexture.GetPointer() ){ return; } // Set up the transformation matrix for the image. glMatrixMode( GL_MODELVIEW ); glPushMatrix(); // Set up the transformation matrix for the image. switch( method ){ case IMAGE_TRANSFORMATION_METHOD_MOVE: glTranslatef( v.m_X, v.m_Y, 0.0f ); break; default: break; } // Draw texture. DrawTexture( pTexture ); glFlush(); // Restore the transformation matrix. glPopMatrix(); }
void PhysicsEngine::collisionTestFastParticles() { raySphereRelative.resizeToSizeIfRequiredWithBatchSize(fastParticles.getCount(), SphereRayHelper::batchSize); Array<int> collisionTestResult; collisionTestResult.setNumberOfElements(fastParticles.getCount(), false); for( int index = 0; index < physicsBodies.getCount(); index++ ) { SharedPointer<PhysicsBody> currentBody = physicsBodies[index]; float collisionSphereRadius = currentBody->boundingSphereRadius; SphereRayHelper::transferFastParticlesToRaySphereSoa(fastParticles, collisionSphereRadius, currentBody->getPosition(), raySphereRelative); SphereRayHelper::doBatchedCollisionTests(raySphereRelative); SphereRayHelper::checkForCollisions(raySphereRelative, fastParticles, collisionTestResult); // process the collision test result for( int collisionTestResultIndex = 0; collisionTestResultIndex < fastParticles.getCount(); collisionTestResultIndex++ ) { if( collisionTestResult[collisionTestResultIndex] != 0 ) { fastParticles[collisionTestResultIndex]->nextHitAnything = true; fastParticles[collisionTestResultIndex]->nextHitBody = currentBody; // NOTE< for now just against/for the bounding sphere > // TODO< calculate the hit position? > } } } }
bool BinaryTypeUpdaterImpl::Update(Snap* snap, IgniteError* err) { JniErrorInfo jniErr; SharedPointer<InteropMemory> mem = env.Get()->AllocateMemory(); InteropOutputStream out(mem.Get()); BinaryWriterImpl writer(&out, NULL); BinaryRawWriter rawWriter(&writer); // We always pass only one meta at a time in current implementation for simplicity. rawWriter.WriteInt32(1); rawWriter.WriteInt32(snap->GetTypeId()); rawWriter.WriteString(snap->GetTypeName()); rawWriter.WriteString(NULL); // Affinity key is not supported for now. if (snap->HasFields()) { std::map<std::string, int32_t>* fields = snap->GetFields(); rawWriter.WriteInt32(static_cast<int32_t>(fields->size())); for (std::map<std::string, int32_t>::iterator it = fields->begin(); it != fields->end(); ++it) { rawWriter.WriteString(it->first); rawWriter.WriteInt32(it->second); } } else rawWriter.WriteInt32(0); rawWriter.WriteBool(false); // Enums are not supported for now. rawWriter.WriteInt32(0); // Schema size. Compact schema footer is not yet supported. out.Synchronize(); long long res = env.Get()->Context()->TargetInStreamOutLong(javaRef, OP_METADATA, mem.Get()->PointerLong(), &jniErr); IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); if (jniErr.code == IGNITE_JNI_ERR_SUCCESS) return res == 1; else return false; }
//---------------------------------------------------------------------------------------------------- CMouseEventResult UIViewCreatorDataSource::dbOnMouseMoved (const CPoint& where, const CButtonState& buttons, int32_t row, int32_t column, CDataBrowser* browser) { if (mouseDownRow >= 0 && buttons.isLeftButton ()) { SharedPointer<UISelection> selection = createSelection (); CMemoryStream stream (1024, 1024, false); if (selection->store (stream, description)) { stream.end (); CDropSource* dropSource = new CDropSource (stream.getBuffer (), static_cast<uint32_t> (stream.tell ()), CDropSource::kText); browser->doDrag (dropSource); dropSource->forget (); } mouseDownRow = -1; } return kMouseEventNotHandled; }
void Renderables::addToRenderables(SharedPointer<GameObject> &i_GameObject) { size_t objecIndex; if (!i_GameObject.isNull()) { if (!isObjectRenderable(i_GameObject, objecIndex)) mRenderables.push_back(i_GameObject); } }//addToRenderables
int main() { SingletonPointer<CGraphicsAPI> GraphicsAPI; SingletonPointer<CWindowManager> WindowManager; SingletonPointer<CGUIManager> GUIManager; GraphicsAPI->Init(new Graphics::COpenGLImplementation()); WindowManager->Init(GraphicsAPI); CWindow * Window = WindowManager->CreateWindow(vec2i(1280, 1024), "ionEngine GUI Demo", EWindowType::Windowed); SharedPointer<Graphics::IGraphicsContext> Context = GraphicsAPI->GetWindowContext(Window); SharedPointer<Graphics::IRenderTarget> RenderTarget = Context->GetBackBuffer(); RenderTarget->SetClearColor(color3f(0.3f)); GUIManager->Init(Window); Window->AddListener(GUIManager); while (WindowManager->Run()) { RenderTarget->ClearColorAndDepth(); GUIManager->NewFrame(); { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver); ImGui::ShowDemoWindow(); } GUIManager->Text(vec2i(100, 100), Color::Basic::White, "Hello, world!"); GUIManager->Text(vec2i(100, 120), Color::Basic::Red, "Hello, world!"); GUIManager->Text(vec2i(100, 140), Color::Basic::Orange, "Hello, world!"); GUIManager->Text(vec2i(100, 160), Color::Basic::Yellow, "Hello, world!"); GUIManager->Text(vec2i(100, 180), Color::Basic::Green, "Hello, world!"); GUIManager->Text(vec2i(100, 200), Color::Basic::Cyan, "Hello, world!"); GUIManager->Text(vec2i(100, 220), Color::Basic::Blue, "Hello, world!"); GUIManager->Text(vec2i(100, 240), Color::Basic::Magenta, "Hello, world!"); GUIManager->Text(vec2i(100, 260), Color::Basic::Black, "Hello, world!"); GUIManager->Draw(); Window->SwapBuffers(); } GUIManager->Shutdown(); return 0; }
MapilVoid GLSprite::DrawString( SharedPointer < GraphicsFont > pFont, const MapilTChar* pStr, const Matrix4x4 < MapilFloat32 >& mat ) { if( !pStr ){ return; } #if defined ( API_WIN32API ) glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadMatrixf( mat.m_Elm1 ); ::HDC hdc = wglGetCurrentDC(); // Build string to be displayed. MapilTChar str[ 4096 ]; va_list vl; MapilInt32 len; va_start( vl, pStr ); len = _vsctprintf( pStr, vl ) + 1; if( len > sizeof( str ) ){ return; } _vstprintf( str, pStr, vl ); va_end( vl ); len = _tcslen( str ); SelectObject( hdc, reinterpret_cast < HFONT > ( pFont->Get() ) ); MapilInt32 list = glGenLists( len ); for( MapilInt32 i = 0; i < len; i++ ){ wglUseFontBitmaps( hdc, str[ i ], 1, list + i ); } //glDisable( GL_LIGHTING ); //glColor4f( colR, colG, colB, 1.0f ); glColor4f( 1.0f, 0.0f, 0.0f, 1.0f ); //glRasterPos2i( vPos.m_X, vPos.m_Y ); glRasterPos2i( 0, 0 ); for( MapilInt32 i = 0; i < len; i++ ){ glCallList( list + i ); } //glEnable( GL_LIGHTING ); glDeleteLists( list, len ); glPopMatrix(); #endif // API_WIN32API }
bool Renderables::removeFromRenderables(SharedPointer<GameObject> &i_GameObject) { size_t objectIndex = 0x0f0f0f0f; if ((!i_GameObject.isNull()) && isObjectRenderable(i_GameObject, objectIndex) && (objectIndex != 0x0f0f0f0f)) { mRenderables.erase(mRenderables.begin() + objectIndex); return true; } return false; }//removeFromRenderables
bool Stream::isTopLevel( SharedPointer< StreamObject > const &obj ) const { for ( const auto &other : _topLevelObjects ) { // double check if ( other == obj && other->getUniqueIdentifier() == obj->getUniqueIdentifier() ) { return true; } } return false; }