Пример #1
0
int main(int argc, char **argv)
{
    /* Intialize debugging */
    SDInit();
    
    if ((IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0))) 
    {
	if ((GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0))) 
        {
	    if ((DOSBase = (struct DosLibrary *) OpenLibrary("dos.library",0)))
	    {
	      struct Screen *screen;
	      struct Window *w1;

	      
              if ((screen = openscreen())) 
              {
		w1 = openwindow(screen, "Window 1",  W1_LEFT, W1_TOP, W1_WIDTH, W1_HEIGHT);
		if (w1)
		{

#ifdef USE_TWO_WINDOWS
		    struct Window *w2;

		    w2 = openwindow(screen, "Window 2", W2_LEFT, W2_TOP, W2_WIDTH, W2_HEIGHT);
		    if (w2)
		    {

#endif	       
			/* Wait forever */
			// test_readpixel(w1);
/*			SetAPen(w1->RPort, 3);
			SetBPen(w1->RPort, 4);
			test_blttemplate(w1);
*/
			test_linedrawing(w1, w2);
/*			handleevents(w1, 0);*/

#ifdef USE_TWO_WINDOWS		
			CloseWindow(w2);
		    }
#endif		    
		    CloseWindow(w1);
		}
		CloseScreen(screen);
	      }
              CloseLibrary((struct Library *)DOSBase);
	  }
	  CloseLibrary((struct Library *)GfxBase);
	}
	CloseLibrary((struct Library *) IntuitionBase);
    }
    return 0;
} /* main */
Пример #2
0
int main(int argc, char **argv)
{
int x, y;

    if ((IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0))) 
    {
	if ((GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0))) 
        {
	    if ((DOSBase = (struct DosLibrary *) OpenLibrary("dos.library",0)))
	    {
	      struct Window *w1;

		w1 = openwindow(100, 100, 100, 100);

		if (w1)
		{
		    printf( "MoveWindow()...\n" );
		    for( x=0 ; x<50 ; x++ )
		    {
			MoveWindow(w1,1,0);
//			RefreshWindowFrame(w1);
		    }
		    for( y=0 ; y<50 ; y++ )
		    {
			MoveWindow(w1,0,1);
//			RefreshWindowFrame(w1);
		    }

		    printf( "ChangeWindowBox()...\n" );
		    for( x=0 ; x<50 ; x++ )
		    {
			ChangeWindowBox(w1,150-x,150-x,100+x,100+x);
			RefreshWindowFrame(w1);
		    }

		    printf( "SizeWindow()...\n" );
		    for( y=0 ; y<50 ; y++ )
		    {
			SizeWindow(w1,-1,-1);
			RefreshWindowFrame(w1);
		    }

		    printf( "Done!\nPress a key or click closegadget to quit.\n" );

		    Wait(1L<<w1->UserPort->mp_SigBit);
		    msg = (struct IntuiMessage *)GetMsg(w1->UserPort);
		    /* Catch any message to quit */
		    ReplyMsg((struct Message *)msg);

		    CloseWindow(w1);
		}
              CloseLibrary((struct Library *)DOSBase);
	  }
	  CloseLibrary((struct Library *)GfxBase);
	}
	CloseLibrary((struct Library *) IntuitionBase);
    }
    return 0;
} /* main */
Пример #3
0
void global uiopenpopup( DESCMENU *desc, UI_WINDOW *window )
{
    window->area = desc->area;
    window->priority = P_DIALOGUE;
    window->update = NULL;
    window->parm = NULL;
    openwindow( window );
}
Пример #4
0
void intern openbackground( void )
/********************************/
{
    UIData->blank.area.row = 0;
    UIData->blank.area.col = 0;
    UIData->blank.area.height = UIData->height;
    UIData->blank.area.width = UIData->width;
    UIData->blank.priority = P_BACKGROUND;
    UIData->blank.update = backblank;
    UIData->blank.parm = (void *)0xbb;// NULL is reserved for CGUI screens!
    openwindow( &UIData->blank );
}
Пример #5
0
int main(int argc,char *argv[])
   {
   char title[STR_MAX];

   setlocale(LC_NUMERIC,"C");

   snprintf(title,STR_MAX,"V^3 %s: Versatile Volume Viewer (c) by Stefan Roettger",VERSION);
   openwindow(WIN_WIDTH,WIN_HEIGHT,WIN_FPS,title);

   initglobal(argc,argv);
   addhandler(handler);

   return(0);
   }
Пример #6
0
int main(int argc, char* argv[])
{
	afout.open("out.txt");
	wclock = new sf::Clock;

	bool record = true;
	bool init_selection = true;
	
	if (argc > 1)
	{
		if (strcmp(argv[1], "norecord")==0) record = false;
		else init_selection = false;
	}
	
	if (init_selection)
	{
		if (record) DeleteDirectory("arch");
		int ngenerations = 100;
		
		int ngs = 2;
		Genome** gs = new Genome*[ngs];
		gs[0] = readgenome("shipmind.mind");
		gs[1] = readgenome("shipmind2.mind");
		
		Population* pop = new Population(gs, ngs);

		for (int gen = 0; gen < ngenerations; gen++)
		{
			pop->calcfitness(evaluate);
			pop->printspecies();
			if (record) pop->savegeneration();
			pop->nextgen();
		}
		
		return 0;
	}
	
	else
	{
		Genome* g1 = readgenome(argv[1]);
		Genome* g2 = 0;
		if (argc > 2)
			g2 = readgenome(argv[2]);
		else
			g2 = readgenome("shipmind.mind");
		
		return openwindow(g1, g2);
	}
}
Пример #7
0
void UIAPI uibandinit( SAREA start, ATTR attr )
{
    Attr = attr;
    start.width++;
    start.height++;
    BandArea = start;
    start.width = 0;
    start.height = 0;
    BandWnd.area = start;
    BandWnd.priority = P_UNBUFFERED;
    BandWnd.update = drawband;
    BandWnd.parm = NULL;
    openwindow( &BandWnd );
    BandWnd.dirty_area = BandArea;
}
Пример #8
0
VBARMENU* global uimenubar( VBARMENU *bar )
/*****************************************/
{
    register    int                     count;
    register    MENUITEM*               menus;
    register    VBARMENU*               prevMenu;

    if( NumMenus > 0 ) {
        closewindow( &BarWin );
        NumMenus = 0;
    }
    prevMenu = Menu;
    Menu = bar;
    /* resetting old_shift is a bit kludgy but it's either this or */
    /* rewrite a bunch of code that somebody else wrote - yuk      */
    /* UIData->old_shift = 0;                                      */
    if( Menu != NULL ) {
        Menu->active = FALSE;
        Menu->draginmenu = FALSE;
        Menu->indicators = TRUE;
        Menu->altpressed = FALSE;
        Menu->ignorealt = FALSE;
        Menu->movedmenu = FALSE;
        Menu->popuppending = FALSE;
        Menu->disabled = FALSE;
        count = 0;
        for( menus = Menu->titles; !MENUENDMARKER( *menus ); ++menus ) {
            if( ++count >= MAX_MENUS ) {
                break;
            }
        }
        NumMenus = count;
        uisetmenudesc();
        BarWin.area.row = 0;
        BarWin.area.col = 0;
        BarWin.area.height = uimenuheight();
        BarWin.area.width = UIData->width;
        BarWin.priority = P_MENU;
        BarWin.update = drawbar;
        BarWin.parm = NULL;
        openwindow( &BarWin );
        InitMenuPopupPending = FALSE;
    }
    return( prevMenu );
}
Пример #9
0
int ploton(int height,int width)

{
    int openwindow(int,int);
    
    if (height < 10) height = 10;
    if (width < 10) width = 10;
    
    scalex = width;
    scaley = height;
    ymaxim = height;
    
    if(!openwindow(width,height))
	return(0);
    //XSelectInput(theDisplay, theWindow, ButtonPressMask|KeyPressMask);
    XSelectInput(theDisplay, theWindow, ButtonPressMask|Button1MotionMask|Button3MotionMask);
    return(1);
}
Пример #10
0
VSCREEN* global uivopen( register VSCREEN *vptr )
/***********************************************/
{
    register    char*                   box;
    register    ATTR                    attr;
    register    int                     priority;
    register    void                    (_FAR *updatertn)( struct sarea, void * );
    register    bool                    okbuffer;
    register    int                     len;
    register    ORD                     col;
    register    unsigned int            flags;
    register    bool                    covered;
    auto        SAREA                   area;

    okarea( vptr->area );
    flags = vptr->flags;
    area = vptr->area;
    if( ( flags & V_DIALOGUE ) != 0 ) {
        if( flags & V_LISTBOX ) {
            box = (char *)&UiGChar[ UI_SBOX_TOP_LEFT ];
            attr = UIData->attrs[ ATTR_NORMAL ];
        } else {
            box = (char *)&UiGChar[ UI_BOX_TOP_LEFT ];
            attr = UIData->attrs[ ATTR_DIAL_FRAME ];
        }
        priority = P_DIALOGUE;
    } else {
        flags &= ~V_UNBUFFERED;
        box = (char *)&UiGChar[ UI_SBOX_TOP_LEFT ];
        attr = UIData->attrs[ ATTR_FRAME ];
        priority = P_VSCREEN;
    }
    if( ( flags & V_UNFRAMED ) == 0 ) {
        (area.row)--;
        (area.col)--;
        (area.height) += 2;
        (area.width) += 2;
        okarea( area );
    }
    if( ( flags & V_UNBUFFERED ) != 0 ) {
        priority = P_UNBUFFERED;
        bfake( &(vptr->window.type.buffer), area.row, area.col );
        okbuffer = TRUE;
        updatertn = NULL;
    } else {
        okbuffer = balloc( &(vptr->window.type.buffer), area.height, area.width );
        updatertn = (void(*)(struct sarea,void *))update;
    }
    if( okbuffer ) {
        vptr->window.area = area;
        vptr->window.priority = priority;
        vptr->window.update = updatertn;
        vptr->window.parm = vptr;
        covered = openwindow( &(vptr->window) );
        vptr->flags = flags;
        if( ( flags & V_UNFRAMED ) == 0 ) {
            if( ( !UIData->no_blowup ) &&
                ( covered == FALSE ) &&
                ( ( flags & V_NO_ZOOM ) == 0 ) ) {
                blowup( &UIData->screen, area, box, attr );
            }
            area.row = 0;
            area.col = 0;
            drawbox( &(vptr->window.type.buffer), area, box, attr, FALSE );
            if( vptr->name != NULL ) {
#if 0
do not delete this stuff
                col = 0;
                len = area.width;
                bstring( &(vptr->window.type.buffer), 0, col,
                         UIData->attrs[ATTR_CURR_SELECT_DIAL], " ", len );
                len = __min( strlen( vptr->name ), area.width );
                col = ( area.width - len ) / 2;
                bstring( &(vptr->window.type.buffer), 0, col,
                         UIData->attrs[ATTR_CURR_SELECT_DIAL], vptr->name, len );
#else
                len = __min( strlen( vptr->name ), area.width );
                col = ( area.width - len ) / 2;
                bstring( &(vptr->window.type.buffer), 0, col,
                         attr, vptr->name, len );
#endif
            }
            bframe( &(vptr->window.type.buffer ) );
        }
        area = vptr->area;
        area.row = 0;
        area.col = 0;
        vptr->open = TRUE;
        uivfill( vptr, area, UIData->attrs[ ATTR_NORMAL ], ' ' );
        uivsetcursor( vptr );

        return( vptr );
    }
    return( NULL );
}
Пример #11
0
void debugloop() {
    int key;
  a:
    if (!(debugds & 2))
        nextopcode();
    if (!(debugds & 1))
        nextspcopcode();

  b:
    // redrawing the display is always a good idea
    refresh();
    wrefresh(debugwin);

   key = getch();
   if (key >= 0 && key < 256)
       key = toupper(key);

   switch (key) {
   case KEY_F(1): // run
       execut = 1;
       return;

   case KEY_F(2): // debugsavestate
       statesaver();
       goto b;

   case KEY_F(4): // debugloadstate
       debugloadstate();
       goto a;

   case 27:       // exit
       return;

   case '\n':     // step
       goto e;


   /* Ported this but couldn't bring myself to commit it.
      pagefault said to remove it.
   case '-':      // skip opcode
   */

   case 'C':      // clear
       numinst = 0;
       goto a;

   case 'M':      // modify
   {
       WINDOW *w;
       unsigned addr, value, n;

       w = openwindow(7, 33, 11, 24, "    Enter Address : ");
       mvwaddstr(w, 3, 1,            "    Previous Value: ");
       mvwaddstr(w, 5, 1,            "    Enter Value   : ");

       wrefresh(w);

       echo();
       n = mvwscanw(w, 1, 21, "%x", &addr);
       noecho();

       if (n == 1) {
       mvwprintw(w, 3, 21, "%02x", memtabler8_wrapper(addr >> 16, addr));
       wrefresh(w);

       echo();
       n = mvwscanw(w, 5, 21, "%x", &value);
       noecho();

       if (n == 1) {
          memtablew8_wrapper(addr >> 16, addr, value);
       }}

       closewindow(w);
       goto b;
   }
Пример #12
0
int main(int argc, char **argv)
{
    struct myargs args = {NULL};
    struct RDArgs *rda;

    if ((IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0))) 
    {
	if ((GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0))) 
        {
	    if ((DOSBase = (struct DosLibrary *) OpenLibrary("dos.library",0)))
	    {
		rda = ReadArgs("LEFT/K/N,TOP/K/N,WIDTH/N,HEIGHT/N,DEPTH/K/N,MODEID/K,OVERSCAN/K/N,SCROLL/K/N,DRAG/K/N,LIKEWB/K/N", (IPTR *)&args, NULL);
		if (rda) {
		    struct Screen *screen;
		    struct Window *w1;
		    ULONG oserr = 0;
		    struct TagItem tags[] = {
			{SA_Width,     640			         },
			{SA_Height,    480			         },
			{SA_Depth,     4			         },
			{TAG_IGNORE,   0			         },
			{TAG_IGNORE,   0			         },
			{TAG_IGNORE,   0			         },
			{TAG_IGNORE,   0			         },
			{TAG_IGNORE,   0			         },
			{TAG_IGNORE,   0			         },
			{TAG_IGNORE,   0			         },
			{SA_Title,     (IPTR)"Screen opening and movement test"},
			{SA_ErrorCode, (IPTR)&oserr			         },
			{TAG_DONE,     0				 }
		    };

		    if (args.width)
		        tags[0].ti_Data = *args.width;
		    if (args.height)
		        tags[1].ti_Data = *args.height;
		    if (args.depth)
		        tags[2].ti_Data = *args.depth;
		    printf("Opening screen, size: %lux%lu, depth: %lu\n", tags[0].ti_Data, tags[1].ti_Data, tags[3].ti_Data);
		    if (args.mode) {
		        tags[3].ti_Tag  = SA_DisplayID;
			tags[3].ti_Data = strtoul(args.mode, NULL, 16);
			printf("ModeID: 0x%08lX\n", tags[3].ti_Data);
		    }
		    if (args.scroll) {
			tags[4].ti_Tag = SA_AutoScroll;
			tags[4].ti_Data = *args.scroll;
			printf("SA_AutoScroll: %ld\n", tags[4].ti_Data);
		    }
		    if (args.drag) {
			tags[5].ti_Tag = SA_Draggable;
			tags[5].ti_Data = *args.drag;
			printf("SA_Draggable: %ld\n", tags[5].ti_Data);
		    }
		    if (args.likewb) {
			tags[6].ti_Tag = SA_LikeWorkbench;
			tags[6].ti_Data = *args.likewb;
			printf("SA_LikeWorkbench: %ld\n", tags[6].ti_Data);
		    }
		    if (args.oscan) {
			tags[7].ti_Tag = SA_Overscan;
			tags[7].ti_Data = *args.oscan;
			printf("SA_Overscan: %ld\n", tags[7].ti_Data);
		    }
		    if (args.left) {
			tags[8].ti_Tag = SA_Left;
			tags[8].ti_Data = *args.left;
			printf("SA_Left: %ld\n", tags[8].ti_Data);
		    }
		    if (args.top) {
			tags[9].ti_Tag = SA_Top;
			tags[9].ti_Data = *args.top;
			printf("SA_Top: %ld\n", tags[9].ti_Data);
		    }

		    screen = OpenScreenTagList(NULL, tags);
                    if (screen) {
			w1 = openwindow(screen, "Screen data",  W1_LEFT, W1_TOP, W1_WIDTH, W1_HEIGHT);
			if (w1) {
			    WORD x = w1->BorderLeft;
		            WORD y = w1->BorderTop;
			    struct BitMap *bitmap = screen->RastPort.BitMap;

			    y = drawtext(w1, x, y, "Requested size: %lux%lu", tags[0].ti_Data, tags[1].ti_Data);
			    y = drawtext(w1, x, y, "Requested depth: %lu", tags[2].ti_Data);
			    if (args.mode)
			        y = drawtext(w1, x, y, "Requested ModeID: 0x%08lX", tags[3].ti_Data);
			    y = drawtext(w1, x, y, "Actual size: %ux%u", screen->Width, screen->Height);
			    y = drawtext(w1, x, y, "Actual ModeID: 0x%08X", screen->ViewPort.ColorMap->VPModeID);
			    y = drawtext(w1, x, y, "Flags: 0x%04lX", screen->Flags);
			    y = drawtext(w1, x, y, "BitMap size: %ux%u", GetBitMapAttr(bitmap, BMA_WIDTH), GetBitMapAttr(bitmap, BMA_HEIGHT));
			    y = drawtext(w1, x, y, "BitMap depth: %u", GetBitMapAttr(bitmap, BMA_DEPTH));
			    handleevents(w1, screen, x, y);
			    CloseWindow(w1);
			}
		        CloseScreen(screen);
		    } else
		        printf("Failed to open screen, error: %d\n", (int)oserr);
		    FreeArgs(rda);
	        } else
		    printf("Error parsing arguments\n");
                CloseLibrary((struct Library *)DOSBase);
	    }
	    CloseLibrary((struct Library *)GfxBase);
	}
	CloseLibrary((struct Library *) IntuitionBase);
    }
    return 0;
} /* main */