#include "Linderdaum.h" sEnvironment* Env = NULL; clScene* g_Scene = NULL; clPinchZoomHandler* g_PinchZoomHandler = NULL; LMatrix4 Position = LMatrix4::IdentityStatic(); LMatrix4 PositionDelta = LMatrix4::IdentityStatic(); LMatrix4 ZoomDelta = LMatrix4::IdentityStatic(); int g_PlaneID; // , void Event_DRAW( LEvent Event, const LEventArgs& Args ) { // g_Scene->RenderForward(); // , if ( !g_PinchZoomHandler->IsGestureValid() ) return; if ( g_PinchZoomHandler->IsDraggingValid() ) { // PositionDelta = g_PinchZoomHandler->GetTranslationMatrix(); } else { // Position = Position * PositionDelta; PositionDelta = LMatrix4::Identity(); } float ZoomFactor = 1.0f; if ( g_PinchZoomHandler->IsPinchZoomValid() ) { // ZoomFactor = g_PinchZoomHandler->GetPinchZoomFactor(); ZoomDelta = g_PinchZoomHandler->GetPinchZoomMatrix(); } else { // Position = Position * ZoomDelta; ZoomDelta = LMatrix4::Identity(); } // g_Scene->SetLocalTransform( g_PlaneID, Position * PositionDelta * ZoomDelta ); // size_t NumContacts = g_PinchZoomHandler->GetMotionData()->GetNumTouchPoints(); clCanvas* C = Env->Renderer->GetCanvas(); LString Str1( "Zoom factor: " + LStr::ToStr( ZoomFactor ) ); LString Str2( "Active : " + LStr::ToStr( NumContacts ) ); C->TextStrFreeType( LRect( 0.0f, 0.0f ), Str1, 0.05f, LC_White, NULL, TextAlign_Left ); C->TextStrFreeType( LRect( 0.0f, 0.05f ), Str2, 0.05f, LC_White, NULL, TextAlign_Left ); } // APPLICATION_ENTRY_POINT { Env = new sEnvironment(); Env->DeployDefaultEnvironment( "", "../../CommonMedia" ); Env->Connect( L_EVENT_DRAWOVERLAY, Utils::Bind( &Event_DRAW ) ); // , clGeom* TestGeom1 = Env->Resources->CreatePlane( 0.1f, 0.2f, 0.9f, 0.8f, -0.1f, 10 ); // g_Scene = Env->Linker->Instantiate( "clScene" ); g_Scene->SetCameraTransform( LMatrix4::GetTranslateMatrix( LVector3(0.0f) ) ); g_Scene->SetCameraProjection( Env->Renderer->GetCanvas()->GetOrthoMatrices()->GetProjectionMatrix() ); g_Scene->SetUseOffscreenBuffer( false, false ); // g_PlaneID = g_Scene->AddGeom( TestGeom1 ); // clMaterial* Mtl = Env->Resources->CreateMaterial(); Mtl->SetPropertyValue( "DiffuseMap", "banner.jpg" ); g_Scene->SetMtl( g_PlaneID, Mtl ); // - g_PinchZoomHandler = Env->Linker->Instantiate( "clPinchZoomHandler" ); Env->RunApplication( DEFAULT_CONSOLE_AUTOEXEC ); APPLICATION_EXIT_POINT( Env ); } // APPLICATION_SHUTDOWN { delete( g_Scene ); delete( g_PinchZoomHandler ); }
ndk-build
ant copy-common-media debug
Source: https://habr.com/ru/post/124688/
All Articles