3b1a30c5591d2dc9b608c42586e3fd55345470ea
[andemo] / README.md
1 Untitled android demo
2 =====================
3 This is the source readme file. For the demo info file see <name>.nfo
4
5 Multiplatform demo for Android, GNU/Linux, and Windows.
6
7 Grab data dir from subversion:
8
9   svn co svn://mutantstargoat.com/datadirs/android_demo1 data
10
11
12 License
13 -------
14 Copyright (C) 2022 John Tsiombikas <nuclear@member.fsf.org>
15
16 This demo is free software. Feel free to use, modify, and/or redistribute it
17 under the terms of the GNU General Public License version 3, or at your option
18 any later version published by the Free Software Foundation. See COPYING for
19 details.
20
21
22 Android build
23 -------------
24 Set up the environment with two variables: `SDK` and `NDK` pointing to the
25 directories where the android SDK and NDK are installed. The default paths
26 correspond with the locations debian's package manager installs them after
27 running:
28
29   apt-get install android-sdk android-sdk-platform-23 google-android-ndk-installer
30
31 Also the `AVER` variable can be set to something other than 23 to change which
32 android platform version to use.
33
34   - `make android` to build the apk.
35   - `make install` to install to the connected android device.
36   - `make run` to install and run on the connected android device.
37   - `make stop` to kill the demo forcefully.
38
39 Hacking
40 -------
41 To add a new "screen", add one or more source files under `src/scr`. Each screen
42 should define a function called `regscr_<name>` which calls `dsys_add_screen`
43 with a pointer to a private `demoscreen` structure, to register the screen with
44 the demosystem. The screen structure contains the screen name, and a number of
45 function pointers for screen callbacks (See `src/demosys.h`). At least the
46 `init` and `draw` callbacks need to be non-null.
47
48 Loading data files need to use the functions in `assfile.h`, because on android
49 the data files are in the apk, not on the filesystem. Functions to load textures
50 and shaders are provided in `assman.h`.
51
52 Only the subset of OpenGL calls which are part of OpenGL ES 2.0 should be used.
53 There are helper functions in `sanegl.h` to bring back some of the missing
54 functionality, namely immediate mode rendering (with quads), and a matrix
55 stack.