English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 09 August 2010, 22:18   #41
korruptor
TDI
 
korruptor's Avatar
 
Join Date: Feb 2007
Location: Blitter Town
Posts: 124
Quote:
Originally Posted by 8bitbubsy View Post
Hmm, what about
pixbuf = SDL_CreateRGBSurface(screen->flags, 320, 255, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
?
Should I change the last four parameters to something in the screen struct?
AFAIK if they're not set, they'll default to the screen's format. Someone can correct me if I'm wrong there...

Or, yeah, try:

pixbuf = SDL_CreateRGBSurface(screen->flags, 320, 255, 32, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
korruptor is offline  
Old 09 August 2010, 22:47   #42
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
Join Date: Sep 2009
Location: Norway
Posts: 1,715
I added some neat palette functions now....

Code:
/* palette */
#define PAL_TRACKER_BG_1 0
#define PAL_TRACKER_BG_2 1
#define PAL_TRACKER_BG_3 2
#define PAL_GENERAL_TEXT 3
#define PAL_PATTERN_TEXT 4
#define PAL_CURSOR_1     5
#define PAL_CURSOR_2     6
#define PAL_CURSOR_3     7
#define PAL_COLORKEY     8
#define PAL_QUADRASCOPE  9

unsigned int palette[48] = 
{
	0x00BBBBBB, /* 0 - PAL_TRACKER_BG_1 */
	0x00888888, /* 1 - PAL_TRACKER_BG_2 */
	0x00555555, /* 2 - PAL_TRACKER_BG_3 */

	0x00000000, /* 3 - PAL_GENERAL_TEXT */
	0x00009955, /* 4 - PAL_PATTERN_TEXT */

	0x00444444, /* 5 - PAL_CURSOR_1 */
	0x00777777, /* 6 - PAL_CURSOR_2 */
	0x00AAAAAA, /* 7 - PAL_CURSOR_3 */

	0x0000FF00, /* 8 - PAL_COLORKEY */

	0x00BB00FF  /* 9 - PAL_QUADRASCOPE */
};

unsigned int pixelToScreenFmtPixel(SDL_Surface *screen, unsigned int pixel)
{
	if (screen != NULL)
	{
		/* thanks to korruptor for this code */
		return (((pixel & 0xFF000000) >> 24) << screen->format->Ashift) | 
			(((pixel & 0x00FF0000) >> 16) << screen->format->Rshift) | 
			(((pixel & 0x0000FF00) >> 8)  << screen->format->Gshift) | 
			((pixel & 0x000000FF) << screen->format->Bshift);
	}
	return 0;
}

void setPaletteEntry(SDL_Surface *screen, unsigned int palette[48], int num, unsigned int color)
{
	palette[num] = pixelToScreenFmtPixel(screen, color);
	return;
}

void convertPaletteToScreenFmt(unsigned int *palette, SDL_Surface *screen)
{
	if ((screen != NULL) && (palette != NULL))
	{
		int i;
		for (i = 0; i < 48; i++)
		{
			unsigned int pix = *palette;
			*palette++ = pixelToScreenFmtPixel(screen, pix);
		}
	}
	return;
}
Code:
setPaletteEntry(screen, palette, PAL_CURSOR_1, 0x00444444);
setPaletteEntry(screen, palette, PAL_CURSOR_2, 0x00777777);
setPaletteEntry(screen, palette, PAL_CURSOR_3, 0x00AAAAAA);
8bitbubsy is offline  
Old 13 August 2010, 21:25   #43
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
Re: Poll. If you do hardpan, users can (possibly) softpan in soundcard settings. The other way round is not possible

Best way I think is an option, like in WinUAE, like a slider 0-100% where 0 is mono and 100 is hard pan.
Photon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
My old source code gemanix Coders. General 36 09 July 2017 13:33
Source code for game in C? Leandro Jardim Coders. General 2 17 February 2013 00:27
Protracker all Versions incl. Source sun68 support.Apps 16 01 April 2012 00:59
Source Code camelord support.Games 2 06 August 2010 17:45
Source Code Thalion project.WinUAE - Kaillera 3 28 April 2006 09:55

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07298 seconds with 14 queries