示例#1
0
文件: Game.cpp 项目: ajorians/nHitori
Game::Game(SDL_Surface* pScreen, const char* pstrFile, int nLevelNumber, Config* pConfig)
: m_pScreen(pScreen)
#ifdef USE_GRAPHIC_YOU_WIN
, m_pWinGraphic(NULL)
#else
, m_YouWinMessage(pScreen)
#endif
, m_nLevelNumber(nLevelNumber), m_pConfig(pConfig), m_Selector(pScreen, pConfig), m_bGameOver(false)
{
	HitoriLibCreate(&m_Hitori, pstrFile);
	m_Selector.SetDimensions(GetHitoriBoardWidth(m_Hitori), GetHitoriBoardHeight(m_Hitori));
	m_pBackground = nSDL_LoadImage(image_HitoriBoard);
	m_pFont = nSDL_LoadFont(NSDL_FONT_THIN, 0/*R*/, 0/*G*/, 0/*B*/);
}
示例#2
0
文件: Menu.cpp 项目: ajorians/nHearts
MainMenu::MainMenu(SDL_Surface* pScreen, Config* pConfig, AchieveConfig* pAchieve, MouseHandling* pMouseHandling)
: m_pScreen(pScreen), m_pMouseHandling(pMouseHandling), m_Background(pScreen, pConfig), m_eChoice(Play), m_pConfig(pConfig), m_pAchieve(pAchieve), m_nFlashAchievement(0)
{
	m_pTitleGraphic 	= nSDL_LoadImage(image_nHeartsText);
	m_pPlayGraphic		= nSDL_LoadImage(image_Play);
	m_pOptionsGraphic	= nSDL_LoadImage(image_OptionsAndHelp);
	m_pAchievementGraphic	= nSDL_LoadImage(image_AchievementGraphic);
	m_pStar			= nSDL_LoadImage(image_Star);
	SDL_SetColorKey(m_pTitleGraphic, SDL_SRCCOLORKEY, SDL_MapRGB(m_pTitleGraphic->format, 255, 255, 255));
	SDL_SetColorKey(m_pPlayGraphic, SDL_SRCCOLORKEY, SDL_MapRGB(m_pPlayGraphic->format, 255, 255, 255));
	SDL_SetColorKey(m_pOptionsGraphic, SDL_SRCCOLORKEY, SDL_MapRGB(m_pOptionsGraphic->format, 255, 255, 255));
	SDL_SetColorKey(m_pAchievementGraphic, SDL_SRCCOLORKEY, SDL_MapRGB(m_pAchievementGraphic->format, 255, 255, 255));
	SDL_SetColorKey(m_pStar, SDL_SRCCOLORKEY, SDL_MapRGB(m_pStar->format, 0, 0, 0));

	m_pFont = nSDL_LoadFont(NSDL_FONT_THIN, 0/*R*/, 0/*G*/, 0/*B*/);

	m_bNewAchievement = pAchieve->GetNewAchievements();
}
示例#3
0
Game::Game(SDL_Surface* pScreen, const char* pstrFile, int nLevelNumber, Config* pConfig)
: m_pScreen(pScreen), m_Background(pScreen, pConfig), m_StartMessage(pScreen)
#ifdef USE_GRAPHIC_YOU_WIN
, m_pWinGraphic(NULL)
#else
, m_YouWinMessage(pScreen)
#endif
, m_nLevelNumber(nLevelNumber), m_pConfig(pConfig), m_MovesRemainingLabel(pScreen, &m_BoardMetrics), m_bGameOver(false), m_Pieces(pScreen, &m_BoardMetrics, pConfig, &m_MovesRemainingLabel), m_bShouldQuit(false)
{
	GravnixLibCreate(&m_Gravnix, pstrFile);
	m_MovesRemainingLabel.SetGravnixLib(&m_Gravnix);

	int nWidth = GetGravnixBoardWidth(m_Gravnix), nHeight = GetGravnixBoardHeight(m_Gravnix);

	m_BoardMetrics.SetDimensions(nWidth, nHeight);

	m_pFont = nSDL_LoadFont(NSDL_FONT_THIN, 0/*R*/, 0/*G*/, 0/*B*/);

        for(int nX=0; nX<nWidth; nX++) {
                for(int nY=0; nY<nHeight; nY++) {
			int nType = GetSpotValue(nX, nY);
			if( nType <= 0 ) continue;

			m_Pieces.CreatePiece(nType, nX, nY);
                }
        }

	if( m_pConfig->GetShowOpeningMoveLimit() ) {
		char buffer[32];
		char buf[8];
		strcpy(buffer, "Move\nLimit: ");
		Puz_itoa(GetGravnixMoveLimit(m_Gravnix), buf, 8);
		strcat(buffer, buf);
		m_StartMessage.CreateMessage(buffer);
	}
}
示例#4
0
文件: Help.cpp 项目: ajorians/nHearts
HeartsHelp::HeartsHelp(SDL_Surface* pScreen)
: m_pScreen(pScreen)
{
	m_pFont = nSDL_LoadFont(NSDL_FONT_VGA, 0, 0, 0);

}
示例#5
0
MainMenu::MainMenu(SDL_Surface* pScreen)
: m_pScreen(pScreen), m_eChoice(Play)
{
	m_pBackground = nSDL_LoadImage(image_FallDownMainMenu);
	m_pFont = nSDL_LoadFont(NSDL_FONT_THIN, 0/*R*/, 0/*G*/, 0/*B*/);
}
示例#6
0
文件: test.c 项目: Lepzulnag/Winbox
int main(void)
{
	SDL_Surface *scr = wInitSDL();
	DrawFillRect(scr, NULL, SDL_MapRGB(scr->format, 0, 0, 0));
	wInitTheme(NULL);
	
	
	nSDL_Font *font = nSDL_LoadFont(NSDL_FONT_VGA, 255, 255, 255);
	nSDL_DrawStringCF(scr, font, 5, 5, "Couco\45 u !");
	SDL_Flip(scr);
	wait_key_pressed();
	
	nSDL_FreeFont(font);
	
	
	/*
	// Déclaration des widgets
	Widget *mainWidget = wWindow("Aide");
	Widget *tabs = wTab();
	
	// 1er onglet
	Widget *body1 = wBasicLayout(0);
	Widget *subody1 = wHorizontalLayout(0);
	Widget *im_tbtton = wPixmapNTI(image_buttonScratchpad);
	Widget *navigation = wText("Use the T-Button to navigate between tabs.\n\nIf you maintain this button while using RIGHT or LEFT buttons, you will be able to select your tab.\n\nMaintaining the T-Button plus pushing DEL will delete the selected tab from your work space.\n\nTo navigate faster in your texts, use CTRL+Directional Arrow.", 15);
	
	//2e onglet
	Widget *keys = wText("DOC - Quicksave the current file\nSHIFT + DOC - Quickave all files\n\nSHIFT + Directional Arrow - Select text\nCTRL + VAR - Copy selection\nVAR - Paste selection\n\nUse CTRL + (Character Button) or SHIFT + (Character Button) to get another character.\n\nHere are some useful examples :\nCTRL + ' , '  -->   ;\nCTRL + ' 0 '  -->   :\nCTRL + '.'  -->   !\nCTRL + '(-)'  -->   ?\nqu'est-ce qui bug au fond ??? Est-ce quand j'ai un wText avec progressbar mais non éditable ???\nCTRL+'2' = '\"'\nCTRL+'/' '\%'\nCTRL+'(' = '['\nSHIFT+'(' = '{'\nSHIFT+1 = '<'\nSHIT+'2' = '_'\nSHIFT+'3' = '>'\netc...\n\nUse CTRL+'?!>' to get some special characters.	", 17);
// 
	// 3e onglet
	Widget *body3 = wGridLayout(1, 3,0);
	Widget *text1 = wText("Rename a file with '.py' or '.py.tns' extension to get Python's syntax highlights.", 3);
	Widget *text2 = wText("You can then click ENTER at any time to execute and test your program.", 3);
	Widget *text3 = wText("If you placed the Micropython executable into a specific location, indicate his path via the 'Options' dialog box.", 3);
	
	
	wText_SetUnEditable(navigation);
	wText_SetUnEditable(keys);
	wText_SetUnEditable(text1);
	wText_SetUnEditable(text2);
	wText_SetUnEditable(text3);
	wTab_AddTab(tabs, "Navigation", body1);
	wTab_AddTab(tabs, "Keys", keys);
	wTab_AddTab(tabs, "Python", body3);
	
	wAddWidget(mainWidget, tabs);
	
	wAddWidget(body1, subody1);
	wAddWidget(subody1, im_tbtton);
	wAddWidget(subody1, wExLabel("<--- This is the awesome T-BUTTON.", ALIGN_LEFT, nSDL_LoadFont(NSDL_FONT_VGA, 204,15,225)));
	wAddWidget(body1, navigation);
	
	wAddWidget(body3, text1);
	wAddWidget(body3, text2);
	wAddWidget(body3, text3);
	
	wSetHeight(subody1, 24);
	wSetWidth(mainWidget, 300);
	wSetHeight(mainWidget, 220);
		
	wExecConstruct(mainWidget);//*/

	wCloseTheme();
	SDL_Quit();
	return 1;
}
示例#7
0
GameDrawer::GameDrawer(SDL_Surface* pSurface, BinaryLib binary, Metrics& metrics)
: m_pSurface(pSurface), m_Binary(binary), m_pBoardMetrics(&metrics)
{
   m_pFont = nSDL_LoadFont(NSDL_FONT_THIN, 0/*R*/, 0/*G*/, 0/*B*/);
   m_pFontPermanent = nSDL_LoadFont(NSDL_FONT_VGA, 49/*R*/, 79/*G*/, 79/*B*/);
}