5/27/2009

My Mog Roulette game likes this...

Probably, it will be completed in the future or may not.

5/26/2009

GNUstep


GNUstep is a way of using with Objective-C under Window or other Platform. Probably many know or not that the language can support same functionality as other languages do. The language is being used with "Cocoa" for building an application for IPhone. The language is quit interesting for learning. There are two installation files should download and install. Before install it, Mingw should install first. Open a new tab this link , get gnustep-system-0.9.1-setup.exe and gnustep-core-0.9.2-setup.exe. After that, install it by order. GNUstep Renaissance will give some special things. go and get it . Probably need its source because should compile and install. Unzip it to MSYS working folder. The working folder will be created by clicking at MSYS shell of GNUstep at first time. The above shown picture shows an execution figure of simple application.

5/14/2009

Clear screen shot of roulette under OpenGL


One of Nehe's OpenGL tutorials gives me an example how to use. The roulette machine will smoothly spin with OpenGL. but since, this picture means alpha valued image works with OpenGL.

To apply for alpha value


To get a proper alpha valued image, some tasks should be included in the previous list. Thank you for Paul Nicholls, I found FloodFill() routine which can be used with TBitmap32.
The above shown picture is alpha valued image. When the generated image is opened by Gimp, it will be the same as the shown above picture. I include its source.

Click -> available download

5/13/2009

Make my own Roulette image...


Making roulette game will have not an easy task. Probably, the task should be included some mathematic routines. I don't know yet what sort of mathematic should be needed for....
At the moment, I will introduce one method how can make roulette image by Delphi 6 and Graphics32. Of course, there are many ways we can make it by using other development tools. To make an executable file with this source, Delphi 6 Standard and Graphics32 Component should be needed.

Uses
  ..., Math, GR32_Image, GR32; // Add this in Uses

// Conversion double rgb color value to TColor value
Function MakeColor(b, g, r: Double): Integer;
begin
    result := Trunc(r * 255) shl 16 + Trunc(b * 255) shl 8 + Trunc(g * 255);
end;

// In order to display text by angle
procedure TextRotate(bitmap: TBitmap32; x, y, angle: integer; atext: string;afont: TFont);
var
    lf:LogFont;
begin
    //Please Change with your country font, test with a different font to get better result...
    Bitmap.Font.Name := '궁서체';
    Bitmap.Font.Size := 12;
    Windows.GetObject(Bitmap.Font.Handle, sizeof(LOGFONT), @lf);
    lf.lfEscapement := angle * 10;
    lf.lfOrientation := angle * 10;
    Bitmap.Font.Handle := CreateFontIndirect(lf);
    Bitmap.Canvas.Brush.Style := bsClear;
    Bitmap.Textout(x, y, atext);
end;

// Button event for drawing roulette Image
procedure TForm1.BitBtn1Click(Sender: TObject);
{ Draw 1 pixcel width line }
procedure DrawLine(X1, Y1, X2, Y2 : Integer; vBitmap: TBitmap32);
Begin
    { Fill area by drawing lines }
    vBitmap.Canvas.MoveTo(X1,Y1);
    vBitmap.Canvas.LineTo(X2,Y2);
End;

const
    DEG2RAD : double = (3.14159/180);
var
    vBitmap : TBitmap32;
    dAngle, degInRad, dAngleX : Double;
    x1, y1, i, centerx, centery : Integer;
    Color0, Color1, Color2 : Integer;
    Angle, X, Y, H, H2, W, X3 : Integer;
    Step : Real;
    ValueT : Array of String;
begin
    vBitmap := TBitmap32.Create;
    vBitmap.Width := 256;
    vBitmap.Height := 256;
    centerx := 128;
    centery := 128;
    vBitmap.Canvas.Pen.Width := 2;
    vBitmap.Canvas.Pen.Color := MakeColor(0.66, 0.82, 0.82);
    vBitmap.Canvas.Ellipse(10, 10, vBitmap.Width-10, vBitmap.Height-10);
    dAngleX := 360 / 37;
    for i := 0 to 36 do begin
        dAngle := dAngleX * i;
        degInRad := dAngle * DEG2RAD;
        x1 := centerx - trunc(cos(degInRad) * (centerx-10));
        Y1 := centery - trunc(sin(degInRad) * (centery-10));
        vBitmap.Canvas.MoveTo(centerx, centery);
        vBitmap.Canvas.LineTo(X1, Y1);
    end;
    vBitmap.Canvas.Ellipse(40, 40, vBitmap.Width-40, vBitmap.Height-40);

    Color0 := MakeColor(1.0, 0.0, 0.0);
    Color1 := MakeColor(0.0, 1.0, 0.0);
    Color2 := MakeColor(0.0, 0.0, 0.0);
    for i := 0 to 36 do begin
        dAngle := dAngleX * i + 5;
        degInRad := dAngle * DEG2RAD;
        if(i = 0) then
            vBitmap.Canvas.Brush.Color := Color0
        else begin
            if(i mod 2 = 1) then vBitmap.Canvas.Brush.Color := Color1
            else vBitmap.Canvas.Brush.Color := Color2;
        end;
        x1 := centerx - trunc(cos(degInRad) * 110);
        Y1 := centery - trunc(sin(degInRad) * 110);
        vBitmap.Canvas.FloodFill(x1, y1, vBitmap.Canvas.Pen.Color, fsBorder);
    end;
    { Get form size }
    H:=vBitmap.Height;
    W:=vBitmap.Width;

    Angle := 0;
    vBitmap.Canvas.Pen.Color := clBlue;
    while (Angle<360) do begin
        X := centerx - Round(cos(Angle*DEG2RAD) * 88);
        Y := centery - Round(sin(Angle*DEG2RAD) * 88);
        vBitmap.Canvas.Pen.Color:=RGB(255, 255,abs(255-Angle));
        DrawLine(centerx, centery, X, Y, vBitmap);
        Inc(Angle);
    end;

    Angle := 0;
    vBitmap.Canvas.Pen.Color := clBlue;
    while (Angle<360) do begin
        X := centerx - Round(cos(Angle*DEG2RAD) * 48);
        Y := centery - Round(sin(Angle*DEG2RAD) * 48);
        vBitmap.Canvas.Pen.Color:=RGB(abs(255-Angle),abs(255-Angle),abs(255-Angle));
        DrawLine(centerx, centery, X, Y, vBitmap);
        Inc(Angle);
    end;

    vBitmap.Canvas.Brush.Color := RGB($DC, $B4, $8C);
    vBitmap.Canvas.Pen.Color := RGB($DC, $B4, $8C);

    vBitmap.Canvas.Rectangle(126, 128-62, 130, 128+62);
    vBitmap.Canvas.Rectangle(128-62, 126, 128+62, 130);

    vBitmap.Canvas.Rectangle(124, 128-62, 132, 128-22);
    vBitmap.Canvas.Rectangle(124, 128+22, 132, 128+62);
    vBitmap.Canvas.Rectangle(128-62, 124, 128-22, 132);
    vBitmap.Canvas.Rectangle(128+22, 124, 128+62, 132);
    vBitmap.Font.Color := RGB($FF, $FF, $FF);
    vBitmap.Canvas.Brush.Style := bsClear;
    Angle := 90;

    Setlength(ValueT, 37);
    ValueT[0] := '0'; ValueT[1] := '32'; ValueT[2] := '15'; ValueT[3] := '19';
    ValueT[4] := '4'; ValueT[5] := '21'; ValueT[6] := '2'; ValueT[7] := '25';
    ValueT[8] := '17'; ValueT[9] := '34'; ValueT[10] := '6'; ValueT[11] := '27';
    ValueT[12] := '13'; ValueT[13] := '36'; ValueT[14] := '11'; ValueT[15] := '30';
    ValueT[16] := '8'; ValueT[17] := '23'; ValueT[18] := '10'; ValueT[19] := '5';
    ValueT[20] := '24'; ValueT[21] := '16'; ValueT[22] := '33'; ValueT[23] := '1';
    ValueT[24] := '20'; ValueT[25] := '14'; ValueT[26] := '31'; ValueT[27] := '9';
    ValueT[28] := '22'; ValueT[29] := '18'; ValueT[30] := '29'; ValueT[31] := '7';
    ValueT[32] := '28'; ValueT[33] := '12'; ValueT[34] := '35'; ValueT[35] := '5';
    ValueT[36] := '26';
    for i := 0 to 36 do begin
        if(length(ValueT[i]) = 1) Then
            dAngle := dAngleX * i + 3
        else
            dAngle := dAngleX * i;
        degInRad := dAngle * DEG2RAD;
        x1 := centerx - trunc(cos(degInRad) * 110);
        Y1 := centery - trunc(sin(degInRad) * 110);
        TextRotate(vbitmap, x1, y1, Angle, ValueT[i], vBitmap.Font);

        Angle := Angle - 10;
        if(Angle = 0) then Angle := 360;
    end;

    PaintBox01.Canvas.CopyRect(Bounds(0, 0, vBitmap.Width, vBitmap.Height), vBitmap.Canvas,
Bounds(0, 0, vBitmap.Width, vBitmap.Height));
    vBitmap.SaveToFile('image.bmp');
    vBitmap.Free;
end;

5/10/2009

News - 11/05/2009

I am happy to introduce my first free Android application - Mog Poker. Mog Poker is a sort of card game, it is easy to play. Just download it by following the direct link. The game will work on 320 * 320, 320 * 480 and 480 * 320 screen size. If you have a smaller size screen than this, please try not to install it into your mobile. The application does not pay anything to me. I spend months to learn and make this application. Testing this application under emulator, it seemingly doesn't make any problem. Please forgive me about try not to test with a real mobile phone. if you do not meet any problem, please enjoy the game. Before trying it, you can see a couple of demo screen which was made by flash format. You can see the demo screen in the previous list. If you have a problem with viewing the demo screen, please avoid Internet Explorer. No problem with both Google Chrome and Opera.
download 1--> Mog Poker(large size cards)
download 2--> Mog Poker(small size cards)
Important :
The package was complied with Android version 1.5 and the target was Android 1.1.

5/07/2009

Optimise on a smaller screen.

There is no such a screen size (320 * 320) in Android real mobile phone. However, I want to see my application, how it can be optimized on this small screen. I changed each card size, simply redesign cards. Probably, I have to find out different technique, if I want to operate my application on a smaller screen than this screen size.