Пример #1
0
void wxJigsawEditorCanvas::OnSize( wxSizeEvent& event )
{
	m_DoubleBufferDC.SelectObject(wxNullBitmap);
	m_DoubleBufferBitmap = wxBitmap(event.GetSize().GetWidth(), event.GetSize().GetHeight());
	m_DoubleBufferDC.SelectObject(m_DoubleBufferBitmap);
	RefreshBuffer();
}
Пример #2
0
void App::Update()
{
	static float elapsed = 0;
	static int frames = 0;

	clock.Tick();
	float time = clock.TotalTime();
	float dt = clock.DeltaTime();

	frames++;
	elapsed += dt;

	// Count and print FPS data to title
	if (elapsed >= 1.0f)
	{
		float secsperframe = 1.0f / (float)frames;
		std::wstringstream ss;
		ss.precision(6);
		ss << "ExplosionDemo FPS: " << frames << "   ||    ms/frame: " << secsperframe;
		SetWindowText(mainWnd, ss.str().c_str());
		frames = 0;
		elapsed = 0;
		ss.flush();
		ss << " lacunarity: " << shaderParams->lacunarity << " gain: " << shaderParams->gain << " offset: " << shaderParams->gradOffset << " scale: " << shaderParams->gradScale << std::endl;
		OutputDebugStringW(ss.str().c_str());
	}

	ScanInput(dt);
	
	for(auto it = viewports.begin(); it != viewports.end(); it++)
	{
		it->SetTime(time);
		it->RefreshBuffer();
	}
}
Пример #3
0
void SimpleConsole::ClearScreen()
{
	memsetw( buffer, charStyle, width * height );
	RefreshBuffer();
	cursorX = 0;
	cursorY = 0;
	MoveCursor();
}
Пример #4
0
void wxJigsawEditorCanvas::OnScrollThumbRelease(wxScrollWinEvent & event)
{
	wxLogTrace(wxTraceMask(), _("wxJigsawEditorCanvas::OnScrollThumbRelease; ScrollPos = %i"),
		event.GetPosition());
	SetScrollPos(event.GetOrientation(), event.GetPosition());
	FixViewOffset();
	RefreshBuffer();
}
Пример #5
0
void wxJigsawEditorCanvas::OnScrollPageDown(wxScrollWinEvent & event)
{
	wxLogTrace(wxTraceMask(), _("wxJigsawEditorCanvas::OnScrollPageDown;"));
	SetScrollPos(event.GetOrientation(), 
		GetScrollPos(event.GetOrientation()) + GetScrollThumb(event.GetOrientation()));
	FixViewOffset();
	RefreshBuffer();
}
Пример #6
0
void wxJigsawEditorCanvas::OnScrollLineDown(wxScrollWinEvent & event)
{
	wxLogTrace(wxTraceMask(), _("wxJigsawEditorCanvas::OnScrollLineDown;"));
	int increment = wxJigsawEditorCanvas::ScrollIncrement;
	SetScrollPos(event.GetOrientation(), GetScrollPos(event.GetOrientation()) + increment);
	FixViewOffset();
	RefreshBuffer();
}
Пример #7
0
void wxJigsawEditorCanvas::Scroll(const wxPoint & pt)
{
	if((pt.x) >= 0 && (GetScrollPos(wxHORIZONTAL) != pt.x))
		SetScrollPos(wxHORIZONTAL, pt.x);
	if((pt.y) >= 0 && (GetScrollPos(wxVERTICAL) != pt.y))
		SetScrollPos(wxVERTICAL, pt.y);
	RefreshBuffer();
}
Пример #8
0
void wxJigsawEditorCanvas::MotionUpdate(wxPoint currentPos)
{		
	// get scroll position
	wxPoint scrollPos = GetScrollPosition();
	wxPoint viewPos = PointToViewPoint(currentPos);
	AutoScroll(currentPos, scrollPos);
	FixViewOffset();
	FixActiveHotSpot(viewPos);
	RefreshBuffer();
}
Пример #9
0
void wxJigsawEditorCanvas::OnLeftDown( wxMouseEvent& event )
{
	SetFocus();
	wxRect displayRect = GetDisplayRect(GetScrollPosition());
	m_MouseDownPos = event.GetPosition();
	
	do
	{
		if(!m_View) break;
		
		wxPoint diagramPoint = PointToViewPoint(m_MouseDownPos);		
		wxJigsawShape * shape(NULL);		
		wxJigsawEditorCanvasHitTest hitTest = HitTest(m_MouseDownPos, infoSelectedShape, NULL);

		static wxJigsawShapeList m_PaletteShapeList;
		static wxJigsawShapeList *pPaletteShapeList = NULL;
		if(infoSelectedShape.GetResult() == wxJigsawShape::wxJigsawShapeHitTest::wxJS_HITTEST_SLOT)
		{
			//Must save the current selected category or save the current search			
			if(!pPaletteShapeList) pPaletteShapeList = wxJigsawEditorMainFrame::Get()->GetPalette()->GetShapes();
			wxJigsawEditorMainFrame::Get()->SearchStyle(infoSelectedShape.GetInputParameterStyle());
		}
		else if(pPaletteShapeList)
		{
			//Restore the search or selected category
			if(wxJigsawEditorMainFrame::Get()->IsSearchStyleSelected())
			{
				wxJigsawEditorMainFrame::Get()->GetPalette()->SetShapes(pPaletteShapeList);
				wxJigsawEditorMainFrame::Get()->GetPalette()->Refresh();
				wxJigsawEditorMainFrame::Get()->GetPalette()->AdjustScrollBars();
			}
			pPaletteShapeList = NULL;			
		}

		switch(hitTest)
		{
		case wxJSEC_HITTEST_SHAPE:
			shape = m_View->GetShapeFromPoint(m_DoubleBufferDC, diagramPoint, infoSelectedShape, NULL);			
			if(shape)
			{				
				SetSelectedShape(shape);
				CaptureMouse();							
			}
			break;
		case wxJSEC_HITTEST_NONE:
			SetSelectedObject(NULL);
		default:
			break;
		}
	}
	while(false);

	RefreshBuffer();
}
Пример #10
0
void wxJigsawEditorCanvas::SetScale(double value)
{
	do
	{
		if(!m_View) break;
		m_View->SetScale(value);
		RefreshBuffer();
		wxJigsawEditorDocument * document = GetDocument();
		if(!document) break;
		document->ReCreateHotSpots(m_DoubleBufferDC, m_HotSpots, m_View->GetSelectedObject(), m_View->GetScale());
	}
	while(false);
}
Пример #11
0
void wxJigsawEditorCanvas::OnLeftUp( wxMouseEvent& event )
{
	m_MouseDownPos = wxPoint(-1, -1);
	if(HasCapture())
	{
		ReleaseMouse();

		do
		{
			if(!m_View) break;
			wxJigsawEditorDocument * document = GetDocument();
			if(!document) break;
			wxPoint realPosition = PointToViewPoint(event.GetPosition());
			wxJigsawShapeGroup *group = document->GetShapeGroup(m_SelectedShape);
			if(group != m_View->GetSelectedObject()) SetSelectedObject(group);
			if(group)
			{
				//Update the offset to the next mouse down event
				wxPoint groupPosition = m_View->GetRealGroupPosition(group);
					m_SelectedObjectOffset = wxSize(
						realPosition.x - groupPosition.x,
						realPosition.y - groupPosition.y); 

				//drop?
				if(document->ProcessDrop(m_DoubleBufferDC, realPosition, 
					group, m_SelectedObjectOffset, m_View->GetScale()))
				{
					SetSelectedObject(NULL);
				}
				document->RequestSizeRecalculation();
				/*wxWindowDC dc(this);
				dc.SetFont(GetFont());
				m_View->OnDraw(&dc);*/
				document->UpdateLayout(m_DoubleBufferDC, m_View->GetScale());
			}
		}
		while(false);

		RefreshBuffer();
		m_TR = m_BL = wxPoint(0,0);
		m_SelectionRect.SetPosition(m_TR);
		m_SelectionRect.SetSize(wxSize(0,0));
		m_ActiveHotSpot = NULL;
		m_HotSpots.Clear();
	}
}
Пример #12
0
void wxJigsawEditorCanvas::ProcessDrop(const wxPoint & pos, 
		const wxJigsawShape * shape, 
		const wxSize & hotSpotOffset)
{
	do
	{
		if(!shape) break;
		wxJigsawEditorDocument * document = GetDocument();
		if(!document) break;
		wxPoint realPosition = PointToViewPoint(pos);
		wxJigsawShape * newShape = new wxJigsawShape(*shape);
		newShape->SetPosition(	realPosition.x - hotSpotOffset.GetWidth(),
			realPosition.y - hotSpotOffset.GetHeight());
		wxJigsawShapeGroup * newGroup = document->CreateGroupByShape(m_DoubleBufferDC, newShape);
		if(!newGroup) break;
		document->ProcessDrop(m_DoubleBufferDC, realPosition, newGroup, hotSpotOffset, m_View->GetScale());
		m_View->BringToFront(newGroup);
		SetSelectedShape(newShape);
		RefreshBuffer();
	}
	while(false);
}
Пример #13
0
int main()
{
	gfxInitDefault();
        gfxSet3D(true); // uncomment if using stereoscopic 3D

        gfxFlushBuffers();

        transparent = BLACK;
	 gfxSetScreenFormat(GFX_TOP, GSP_BGR8_OES);
	 gfxSetScreenFormat(GFX_BOTTOM, GSP_BGR8_OES);
        InitParx(BLACK);
/*
	ParxLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL); 
	ParxRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL); 
	ParxBot = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL); 

	ClrParx(ParxLeft, BLACK); 
	ClrParx(ParxRight, BLACK); 
	ClrParx(ParxBot, BLACK);
*/

	char* str[256];
        int l, k, j, i=20, posx = 100, posy = 100;
        TBGR rgbsam;
        TBGR rgb;
	u64 time; 

	// Main loop
	while (aptMainLoop())
	{
//		gspWaitForVBlank();

//		  	ParxLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL); 
//			ParxRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL); 
//			ParxBot = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL); 

		hidScanInput();              
		u32 kDown = hidKeysHeld();

		if (kDown & KEY_START)
			break; // break in order to return to hbmenu
                if (kDown & KEY_A)
			{
                          CanvasString(ParxBot, CopyRight(), 10,10, LIGHT_GREEN);
			}
                if (kDown & KEY_B)
			{
                          time= osGetTime();
			
			rgb.r= 0xCC;
			rgb.g= 0x33;
			rgb.b= 0xCC;
			
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  SetPixL(k,l,rgb); //TopLCD
  SetPixR(k,l,rgb);
  if (k<320) SetPixB(k,l,rgb); //BotLCD
}

time = osGetTime() - time; 
sprintf(str, "%i:ms ParxPro SetPix L/R/B,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  

			}
                if (kDown & KEY_X)
			{
                          TestPattern();
			}
                if (kDown & KEY_Y)
			{
			InitParx(BLACK);
		  	
//			  PasBotfill(ParxBot);
			rgb.r= 0xFF;
			rgb.g= 0x00;
			rgb.b= 0x8F;
			  PasClrSrc(ParxBot, rgb);
			  CanvasString(ParxBot, "InitParx", 10,10, GREEN);  
			}
                if(kDown & KEY_CPAD_DOWN)
                        {	     
			rgb.r= 0x00;
			rgb.g= 0x00;
			rgb.b= 0XFF;
			PasTopfill(ParxLeft, rgb);
			PasTopfill(ParxRight, rgb);
			}

                if(kDown & KEY_CPAD_UP) 
                        {	
                        
			rgb.r= 0xFF;
			rgb.g= 0x00;
			rgb.b= 0x00;		
			PasTopfill(ParxLeft, rgb);
			PasTopfill(ParxRight, rgb);
			}
                if(kDown & KEY_CPAD_RIGHT) 
                        {	
                        
			rgb.r= 0x00;
			rgb.g= 0xFF;
			rgb.b= 0x00;
time= osGetTime();
			PasTopfill(ParxLeft, rgb);
			PasTopfill(ParxRight, rgb);

time = osGetTime() - time; 
sprintf(str, "%i:ms L&R BGRTop,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
			}

                if(kDown & KEY_CPAD_LEFT)
                        {
                        
			rgb.r= 0x00;
			rgb.g= 0x11;
			rgb.b= 0x00;
time= osGetTime();					
						
			HexTopfill(ParxLeft);
			HexTopfill(ParxRight);

time = osGetTime() - time; 
sprintf(str, "%i:ms L&R TopMapLED,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
			}               
                if(kDown & KEY_R)
                        {	
                              	InitBufSingle(BLACK);
                                Topfill2;
                              //  ClrParx(ParxBot, BLACK);
                               // sprintf(str, "Dergibal Rad:%i  X:%i  Y:%i", i, posx, posy);
			//	CanvasString(ParxBot, str, 0, 0, RED);
			}

                if(kDown & KEY_L) 
                        {	
                        	InitBufDub(BLACK);		
			        Topfill1;
                             //   ClrParx(ParxBot, BLACK);
                              //  sprintf(str, "Dergibal Rad:%i  X:%i  Y:%i", i, posx, posy);
			//	CanvasString(ParxBot, str, 0, 0, RED);
			}
                if(kDown & KEY_DUP)
                        {	
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  if (k<320) PSetPixT(ParxRight,k,l, GetPixB(k,l));
} 

			}

                if(kDown & KEY_DDOWN)
                        {	
time= osGetTime();
			
			rgb.r= 0xCC;
			rgb.g= 0x11;
			rgb.b= 0xCC;
			
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  PSetPixT(ParxRight,k,l, rgb); //TopLCD
  PSetPixT(ParxLeft,k,l, rgb);
  if (k<320) PSetPixB(ParxBot,k,l, rgb); //BotLCD
}

time = osGetTime() - time; 
sprintf(str, "%i:ms ParxPro,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
		
			}                
		if(kDown & KEY_DRIGHT)
                        {

                         ClrParx(ParxBot, BLACK);    
                          
			rgb.r= 0xEE;
			rgb.g= 0x00;
			rgb.b= 0xCC;
		
time= osGetTime();			
                       for (k=0;k<400;k++)
                          for (l=0;l<240;l++) SetPixL(k,l,rgb); //TopLCD
time = osGetTime() - time; 
sprintf(str, "Left %i:ms ParxPro,kdl", time);
CanvasString(ParxBot, str, 10,10, LIGHT_GREEN); 

time= osGetTime();			
                       for (k=0;k<400;k++)
                          for (l=0;l<240;l++) SetPixR(k,l,rgb);                       
time = osGetTime() - time; 
sprintf(str, "Right %i:ms ParxPro,kdl", time);
CanvasString(ParxBot, str, 10,20, LIGHT_GREEN); 
			}

                if(kDown & KEY_DLEFT)
                        {				
                     //   SetTopFramebuffers(0);  
time= osGetTime();
			
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  SetPix(ParxRight,k,l,BLACK);
  SetPix(ParxLeft,k,l,BLACK);
  if (k<320) SetPix(ParxBot,k,l,BLACK);
}

time = osGetTime() - time; 
sprintf(str, "%i:ms Parx-GDI,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
		}
//gfxString(ParxRight, str, 30,30, 3, rgb); 
//gfxString(ParxLeft, str, 30,30, 3, rgb);   
//for (l=1;l<16;l++) print3d(rgb,10*l,10*l,l-1,3,str);



		//render rainbow
//		renderEffect();
		//copy buffer to lower screen (don't have to do it every frame)
//		memcpy(gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL), buffer, size);
		//wait & swap
//		gfxSwapBuffersGpu();
//		gspWaitForEvent(GSPGPU_EVENT_VBlank0, false);

		// Flush and swap framebuffers
	//	gfxFlushBuffers();
	//	gfxSwapBuffers();
        	RefreshBuffer();
		//Wait for VBlank
		gspWaitForVBlank();
	}

	gfxExit();
	return 0;
}
Пример #14
0
void wxJigsawEditorCanvas::OnMotion( wxMouseEvent& event )
{
	UpdateCursor(event.GetPosition());
	if(HasCapture())
	{
		if(event.GetPosition() != m_MouseDownPos && m_MouseDownPos != wxPoint(-1, -1) && m_SelectedShape)
		{
			do
			{
				if(!m_View) break;
				wxJigsawEditorDocument * document = GetDocument();
				if(!document) break;
				document->ReCreateHotSpots(m_DoubleBufferDC, m_HotSpots, NULL, m_View->GetScale());
				wxPoint diagramPoint = PointToViewPoint(m_MouseDownPos);
				wxLogTrace(wxTraceMask(), 
					_("wxJigsawEditorCanvas::OnLeftDown: Client Pos (%i, %i); View offset (%i, %i); Point (%i, %i)"),
					m_MouseDownPos.x, m_MouseDownPos.y,
					m_View->GetViewOffset().GetWidth(), m_View->GetViewOffset().GetHeight(),
					diagramPoint.x, diagramPoint.y);

				wxJigsawShapeGroup * group(NULL);
				group = document->GetShapeGroup(m_SelectedShape);
				if(!group)
				{
					group = document->CreateGroupByShape(m_DoubleBufferDC, m_SelectedShape);
				}
				else
				{
					// If it is not the first shape in a group
					if(group->GetShapes().IndexOf(m_SelectedShape) > 0)
					{
						// Then extract the shape and all shapes after it into separate group
						group = document->CreateGroupByShape(m_DoubleBufferDC, m_SelectedShape);
					}
				}

				if(!group) 
				{
					wxLogTrace(wxTraceMask(), _("Error obtaining group of shapes"));
					break;
				}
				else
				{
					m_View->BringToFront(group);
					wxPoint groupPosition = m_View->GetRealGroupPosition(group);
					m_SelectedObjectOffset = wxSize(
						diagramPoint.x - groupPosition.x,
						diagramPoint.y - groupPosition.y);
				}

				SetSelectedObject(group);
				document->ReCreateHotSpots(m_DoubleBufferDC, m_HotSpots, m_View->GetSelectedObject(), m_View->GetScale());
				FixActiveHotSpot(diagramPoint);
				m_Mode = wxJSEC_MODE_DRAGGING;

				RefreshBuffer();
				m_TR = m_BL = m_MouseDownPos;
				m_SelectionRect.SetPosition(m_MouseDownPos);
				m_SelectionRect.SetSize(wxSize(0,0));
			}
			while(false);

			m_MouseDownPos = wxPoint(-1, -1);
		}
		else
		{
			MotionUpdate(event.GetPosition());
		}
	}
}
Пример #15
0
int main()
{
	gfxInitDefault();
        gfxSet3D(true); // uncomment if using stereoscopic 3D

        gfxFlushBuffers();

        transparent = BLACK;
	 gfxSetScreenFormat(GFX_TOP, GSP_BGR8_OES);
	 gfxSetScreenFormat(GFX_BOTTOM, GSP_BGR8_OES);
        InitParx(BLACK);
/*
	ParxLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL); 
	ParxRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL); 
	ParxBot = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL); 

	ClrParx(ParxLeft, BLACK); 
	ClrParx(ParxRight, BLACK); 
	ClrParx(ParxBot, BLACK);
*/

	char* str[256];
        int l, k, j, i=20, posx = 100, posy = 100;
        TBGR rgbsam;
        TBGR rgb;
	u64 time; 
	u8* tempScr;
	bool Dbuf;	
	
	circlePosition pos;
	touchPosition touch;

	// Main loop
	while (aptMainLoop())
	{
//		gspWaitForVBlank();

//		  	ParxLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL); 
//			ParxRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL); 
//			ParxBot = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL); 

		hidScanInput();              
		u32 kDown = hidKeysHeld();

         
		//Read the CirclePad position
		hidCircleRead(&pos);

		//Print the CirclePad position
//-		printf("\x1b[2;0H%04d; %04d", pos.dx, pos.dy);
		

		//Read the touch screen coordinates
		hidTouchRead(&touch);
		
		//Print the touch screen coordinates
//		printf("\x1b[2;0H%03d; %03d", touch.px, touch.py);
		

		if (kDown & KEY_START)
			break; // break in order to return to hbmenu
                if (kDown & KEY_A)
			{
                          CanvasString(ParxBot, CopyRight(), 10,10, LIGHT_GREEN);
			}
                if (kDown & KEY_B)
			{
                          time= osGetTime();
			
			rgb.r= 0xCC;
			rgb.g= 0x33;
			rgb.b= 0xCC;
			
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  SetPixL(k,l,rgb); //TopLCD
  SetPixR(k,l,rgb);
  if (k<320) SetPixB(k,l,rgb); //BotLCD
}

time = osGetTime() - time; 
sprintf(str, "%i:ms ParxPro SetPix L/R/B,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  

			}
                if (kDown & KEY_X)
			{
                          TestPattern();
			}
                if (kDown & KEY_Y)
			{
			InitParx(BLACK);
		  	
//			  PasBotfill(ParxBot);
			rgb.r= 0xFF;
			rgb.g= 0x00;
			rgb.b= 0x8F;
			  PasClrSrc(ParxBot, rgb);
			  CanvasString(ParxBot, "InitParx", 10,10, GREEN);  
			}
                if(kDown & KEY_CPAD_DOWN)
                        {	     
			rgb.r= 0x00;
			rgb.g= 0x00;
			rgb.b= 0XFF;
			PasTopfill(ParxLeft, rgb);
			PasTopfill(ParxRight, rgb);
			}

                if(kDown & KEY_CPAD_UP) 
                        {	
                        
			rgb.r= 0xFF;
			rgb.g= 0x00;
			rgb.b= 0x00;		
			PasTopfill(ParxLeft, rgb);
			PasTopfill(ParxRight, rgb);
			}
                if(kDown & KEY_CPAD_RIGHT) 
                        {	
                        
			rgb.r= 0x00;
			rgb.g= 0xFF;
			rgb.b= 0x00;
time= osGetTime();
			PasTopfill(ParxLeft, rgb);
			PasTopfill(ParxRight, rgb);

time = osGetTime() - time; 
sprintf(str, "%i:ms L&R BGRTop,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
			}

                if(kDown & KEY_CPAD_LEFT)
                        {
                        
			rgb.r= 0x00;
			rgb.g= 0x11;
			rgb.b= 0x00;
time= osGetTime();					
						
			HexTopfill(ParxLeft);
			HexTopfill(ParxRight);

time = osGetTime() - time; 
sprintf(str, "%i:ms L&R TopMapLED,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
			}               
                if(kDown & KEY_R)
                        {	
                              	//InitBufSingle(BLACK);
                                ClrParx(ParxBot, BLACK);
                                //i of linearSpaceFree(); //no effect
                                //i of vramSpaceFree(); //reads as Zero 
                                //i of mappableSpaceFree(); //no change in alloc & free 
                                
                                sprintf(str, "v:%i  m:%i  l:%i", vramSpaceFree, mappableSpaceFree, linearSpaceFree);
				CanvasString(ParxBot, str, 0, 10, RED);
				
                                Topfill2;
                                sprintf(str, "v:%i  m:%i  l:%i", vramSpaceFree, mappableSpaceFree, linearSpaceFree);
				CanvasString(ParxBot, str, 0, 20, RED);
				
                               // Topfill3;
                               // sprintf(str, "Topfill3 Free :%i", vramSpaceFree);
				//CanvasString(ParxBot, str, 0, 40, RED);
				
                                //sprintf(str, "Topfill3 Free :%i", );
				//CanvasString(ParxBot, str, 0, 40, RED);
			}

                if(kDown & KEY_L) 
                        {	
                        	if (Dbuf) InitBufDub(BLACK); else InitBufSingle(BLACK);		
			        Topfill1;
                                ClrParx(ParxBot, BLACK);
                              //  sprintf(str, "Dergibal Rad:%i  X:%i  Y:%i", i, posx, posy);
                              
                        	if (Dbuf) CanvasString(ParxBot, "InitBufDub", 0, 40, RED); else
                        	CanvasString(ParxBot, "InitBufSingle", 0, 40, RED); (BLACK);	
                        	Dbuf = !Dbuf;
			}
                if(kDown & KEY_DUP)
                        {	
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  if (k<320) PSetPixT(ParxRight,k,l, GetPixB(k,l));
} 

			}

                if(kDown & KEY_DDOWN)
                        {	
time= osGetTime();
			
			rgb.r= 0xCC;
			rgb.g= 0x11;
			rgb.b= 0xCC;
			
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  PSetPixT(ParxRight,k,l, rgb); //TopLCD
  PSetPixT(ParxLeft,k,l, rgb);
  if (k<320) PSetPixB(ParxBot,k,l, rgb); //BotLCD
}

time = osGetTime() - time; 
sprintf(str, "%i:ms ParxPro,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
		
			}                
		if(kDown & KEY_DRIGHT)
                        {

                         ClrParx(ParxBot, BLACK);    
                          
			rgb.r= 0xEE;
			rgb.g= 0x00;
			rgb.b= 0xCC;
		
time= osGetTime();			
                       for (k=0;k<400;k++)
                          for (l=0;l<240;l++) SetPixL(k,l,rgb); //TopLCD
time = osGetTime() - time; 
sprintf(str, "Left %i:ms ParxPro,kdl", time);
CanvasString(ParxBot, str, 10,10, LIGHT_GREEN); 

time= osGetTime();				
//ParxLeft = GetSrcL(-1); // good!!			
//tempScr = GetSrcL(0); // good!!	
//tempScr = GetSrcL(1); // good!!
//                       for (k=0;k<400;k++)
//                        { 
//                            ParxLeft = GetSrcL(-1); // good!!
//                          for (l=0;l<80;l++) PSetPixT(ParxRight,k,l, GetPixL(k,l)); // 
//       			    ParxLeft = GetSrcL(0); // good!!
//                          for (l=80;l<160;l++) PSetPixT(ParxRight,k,l, GetPixL(k,l));   		
//     			    ParxLeft = GetSrcL(1); // good!!
//                          for (l=160;l<240;l++) PSetPixT(ParxRight,k,l, GetPixL(k,l)); 
//                          //assignment to eg PSetPixT(GetSrcR(-1),k,l, GetPixL(k,l)) poops out                      
//                        }  
time = osGetTime() - time; 
sprintf(str, "ParxLeft = GetSrcL(-1&0&1); %i:ms ,kdl", time);
CanvasString(ParxBot, str, 10,20, LIGHT_GREEN); 

time= osGetTime();			
//SetSrcR(0,tempScr);	// No Good 

//SetSrcL(-1,ParxLeft);	// 
//sprintf(str, "SetSrcL(-1,ParxLeft); %i:ms ,kdl", time);
//CanvasString(ParxBot, str, 10,40, LIGHT_GREEN); 

//BufSub(-1);
//BufSub(-2);
//BufSub(-3);

//SetSrcL(-1,ParxLeft);	// 
sprintf(str, "SetSrcL(1,ParxLeft); %i:ms ,kdl", time);
CanvasString(ParxBot, str, 10,50, LIGHT_GREEN); 
//SetSrcR(0,ParxRight);	//
//sprintf(str, "SetSrcR(0,ParxRight) %i:ms ,kdl", time);
//CanvasString(ParxBot, str, 10,60, LIGHT_GREEN); 

                    //   for (k=0;k<400;k++)
                    //      for (l=0;l<240;l++) PSetPixT(GetSrcR(0),k,l,rgb); //GetSrcR(0) works                      
time = osGetTime() - time; 
sprintf(str, "SetSrc L&R(-1,(ParxLeft & ParxRight); %i:ms ,kdl", time);
CanvasString(ParxBot, str, 10,30, LIGHT_GREEN); 
			}

                if(kDown & KEY_DLEFT)
                        {				
                     //   SetTopFramebuffers(0);  
time= osGetTime();
			
                        for (k=0;k<400;k++)
                          for (l=0;l<240;l++)
{
  SetPix(ParxRight,k,l,BLACK);
  SetPix(ParxLeft,k,l,BLACK);
  if (k<320) SetPix(ParxBot,k,l,BLACK);
}

time = osGetTime() - time; 
sprintf(str, "%i:ms Parx-GDI,kdl", time);
CanvasString(ParxBot, str, 10,10, GREEN);  
		}
//gfxString(ParxRight, str, 30,30, 3, rgb); 
//gfxString(ParxLeft, str, 30,30, 3, rgb);   
//for (l=1;l<16;l++) print3d(rgb,10*l,10*l,l-1,3,str);



		//render rainbow
//		renderEffect();
		//copy buffer to lower screen (don't have to do it every frame)
//		memcpy(gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL), buffer, size);
		//wait & swap
//		gfxSwapBuffersGpu();
//		gspWaitForEvent(GSPGPU_EVENT_VBlank0, false);

		// Flush and swap framebuffers
	//	gfxFlushBuffers();
	//	gfxSwapBuffers();
        	RefreshBuffer();
		//Wait for VBlank
		gspWaitForVBlank();
	}

	gfxExit();
	return 0;
}