remove text draw sutff

This commit is contained in:
Alexander Mahr 2025-03-01 10:58:16 +01:00
parent 0f3be8033e
commit 0f5b24c83c

View file

@ -154,97 +154,97 @@ float Heightmap[HMX*HMY];
extern struct android_app * gapp; extern struct android_app * gapp;
void DrawHeightmap() //Heightmap void DrawHeightmap()
{ //Heightmap {
int x, y; //Heightmap int x, y;
//float fdt = ((iframeno++)%(360*10))/10.0; //Heightmap //float fdt = ((iframeno++)%(360*10))/10.0;
//Heightmap
mountainangle += .2; //Heightmap mountainangle += .2;
if( mountainangle < 0 ) mountainangle += 360; //Heightmap if( mountainangle < 0 ) mountainangle += 360;
if( mountainangle > 360 ) mountainangle -= 360; //Heightmap if( mountainangle > 360 ) mountainangle -= 360;
//Heightmap
mountainoffsety = mountainoffsety - ((mountainoffsety-100) * .1); //Heightmap mountainoffsety = mountainoffsety - ((mountainoffsety-100) * .1);
//Heightmap
float eye[3] = { (float)(sin(mountainangle*(3.14159/180.0))*30*sin(mountainoffsety/100.)), (float)(cos(mountainangle*(3.14159/180.0))*30*sin(mountainoffsety/100.)), (float)(30*cos(mountainoffsety/100.)) }; //Heightmap float eye[3] = { (float)(sin(mountainangle*(3.14159/180.0))*30*sin(mountainoffsety/100.)), (float)(cos(mountainangle*(3.14159/180.0))*30*sin(mountainoffsety/100.)), (float)(30*cos(mountainoffsety/100.)) };
float at[3] = { 0,0, 0 }; //Heightmap float at[3] = { 0,0, 0 };
float up[3] = { 0,0, 1 }; //Heightmap float up[3] = { 0,0, 1 };
//Heightmap
tdSetViewport( -1, -1, 1, 1, screenx, screeny ); //Heightmap tdSetViewport( -1, -1, 1, 1, screenx, screeny );
//Heightmap
tdMode( tdPROJECTION ); //Heightmap tdMode( tdPROJECTION );
tdIdentity( gSMatrix ); //Heightmap tdIdentity( gSMatrix );
tdPerspective( 30, ((float)screenx)/((float)screeny), .1, 200., gSMatrix ); //Heightmap tdPerspective( 30, ((float)screenx)/((float)screeny), .1, 200., gSMatrix );
//Heightmap
tdMode( tdMODELVIEW ); //Heightmap tdMode( tdMODELVIEW );
tdIdentity( gSMatrix ); //Heightmap tdIdentity( gSMatrix );
tdTranslate( gSMatrix, 0, 0, -40 ); //Heightmap tdTranslate( gSMatrix, 0, 0, -40 );
tdLookAt( gSMatrix, eye, at, up ); //Heightmap tdLookAt( gSMatrix, eye, at, up );
//Heightmap
float scale = 60./HMX; //Heightmap float scale = 60./HMX;
//Heightmap
for( x = 0; x < HMX-1; x++ ) //Heightmap for( x = 0; x < HMX-1; x++ )
for( y = 0; y < HMY-1; y++ ) //Heightmap for( y = 0; y < HMY-1; y++ )
{ //Heightmap {
float tx = x-HMX/2; //Heightmap float tx = x-HMX/2;
float ty = y-HMY/2; //Heightmap float ty = y-HMY/2;
float pta[3]; //Heightmap float pta[3];
float ptb[3]; //Heightmap float ptb[3];
float ptc[3]; //Heightmap float ptc[3];
float ptd[3]; //Heightmap float ptd[3];
//Heightmap
float normal[3]; //Heightmap float normal[3];
float lightdir[3] = { .6, -.6, 1 }; //Heightmap float lightdir[3] = { .6, -.6, 1 };
float tmp1[3]; //Heightmap float tmp1[3];
float tmp2[3]; //Heightmap float tmp2[3];
//Heightmap
RDPoint pto[6]; //Heightmap RDPoint pto[6];
//Heightmap
pta[0] = (tx+0)*scale; pta[1] = (ty+0)*scale; pta[2] = Heightmap[(x+0)+(y+0)*HMX]*scale; //Heightmap pta[0] = (tx+0)*scale; pta[1] = (ty+0)*scale; pta[2] = Heightmap[(x+0)+(y+0)*HMX]*scale;
ptb[0] = (tx+1)*scale; ptb[1] = (ty+0)*scale; ptb[2] = Heightmap[(x+1)+(y+0)*HMX]*scale; //Heightmap ptb[0] = (tx+1)*scale; ptb[1] = (ty+0)*scale; ptb[2] = Heightmap[(x+1)+(y+0)*HMX]*scale;
ptc[0] = (tx+0)*scale; ptc[1] = (ty+1)*scale; ptc[2] = Heightmap[(x+0)+(y+1)*HMX]*scale; //Heightmap ptc[0] = (tx+0)*scale; ptc[1] = (ty+1)*scale; ptc[2] = Heightmap[(x+0)+(y+1)*HMX]*scale;
ptd[0] = (tx+1)*scale; ptd[1] = (ty+1)*scale; ptd[2] = Heightmap[(x+1)+(y+1)*HMX]*scale; //Heightmap ptd[0] = (tx+1)*scale; ptd[1] = (ty+1)*scale; ptd[2] = Heightmap[(x+1)+(y+1)*HMX]*scale;
//Heightmap
tdPSub( pta, ptb, tmp2 ); //Heightmap tdPSub( pta, ptb, tmp2 );
tdPSub( ptc, ptb, tmp1 ); //Heightmap tdPSub( ptc, ptb, tmp1 );
tdCross( tmp1, tmp2, normal ); //Heightmap tdCross( tmp1, tmp2, normal );
tdNormalizeSelf( normal ); //Heightmap tdNormalizeSelf( normal );
//Heightmap
tdFinalPoint( pta, pta ); //Heightmap tdFinalPoint( pta, pta );
tdFinalPoint( ptb, ptb ); //Heightmap tdFinalPoint( ptb, ptb );
tdFinalPoint( ptc, ptc ); //Heightmap tdFinalPoint( ptc, ptc );
tdFinalPoint( ptd, ptd ); //Heightmap tdFinalPoint( ptd, ptd );
//Heightmap
if( pta[2] >= 1.0 ) continue; //Heightmap if( pta[2] >= 1.0 ) continue;
if( ptb[2] >= 1.0 ) continue; //Heightmap if( ptb[2] >= 1.0 ) continue;
if( ptc[2] >= 1.0 ) continue; //Heightmap if( ptc[2] >= 1.0 ) continue;
if( ptd[2] >= 1.0 ) continue; //Heightmap if( ptd[2] >= 1.0 ) continue;
//Heightmap
if( pta[2] < 0 ) continue; //Heightmap if( pta[2] < 0 ) continue;
if( ptb[2] < 0 ) continue; //Heightmap if( ptb[2] < 0 ) continue;
if( ptc[2] < 0 ) continue; //Heightmap if( ptc[2] < 0 ) continue;
if( ptd[2] < 0 ) continue; //Heightmap if( ptd[2] < 0 ) continue;
//Heightmap
pto[0].x = pta[0]; pto[0].y = pta[1]; //Heightmap pto[0].x = pta[0]; pto[0].y = pta[1];
pto[1].x = ptb[0]; pto[1].y = ptb[1]; //Heightmap pto[1].x = ptb[0]; pto[1].y = ptb[1];
pto[2].x = ptd[0]; pto[2].y = ptd[1]; //Heightmap pto[2].x = ptd[0]; pto[2].y = ptd[1];
//Heightmap
pto[3].x = ptc[0]; pto[3].y = ptc[1]; //Heightmap pto[3].x = ptc[0]; pto[3].y = ptc[1];
pto[4].x = ptd[0]; pto[4].y = ptd[1]; //Heightmap pto[4].x = ptd[0]; pto[4].y = ptd[1];
pto[5].x = pta[0]; pto[5].y = pta[1]; //Heightmap pto[5].x = pta[0]; pto[5].y = pta[1];
//Heightmap
// CNFGColor(((x+y)&1)?0xFFFFFF:0x000000); //Heightmap // CNFGColor(((x+y)&1)?0xFFFFFF:0x000000);
//Heightmap
float bright = tdDot( normal, lightdir ); //Heightmap float bright = tdDot( normal, lightdir );
if( bright < 0 ) bright = 0; //Heightmap if( bright < 0 ) bright = 0;
CNFGColor( 0xff | ( ( (int)( bright * 90 ) ) << 24 ) ); //Heightmap CNFGColor( 0xff | ( ( (int)( bright * 90 ) ) << 24 ) );
//Heightmap
// CNFGTackPoly( &pto[0], 3 ); CNFGTackPoly( &pto[3], 3 ); //Heightmap // CNFGTackPoly( &pto[0], 3 ); CNFGTackPoly( &pto[3], 3 );
CNFGTackSegment( pta[0], pta[1], ptb[0], ptb[1] ); //Heightmap CNFGTackSegment( pta[0], pta[1], ptb[0], ptb[1] );
CNFGTackSegment( pta[0], pta[1], ptc[0], ptc[1] ); //Heightmap CNFGTackSegment( pta[0], pta[1], ptc[0], ptc[1] );
CNFGTackSegment( ptb[0], ptb[1], ptc[0], ptc[1] ); //Heightmap CNFGTackSegment( ptb[0], ptb[1], ptc[0], ptc[1] );
//Heightmap
} //Heightmap }
} //Heightmap }
int HandleDestroy() int HandleDestroy()
@ -280,73 +280,73 @@ void AudioCallback( struct CNFADriver * sd, short * out, short * in, int framesp
} }
*/ */
void MakeNotification( const char * channelID, const char * channelName, const char * title, const char * message ) //notification void MakeNotification( const char * channelID, const char * channelName, const char * title, const char * message )
{ //notification {
static int id; //notification static int id;
id++; //notification id++;
//notification
const struct JNINativeInterface * env = 0; //notification const struct JNINativeInterface * env = 0;
const struct JNINativeInterface ** envptr = &env; //notification const struct JNINativeInterface ** envptr = &env;
const struct JNIInvokeInterface ** jniiptr = gapp->activity->vm; //notification const struct JNIInvokeInterface ** jniiptr = gapp->activity->vm;
const struct JNIInvokeInterface * jnii = *jniiptr; //notification const struct JNIInvokeInterface * jnii = *jniiptr;
//notification
jnii->AttachCurrentThread( jniiptr, &envptr, NULL); //notification jnii->AttachCurrentThread( jniiptr, &envptr, NULL);
env = (*envptr); //notification env = (*envptr);
//notification
jstring channelIDStr = env->NewStringUTF( ENVCALL channelID ); //notification jstring channelIDStr = env->NewStringUTF( ENVCALL channelID );
jstring channelNameStr = env->NewStringUTF( ENVCALL channelName ); //notification jstring channelNameStr = env->NewStringUTF( ENVCALL channelName );
//notification
// Runs getSystemService(Context.NOTIFICATION_SERVICE). //notification // Runs getSystemService(Context.NOTIFICATION_SERVICE).
jclass NotificationManagerClass = env->FindClass( ENVCALL "android/app/NotificationManager" ); //notification jclass NotificationManagerClass = env->FindClass( ENVCALL "android/app/NotificationManager" );
jclass activityClass = env->GetObjectClass( ENVCALL gapp->activity->clazz ); //notification jclass activityClass = env->GetObjectClass( ENVCALL gapp->activity->clazz );
jmethodID MethodGetSystemService = env->GetMethodID( ENVCALL activityClass, "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;"); //notification jmethodID MethodGetSystemService = env->GetMethodID( ENVCALL activityClass, "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;");
jstring notificationServiceName = env->NewStringUTF( ENVCALL "notification" ); //notification jstring notificationServiceName = env->NewStringUTF( ENVCALL "notification" );
jobject notificationServiceObj = env->CallObjectMethod( ENVCALL gapp->activity->clazz, MethodGetSystemService, notificationServiceName); //notification jobject notificationServiceObj = env->CallObjectMethod( ENVCALL gapp->activity->clazz, MethodGetSystemService, notificationServiceName);
//notification
// create the Notification channel. //notification // create the Notification channel.
jclass notificationChannelClass = env->FindClass( ENVCALL "android/app/NotificationChannel" ); //notification jclass notificationChannelClass = env->FindClass( ENVCALL "android/app/NotificationChannel" );
jmethodID notificationChannelConstructorID = env->GetMethodID( ENVCALL notificationChannelClass, "<init>", "(Ljava/lang/String;Ljava/lang/CharSequence;I)V" ); //notification jmethodID notificationChannelConstructorID = env->GetMethodID( ENVCALL notificationChannelClass, "<init>", "(Ljava/lang/String;Ljava/lang/CharSequence;I)V" );
jobject notificationChannelObj = env->NewObject( ENVCALL notificationChannelClass, notificationChannelConstructorID, channelIDStr, channelNameStr, 3 ); // IMPORTANCE_DEFAULT //notification jobject notificationChannelObj = env->NewObject( ENVCALL notificationChannelClass, notificationChannelConstructorID, channelIDStr, channelNameStr, 3 ); // IMPORTANCE_DEFAULT
jmethodID createNotificationChannelID = env->GetMethodID( ENVCALL NotificationManagerClass, "createNotificationChannel", "(Landroid/app/NotificationChannel;)V" ); //notification jmethodID createNotificationChannelID = env->GetMethodID( ENVCALL NotificationManagerClass, "createNotificationChannel", "(Landroid/app/NotificationChannel;)V" );
env->CallVoidMethod( ENVCALL notificationServiceObj, createNotificationChannelID, notificationChannelObj ); //notification env->CallVoidMethod( ENVCALL notificationServiceObj, createNotificationChannelID, notificationChannelObj );
//notification
env->DeleteLocalRef( ENVCALL channelNameStr ); //notification env->DeleteLocalRef( ENVCALL channelNameStr );
env->DeleteLocalRef( ENVCALL notificationChannelObj ); //notification env->DeleteLocalRef( ENVCALL notificationChannelObj );
//notification
// Create the Notification builder. //notification // Create the Notification builder.
jclass classBuilder = env->FindClass( ENVCALL "android/app/Notification$Builder" ); //notification jclass classBuilder = env->FindClass( ENVCALL "android/app/Notification$Builder" );
jstring titleStr = env->NewStringUTF( ENVCALL title ); //notification jstring titleStr = env->NewStringUTF( ENVCALL title );
jstring messageStr = env->NewStringUTF( ENVCALL message ); //notification jstring messageStr = env->NewStringUTF( ENVCALL message );
jmethodID eventConstructor = env->GetMethodID( ENVCALL classBuilder, "<init>", "(Landroid/content/Context;Ljava/lang/String;)V" ); //notification jmethodID eventConstructor = env->GetMethodID( ENVCALL classBuilder, "<init>", "(Landroid/content/Context;Ljava/lang/String;)V" );
jobject eventObj = env->NewObject( ENVCALL classBuilder, eventConstructor, gapp->activity->clazz, channelIDStr ); //notification jobject eventObj = env->NewObject( ENVCALL classBuilder, eventConstructor, gapp->activity->clazz, channelIDStr );
jmethodID setContentTitleID = env->GetMethodID( ENVCALL classBuilder, "setContentTitle", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;" ); //notification jmethodID setContentTitleID = env->GetMethodID( ENVCALL classBuilder, "setContentTitle", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;" );
jmethodID setContentTextID = env->GetMethodID( ENVCALL classBuilder, "setContentText", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;" ); //notification jmethodID setContentTextID = env->GetMethodID( ENVCALL classBuilder, "setContentText", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;" );
jmethodID setSmallIconID = env->GetMethodID( ENVCALL classBuilder, "setSmallIcon", "(I)Landroid/app/Notification$Builder;" ); //notification jmethodID setSmallIconID = env->GetMethodID( ENVCALL classBuilder, "setSmallIcon", "(I)Landroid/app/Notification$Builder;" );
//notification
// You could do things like setPriority, or setContentIntent if you want it to do something when you click it. //notification // You could do things like setPriority, or setContentIntent if you want it to do something when you click it.
//notification
env->CallObjectMethod( ENVCALL eventObj, setContentTitleID, titleStr ); //notification env->CallObjectMethod( ENVCALL eventObj, setContentTitleID, titleStr );
env->CallObjectMethod( ENVCALL eventObj, setContentTextID, messageStr ); //notification env->CallObjectMethod( ENVCALL eventObj, setContentTextID, messageStr );
env->CallObjectMethod( ENVCALL eventObj, setSmallIconID, 17301504 ); // R.drawable.alert_dark_frame //notification env->CallObjectMethod( ENVCALL eventObj, setSmallIconID, 17301504 ); // R.drawable.alert_dark_frame
//notification
// eventObj.build() //notification // eventObj.build()
jmethodID buildID = env->GetMethodID( ENVCALL classBuilder, "build", "()Landroid/app/Notification;" ); //notification jmethodID buildID = env->GetMethodID( ENVCALL classBuilder, "build", "()Landroid/app/Notification;" );
jobject notification = env->CallObjectMethod( ENVCALL eventObj, buildID ); //notification jobject notification = env->CallObjectMethod( ENVCALL eventObj, buildID );
//notification
// NotificationManager.notify(...) //notification // NotificationManager.notify(...)
jmethodID notifyID = env->GetMethodID( ENVCALL NotificationManagerClass, "notify", "(ILandroid/app/Notification;)V" ); //notification jmethodID notifyID = env->GetMethodID( ENVCALL NotificationManagerClass, "notify", "(ILandroid/app/Notification;)V" );
env->CallVoidMethod( ENVCALL notificationServiceObj, notifyID, id, notification ); //notification env->CallVoidMethod( ENVCALL notificationServiceObj, notifyID, id, notification );
//notification
env->DeleteLocalRef( ENVCALL notification ); //notification env->DeleteLocalRef( ENVCALL notification );
env->DeleteLocalRef( ENVCALL titleStr ); //notification env->DeleteLocalRef( ENVCALL titleStr );
env->DeleteLocalRef( ENVCALL activityClass ); //notification env->DeleteLocalRef( ENVCALL activityClass );
env->DeleteLocalRef( ENVCALL messageStr ); //notification env->DeleteLocalRef( ENVCALL messageStr );
env->DeleteLocalRef( ENVCALL channelIDStr ); //notification env->DeleteLocalRef( ENVCALL channelIDStr );
env->DeleteLocalRef( ENVCALL NotificationManagerClass ); //notification env->DeleteLocalRef( ENVCALL NotificationManagerClass );
env->DeleteLocalRef( ENVCALL notificationServiceObj ); //notification env->DeleteLocalRef( ENVCALL notificationServiceObj );
env->DeleteLocalRef( ENVCALL notificationServiceName ); //notification env->DeleteLocalRef( ENVCALL notificationServiceName );
//notification
} //notification }
void HandleThisWindowTermination() void HandleThisWindowTermination()
{ {
@ -516,7 +516,7 @@ uint32_t randomtexturedata[256*256];
int main( int argc, char ** argv ) int main( int argc, char ** argv )
{ {
int x, y; //Heightmap int x, y;
double ThisTime; double ThisTime;
double LastFPSTime = OGGetAbsoluteTime(); double LastFPSTime = OGGetAbsoluteTime();
@ -527,11 +527,11 @@ int main( int argc, char ** argv )
HandleWindowTermination = HandleThisWindowTermination; HandleWindowTermination = HandleThisWindowTermination;
for( x = 0; x < HMX; x++ ) //Heightmap for( x = 0; x < HMX; x++ )
for( y = 0; y < HMY; y++ ) //Heightmap for( y = 0; y < HMY; y++ )
{ //Heightmap {
Heightmap[x+y*HMX] = tdPerlin2D( x, y )*8.; //Heightmap Heightmap[x+y*HMX] = tdPerlin2D( x, y )*8.;
} //Heightmap }
//A-s-s-e-t-s const char * assettext = "Not Found,2"; //A-s-s-e-t-s const char * assettext = "Not Found,2";
//A-s-s-e-t-s AAsset * file = AAssetManager_open( gapp->activity->assetManager, "asset.txt", AASSET_MODE_BUFFER ); //A-s-s-e-t-s AAsset * file = AAssetManager_open( gapp->activity->assetManager, "asset.txt", AASSET_MODE_BUFFER );
@ -563,10 +563,10 @@ int main( int argc, char ** argv )
int i; int i;
iframeno++; iframeno++;
if( iframeno == 200 ) //notification if( iframeno == 200 )
{ //notification {
MakeNotification( "default", "rawdraw alerts", "rawdraw", "Hit frame two hundred\nNew Line" ); //notification MakeNotification( "default", "rawdraw alerts", "rawdraw", "Hit frame two hundred\nNew Line" );
} //notification }
CNFGHandleInput(); CNFGHandleInput();
//SENSORSTURFF AccCheck(); //SENSORSTURFF AccCheck();
@ -582,7 +582,7 @@ int main( int argc, char ** argv )
// Mesh in background // Mesh in background
CNFGSetLineWidth( 9 ); CNFGSetLineWidth( 9 );
DrawHeightmap(); //Heightmap DrawHeightmap();
CNFGPenX = 0; CNFGPenY = 400; CNFGPenX = 0; CNFGPenY = 400;
CNFGColor( 0xffffffff ); CNFGColor( 0xffffffff );
//A-s-s-e-t-s CNFGDrawText( assettext, 15 ); //A-s-s-e-t-s CNFGDrawText( assettext, 15 );
@ -594,27 +594,27 @@ int main( int argc, char ** argv )
CNFGDrawText( st, 10 ); CNFGDrawText( st, 10 );
CNFGSetLineWidth( 2 ); CNFGSetLineWidth( 2 );
// Square behind text //texts // Square behind text
CNFGColor( 0x303030ff ); //texts CNFGColor( 0x303030ff );
CNFGTackRectangle( 600, 0, 950, 350); //texts CNFGTackRectangle( 600, 0, 950, 350);
//texts
CNFGPenX = 10; CNFGPenY = 10; //texts CNFGPenX = 10; CNFGPenY = 10;
//texts
// Text //texts // Text
CNFGColor( 0xffffffff ); //texts CNFGColor( 0xffffffff );
for( i = 0; i < 1; i++ ) //texts for( i = 0; i < 1; i++ )
{ //texts {
int c; //texts int c;
char tw[2] = { 0, 0 }; //texts char tw[2] = { 0, 0 };
for( c = 0; c < 256; c++ ) //texts for( c = 0; c < 256; c++ )
{ //texts {
tw[0] = c; //texts tw[0] = c;
//texts
CNFGPenX = ( c % 16 ) * 20+606; //texts CNFGPenX = ( c % 16 ) * 20+606;
CNFGPenY = ( c / 16 ) * 20+5; //texts CNFGPenY = ( c / 16 ) * 20+5;
CNFGDrawText( tw, 4 ); //texts CNFGDrawText( tw, 4 );
} //texts }
} //texts }
// Green triangles // Green triangles
CNFGPenX = 0; CNFGPenX = 0;