slPrint() Question

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

slinga

Member
Joined
Apr 17, 2001
Messages
1,064
Points
36
Age
35
Website
Visit site
Hey guys,

Is there a way to print colored ASCII characters on the saturn? Like a function similar to slPrint(), but that will take a parameter for color? Thanks in advance.
 

antime

Extra Hard Mid Boss
Joined
Jan 24, 2002
Messages
2,578
Points
48
Website
www.iki.fi
If you plot using tiled backgrounds, you could use multiple tile definitions (one for each color) or you could use one set of tiles with multiple palettes. Bitmapped solutions are obvious (you can mix bitmaps and tiles by plotting into a tile buffer, good for variable-width fonts etc). If you use sprites you can use indexed sprites with many palettes, multiple sets of RGB sprites or VDP2-indexed sprites with many palettes. VDP2-indexed palettes with Gouraud-shading would be a pretty sneaky trick (use the same value for each vertex and you can control the palette index) but only really usable for single-colored tiles.

Those are the ones that come to mind immediately, I'm sure there are more ways.
 

vreuzon

New Member
Joined
Sep 13, 2002
Messages
231
Points
16
from SGL302J\DOC\210A_US\packs.txt

Code:
***************************

void slCurColor((Uint16)Palette)

***************************

************************** Changes

Function:

Specifies the palette number for the text displayed by "slPrint???()" and

"slDisp???()".

Specify a number from 1 to 15 for the palette.

****************** End of Changes
But I've never been successful in its use.
 

mrkotfw

Member
Joined
Dec 30, 2002
Messages
838
Points
28
Age
31
my newest demo has colored text, if you need the source code just pm me.
 

slinga

Member
Joined
Apr 17, 2001
Messages
1,064
Points
36
Age
35
Website
Visit site
You guys rule :cheers

I'm going to update my pong game to have different color paddles for each player. Since all I'm doing are slPrint()'s, this should be pretty easy.
 

vreuzon

New Member
Joined
Sep 13, 2002
Messages
231
Points
16
antime :

I'm not sure I understand what you mean by "tile" ? Is it a bitmap defining the chars ?

by the way, do you know where the default font (used for slprint) is stored ?

piratero :

I'd like to read your code: it could be interesting. You could make it public, too.

V
 

antime

Extra Hard Mid Boss
Joined
Jan 24, 2002
Messages
2,578
Points
48
Website
www.iki.fi
Yes, a tile is the 8*8 pixel basic building block of backgrounds in non-bitmap modes. On the C64 they were called "characters". I don't know where the charset used in SGL is stored, but you could try loading both the BIOS ROM and SGL library into some graphics-ripping tool.
 

vreuzon

New Member
Joined
Sep 13, 2002
Messages
231
Points
16
Thanks.

Yes, a tile is the 8*8 pixel basic building block of backgrounds in non-bitmap modes

But... Isn't this 8x8 pixel block a bitmap ? So what do you call a non-bitmap mode ? Has it something to do with the block size and the screen size ?
 

antime

Extra Hard Mid Boss
Joined
Jan 24, 2002
Messages
2,578
Points
48
Website
www.iki.fi
In tiled modes you use tilemaps to get one (or more, in the case of the Saturn) level of indirections. The tiles are quite correctly bitmapped images, but the screen is constructed by going through the tilemap which directs which tile is displayed at what location. In bitmapped modes the whole screen is represented as one big bitmap which is directly transferred to the video output.

EDIT: In case I didn't make myself clear, in tiled modes you generally manipulate the tilemaps while in bitmapped modes you draw individual pixels.
 

mrkotfw

Member
Joined
Dec 30, 2002
Messages
838
Points
28
Age
31
you copy the tiles in DMA, the map is where you would place a tile... why not just create a font and use that? :) i'll release my source code too *soon*
 

vreuzon

New Member
Joined
Sep 13, 2002
Messages
231
Points
16
Perfectly clear now, thanks. That was something I didn't knew.

For info, i think the tilemap is called "pattern data" and character "character data".

(chap 8-7 in sgl tut.).
 

slinga

Member
Joined
Apr 17, 2001
Messages
1,064
Points
36
Age
35
Website
Visit site
*bump*

Can anybody get slCurColor to work? I tried with a number of values between 1-15, but I always get white text. One of the samples has it, but I can't compile it for some reason (something with my makefile, I'll check it again when I get back to school).
 

antime

Extra Hard Mid Boss
Joined
Jan 24, 2002
Messages
2,578
Points
48
Website
www.iki.fi
Looking through the akira3 sample you may have to load a palette to the start of VDP2 color-RAM.
 

slinga

Member
Joined
Apr 17, 2001
Messages
1,064
Points
36
Age
35
Website
Visit site
Yeah I saw that too, why can't Sega make anything simple for us :D

I could compile that sample, but I couldn't get it to run on Satourne. Could you get it to work?
 

antime

Extra Hard Mid Boss
Joined
Jan 24, 2002
Messages
2,578
Points
48
Website
www.iki.fi
The sample works, it has the same Akira model walking in a circle as the other sample, but it has a fake "environment mapping" surface applied.
 

slinga

Member
Joined
Apr 17, 2001
Messages
1,064
Points
36
Age
35
Website
Visit site
Hey guys,

I almost got it. From what I understand you need to define this before your main:

Code:
static	Uint16	palette[32] = {

	0x0000, // background color slCurColor(1);

	0x1111, // text color slCurcolor(1);

	0x0000,

	0x2222,

	0x0000,

	0x3333,

	0x0000,

	0x4444,

	0x0000,

	0x5555,

	0x0000,

	0x6666,

	0x0000,

	0x7777,

	0x0000,

	0x8888,

	0x0000,

	0x9999,

	0x0000,

	0xAAAA,

	0x0000,

	0xBBBB,

	0x0000,

	0xCCCC,

	0x0000,

	0xDDDD,

	0x0000,

	0xEEEE,

	0x0000, // background color slCurColor(15);

	0xFFFF, // background color slCurColor(15);

	0x0000, // Not sure yet??

	0x0000, // Not sure yet??

};
Then in your main do this:

Code:
	slDMACopy( (void*)palette, (void*)0x25f00000, sizeof(palette) );

	slCurColor(5);
Where slCurColor(some number) selects which color combination you want to use. Unfortunately, slPrint displays only the first color combination, no matter what number you use for slCurColor. In the above configuration I was always getting orange text with a black background no matter what number I used for slCurColor and even if I ommited slCurColor completely. I'll keep working on this, just thought I'd update anybody else who was interested.
 

slinga

Member
Joined
Apr 17, 2001
Messages
1,064
Points
36
Age
35
Website
Visit site
Nope I'm stuck again. It seems that even in the demos (chrome and akira3), changing slCurColor to a different value does nothing. Doh!
 

vreuzon

New Member
Joined
Sep 13, 2002
Messages
231
Points
16
Searching in dev central threads, I found a one year old Piratero code calling slCurColor this way :

Code:
slCurColor(C_RGB(25,0,0));
No palette. Still don't know if that works.
 

mrkotfw

Member
Joined
Dec 30, 2002
Messages
838
Points
28
Age
31
:damn: ok, what you can do is change 1 from the palette and change it to whatever color you want, god forbid me do this but:

Code:
#include <sgl.h> // get the vram/palette defines.

int replace1color(Uin16 *color){

Uint32 *palette1=COL_RAM;

 palette+location_of_color_white=color;

 // i'm guessing 1 color is 2 bits? 

return(0);

}
Wild guess, horrible code, but i hope it at least gives you an idea....
 

slinga

Member
Joined
Apr 17, 2001
Messages
1,064
Points
36
Age
35
Website
Visit site
Do you meaning changing the first entry in the palette? That changes all text on the screen at the next slSynch, so it's pretty worthless to me. I'm trying to display multiple colors at once.
 
Top