コード例 #1
0
ファイル: AnimTest.cpp プロジェクト: otoauler/sdkpub
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    MSG			msg;
    WNDCLASSEX	wcex;
    HACCEL		hAccelTable;

    hInstance = hInst;

    wcex.cbSize = sizeof(WNDCLASSEX);

    wcex.style			= CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc	= (WNDPROC)WndProc;
    wcex.cbClsExtra		= 0;
    wcex.cbWndExtra		= 0;
    wcex.hInstance		= hInstance;
    wcex.hIcon			= LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
    wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
    wcex.lpszMenuName	= (LPCSTR)IDR_MENU1;
    wcex.lpszClassName	= TITLE;
    wcex.hIconSm		= LoadIcon(wcex.hInstance, (LPCTSTR)IDI_ICON1);

    RegisterClassEx(&wcex);

    HWnd = CreateWindow(TITLE, TITLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                        50, 50, 400, 300, NULL, NULL, hInstance, NULL);
    if (HWnd == NULL)
        return FALSE;

    // Display the window
    ShowWindow(HWnd, nCmdShow);
    UpdateWindow(HWnd);

    ilInit();
    ilEnable(IL_ORIGIN_SET);
    ilEnable(IL_TYPE_SET);
    ilEnable(IL_FORMAT_SET);

    ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
    ilTypeFunc(IL_UNSIGNED_BYTE);
    ilFormatFunc(IL_BGR);

    // Is there a file to load from the command-line?
    if (__argc > 1) {
        LoadImages(__argv[1]);
    }

    hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDR_MENU1);

    while (GetMessage(&msg, NULL, 0, 0)) {
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return msg.wParam;
}
コード例 #2
0
ファイル: Imagegfx.cpp プロジェクト: 183amir/kge
	//------------------------------------------------------------------------------------
	// Loads an image from a file
	//------------------------------------------------------------------------------------
	bool Image::LoadImageFromFile()
	{
		// Generate the main image name to use.
		ilGenImages (1, &m_iImgID);

		// Bind this image name.
		ilBindImage (m_iImgID);
		ilFormatFunc(IL_BGRA);

		// Loads the image specified by File into the ImgId image.
		if (!ilLoadImage (m_pFileName))
		{
			CheckDevilErrors( m_pFileName );
			return false;
		}

		m_iWidth  = ilGetInteger(IL_IMAGE_WIDTH);			// width
		m_iHeight = ilGetInteger(IL_IMAGE_HEIGHT);			// height
		m_ibpp    = ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);	// Bits per pixel
		m_iBpp    = ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL); // bytes per pixel

		if (m_ibpp == 8)
		{
//			ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
//			m_ibpp = ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);
			m_eFmt = EIF_A;
			m_iBpp = 1;
		}
		else if (m_ibpp==16)
		{
			ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
			m_ibpp = ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);
			m_eFmt = EIF_BGR;
		}

		CheckDevilErrors( m_pFileName );

		return true;

	} // LoadImageFromFile
コード例 #3
0
ファイル: il_states.cpp プロジェクト: wg-lesta/ResIL
void ILAPIENTRY ilSetInteger(ILenum Mode, ILint Param)
{
    switch (Mode)
    {
    // Integer values
    case IL_FORMAT_MODE:
        ilFormatFunc(Param);
        return;
    case IL_KEEP_DXTC_DATA:
        if (Param == IL_FALSE || Param == IL_TRUE) {
            ilStates[ilCurrentPos].ilKeepDxtcData = Param;
            return;
        }
        break;
    case IL_MAX_QUANT_INDICES:
        if (Param >= 2 && Param <= 256) {
            ilStates[ilCurrentPos].ilQuantMaxIndexs = Param;
            return;
        }
        break;
    case IL_NEU_QUANT_SAMPLE:
        if (Param >= 1 && Param <= 30) {
            ilStates[ilCurrentPos].ilNeuSample = Param;
            return;
        }
        break;
    case IL_ORIGIN_MODE:
        ilOriginFunc(Param);
        return;
    case IL_QUANTIZATION_MODE:
        if (Param == IL_WU_QUANT || Param == IL_NEU_QUANT) {
            ilStates[ilCurrentPos].ilQuantMode = Param;
            return;
        }
        break;
    case IL_TYPE_MODE:
        ilTypeFunc(Param);
        return;

    // Image specific values
    case IL_IMAGE_DURATION:
        if (iCurImage == NULL) {
            ilSetError(IL_ILLEGAL_OPERATION);
            break;
        }
        iCurImage->Duration = Param;
        return;
    case IL_IMAGE_OFFX:
        if (iCurImage == NULL) {
            ilSetError(IL_ILLEGAL_OPERATION);
            break;
        }
        iCurImage->OffX = Param;
        return;
    case IL_IMAGE_OFFY:
        if (iCurImage == NULL) {
            ilSetError(IL_ILLEGAL_OPERATION);
            break;
        }
        iCurImage->OffY = Param;
        return;
    case IL_IMAGE_CUBEFLAGS:
        if (iCurImage == NULL) {
            ilSetError(IL_ILLEGAL_OPERATION);
            break;
        }
        iCurImage->CubeFlags = Param;
        break;

    // Format specific values
    case IL_BMP_RLE:
        if (Param == IL_FALSE || Param == IL_TRUE) {
            ilStates[ilCurrentPos].ilBmpRle = Param;
            return;
        }
        break;
    case IL_DXTC_FORMAT:
        if (Param >= IL_DXT1 || Param <= IL_DXT5 || Param == IL_DXT1A) {
            ilStates[ilCurrentPos].ilDxtcFormat = Param;
            return;
        }
        break;
    case IL_JPG_SAVE_FORMAT:
        if (Param == IL_JFIF || Param == IL_EXIF) {
            ilStates[ilCurrentPos].ilJpgFormat = Param;
            return;
        }
        break;
    case IL_JPG_QUALITY:
        if (Param >= 0 && Param <= 99) {
            ilStates[ilCurrentPos].ilJpgQuality = Param;
            return;
        }
        break;
    case IL_PNG_INTERLACE:
        if (Param == IL_FALSE || Param == IL_TRUE) {
            ilStates[ilCurrentPos].ilPngInterlace = Param;
            return;
        }
        break;
    case IL_PCD_PICNUM:
        if (Param >= 0 || Param <= 2) {
            ilStates[ilCurrentPos].ilPcdPicNum = Param;
            return;
        }
        break;
    case IL_PNG_ALPHA_INDEX:
        if (Param >= -1 || Param <= 255) {
            ilStates[ilCurrentPos].ilPngAlphaIndex=Param;
            return;
        }
        break;
    case IL_SGI_RLE:
        if (Param == IL_FALSE || Param == IL_TRUE) {
            ilStates[ilCurrentPos].ilSgiRle = Param;
            return;
        }
        break;
    case IL_TGA_CREATE_STAMP:
        if (Param == IL_FALSE || Param == IL_TRUE) {
            ilStates[ilCurrentPos].ilTgaCreateStamp = Param;
            return;
        }
        break;
    case IL_TGA_RLE:
        if (Param == IL_FALSE || Param == IL_TRUE) {
            ilStates[ilCurrentPos].ilTgaRle = Param;
            return;
        }
        break;
    case IL_VTF_COMP:
        if (Param == IL_DXT1 || Param == IL_DXT5 || Param == IL_DXT3 || Param == IL_DXT1A || Param == IL_DXT_NO_COMP) {
            ilStates[ilCurrentPos].ilVtfCompression = Param;
            return;
        }
        break;

    default:
        ilSetError(IL_INVALID_ENUM);
        return;
    }

    ilSetError(IL_INVALID_PARAM);  // Parameter not in valid bounds.
    return;
}
コード例 #4
0
ファイル: fortran_wrapper.c プロジェクト: AMDmi3/DevIL
void ilFFormatFunc_(int *RetVal, int *Mode)
{
	*RetVal = ilFormatFunc(*Mode);
	return;
}