Exemple #1
0
int main()
{

	Engine engines[3]=
					{Engine("V8",6.0),
					Engine("V8",8.0),
					Engine("Inline",4.2)};

	Ship titanic("liner",engines,3);

	titanic.display(std::cout);

	//Comparing with the standards:
	if(titanic<MIN)
		std::cout<<"Below average!"<<std::endl;
	else
		std::cout<<"Above average!"<<std::endl;

}
Exemple #2
0
Manager::Manager( const char* name, int width, int height, Engine::WindowMode wm ):
RTTI_CLASS_DEFINE( Manager ),
m_engine( 0 ),
m_game( 0 ),
m_pushState( 0 ),
m_progressState( 0 ),
m_progressStateDefault( 0 ),
m_popState( false ),
m_changeState( false ),
m_loading( false ),
m_states( 0 ),
m_scenes( 0 ),
m_materials( 0 ),
m_effects( 0 ),
m_fonts( 0 ),
m_textures( 0 ),
m_canvases( 0 ),
m_assets( 0 ),
m_assetsLoading( 0 ),
m_actors( 0 ),
m_controls( 0 ),
m_collisions( 0 ),
m_audio( 0 )
{
	m_engine = xnew Engine();
	m_engine->initiation( name, width, height, wm );
	m_states = xnew Stack< IState >();
	m_scenes = xnew SceneManager();
	m_materials = xnew MaterialManager();
	m_effects = xnew EffectManager();
	m_fonts = xnew FontManager();
	m_textures = xnew TextureManager();
	m_canvases = xnew CanvasManager();
	m_assets = xnew AssetManager();
	m_assetsLoading = xnew AssetManager();
	m_actors = xnew Stack< ActorManager >();
	m_controls = xnew Stack< ControlManager >();
	m_collisions = xnew Stack< CollisionManager >();
	m_audio = xnew AudioManager();

	Global::use().engine = m_engine;
	Global::use().scenes = m_scenes;
	Global::use().materials = m_materials;
	Global::use().effects = m_effects;
	Global::use().fonts = m_fonts;
	Global::use().textures = m_textures;
	Global::use().canvases = m_canvases;
	Global::use().assets = m_assets;
	Global::use().assetsLoading = m_assetsLoading;
	Global::use().actors = 0;
	Global::use().controls = 0;
	Global::use().collisions = 0;
	Global::use().audio = m_audio;
}
Exemple #3
0
Engine Engine::create(Server server)
{
    ib_engine_t* ib_engine;
    Internal::throw_if_error(
        ib_engine_create(
            &ib_engine,
            server.ib()
        )
    );
    return Engine(ib_engine);
}
	void CSprite::Draw(CRenderContext& renderContext)
	{
		CMatrix mWorld;
		mWorld = CMatrix::Identity;
		CVector3 scale;
		int frameBufferW = Engine().GetFrameBufferWidth();
		int frameBufferH = Engine().GetFrameBufferHeight();
		int frameBufferHalfW = frameBufferW / 2;
		int framebufferHalfH = frameBufferH / 2;
		scale.x = m_size.x / frameBufferW;
		scale.y = m_size.y / frameBufferH;
		scale.z = 1.0f;
		mWorld.MakeScaling(scale);
		CMatrix mTrans = CMatrix::Identity;
		CVector3 trans;
		trans.x = m_pos.x / frameBufferHalfW;
		trans.y = m_pos.y / framebufferHalfH;
		trans.z = 0.0f;
		//ピボットの分のオフセットを計算。
		CVector3 pivotOffset;
		pivotOffset.x = (m_size.x * (0.5f - m_pivot.x)) / frameBufferHalfW;
		pivotOffset.y = (m_size.y * (0.5f - m_pivot.y)) / framebufferHalfH;
		pivotOffset.z = 0.0f;
		trans.Add(pivotOffset);

		mTrans.MakeTranslation(trans);
		mWorld.Mul(mWorld, mTrans);

		m_effect->Begin(renderContext);
		m_effect->BeginPass(renderContext, 0);
		m_effect->SetTechnique(renderContext, "SpriteTexture");
		m_effect->SetValue(renderContext, "mWorld", &mWorld, sizeof(mWorld));
		m_effect->SetTexture(renderContext, "g_tex", m_texture);
		m_effect->CommitChanges(renderContext);
		renderContext.SetVertexDeclaration(m_primitive.GetVertexDecl());
		renderContext.SetStreamSource(0, m_primitive.GetVertexBuffer());
		renderContext.SetIndices(m_primitive.GetIndexBuffer());
		renderContext.DrawIndexedPrimitive(&m_primitive);
		m_effect->EndPass(renderContext);
		m_effect->End(renderContext);
	}
TEST(IEJobExecutor, DistributionQuality)
{
	std::random_device rd;
	std::default_random_engine Engine(rd());
	std::uniform_int_distribution<uint32_t> distribution(5000, 150000);

	// Create tasks with varying lengths
	auto taskSum = [](int taskLength)
	{
		int result = 0;
		for(int i = 0; i < taskLength; i++)
		{
			if(i % 2)
				result += i;
			else
				result -= i;
		}
	};

	//
	IEJobExecutor<> jobManager;
	jobManager.Start();
	double timings[10];
	std::vector<std::future<void>> results;

	// Time Each Iteration
	for(int a = 0; a < 10; a++)
	{
		auto start = std::chrono::high_resolution_clock::now();
		for(int i = 0; i < 500; i++)
		{
			int taskLength = distribution(Engine);
			results.push_back(jobManager.AssignJob(taskSum, taskLength));
		}
		// Wait All Results
		for(auto iterator = results.begin(); iterator != results.end(); ++iterator) 
			iterator->wait();

		auto end = std::chrono::high_resolution_clock::now();
		auto diff = end - start;
		timings[a] = std::chrono::duration <double, std::milli>(diff).count();
		results.clear();
	}

	double avg = 0.0;
	for(int i = 0; i < 10; i++)
		avg += timings[i];
	avg /= 10.0;
	for(int i = 0; i < 10; i++)
		EXPECT_NEAR(timings[i], avg, 100.0);
	jobManager.Stop();
}
	/*!
	 * @brief	テクスチャをロード。
	 */
	bool CTexture::Load(const char* fileName)
	{
		LPDIRECT3DDEVICE9 device = Engine().GetD3DDevice();
		if ( FAILED( D3DXCreateTextureFromFile(
			device,
			fileName,
			&m_tex))) {
			TK_LOG("FailedTextureLoad");
			return false;
		}
		ComputeTexSize();
		return true;
	}
Exemple #7
0
int main(int argc, char* argv[])
{
    Engine engine = Engine();

    if(engine.init())
    {
        engine.run();
    }

    engine.shutdown();

    return 0;
}
Exemple #8
0
void KrButton::SetMode( int m )
{
	if (    Engine() 
		 && m != mode )
	{
		if ( ( m & DOWN ) && !( mode & DOWN ) )			// down transition
		{
			PublishEvent( ACTIVATED, 0, 0, 0, 0 );		
			if ( IsSelectable() )
			{
				mode = m;		// Prevent from recursion.
				KrEventManager::Instance()->SelectMe( this );
			}
		}
		else if ( !( m & DOWN ) && ( mode & DOWN ) )	// up transition
		{
			PublishEvent( DEACTIVATED, 0, 0, 0, 0 );
		}
		mode = m;

		KrColorTransform color;

		if ( mode == ( OVER ) )
		{
			color = scheme.CalcHiSec();
			bevel.DrawOut();
			if ( icon )
				icon->SetPos( iconX, iconY );
		}
		else if ( mode & DOWN )
		{		
			if ( mode & OVER )
				color = scheme.CalcDarkSec();
			else
				color = scheme.CalcDark();

			bevel.DrawIn();
			if ( icon )
				icon->SetPos( iconX+1, iconY+1 );
		}
		else
		{
			bevel.DrawOut();
			if ( icon )
				icon->SetPos( iconX, iconY );
		}

		plate->SetColor( color );
	}
}
Exemple #9
0
void sTextControl::Log(sChar *s)
{
  sInt tl,sl,stat;

  stat = Static;
  Static = 0;
  tl = sGetStringLen(Text);
  sl = sGetStringLen(s);
  Engine(tl,sl,s);
  Cursor = tl+sl;
  ScrollToCursor();
  Static = stat;
  RecalcSize = sTRUE;
}
Exemple #10
0
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	switch (uMsg) {
	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	case WM_SIZE:
		if (Engine()->GetGlDevice()) {
			Engine()->GetGlDevice()->SetWindowSize();
			MG()->Resize();
		}
		break;

	case WM_PAINT:
		PAINTSTRUCT ps;
		HDC hdc = BeginPaint(hwnd, &ps);
		FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW + 1));
		EndPaint(hwnd, &ps);
		break;
	
	}
	return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
Exemple #11
0
wxImage
FreeImage_Rescale(wxImage src, wxInt32 dst_width, wxInt32 dst_height, FREE_IMAGE_FILTER filter) {

	wxImage dst;

	if ((src.Ok()) && (dst_width > 0) && (dst_height > 0)) {

		dst.Create(dst_width, dst_height);

		// select the filter
		CGenericFilter *pFilter = NULL;
		switch(filter) {
			case FILTER_BOX:
				pFilter = new CBoxFilter();
				break;
			case FILTER_BICUBIC:
				pFilter = new CBicubicFilter();
				break;
			case FILTER_BILINEAR:
				pFilter = new CBilinearFilter();
				break;
			case FILTER_BSPLINE:
				pFilter = new CBSplineFilter();
				break;
			case FILTER_CATMULLROM:
				pFilter = new CCatmullRomFilter();
				break;
			case FILTER_LANCZOS3:
				pFilter = new CLanczos3Filter();
				break;
		}
		CResizeEngine Engine(pFilter);

		// perform upsampling or downsampling
		unsigned char *pSrc = src.GetData();
		unsigned char *pDst = dst.GetData();
		wxInt32 src_width  = src.GetWidth();
		wxInt32 src_height = src.GetHeight();

		Engine.Scale(pSrc, src_width, src_height, pDst, dst_width, dst_height);

		delete pFilter;

	}

	return dst;

}
Exemple #12
0
void sTextControl::DelSel()
{
  sInt s0,s1,len;
  if(SelMode)
  {
    s0 = sMin(SelPos,Cursor);
    s1 = sMax(SelPos,Cursor);
    len = s1-s0;
    if(len>0)
    {
      Engine(s0,len,0);
      Cursor = s0;
      SelMode = 0;
    }
  }
}
QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
    : QDeclarativeView(parent)
    , d(new QmlApplicationViewerPrivate())
{
    connect(engine(), SIGNAL(quit()), SLOT(close()));
    setResizeMode(QDeclarativeView::SizeRootObjectToView);
    // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
#if !defined(NO_JSDEBUGGER)
    new QmlJSDebugger::JSDebuggerAgent(Engine());
#endif
#if !defined(NO_QMLOBSERVER)
    new QmlJSDebugger::QDeclarativeViewObserver(this, this);
#endif
#endif
}
Exemple #14
0
void Ball::Draw(PGLENGINE glEngine) {
	GLVECTOR2 end;
	double mag = Magnitude(Vel);

	end.x = Pos.x + Vel.x * 6.0;
	end.y = Pos.y + Vel.y * 6.0;

	float r = (float)mag / 50;

	if (r > 1.0)
		r = 1.0;

	glEngine->DrawArrow(this->Pos, end, 4.0f, ColorOf(r, 1.0f - r, 0.0f));
	//glEngine->DrawCircle(this->Pos, VectorOf(this->radius, 0), ColorOf(0.95f, 0.95f, 0.95f));
	glEngine->DrawTexturedRect(this->Pos, VectorOf(this->radius, this->radius), Engine()->GetString("ball_tex"));
}
Exemple #15
0
FIBITMAP * DLL_CALLCONV 
FreeImage_Rescale(FIBITMAP *src, int dst_width, int dst_height, FREE_IMAGE_FILTER filter) {
	FIBITMAP *dst = NULL;

	if (!FreeImage_HasPixels(src) || (dst_width <= 0) || (dst_height <= 0) || (FreeImage_GetWidth(src) <= 0) || (FreeImage_GetHeight(src) <= 0)) {
		return NULL;
	}

	// select the filter
	CGenericFilter *pFilter = NULL;
	switch (filter) {
		case FILTER_BOX:
			pFilter = new(std::nothrow) CBoxFilter();
			break;
		case FILTER_BICUBIC:
			pFilter = new(std::nothrow) CBicubicFilter();
			break;
		case FILTER_BILINEAR:
			pFilter = new(std::nothrow) CBilinearFilter();
			break;
		case FILTER_BSPLINE:
			pFilter = new(std::nothrow) CBSplineFilter();
			break;
		case FILTER_CATMULLROM:
			pFilter = new(std::nothrow) CCatmullRomFilter();
			break;
		case FILTER_LANCZOS3:
			pFilter = new(std::nothrow) CLanczos3Filter();
			break;
	}

	if (!pFilter) {
		return NULL;
	}

	CResizeEngine Engine(pFilter);

	dst = Engine.scale(src, dst_width, dst_height, 0, 0,
			FreeImage_GetWidth(src), FreeImage_GetHeight(src));

	delete pFilter;

	// copy metadata from src to dst
	FreeImage_CloneMetadata(dst, src);
	
	return dst;
}
Exemple #16
0
	void CFont::Init()
	{

		D3DXCreateFont(
			Engine().GetD3DDevice(),					// Direct3Dデバイス
			FONT_HEIGHT,				// 高さ
			FONT_WIDTH,					// 幅
			FW_REGULAR,					// フォントの太さ 普通
			NULL,						// 下線
			FALSE,						// 斜体
			SHIFTJIS_CHARSET,			// 文字セット
			OUT_DEFAULT_PRECIS,			// 出力制度は普通
			PROOF_QUALITY,				// 文字品質を重視
			FIXED_PITCH | FF_SCRIPT,	// ピッチとファミリ
			TEXT("MS Pゴシック"),		// フォント名
			&font);
	}
Exemple #17
0
int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPreviousInstance, _In_ LPSTR lpCommandLine, _In_ int nCommandShow)
{
    
	auto engine = Engine();

    engine.createGraphics3D(1024,768);
	engine.setApplicationTitle(L"My APP");

    while(engine.isRunning())
    {
		if(engine.input.isKeyHit(VK_ESCAPE))
			break;

		engine.graphics.renderWorld();
    }
	return 0;
}
Exemple #18
0
/*!
 * @brief	tkEngineの初期化。
 */
void InitTkEngine( HINSTANCE hInst )
{
	SInitParam initParam;
	memset(&initParam, 0, sizeof(initParam));
	//コマンドバッファのサイズのテーブル。
	int commandBufferSizeTbl[] = {
		10 * 1024 * 1024,		//10MB
	};
	initParam.hInstance = hInst;
	initParam.gameObjectPrioMax = 255;
	initParam.numRenderContext = 1;	//レンダリングコンテキストは一本
	initParam.commandBufferSizeTbl = commandBufferSizeTbl;
	initParam.screenHeight = 720;
	initParam.screenWidth = 1280;
	initParam.frameBufferHeight = 720;
	initParam.frameBufferWidth = 1280;
	//Bloom
	initParam.graphicsConfig.bloomConfig.isEnable = false;
	initParam.graphicsConfig.edgeRenderConfig.isEnable = false;
	initParam.graphicsConfig.edgeRenderConfig.idMapWidth = initParam.frameBufferWidth;
	initParam.graphicsConfig.edgeRenderConfig.idMapHeight = initParam.frameBufferHeight;
	//Shadow
	initParam.graphicsConfig.shadowRenderConfig.Init();
	initParam.graphicsConfig.shadowRenderConfig.isEnable = true;
	initParam.graphicsConfig.shadowRenderConfig.shadowMapWidth = 1024;
	initParam.graphicsConfig.shadowRenderConfig.shadowMapHeight = 1024;
	initParam.graphicsConfig.shadowRenderConfig.numShadowMap = 3;
	
	//reflection
	initParam.graphicsConfig.reflectionMapConfig.isEnable = false;
	initParam.graphicsConfig.reflectionMapConfig.reflectionMapWidth = 512;
	initParam.graphicsConfig.reflectionMapConfig.reflectionMapHeight = 512;
	//DOF
	initParam.graphicsConfig.dofConfig.isEnable = false;
	//AA
	initParam.graphicsConfig.aaConfig.isEnable = false;
	//乱数初期化。
	g_random.Init((unsigned long)time(NULL));

	Engine().Init(initParam);	//初期化。
	
	ShadowMap().SetNear(2.0f);
	ShadowMap().SetFar(40.0f);
	
}
void CSettings::run() {
	while (true) {
		if (Engine()->initialized()) {
			if (GetAsyncKeyState(trigger_key)) {
				triggerEnabled = !triggerEnabled;
				printBool("Trigger is now", triggerEnabled);
				Sleep(150);
			}

			if (GetAsyncKeyState(radar_key)) {
				radarEnabled = !radarEnabled;
				printBool("Radar is now", radarEnabled);
				Sleep(150);
			}
		}

		Sleep(50);
	}
}
Exemple #20
0
int WINAPI wWinMain(
	HINSTANCE hInst,
	HINSTANCE hPrevInstance,
	LPWSTR lpCmdLine,
	int nCmdShow
	)
{
	//tkEngineの初期化。
	InitTkEngine( hInst );

	//常駐オブジェクト。
	g_fade = NewGO<Fade>(1);
	//タイトルシーンの作成。
	NewGO<TitleScene>(0);
	
	Engine().RunGameLoop();		//ゲームループを実行。

	return 0;
}
QtInterface::QtInterface(QWidget *parent) 
    : QGLWidget(parent)
{
    qApp->installEventFilter(this);
    m_bShouldClose = false;
	
	m_flLastTime = 0.0f;
	m_iFrameCount = 0;
	m_flFPS = 0.0f;

	if ( !isValid() )
	{
		qDebug("Not a valid OpenGL configuration");
		Engine()->Stop();
		return;
	}
	
    setAutoBufferSwap(true);
}
int main() {
	std::cout << "Radar and Trigger\n\n";
	
	Engine()->start();
	std::thread engineThread(&CEngine::update, Engine());

	std::cout << "Found\n\n";
	std::cout << "Offsets\n";
	std::cout << "Local player: 0x" << Engine()->Offsets()->toHex(Engine()->Offsets()->dwLocalPlayer) << "\n";
	std::cout << "Entity list: 0x" << Engine()->Offsets()->toHex(Engine()->Offsets()->dwEntityList) << "\n";
	std::cout << "Attack: 0x" << Engine()->Offsets()->toHex(Engine()->Offsets()->dwAttack) << "\n\n";

	std::cout << "Hotkeys:\n";
	std::cout << "Triggerkey: ";
	Settings()->trigger_key = whichKeyIsPressed();
	std::cout << Settings()->trigger_key << "\n";
	std::cout << "Trigger hold key (press ENTER for no hold key): ";
	Settings()->trigger_holdkey = whichKeyIsPressed();
	if (Settings()->trigger_holdkey == VK_RETURN) {
		Settings()->trigger_holdkey = 0;
	}
	std::cout << Settings()->trigger_holdkey << "\n";
	std::cout << "Radar key: ";
	Settings()->radar_key = whichKeyIsPressed();
	std::cout << Settings()->radar_key << "\n\n";

	std::cout << "The hack is now active!\n\n";

	std::thread settingsThread(&CSettings::run, Settings());
	std::thread radarThread(&Radar::run, Radar());
	std::thread triggerThread(&Triggerbot::run, Triggerbot());

	while (!GetAsyncKeyState(VK_END)) {
		Sleep(100);
	}

	exit(0);

	return 0;
}
Exemple #23
0
// O1 X1 O2
// O3 X2 --
// -- X3 --
/// win on last move
void ai_1()
{
	auto engine = Engine("P1", "AI");

	assert(engine.add_pawn(0, 0) == true);
	assert(engine.add_pawn(1, 0) == true);
	assert(engine.add_pawn(2, 0) == true);
	assert(engine.add_pawn(1, 1) == true);
	assert(engine.add_pawn(0, 1) == true);

	auto ai = Min_Max { "AI" };
	uint16_t x = 10, y = 10;
	ai.compute(engine, 5, x, y);

	cout << x << " " << y << endl;

	assert(x == 1 && y == 2);

	cout << __func__ << endl;
}
Exemple #24
0
void Minigame::Draw() {
	Engine()->GetGlDevice()->BeginScene();
	Engine()->GetGlDevice()->DrawTexturedRect(VectorOf(Engine()->ScreenX() / 2, Engine()->ScreenY() / 2), VectorOf(Engine()->ScreenX(), Engine()->ScreenY()), Engine()->GetString("bg_tex"));
	switch (GameState) {
	case Minigame::WAITING:
		WaitingDraw();
		break;
	case Minigame::RUNNING:
		RunningDraw();
		break;
	case Minigame::WINNING:
		WinningDraw();
		break;
	default:
		break;
	}

	char buffer[200];
	sprintf(buffer, "Difficulty : %d    |    Move : %d    |    Level : %d", Engine()->GetInt("difficulty") , NumMoves, Level);
	Engine()->GetGlDevice()->DrawTextGl(VectorOf(Engine()->ScreenX() - 300, 6), ColorOf(0.0f, 0.0f, 0.0f), buffer);

	Engine()->GetGlDevice()->EndScene();
}
Exemple #25
0
Minigame::Minigame() {
	GameState = Minigame::WAITING;
	Level = 0;
	lmState = 0;

	SetupEnv();
	NewMap();

	// Load default textures
	Engine()->GetGlDevice()->LoadTexture("ball.bmp", "ball", false);
	Engine()->GetGlDevice()->LoadTexture("hole.bmp", "hole", false);
	Engine()->GetGlDevice()->LoadTexture("block.bmp", "block", false);
	Engine()->GetGlDevice()->LoadTexture("you_suck.bmp", "you_suck", false);
	Engine()->GetGlDevice()->LoadTexture("you_rock.bmp", "you_rock", false);
	Engine()->GetGlDevice()->LoadTexture("background.bmp", "background", false);
}
	void CMonochromeFilter::Render( CRenderContext& renderContext, CPostEffect* postEffect )
	{
		if(m_isEnable){
			
			//レンダリングターゲットを切り替え。
			Engine().ToggleMainRenderTarget();
			//Zバッファだけクリアするためのレンダリングターゲットを作成。
			m_clearRenderTarget.SetSurfaceDX(nullptr);
			m_clearRenderTarget.SetDepthSurfaceDX(Engine().GetMainRenderTarget().GetDepthSurfaceDx());
			renderContext.SetRenderTarget(0, &m_clearRenderTarget);
			//Zバッファをクリア。
			renderContext.Clear(0, nullptr, D3DCLEAR_ZBUFFER, 0, 0.0f, 0);
			renderContext.SetRenderState(RS_ZWRITEENABLE, TRUE);
			renderContext.SetRenderState(RS_ZENABLE, TRUE);
			renderContext.SetRenderState(RS_ZFUNC, D3DCMP_GREATEREQUAL);
			//Zマスクをレンダリング。
			for (auto func : maskModelsFunc) {
				(*func)(renderContext);
			}
			maskModelsFunc.clear();

			CPIXPerfTag tag(renderContext, L"CMonochromeFilter::Render");
			float texSize[] = {
				s_cast<float>(Engine().GetMainRenderTarget().GetWidth()),
				s_cast<float>(Engine().GetMainRenderTarget().GetHeight())
			};
			m_effect->SetTechnique(renderContext, "Default");
			m_effect->Begin(renderContext);
			m_effect->BeginPass(renderContext, 0);
			m_effect->SetTexture(renderContext, "g_scene", Engine().GetMainRenderTarget().GetTexture());
			m_effect->SetValue(renderContext, "g_sceneTexSize", texSize, sizeof(texSize));
			m_effect->SetValue(renderContext, "g_blendRate", &m_blendRate, sizeof(m_blendRate));
			m_effect->CommitChanges(renderContext);

			renderContext.SetRenderState(RS_ZFUNC, D3DCMP_EQUAL);
			renderContext.SetRenderTarget(0, &Engine().GetMainRenderTarget());
			postEffect->RenderFullScreen(renderContext);
			renderContext.SetRenderState(RS_ZFUNC, D3DCMP_LESSEQUAL);
			m_effect->EndPass(renderContext);
			m_effect->End(renderContext);
		}
	}
Exemple #27
0
void KrProgress::SetBarColors (KrRGBA FillColor, KrRGBA ChangeColor, KrRGBA BorderColor)
{
    if (m_progress) {
        if (Engine()) {
            Engine()->Tree()->DeleteNode(m_progress);
            Engine()->Tree()->DeleteNode(m_border);
        } else {
            delete m_progress;
            delete m_border;
        }
    }

    delete m_progressres;
    delete m_borderres;

    m_FillCol = FillColor;
    m_ChangeCol = ChangeColor;
    m_BorderCol = BorderColor;

    if (m_FillCol != m_ChangeCol)
        m_multicolor = true;
    else
        m_multicolor = false;

    m_progressres = new KrBoxResource( "KrProgress Bar", m_width-2, m_height-2, &m_FillCol,  1, KrBoxResource::FILL );
    m_borderres   = new KrBoxResource( "KrProgress Border", m_width, m_height,	&m_BorderCol, 1, KrBoxResource::OUTLINE);

    m_progress = new KrBox(m_progressres);
    m_border   = new KrBox(m_borderres);

    if (m_progress && Engine()) {
        Engine()->Tree()->AddNode (this, m_border);
        Engine()->Tree()->AddNode (this, m_progress);
        Update();
    }
}
Exemple #28
0
Engine ConstContext::engine() const
{
    return Engine(ib_context_get_engine(ib()));
}
Exemple #29
0
void android_main(struct android_app* state)
{	
	LOG_INTRO();
	if (!envInitialized)
	{
		LOGE("ERROR! JAVA DID NOT INITIALIZE FIRST. Exiting!");
		return;
	}

	pthread_mutex_init(&incomingMutex,NULL);
	jniDataVector.clear();	

	Engine mainEngine = Engine();	
	AmplifyRunner myRunner = AmplifyRunner(&mainEngine);
	
	struct ARUserData myData;
	memset(&myData,0,sizeof(ARUserData));

	myData.engine = &mainEngine;
	myData.runner = &myRunner;
	state->userData = &myData;
		
	initializeEngine(state, &mainEngine);	


	bool running = true;
	while (running)
	{
		// Read all pending events.
		int ident;
		int events;
		struct android_poll_source* source;

		// If not animating, we will block forever waiting for events.
		// If animating, we loop until all events are read, then continue to draw the next frame of animation.
		while ((ident = ALooper_pollAll(mainEngine.animating ? 0 : -1, NULL, &events, (void**) &source)) >= 0)
		{
			// Process this event.
			if (source != NULL)
			{
				source->process(state, source);
			}		

			//Process sensor events
			if (ident == LOOPER_ID_USER)
			{
				mainEngine.sensorCollector->ProcessSensorEvents();
			}

			// Check if we are exiting.
			if (state->destroyRequested != 0)
			{
				LOGI(LOGTAG_MAIN,"Engine thread destroy requested!");
				shutdownEngine(&mainEngine);
				return;
			}			
		}
		
		if (mainEngine.animating == 1)
		{	
			mainEngine.communicator->Update(javaVM);

			//Check for messages in JNI queue
			if ( pthread_mutex_trylock(&incomingMutex) == 0)
			{
				int count = 0;
				while (!jniDataVector.empty())
				{
					count++;
					mainEngine.communicator->AddIncomingMessage(jniDataVector.back());
					jniDataVector.pop_back();
				}
				if (count > 0)
					LOGD(LOGTAG_NETWORKING,"Got %d messages from JNI queue",count);
				pthread_mutex_unlock(&incomingMutex);
			}

			try
			{
				myRunner.DoFrame(&mainEngine);
			}
			catch (exception & e)
			{
				LOGE("Exiting due to caught exception. Message=%s",e.what());
				myRunner.Teardown(&mainEngine);
				shutdownEngine(&mainEngine);
			}
		}

		//Check if state has changed during animation loop
		if (mainEngine.animating == 0)
		{
			LOGW(LOGTAG_MAIN,"Exiting due to internal user command.");
			ANativeActivity_finish(state->activity);
		}
	}
	myRunner.~AmplifyRunner();
	shutdownEngine(&mainEngine);
	//ANativeActivity_finish(state->activity);
}
bool
AudioNodeExternalInputStream::IsEnabled()
{
  return ((MediaStreamAudioSourceNodeEngine*)Engine())->IsEnabled();
}