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

Topics - spicypixel

I am using GLB v14. I have copied the platform files to the relevant program files sub directory within glb (although extracting the platform zips with 7zip was strange). However on compilation I get the relevant folder and sub folders however there is no media in the files whatsoever????

This was the output from my Mac compile. Which seemed to compile but as I say no media in the media directory????

Code (glbasic) Select

*** Configuration: OS-X_X86 ***
GPC - GLBasic Precompiler V.10.037 SN:429c3389 - 3D, NET
Wordcount:82 commands
cygwin warning:
  MS-DOS style path detected: C:\Users\tGerk\GLBasic\Samples\_Projects_\Pong\MacIcon.icns
  Preferred POSIX equivalent is: /cygdrive/c/Users/tGerk/GLBasic/Samples/_Projects_/Pong/MacIcon.icns
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
Using icns type 'ic09' (ARGB) for 'C:\Users\tGerk\GLBasic\Samples\_Projects_\Pong\tmpMacIcon.png'
Saved icns file to C:\Users\tGerk\GLBasic\Samples\_Projects_\Pong\MacIcon.icns
Creating .app for Pong
run: "Q:\Tools\Icons.exe" "C:\Users\tGerk\GLBasic\Samples\_Projects_\Pong\icon.png" /MACOSX
*** Finished ***
Elapsed: 10.3 sec. Time: 13:55
Build: 1 succeeded.
This is a pseudo-random-number-generator which I'd really like to test out in GLB. My math knowledge is poor so thought I'd post this little function to see if anyone can answer my question regarding converting it to GLB. It's just the math section that needs doing really the results can be DEBUG output rather than printed (as per the example).

Code (glbasic) Select

//by default these are 0
global BSDState
global MSState

for i = 1 to 10
    print randBSD()

for i = 1 to 10
    print randMS()

function randBSD:
    randBSD = (1103515245 * BSDState + 12345) mod (2 ^ 31)
    BSDState = randBSD

function randMS:
    MSState = (214013 * MSState + 2531011) mod (2 ^ 31)
    randMS = integer(MSState / 2 ^ 16)
Something to wile away those hours and infuriate you with every collision  :rant:

Android (FREE with IAP)
Android Extras is awesome but...... Can I compile the example to run under Windows without _android_javacall error and have the build failed?? I really want to work with the new version but unless I can implement it to compile under a development environment (win) then its annoying. An older version of AE had stub functions to allow Windows compilation, is there a similar sample we can see :)

Pretty Please :D
Is there a way we can directly grab a file from a remote http location and download it to our app (to be saved). Useful for PNGs etc., but far better for map data. I can get html info from a php or html file using NETWEB commands but I want the actual byte or word data from a specific file. This was pretty straightforward in blitz using Streams and Banks to create a http_get function. But can't get my head around it in GLB.

This is the nonsense I have so far for testing.

Code (glbasic) Select


GLOBAL host$
host$ = ""

GetWebFile ("index.php", "savedfilename_unused.php")


FUNCTION GetWebFile: srcfilename$, destfilename$
LOCAL init_tcp%, web_file%, msg$

init_tcp% = SOCK_INIT()
web_file% = SOCK_TCPCONNECT(host$, 80)

SOCK_TCPSEND (web_file%, "GET /" + srcfilename$ + " HTTP/1.1")
SOCK_TCPSEND (web_file%, "Host: " + host$)
SOCK_TCPSEND (web_file%, "User-Agent: Android App")
SOCK_TCPSEND (web_file%, "Accept: */*")
SOCK_TCPSEND (web_file%, "")

SOCK_RECV (web_file%, msg$, 1024)
DEBUG "MSG: " + msg$ + "\n"


Here is a working Blitz Basic Routine for anyone interested...
Code (glbasic) Select

Function GetWebFile (srcfilename$, destfilename$)
www = OpenTCPStream (host$, 80)
If www=0 Then Print "Failed to connect": Return 0

Print "Downloading '"+srcfilename$+"' from "+host$

get$="GET /" + srcfilename$ + " HTTP/1.1"
WriteLine www, get$ ; GET / gets default page...
WriteLine www, "Host: " + host$
WriteLine www, "User-Agent: Overlord Client"
WriteLine www, "Accept: */*"
WriteLine www, ""

; Find Number of bytes to read in header data
bytesToRead = 0
header$ = ReadLine (www)
If Left (header$, 16) = "Content-Length: " Then bytesToRead = Right (header$, Len (header$) - 16)
Until header$ = "" Or (Eof (www))
If bytesToRead = 0 Then CloseTCPStream www: Return 0

save = WriteFile (destfilename$) ; Create new file to write downloaded bytes into
If save = 0 Then CloseTCPStream www: Return 0

ReadBytes tempstorage,www,0,bytesToRead
WriteBytes tempstorage,save,0,bytesToRead ; download-to-file
FreeBank tempstorage
CloseFile save

CloseTCPStream www
Return 1
End Function
I seem to be doing my own personal Android flooding here at the moment :) However I'd very much like to know how I can target SDK 16 instead of the default SDK8 API 2.2. I have updated the SDK's within the pre-installed Android SDK that comes with GLB12 and having changed glb_build.bat to reference 16 as my target and then being prompted to download Apache Ant, which I did and extracted in the ant folder. I managed to reduce my errors however still no SDK upgrade working.

I have since removed the ant files that were extracted and set the SDK back to 8 in glb_build.bat but can't now compile there either so a reinstall of glb12 is needed now it would seem :)

Before I start messing about with things I don't understand again lol, can someone give me some tips or better still a walkthrough of how I can achieve this. I'm hoping to use SDK 16 to see if it fixes sound latency with 4.1.2 instead of the default 2.2 api.

Many Thanks in advance O' wondrous community :D
I am getting very confused that the only version of GLB that works at all for Android regarding sound is Version 10 (and there's latency on the sfx there too). GLB v11 and v12 both fail BIGTIME in playing WAV or OGG files. I have created an APK using GLB 10 that works fine albeit the latency which I believe is a java android issue anyway, although I have a Sony Xperia SP on 4.1.2 so I would have though that would have been fixed by now so is this latency a GLB issue instead?

Working fine on GLB 10
Music: OGG 44100Hz, 96Kbs (low but fine), Mono, 16Bit
SFX: WAV 44100Hz, Mono, 16Bit

Unless I'm creating a Charlie Chaplin game I might be struggling with v11 & v12, unless anyone can tell me different lol :D
It seems that Kitty has removed the tiny media copying (please wait loading...) type iconography from the V11 beta, not sure if V12 is the same I can't compile to Android with it :) However this post I wanted to offer some pixel artwork which can be used freely by kitty, or indeed if he can come up with an idea to allow us to use our own animation instead to depict this media copying on an Android apps first install and run delay period which is presently depicted with a black screen.

8 frames of animation 64x64 pixel dimensions, png alpha and only 8kb overhead ;)

It's basically unusable as I can't even press cancel on any option, only ok which is pretty annoying. I gave up after about 3 minutes of using it but I will write a full buglist soon. I'm going out shortly but intend to document all the problems as succinctly as I can.
I am looking at rotating the contents of a squarely dimensioned array. So for example if I had the contents shown (as below) for a 4x4 array, how can I go about writing a function to rotate the array clockwise and anti-clockwise. Thoughts?

Code (glbasic) Select



or clockwise

I kinda have the code to display my array in rotated positions (untested but think it's right), but can't get my head around taking my existing array and affecting the contents rather than just how it's depicted lol.

Code (glbasic) Select

FOR Y = 0 TO 7
    FOR X = 0 TO 7
        DRAW [X][Y].FRAME

FOR  X = 0 TO 7
    FOR Y = 7 TO 0


but as I say can't get my head around the rotating of the actual array values. I do realise I need a temporary store but even so my head is imploding, HELP! :D
Just tried today to grab the Java SDK and Oracle want me to register. Errrrrm, how about no thanks :-) So here we have direct links to the various Java SDKs.
I am trying to rotate a sprite the quickest route from its existing angle to a given angle. The issue I'm having is for example if I'm at 45 degrees and I want to rotate to 315 degrees. I presently have something similar to...

Code (glbasic) Select

ANGLE# = 45


Works for lots of cases apart from the 0/360 threshold, anyone have any pseudo-code or suggestions please. It's late might just be my brain at this time :-)
Having put my last two apps online, one a util and the other a game. On both AppStore and PlayStore and getting zero purchases for either it has struck me the importance of Ads and/or InApp purchases. We are competing in a strong marketplace on both stores and having a LITE and FULL just isn't cutting it anymore (imho). Can some of the better coders amongst us collaborate or assist in finding a solution that Gernot can implement into the core of GLB. Adding libs, messing with sdks and adding .mm files is all good and well but personally I feel that GLB would be far more solid if these features were part of the core.

Maybe there is a way to add modules to the core to make things easier for newbies and seasoned pros alike to add functionality. Ultimately the money I've spent and the return I've had just isn't worth it and it would be sad for me to not bother with the AppStore and the PlayStore because ultimately leaving this effectively means leaving GLB and doing something else to make money. Car Boots maybe lol :-)

Just an opinion I'd be happy to hear others thoughts.
Could you please test this apk and let me know if the app is successful in grabbing an image of your general gps location. APK can be downloaded from here

Please find enclosed the source and project files for those wishing to dabble themselves. Please be aware this contains AMPOS zones library, ANDROID_EXTRAS_1.1 functionality and my TinyFramework setup (scaling all devices) so you might have to look at the code in more detail to understand everything but the general usage logic is simple enough.

As this uses AndroidExtras 1.1 to compile this you need to download and follow the instructions for setting up this first.

Once set up enjoy the attached project files and source.
This is my latest creation, which took 2 days to code, pixel and publish :D
I have an input field and enter the value 2.35, this value is stored in a variable# however when I print this number I get 2.349999905. Now this would be fine if I was displaying a sprite on-screen and works fine for the maths within my application...HOWEVER...

I'm using the float 2.35 to represent £2.35 so when it display £2.349999905 after the user inputs £2.35 it's not the best :-) Any idea of a math fix or a money function anyone could post please. This is the final aspect of my app that is preventing me releasing on the PlayStore presently so any help would be appreciated. Crazy to write my app and test it when its complete I know but my framework scales etc so I don't need to worry too much about testing.

Thanks in advance ;)
This is a fairly small framework which allows for scaling on differing devices, there is a texture atlas included which I use for the bitmap printing, and text is scaled in either x/y or both. I have written a couple of button functions which work with scaling also, these include ON_HOVER, ON_CLICK and ON_RELEASE. It includes an independent frame loop for logic and drawing which is delta-timed (grabbed from this forum props for that), and a couple of screens showing menu and gameloop just to demonstrate how it can interact etc..

The demo does very little but it has enough to see how things work, I have ripped most of this code from my current projects and removed unnecessary code, hope you guys like it :-)

** ADDED **
Some math fixes :)
Couple of new Sprite functions (standard sprites not PV's)
Changed demo to show it works with portrait too
Using 1080x1920 as my base gfx now
kept original attachment to see changes and the demo of landscape


I have a function to scale sprites according to a pre-calculated ZOOM factor, and this works quite well for simple sprite blitting. However I have come across the need for an instruction that just doesn't seem to be there. Here is my code for both DRAWSPRITE and DRAWANIM equivalents.

Code (glbasic) Select

// Zoom Scaled DRAWSPRITE Command
LOCAL sizeX, sizeY
GETSPRITESIZE image%, sizeX, sizeY
STRETCHSPRITE image%, (x * ZOOM), (y * ZOOM), (sizeX * ZOOM), (sizeY * ZOOM)

Code (glbasic) Select

// Zoom Scaled DRAWANIM Command
FUNCTION ZDRAWANIM: image%, anim, x, y
LOCAL sizeX, sizeY
GETSPRITESIZE image%, sizeX, sizeY
STRETCHANIM image%, anim, (x * ZOOM), (y * ZOOM), (sizeX * ZOOM), (sizeY * ZOOM)

As you can see I'm using the GETSPRITESIZE for both functions and as expected the size given in the ZDRAWANIM is for the full sprite and not the individual animation sizes. I know the size for the individual animation I want to draw but it seems sensible to have a command to allow functions like this.

Do we need a GETANIMSIZE command or do you have a code alternative?
This is the latest version of my new iOS and Android game, it has since been updated but alas no new video as of yet. Loving GLB :-)
I want to be able to generate my own LOADBMP equivalent background which is generated before my main loop, so that when I use SHOWSCREEN it continually shows my generated image for the background instead of having to use LOADBMP. I've been trying with USESCREEN -1 and then DRAWSPRITE but all I generate is a nice black background :-)