Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - spacefractal

Pages: [1] 2 3 ... 12
1
based from this thread:
https://www.glbasic.com/forum/index.php?topic=11565.0

Im have choosen to update and reimplement GameInput to v2.0 beta. In this version the remapping has been totally rewrote and is now supporting gamepads as well keyboards. The formatting of codes is now based on a sdl database, but also added to possible to remap keyboard as well.

to implement to your game, you can do something like this:

Code: (glbasic) [Select]
// top of the code should have those defines:
?IFDEF WIN64
?DEFINE WIN32
?ENDIF

?IFDEF WIN32
?DEFINE DESKTOP
?ENDIF


// start of the code somewhere under loading.
LOCAL SaveFile$=PLATFORMINFO$("DOCUMENTS")+"/Yourgame/Yourgame_AutoSave.ini" // should been APPDATA on other platforms.
IF STEAMDECK=1 // if you want to do that, howover users can quit remapping by mouse button now (you could get stuck).
GameInput.init(SaveController$, 1) // the first two devices should not been possible to been remapped on steamdeck.
ELSE
GameInput.init(SaveController$, -1) // if you dont want possible to remap keyboard, set it to 0.
ENDIF

// Somewhere in the game input code.
// actuelley does nothing now on Windows, but only on Android.
LOCAL profilechanged=GameInput.update()

IF GameInput.Remap_IsRemapping()=1 // the function is doing remapping, dont do any game code
LOCAL result=GameInput.Remap_ScanCode() // return a sound/visual effect.
IF result=1 THEN SoundPlay("selectlevel")
IF result=2 THEN SoundPlay("confirmlevel")
RETURN
ENDIF

// polling input from the api (incude keyboard) example. far from all games should do this.
IF ISPAUSE OR S_Status$<>"play"
GameInput.EnableKeyboard(TRUE)
ELSE
GameInput.EnableKeyboard(FALSE) // in some cases, you dont want keyboard remapped ingame.
ENDIF

// This is something like that when you want to poll a joystick. In PowerUp Elevation, wbich
// im toke this snippet from, here all sticks controls the bird (include the right one).
LOCAL K1, K2, K3, K4, KJ
LOCAL Players=GameInput.GetNumberOfPlayers()

GameInput.SetDeadZone(0, 0.6) // analoge as digital with 0.6 as deadzone.
FOR i=0 TO Players-1
//IF GameInput.GetControllerName$(i)<>""
IF Players>0 // could been 0 on Android, but allways a least 1 on Windows throught as first player is on keyboard.

KL=KL+GameInput.Left(i)+GameInput.LeftStick_Left(i)+GameInput.RightStick_Left(i); IF KL>1 THEN KL=1
KR=KR+GameInput.Right(i)+GameInput.LeftStick_Right(i)+GameInput.RightStick_Right(i); IF KR>1 THEN KR=1
KU=KU+GameInput.Up(i)+GameInput.LeftStick_Up(i)+GameInput.RightStick_Up(i); IF KU>1 THEN KU=1
KD=KD+GameInput.Down(i)+GameInput.LeftStick_Down(i)+GameInput.RightStick_Down(i); IF KD=1 THEN KD=1

IF GameInput.ActionButton("A", i) OR GameInput.ActionButton("B", i) THEN KJ=1
IF GameInput.ActionButton("X", i) OR GameInput.ActionButton("Y", i) THEN KJ=1
IF GameInput.LeftTrigger(i) OR GameInput.ActionButton("RB", i) THEN KJ=1
IF GameInput.RightTrigger(i)=1 OR GameInput.ActionButton("LB", i) THEN TURNED=1

LOCAL SE=GameInput.ActionButton("select", i); // AB cab been swapped on some controllers
LOCAL PA=GameInput.ActionButton("parent", i); // AB cab been swapped on some controllers
ENDIF
NEXT

// somewhere in the menu to start the remap
// First argument, is if you want keyboard remapped or not.
IF OPTIONSELECTNAME$="remap"
// this is a full remap for a game controller, but only required buttons for keyboard.
// if a game controller dont have all buttons, the user will escape.
// if you dont want a full remap for a controller, you can remove those you dont uses.
GameInput.Remap_Start(0,"back:back/pause|*,start:start|*,leftx:Left Stick|Movement,a:Face Bottom|Jump,b:Face Right|Turn,x:Face Left|*,y:Face Up|*,leftshoulder:Back Left Top|*,rightshoulder:Back Right Top|*,LeftTrigger:Back Left Bottom|*,RightTrigger:Back Right Bottom|*,dpdown:Dpad Down|*,dpright:Dpad Right|*,dpup:DPad Up|*,dpleft:DPad Left|*,rightx:Right Stick|*,leftstick:Left Stick|*,rightstick:Right Stick|*")
ENDIF

// somewhere to print, when under remapping (allways max 3 lines)
// also escape or back button will allways quit remapping with no save.
IF GameInput.Remap_IsRemapping()=1
LOCAL line$=GameInput.Remap_GetText$(1)
BMFont.DrawText(line$, 0, PY+PH+SCALING*70, SIN(FADING*90)*1, SIN(FADING*90)*0.5*2, 0, -1, -2)

line$=GameInput.Remap_GetText$(2)
IF line$<>"" THEN BMFont.DrawText(line$, 0, PY+PH+SCALING*75, SIN(FADING*90)*1, SIN(FADING*90)*0.5*2, 0, -1, -2)

line$=GameInput.Remap_GetText$(3)
IF line$<>"" THEN BMFont.DrawText(line$, 0, PY+PH+SCALING*80, SIN(FADING*90)*1, SIN(FADING*90)*0.5*2, 0, -1, -2)

RETURN
ENDIF

this code is only tested on Windows, while the code for Android is there, im have nowhere tested it at all. Its might or might not work, or not compile at all. No idea. Im have still yet to update Android Studio, if im want to do that.

PS. PowerUp Elevation has been updated on steam, which uses this api (that game became test game).

2
Those who have Swicth Pro controller. Can you checking which buttons that does that.

Etc im need the name of it, and how and which axis the right controller and the both analoge triggers does.

Im purchased such of one you can see, but that controller did not have the analoge trigger, but a digital trigger instead (not a issue in such a game that is not racing really). Im wasent aware of that of course, but im implementated this feature of course.

Im do believe they follow the ps layout button wise, not xbox. Then im will update my GameInput thing for Windows.

4
Im just got my Steam Deck recently. There is a issue with the MUSIC commands as this start a fullscreen window, that cover up the gameplay window, cause the games unplayable. So im have in this case choosen to uses samples as music and forgoe saving disk space for tunes.

This can seen on all my games, but im did do managed to fix Greedy Mouse and Spot Race. Both games run nicely on the Steam Deck and both updated to the official version.

Now im need to fix the rest, so they dont uses any MUSIC commands. But we might need to implement either bass or fmod, so they can been used when found? here im dont care about older versions really.

A Direct linux build is NOT required for this device. Only PLAYMUSIC and such commands failed.

5
Off Topic / Glbasic to Nintendo Switch?
« on: 2022-Jul-15 »
Micheal Ware has just got approvede Nintendo Switch devkit portal access and im also getting a DevKit as well.

Im wonder if im can get Glbasic run on a Nintendo Switch? Could been cool. Long time im used glbasic (as my focus has and is still with Spectrum Next and other none computer stuff).

6
Hi im is back again and we have a strange issue we needs too at as im not sure what happens?

Currectly glbasic compiles, run, compile, run twice (and closing the previous app). Im have newer seen this bug before.

7
Off Topic / Where has im been
« on: 2021-Jul-05 »
as some of you might notice as im have not been on the forum in a while (dispite im did do checks here and there).

The reasons is im currectly have various Spectrum Next projects with Rusty Pixels those time, so im have not code that much or could help. Currectly we trying to do Baggers in Space - Detour finished in time (most is done) and a Tyvarian 2 game, named "Tyvarian - To the Victor the Spoils".

For more info about those two projects is on the Kickstart update here:
https://www.kickstarter.com/projects/spectrumnext/zx-spectrum-next-issue-2/posts/3224494


8
When im building windows 32 binary files from _build.bat. The _build.bat compiles its self fine, but im got a wast of about 50 errors when trying to compile from IDE.

Its look like you somehow have mixed 64 and 32 bit code?

Gernot, im have uploaded the source code to steam again, but im do have password protected that branch, this is due this issue and would make sure we both has been sync correctly. You can get the password from the SteamWorks as this is not hidden there, but for users.

Of course im wont share the password here and you are fell free to change it eventuelly.

9
Currectly im have no idea why this happens, but a app can crash out on a backbuffer flip after you have minimized the app.

Etc im tried do this:

Code: (glbasic) [Select]
void OpenGLRainbows::PrepareBackbuffer() {
#if defined(TINYGL) || defined(TRENKI3D)
                                                                                                                            if (m_Surface[0].m_Height) {
m_Surface[0].MemCpyToScreen();
} else {
if (m_bHasClearColor) {
Screen.Clear();
}
}
#ifdef TRENKI3D
if (m_bDirtyZBuffer) {
m_bDirtyZBuffer=false;
Screen.ClearZBuffer();
}
#endif
#else
#ifdef PALM_WEBOS
#endif
#ifdef GLB_SURFACE_OLDSCHOOL
                                                                                                                            if (m_Surface[0].usex>0) {
if (m_bDirtyZBuffer) {
m_bDirtyZBuffer=false; glClear(GL_DEPTH_BUFFER_BIT);
}
PasteSurface(0);
} else if (m_bHasClearColor || m_bDirtyZBuffer) {
GLbitfield bits=0;
if (m_bHasClearColor)  { bits |= GL_COLOR_BUFFER_BIT; }
if (m_bDirtyZBuffer) { bits |= GL_DEPTH_BUFFER_BIT;  m_bDirtyZBuffer=false; }
glClear(bits);
}
#else
    g_debug("PrepareBackbuffer start");
    if (m_BackSurfaceSpriteID[0] != -1) {
        g_debug("1");
        PasteSurface(0);
        g_debug("2");
    } else if (m_bHasClearColor || m_bDirtyZBuffer) {
        g_debug("11");
        GLbitfield bits = 0;
        g_debug("12");
        if (m_bHasClearColor) { bits |= GL_COLOR_BUFFER_BIT; }
        g_debug("13");
        if (m_bDirtyZBuffer) {
            bits |= GL_DEPTH_BUFFER_BIT;
            m_bDirtyZBuffer = false;
        }
        g_debug("14");
        glClear(bits);

    }
#endif
#endif
    g_debug("PrepareBackbuffer end");
}

but got a logcat like this:
Code: (glbasic) [Select]
I/glbasic: [GLB]->loop start() after SHOWSCREEN
    [GLB]->loop start()
I/glbasic: [GLB]->loop start() before SHOWSCREEN
    __g_paused: 0 0
    FlipScreens before
    FlipScreens
    1
    PrepareBackbuffer start
    11
    12
    13
    14
I/glbasic: OnPause()
    glbasicOnPause
V/SDL: onPause()
V/SDL: nativePause()
V/SDL: surfaceDestroyed() start
I/SDL: surfaceDestroyed() end
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4 in tid 21728 (SDLThread), pid 21683 (ractal.spotrace)
V/SDL: onWindowFocusChanged(): false

And now, removeing glClear(bits) diddent help a test, then its just crashout in a another place in the function.

10
GLBasic - en / Chromebook support coming soon
« on: 2020-Mar-24 »
Glbasic coming soon to Chromebook,

Even i is inquired after a crash, im did do work slowly today.

- Im just got keybaord with most keys remapped to pc scancodes (not all was possible, most of them)
- mouse and primary touchpad (one finger by now) include hover. Pointer is still there thought.
- You can even detect a chromebook from PLATFORMINFO$()
- Android Studio is of course required and is enabled by adding this to manifest.xml:
Code: (glbasic) [Select]
    <uses-feature android:name="android.hardware.type.pc" android:required="false" />
- howover resize window wont been supported and is chrashing out, but app just works fine in fullscreen.
- some keys is remapped to different pc style on a chromeos keybaord:
ESCAPE is F1 and Forward is F2 and Refresh is F3.
- Landscape is required as minimum supports! That one im have is required!
The reason is im did not want to conflict escape button to the back button.

No idea about release date, but im slow in the moment.



12
STEAM ONLY

Enable Beta in the steam:
- Right Click on Glbasic in library.
- Click on Properties.
- Click on betas.
- Select "beta - beta builds".

Im still use beta for the version im do, even after a official release when Gernot release that as official (im only release beta versions). This so its possibe to eventuelly do a roolback when testing is required before a release.

First a bit of warning:
This is for the steam version of glbasic. Im cannot garentee its works on Glbasic 15 or below, so im only checked with code from Glbasic 16. Im do no longer uses external downloads.

Here is what that is fixed (listed here as official 16.507 release):
- The theme has been changed a bit, so its now launch in a pure black screen.
- Various new arguments added to androidmanifest.xml, strings.xml and some changes to other xml files (themes).
- Surface might not allways have whole screen! That could causes game not been placed in center correctly. This is fixed.
- navigationbar enabled by default! See next post about it.
- Admob has been more integrated! Admob is optional, not required!
- JOY() commands works much better in this version! Multiply gamepads is even supported!
- You can now use Tilt and Orientation using JOY() commands as well a Android TV remote.
- Assest loading should works much better since SETCURRENTDIR() now finally works correctly between c++ and java. That means c++ does no longer needs to try to guess the path anymore. This is include both relative as well full path using GETCURRENTDIR$()
- Keyboard, Touchpad (one finger) and Mouse (include right button) is now supported for ChromeBook!
- Keyboard can been mapped for pc style scankey layout for most keys. disabled by default. Set it in Strings.xml
- ChromeBook can been detected by PLATFORMINFO$("DEVICE") as well AndroidTV. "Keyboard" tag here is depreacted as im allways hated it and diddent make sense at all!
- Fullscreen is required on ChromeBook! So keep android:resizeableActivity="false" in manifest!

Property other small fixes as well!

Android 6 required!
Android 6 and better is required. Its look like its a grandle issue that cause its dont support png and jpg files in Android 5. Im cant do anything with it at all. So Dont ask me about it. But if you do NOT use png and jpg files at all, then you should been possible to support Android 5. Its depend of game of course.

Can im update Android Studio
Also you can SAFELY update your Android Studio, that include buildtools. But you should stays on the Grandle version we using, currectly version 3.4.1. So dont update the project its self when Android Studio is asking about it to your glbasic project!

13
Now im is fully back to get my stuff working again with Android Studio. Genius Greedy Mouse is all running again (but still yet to been submitted). Now im missing to do rest of the games im have did past on the day.

The games im have done in glbasic is those:

Genius Greedy Mouse
Karma Miwa
Catchout
Spot Race
PowerUp Elevation
The Beagle Jam

Im plans to do all 6 games back to Google Play, all free and some games with ads (not all).

14
GLBasic - en / Cleaning up sticky threads
« on: 2020-Feb-12 »
Im have choosen to unsticky 4 old unrelevant Android threads, but added a new one that is for the v16.

Im wiill not touch the stores sticky theads, even some of them cant been supported anymore. The reason: Its fun to see what people have done back in time, so im see no reason to do it.

If im do, im would make sure to do similar with the old android stuff sticky thread, so they can easy to been found.

15
GLBasic - en / Old Android Sticky Stuff
« on: 2020-Feb-12 »
Im will unsticky various Android Stuff as they are very old or not required anymore after move to Android Studio. Im sticky this soon that collect those old threads and locking it:

AndroidExtras and iOS/tvOS updates + Download Links:
https://www.glbasic.com/forum/index.php?topic=9644.0

This is for glbasic 15 and below only and im will no longer support it at all.



LibPng security Fix - If Google Reject it:
https://www.glbasic.com/forum/index.php?topic=10801.msg95702#msg95702

This wont been happens in Android Studio of course. This was fixed long time ago.



How to use ADB:
https://www.glbasic.com/forum/index.php?topic=8200.0

This is not relevant anymore when using Android Studio. Its much easier here.



Android debug certificate has expired:
https://www.glbasic.com/forum/index.php?topic=8023.0

This is very old issue that should long time to fixed and is not relevant with Android Studio at all


Pages: [1] 2 3 ... 12