I have been moving home I should have my PC setup tonight I will update the tutorial as soon as I get a chance.
nsw25 said:bWWd said:
nsw25 That's cool man. May I message you to ask about the way you secure the pak file? I have original IP in the work for PC & android (I can let you know in the msg), although android version will be much later in the future, It'd be great to cover the base and know about the solutions.
button attack 0.15 0.1 0.08 2
button jump 0.35 0.1 0.08 2
button special -99 -99 0.08 0
button attack2 -99 -99 0.08 0
button attack3 -99 -99 0.08 0
button attack4 -99 -99 0.08 0
button esc -99 -99 0.08 0
button start 0.1 0.1 0.08 1
button attack 0.15 0.1 0.08 2
button jump 0.35 0.1 0.08 2
button special 0.55 0.1 0.08 2
button attack2 -99 -99 0.08 0
button attack3 -99 -99 0.08 0
button attack4 -99 -99 0.08 0
button esc -99 -99 0.08 0
button start 0.1 0.1 0.08 1
This one says its "texture" command that should be used, strangeThe title says it all. Apparently, uTunnels implemented a configuration text file for use of his Android build called 'touch.txt'. Like the text files we modders commonly edit, touch.txt can also be commented for ease of navigation and stuff.
You can place the touch.txt on either your save folder (/mnt/sdcard/OpenBOR/saves) or if you plan on including it on your pak, you can place it on your data folder of your mod prior to pak-ing it.
Here's the three syntax that touch.txt can detect:
buttons {x} {y} {size} {placement}
This is what we usually modify in touch.txt. This controls the placement of the on screen touch buttons.
Firstly, placement defines what corner do we place the button. For a diagram, here's what uTunnels created in the source code:
0 1
3 2
The reason why I explain placement first is because {x} and {y} are relative to {placement}. For example, if placement is defined 2, then {x} goes from right to left and {y} goes from down to up.
X's range is 0.0 to 1.80 while Y's range is 0.0 to 1.0 (since the screen size is 9:5)
You can adjust size of the button by using {size}. Default is 0.08, which is the comfortable size. I tested using 1.0 and it's gigantic.
surface {path}
You can define your button's appearance using this. The path is relative to the OpenBOR folder path. If you plan to include it to your mod, you should point your touch.txt to point at the data folder. Example:
surface data\yourbutton.png
The button should be in PNG and you need to follow the button template included in the tutorial zip.
screendocking {value}
Screendocking, according to uTunnels' source, is "[changing] screen position to avoid buttons". This is optional since the buttons are already transparent, but you can place it anyway.
Accepted values are left, right, top and bottom
Tip:
If you want to hide a button, you can make the x and y go -99. Not placing graphics on the respective button might hide it, but it can still be detected when pressed.
If you want to center a button, say the screenshot button, you can use x=0.90 and y=0.5
That's all there is to it for touch.txt.
For now I have a zip file template for android porting:
touch.zip - 10.25 KB
The zip file contains the old buttons that was used by uTunnels from his previous commit from the source code. This can be used as a template for your buttons. The zip also has a touch.txt set on a configuration similar to what bWWd had but includes the screenshot and directional buttons configured as well the attack button enlarged a bit.
Thanks for bWWd for pointing this out!
-------Android touch button layout can be customized now using touch.txt, which can be placed in 3 different locations:
1) /mnt/sdcard/OpenBOR/Saves/pakname/touch.txt
2) data/touch.txt
3) /mnt/sdcard/OpenBOR/Saves/touch.txt
1) overrides 2), 2) overrides 3), so 3) can be used as a global setting if you don't want the default layout. The commands:
button {name} {x} {y} {radius} {corner}
{name} is same as its counterpart in menu.txt.
{x} {y} {radius}, coordinations and radius. They should be decimal values, and the actual size is sizexwidthx0.6, see below.
{corner} defines one of the 4 corners your coordinations start from.
0 1
3 2
An example:
button attack 0.6 0.25 0.08 2
Assume your screen resolution is 800x480, the button (center of it) is at (0.6x800x0.6, 0.25x800x0.6)=(288, 120), radius is 38. Because corner is 2(see above), actual position is at (800-288, 480-120)=(512, 360). There is no direct way to center a button though.
To hide a button, just move it out of the screen.
Usually you don't need to change the picture, if you really want to, use texture command:
texture {path}
char buttonpng[99078] = {
0x89, 0x50, 0x4E, 0x47, 0xD, 0xA, 0x1A, 0xA,
0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82
};
DL video Renderer: opengles2
error: Surface doesn't have a colorkey
OpenBoR v3.0 Build , Compile Date: Sep 29 2019
Game Selected: /storage/emulated/0/Android/data/org.bearzz.game/files/Paks/1.0.0.pak
FileCaching System Init...... Enabled
Initializing video............
Reading video settings from 'data/video.txt'.
Colordepth is depreciated. All modules are displayed with a 32bit color screen.
Using debug video mode: 640 x 360
Initialized video............. 640x360 (Mode: 255)
SDL video Renderer: opengles2
error: Surface doesn't have a colorkey
******** An Error Occurred ********
* Shutting Down *
Unable to set video mode: 640 x 360!
Total Ram: 1930194944 Bytes ( 1840 MB )
Free Ram: 136179712 Bytes ( 129 MB )
Used Ram: 128552448 Bytes ( 122 MB )
Release level data...........
Done!
Release graphics data........ Done!
Release game data............
Release game data............ Done!
Release timer................ Done!
Release input hardware....... Done!
Release sound system......... Done!
Release FileCaching System... Done!
************** Done ***************
Unable to set video mode: 640 x 360!