void run_as_shell_command(int argc, _TCHAR* argv[]){

	if(argc > 2){
		char * filename = wchar_to_string(argv[1]);
		char * filename_result = wchar_to_string(argv[2]);
		printf(filename);
		printf("\n");
		printf(filename_result);
		printf("\n");
		IplImage *input_image = cvLoadImage(filename,0);
		IplImage * rimage = su_algorithm(input_image);
		cvSaveImage(filename_result,rimage);
		cvReleaseImage(&rimage);
	}
	else{
		printf("enter more arguments");
	}
}
Beispiel #2
0
static void		s_trunc(char **s, int length, wchar_t *wtmp)
{
	int		size;
	int		index;
	char	*string;

	size = (length < 0) ? -length : length;
	string = ft_strnew(size);
	if (*s == NULL)
		return ;
	index = 0;
	if (wtmp != NULL)
	{
		size = 0;
		*s = ft_strnew(0);
		while ((size + ft_wlen(wtmp[index])) <= length)
		{
			size += ft_wlen(wtmp[index]);
			*s = ft_strjoin(*s, wchar_to_string(wtmp[index++]));
		}
	}
	else
		*s = ft_strndup(*s, length);
}
Beispiel #3
0
/**
 * Fonction appelée lors du click du bouton "appliquer" dans
 * les menus de configuration
 *
 * @param idsection     identifiant de la section concernée (utilisation des #define  enumerés)
 */
void RenderingEngine::applyConfigChanges(int idsection)
{
    map<string, int> config;

    //! \TODO : Ajouter une gestion de KEYS, AUDIO et MISC


    //Video Stuff
    bool fullscreenBool, vsyncBool;
    irr::s32 resolution;
    const wchar_t * resolutionName;
    int fullscreen = 0, vsync = 0, width, height;
    string resolutionString, widthString, heightString;
    irr::gui::IGUIElement* checkFull;
    irr::gui::IGUIElement* checkVsync ;
    irr::gui::IGUIElement* resolutionList;
    //KEYS stuff
    IGUIKeySelector* keyForward;
    IGUIKeySelector* keyBackward;
    IGUIKeySelector* keyLeft;
    IGUIKeySelector* keyRight;
    IGUIKeySelector* keyShoot;
    IGUIKeySelector* keyAction;


    switch(idsection){
        case GUI_OPTIONSMENU_KEYS:
            //On recupere les elements, et on les map
            keyForward = (IGUIKeySelector*) l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_KEYS_FORWARD, true);
            config["forward"] = keyForward->getValue();
            keyBackward = (IGUIKeySelector*) l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_KEYS_BACKWARD, true);
            config["backward"] = keyBackward->getValue();
            keyLeft = (IGUIKeySelector*) l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_KEYS_LEFT, true);
            config["left"] = keyLeft->getValue();
            keyRight = (IGUIKeySelector*) l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_KEYS_RIGHT, true);
            config["right"] = keyRight->getValue();
            keyShoot = (IGUIKeySelector*) l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_KEYS_SHOOT, true);
            config["shoot"] = keyShoot->getValue();
            keyAction = (IGUIKeySelector*) l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_KEYS_ACTION, true);
            config["action"] = keyAction->getValue();
            core->saveConfig("KEYS", config);
        break;

        case GUI_OPTIONSMENU_VIDEO:

            //On recupere les elements
            checkFull = l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_VIDEO_FULLSCREEN, true);
            checkVsync = l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_VIDEO_VSYNC, true);
            resolutionList = l_guiElement[IN_OPTIONS_MENU]->getElementFromId(GUI_OPTIONSMENU_VIDEO_RESOLUTION, true);
            //On recupere les valeurs en "raw"
            resolution = ((irr::gui::IGUIListBox*)(resolutionList))->getSelected();
            resolutionName = ((irr::gui::IGUIListBox*)(resolutionList))->getListItem(resolution);
            fullscreenBool = ((irr::gui::IGUICheckBox*)(checkFull))->isChecked();
            vsyncBool = ((irr::gui::IGUICheckBox*)(checkVsync))->isChecked();
            // Bool -> int
            if(fullscreenBool)
                fullscreen = 1;
            if(vsyncBool)
                vsync = 1;

            //wchar_t * -> str | split str | str -> int width & height
            resolutionString = wchar_to_string(resolutionName);
            widthString = resolutionString.substr(0, resolutionString.find("x"));
            heightString = resolutionString.substr(resolutionString.find("x")+1, resolutionString.size() - resolutionString.find("x"));
            width = atoi(widthString.c_str());
            height = atoi(heightString.c_str());

            //mapping des valeurs
            config["width"] = width;
            config["height"] = height;
            config["fullscreen"] = fullscreen;
            config["vsync"] = vsync;
            core->saveConfig("VIDEO", config);

        break;
        case GUI_OPTIONSMENU_AUDIO:

        break;
        case GUI_OPTIONSMENU_MISC:

        break;
    }
}