public DrawItem(EnumBLEND _blend, int _blendparam) { gh = -1; index = 0; xy = new Point(0, 0); xy2 = new Point(0, 0); xy3 = new Point(0, 0); xy4 = new Point(0, 0); wh = new Point(0, 0); blend = _blend; blendparam = _blendparam; }
public DrawItem() { gh = -1; index = 0; xy = new Point(0, 0); xy2 = new Point(0, 0); xy3 = new Point(0, 0); xy4 = new Point(0, 0); wh = new Point(0, 0); blend = EnumBLEND.NOBLEND; blendparam = 0; }
/// <summary> /// メモリに読みこんだグラフィックの描画 /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="GrHandle"></param> private static void DrawGraph(int x, int y, int GrHandle, EnumPriority priority, EnumBLEND blend, int blendparam) { DrawItem d = new DrawItem(); d.xy.X = x; d.xy.Y = y; d.gh = GrHandle; d.priority = priority; d.blend = blend; d.blendparam = blendparam; d.drawmode = EnumDraw.DrawGraph; d.index = lstDrawObject.Count(); lstDrawObject.Add(d); }
/// <summary> /// メモリに読みこんだグラフィックの自由変形描画 /// </summary> /// <param name="x1"></param> /// <param name="y1"></param> /// <param name="x2"></param> /// <param name="y2"></param> /// <param name="x3"></param> /// <param name="y3"></param> /// <param name="x4"></param> /// <param name="y4"></param> /// <param name="GrHandle"></param> /// <returns></returns> private static void DrawModiGraph(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int GrHandle, EnumPriority priority, EnumBLEND blend, int blendparam) { DrawItem d = new DrawItem(); d.xy.X = x1; d.xy.Y = y1; d.xy2.X = x2; d.xy2.Y = y2; d.xy3.X = x3; d.xy3.Y = y3; d.xy4.X = x4; d.xy4.Y = y4; d.gh = GrHandle; d.priority = priority; d.blend = blend; d.blendparam = blendparam; d.drawmode = EnumDraw.DrawModiGraph; d.index = lstDrawObject.Count(); lstDrawObject.Add(d); }
/// <summary> /// グラフィックの指定矩形部分のみを描画 /// </summary> /// <param name="DestX">画面上の位置</param> /// <param name="DestY"></param> /// <param name="SrcX">グラフィックのどこの部分を描く?(左上座標)</param> /// <param name="SrcY"></param> /// <param name="Width">描画するグラフィックのサイズ</param> /// <param name="Height"></param> /// <param name="GraphHandle"></param> /// <returns></returns> private static void DrawRectGraph(int DestX, int DestY, int SrcX, int SrcY, int Width, int Height, int GrHandle, EnumPriority priority, EnumBLEND blend, int blendparam) { DrawItem d = new DrawItem(); d.xy.X = DestX; d.xy.Y = DestY; d.xy2.X = SrcX; d.xy2.Y = SrcY; d.wh.X = Width; d.wh.Y = Height; d.gh = GrHandle; d.priority = priority; d.blend = blend; d.blendparam = blendparam; d.drawmode = EnumDraw.DrawRectGraph; d.index = lstDrawObject.Count(); lstDrawObject.Add(d); }
/// <summary> /// リストに溜め込んだものを全て描画してリストをクリア /// 毎フレーム呼ぶ /// </summary> public static void Flush() { DX.ClearDrawScreen(); EnumBLEND preblend = EnumBLEND.NOBLEND; int preblendvalue = -1; lstDrawObject.Sort(new DrawItem()); foreach (DrawItem obj in lstDrawObject) { if (preblend != obj.blend || preblendvalue != obj.blendparam) { MyDraw.SetDrawBlendMode((int)obj.blend, obj.blendparam); } switch (obj.drawmode) { case EnumDraw.DrawGraph: DX.DrawGraph(obj.xy.X, obj.xy.Y, obj.gh, DX.TRUE); break; case EnumDraw.DrawModiGraph: DX.DrawModiGraph(obj.xy.X, obj.xy.Y, obj.xy2.X, obj.xy2.Y, obj.xy3.X, obj.xy3.Y, obj.xy4.X, obj.xy4.Y, obj.gh, DX.TRUE); break; case EnumDraw.DrawRectGraph: DX.DrawRectGraph(obj.xy.X, obj.xy.Y, obj.xy2.X, obj.xy2.Y, obj.wh.X, obj.wh.Y, obj.gh, DX.TRUE, DX.FALSE); break; case EnumDraw.DrawRotaGraph: DX.DrawRotaGraph(obj.xy.X, obj.xy.Y, obj.zoom, obj.angle, obj.gh, DX.TRUE); break; } } DX.ScreenFlip(); lstDrawObject.Clear(); frame++; // 画面をクリア }
/// <summary> /// 描画の際のブレンドモードをセットする /// </summary> /// <param name="BlendMode">DX_BLENDMODE_NOBLEND:ノーブレンド(デフォルト) DX_BLENDMODE_ALPHA:αブレンド DX_BLENDMODE_ADD:加算ブレンド DX_BLENDMODE_SUB:減算ブレンド DX_BLENDMODE_MUL:乗算ブレンド</param> /// <param name="BlendParam">描画ブレンドモードのパラメータ(0~255)</param> public static void SetDrawBlendMode(int BlendMode, int BlendParam) { lastblend = (EnumBLEND)BlendMode; lastblendparam = BlendParam; }
/// <summary> /// 拡大、回転表示(x,y)が中心座標になるのでalignのDelta(dx,dy)値は無視 /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="zoom">1で元のまま</param> /// <param name="angle">0で元のままラジアン指定</param> private static void DrawZoomRotate(EnumGraphic enumgraphic, int x, int y, double zoom, double angle, int num, EnumPriority priority, EnumBLEND blend, int blendparam) { GraphicObject o = GraphicObject.GetGraphicObject(enumgraphic); MyDraw.DrawRotaGraph(x, y, zoom, angle, o.GHandle(frame, num), priority, blend, blendparam); }
/// <summary> /// 配列版の描画(上一部分だけ描画 /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="num">配列番号</param> private static void DrawUpperRect(EnumGraphic enumgraphic, int x, int y, int num, int upperheight, EnumPriority priority, EnumBLEND blend, int blendparam) { GraphicObject o = GraphicObject.GetGraphicObject(enumgraphic); MyDraw.DrawRectGraph(x + o.dx, y + o.dy, 0, 0, o.width, upperheight, o.GHandle(frame, num), priority, blend, blendparam); }
/// <summary> /// 配列版の描画Align指定付き /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="num"></param> /// <param name="tmpalign"></param> private static void Draw(EnumGraphic enumgraphic, int x, int y, int num, EnumAlign tmpalign, EnumPriority priority, EnumBLEND blend, int blendparam) { int dx, dy; GraphicObject o = GraphicObject.GetGraphicObject(enumgraphic); if (tmpalign == EnumAlign.NONE) { dx = o.dx; dy = o.dy; } else { o.GetAlignDeltaXY(tmpalign, out dx, out dy); } MyDraw.DrawGraph(x + dx, y + dy, o.GHandle(frame, num), priority, blend, blendparam); }
/// <summary> /// 左上、右上、右下、左下を指定してそこに変形描画 /// </summary> /// <param name="p1"></param> /// <param name="p2"></param> /// <param name="p3"></param> /// <param name="p4"></param> private static void DrawModi(EnumGraphic enumgraphic, Point p1, Point p2, Point p3, Point p4, int num, EnumPriority priority, EnumBLEND blend, int blendparam) { GraphicObject o = GraphicObject.GetGraphicObject(enumgraphic); MyDraw.DrawModiGraph( p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y, p4.X, p4.Y, o.GHandle(frame, num), priority, blend, blendparam); }