Menu

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.

Show posts Menu

Messages - S.O.P.M.

#61
Have to say sorry, my understanding for mathematics is quite limited so programming can easily become a running the gauntlet for me. Finally I found the right formula and my checkerboard background can be drawn correctly:

Code (glbasic) Select

FOR i = 0 TO 16 STEP 16
    FOR j = 0 TO 16 STEP 16
        FOR k = 0 TO 7
            FOR l = 0 TO 7
                Ima[(i * 32) + j + (k * 32) + l] = 0xFF444444
                Ima[(i * 32) + 8 + j + (k * 32) + l] = 0xFF323232
                Ima[256 + (i * 32) + j + (k * 32) + l] = 0xFF323232
                Ima[256 + (i * 32) + 8 + j + (k * 32) + l] = 0xFF444444
            NEXT
        NEXT
    NEXT
NEXT


But one thing I noticed though. Normally the color value 0x222222 that I used is clearly visible. In this case, if I set it as 0xFF222222 for MEM2SPRITE I got black pixels. Why?

[EDIT]

Fortunately this method works on Android nice and smooth, so it's an acceptable solution for me, even if a bit unlikely. Please pardon the inconvenience!
#62
Oh...

Now I try the MEM2SPRITE method and have much trouble to get the formula right to bring a set of the checkerboard pattern into the data matrix. I thought to make 32x32 pixel sprites from it so I've to create a set of 4x4 of these 8x8 pixel squares. This is the current function:

Code (glbasic) Select
SUB ChessBoard:
STATIC ini%
LOCAL Ima%[]
LOCAL x%, y%
x = GetWindowXPosition(1)
y = GetWindowYPosition(1)
IF ini = 0
ini = 1
REDIM Ima[1024]
FOR i = 0 TO 31 STEP 16
FOR j = 0 TO 31 STEP 16
FOR k = 0 TO 7
FOR l = 0 TO 7
Ima[(i * 32) + j + (k * 32) + l] = 0xFF444444
NEXT
NEXT
NEXT
NEXT
MEM2SPRITE(Ima[], 1, 32, 32)
DIM Ima[0]
ENDIF
FOR i = 0 TO BasScrHei STEP 32
FOR j = 0 TO BasScrWid STEP 32
DRAWSPRITE 1, x + j, y + i
NEXT
NEXT
ENDSUB


The result you can see in the screenshot. So far all right. I've marked the pattern set this function creates. Now I've to place another 3 squares right from, below and diagonal right/below of the first one. But no matter how I change the formula
Code (glbasic) Select
(i * 32) + j + (k * 32) + l the result is absolutely wrong. To my understanding the formula to place one more square right of in the matrix should be
Code (glbasic) Select
(i * 32) + j + 16 + (k * 32) + l but it isn't.
#63
Yes, that's no question. But it's absolutely necessary. Every good app you want to offer should handle different screen resolutions. And I honestly can't imagine that any other scaling technology than the one using virtual screens is as efficient and easy to use for the programmer. But please put it right if you know the truth ;)

Ok, the new results are somewhat disappointing. I tried to reduce the realtime mathematics and was able to notice a small difference. A little bit more speed but still much too slow. Then I tried to draw the same checkerboard by using POLYVECTOR. No difference, almost same load.

Then I was happy to find this method:

Code (glbasic) Select
SUB ChessBoard:
STATIC ini%
LOCAL x%, y%
x = GetWindowXPosition(1)
y = GetWindowYPosition(1)
IF ini = 0
ini = 1
DRAWRECT 0, 0, BasScrWid, BasScrHei, 0x222222
FOR i = 0 TO BasScrHei STEP 16
FOR j = 0 TO BasScrWid STEP 16
DRAWRECT 0 + j, 0 + i, 8, 8, 0x444444
DRAWRECT 8 + j, 8 + i, 8, 8, 0x444444
NEXT
NEXT
GRABSPRITE 1, 0, 0, BasScrWid, BasScrHei
ELSE
DRAWSPRITE 1, x, y
ENDIF
ENDSUB


It works pretty nice under Win32, got similar low load as on other screens/windows. But then the disappointment when running on Android: The grabbed sprite is completely white. So I assume GRABSPRITE isn't working properly on Android, currently. Or is there something that I've missed?
#64
Great hints! Thanks a lot. Had really not such ideas before even if it sounds quite plausible once adverted :)

Will test it out and give feedback about the results. I confirm, virtual screens are working fine on Android, my application uses it to fit on all resolutions.
#65
Ok guys, I found the issue. It's the sub that draws the chessboard background! Under Win32 I checked the CPU load while running the application and the window with that background caused around 40% cpu load. By removing that drawing function I saved 30% load! This is the function:

Code (glbasic) Select
SUB ChessBoard:
LOCAL x%, y%
x = GetWindowXPosition(1)
y = GetWindowYPosition(1)
FOR i = 0 TO BasScrHei / 16
FOR j = 0 TO BasScrWid / 16
DRAWRECT x + 0 + j * 16, y + 0 + i * 16, 8, 8, 0x444444
DRAWRECT x + 8 + j * 16, y + 8 + i * 16, 8, 8, 0x444444
NEXT
NEXT
ENDSUB


BasScrHei = 512 and BasScrWid = 1024 so we have 64 x 32 x 2 = 4096 DRAWRECT calls. Each rect with a size of 8 x 8 pixels. I was not expecting this to cause so much ressources...
What do you think, is this usual?
Now how about a good workaround? To host this repetitive 1024 x 512 pixel background as a graphic file would be very unprofessional. I would like to draw it once and then save it during run time. Hopefully GRABSPRITE will work... or how would you do that?
#66


Hello, please watch this short demonstration. This is my current project. For several reasons I've written my own window- and gadget-management that fits my purposes perfectly. The game itself is already there but I've to rebuild the user interface with a new level editor. Design comes later. Anyway, I've no clue at the moment, why everything is running so slowly, the old application reached 60 fps on Android easily.

The window management works as follows. Windows are defined via functions and stored in arrayed types. Then there's a window list to define the order all opened windows will be displayed. Only windows that can be visible will be drawn so for performance reasons it's basically not necessary to close each window when a new one is completely in front of the other. There can be subs that are appended to each window and will be called via the CALLBYNAME command.

Is it known that this command causes trouble under Android? At least I've never used it before.

Also each window has it's own gadget list that tells the window drawing routine which gadgets has to be drawn within a window. And there's a buffer for a window background- and foreground drawing routine. Gadgets will drawn between. Finally each window has a function list that contains all functions that are executed before everything will be drawn. These functions can be triggered by changing window state slots.

Unfortunately I cannot show you the full source code because the project shall go a little beyond the hobby state, let's say.

Any suggestions what could cause the speed issue? Note the sudden speed gain when the world overview window is opened. And I can tell you for sure, all other windows are still there...
#67
Just now I've found out some really curious thing. Have to make a video to demonstrate that... it could be app itself but I've absolutely no clue what causes this speed issue. Some part of the app is running absolutely fine but I know what it's happing in the background so this is quite odd...

[Edit] Well... will refer to a new topic because it doesn't really fit longer here.

http://www.glbasic.com/forum/index.php?topic=10011.0
#68
Many thanks for your reply! It's very appreciated. Now I did a fresh install of GLB, Java and AE. Finally I got almost everything to work as before. Interestingly the glbasic_debug.apk file is about 1 MB smaller. I guess this is because of the latest Java JDK.

One bad thing remains: My app runs extremely slow on my mobile Android device (Android 4.3). I think I've not more than 10 fps. Before it was stable at 60 fps. Can anyone confirm this? Should I install an older Java JDK again or maybe there's another reason for this? My Java version is now jdk1.8.0_20.
#69
I have massive problems using the new AE and/or Android compiling doesn't work anymore for me since I updated something. First I updated GLB via web update to 12.308. Then I got the full version from AE here, DOWNLOAD LINK REMOVED, installed it. After that I got the following Java SDK: http://www.computerbild.de/download/Java-SDK-SE-32-Bit-3685826.html, installed it.

I followed the new instructions in the Android Extras for glbasic.chm file of AE. Android.init() first, then Android.Check_Asset() instead of Check_Asset() alone. More functions of AE I don't use actually. I included all three .gbas files AndroidExtras.gbas, Funcs_General.gbas, interstitial.gbas, of course.

First, the compiler told me that GLB_ON_PAUSE is not defined so I commented it out in the interstitial.gbas file. Then I got this huge list of errors and warnings from the compiler:

Code (glbasic) Select
_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.10.053 SN:fc8586fd - 2D, NET
"AndroidExtras.gbas"(23) warning : GPC1003 Demo mode: This command would require "GLBasic SDK premium"  : IMPORT
Wordcount:3332 commands
compile+link:

running glb_build.bat
Using ANDROID_TARGET="android-18"
You can use "C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\glb_android_build.bat" to change the API level and SDK path.
%ANDROIDSDK% not set. Using GLBasic's default target-18, Android 4.3

Checking Icons (uses 'AndroidExtras_icons_X.png' For changes)....
C:/Program Files (x86)/GLBasic/projects/mario/distribute/Android
C:/Program Files (x86)/GLBasic/projects/mario/icon_ouya_AndroidExtras.png is missing (732x412 size)
the Ouya icon is not important, if you dont want to support the console
Checking Icons Finished...

BUILD STAGE 2: Start compiler (android.bat)
R:\Compiler\platform\android\bin\..\android-sdk-windows
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
Updated project.properties
Updated local.properties
Updated file C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\build.xml
Updated file C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\proguard-project.txt
Updated project.properties
Updated local.properties
Updated file C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\bin\build.xml
Updated file C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\bin\proguard-project.txt
.
BUILD STAGE 3: Build a debug build
   [subant] No sub-builds to iterate on
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:381: error: cannot find symbol
    [javac] if (shop.mOuyaFacade.isRunningOnOUYASupportedHardware()==true) // we are on Ouya?
    [javac]                     ^
    [javac]   symbol:   method isRunningOnOUYASupportedHardware()
    [javac]   location: variable mOuyaFacade of type OuyaFacade
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:384: error: cannot find symbol
    [javac] OuyaInputMapper.init(this);
    [javac] ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:551: error: cannot find symbol
    [javac] { OuyaInputMapper.shutdown(this);
    [javac] ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:713: error: cannot find symbol
    [javac] if (OuyaInputMapper.shouldHandleInputEvent(keyEvent)==true) {
    [javac]     ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:715: error: cannot find symbol
    [javac] { return OuyaInputMapper.dispatchKeyEvent(this, keyEvent);
    [javac]        ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:723: error: cannot find symbol
    [javac] if (OuyaInputMapper.shouldHandleInputEvent(motionEvent)==true) {
    [javac]     ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:724: error: cannot find symbol
    [javac] return OuyaInputMapper.dispatchGenericMotionEvent(this, motionEvent);
    [javac]        ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\GameControllers.java:307: error: cannot find symbol
    [javac] { OuyaController.ButtonData buttonData = OuyaController.getButtonData(Button);
    [javac]               ^
    [javac]   symbol:   class ButtonData
    [javac]   location: class OuyaController
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\GameControllers.java:307: error: cannot find symbol
    [javac] { OuyaController.ButtonData buttonData = OuyaController.getButtonData(Button);
    [javac]                                                      ^
    [javac]   symbol:   method getButtonData(int)
    [javac]   location: class OuyaController
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\GameControllers.java:416: error: cannot find symbol
    [javac] try { OuyaController.showCursor(false); } catch(NullPointerException e) { }
    [javac]                     ^
    [javac]   symbol:   method showCursor(boolean)
    [javac]   location: class OuyaController
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\Shop.java:193: error: cannot find symbol
    [javac] String PriceText = p.getFormattedPrice();
    [javac]                     ^
    [javac]   symbol:   method getFormattedPrice()
    [javac]   location: variable p of type Product
    [javac] Note: C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 11 errors
    [javac] 3 warnings

BUILD FAILED
R:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:720: The following error occurred while executing this line:
R:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:734: Compile failed; see the compiler error output for details.

Total time: 6 seconds
.
BUILD STAGE 4: Build a release build
   [subant] No sub-builds to iterate on
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:381: error: cannot find symbol
    [javac] if (shop.mOuyaFacade.isRunningOnOUYASupportedHardware()==true) // we are on Ouya?
    [javac]                     ^
    [javac]   symbol:   method isRunningOnOUYASupportedHardware()
    [javac]   location: variable mOuyaFacade of type OuyaFacade
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:384: error: cannot find symbol
    [javac] OuyaInputMapper.init(this);
    [javac] ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:551: error: cannot find symbol
    [javac] { OuyaInputMapper.shutdown(this);
    [javac] ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:713: error: cannot find symbol
    [javac] if (OuyaInputMapper.shouldHandleInputEvent(keyEvent)==true) {
    [javac]     ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:715: error: cannot find symbol
    [javac] { return OuyaInputMapper.dispatchKeyEvent(this, keyEvent);
    [javac]        ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:723: error: cannot find symbol
    [javac] if (OuyaInputMapper.shouldHandleInputEvent(motionEvent)==true) {
    [javac]     ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java:724: error: cannot find symbol
    [javac] return OuyaInputMapper.dispatchGenericMotionEvent(this, motionEvent);
    [javac]        ^
    [javac]   symbol:   variable OuyaInputMapper
    [javac]   location: class SDLActivity
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\GameControllers.java:307: error: cannot find symbol
    [javac] { OuyaController.ButtonData buttonData = OuyaController.getButtonData(Button);
    [javac]               ^
    [javac]   symbol:   class ButtonData
    [javac]   location: class OuyaController
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\GameControllers.java:307: error: cannot find symbol
    [javac] { OuyaController.ButtonData buttonData = OuyaController.getButtonData(Button);
    [javac]                                                      ^
    [javac]   symbol:   method getButtonData(int)
    [javac]   location: class OuyaController
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\GameControllers.java:416: error: cannot find symbol
    [javac] try { OuyaController.showCursor(false); } catch(NullPointerException e) { }
    [javac]                     ^
    [javac]   symbol:   method showCursor(boolean)
    [javac]   location: class OuyaController
    [javac] C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\Shop.java:193: error: cannot find symbol
    [javac] String PriceText = p.getFormattedPrice();
    [javac]                     ^
    [javac]   symbol:   method getFormattedPrice()
    [javac]   location: variable p of type Product
    [javac] Note: C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android\src\com\glbasic\test\SDLActivity.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 11 errors
    [javac] 3 warnings

BUILD FAILED
R:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:720: The following error occurred while executing this line:
R:\Compiler\platform\android\android-sdk-windows\tools\ant\build.xml:734: Compile failed; see the compiler error output for details.

Total time: 4 seconds
Picked up _JAVA_OPTIONS: -Xms256m -Xmx512m
.
HOW TO INSTALL? Install by invoke this command:
"R:\Compiler\platform\android\bin\..\android-sdk-windows\platform-tools\adb.exe" install -r "C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android/bin/glbasic-debug.apk"
.
HOW TO SIGN? Sign it by invoke this command:
"R:\Compiler\platform\android\bin\glb_code_sign.bat" "C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android"
.
Android=C:\Program Files (x86)\GLBasic\projects\mario\distribute\Android
erfolgreich
_______________________________________
*** Fertig ***
Dauer: 31.7 sek. Zeit: 09:53
Erstellen: 1 erfolgreich.

Am I right that the cannot find symbol hints are not really important and only about the icons?

Using GLBasic's default target-18, Android 4.3 is not good, right?

Fact it, it doesn't write any new apk file. It seems something with the Java SDK went completely wrong. To ensure it's not something set wrong with AE, I tried to compile a project that doesn't use AE. I got all the same errors and warnings.

I'm so disappointed about myself not to understand the technical backgrounds of all this, with the result not to really know what to do and why.
#71
Okay! So I'll await an answer from him. Also it would be from interest to make it as a deal. The reason is I need the IMPORT command which my version only support as a demo. In those days I only purchased the 2D/NET feature of GLBasic. I still don't need the 3D commands so a cut-price upgrade would be nice.
#72
Gernot, thank you for the new update! Have tested the compiling behaviour just now, this is some pleasant improvement. I'm quite happy at the moment. Now I can change strings without the initial waiting time. Also it seems to compile a bit faster in general. Good work!

Where can I donate?
#73
Quote from: GernotOr maybe the new pandora drivers? I will have to dig into this. And it sounds like a lot of work :(

This is exactly what I'm afraid of...

Even these niches-platforms let GLBasic development become a running the gauntlet. Not that I wouldn't have confidence in Gernot's capability. It's just that I would love to see GLBasic's future to be ensured.

Please excuse myself for this, I simply couldn't resist to express discontent. Enough from my part here.
#74
Gah! Fortunately I don't use the Open Pandora since a long time - the performance was never too good on this device. Please don't get me wrong but I'm absolute for it to cancel the support for some platforms to clean up GLBasic for the future. GLBasic is already quite overloaded and the more it supports the more sources of error are there. All these platforms can never be perfectly supported simultaneously. So keep Win, Linux, iOS, Android, HTML5 but throw out most of the rest.
#75
Okay! It would be nice, though, if on the main page you could exactly see what version is offered. Just to mention.