void amiga_init (char *dir) { if ((DefaultPubScreen = LockPubScreen (0)) == 0) exit (1); screen_ratio (DefaultPubScreen); char prog_name[256]; static char font_name[MAXFONTPATH]; char *font_desc, *name_ptr; static WORD pens[] = {-1}; static struct TextAttr font = {NULL, 0, FS_NORMAL, 0}; int window = 0; if (Icon == NULL) { if (GetProgramName (prog_name, 256)) Icon = GetDiskObject (prog_name); } if (Icon) { if (FindToolType (Icon->do_ToolTypes, "WINDOW")) window = 1; if (font_desc = FindToolType (Icon->do_ToolTypes, "FONT")) { strcpy (font_name, font_desc); if (name_ptr = strrchr (font_name, '/')) { font.ta_Name = font_name; font.ta_YSize = atoi (name_ptr + 1); strcpy (name_ptr, ".font"); } } if (font.ta_Name) Font = OpenDiskFont (&font); } if (Font == NULL) { font.ta_Name = "topaz.font"; font.ta_YSize = 8; Font = OpenFont (&font); } if (window == 0) { if ((Screen = OpenScreenTags (0, SA_Pens, pens, SA_DisplayID, GetVPModeID (&DefaultPubScreen->ViewPort), SA_Overscan, OSCAN_TEXT, SA_Depth, 2, SA_Type, CUSTOMSCREEN | AUTOSCROLL, SA_Font, &font, SA_Title, TitleBar, TAG_DONE)) == 0) exit (1); } if ((Window = OpenWindowTags (0, WA_Left, 0, WA_Top, Screen ? 2 : DefaultPubScreen->BarHeight + 1, WA_Width, Screen ? Screen->Width : ScreenWidth, WA_Height, Screen ? Screen->Height - 2 : ScreenHeight - DefaultPubScreen->BarHeight - 1, WA_SmartRefresh, 1, WA_NewLookMenus, 1, WA_AutoAdjust, 1, WA_Borderless, Screen ? 1 : 0, WA_Backdrop, Screen ? 1 : 0, WA_Activate, 1, WA_CloseGadget, Screen ? 0 : 1, WA_DragBar, Screen ? 0 : 1, WA_DepthGadget, Screen ? 0 : 1, WA_SizeGadget, Screen ? 0 : 1, WA_SizeBBottom, Screen ? 0 : 1, WA_Title, TitleBar, WA_ScreenTitle, TitleBar, WA_IDCMP, IDCMP_RAWKEY | IDCMP_VANILLAKEY | IDCMP_MENUPICK | IDCMP_CLOSEWINDOW | IDCMP_CHANGEWINDOW, Screen ? WA_CustomScreen : WA_PubScreen, Screen ? Screen : DefaultPubScreen, TAG_DONE)) == 0) exit (1); ThisProcess = (struct Process *)FindTask(0); OldWindowPtr = ThisProcess->pr_WindowPtr; ThisProcess->pr_WindowPtr = Window; if ((Visual = GetVisualInfo (Window->WScreen, TAG_DONE)) == 0) exit (1); if ((Menus = CreateMenus (NewMenus, GTMN_NewLookMenus, TRUE, TAG_DONE)) == 0) exit (1); LayoutMenus (Menus, Visual, GTMN_NewLookMenus, TRUE, TAG_DONE); SetMenuStrip (Window, Menus); if ((GameReq = alloc_freq (dir)) == 0) exit (1); if ((SaveReq = alloc_freq (dir)) == 0) exit (1); if ((ScriptReq = alloc_freq (dir)) == 0) exit (1); RastPort = Window->RPort; SetDrMd (RastPort, JAM2); SetAPen (RastPort, 1); SetBPen (RastPort, 0); SetFont (RastPort, Font); DisplayHeight = ((Window->Height - Window->BorderTop - Window->BorderBottom) / RastPort->TxHeight) - 1; PreviousHeight = DisplayHeight; reset_cursor (); }
/* ** main routine. Open required library and window and draw the images. ** This routine opens a very simple window with no IDCMP. See the ** chapters on "Windows" and "Input and Output Methods" for more info. ** Free all resources when done. */ int main(int argc, char *argv[]) { struct Window *win; struct Image myImage; IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",37); if (IntuitionBase != NULL) { #ifdef __AROS__ if (NULL != (win = OpenWindowTags(NULL, WA_Width, 200, WA_Height, 100, WA_RMBTrap, TRUE, WA_IDCMP, IDCMP_RAWKEY, TAG_END))) #else if (NULL != (win = OpenWindowTags(NULL, WA_Width, 200, WA_Height, 100, WA_RMBTrap, TRUE, TAG_END))) #endif { myImage.LeftEdge = MYIMAGE_LEFT; myImage.TopEdge = MYIMAGE_TOP; myImage.Width = MYIMAGE_WIDTH; myImage.Height = MYIMAGE_HEIGHT; myImage.Depth = MYIMAGE_DEPTH; myImage.ImageData = myImageData; myImage.PlanePick = 0x1; /* use first bit-plane */ myImage.PlaneOnOff = 0x0; /* clear all unused planes */ myImage.NextImage = NULL; /* Draw the 1 bit-plane image into the first bit-plane (color 1) */ DrawImage(win->RPort,&myImage,10,10); /* Draw the same image at a new location */ DrawImage(win->RPort,&myImage,100,10); #ifdef __AROS__ /* Wait for a keypress */ Wait (1L << win->UserPort->mp_SigBit); #else /* Wait a bit, then quit. ** In a real application, this would be an event loop, like the ** one described in the Intuition Input and Output Methods chapter. */ Delay(200); #endif CloseWindow(win); } CloseLibrary((struct Library *)IntuitionBase); } return 0; }
static void makewin(void) { shapehook.h_Entry = HookEntry; shapehook.h_SubEntry = (HOOKFUNC)shapefunc; win = OpenWindowTags(NULL, WA_CustomScreen , (IPTR)scr, WA_InnerWidth , WINWIDTH, WA_InnerHeight , WINHEIGHT, WA_Title , (IPTR)"Round Edged Window", WA_DragBar , TRUE, //WA_DepthGadget , TRUE, //WA_CloseGadget , TRUE, WA_Activate , TRUE, WA_MinWidth , 160, WA_MinHeight , 160, WA_MaxWidth , 2000, WA_MaxHeight , 2000, WA_SizeGadget , TRUE, WA_SizeBBottom , TRUE, WA_NoCareRefresh , TRUE, WA_ShapeHook , (IPTR)&shapehook, WA_IDCMP , IDCMP_CLOSEWINDOW | IDCMP_RAWKEY | IDCMP_NEWSIZE, TAG_DONE); if (!win) cleanup("Can't open window"); rp = win->RPort; }
struct Window *openwindow(LONG x, LONG y, LONG w, LONG h) { struct Window *window; struct Rectangle R; R.MinX = 10; R.MinY = 10; R.MaxX = 100; R.MaxY = 100; window = OpenWindowTags(NULL, WA_IDCMP, IDCMP_RAWKEY|IDCMP_CLOSEWINDOW, WA_Left, x, WA_Top, y, WA_Height, w, WA_Width, h, WA_Activate, TRUE, WA_DepthGadget, TRUE, WA_Zoom, (IPTR)&R, WA_CloseGadget, TRUE, WA_Title, (IPTR)"Windowing demo", TAG_END); printf("Window opened\n"); return window; }
/* ** Open a simple window using OpenWindowTagList() */ int main(int argc, char **argv) { win = OpenWindowTags(0, WA_Title, (IPTR)"glAGetProcAddress", WA_CloseGadget, TRUE, WA_DragBar, TRUE, WA_DepthGadget, TRUE, WA_Left, 10, WA_Top, 10, WA_InnerWidth, 300, WA_InnerHeight, 300, WA_Activate, TRUE, WA_RMBTrap, TRUE, WA_SimpleRefresh, TRUE, WA_NoCareRefresh, TRUE, WA_IDCMP, IDCMP_CLOSEWINDOW, TAG_DONE); initgl(); testextensions(); deinitgl(); CloseWindow(win); return 0; }
struct Window *openwindow(struct Screen *screen, const char *title, LONG x, LONG y, LONG w, LONG h) { struct Window *window; printf("Opening window, screen=0x%p\n", screen); window = OpenWindowTags(NULL, WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_INTUITICKS, WA_Left, x, WA_Top, y, WA_InnerWidth, w, WA_InnerHeight, h, WA_CustomScreen, screen, WA_Activate, TRUE, WA_DepthGadget, TRUE, WA_DragBar, TRUE, WA_CloseGadget, TRUE, WA_NoCareRefresh, TRUE, WA_NotifyDepth, TRUE, WA_Title, title, TAG_END); printf("Window opened\n"); return window; }
static void makewin(void) { win = OpenWindowTags(0, WA_PubScreen , (IPTR)scr, WA_Left , 10, WA_Top , 20, WA_Width , 200, WA_Height , 190, WA_MinWidth , 50, WA_MinHeight , 50, WA_MaxWidth , 4000, WA_MaxHeight , 4000, WA_AutoAdjust , TRUE, WA_Title , (IPTR)"ColorWheel", WA_CloseGadget , TRUE, WA_DragBar , TRUE, WA_DepthGadget , TRUE, WA_SizeGadget , TRUE, WA_SizeBBottom , TRUE, WA_Activate , TRUE, WA_ReportMouse , TRUE, WA_IDCMP , IDCMP_CLOSEWINDOW | IDCMP_IDCMPUPDATE, WA_Gadgets , (IPTR)gradgad, TAG_DONE); if (!win) cleanup("Can't open window!"); }
void openWindow(void) { int windowHeight; struct Screen *lockscreen; strcpy(NiKomReleaseStr, NIKRELEASE " (" __DATE__ " " __TIME__ ")"); sprintf(windowTitle, "NiKom %s, 0 noder aktiva", NiKomReleaseStr); if(!(lockscreen = LockPubScreen(pubscreen[0] == '-' ? NULL : pubscreen))) { cleanup(EXIT_ERROR,"Kunde inte låsa angiven Public Screen\n"); } windowHeight = lockscreen->WBorTop + lockscreen->Font->ta_YSize + 1; NiKWindow = (struct Window *)OpenWindowTags(NULL, WA_Left, xpos, WA_Top, ypos, WA_Width, 500, WA_Height, windowHeight, WA_IDCMP, IDCMP_CLOSEWINDOW, WA_Title, windowTitle, WA_SizeGadget, FALSE, WA_DragBar, TRUE, WA_DepthGadget, TRUE, WA_CloseGadget, TRUE, WA_NoCareRefresh, TRUE, WA_ScreenTitle, "NiKom Server", WA_AutoAdjust, TRUE, WA_PubScreen, lockscreen); UnlockPubScreen(NULL, lockscreen); if(NiKWindow == NULL) { cleanup(EXIT_ERROR, "Could not open window."); } }
struct Window *openwindow(struct Screen *screen, const char *title, LONG x, LONG y, LONG w, LONG h) { struct Window *window; printf("Opening window, screen=%p\n", screen); window = OpenWindowTags(NULL, WA_IDCMP, IDCMP_RAWKEY | IDCMP_CLOSEWINDOW | IDCMP_CHANGEWINDOW, WA_Left, x, WA_Top, y, WA_Width, w, WA_Height, h, WA_CustomScreen, screen, WA_Activate, TRUE, WA_DepthGadget, TRUE, WA_CloseGadget, TRUE, WA_SmartRefresh, TRUE, WA_NotifyDepth, TRUE, WA_Title, title, TAG_END); printf("Window opened\n"); return window; }
void main() { if ((scr = LockPubScreen("Workbench"))) { wnd = OpenWindowTags(NULL, WA_Title, "Textview", WA_CloseGadget, TRUE, WA_DragBar, TRUE, WA_DepthGadget, TRUE, WA_Activate, TRUE, WA_InnerHeight, 400, WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_RAWKEY | IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_VANILLAKEY, WA_SizeGadget, TRUE, WA_MinWidth, 100, WA_MinHeight, 100, WA_MaxWidth, -1, WA_MaxHeight, -1, WA_ReportMouse, TRUE, TAG_DONE); if (wnd) { if ((text = Text_Create())) { Text_SetFrameBox(text, scr, wnd->RPort, (LONG) wnd->BorderLeft, (LONG) wnd->BorderTop, wnd->Width - wnd->BorderLeft - wnd->BorderRight - 1, wnd->Height - wnd->BorderTop - wnd->BorderBottom - 1); Text_Load(text, "DH0:"); Text_Redraw(text); loop(); Text_Free(text); } CloseWindow(wnd); } UnlockPubScreen(NULL, scr); } }
int OpenBlankerWindow( void ) { struct NewGadget ng; struct Gadget *g; UWORD lc, tc; UWORD wleft = BlankerLeft, wtop = BlankerTop, ww, wh; ComputeFont( BlankerWidth, BlankerHeight ); ww = ComputeX( BlankerWidth ); wh = ComputeY( BlankerHeight ); if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww; if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh; if ( ! ( BlankerFont = OpenDiskFont( Font ))) return( 5L ); if ( ! ( g = CreateContext( &BlankerGList ))) return( 1L ); for( lc = 0, tc = 0; lc < Blanker_CNT; lc++ ) { CopyMem((char * )&BlankerNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget )); ng.ng_VisualInfo = VisualInfo; ng.ng_TextAttr = Font; ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge ); ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge ); ng.ng_Width = ComputeX( ng.ng_Width ); ng.ng_Height = ComputeY( ng.ng_Height); BlankerGadgets[ lc ] = g = CreateGadgetA((ULONG)BlankerGTypes[ lc ], g, &ng, ( struct TagItem * )&BlankerGTags[ tc ] ); while( BlankerGTags[ tc ] ) tc += 2; tc++; if ( NOT g ) return( 2L ); } if ( ! ( BlankerWnd = OpenWindowTags( NULL, WA_Left, wleft, WA_Top, wtop, WA_Width, ww + OffX + Scr->WBorRight, WA_Height, wh + OffY + Scr->WBorBottom, WA_IDCMP, BUTTONIDCMP|LISTVIEWIDCMP|IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW, WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SIZEBBOTTOM|WFLG_SMART_REFRESH|WFLG_ACTIVATE|WFLG_RMBTRAP, WA_Gadgets, BlankerGList, WA_Title, BlankerWdt, WA_ScreenTitle, "Garshneblanker", WA_PubScreen, Scr, TAG_DONE ))) return( 4L ); GT_RefreshWindow( BlankerWnd, NULL ); return( 0L ); }
int OpenBlockSelectWindow( void ) { struct NewGadget ng; struct Gadget *g; UWORD lc, tc; UWORD offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1; if ( ! ( g = CreateContext( &BlockSelectGList ))){ CloseBlockSelectWindow(); return( 1L ); } for( lc = 0, tc = 0; lc < BlockSelect_CNT; lc++ ) { CopyMem((char * )&BlockSelectNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget )); ng.ng_VisualInfo = VisualInfo; ng.ng_TextAttr = &topaz8; ng.ng_LeftEdge += offx; ng.ng_TopEdge += offy; BlockSelectGadgets[ lc ] = g = CreateGadgetA((ULONG)BlockSelectGTypes[ lc ], g, &ng, ( struct TagItem * )&BlockSelectGTags[ tc ] ); while( BlockSelectGTags[ tc ] ) tc += 2; tc++; if ( NOT g ){ CloseBlockSelectWindow(); return( 2L ); } } if ( ! ( BlockSelectWnd = OpenWindowTags( NULL, WA_Left, BlockSelectLeft, WA_Top, BlockSelectTop, WA_Width, BlockSelectWidth, WA_Height, BlockSelectHeight + offy, WA_IDCMP, LISTVIEWIDCMP | BUTTONIDCMP | IDCMP_NEWSIZE | IDCMP_REFRESHWINDOW | IDCMP_RAWKEY, WA_Flags, WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_SMART_REFRESH, WA_Gadgets, BlockSelectGList, WA_Title, BlockSelectWdt, WA_MinWidth, 160, WA_MinHeight, 60, WA_MaxWidth, 720, WA_MaxHeight, 467, WA_AutoAdjust, TRUE, WA_PubScreen,Scr, TAG_DONE ))) { CloseBlockSelectWindow(); return( 4L ); } GT_RefreshWindow( BlockSelectWnd, NULL ); return( 0L ); }
void ami_drag_icon_show(struct Window *win, const char *type) { struct DiskObject *dobj = NULL; ULONG *icondata1; ULONG width, height; long format = 0; int err = 0; int deftype = WBPROJECT; drag_in_progress = TRUE; if(nsoption_bool(drag_save_icons) == false) { ami_update_pointer(win, AMI_GUI_POINTER_DRAG); return; } else { ami_update_pointer(win, GUI_POINTER_DEFAULT); } if(!strcmp(type, "drawer")) deftype = WBDRAWER; dobj = GetIconTags(NULL, ICONGETA_GetDefaultName, type, ICONGETA_GetDefaultType, deftype, TAG_DONE); err = IconControl(dobj, ICONCTRLA_GetWidth,&width, ICONCTRLA_GetHeight,&height, TAG_DONE); drag_icon_width = width; drag_icon_height = height; drag_icon = OpenWindowTags(NULL, WA_Left, scrn->MouseX - (width/2), WA_Top, scrn->MouseY - (height/2), WA_Width, width, WA_Height, height, WA_PubScreen, scrn, WA_Borderless, TRUE, WA_ToolBox, TRUE, WA_StayTop, TRUE, WA_Opaqueness, 128, WA_OverrideOpaqueness, TRUE, TAG_DONE); /* probably need layouticon and drawinfo stuff too */ DrawIconState(drag_icon->RPort, dobj, NULL, 0, 0, IDS_NORMAL, ICONDRAWA_Frameless, TRUE, ICONDRAWA_Borderless, TRUE, TAG_DONE); }
struct Window * createMainWindow(int req_width, int req_height) { struct Screen *pubScreen; struct Window *displayWin = NULL; int width, height; pubScreen = LockPubScreen(0); if (pubScreen) { width = ((pubScreen->Width * 4) / 5) & ~0x1f; height = (width * 3 / 4) & ~0x1f; if (req_width && req_width < width) width = req_width & ~0x1f; if (req_height && req_height < height) height = req_height & ~0x1f; if (height >= (pubScreen->Height * 4) / 5) { height = ((pubScreen->Height * 4) / 5) & ~0x1f; width = (height * 4 / 3) & ~0x1f; } } else { width = 320; height = 240; } if ((displayWin = OpenWindowTags(0, WA_PubScreen, (IPTR)pubScreen, WA_Left, 0, WA_Top, (pubScreen) ? pubScreen->BarHeight : 10, WA_InnerWidth, width, WA_InnerHeight, height, WA_Title, (IPTR) "SMP-Smallpt renderer", WA_SimpleRefresh, TRUE, WA_CloseGadget, TRUE, WA_DepthGadget, TRUE, WA_DragBar, TRUE, WA_SizeGadget, FALSE, WA_SizeBBottom, FALSE, WA_SizeBRight, FALSE, WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_REFRESHWINDOW, TAG_DONE)) != NULL) { if (pubScreen) UnlockPubScreen(0, pubScreen); } return displayWin; }
void nsSplashScreenAmigaOS::Open() { if (mIsOpen) return; struct Screen *scr = mIIntuition->LockPubScreen(NULL); uint32 scrWidth, scrHeight; mIIntuition->GetScreenAttrs(scr, SA_Width, &scrWidth, SA_Height, &scrHeight, TAG_DONE); mIIntuition->UnlockPubScreen(NULL, scr); uint32 winX = (scrWidth - splash_img.width) / 2; uint32 winY = (scrHeight - splash_img.height) / 2; mWindow = mIIntuition->OpenWindowTags(NULL, WA_Flags, WFLG_BORDERLESS, WA_IDCMP, 0, WA_Left, winX, WA_Top, winY, WA_InnerWidth, splash_img.width, WA_InnerHeight, splash_img.height, WA_WindowName, "Timberwolf Splash", WA_Hidden, FALSE, TAG_DONE); mIGraphics->BltBitMapTags( BLITA_SrcX, 0, BLITA_SrcY, 0, BLITA_Width, splash_img.width, BLITA_Height, splash_img.height, BLITA_SrcType, BLITT_RGB24, BLITA_Source, splash_img.pixel_data, BLITA_SrcBytesPerRow,splash_img.bytes_per_pixel * splash_img.width, BLITA_DestX, 0, BLITA_DestY, 0, BLITA_DestType, BLITT_RASTPORT, BLITA_Dest, mWindow->RPort, TAG_DONE); mIsOpen = PR_TRUE; }
int vsid_ui_init(void) { int i; vsid_window = (struct Window *)OpenWindowTags(NULL, WA_Left, 20, WA_Top, 20, WA_Width, 400, WA_Height, 200, WA_Title, (ULONG)"VSID: The VICE SID player", WA_DepthGadget, TRUE, WA_CloseGadget, TRUE, WA_SizeGadget, TRUE, WA_DragBar, TRUE, WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_MENUPICK | IDCMP_MENUVERIFY, TAG_END); if (vsid_window == NULL) { return -1; } ui_event_handling = vsid_event_handling; if (vsid_menu_create() != 0) { return -1; } for (i = 0; i < VSID_S_LASTLINE; i++) { vsidstrings[i][0] = 0; vsid_text[i].LeftEdge = 10; vsid_text[i].TopEdge = 25 + i * 10; vsid_text[i].IText = vsidstrings[i]; vsid_text[i].ITextFont = &vsid_font_attr; vsid_text[i].DrawMode = JAM1; vsid_text[i].FrontPen = 1; vsid_text[i].NextText = NULL; } vsid_update_text(); self = (APTR)FindTask(NULL); orig_windowptr = self->pr_WindowPtr; self->pr_WindowPtr = vsid_window; return mui_init(); }
static void makewin(void) { win = OpenWindowTags(NULL, WA_CustomScreen , (IPTR)scr, WA_InnerWidth , SCREENWIDTH, WA_InnerHeight , SCREENHEIGHT, WA_Title , (IPTR)"ReadPixelArray", WA_DragBar , TRUE, WA_DepthGadget , TRUE, WA_CloseGadget , TRUE, WA_Activate , TRUE, WA_BackFill , (IPTR)LAYERS_NOBACKFILL, WA_IDCMP , IDCMP_CLOSEWINDOW | IDCMP_RAWKEY, TAG_DONE); if (!win) cleanup("Can't open window"); rp = win->RPort; }
static void makewin(void) { win = OpenWindowTags(NULL, WA_CustomScreen , (IPTR)scr, WA_InnerWidth , SCREENWIDTH, WA_InnerHeight , SCREENHEIGHT, WA_Title , (IPTR)"BltTemplateAlpha: Moving mouse is useless!", WA_DragBar , TRUE, WA_DepthGadget , TRUE, WA_CloseGadget , TRUE, WA_Activate , TRUE, WA_IDCMP , IDCMP_CLOSEWINDOW, WA_BackFill , (IPTR) LAYERS_NOBACKFILL, TAG_DONE); if (!win) cleanup("Can't open window"); rp = win->RPort; }
static void MakeWin(void) { win = OpenWindowTags(0,WA_Left,10, WA_Top,20, WA_Width,200, WA_Height,200, WA_Title,(IPTR)"Press key to flip color!", WA_CloseGadget,TRUE, WA_DepthGadget,TRUE, WA_DragBar,TRUE, WA_Activate,TRUE, args[ARG_SIMPLE] ? WA_SimpleRefresh : TAG_IGNORE, TRUE, WA_IDCMP,IDCMP_CLOSEWINDOW | IDCMP_VANILLAKEY | IDCMP_REFRESHWINDOW, TAG_DONE); if (!win) Cleanup("Can't open window!"); rp = win->RPort; lay = win->WLayer; }
int main (int argc, char **argv) { UBYTE buffer[BUFSIZE]; KeymapBase = OpenLibrary("keymap.library", 37); if (!KeymapBase) printf("Failed to open keymap.library v37\n"); else { IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37); if (!IntuitionBase) printf("Failed to open intuition.library v37\n"); else { struct Window *win; win = OpenWindowTags(NULL, WA_Width, 200, WA_Height, 60, WA_Title, (IPTR)"Maprawkey test (ESC to exit)", WA_Flags, WFLG_ACTIVATE, WA_IDCMP, IDCMP_RAWKEY, TAG_DONE); if (!win) printf("Could not open window\n"); else { HandleEvents(win, buffer, BUFSIZE); CloseWindow(win); } CloseLibrary((struct Library *)IntuitionBase); } CloseLibrary(KeymapBase); } return (0); }
struct Window *openmywindow(char *screenname) { static char titel[32]; sprintf(titel,"NiKom PreNode, nod #%d SER:",nodnr); return(OpenWindowTags(NULL,WA_Left,xpos, WA_Top,ypos, WA_Width,xsize, WA_Height,ysize, WA_IDCMP,IDCMP_CLOSEWINDOW, WA_MinWidth,50, WA_MinHeight,10, WA_MaxWidth,~0, WA_MaxHeight,~0, WA_SizeGadget,TRUE, WA_SizeBBottom, TRUE, WA_DragBar,TRUE, WA_DepthGadget,TRUE, WA_CloseGadget,TRUE, WA_SimpleRefresh,TRUE, WA_Title,titel, WA_ScreenTitle,"NiKom Prenode", WA_AutoAdjust,TRUE, WA_PubScreenName,screenname, TAG_DONE)); }
VOID OpenWindows (STRPTR name, ULONG count, ULONG repeat, struct Screen *scr) { // struct BitMap **windows = new BitMap *[count]; struct Window **windows = new Window *[count]; struct TimeIt timer(name); for(ULONG i = 0; i < repeat; i++) { for(ULONG j = 0; j < count; j++) // windows[j] = MyAllocBitMap(rand() % scr->Width/2, rand() % scr->Height/2, GetBitMapAttr(scr->RastPort.BitMap, BMA_DEPTH), 0L, scr->RastPort.BitMap); // windows[j] = AllocBitMap(rand() % scr->Width/2, rand() % scr->Height/2, GetBitMapAttr(scr->RastPort.BitMap, BMA_DEPTH), 0L, scr->RastPort.BitMap); // windows[j] = (BitMap *)new UBYTE [RASSIZE(rand() % scr->Width/2, rand() % scr->Height/2) * GetBitMapAttr(scr->RastPort.BitMap, BMA_DEPTH)]; // windows[j] = (BitMap *)AllocVec(RASSIZE(rand() % scr->Width/2, rand() % scr->Height/2) * GetBitMapAttr(scr->RastPort.BitMap, BMA_DEPTH), MEMF_ANY); windows[j] = OpenWindowTags(NULL, WA_PubScreen, scr, WA_SimpleRefresh, TRUE, WA_Left, rand() % scr->Width/2, WA_Top, rand() % scr->Height/2, WA_InnerWidth, rand() % scr->Width/2, WA_InnerHeight, rand() % scr->Height/2, TAG_DONE); // for(j = 0; j < count; j++) while(j--) // MyFreeBitMap(windows[j]); // FreeBitMap(windows[j]); // delete windows[j]; // FreeVec(windows[j]); CloseWindow(windows[j]); } delete windows; }
void shutdownwnd_open(void) { if ((scr = LockPubScreen(NULL))) { char *filename; /* get a white pen for the color of our text */ pen = ObtainBestPenA(scr->ViewPort.ColorMap,0xffffffff,0xffffffff,0xffffffff,NULL); if ((filename = mycombinepath(gui_get_images_directory(),"shutdown"))) { if ((obj = LoadAndMapPicture("PROGDIR:Images/shutdown",scr))) { struct BitMapHeader *bmhd = NULL; struct BitMap *bitmap = NULL; GetDTAttrs(obj,PDTA_BitMapHeader,&bmhd,TAG_DONE); GetDTAttrs(obj,PDTA_DestBitMap,&bitmap,TAG_DONE); if (!bitmap) GetDTAttrs(obj,PDTA_BitMap,&bitmap,TAG_DONE); if (bmhd && bitmap) { int width = bmhd->bmh_Width; int height = bmhd->bmh_Height; int wndleft,wndtop; wndleft = (scr->Width - width)/2; wndtop = (scr->Height - height)/2; if ((shutdown_wnd = OpenWindowTags(NULL, WA_SmartRefresh, TRUE, WA_NoCareRefresh, TRUE, WA_Borderless, TRUE, WA_Width, width, WA_Height, height, WA_PubScreen, scr, WA_Left, wndleft, WA_Top, wndtop, WA_BackFill, LAYERS_NOBACKFILL, TAG_DONE))) { BltBitMapRastPort(bitmap,0,0, shutdown_wnd->RPort, 0, 0, width, height, 0xc0); if (!user.config.dont_show_shutdown_text) { struct TextExtent te; const char *txt = _("Shutting down..."); SetDrMd(shutdown_wnd->RPort,JAM1); SetAPen(shutdown_wnd->RPort,pen); TextExtent(shutdown_wnd->RPort,txt,strlen(txt),&te); if ((te.te_Width < width) && (te.te_Height < height)) { /* only draw the text if there is enought space for it */ Move(shutdown_wnd->RPort,(width - te.te_Width)/2, height - te.te_Height - 4 + shutdown_wnd->RPort->TxBaseline); Text(shutdown_wnd->RPort,txt,strlen(txt)); } } } } } free(filename); } } }
grArosSurface* init_surface( grArosSurface* surface, grBitmap* bitmap ) { printf("init_surface: width = %d height = %d\n", bitmap->width, bitmap->rows); bitmap->width = (bitmap->width + 15) & ~15; surface->bpr = bitmap->width / 8; if (grNewBitmap(bitmap->mode, bitmap->grays, bitmap->width, bitmap->rows, bitmap)) return 0; surface->win = OpenWindowTags(0, WA_Left, 20, WA_Top, 20, WA_InnerWidth, bitmap->width, WA_InnerHeight, bitmap->rows, WA_AutoAdjust, TRUE, WA_Title, "Freetype demo", WA_CloseGadget, TRUE, WA_DepthGadget, TRUE, WA_Activate, TRUE, WA_IDCMP, IDCMP_VANILLAKEY | IDCMP_RAWKEY, TAG_DONE); if (!surface->win) { puts("Could not open window!"); grDoneBitmap(bitmap); return 0; } puts("Window opened."); surface->grays = ( bitmap->mode == gr_pixel_mode_gray && bitmap->grays >= 2 ); if (surface->grays) { WORD i; if (GetBitMapAttr(surface->win->RPort->BitMap, BMA_DEPTH <= 8)) { puts("Need hi/true color screen!"); CloseWindow(surface->win); grDoneBitmap(bitmap); return 0; } for(i = 0; i < bitmap->grays; i++) { LONG red, green, blue; red = green = blue = (bitmap->grays - i) * 255 / bitmap->grays; surface->cgfxcoltab[i] = (red << 16) | (green << 8) | blue; } } surface->root.bitmap = *bitmap; surface->root.done = (grDoneSurfaceFunc) done_surface; surface->root.refresh_rect = (grRefreshRectFunc) refresh_rectangle; surface->root.set_title = (grSetTitleFunc) set_title; surface->root.listen_event = (grListenEventFunc) listen_event; return surface; }
static BOOL MakePopupWin(Object *obj, struct Numericbutton_DATA *data) { const struct ZuneFrameGfx *zframe; struct RastPort *rp, *saverp; LONG winx, winy, winw, winh; LONG framew, frameh; LONG min, max; zframe = zune_zframe_get_with_state(obj, &muiGlobalInfo(obj)->mgi_Prefs->frames[MUIV_Frame_Slider], muiGlobalInfo(obj)->mgi_Prefs->frames[MUIV_Frame_Slider].state); data->pop_innerx = zframe->ileft; data->pop_innery = zframe->itop; data->knob_width = data->max_text_width + 4; data->knob_height = data->text_height + 2; framew = data->pop_innerx + zframe->iright; frameh = data->pop_innery + zframe->ibottom; longget(obj, MUIA_Numeric_Min, &min); longget(obj, MUIA_Numeric_Max, &max); winw = max - min + data->knob_width + framew; winh = data->knob_height + frameh; if (winw > _screen(obj)->Width) { winw = _screen(obj)->Width; } if ((winw < data->knob_width + framew) || (winh > _screen(obj)->Height)) { return FALSE; } data->pop_innerw = winw - framew; data->pop_innerh = winh - frameh; data->knob_left = DoMethod(obj, MUIM_Numeric_ValueToScale, 0, data->pop_innerw - data->knob_width); winx = _window(obj)->LeftEdge + _mleft(obj) - data->pop_innerx - 2 - data->knob_left; winy = _window(obj)->TopEdge + _mtop(obj) - 1- data->pop_innery; data->popwin = OpenWindowTags(NULL, WA_CustomScreen, (IPTR)_screen(obj), WA_Left, winx, WA_Top, winy, WA_Width, winw, WA_Height, winh, WA_AutoAdjust, TRUE, WA_Borderless, TRUE, WA_Activate, FALSE, WA_BackFill, (IPTR)LAYERS_NOBACKFILL, TAG_DONE); if (!data->popwin) { return FALSE; } rp = data->popwin->RPort; saverp = _rp(obj); _rp(obj) = rp; zframe->draw(zframe->customframe, muiRenderInfo(obj), 0, 0, winw, winh, 0, 0, winw, winh); DrawKnob(obj, data, TRUE); _rp(obj) = saverp; return TRUE; }
LONG Blank( PrefObject *Prefs ) { LONG delay_rate, i, j, counter = 0, RetVal = OK; struct RastPort *Rast; struct Screen *FTScr; struct Window *FTWin; struct Window *Wnd; NumToasters = Prefs[OBJECTS].po_Level; delay_rate = 11 - Prefs[SPEED].po_Level; Toasters = AllocVec( sizeof( Toaster ) * NumToasters, MEMF_CLEAR ); FTScr = OpenScreenTags( NULL, SA_DisplayID, Prefs[MODE].po_ModeID, SA_Depth, 4, SA_Overscan, OSCAN_STANDARD, SA_Type, CUSTOMSCREEN, SA_Quiet, TRUE, SA_Behind, TRUE, TAG_DONE ); if( Toasters && FTScr ) { for( i = 0; i < 48; i += 3 ) if( GfxBase->lib_Version < 39 ) SetRGB4(&( FTScr->ViewPort ), i/3, ( cmap[i] * 16 ) / 256, ( cmap[i+1] * 16 ) / 256, ( cmap[i+2] * 16 ) / 256 ); else SetRGB32(&( FTScr->ViewPort ), i/3, cmap[i]<<24, cmap[i+1]<<24, cmap[i+2]<<24 ); FTWin = OpenWindowTags( 0L, WA_Width, FTScr->Width, WA_Height, FTScr->Height, WA_IDCMP, 0L, WA_Flags, WFLG_SIMPLE_REFRESH|WFLG_BORDERLESS, WA_CustomScreen, FTScr, TAG_DONE ); if( FTWin ) { Rast = FTWin->RPort; SetAPen( Rast, 0 ); for( i = 0; i < NumToasters; i++ ) if( !FindLaunchPos( i, ( LONG )FTWin->Width, ( LONG )FTWin->Height )) Toasters[i].delay = 30; Wnd = BlankMousePointer( FTScr ); ScreenToFront( FTScr ); while( RetVal == OK ) { WaitTOF(); if(!( ++counter % 60 )) ScreenToFront( FTScr ); if(!( counter % delay_rate )) { for( i = 0; i < NumToasters; i++ ) { if( !Toasters[i].delay ) { Toasters[i].old_x = Toasters[i].x; Toasters[i].old_y = Toasters[i].y; Toasters[i].x -= Toasters[i].xspeed; Toasters[i].y += Toasters[i].yspeed; Toasters[i].xcol = -1; Toasters[i].ycol = -1; } } for( i = 0; i < NumToasters; i++ ) { if( !Toasters[i].delay ) { j = -1; while(( j = TestExtent( j+1, i, Toasters[i].x, Toasters[i].y )) >= 0 ) { if( abs( Toasters[j].old_x - Toasters[i].old_x ) < IM_WIDBUF ) { if( Toasters[i].y < Toasters[j].y ) Toasters[i].ycol = j; if( Toasters[i].xspeed == Toasters[j].xspeed ) Toasters[i].xspeed++; } else { if( Toasters[i].x > Toasters[j].x ) Toasters[i].xcol = j; if( Toasters[i].yspeed == Toasters[j].yspeed ) Toasters[i].yspeed++; } if( abs( Toasters[j].old_y - Toasters[i].old_y ) < IM_HEIBUF ) { if( Toasters[i].x > Toasters[j].x ) Toasters[i].xcol = j; if( Toasters[i].yspeed == Toasters[j].yspeed ) Toasters[i].yspeed++; } } } } for( i = 0; i < NumToasters; i++ ) { if( !Toasters[i].delay ) { Toasters[i].x = Toasters[i].old_x - ActXSpeed( i ); Toasters[i].y = Toasters[i].old_y + ActYSpeed( i ); } } for( i = 0; i < NumToasters; i++ ) { if( !Toasters[i].delay ) { j = -1; while(( j = TestExtent( j+1, i, Toasters[i].x, Toasters[i].y )) >= 0 ) { if( abs( Toasters[j].old_x - Toasters[i].old_x ) < IM_WIDBUF ) if( Toasters[i].x > Toasters[j].x ) Toasters[i].x = Toasters[i].old_x; else if( Toasters[i].y < Toasters[j].y ) Toasters[i].y = Toasters[i].old_y; if( abs( Toasters[j].old_y - Toasters[i].old_y ) < IM_HEIBUF ) if( Toasters[i].y < Toasters[j].y ) Toasters[i].y = Toasters[i].old_y; } } } for( i = 0; i < NumToasters; i++ ) { if( !Toasters[i].delay ) { Toasters[i].phase = ( Toasters[i].phase + 1 ) % IMAGEMAX; EraseRect( Rast, Toasters[i].x + IM_WIDTH, Toasters[i].old_y, Toasters[i].x + IM_WIDTH + Toasters[i].xspeed, Toasters[i].old_y + IM_HEIGHT ); EraseRect( Rast, Toasters[i].old_x, Toasters[i].old_y, Toasters[i].old_x + IM_WIDTH, Toasters[i].old_y + Toasters[i].yspeed ); DrawImage( Rast, img[Toasters[i].phase], Toasters[i].x, Toasters[i].y ); if(( Toasters[i].x < -IM_WIDTH-1 )|| ( Toasters[i].y > FTWin->Height )) Toasters[i].delay = RangeRand( 50 ); } else if(!( --Toasters[i].delay )) Toasters[i].delay = FindLaunchPos( i, ( LONG )FTWin->Width, ( LONG )FTWin->Height ) ? 0 : 30; } } RetVal = ContinueBlanking(); } SetSignal( 0L, SIGBREAKF_CTRL_C ); UnblankMousePointer( Wnd ); CloseWindow( FTWin ); } else RetVal = FAILED; CloseScreen( FTScr ); } else RetVal = FAILED; FreeVec( Toasters ); return RetVal; }
void main() { ULONG class,code; struct Gadget *gadget; struct IntuiMessage *message; struct DrawInfo *dri; BOOL running=TRUE; unless(Scr=LockPubScreen("Workbench")) LEAVE; unless(dri=GetScreenDrawInfo(Scr)) LEAVE; unless(SmartBitMapBase=OpenLibrary("images/smartbitmap.image",36L)) LEAVE; unless(ImClass=GetSmartBitMapClass()) LEAVE; GetRGB32(Scr->ViewPort.ColorMap,0,1,&pal[0].R); unless(Im=NewObject(ImClass,NULL, IA_Left,25, IA_Top,25, IA_Width,20, SMBM_Border,FALSE, SMBM_SelBorder,TRUE, SMBM_Screen,Scr, SMBM_BitMap,&TBCOLORWHEELBitMap, // SMBM_BitMap,&Size45UDBitMap, SMBM_Palette,pal, TAG_DONE)) LEAVE; unless(MainWnd=OpenWindowTags(NULL, WA_Left,0, WA_Top,0, WA_Width,600, WA_Height,200, WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_GADGETUP, WA_Flags,WFLG_CLOSEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_ACTIVATE|WFLG_SIZEGADGET, WA_CustomScreen,Scr, TAG_DONE)) LEAVE; DrawImageState(MainWnd->RPort,(struct Image *)Im,0,0,IDS_NORMAL,dri); while(running) { Wait(1L<<MainWnd->UserPort->mp_SigBit); while(message=GT_GetIMsg(MainWnd->UserPort)) { class=message->Class; code=message->Code; gadget=(struct Gadget *)message->IAddress; GT_ReplyIMsg(message); switch(class) { case IDCMP_CLOSEWINDOW: running=FALSE; break; } } } end: if(MainWnd) { CloseWindow(MainWnd); } if(Im) DisposeObject(Im); if(SmartBitMapBase) CloseLibrary(SmartBitMapBase); if(dri) FreeScreenDrawInfo(Scr,dri); if(Scr) UnlockPubScreen(NULL,Scr); }
int main(int argc, char **argv) { ULONG DisplayID,Depth; struct Screen *CyberScreen; struct Window *WriteWindow; LONG done; struct IntuiMessage *IntMsg; IMAGE image; LONG src_x,src_y, old_src_x,old_src_y; ULONG argarray[2]; struct RDArgs *rdargs; char *file; rdargs = ReadArgs((STRPTR)arg_template, (LONG*)argarray, NULL); if(!rdargs) return 20; file = (char*)argarray[0]; IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",39L); if(!IntuitionBase) return 20; CyberGfxBase = OpenLibrary(CYBERGFXNAME,CYBERGFXVERSION); if(!CyberGfxBase) { ErrorF ("Can't open \"%s\" version %ld or newer.", CYBERGFXNAME,CYBERGFXVERSION); CloseLibrary (&IntuitionBase->LibNode); return 10; } if(!Load(file, &image)) { ErrorF ("Can't load image."); FreeArgs(rdargs); CloseLibrary (CyberGfxBase); CloseLibrary (&IntuitionBase->LibNode); return 10; } /* Let CyberGraphX search a display mode for us! */ if(argarray[1]) Depth = 16; else Depth = 24; FreeArgs(rdargs); while (Depth) { DisplayID = BestCModeIDTags(CYBRBIDTG_NominalWidth, image.width, CYBRBIDTG_NominalHeight, image.height, CYBRBIDTG_Depth, Depth, TAG_DONE); if(DisplayID != INVALID_ID) { /* Because older version of the "cybergraphics.library" don't handle */ /* CYBRBIDTG_Depth properly we query the real depth of the mode. */ Depth = GetCyberIDAttr(CYBRIDATTR_DEPTH,DisplayID); break; } /* retry with less bits per pixel */ Depth = NextDepth(Depth); } if (Depth < SCREEN_MIN_DEPTH) { ErrorF ("Can't find suitable display mode for %ldx%ldx.", image.width, image.height); CloseLibrary (CyberGfxBase); CloseLibrary (&IntuitionBase->LibNode); Cleanup(&image); return 5; } /* open screen, but let Intuition choose the actual dimensions */ CyberScreen = OpenScreenTags( NULL, SA_Title,"RayStorm Image Viewer (C) 1998 Andreas Heumann", SA_DisplayID,DisplayID, SA_Depth,Depth, TAG_DONE); if(!CyberScreen) { ErrorF ("Can't open screen."); CloseLibrary (CyberGfxBase); CloseLibrary (&IntuitionBase->LibNode); Cleanup(&image); return 5; } /* create Write window */ WriteWindow = OpenWindowTags( NULL, WA_Title,"Viewer", WA_Flags, WFLG_ACTIVATE|WFLG_SIMPLE_REFRESH|WFLG_RMBTRAP, WA_IDCMP, IDCMP_REFRESHWINDOW|IDCMP_VANILLAKEY|IDCMP_RAWKEY|IDCMP_MOUSEBUTTONS, WA_Borderless, TRUE, WA_Left, 0, WA_Top, 0, WA_Width, image.width, WA_Height, image.height, WA_CustomScreen,CyberScreen, TAG_DONE); if(!WriteWindow) { ErrorF ("Can't open write window."); CloseScreen (CyberScreen); CloseLibrary (CyberGfxBase); CloseLibrary (&IntuitionBase->LibNode); Cleanup(&image); return 5; } src_x = 0; src_y = 0; WritePixelArray( image.colormap, src_x, src_y, image.width*sizeof(SMALL_COLOR), WriteWindow->RPort, 0, 0, image.width, image.height, RECTFMT_RGBA); /* event loop */ done = FALSE; while (!done) { (void)Wait(SIGMASK(WriteWindow)); while (IntMsg=GETIMSG(WriteWindow)) { switch (IntMsg->Class) { case IDCMP_REFRESHWINDOW: BeginRefresh(WriteWindow); WritePixelArray( image.colormap, src_x, src_y, image.width*sizeof(SMALL_COLOR), WriteWindow->RPort, 0, 0, image.width, image.height, RECTFMT_RGBA); EndRefresh(WriteWindow,TRUE); break; case IDCMP_VANILLAKEY: switch(IntMsg->Qualifier & 0x7fff) { case 0: switch (IntMsg->Code) { case 27: done = TRUE; break; } break; } break; case IDCMP_RAWKEY: old_src_x = src_x; old_src_y = src_y; switch(IntMsg->Code) { case CURSORRIGHT: if(src_x + WriteWindow->Width + WriteWindow->LeftEdge < image.width) { src_x += 8; if(src_x + WriteWindow->Width + WriteWindow->LeftEdge > image.width) src_x = image.width - WriteWindow->Width - WriteWindow->LeftEdge; } break; case CURSORLEFT: if(src_x > 0) { src_x -= 8; if(src_x < 0) src_x = 0; } break; case CURSORDOWN: if(src_y + WriteWindow->Height + WriteWindow->TopEdge < image.height) { src_y += 8; if(src_y + WriteWindow->Height + WriteWindow->TopEdge > image.height) src_y = image.height - WriteWindow->Height - WriteWindow->TopEdge; } break; case CURSORUP: if(src_y > 0) { src_y -= 8; if(src_y < 0) src_y = 0; } break; } if((old_src_x != src_x) || (old_src_y != src_y)) { if(old_src_x < src_x) { ClipBlit( WriteWindow->RPort, src_x - old_src_x, 0, WriteWindow->RPort, 0, 0, WriteWindow->Width + WriteWindow->LeftEdge - (src_x - old_src_x), WriteWindow->Height + WriteWindow->TopEdge, 0xc0); WritePixelArray( image.colormap, old_src_x + WriteWindow->Width + WriteWindow->LeftEdge, src_y, image.width*sizeof(SMALL_COLOR), WriteWindow->RPort, WriteWindow->Width + WriteWindow->LeftEdge - (src_x - old_src_x), 0, src_x - old_src_x, WriteWindow->Height + WriteWindow->TopEdge, RECTFMT_RGBA); } else if(old_src_x > src_x) { ClipBlit( WriteWindow->RPort, 0, 0, WriteWindow->RPort, old_src_x - src_x, 0, WriteWindow->Width + WriteWindow->LeftEdge - (old_src_x - src_x), WriteWindow->Height + WriteWindow->TopEdge, 0xc0); WritePixelArray( image.colormap, src_x, src_y, image.width*sizeof(SMALL_COLOR), WriteWindow->RPort, 0, 0, old_src_x - src_x, WriteWindow->Height + WriteWindow->TopEdge, RECTFMT_RGBA); } else if(old_src_y < src_y) { ClipBlit( WriteWindow->RPort, 0, src_y - old_src_y, WriteWindow->RPort, 0, 0, WriteWindow->Width + WriteWindow->LeftEdge, WriteWindow->Height + WriteWindow->TopEdge - (src_y - old_src_y), 0xc0); WritePixelArray( image.colormap, src_x, old_src_y + WriteWindow->Height + WriteWindow->TopEdge, image.width*sizeof(SMALL_COLOR), WriteWindow->RPort, 0, WriteWindow->Height + WriteWindow->TopEdge - (src_y - old_src_y), WriteWindow->Width + WriteWindow->LeftEdge, src_y - old_src_y, RECTFMT_RGBA); } else if(old_src_y > src_y) { ClipBlit( WriteWindow->RPort, 0, 0, WriteWindow->RPort, 0, old_src_y - src_y, WriteWindow->Width + WriteWindow->LeftEdge, WriteWindow->Height + WriteWindow->TopEdge - (old_src_y - src_y), 0xc0); WritePixelArray( image.colormap, src_x, src_y, image.width*sizeof(SMALL_COLOR), WriteWindow->RPort, 0, 0, WriteWindow->Width + WriteWindow->LeftEdge, old_src_y - src_y, RECTFMT_RGBA); } } break; case IDCMP_MOUSEBUTTONS: done = TRUE; break; } ReplyMsg (&IntMsg->ExecMessage); } } /* cleanup */ CloseWindow(WriteWindow); CloseScreen(CyberScreen); CloseLibrary(CyberGfxBase); CloseLibrary(&IntuitionBase->LibNode); Cleanup(&image); return 0; }
void *Sys_Video_Open(const char *mode, unsigned int width, unsigned int height, int fullscreen, unsigned char *palette) { struct display *d; struct modeinfo modeinfo; char monitorname[128]; int r; int i; d = AllocVec(sizeof(*d), MEMF_CLEAR); if (d) { MesaBase = OpenLibrary("mesa.library", 0); if (MesaBase) { if (fullscreen) { if (*mode && modeline_to_modeinfo(mode, &modeinfo)) { snprintf(monitorname, sizeof(monitorname), "%s.monitor", modeinfo.monitorname); d->screen = OpenScreenTags(0, SA_Width, modeinfo.width, SA_Height, modeinfo.height, SA_Depth, modeinfo.depth, #if 0 SA_MonitorName, monitorname, #endif SA_Quiet, TRUE, TAG_DONE); } else { d->screen = OpenScreenTags(0, SA_Quiet, TRUE, TAG_DONE); } if (d->screen) { width = d->screen->Width; height = d->screen->Height; snprintf(d->used_mode, sizeof(d->used_mode), "Dunno,%d,%d,42", width, height); } else fullscreen = 0; } if (d->screen || !fullscreen) { d->window = OpenWindowTags(0, d->screen?WA_Width:WA_InnerWidth, width, d->screen?WA_Height:WA_InnerHeight, height, WA_Title, "Fodquake", WA_DragBar, d->screen?FALSE:TRUE, WA_DepthGadget, d->screen?FALSE:TRUE, WA_Borderless, d->screen?TRUE:FALSE, WA_RMBTrap, TRUE, d->screen?WA_CustomScreen:TAG_IGNORE, (IPTR)d->screen, WA_Activate, TRUE, TAG_DONE); if (d->window) { d->mesacontext = AROSMesaCreateContextTags( AMA_Window, d->window, AMA_Left, d->screen?0:d->window->BorderLeft, AMA_Top, d->screen?0:d->window->BorderTop, AMA_Width, width, AMA_Height, height, AMA_NoStencil, TRUE, AMA_NoAccum, TRUE, TAG_DONE); if (d->mesacontext) { AROSMesaMakeCurrent(d->mesacontext); d->pointermem = AllocVec(256, MEMF_ANY|MEMF_CLEAR); if (d->pointermem) { SetPointer(d->window, d->pointermem, 16, 16, 0, 0); d->width = width; d->height = height; d->fullscreen = fullscreen; d->inputdata = Sys_Input_Init(d->screen, d->window); if (d->inputdata) { return d; } FreeVec(d->pointermem); } AROSMesaMakeCurrent(0); AROSMesaDestroyContext(d->mesacontext); } CloseWindow(d->window); } if (d->screen) CloseScreen(d->screen); } CloseLibrary(MesaBase); } FreeVec(d); } return 0; }
struct Window *initWindow(void) { struct Window *win; gad[0] = CreateContext(&glist); ng.ng_LeftEdge = 8; ng.ng_TopEdge = fontheight+7; ng.ng_Width = 192; ng.ng_Height = 11*fontheight+4; ng.ng_VisualInfo = vi; ng.ng_TextAttr = scr->Font; ng.ng_GadgetText = NULL; ng.ng_UserData = NULL; ng.ng_GadgetID = 1; lvgad[0] = CreateGadget(LISTVIEW_KIND,gad[0],&ng,GTLV_Labels,&list[0],TAG_END); ng.ng_LeftEdge = 206; ng.ng_Width = 186; ng.ng_GadgetText = NULL; ng.ng_GadgetID++; lvgad[1] = CreateGadget(LISTVIEW_KIND,lvgad[0],&ng,GTLV_Labels,&list[1],TAG_END); ng.ng_TopEdge += ng.ng_Height+3; ng.ng_LeftEdge = 8; ng.ng_Height = fontheight+4; ng.ng_Width = TLn("New")+16; ng.ng_Flags = PLACETEXT_IN; ng.ng_GadgetText = "New"; ng.ng_GadgetID++; gad[0] = CreateGadget(BUTTON_KIND,lvgad[1],&ng,GA_Immediate,TRUE,TAG_END); ng.ng_LeftEdge += ng.ng_Width+6; ng.ng_Width = TLn("Copy")+16; ng.ng_GadgetText = "Copy"; ng.ng_GadgetID++; gad[1] = CreateGadget(BUTTON_KIND,gad[0],&ng,TAG_END); ng.ng_LeftEdge += ng.ng_Width+6; ng.ng_Width = TLn("Delete")+16; ng.ng_GadgetText = "Delete"; ng.ng_GadgetID++; gad[2] = CreateGadget(BUTTON_KIND,gad[1],&ng,TAG_END); if ((win = OpenWindowTags(NULL,WA_Title, "gtdrag - Test", WA_Flags, WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_ACTIVATE, WA_IDCMP, IDCMP_CLOSEWINDOW | DRAGIDCMP, WA_Width, 400, WA_Height, fontheight*13+23, WA_Gadgets, glist, TAG_END)) != 0) { GT_RefreshWindow(win,NULL); GTD_AddGadget(LISTVIEW_KIND,lvgad[0],win,GTDA_InternalType, 1, GTDA_NoPosition, TRUE, GTDA_Type, ODT_NODE, TAG_END); GTD_AddGadget(LISTVIEW_KIND,lvgad[1],win,GTDA_InternalType,1, GTDA_Same, TRUE, GTDA_Type, ODT_NODE, TAG_END); GTD_AddGadget(BUTTON_KIND,gad[0],win,GTDA_Object, &in, GTDA_Image, in.in_Image, GTDA_InternalType,2, GTDA_AcceptTypes, 0, GTDA_Width, newImg.Width, GTDA_Height, newImg.Height, TAG_END); GTD_AddGadget(BUTTON_KIND,gad[1],win,GTDA_AcceptTypes,1,TAG_END); GTD_AddGadget(BUTTON_KIND,gad[2],win,GTDA_AcceptTypes,1,TAG_END); GTD_AddWindow(win,TAG_END); return(win); } return(NULL); }