/*
 replaces the XWindow stuff with NeXTstep stuff.
 G. Arakaki
 */

#import <appkit/Application.h>
#import <appkit/Window.h>
#import <appkit/View.h>
#import <appkit/graphics.h>
#import "video.h"

static NXRect rect;
static Window *window;

void InitDisplay(int w, int h)
{
    NXApp = [Application new];
    rect.origin.x = 8.0 * 64.0;
    rect.origin.y = 512.0;
    rect.size.width = w;
    rect.size.height = h;
    window = [[Window alloc] initContent:&rect style:NX_TITLEDSTYLE
        backing:NX_RETAINED buttonMask:0 defer:NO];
    rect.origin.x = rect.origin.y = 0.0;
    [window setDepthLimit:NX_TwelveBitRGBDepth];
    [[window contentView] setClipping:NO];
    [window setTitle:"mpeg_play"];
    [window orderFront:nil];
    [[window contentView] lockFocus];
}

void ExecuteDisplay(VidStream *vid_stream)
{
    NXPing();
    NXDrawBitmap(&rect, rect.size.width, rect.size.height,
        4, 3, 16, rect.size.width * 2, NO, NO, NX_RGBColorSpace,
        (const unsigned char *const*)&vid_stream->current->display);
//    NXDrawBitmap(&rect, rect.size.width, rect.size.height,
//        8, 3, 32, rect.size.width * 4, NO, NO, NX_RGBColorSpace,
//        (const unsigned char *const*)&vid_stream->current->display);
    DPSFlush();
  totNumFrames++;
}


