My first Dreamcast Program!

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

My first Dreamcast Program!

Post by Falco Girgis »

Okay kiddies, I've been working my ass off. I finally successfully set up my environment. My ass has been juggling Linux and Dos windows all day. Looks like it payed off. I made my first thing for dreamcast. I was screwing around with shapes. This is based on BlackAura's tutorial.

This is a hand drawing of what the Dreamcast draws to your TV:
Image
Please note: this is a rough drawing and the Dreamcast can render it a hell of a lot better than I can draw.

There source is here:

Code: Select all

/*
 * example1.c
 * Basic example using 2D graphics using KallistiOS
 * (c) 2004, Stuart Dalton / BlackAura (obsidianglow@hotpop.com)
 */

#include "video.h"

/* The main example */
int main(int argc, char *argv[])
{
	int i;

	/* Initialise video mode - 640x480, RGB565, 60Hz */
	vid_set_mode(DM_640x480, PM_RGB565);

	/* Draw a gradient along the left of the screen using draw_vline */
	for(i = 0; i < 256; i++)
		draw_vline(i, 0, 479, PACK_PIXEL(0, i, 0));

	/* Draw a gradient across the top of the screen using draw_hline */
	for(i = 0; i < 256; i++)
		draw_hline(256, 639, i, PACK_PIXEL(0, 0, i));
		
	/* Draw a gradient along the right of the screen using draw_vline */
	for(i = 0; i > 256; i--)
		draw_vline(i, 0, 479, PACK_PIXEL(0, i, 0));

	/* Draw a white filled box taking up the rest of the space */
	draw_fbox(1, 1, 256, 192, PACK_PIXEL(0, 255, 0));
	draw_fbox(384, 1, 639, 192, PACK_PIXEL(0, 0, 255));
	draw_fbox(1, 288, 256, 479, PACK_PIXEL(255, 0, 0));
	draw_fbox(384, 288, 639, 479, PACK_PIXEL(255, 255, 255));

	/* Do nothing, forever, so we can see the pretty pattern */
	while(1)
		vid_waitvbl();

	return 0;
}
[/quote]
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

Koo. Why don't you try making a box move across the screen now. Maybe using a thing like this.

Code: Select all

Box_x = Box_x + Box_vx
Box_y = Box_y + Box_vy

if Box_x < 0 then ( Box_x = 0 ; Box_vx = -Box_vx)
if Box_x > 640 then ( Box_x = 640 ; Box_vx = -Box_vx)

if Box_y < 0 then ( Box_y = 0 ; Box_vy = -Box_vy)
if Box_y > 480 then ( Box_y = 480 ; Box_vy = -Box_vy)

Draw sqr
Something like that would probably work.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Maybe, but I doubt.

Everything you think should work is a hell of a lot more complex in C. I think that'll work though.

:chex.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

are you telling me you HAVE to do this in c? Why not C++.

Besides, I know c has if statements, so theres no way it can't work. :wink:
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Don Pwnious
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 833
Joined: Tue Jun 15, 2004 5:32 pm
Location: on the streets wit my j23
Contact:

Post by Don Pwnious »

Yes i think i know some of the code the studying is helping
1/8th time- 14secs
1/8th speed - 110mph
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

OMFG! Don't visit this. That was my FIRST Dreamcast program. I'm lightyears better. That is 2D hardware too! LORD!

Now, I'm using C++
Using 3D hardware
Fancy 3D affects, etc.

I could write you up a basic "shape drawer" for Dreamcast in C++ with 3d hardware.
Post Reply