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 - Crivens

Pages: 1 2 [3] 4
GLBasic - en / iPhone lighting
« on: 2011-Aug-28 »
Ok so I'm using 3D (Entity system found on forum) in my latest game and so far so good.

I then tried a bit of lightning which worked fine on the PC and on WebOS. I've included images that show no light used, standard light (255,255,255), and blue light (0,0,255). No worries really. Code was pretty much EntityCreateLight(RGB(255,255,255)) (with changes for blue light and not used at all for no light) with a move afterwards although that makes no difference to the problem it seems.

Then I tried on iOS (3GS and 4G Touch). Everything is too bright. And on the blue light is much too blue. If I reduce the brightness (say by lowering the colour from (255,255,255) then it just changes the colour but still looks too bright).

I guess I could muck around with the light settings and get it just so for iPhone (everything looks a little higher contrast even with no light on WebOS for example but it's acceptable compared to the serious brightness of the iPhone) but does anyone know if iDevices need different light settings or another command used to keep it in line?

Attached is white light (255,255,255) of PC and iOS. You can see the PC is fine, but the iPhone is much too bright. Both have used lighting as can be seen by shading on the spheres in the background.


[attachment deleted by admin]

GLBasic - en / Resolutions
« on: 2011-Aug-27 »
Is there a way to make a device use it's highest resolution settings?

Currently my project resizes graphics based on a comparison made between the used resolution and a target resolution. I am targeting the retina iOS devices so have the project settings of 640x960. On my iPod 4G no resizing is required but my 3GS shrinks them as the resolution is 4x the pixels less. If I set to 320x480 then the retina device does use that resolution. However I would imagine the iPad will do the same thing as this and stay at 640x960. Not what I want. Needs to use full iPad size.

Ok I could do graphics for the largest display and set to that but I would rather have an option where all devices just use their native resolutions and I can worry about the resizing myself and not worry about setting to the highest resolution setting when things may change in the future.


GLBasic - en / Free phones
« on: 2011-Aug-22 »
Seen this?

Hmm. Don't have time at the minute (at work) to look into more. Anyone want to have a better look and update us?

Also, Gernot, still no chance of Windows 7 phone compilation?

Might just try and get one anyway if it's free...


GLBasic - en / Retina 3D
« on: 2011-Aug-19 »
Ok so I'm almost done putting together a 3D game, using my trusty Pre2 as a test device all along the development cycle. No worries, runs like a charm. Anyway I get to the point where I think I'll try it on an iDevice. Both my 3GS and 2G Touch work brilliantly. This is when compiled for Retina. When it gets to the older devices it obviously isn't doing Retina, and the first time in it resizes all 2D graphics (3D can stay the same) to the correct resolution (code is posted on these forums).

It all works brilliantly. The Pre runs it the smoothest, but the 3GS and even the 2G Touch are pretty close as to not really matter. However when I thought I'd try my 4G Touch (Retina) it looks better (obviously) with the un-resized graphics, but once it gets to the 3D it stutters quite a bit. Now I'm using timer based movement so it can jutter now and again if something is running in the background (fair enough but runs at the correct speed), but it happens all the time. I tried compiling hardcoded to the non-retina resolution and it works fine on the 4G. As smooth as the 3GS.

So is it really that the 4G Touch just doesn't have the speed to run 3D (pretty simple too with not much going on) in full Retina display, or is there something wrong here? And would the iPhone4 be better? Note I am not using up stupid amounts of memory either. It's a pretty simple game. Also is it possible to compile for Retina and then switch to non-retina mid game? So menus all look good and then the main 3D bit (which doesn't benefit too much from Retina) can be in non-retina.


GLBasic - en / Loadanim question
« on: 2011-Aug-12 »
What commands do you use to assign a variable to the ID for LOADANIM? With LOADSPRITE you can use GENSPRITE() to assign the ID, but I couldn't find anything for LOADANIM.


IDE/Syntax / Macro buttons
« on: 2011-Aug-10 »
As we get more and more devices on GLB I am finding my macro bar getting a bit full. For example I use 3 just for iOS (initial full SCP copy, media and libs copy only, and just libs copy) and another for WebOS. That's me full.

I want to get into Android soon, and I assume that can be sped up by using another macro like iOS and WebOS before it. But I have no more macro buttons.

Can we get some more added to the IDE? It would be nice to be able to add new macros and assign them to the toolbar ourselves, but just an increase in the basic 4 would be nice (something like 10 with a rainbow of colours would be pretty good, or the ability to modify the icon ourselves).


Off Topic / Kitty Hello FPS
« on: 2011-Jul-29 »
Hey, Gernot, if you ever plan an FPS then use this gun:-

Had to laugh when I saw that :)

BTW it's a real gun. See


GLBasic - en / Blackberry
« on: 2011-Jul-28 »
I can't find any reference to it, but can you use GLB on Blackberry devices? According to a blog site I saw today they still reckon it is 20% of the US smartphone market so a pretty big deal to develop apps for (WebOS is 2% for instance, iOS 28%, and Android 39%).


Bug Reports / Screen error
« on: 2011-Jul-22 »
I'm getting an error where the screen isn't being cleared each loop like it used to. Identical code running on my Palm Pre from an older GLB version (not sure if was 9 or one of the 10 betas to be honest) worked fine, but now I am getting repeated graphics from previous screens staying on the screen. I can get around it by clearing that area each time, but it definitely didn't used to happen on an older GLB. See the attached pic to see what I mean. It should be just showing the foremost text (5 seconds left and no other text) and nothing else in the last 80 or so pixels (just black in the background).

Note this happens on my Palm Pre as well as my PCs (10.057 and 10.054). I would check my Mac Mini but it's going through installing Lion etc.


[attachment deleted by admin]

Ok, using the standard function to get the mouse coords (the one that's posted everywhere) on the new 10.051 release, updates the active flag, but the X and Y coords are always zero for WebOS (Windows works fine). Incase I was going crazy I tested on 10.042 and it works fine in WebOS with my same code. Not sure if it still works on iOS as I'm informed, by the wife, that my dinner is ready :-[

Oh, and how do I go back a version in GLB? ie. so I can return to 10.042?


Bug Reports / Playmusic loop on Windows
« on: 2011-Jul-15 »
I've got an mp3 that plays fine on both Windows and my Palm Pre 2, and I load it with the command
Code: (glbasic) [Select]
IF ISMUSICPLAYING()=0 THEN PLAYMUSIC "Media/music.mp3",TRUEHowever while the Palm Pre 2 starts repeating the music after it finishes, Windows does not. I'm using GLB 10.042.


GLBasic - en / WebOS gestures
« on: 2011-Jul-13 »
Is there a way to use WebOS gestures in GLB? Specifically the back gesture.

Oh, and nice one on WebOS Gernot. I followed the instructions and wham my whole iOS app works perfectly on my new Palm Pre. Only downside is it seems more sensitive than the iPhone for the touch screen, so I need to adjust a couple of settings. No sweat though.


Bug Reports / IF THEN
« on: 2011-Jun-24 »
I guess this can be argued either way, but in a lot of basic languages I've used in the past then any commands after the THEN of a single line IF are part of the IF. So if you look at this code:-
Code: (glbasic) [Select]
IF a=1
PRINT "1",0,0
PRINT "2",0,10
PRINT "3",0,20

IF a=1 THEN PRINT "1",40,0;PRINT "2",40,10;PRINT "3",40,20

So only 2 and 3 are shown from the IF THEN line. Which is the same as saying:-
Code: (glbasic) [Select]
IF a=1 THEN PRINT "1",40,0
PRINT "2",40,10
PRINT "3",40,20
But from what I've used in the past it shouldn't be. Basically nothing should show as anything on the same line as the IF THEN are part of the single IF statement. Basically ENDIF should be implied at the line feed and not at the end of the first command (ie. the semicolon).


GLBasic - en / Apple store rejection advice
« on: 2011-Jun-24 »
Ok so on some feedback on my original iOS game (Rotaslider) I made a sequel of sorts swapping out kittens and puppies for women in bikinis. Much better idea I think everyone can agree :)

Anyway I just got it rejected (does it always take exactly a week pretty much to the hour?). Ok so it's no major surprise and they point to sexual images etc. Point is though that I did label it as 17+ (laughable when Kays catalogue is more sexy and it's nothing you don't see on a beach). And a bigger point is how come apps like the hooters calendar (where you wipe soap suds off women in bikinis) are allowed, also with a 17+ rating?

All they posted was an image of the level selection screen which to be honest is hardly grumble mag level material. I can post the complete thing if anyone is interested.

So, can anyone give me advise on what to answer with? At the end of the day it's not the end of the world as it wasn't that much work to change the original game, and I'll probably host it somewhere free for the pc if I can't get it on the iPhone. Just sucks a bit is all...


Ok, so you have designed everything to work on an iPhone 4 with retina display. However you want all the graphics to also work on an older iPhone (or any other device really) without having to have the program always load in the full sized graphics using up far more memory than it really needs to use.

So what this routine does is work out the ratio of your current device compared to the target device which you designed all your graphics for. It then (if the ratio is not 1-1) resizes everything to fit the current device and saves into a separate directory (iPhone cannot write to the MEDIA directory by the looks of things) to load forever after. You can get it to rescan everything by using a ver.txt file in the media directory that you load a new value into every time you have new graphics (so just update ver.txt when making an update to the app store and you have changed your graphics). It also uses sprite2mem so all the alpha values of semi transparent graphics can be kept (rather than just resizing and grabbing the sprite again).

That's about it really. I'm sure someone can improve on it (some kind of smoothing operation when it resizes would be good) or point out some bugs as I just knocked it up quickly. Note that jpgs seem to crash it, but I believe this is just a bug in GLB fullstop. The build in font system is also a bit glitchy, but I think it is because mucking about with the built in functionality. Use your own bitmap routine instead basically. Also note it will also scale up. ie. make graphics bigger if on a higher resolution than intended. On a PC you should be really using the target resolution, but if you want to test then keep changing the ver.txt value in media, or for a quicker method removing the ver.txt file from the secondary storage (it's in documents).

Code: (glbasic) [Select]
// --------------------------------- //
// Project: AlphaTest
// Start: Friday, June 03, 2011
// IDE Version: 9.040

SETCURRENTDIR("Media") // Will use this directory if using target device

TYPE tMouse
GLOBAL mouse[] AS tMouse
DIM mouse[5]

SETSCREEN 320,480,0 //Pretend to be an older iPhone - Note should always be the same as target on a PC, but remove/change ver.txt to auto update graphics if choose to test resolutions

GLOBAL dx#,dy#
GLOBAL targetx#=640 //Graphics originally made for
GLOBAL targety#=960 //Retina display iPhone 4
GLOBAL x#;x=dx/targetx //This works as one command with local, not with global however...
GLOBAL y#;y=dy/targety
GLOBAL docdir$;docdir$=PLATFORMINFO$("DOCUMENTS")+"/alphatest-bin" //Has to be different for iPhone as cannot update MEDIA directory
GOSUB remapall

TYPE stype
GLOBAL spr[] AS stype
DIM spr[0]
GLOBAL tspr AS stype

LOADSPRITE "1.png",tspr.s
GETSPRITESIZE tspr.s,tspr.width,tspr.height;tspr.width=tspr.width/x;tspr.height=tspr.height/y
DIMPUSH spr[],tspr
LOADSPRITE "2.png",tspr.s
GETSPRITESIZE tspr.s,tspr.width,tspr.height;tspr.width=tspr.width/x;tspr.height=tspr.height/y
DIMPUSH spr[],tspr

LOADBMP "background.png"
LOADFONT "myfont.png",myfont //Font's dont really work well. Resized ones need to be resaved in a paint package (eg. PSP8) to regain transparency but rarely still looks good. May have to use own routine for text, or just have a few different ones
LOCAL tprint$="0"
LOCAL oprint$=tprint$
LOCAL sloop%

//Remember to show anything using x/y ratios (see below)
FOR sloop=0 TO BOUNDS(spr[],0)-1
IF spr[sloop].visible
DRAWSPRITE spr[sloop].s,x*spr[sloop].x,y*spr[sloop].y
IF mouse[0].active=1 //Click (and hold) on a sprite to see its text
IF mouse[0].x>=spr[sloop].x AND mouse[0].x<=spr[sloop].x+spr[sloop].width AND mouse[0].y>=spr[sloop].y AND mouse[0].y<=spr[sloop].y+spr[sloop].height
PRINT tprint$,x*10,y*10,10

SUB remapall: //Takes all pictures and resizes them for the device being used
IF x<>1 AND y<>1 //If exactly the same then you are using the device made for
LOCAL needresize=1
IF DOESFILEEXIST(docdir$+"/ver.txt") //Must exist in target directory
IF DOESFILEEXIST("ver.txt") //And in media directory
LOCAL file1line$,file2line$
READLINE file1,file1line$
READLINE file2,file2line$
IF file1line$=file2line$ THEN needresize=0
IF needresize=1
LOCAL file$[],num,i
IF num>0
FOR i=0 TO BOUNDS(file$[],0)-1
COPYFILE "ver.txt",docdir$+"/ver.txt"

FUNCTION remapimage:file$ //Takes a picture and resizes it for the device being used
LOCAL rightf$=UCASE$(RIGHT$(file$,3))
IF rightf$="PNG" OR rightf$="BMP" OR rightf$="JPG" //I know it says it can but JPG just doesn't work. Wrong colours and crashes a lot. Use PNG!
LOCAL width,height
LOADSPRITE file$,usesprite
GETSPRITESIZE usesprite,width,height
LOCAL pix%[]
LOCAL ok%=SPRITE2MEM(pix[],usesprite)
LOCAL pix2%[]
LOCAL xwidth%=width*x
IF INTEGER(xwidth)<>xwidth THEN xwidth=INTEGER(xwidth)+1
LOCAL xheight%=height*y
IF INTEGER(xheight)<>xheight THEN xheight=INTEGER(xheight)+1
DIM pix2%[xwidth*xheight]
LOCAL bx,by
FOR xl=0 TO BOUNDS(pix2[],0)-1
LOCAL usesprite2=GENSPRITE()
MEM2SPRITE(pix2[], usesprite2, xwidth, xheight)
SAVESPRITE docdir$+"/"+file$,usesprite2
LOADSPRITE "",usesprite
LOADSPRITE "",usesprite2

FUNCTION debug_out: in$
LOCAL out$
out$="[APP] "+MID$(PLATFORMINFO$("TIME"),11,8) + ": "+ in$+"\n"
DEBUG out$

FUNCTION updateMice:
LOCAL imouse%,mx%, my%, b1%, b2%
FOR imouse% = 0 TO MIN(GETMOUSECOUNT()-1,4)
MOUSESTATE mx%, my%, b1%, b2%


[attachment deleted by admin]

Pages: 1 2 [3] 4