Yes mtheall, this was a duplication of
this post and that's my bad. As a first time poster I didn't notice posts had to be accepted by administrator and I thought it was some sort of error my post the fact that my post did not appear, so I posted again.
Regarding the problem, here is a screenshot of my result with the following code.
Code used for initialization:
Code: Select all
System::System( void )
{
videoSetMode ( MODE_5_2D );
videoSetModeSub( MODE_5_2D );
vramSetBankA( VRAM_A_MAIN_BG );
vramSetBankB( VRAM_B_MAIN_BG );
vramSetBankC( VRAM_C_SUB_BG );
consoleInit( NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 4, 0, true, true );
bgIndex = bgInit( 2, BgType_Bmp16, BgSize_B16_256x256,5, 0 );
this->mainScreen.setFrameBuffer( ( u16 * ) bgGetGfxPtr( bgIndex ) );
bgIndex = bgInitSub( 3, BgType_Bmp16, BgSize_B16_256x256, 0, 0 );
this->subScreen.setFrameBuffer( ( u16 * ) bgGetGfxPtr( bgIndex ) );
}
Redraw function:
Code: Select all
static Framework::Geometry::Rectangle area( 0, 0, 100, 100 );
void drawScreens( void )
{
if ( !contains )
{
systemHandler->subScreen.drawRectangle ( area, Framework::Util::Color::CYAN );
systemHandler->mainScreen.drawRectangle( area, Framework::Util::Color::CYAN );
} else
{
systemHandler->subScreen.drawRectangle ( area, Framework::Util::Color::BLACK );
systemHandler->mainScreen.drawRectangle( area, Framework::Util::Color::BLACK );
}
consoleClear( );
printf( "Player 1 life points: %d\n", player1.lifePoints );
printf( "Player 2 life points: %d\n", player2.lifePoints );
}
drawRectangle method:
Code: Select all
void Screen::drawRectangle( const Geometry::Rectangle & rec ,
u16 color,
uint8 layer )
{
for ( auto column = rec.bottomLeft.x; column < rec.topRight.x; ++column )
{
for ( auto line = rec.bottomLeft.y; line < rec.topRight.y; ++line )
{
this->frameBuffer[ line * 256 + column ] = color;
}
}
}
As you can see, a blue and a noisy line appear.
Thanks for your time.