コード例 #1
0
eZapEmuSetup::eZapEmuSetup ():
eWindow (0)
{
  int i;

#ifdef DEBUG
  printf ("eZapEmuSetup::eZapEmuSetup()\n");
#endif

  Serial = NULL;

  RC->read ();

  setText (_(TITLE));
  cmove (ePoint (170, 150));
  cresize (eSize (390, 350));

  int fd = eSkin::getActive ()->queryValue ("fontsize", 16);

#ifdef OLD_CODE
  RC->Enabled = eZapEmuSetup::EmuEnabled ();
  RC->StartServer = eZapEmuSetup::EmuStartServer ();
  RC->StartDhcp = eZapEmuSetup::EmuStartDhcp ();
  RC->v_SelectedEmu = eZapEmuSetup::WichEmu ();
#endif

  eLabel *l = new eLabel (this);
  l->setText (_("Select Emu:"));
  l->move (ePoint (10, 10));
  l->resize (eSize (200, fd + 4));

  eListBoxEntryText *entrys[10];
  SelectedEmu = new eListBox < eListBoxEntryText > (this, l);
  SelectedEmu->loadDeco ();
  SelectedEmu->setFlags (eListBox < eListBoxEntryText >::flagNoUpDownMovement);
  SelectedEmu->move (ePoint (160, 10));
  SelectedEmu->resize (eSize (200, 35));
  for (i = 0; i < RC->no_emu; i++)
    {
      // printf ("R:(%s) i=%i\n", EMU[i], i);
      entrys[i] = new eListBoxEntryText (SelectedEmu, EMU[i], (void *) i);
    }
  SelectedEmu->setCurrent (entrys[RC->v_SelectedEmu]);
  SelectedEmu->setHelpText (_("choose emu ( left, right )"));
  CONNECT (SelectedEmu->selected, eZapEmuSetup::EmuSetup);

  eLabel *l2 = new eLabel (this);
  l2->setText (_("Select Server:"));
  l2->move (ePoint (10, 50));
  l2->resize (eSize (200, fd + 4));

  eListBoxEntryText *entrys2[10];
  SelectedCrdsrv = new eListBox < eListBoxEntryText > (this, l);
  SelectedCrdsrv->loadDeco ();
  SelectedCrdsrv->setFlags (eListBox < eListBoxEntryText >::flagNoUpDownMovement);
  SelectedCrdsrv->move (ePoint (160, 50));
  SelectedCrdsrv->resize (eSize (200, 35));
  for (i = 0; i < RC->no_crdsrv; i++)
    {
      // printf ("R:(%s) i=%i\n", CRDSRV[i], i);
      entrys2[i] = new eListBoxEntryText (SelectedCrdsrv, CRDSRV[i], (void *) i);
    }
  SelectedCrdsrv->setCurrent (entrys2[RC->v_SelectedCrdsrv]);
  SelectedCrdsrv->setHelpText (_("choose card server ( left, right )"));
  CONNECT (SelectedCrdsrv->selected, eZapEmuSetup::EmuSetup);


#ifdef NOT_ANY_MORE
  eEmuEnabled = new eCheckbox (this, Enabled, 1);
  eEmuEnabled->setText (_("Emu"));
  eEmuEnabled->move (ePoint (10, 50));
  eEmuEnabled->resize (eSize (fd + 4 + 150, fd + 4));
  eEmuEnabled->setHelpText (_("enable/disable emu"));
  CONNECT (eEmuEnabled->checked, eZapEmuSetup::EmuEnabledChanged);
#endif

  keyupdate = new eButton (this);
  keyupdate->setShortcut ("blue");
  keyupdate->setShortcutPixmap ("blue");
  keyupdate->setText (_("Key setting"));
  keyupdate->move (ePoint (20, 90));
  keyupdate->resize (eSize (170, 40));
  keyupdate->setHelpText (_("Launch the key update and convert plugin"));
  keyupdate->loadDeco ();
  CONNECT (keyupdate->selected, eZapEmuSetup::keyupdatePressed);

#ifdef NOT_ANY_MORE
  softcam2all = new eButton (this);
  softcam2all->setText (_("Soft -> all"));
  softcam2all->setShortcut ("yellow");
  softcam2all->setShortcutPixmap ("yellow");
  softcam2all->move (ePoint (20, 100));
  softcam2all->resize (eSize (170, 40));
  softcam2all->setHelpText (_("Convert SoftCam.Key to all other key formats"));
  softcam2all->loadDeco ();
  CONNECT (softcam2all->selected, eZapEmuSetup::softcam2allPressed);
#endif

  v_CardInfo = CardInfo ();
  if (v_CardInfo == 0)
    {
      cardinfo = new eButton (this);
      cardinfo->setShortcut ("yellow");
      cardinfo->setShortcutPixmap ("yellow");
      cardinfo->setText (_("Card info"));
      cardinfo->move (ePoint (210, 90));
      cardinfo->resize (eSize (170, 40));
      cardinfo->setHelpText (_("Show some info of seca card"));
      cardinfo->loadDeco ();
      CONNECT (cardinfo->selected, eZapEmuSetup::cardinfoPressed);
    }

#ifdef NOT_ANY_MORE
  extraset = new eButton (this);
  extraset->setShortcut ("1");
  extraset->setShortcutPixmap ("1");
  extraset->setText (_("Extra Setup"));
  extraset->move (ePoint (20, 220));
  extraset->resize (eSize (170, 40));
  extraset->setHelpText (_("Enter the extra setup menu"));
  extraset->loadDeco ();
  CONNECT (extraset->selected, eZapEmuSetup::ExtraSettings);

  v_IpInfo = IpInfo ();
  if (v_IpInfo == 0)
    {
      ipinfo = new eButton (this);
      ipinfo->setShortcut ("2");
      ipinfo->setShortcutPixmap ("2");
      ipinfo->setText (_("DHCP info"));
      ipinfo->move (ePoint (210, 220));
      ipinfo->resize (eSize (170, 40));
      ipinfo->setHelpText (_("Show some info of seca card"));
      ipinfo->loadDeco ();
      CONNECT (ipinfo->selected, eZapEmuSetup::ipinfoPressed);
    }
#endif

  ok = new eButton (this);
  ok->setText (_("save"));
  ok->setShortcut ("green");
  ok->setShortcutPixmap ("green");
  ok->move (ePoint (20, 270));
  ok->resize (eSize (170, 40));
  ok->setHelpText (_("save changes and return"));
  ok->loadDeco ();
  CONNECT (ok->selected, eZapEmuSetup::okPressed);

  abort = new eButton (this);
  abort->setShortcut ("red");
  abort->setShortcutPixmap ("red");
  abort->loadDeco ();
  abort->setText (_("abort"));
  abort->move (ePoint (210, 270));
  abort->resize (eSize (170, 40));
  abort->setHelpText (_("ignore changes and return"));
  CONNECT (abort->selected, eZapEmuSetup::abortPressed);

  statusbar = new eStatusBar (this);
  statusbar->move (ePoint (0, clientrect.height () - 30));
  statusbar->resize (eSize (clientrect.width (), 30));
  statusbar->loadDeco ();
}
コード例 #2
0
ファイル: particlesII.cpp プロジェクト: SummerSnail2014/haiku
void
NWindowScreen::ScreenConnected(bool connected)
{
	PRINT(("ScreenConnected()\n"));
	fflush(stdout);
	if(connected)
	{
		if(SetSpace(B_8_BIT_640x480) < B_OK)
		{
			//SetFrameBuffer(640, 480);
			PRINT(("SetSpace() failed\n"));
			// properly set the framebuffer. exit if an error occurs.
			be_app->PostMessage(B_QUIT_REQUESTED);
			return;
		}
		// get the framebuffer-related info, each time the
		// WindowScreen is connected (multiple monitor)
		frame_buffer = (uint8*)(CardInfo()->frame_buffer);
		line_length = FrameBufferInfo()->bytes_per_row;
		if(tid == 0)
		{
			// clean the framebuffer
			PRINT(("zeroing the framebuffer\n"));
			memset(frame_buffer,0,480*line_length);
			// spawn the rendering thread. exit if an error occurs.
			PRINT(("spawning the render thread.\n"));
			tid = spawn_thread(Entry,"rendering thread", B_URGENT_DISPLAY_PRIORITY,this);
			if(resume_thread(tid) < B_OK)
			{
				be_app->PostMessage(B_QUIT_REQUESTED);
				return;
			}
		}
		else
		{
			for(int y=0;y<480;y++)
			{
				// restore the framebuffer when switching back from
				// another workspace.
            	memcpy(frame_buffer+y*line_length,save_buffer+640*y,640);
            }
		}
		// set our color list.
		rgb_color palette[256];
		rgb_color c1;
		for(int i=0,j=0;i<256;i++,j++)
		{
			if(i<64)
			{
				c1.red = j*4; // greys
				c1.green = j*4;
				c1.blue = j*4;
				c1.alpha = 255;
			}
			if((i>=64) && (i<128))
			{
				c1.red = j*4; // reds
				c1.green = 0;
				c1.blue = 0;
				c1.alpha = 255;
			}
			if((i>=128) && (i<192))
			{
				c1.red = 0; // greens
				c1.green = j*4;
				c1.blue = 0;
				c1.alpha = 255;
			}
			if((i>=192) && (i<256))
			{
				c1.red = 0; // blues
				c1.green = 0;
				c1.blue = j*4;
				c1.alpha = 255;
			}
			if(j == 64)
				j=0;
			palette[i]=c1;
		}
		SetColorList(palette);
		
		// allow the rendering thread to run.
		thread_is_locked = false;
		release_sem(sem);
	}
	else /* !connected */
	{
		// block the rendering thread.
		if(!thread_is_locked)
		{
			acquire_sem(sem);
			thread_is_locked = true;
		}
		// kill the rendering and clean up when quitting
		if((((NApplication*)be_app)->is_quitting))
		{
			status_t ret;
			kill_thread(tid);
			wait_for_thread(tid,&ret);
			delete_sem(sem);
			delete_area(area);
			free(particle_list);
		}
		else
		{
			// set the color list black so that the screen doesn't seem
			// to freeze while saving the framebuffer
			rgb_color c={0,0,0,255};
			rgb_color palette[256];
			// build the palette
			for(int i=0;i<256;i++)
				palette[i] = c;
			// set the palette
			SetColorList(palette);
			// save the framebuffer
			for(int y=0;y<480;y++)
				memcpy(save_buffer+640*y,frame_buffer+y*line_length,640);
		}
	}
}
コード例 #3
0
void InformationStorage::loadAll(string file)
{
	//Clear out the object types first
	terrainTypes.clear();
	buildingTypes.clear();
	unitTypes.clear();
	
	TiXmlDocument doc( file.c_str());
	if(doc.LoadFile())
	{
		TiXmlHandle hDoc(&doc);
		TiXmlElement* pElem;
		TiXmlHandle hRoot(0);
		pElem = hDoc.FirstChildElement().Element();
		hRoot=TiXmlHandle(pElem);


		//--------------------------------Load in Units----------------------

		TiXmlNode* pUnitNode=hRoot.FirstChild( "Units" ).FirstChild().ToNode();
		TiXmlNode* pUnitInfoNode;
		//For loop will cycle through each unit within the Units tag
		for( pUnitNode; pUnitNode; pUnitNode=pUnitNode->NextSiblingElement())
		{
			//Need to iterate through the data of a unit; can make a pointer to the first child of pUnitNode for ID, get NextSiblingElement for other elements, use 
			//query attributes for combat stats.
			UnitInfo u = UnitInfo();
			u.load(pUnitNode);
			unitTypes[u.id] = u;
		}



		//----------------------Load in Terrain-------------------------------

		TiXmlNode* pTerrainNode=hRoot.FirstChild( "Terrain" ).FirstChild().ToNode();
		TiXmlNode* pTerrainInfoNode;
		//For loop will cycle through each unit within the Units tag
		for( pTerrainNode; pTerrainNode; pTerrainNode=pTerrainNode->NextSiblingElement())
		{
			//Need to iterate through the data of a unit; can make a pointer to the first child of pUnitNode for ID, get NextSiblingElement for other elements, use 
			//query attributes for combat stats.
			TerrainInfo t = TerrainInfo();
			t.load(pTerrainNode);
			terrainTypes[t.id] = t;
		}


		//---------------------------------Load in Buildings--------------------------------------

		TiXmlNode* pBuildingNode=hRoot.FirstChild( "Buildings" ).FirstChild().ToNode();
		//TiXmlNode* pBuildingInfoNode;
		//TiXmlNode* pProductionIDNode;
		//For loop will cycle through each unit within the Units tag
		for( pBuildingNode; pBuildingNode; pBuildingNode=pBuildingNode->NextSiblingElement())
		{
			//Need to iterate through the data of a unit; can make a pointer to the first child of pUnitNode for ID, get NextSiblingElement for other elements, use 
			//query attributes for combat stats.
			BuildingInfo b = BuildingInfo();
			b.load(pBuildingNode);
			buildingTypes[b.id] = b;
		}

		//-------------------------------Load in Commander Cards--------------------------------
		TiXmlNode* pCardNode = hRoot.FirstChild( "Cards" ).FirstChild().ToNode();
		for( pCardNode; pCardNode; pCardNode=pCardNode->NextSiblingElement())
		{
			CardInfo c = CardInfo();
			c.load(pCardNode);
			cardTypes[c.id] = c;
		}


	}
	else
	{
		//std::cout << "\nFailed to load the units\n";
	}

	DeveloperConsole::write("Buildings Loaded: ");
	DeveloperConsole::writeLine(buildingTypes.size());
	DeveloperConsole::write("Units Loaded: ");
	DeveloperConsole::writeLine(unitTypes.size());
	DeveloperConsole::write("Terrain Loaded: ");
	DeveloperConsole::writeLine(terrainTypes.size());
	

}
コード例 #4
0
ファイル: video_beos.cpp プロジェクト: DavidLudwig/macemu
void MacScreen::ScreenConnected(bool active)
{
	graphics_card_info *info = CardInfo();
	screen_active = active;
	const video_mode &mode = monitor.get_current_mode();

	if (active == true) {

		// Set VideoMonitor
#if REAL_ADDRESSING
		monitor.set_mac_frame_base((uint32)info->frame_buffer);
#else
		monitor.set_mac_frame_base(MacFrameBaseMac);
#endif

#if !REAL_ADDRESSING
		// Set variables for UAE memory mapping
		MacFrameBaseHost = (uint8 *)info->frame_buffer;
		MacFrameSize = mode.bytes_per_row * mode.y;
		switch (info->bits_per_pixel) {
			case 15:
				MacFrameLayout = FLAYOUT_HOST_555;
				break;
			case 16:
				MacFrameLayout = FLAYOUT_HOST_565;
				break;
			case 32:
				MacFrameLayout = FLAYOUT_HOST_888;
				break;
			default:
				MacFrameLayout = FLAYOUT_DIRECT;
				break;
		}
#endif

		// Copy from backup store to frame buffer
		if (frame_backup != NULL) {
			memcpy(info->frame_buffer, frame_backup, mode.bytes_per_row * mode.y);
			delete[] frame_backup;			
			frame_backup = NULL;
		}

		// Restore palette
		if (mode.depth == VDEPTH_8BIT)
			SetColorList(palette);

		// Restart/signal emulator thread
		release_sem(mac_os_lock);

	} else {

		if (!quitting) {

			// Stop emulator thread
			acquire_sem(mac_os_lock);

			// Create backup store and save frame buffer
			frame_backup = new uint8[mode.bytes_per_row * mode.y];
			memcpy(frame_backup, info->frame_buffer, mode.bytes_per_row * mode.y);
		}
	}
}