Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rawdraw text position being move at android #119

Open
salihberat opened this issue Jan 4, 2025 · 3 comments
Open

Rawdraw text position being move at android #119

salihberat opened this issue Jan 4, 2025 · 3 comments

Comments

@salihberat
Copy link

salihberat commented Jan 4, 2025

video link: https://archive.org/details/screen-record-2025-01-05-01-40-12

int (main):

int main()
{
	CNFGSetup( "Example App", 1024, 768 );
	while(CNFGHandleInput())
	{
		CNFGBGColor =  0xc37e68ff;

		short w, h;
		CNFGClearFrame();
		CNFGGetDimensions( &w, &h );

		//Change color to white.
		CNFGColor( 0xffffffff ); 

		CNFGPenX = 100;
		CNFGPenY = 10;
		CNFGDrawText("FOSS Client", 16);

		//Display the image and wait for time to display next frame.
		CNFGSwapBuffers();		
	}
}

why it is moving?

@cnlohr
Copy link
Member

cnlohr commented Jan 5, 2025

For Android, you need to use:

	CNFGSetupFullscreen( "Example App", 0 );

@salihberat
Copy link
Author

salihberat commented Jan 5, 2025

mkdir -p makecapk/lib/armeabi-v7a
/root/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi29-clang -ffunction-sections -Os -fdata-sections -Wall -fvisibility=hidden -fvisibility=hidden -Os -DANDROID -DAPPNAME=\"foss\" -I./rawdraw -I/root/android-sdk/ndk/21.3.6528147/sysroot/usr/include -I/root/android-sdk/ndk/21.3.6528147/sysroot/usr/include/android -I/root/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/root/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android -fPIC -I. -DANDROIDVERSION=29 -mfloat-abi=softfp -m32 -o makecapk/lib/armeabi-v7a/libfoss.so main.c android_native_app_glue.c -L/root/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/29 -Wl,--gc-sections -Wl,-Map=output.map -s -s -lm -lGLESv3 -lEGL -landroid -llog -lOpenSLES -shared -uANativeActivity_onCreate

main.c:516:2: warning: implicit declaration of function 'CNFGSetupFullScreen' is invalid in C99 [-Wimplicit-function-declaration]
        CNFGSetupFullScreen( "FOSS Client", 0);
        ^
1 warning generated.

Push is succesfull, but application is directly crashing

int(main)

int main()
{
	CNFGSetupFullScreen( "FOSS Client", 0 );
	while(CNFGHandleInput())
	{
		CNFGBGColor =  0xc37e68ff; //Background color

		short w, h;
		CNFGClearFrame();
		CNFGGetDimensions( &w, &h );

		//Change color to white.
		CNFGColor( 0xffffffff ); 

		CNFGPenX = 100;
		CNFGPenY = 10;
		CNFGDrawText("FOSS Client", 16);

		//Display the image and wait for time to display next frame.
		CNFGSwapBuffers();		
	}
}

@salihberat
Copy link
Author

used libraries

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "os_generic.h"
#include <GLES3/gl3.h>
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
#include <android_native_app_glue.h>
#include <android/sensor.h>
#include <byteswap.h>
#include <errno.h>
#include <fcntl.h>
#include "CNFGAndroid.h"

//#define CNFA_IMPLEMENTATION
#define CNFG_IMPLEMENTATION
#define CNFG3D

//#include "cnfa/CNFA.h"
#include "CNFG.h"

#define WEBVIEW_NATIVE_ACTIVITY_IMPLEMENTATION
#include "webview_native_activity.h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants