main.cpp

来自「这是一款象棋游戏」· C++ 代码 · 共 63 行

CPP
63
字号
/************************************************************************ * *    linux版仿联众俄罗斯方块 * *    该软件在GPL(GNU通用公共许可证)下发布 * *    Copyright (C)   <codeky@126.com> * *   This source code is licensed under the GNU General Public License */ //************************************************************************#include <qapplication.h>#include <stdlib.h>#ifndef WIN32#include <unistd.h>#else#include <limits.h>#endif#include "qmainwidget.h"char curPath[_MAX_PATH];int main( int argc, char **argv ){	QApplication app( argc, argv );	int rt = 0;//lee mask readlink("/proc/self/exe", curPath, PATH_MAX);	if(rt< 0||rt >=_MAX_PATH){		rt =0;	}		curPath[rt] = '\0';	int pos = strlen(curPath)-1;	while(pos>=0){		if(curPath[pos]=='/'){			break;		}		pos--;	}	curPath[pos+1]='\0';//lee add	memset(curPath,0,sizeof(_MAX_PATH));	QString pathstr = app.applicationDirPath() + "/";	strcpy(curPath,(const char *)pathstr.local8Bit());//lee add end	QMainWidget w;	app.setMainWidget( &w );	w.setCaption("linux-tetris -- Codekey@126.com");	w.show();		app.connect(&app,SIGNAL(lastWindowClosed()),&app,SLOT(quit()));	return app.exec();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?