error when compiling for iphone

Previous topic - Next topic

baicskillet

I was just tried to compile a program I made for the iphone. I sent the /xcode folder it generated with all the contents to a friend that has a mac with the sdk installed.  He told me it compiled, but there was nothing on the screen, only a small rectangle.  I'm thinking probably I placed the .bmp files elsewhere and not in the correct folder. I put them in the "media" folder. Or, hmm, does the iphone require .png files?

trucidare

place your .bmp or .png into media folder, set the currentdir to Media, after that you can load with LOADSPRITE "test.bmp",0
compile for iphone, copy the files from your media into XCode/GLBasic/Media compile on mac and voila.
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

baicskillet

what's the command to set the currentdir to Media? Do i save the project in that folder?

Hark0

#3
Quote from: baicskillet on 2010-Jul-20
what's the command to set the currentdir to Media? Do i save the project in that folder?

Code (glbasic) Select
SETCURRENTDIR("Media")
Graficos_Mapa$=GETCURRENTDIR$()+"map/Tiles_Map_TileStudio_001.png"
LOADANIM Graficos_Mapa$,0,46,46


and...

You have this:

//appname.app
appname.exe (Win32)

iPhone-Info.plist... (and other Xcode files for iphone in xcode//glbasic// folder)
     
    //Media
          //Map
          Tiles_Map_TileStudio_001.png


I hope help you.  :)
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

baicskillet

I just added these two lines from your posting:

SETCURRENTDIR("Media")
Graficos_Mapa$=GETCURRENTDIR$()

Then i compiled to iphone, and the output was a folder with an icon.png, iphone-info.plist, iphoneprefix,
and a media, class, xcodepr, and lib folders. I hope that's the right output.

Slydog

I'm just starting to figure this out for myself, finally.

QuoteSETCURRENTDIR("Media")
Graficos_Mapa$=GETCURRENTDIR$()+"map/Tiles_Map_TileStudio_001.png"

Couldn't the 2nd line just be written as (because you are already in the 'current' folder):
Code (glbasic) Select
Graficos_Mapa$="map/Tiles_Map_TileStudio_001.png"

baicskillet, did you copy / create a 'Media' folder to the xCode project location?
It may not do this automatically.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

mykyl66

Make sure you actually copy the files needed into the xcode/glbasic/media directory. Glbasic doesnt move them itself. You have to manually do it yourself.

Cheers

Mike R

msx

Tengo el mismo problema, he activado el SETCURRENDIR("Media") y he cargado los Sprites con LOADSPRITE y GRABSPRITE. Si lo compilo para Windows funciona perfectamente, con los .bmp y .png en la carpeta Media, sin embargo en el IPhone no me los muestra, y tengo copiado los ficheros en la carpeta Media también. ¿Alguna idea?.

Translate by Google:
I have the same problem, I activated the SETCURRENDIR ("Media") and loaded the Sprites with LOADSPRITE and GRABSPRITE. If I compile for Windows works seamlessly with the .bmp and .png files in the Media folder, but the iPhone is not shown to me, and I have copied the files into the Media folder as well. Do you can help me?.

Thank you

Ian Price

#8
What do you mean by "iPhone is not shown to me"? Are you saying that the sprites don't show on your iPhone, or that the iPhone is not detected in XCode?

Do you have an Apple developer license? I don't think you can transfer to an iDevice without one. Dunno.

If you have got a license, have you set up the certificates properly (developer and distribution - or whatever they are called). Are they still valid? If you haven't set them up and have trouble, then please PM me, as I have a very useful PDF guide that'll help.


Another thing, if everything else is set up, does text show up on the screen, or primitive drawing commands? If so, then it would seem that the media is either not in the right place or your paths might not be right. If you are getting no images at all on your iPhone, then something is obviously very amiss.


Maybe some more info is required.
I came. I saw. I played.

msx

I have all the certificates and I transferred my program to my iPhone, but instead of displaying sprites appear black squares.

Ian Price

So it's trying to display something (over a non-black background, I presume). That's odd, as it would suggest that the sprites, or something, has loaded and are in memory, otherwise nothing would be displayed.

Are you willing to post your source and sprites (or a cut down version that does the same as what you are experiencing)? Perhaps two (or more) sets of eyes looking at it will identify and solve the problem quicker than one pair of eyes and lots of guessing.
I came. I saw. I played.

msx

#11
I'll post the piece of code that I think may be important to solve my problem, the full code is too long and I do not want to be public.

Code (glbasic) Select
// --------------------------------- //
// Project: XXX
// Start: Thursday, January 01, 1970
// IDE Version: 8.078


SETCURRENTDIR("Media") // seperate media and binaries?

.......


//Creamos SPRITES de movimiento Enemigo hacia derecha
LOADBMP ""
LOADSPRITE "Enemigo.bmp",0
ID=101
FOR I=0 TO -234 STEP -29.25
INC ID
CLEARSCREEN
DRAWRECT 0,0,30,31, RGB(255,0,128)
DRAWSPRITE 0,I,0
GRABSPRITE ID,0,0,30,31
NEXT

........

DRAWSPRITE 102,XDIR,YDIR //

.......



I explained that everything is working correctly in windows.

Ian Price

I can see what you are doing with this code.

Anyway there are several areas that jump out -

You don't need to use CLEARSCREEN in the FOR/NEXT loop. The DRAWRECT should cover up any sprite remains.

That floating value in the FOR/NEXT loop is pretty nasty and may cause inaccuracies.

Using the GRABSPRITE on iPhone does not work unless in portrait mode. I presume what you are trying to do is display the loaded sprite disappearing off the left of the screen, grabbing it and storing it as individual sprites. If this is the case, then i can;t see any obvious problems, other than those identified above.

I created a similar piece of code that does what I think you are trying to do.

Code (glbasic) Select


GLOBAL ID

ID=101


// Create sprite #1
DRAWRECT 0,0,32,32,RGB(255,0,0)
GRABSPRITE 1,0,0,32,32


// For/Next loop
FOR I=0 TO -235 STEP -4

  // Draw pink masking background rectangle
  DRAWRECT 0,0,30,31, RGB(255,0,128)

  // Draw sprite #1 (red rectangle) at position I,0
  DRAWSPRITE 1,I,0

  // Grab portions of sprite #1
  GRABSPRITE ID,0,0,30,31

  // Increase the grabbed sprite number
  INC ID

NEXT


// repeat until ESC pressed
WHILE TRUE

// Make all-white screen
DRAWRECT 0,0,640,480,RGB(255,255,255)

// Draw the grabbed sprites
FOR n=101 TO 130
  DRAWSPRITE n,100,(n-100)*34
NEXT

// Display screen and clean backbuffer
SHOWSCREEN

WEND


I'll try it on iPhone later (once you confirm that this is what you are trying to do), but I expect it to work.
I came. I saw. I played.

msx

#13
I'm using GRABSPRITE in Landscape Mode. I tried using a red rectangle instead of a BMP image but my iPhone still shows a black rectangle. I try to record a video to show it.



http://www.youtube.com/watch?v=CWhjSXveLJw


msx

#14
¡¡SOLVED!!

:enc: :enc:

And I do not know how I did it. I think the problem was that I did not copy the XCode folder correctly.

Thanks for your patience.  :booze:

P.D.: or maybe I have now compiled the project with the latest version of GLBasic