Esempio n. 1
0
void _store_ekran1(void) {
	int scr=Screen();
	Screen(1);
	if( 0 == ekran1_buffer ) ekran1_buffer = ReserveBuffer(0,0,320,160);
	if( 0 != ekran1_buffer ) StoreBuffer(ekran1_buffer,0,0,320,24);
	Screen(scr);
}
Esempio n. 2
0
void nuiMetaPainter::MultProjectionMatrix(const nuiMatrix& rMatrix)
{
  StoreOpCode(eMultProjectionMatrix);
  StoreBuffer(rMatrix.Array, sizeof(nuiSize), 16);
  
  nuiPainter::MultProjectionMatrix(rMatrix);
}
Esempio n. 3
0
void nuiMetaPainter::LoadMatrix(const nuiMatrix& rMatrix)
{
  if (mMatrixStack.top() == rMatrix)
    return;
  StoreOpCode(eLoadMatrix);
  StoreBuffer(rMatrix.Array, sizeof(nuiSize), 16);

  nuiPainter::LoadMatrix(rMatrix);
}
Esempio n. 4
0
void nuiMetaPainter::LoadProjectionMatrix(const nuiRect& rViewport, const nuiMatrix& rMatrix)
{
  StoreOpCode(eLoadProjectionMatrix);
  StoreFloat(rViewport.Left());
  StoreFloat(rViewport.Top());
  StoreFloat(rViewport.GetWidth());
  StoreFloat(rViewport.GetHeight());
  StoreBuffer(rMatrix.Array, sizeof(nuiSize), 16);  
  
  nuiPainter::LoadProjectionMatrix(rViewport, rMatrix);
}
Esempio n. 5
0
void _M_RUCH_INFO(astr A_S) {
	aint KONIEC=0;
	rysuj(); MouseClick();
																					//	   INFO:
	OKNO(90,100,158,22);										//	   OKNO[90,100,158,22]
	GADGET(OKX+4,OKY+4,150,15,"",31,2,30,1,0);//	   GADGET[OKX+4,OKY+4,150,15,"",31,2,30,1,0]
	gad_text(1.0); Text(OKX+8,OKY+15,A_S);	//	   Ink 1,30 : Text OKX+8,OKY+15,A$
	void *sb=StoreBuffer(OKX-1,OKY-1,158+2,22+2);
	do {																		//	   Repeat
		rysuj();
		RestoreBuffer(sb);
		WaitVbl();
		if( MouseClick() ) {									//	      If Mouse Click=1
			KONIEC=-1;													//	         KONIEC=True
		}																			//	      End If
	} while( KONIEC==0 );										//	   Until KONIEC
	ZOKNO();																//	   ZOKNO
	FreeBuffer(sb);
	rysuj();
	WaitVbl();
}
Esempio n. 6
0
STDMETHODIMP CDataCallback::BandedDataCallback(
    LONG   lReason,
    LONG   lStatus,
    LONG   lPercentComplete,
    LONG   lOffset,
    LONG   lLength,
    LONG, LONG,
    PBYTE  pbBuffer
)
{
    HRESULT hr;

    // Parse the message

    switch (lReason)
    {
        case IT_MSG_DATA_HEADER:
        {
            PWIA_DATA_CALLBACK_HEADER pHeader = (PWIA_DATA_CALLBACK_HEADER) pbBuffer;

            // Determine if this is a BMP transfer

            m_bBMP = pHeader->guidFormatID == WiaImgFmt_MEMORYBMP || pHeader->guidFormatID == WiaImgFmt_BMP;

            // For WiaImgFmt_MEMORYBMP transfers, WIA does not send a BITMAPFILEHEADER before the data.
            // In this program, we desire all BMP files to contain a BITMAPFILEHEADER, so add it manually

            m_nHeaderSize = pHeader->guidFormatID == WiaImgFmt_MEMORYBMP ? sizeof(BITMAPFILEHEADER) : 0;

            // Allocate memory for the image if the size is given in the header

            if (pHeader != NULL && pHeader->lBufferSize != 0)
            {
                hr = ReAllocBuffer(m_nHeaderSize + pHeader->lBufferSize);

                if (FAILED(hr))
                {
                    return hr;
                }
            }
        
            break;
        }

        case IT_MSG_DATA:
        {
            // Invoke the callback function

            hr = m_pfnProgressCallback(lStatus, lPercentComplete, m_pProgressCallbackParam);

            if (FAILED(hr) || hr == S_FALSE)
            {
                return hr;
            }

            // If the buffer is not allocated yet and this is the first block, 
            // and the transferred image is in BMP format, allocate the buffer
            // according to the size information in the bitmap header

            if (m_pStream == NULL && lOffset == 0 && m_bBMP)
            {
                LONG nBufferSize = BitmapUtil::GetBitmapSize(pbBuffer);

                if (nBufferSize != 0)
                {
                    hr = ReAllocBuffer(m_nHeaderSize + nBufferSize);

                    if (FAILED(hr))
                    {
                        return hr;
                    }
                }
            }

            if (m_nHeaderSize + lOffset + lLength < 0)
            {
                return E_OUTOFMEMORY;
            }

            // If the transfer goes past the buffer, try to expand it
            if (m_nHeaderSize + lOffset + lLength > m_nDataSize)
            {
                hr = ReAllocBuffer(m_nHeaderSize + lOffset + lLength);

                if (FAILED(hr))
                {
                    return hr;
                }
            }

            // copy the transfer buffer

            hr = CopyToBuffer(m_nHeaderSize + lOffset, pbBuffer, lLength);

            if (FAILED(hr))
            {
                return hr;
            }

            break;
        }

        case IT_MSG_STATUS:
        {
            // Invoke the callback function

            hr = m_pfnProgressCallback(lStatus, lPercentComplete, m_pProgressCallbackParam);

            if (FAILED(hr) || hr == S_FALSE)
            {
                return hr;
            }

            break;
        }

        case IT_MSG_TERMINATION:
        case IT_MSG_NEW_PAGE:
        {
            if (m_pStream != NULL)
            {
                // For BMP files, we should validate the the image header
                // So, obtain the memory buffer from the stream

                if (m_bBMP)
                {
                    // Since the stream is created using CreateStreamOnHGlobal,
                    // we can get the memory buffer with GetHGlobalFromStream.

                    HGLOBAL hBuffer;

                    hr = GetHGlobalFromStream(m_pStream, &hBuffer);

                    if (FAILED(hr))
                    {
                        return hr;
                    }

                    PBITMAPFILEHEADER pBuffer = (PBITMAPFILEHEADER) GlobalLock(hBuffer);

                    if (pBuffer == NULL)
                    {
                        return HRESULT_FROM_WIN32(GetLastError());
                    }

                    // Some scroll-fed scanners may return 0 as the bitmap height
                    // In this case, calculate the image height and modify the header

                    BitmapUtil::FixBitmapHeight(pBuffer + 1, m_nDataSize, TRUE);

                    // For WiaImgFmt_MEMORYBMP transfers, the WIA service does not 
                    // include a BITMAPFILEHEADER preceeding the bitmap data. 
                    // In this case, fill in the BITMAPFILEHEADER structure.
        
                    if (m_nHeaderSize != 0)
                    {
                        BitmapUtil::FillBitmapFileHeader(pBuffer + 1, pBuffer);
                    }

                    GlobalUnlock(hBuffer);
                }

                // Store this buffer in the successfully transferred images array

                hr = StoreBuffer();

                if (FAILED(hr))
                {
                    return hr;
                }
            }

            break;
        }
    }

    return S_OK;
}
Esempio n. 7
0
void _ARMIA(aint A) {
	//	Procedure ARMIA[A]

	aint AX=0,AY=0,PL=0,KONIEC=0,TEREN=0,I=0,DANE=0;
	aint STREFA=0,KONIEC2=0,STREFA2=0,TER2=0;

	_rysuj_armia_nr = A;

	AX=ARMIA[A][0][TX];											//	   AX=ARMIA(A,0,TX)
	AY=ARMIA[A][0][TY];											//	   AY=ARMIA(A,0,TY)
	PL=ARMIA[A][0][TMAG];										//	   PL=ARMIA(A,0,TMAG)
	if( PREFS[5]==1 ) {
		WJAZD(AX,AY,80,80,150,100,4);					//	   If PREFS(5)=1 : WJAZD[AX,AY,80,80,150,100,4] : End If
	}

	if( A<20 ) {
		DANE=-1;
	} else {
		if( ARMIA[A][0][TMAGMA]==0 || ARMIA[A][0][TMAGMA]==100 ) {
			DANE=-1;
		}
	}

	if( DANE!=0 ) {
		TEREN=ARMIA[A][0][TNOGI];
		AX=ARMIA[A][0][TX];
		AY=ARMIA[A][0][TY];
	}

	rysuj();
	_ARMIA_RYSUJ_INFO(A);

	void *sb=0, *sb2=0;
	sb = StoreBuffer(OKX-1,OKY-1,150+2,100+2);

	do {																		//	   Repeat
		rysuj();
		RestoreBuffer(sb);
		WaitVbl();
		if( MouseClick() ) {									//	      If Mouse Click=1
			STREFA=MouseZone();									//	         STREFA=Mouse Zone
			if( STREFA==1 || STREFA==0 ) {			//	         If STREFA=1 or STREFA=0
				KONIEC=-1;												//	            KONIEC=True
				ZOKNO();													//	            ZOKNO
			}																		//	         End If
			if( STREFA==11 ) {									//	         If STREFA=11
				//WPISZ(OKX+50,OKY+15,1,30,14,0);			//	            WPISZ[OKX+50,OKY+15,1,30,14]

				_rysuj_tlo_armia = rysuj_ekran_ptr;
				rysuj_ekran_ptr = _rysuj_armia;
				WPISZ_PC(OKX+50,OKY+15-TextBase(),100,10,14,ARMIA_S[A][0],2);	//rysuj tylko tlo i kursor
				rysuj_ekran_ptr = _rysuj_tlo_armia;
				sb = StoreBuffer(OKX-1,OKY-1,150+2,100+2);

				ARMIA_S[A][0]=WPI_S;							//	            ARMIA$(A,0)=WPI$
			}																		//	         End If
			if( STREFA==10 && A<20 ) {					//	         If STREFA=10 and A<20
				ZOKNO();													//	            ZOKNO
				KONIEC=-1;												//	            KONIEC=True
				rysuj();
				_ARMIA_RYSUJ_ROZKAZY(A);					//	            Gosub RYSUJ_ROZKAZY
				sb2 = StoreBuffer(OKX-1,OKY-1,80+2,150+2);
				KONIEC2=0;												//	            KONIEC2=False
				do {															//	            Repeat
					rysuj();
					RestoreBuffer(sb2);
					WaitVbl();
					if( MouseClick() ) {						//	               If Mouse Click=1
						STREFA2=MouseZone();					//	                  STREFA2=Mouse Zone
						if( STREFA2>0 && STREFA2<4 ) {//	                  If STREFA2>0 and STREFA2<4
							ZOKNO();										//	                     ZOKNO
							M_RUCH(A,STREFA2);					//	                     M_RUCH[A,STREFA2]
							KONIEC2=-1; KONIEC=-1;			//	                     KONIEC2=True : KONIEC=True
						}															//	                  End If
						if( STREFA2==4 && TEREN<70 ) {//	                  If STREFA2=4 and TEREN<70
							ZOKNO();										//	                     ZOKNO
							ARMIA[A][0][TTRYB]=4;				//	                     ARMIA(A,0,TTRYB)=4
							KONIEC2=-1; KONIEC=-1;			//	                     KONIEC=True : KONIEC2=True
						}															//	                  End If
						if( STREFA2==4 && TEREN>69 ) {//	                  If STREFA2=4 and TEREN>69
							if( MIASTA[TEREN-70][0][M_CZYJE]==1 ) {//	                     If MIASTA(TEREN-70,0,M_CZYJE)=1
								ZOKNO();									//	                        ZOKNO
								ARMIA[A][0][TTRYB]=0;			//	                        ARMIA(A,0,TTRYB)=0
								REKRUTACJA(10,TEREN-70,A);//	                        REKRUTACJA[10,TEREN-70,A]
								_ARMIA_RYSUJ_ROZKAZY(A);		//	                        Gosub RYSUJ_ROZKAZY
							}														//	                     End If
						}															//	                  End If
																					//
						if( STREFA2==6 ) {						//	                  If STREFA2=6
							ZOKNO();										//	                     ZOKNO
							SpriteOnOff(2,false);				//	                     Sprite Off 2
																					//	                     'Auto View Off
							_LOAD(KAT_S+"dane/gad","dane:gad","Dane",1);	//	                     _LOAD[KAT$+"dane/gad","dane:gad","Dane",1]
							ScreenOpen(1,320,160,32,LOWRES);//	                     Screen Open 1,320,160,32,Lowres
							Screen(1);									//	                     Screen 1
																					//	                     Curs Off : Flash Off
							ReserveZone(60);						//	                     Reserve Zone 60 : Get Bob Palette : Set Font FON1
							SetFont(FON1);
							GOBY=44;										//	                     GOBY=44
																					//	                     'Auto View On
							ARM=A;											//	                     ARM=A
							for(I=1;I<=10;++I) {				//	                     For I=1 To 10
								if( ARMIA[A][I][TE]>0 ) {	//	                        If ARMIA(A,I,TE)>0
									NUMER=I;								//	                           NUMER=I
									I=10;										//	                           I=10
								}													//	                        End If
							}														//	                     Next
							WYBOR(1);										//	                     WYBOR[1]
							ScreenClose(1);							//	                     Screen Close 1
							for(I=1;I<=50;++I) {				//	                     For I=1 To 50
								DelBob(GOBY+1);						//	                        Del Bob GOBY+1
							}														//	                     Next
							Screen(0);									//	                     Screen 0
							Sprite(2,SPX,SPY,1);				//	                     Sprite 2,SPX,SPY,1
							_ARMIA_RYSUJ_ROZKAZY(A);			//	                     Gosub RYSUJ_ROZKAZY
						}															//	                  End If
																					//
						if( STREFA2==8 ) {						//	                  If STREFA2=8
							KONIEC=-1;KONIEC2=-1;				//	                     KONIEC=True : KONIEC2=True
							ARMIA[A][0][TWAGA]=1;				//	                     ARMIA(A,0,TWAGA)=1
							ARM=A; WRG=40;							//	                     ARM=A : WRG=40
							SpriteOnOff(2,false);				//	                     Sprite Off 2
							SETUP(GS("070"),GS("071"),GS("072"));			//	                     SETUP["","Action",""]
							if( TEREN>69 ) {						//	                     If TEREN>69
								TER2=MIASTA[TEREN-70][1][M_X];//	                        TER2=MIASTA(TEREN-70,1,M_X)
								RYSUJ_SCENERIE(TER2,TEREN-70);//	                        RYSUJ_SCENERIE[TER2,TEREN-70]
								WRG=40;										//	                        WRG=40
																					//	                        'ustaw wieôniaków
								for(I=1;I<=7;++I) {				//	                        For I=1 To 7 : NOWA_POSTAC[40,I,9] : Next I
									NOWA_POSTAC(40,I,9);
								}
								for(I=8;I<=10;++I) {			//	                        For I=8 To 10 : NOWA_POSTAC[40,I,Rnd(8)] : Next I
									NOWA_POSTAC(40,I,Rnd(8));
								}
								for(I=1;I<=7;++I) {				//	                        For I=1 To 7 : ARMIA(40,I,TKORP)=20 : Next I
									ARMIA[40][I][TKORP]=20;
								}
								for(I=8;I<=10;++I) {			//	                        For I=8 To 10 : ARMIA(WRG,I,TKORP)=40 : Next I
									ARMIA[WRG][I][TKORP]=40;
								}
								ARMIA[40][0][TE]=10;			//	                        ARMIA(40,0,TE)=10
								USTAW_WOJSKO(WRG,1,1,1);	//	                        USTAW_WOJSKO[WRG,1,1,1]
							} else {										//	                     Else
								ARMIA[WRG][0][TE]=0;			//	                        ARMIA(WRG,0,TE)=0
								RYSUJ_SCENERIE(TEREN,-1);	//	                        RYSUJ_SCENERIE[TEREN,-1]
							}														//	                     End If
							USTAW_WOJSKO(ARM,1,1,0);		//	                     USTAW_WOJSKO[ARM,1,1,0]
							MAIN_ACTION();							//	                     MAIN_ACTION
																					//	                     'skasuj wieôniaków
							for(I=0;I<=10;++I) {				//	                     For I=0 To 10 : ARMIA(40,I,TE)=0 : Next I
								ARMIA[40][I][TE]=0;
							}
							SETUP0();										//	                     SETUP0
							VISUAL_OBJECTS();						//	                     VISUAL_OBJECTS
							CENTER(AX,AY,0);						//	                     CENTER[AX,AY,0]
							Sprite(2,SPX,SPY,1);				//	                     Sprite 2,SPX,SPY,1
						}															//	                  End If
																					//
						if( STREFA2==5 ) {						//	                  If STREFA2=5
							ZOKNO();										//	                     ZOKNO
							ARMIA[A][0][TTRYB]=0;				//	                     ARMIA(A,0,TTRYB)=0
							KONIEC=-1;KONIEC2=-1;				//	                     KONIEC=True : KONIEC2=True
						}															//	                  End If
						if( STREFA2==7 ) {						//	                  If STREFA2=7
							ZOKNO();										//	                     ZOKNO
							KONIEC2=-1;									//	                     KONIEC2=True
						}															//	                  End If
					}																//	               End If
				} while( 0==KONIEC2 );						//	            Until KONIEC2
			}																		//	         End If
			if( STREFA==10 && A>19 ) {					//	         If STREFA=10 and A>19
				if( ARMIA[A][0][TMAGMA]==0 ) {		//	            If ARMIA(A,0,TMAGMA)=0
					gad_text(1.0);									//	               Ink 31,6 : Text OKX+48,OKY+89,"@"
					Text(OKX+48,OKY+89,"@");
					ARMIA[A][0][TMAGMA]=100;				//	               ARMIA(A,0,TMAGMA)=100
					goto SKIP;											//	               Goto SKIP
				}																	//	            End If
				if( ARMIA[A][0][TMAGMA]==100 ) {	//	            If ARMIA(A,0,TMAGMA)=100
					gad_text(1.0);									//	               Gr Writing 1 : Ink 6,6
					Text(OKX+47,OKY+89,"  ");				//	               Text OKX+47,OKY+89,"  "
					ARMIA[A][0][TMAGMA]=0;					//	               ARMIA(A,0,TMAGMA)=0
				}																	//	            End If
				if( ARMIA[A][0][TMAGMA]>0 && ARMIA[A][0][TMAGMA]<100 ) {//	            If ARMIA(A,0,TMAGMA)>0 and ARMIA(A,0,TMAGMA)<100
					ZOKNO();												//	               ZOKNO
					KONIEC=-1;											//	               KONIEC=True
					SZPIEGUJ(A,1);									//	               SZPIEGUJ[A,1]
				}																	//	            End If
				SKIP:															//	            SKIP:
					;
			}																		//	         End If
		}																			//	      End If
	} while( KONIEC==0 );										//	   Until KONIEC

	FreeBuffer(sb);
	FreeBuffer(sb2);
																					//	   Goto OVER
																					//	   OVER:
																					//	End Proc
}