updated readme
[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 The above are "shortcuts" in the main makefile. The real android makefile is
40 `Makefile.android`. Some operations might have to be performed using that one.
41 For instance to clean and rebuild all libraries:
42
43     make -f Makefile.android clean-libs
44     make -f Makefile.android libs
45
46 Or to monitor the android log stream:
47
48     make -f makefile.android logcat
49
50
51 PC version build
52 ----------------
53 On UNIX and windows under msys2, just type `make`. No external dependencies are
54 needed, everything is included in the source tree.
55
56 For msys2 builds, start either a "mingw32 console" or a "mingw64 console", to
57 have the environment set up correctly to build native 32bit or 64bit binaries.
58 Do not start an "msys2 console"; that's for building with the UNIX system call
59 emulation layers linked to the binary (similar to old cygwin).
60
61 Alternatively msvc2022 project files are included, configured to build for
62 64bit x86. Warning: msvc project files might be out of date. If you encounter
63 unresolved symbols, make sure to add any new source files to the project.
64
65 Hacking
66 -------
67
68 ### Demo screens (parts/subparts)
69 To add a new "screen", add one or more source files under `src/scr`. Each screen
70 should define a function called `regscr_<name>` which calls `dsys_add_screen`
71 with a pointer to a private `demoscreen` structure, to register the screen with
72 the demosystem. The screen structure contains the screen name, and a number of
73 function pointers for screen callbacks (See `src/demosys.h`). At least the
74 `init` and `draw` callbacks need to be non-null.
75
76 To override the demoscript and work on a single screen, add the line
77 `screen = <name>` in the `demo.cfg` file. Events defined in the demoscript will
78 still be available.
79
80 ### Asset loading
81 Loading data files need to use the functions in `assfile.h`, because on android
82 the data files are in the apk, not on the filesystem. Functions to load textures
83 and shaders are provided in `assman.h`.
84
85 ### OpenGL compatibility
86 Only the subset of OpenGL calls which are part of OpenGL ES 2.0 should be used.
87 There are helper functions in `sanegl.h` to bring back some of the missing
88 functionality, namely immediate mode rendering (with quads), and a matrix
89 stack.