Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain »

Hi,

I n' do not arrive at l' to use last version: it does not have makefile.gen ?

Je souhaite déplacer un sprite.

Code: Select all

// Philippe H. - Toulouse - 25/04/2011
#include "genesis.h"
/* ProgMD/Gendev/include/joy.h 13/01/2007
#ifndef _JOY_H_
#define _JOY_H_


#define JOY_1           0x0000
#define JOY_2           0x0001
#define JOY_3           0x0002
#define JOY_4           0x0003
#define JOY_5           0x0004
#define JOY_6           0x0005
#define JOY_7           0x0006
#define JOY_8           0x0007
#define JOY_NUM         0x0008
#define JOY_ALL         0xFFFF


#define BUTTON_UP       0x0001
#define BUTTON_DOWN     0x0002
#define BUTTON_LEFT     0x0004
#define BUTTON_RIGHT    0x0008
#define BUTTON_A        0x0040
#define BUTTON_B        0x0010
#define BUTTON_C        0x0020
#define BUTTON_START    0x0080
#define BUTTON_X        0x0100
#define BUTTON_Y        0x0200
#define BUTTON_Z        0x0400
#define BUTTON_MODE     0x0800

#define BUTTON_DIR      0x000F
#define BUTTON_BTN      0x0FF0
#define BUTTON_ALL      0x0FFF


#define JOY_SUPPORT_3BTN        0x01
#define JOY_SUPPORT_6BTN        0x02
#define JOY_SUPPORT_MOUSE       0x04
#define JOY_SUPPORT_TEAMPLAY    0x08
#define JOY_SUPPORT_MENACER     0x10
#define JOY_SUPPORT_ANALOGJOY   0x20
#define JOY_SUPPORT_KEYBOARD    0x40


typedef void _joyEventCallback(u16 joy, u16 changed, u16 state);


void JOY_init();

void JOY_setEventHandler(_joyEventCallback *CB);

void JOY_setSupport(u16 port, u16 support);

u16 JOY_readJoypad(u16 joy);

void JOY_waitPressBtn();
void JOY_waitPress(u16 joy, u16 btn);

void JOY_update();


#endif // _JOY_H_
 */
 
/**
 * sprite tile data
 */
 
const unsigned short tiledata_palette[16] = {
	0x0E0E,0x000E,0x0EEE,0x0620,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
};
const unsigned long tiledatb_tiles[512] = {
	0x00000000,	//' Tile #0
	0x00000000,
	0x00000000,
	0x00000000,
	0x00000001,
	0x00000011,
	0x00000111,
	0x00001112,
	0x00011122,	//' Tile #1
	0x00011122,
	0x00111222,
	0x00111222,
	0x00112222,
	0x00112222,
	0x01112222,
	0x01112222,
	0x01112222,	//' Tile #2
	0x01112222,
	0x00112222,
	0x00112222,
	0x00111222,
	0x00111222,
	0x00011122,
	0x00011122,
	0x00001112,	//' Tile #3
	0x00000111,
	0x00000011,
	0x00000001,
	0x00000000,
	0x00000000,
	0x00000000,
	0x00000000,
	0x00000000,	//' Tile #4
	0x00000011,
	0x00111111,
	0x11111111,
	0x11112222,
	0x11222222,
	0x22222222,
	0x22222222,
	0x22222222,	//' Tile #5
	0x22222222,
	0x22222222,
	0x22222222,
	0x22222233,
	0x22222322,
	0x22222232,
	0x22222232,
	0x22222232,	//' Tile #6
	0x22222232,
	0x22222232,
	0x22222223,
	0x22222222,
	0x22222222,
	0x22222222,
	0x22222222,
	0x22222222,//' Tile #7
	0x22222222,
	0x11222222,
	0x11112222,
	0x11111111,
	0x00111111,
	0x00000011,
	0x00000000,
	0x00000000,	//' Tile #8
	0x11000000,
	0x11111100,
	0x11111111,
	0x22221111,
	0x22222211,
	0x22222222,
	0x22222222,
	0x22222222,	//' Tile #9
	0x22222222,
	0x22222222,
	0x22222222,
	0x32222222,
	0x23222222,
	0x23222222,
	0x23222222,
	0x23222222,	//' Tile #10
	0x23222222,
	0x23222222,
	0x32222222,
	0x22222222,
	0x22222222,
	0x22222222,
	0x22222222,
	0x22222222,	//' Tile #11
	0x22222222,
	0x22222211,
	0x22221111,
	0x11111111,
	0x11111100,
	0x11000000,
	0x00000000,
	0x00000000,	//' Tile #12
	0x00000000,
	0x00000000,
	0x00000000,
	0x10000000,
	0x11000000,
	0x11100000,
	0x21110000,
	0x22111000,	//' Tile #13
	0x22111000,
	0x22211100,
	0x22211100,
	0x22221100,
	0x22221100,
	0x22221110,
	0x22221110,
	0x22221110,	//' Tile #14
	0x22221110,
	0x22221100,
	0x22221100,
	0x22211100,
	0x22211100,
	0x22111000,
	0x22111000,
	0x21110000,	//' Tile #15
	0x11100000,
	0x11000000,
	0x10000000,
	0x00000000,
	0x00000000,
	0x00000000,
	0x00000000
};









u16 score;


//ushort i;
//,k=0,scrollx=0,scrolly=0;


//boucle principale

int main()
//ushort i,k=0,scrollx=0,scrolly=0;
{
long xpos=150;
long ypos=124;
long X=16;
long Y=1;
// initialisation du VDP + Joypad
VDP_init();
JOY_init();
// mise en Vram et CRAM des GFX
VDP_setPalette(2, (u16 *) tiledata_palette); 
VDP_DoVRamDMA( (u32) tiledatb_tiles, 32, 512); 



// ******************************
// ******************************
// ******************************
// *******************************


// et on affiche sur l écran ;)
// ushort i,k=0;
// uchar *pb,i;
// pb = 0x40;
// pb += 2;

   /*set the ball sprite data at position (160,0 = 128+160= 288, 128+0= 128), 0xA=0101b=16x16 (sprite size in tiles),
    * 32832 = 32768 + 64 = 1000000000000000b(priority/vflip/hflip) + 1000000b(vram position of tile data)
   VDP_setSprite(0, width/2, 0, 0x5, TILE_ATTR_FULL(PAL0, 0, 0, 0, ballTileIdx) , 1);
   VDP_setSprite(1, width/2, height - border, 0x8,TILE_ATTR_FULL(PAL1, 0, 0, 0, paddletileIdx), 0);
*/
//xpos=100;

//  void VDP_setSprite(u16 index, u16 x, u16 y, u8 size, u16 tile_attr, u8 link)
			VDP_setSprite(0, xpos, 150, 0xF, 0x4000+1, 1);
			VDP_updateSprites();

while (1)
	{
	
	if (BUTTON_RIGHT) // move sprite
		{
		xpos+= 1;
		}
	if (BUTTON_LEFT) // move sprite
		{
		xpos-= 1;
		}
	if (BUTTON_UP) // move sprite
		{
		ypos-= 1;
		}
	if (BUTTON_DOWN) // move sprite
		{
		ypos-= 1;
		}
	if (BUTTON_START) // reset sprite position
		{
		xpos= 150;
		ypos=124;
		}
	JOY_update();
	
	VDP_setSprite(0, xpos, ypos, 0xF, 0x4000+1, 1);
	VDP_updateSprites();
	
	VDP_drawText(APLAN,"Sprite Test", 0x0000, X, Y);
	
	VDP_waitVSync();
	}
} 



Voici l'ancienne version que j'utilise (racine C: ), que j'aimerai remplacer par la nouvelle.
http://www.mirari.fr/WmEw
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Hmm, seems you're not using SGDK correctly ;)
You should read these tutorials :

How to integrate SGDK with Code::Blocks :
http://code.google.com/p/sgdk/wiki/UseSGDKWithCB

And also the "Read the joypad" section of the following link :
http://code.google.com/p/sgdk/wiki/SGDKTutorial
letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain »

Thanks :)


But problem Code::Blocks

make: *** No rule to make target '/lib/sega.o', needed by 'out/rom.out'

http://www.mirari.fr/GmIp


ps: j'ai copié/collé le code hello world 2 dans test.cbp, mais ce n'est peut être pas une bonne idée, hum. Et il y a une différence dans Project build options, donc j'ai fait un screenshot. J'espère que tu aura la solution, car ce que tu propose est vraiment chouette. :)
Last edited by letoulousain on Tue Apr 26, 2011 7:35 pm, edited 1 time in total.
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

The way you set up it is correct. I used an older version of Code::Blocks to make the tutorial, this is, i believe, the only minor difference ;)
letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain »

my version Code::Blocks 10.05
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Tu as bien téléchargé la dernière version de la librarie ?
Car là le problème c'est qu'il te manque le fichier lib/sega.o alors qu'il est bien présent normalement dans l'archive :

http://code.google.com/p/sgdk/downloads/list

Télécharge la dernière version de SGDK à partir du lien ci dessus, apparemment ta version est obsolète et/ou modifiée...
letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain »

Stef wrote:Tu as bien téléchargé la dernière version de la librarie ?
Car là le problème c'est qu'il te manque le fichier lib/sega.o alors qu'il est bien présent normalement dans l'archive :

http://code.google.com/p/sgdk/downloads/list

Télécharge la dernière version de SGDK à partir du lien ci dessus, apparemment ta version est obsolète et/ou modifiée...
J'avais effectivement mis une veille version, désolé ! J'ai mis la nouvelle version, comme tu peux le voir dans l'image ci-dessous:
http://www.mirari.fr/6Jp6
et il y a bien le fichier sega.o dans le dossier lib de gendev.


là, les autres dossiers:
http://www.mirari.fr/jmLW

J'ai hélas toujours le même message:
make: *** No rule to make target '/lib/sega.o', needed by 'out/rom.out'

Le fichier rom.bin doit se créer dans quel dossier quand ça marche sans accroc ?
bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien »

dans le dossier out

as-tu bien définit tes variables d' environnements ?
Tu est sur de ta configuration de Code Blocks ?
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Effectivement ce sont les variables d'environnement qui ne sont pas réglées, j'avais pas vu le "/lib/sega.o"...

Je cite les 2 premières lignes du tutorial pour l'intégration avec Code::Blocks :

Code: Select all

* Define "GDK" environment variable to your installation path in unix path format (example D:/apps/gendev). 
* Define "GDK_WIN" which still point to your installation path but in windows format (exemple D:\apps\gendev).
Voici un lien qui explique comment créer une variable d'environnement :

http://support.microsoft.com/kb/310519/fr
letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain »

bastien wrote:dans le dossier out

as-tu bien définit tes variables d' environnements ?
Tu est sur de ta configuration de Code Blocks ?
oui, enfin je pense. Il doit tout de même manquer un truc.
http://www.mirari.fr/Nxw4

Pour le Debugger, je n'ai pas trouvé le programme gdb.exe
Stef wrote:Effectivement ce sont les variables d'environnement qui ne sont pas réglées, j'avais pas vu le "/lib/sega.o"...

Je cite les 2 premières lignes du tutorial pour l'intégration avec Code::Blocks :

Code: Select all

* Define "GDK" environment variable to your installation path in unix path format (example D:/apps/gendev). 
* Define "GDK_WIN" which still point to your installation path but in windows format (exemple D:\apps\gendev).
Voici un lien qui explique comment créer une variable d'environnement :

http://support.microsoft.com/kb/310519/fr
Avec Seven c'est un peu différent, mais bon. Dans l'image ci-dessous, on voit que j'ai mis la nouvelle variable GDK_WIN dans Variables utilisateur pour Administrateur et Variables système.

J'ai également fait un nouveau projet, nommézutalors, où j'ai placé dans Sources un main.c et aussi un dossier nommé out. Bref, je suis à court d'idée car j'ai toujours le même message.
Image :cry:
Last edited by letoulousain on Wed Apr 27, 2011 7:57 pm, edited 1 time in total.
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Il faut définir les 2 variables d'environnements GDK et GDK_WIN.
GDK est nécessaire au compilateur GCC et l'outil make qui utilisent un chemin type unix.
GDK_WIN est nécessaire que pour les différents fichiers batchs il me semble.
letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain »

Stef wrote:Il faut définir les 2 variables d'environnements GDK et GDK_WIN.
GDK est nécessaire au compilateur GCC et l'outil make qui utilisent un chemin type unix.
GDK_WIN est nécessaire que pour les différents fichiers batchs il me semble.
Ah ! Les 2, ok, je suis un boulet sur cette affaire. :oops:

Voilà qui est fait:
http://www.mirari.fr/Mj2k

Le message d'erreur est cette fois-ci différent, on progresse ! ;)
bastien
Very interested
Posts: 208
Joined: Mon Jun 25, 2007 7:19 pm
Location: Besançon,France
Contact:

Post by bastien »

tu a mal configurer code:Blocks tu a oublier un \ dans ta ligne entre apps et gendev !
bastien wrote: as-tu bien définit tes variables d' environnements ?
Tu est sur de ta configuration de Code Blocks ?
letoulousain wrote: oui, enfin je pense. Il doit tout de même manquer un truc.
http://www.mirari.fr/Nxw4
bah oui il manquait bien ces deux choses :wink:
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

letoulousain wrote:
Stef wrote:Il faut définir les 2 variables d'environnements GDK et GDK_WIN.
GDK est nécessaire au compilateur GCC et l'outil make qui utilisent un chemin type unix.
GDK_WIN est nécessaire que pour les différents fichiers batchs il me semble.
Ah ! Les 2, ok, je suis un boulet sur cette affaire. :oops:

Voilà qui est fait:
http://www.mirari.fr/Mj2k

Le message d'erreur est cette fois-ci différent, on progresse ! ;)
La Variable GDK doit contenir le chemin d'installation au format UNIX.
Là tu l'as déclaré comme GDK_WIN.
letoulousain
Interested
Posts: 42
Joined: Fri Sep 24, 2010 11:32 pm
Location: toulouse

Post by letoulousain »

Ah oui, les barres antislash (en anglais backslash), quel étourdis je suis. :oops: Merci pour votre patience.

Thanks guys ! :D

philippe
Post Reply