This blog will be associated with eclipse, Java Micro Edition, Android, etc... My premiere blogging date began from March, 25th, 2009
8/18/2009
Creating 3d data values for drawing ground
To create 3d data values for drawing ground have to calculate from center (0f, 0f, 0f). The left picture shows the four parts which are divided by center.
Every x and y values are increased and decreased by 1.0 or -1.0 except z values. The increase and decrease values have a same pattern. According many OpenGL examples from Internet, we can draw rectangle with 4 vertex points. Each vertex point has x, y and z value. Therefore, the program has to generate rectangle points’ value. Of course, the generated file has also color values.
int main(int argc, char **argv)
{
int nwidth = atoi(argv[1]);
int nheight = atoi(argv[2]);
fnCVertextFile(nheight, nwidth);
}
Example) program 8 8
When the program was executed like an example, then the vector values will be generated 16 * 16 sizes.
typedef struct {
float x, y, z;
} M3DPoint;
typedef struct {
M3DPoint left, top, right, bottom;
} M3DRect;
// the function writes structure values and string values to file.
void fprintfex(FILE *fvfile, M3DRect row1, char *value)
{
fprintf(fvfile, "%f %f %f %s\n", row1.left.x, row1.left.y, row1.left.z, value);
fprintf(fvfile, "%f %f %f %s\n", row1.top.x, row1.top.y, row1.top.z, value);
fprintf(fvfile, "%f %f %f %s\n", row1.right.x, row1.right.y, row1.right.z, value);
fprintf(fvfile, "%f %f %f %s\n", row1.bottom.x, row1.bottom.y, row1.bottom.z, value);
}
void fnCVertextFile(int aRow, int aColumn)
{
M3DRect row1;
float nleft = 0.0f;
float ntop = 0.0f;
char value1[] = {"0.3 0.3 0.3"};
char value2[] = {"0.5 0.5 0.5"};
char *value;
bool toggle = false;
FILE *fvfile = fopen("vector.dat", "w");
if(fvfile == NULL) {
printf("file cannot open!\n");
exit(-1);
}
// count of vertex
fprintf(fvfile, "%d\n", aRow * aColumn * 4 * 4);
for(int j = 0; j < aRow; j++)
{
for(int i = 0; i < aColumn; i++)
{
row1.left.x = nleft; row1.left.y = ntop; row1.left.z = 1.5f;
row1.top.x = nleft+1.0f; row1.top.y = ntop; row1.top.z = 1.5f;
row1.right.x = nleft+1.0f; row1.right.y = ntop+1.0f; row1.right.z = 1.5f;
row1.bottom.x = nleft; row1.bottom.y = ntop+1.0f; row1.bottom.z = 1.5f;
value = (toggle) ? value1 : value2;
fprintfex(fvfile, row1, value);
toggle = !toggle;
nleft += 1.0f;
}
ntop += 1.0f;
nleft = 0.0f;
toggle = !toggle;
}
// was ommited below section of source
…
7/02/2009
Now, my second app was included some MIDI sounds.
Until I get Android test device, The second app will be like this.
6/27/2009
Qt4.5.2-tower
Recently, Nokia published the new version of Qt4.5.2-tower which can be operated in many platforms. Previously, I installed the Qt4.5.0-garden for s60 and windows platforms. A couple of days ago, I tried to install S60 5th edition SDK and s60 3rd Feature pack II. I already had N97 0.5 version SDK. The S60 5th edition emulator provided a couple of resolution of mobile screen. So, I uninstalled 3rd edition and N97 edition SDK. Yesterday, I downloaded the Qt4.5.2-tower and I did install process into my old laptop notebook. The install required many things to install the Qt4.5.2-tower. I completed the install process yesterday night due to what I got. I like 2d graphics API. It easily use and so powerful. I am not sure now how an application install into real device. Since I like the emulator and I can launch my testing application into the emulator.
6/21/2009
Qt4.5.0-Garden
For Nokia Application developers, Now They have a little strong development toolkit. ‘Qt4.5.0-garden’ which supports library for s60 mobile makes low a barrier then before. It means S60 mobile application developers can develop application more easy. For me, I was trying to learn about Carbide C++ and S60 library but it gave to me very complex. But Qt garden takes away some complex. To launch an application under S60 emulator, it is very simple. The picture shows my first trying of tutorial which was presented from qt garden prereleased web site. At the moment, I only use text editor called Notepad++, Dos command for building tutorial C++ code and emulator. Of course, there are some things should installed before use Qt garden.
6/19/2009
Translation bitmap image
Bitmap image contains BitmapHeader, pixels data and palette. The palette only need less than 16 bit color bitmap image, so This article will not include. Microsoft Visual studio has BitmapHeader structure in some header files. It also provides some functions which often give developer difficult to understand. Anyone who may has basic knowledge of c++ and the structure of bitmap file will has no problem with this article. The aritcle will touch only Device Independent Bitmap and pixels data are not compressed.
Code begining here // ->>
#include <stdio.h>
#include <stdlib.h>
#pragma pack(1) // get the structure size 54 not 56
typedef struct {
unsigned char bfType1; // fixed 'B'
unsigned char bfType2; // fixed 'M'
unsigned int bfSize; // Size of File. Zero is acceptable
unsigned short bfReserved1; // Zero
unsigned short bfReserved2; // Zero
unsigned int bfOffBits; // Offset to beginning of bitmap
unsigned int biSize; // Number of Bytes in Structure
unsigned int biWidth; // width of bitmap in pixels
unsigned int biHeight; // height of bitmap in pixels
unsigned short biPlanes; // Planes in target device = 1
unsigned short biBitCount; // Bits per Pixel 1, 4, 8, 16, 24, 32
unsigned int biCompression; // BI_RGB = 0, BI_RLE8, BI_RLE4
unsigned int biSizeImage; // Size of Image Part (often ignored)
unsigned int biXPelsPerMeter; // Always Zero
unsigned int biYPelsPerMeter; // Always Zero
unsigned int biClrUsed; // Number of Colors used in Palette
unsigned int biClrImportant; // Number of Colors that are Important
} TBmpHeader;
<<- // Code end here
The pixels data fills the end of bitmap file after bitmap header. The 1 point pixel data consists of red, green and blue color value each. The each color value has the size of 8 bit.
This is a structure for 24 bit color.
Code begining here // ->>
typedef struct {
unsigned char rgbBlue; //intensity of blue in the color
unsigned char rgbGreen; //intensity of green in the color
unsigned char rgbRed; //intensity of red in the color
} TRGB;
<<- // Code end here
32 bit color adds alpha color value which sometimes use calcuration for mixing two images.
Code begining here // ->>
typedef struct {
unsigned char rgbBlue; //intensity of blue in the color
unsigned char rgbGreen; //intensity of green in the color
unsigned char rgbRed; //intensity of red in the color
unsigned char rgbAlpha; //intensity of Alpha in the color
} TRGBA;
<<- // Code end here
This routine fills bitmapheader structure by using width, height and color bit. The third argument is color type. It can use with 16, 24 and 32 value.
Code begin here // ->>
TBmpHeader FillBitmapHeader(unsigned int width, unsigned int height,
unsigned short bitmapType)
{
TBmpHeader MyBitmapHeader;
MyBitmapHeader.bfType1 = 0x42;
MyBitmapHeader.bfType2 = 0x4D;
MyBitmapHeader.bfSize = 0x00000000;
MyBitmapHeader.bfReserved1 = 0x0000;
MyBitmapHeader.bfReserved2 = 0x0000;
MyBitmapHeader.bfOffBits = 0x36; // the location of bitmap data
MyBitmapHeader.biSize = 0x28; // Size of the BItmapHeader
MyBitmapHeader.biWidth = width;
MyBitmapHeader.biHeight = height;
MyBitmapHeader.biPlanes = 0x0001; // Plane target device 1
MyBitmapHeader.biBitCount = bitmapType; // Bits per Pixel 1, 4, 8, 16, 24, 32
MyBitmapHeader.biCompression = 0x00000000; // BI_RGB = 0, BI_RLE8, BI_RLE4
MyBitmapHeader.biSizeImage = 0x00000000;
MyBitmapHeader.biXPelsPerMeter = 0x00000000;
MyBitmapHeader.biYPelsPerMeter = 0x00000000;
MyBitmapHeader.biClrUsed = 0x00000000;
MyBitmapHeader.biClrImportant = 0x00000000;
return MyBitmapHeader;
}
<<- // Code end here
16 bit color can consist 32 bit color but each RGBA color has to decrease there own size half. Therefore, the result image can not avoid color loss.
Code begin here // ->>
void ConvertBmp32to16(const char *srcfname, const char *dstfname)
{
TBmpHeader MyBitmapHeader;
FILE *finput = fopen(srcfname, “rb”);
if(finput == NULL) return;
fread(&MyBitmapHeader, sizeof(TBmpHeader), 1, finput);
TRGBA * rgbdata;
unsigned short *rgbdata16;
int SSize = MyBitmapHeader.biWidth * MyBitmapHeader.biHeight;
int Size = SSize * 4;
rgbdata = (TRGBA *)malloc(Size);
fread(rgbdata, Size, 1, finput);
fclose(finput);
rgbdata16 = (unsigned short *)malloc(SSize*2);
unsigned short r, g, b, a;
for(int i=0; i < SSize; i++) {
b = rgbdata[i].rgbBlue >> 4;
g = rgbdata[i].rgbGreen >> 4;
r = rgbdata[i].rgbRed >> 4;
a = rgbdata[i].rgbAlpha >> 4;
rgbdata16[i] = (r << 12) + (g << 8) + (b << 4) + a;
}
MyBitmapHeader = FillBitmapHeader(MyBitmapHeader.biWidth, MyBitmapHeader.biHeight, 16);
FILE *fpout = fopen(dstfname, “wb”);
if(fpout == NULL) return;
fwrite(&MyBitmapHeader, sizeof(TBmpHeader), 1, fpout);
fwrite(rgbdata16, SSize*2, 1, fpout);
fclose(fpout);
free(rgbdata);
free(rgbdata16);
}
<<- // Code End here
After execute the ConvertBmp32to16() routine, a bitmap image will be generated. The aim of this routine is for keeping alpha value after translation. So, you don't have to confirm the generated image.
Code begin here // ->>
void ConvertBmp16to32(const char *srcfname, const char *dstfname)
{
TBmpHeader MyBitmapHeader;
FILE *finput = fopen(srcfname, “rb”);
if(finput == NULL) return;
fread(&MyBitmapHeader, sizeof(TBmpHeader), 1, finput);
TRGBA * rgbdata;
unsigned short *rgbdata16;
int SSize = MyBitmapHeader.biWidth * MyBitmapHeader.biHeight;
int Size = SSize * 2;
rgbdata16 = (unsigned short *)malloc(Size);
fread(rgbdata16, Size, 1, finput);
fclose(finput);
rgbdata = (TRGBA *)malloc(SSize*4);
unsigned short r, g, b, a;
for(int i=0; i < SSize; i++) {
b = (rgbdata16[i] >> 4) & 0x0f;
g = (rgbdata16[i] >> 8) & 0x0f;
r = (rgbdata16[i] >> 12) & 0x0f;
a = rgbdata16[i] & 0x0f;
rgbdata[i].rgbBlue = b << 4;
rgbdata[i].rgbGreen = g << 4;
rgbdata[i].rgbRed = r << 4;
rgbdata[i].rgbAlpha = a << 4;
}
MyBitmapHeader = FillBitmapHeader(MyBitmapHeader.biWidth, MyBitmapHeader.biHeight, 32);
FILE *fpout = fopen(dstfname, “wb”);
if(fpout == NULL) return;
fwrite(&MyBitmapHeader, sizeof(TBmpHeader), 1, fpout);
fwrite(rgbdata, SSize*4, 1, fpout);
fclose(fpout);
free(rgbdata);
free(rgbdata16);
}
<<- // Code end here
After execute the ConvertBmp16to32() routine, a bitmap image will also be generated. The image color shows
some color loss.
The shown below routine is translation routine which converts 24 bit color into 16 bit color bitmap.
Code begin here // ->>
void ConvertBmp24to16_555(const char *srcfname, const char *dstfname)
{
TBmpHeader MyBitmapHeader;
FILE *finput = fopen(srcfname, “rb”);
if(finput == NULL) return;
fread(&MyBitmapHeader, sizeof(TBmpHeader), 1, finput);
TRGB * rgbdata;
unsigned short *rgbdata16;
int SSize = MyBitmapHeader.biWidth * MyBitmapHeader.biHeight;
int Size = SSize * 3;
rgbdata = (TRGB *)malloc(Size);
fread(rgbdata, Size, 1, finput);
fclose(finput);
rgbdata16 = (unsigned short *)malloc(SSize*2);
unsigned short r, g, b, a;
for(int i=0; i < SSize; i++) {
b = rgbdata[i].rgbBlue >> 3;
g = rgbdata[i].rgbGreen >> 3;
r = rgbdata[i].rgbRed >> 3;
rgbdata16[i] = (r << 10) + (g << 5) + b;
}
MyBitmapHeader = FillBitmapHeader(MyBitmapHeader.biWidth, MyBitmapHeader.biHeight, 16);
FILE *fpout = fopen(dstfname, “wb&rdquo);
if(fpout == NULL) return;
fwrite(&MyBitmapHeader, sizeof(TBmpHeader), 1, fpout);
fwrite(rgbdata16, SSize*2, 1, fpout);
fclose(fpout);
free(rgbdata);
free(rgbdata16);
}
<<- // Code end here
Code begin here // ->>
int main(int argc, char **argv)
{
ConvertBmp32to16(“bitmap32.bmp”, “bitmap16r1.bmp”);
ConvertBmp16to32(“bitmap16r1.bmp”, “bitmap32r1.bmp”);
ConvertBmp24to16_555(“bitmap24.bmp”, “bitmap16r2.bmp”);
return 0;
}
<<- // Code end here
6/17/2009
This will be my second Android game application...
Since, I am trying to complete this application. The application still miss some routines but the routines will be made soon.
6/09/2009
Sphere on my Android emulator...
Both 'setModel()' and 'setModelEX()' methods work with making points of sphere surface. Now I get my drawing sphere routine. I recommend a URL which provides some glut functions that can be used under Android. akjava-android-project
class GLBall {
private int VertexCount, mallocCount;
private FloatBuffer mVertexBuffer;
private FloatBuffer mNormalBuffer;
public float z_angle;
private int slices, stacks;
public GLBall()
{
mVertexBuffer = null;
mNormalBuffer = null;
}
public void setModel(double radius, int lats, int longs)
{
double lat0, z0, zr0, lat1, z1, zr1, lng, x, y;
float normal[];
float vertices[];
int mindex = 0, nindex=0;
VertexCount = (lats+1) * (longs+1) * 2;
mallocCount = VertexCount * 3;
normal = new float[mallocCount];
vertices = new float[mallocCount];
stacks = lats+1;
slices = longs+1;
for(int i = 0; i <= lats; i++) {
lat0 = (double)Math.PI * (-0.5 + (i - 1) / (double)lats);
z0 = (double)Math.sin(lat0) * radius;
zr0 = (double)Math.cos(lat0) * radius;
lat1 = (double)Math.PI * (-0.5 + i / (double)lats);
z1 = (double)Math.sin(lat1) * radius;
zr1 = (double)Math.cos(lat1) * radius;
for(int j = 0; j <= longs; j++) {
lng = 2 * Math.PI * (j - 1) /(double)longs;
x = Math.cos(lng);
y = Math.sin(lng);
normal[nindex++] = vertices[mindex++] = (float)(x * zr0);
normal[nindex++] = vertices[mindex++] = (float)(y * zr0);
normal[nindex++] = vertices[mindex++] = (float)z0;
normal[nindex++] = vertices[mindex++] = (float)(x * zr1);
normal[nindex++] = vertices[mindex++] = (float)(y * zr1);
normal[nindex++] = vertices[mindex++] = (float)z1;
}
}
mVertexBuffer = FloatBuffer.wrap(vertices);
mNormalBuffer = FloatBuffer.wrap(normal);
z_angle = 0.0f;
}
public void setModelEX(float radius, int astacks, int aslices)
{
int i, j, vindex = 0, nindex = 0;
float slicestep, stackstep;
stackstep = ((float)Math.PI) / astacks;
slicestep = 2.0f * ((float)Math.PI) / aslices;
VertexCount = astacks * (aslices+1) * 2;
mallocCount = VertexCount * 3;
float normal[] = new float[mallocCount];
float vertices[] = new float[mallocCount];
for (i = 0; i < astacks; i++)
{
float a = i * stackstep;
float b = a + stackstep;
float s0 = (float)Math.sin(a);
float s1 = (float)Math.sin(b);
float c0 = (float)Math.cos(a);
float c1 = (float)Math.cos(b);
float nv;
for (j = 0; j <= aslices; j++)
{
float c = j * slicestep;
float x = (float)Math.cos(c);
float y = (float)Math.sin(c);
nv=x * s0;
normal[nindex++] = nv;
vertices[vindex++] = nv * radius;
nv=y * s0;
normal[nindex++] = nv;
vertices[vindex++] = nv * radius;
nv=c0;
normal[nindex++] = nv;
vertices[vindex++] = nv * radius;
nv=x * s1;
normal[nindex++] = nv;
vertices[vindex++] = nv * radius;
nv=y * s1;
normal[nindex++] = nv;
vertices[vindex++] = nv * radius;
nv=c1;
normal[nindex++] = nv;
vertices[vindex++] = nv * radius;
}
}
mVertexBuffer = FloatBuffer.wrap(vertices);
mNormalBuffer = FloatBuffer.wrap(normal);
z_angle = 0.0f;
this.stacks = astacks;
this.slices = aslices+1;
}
public void draw(GL10 gl) {
int triangles;
gl.glDisable(GL10.GL_TEXTURE_2D);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
gl.glNormalPointer(GL10.GL_FLOAT, 0, mNormalBuffer);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
triangles = slices * 2;
for(int i=0; i < stacks; i++)
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, i*triangles, triangles);
gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glEnable(GL10.GL_TEXTURE_2D);
}
}
6/06/2009
Drawing sphere again
With Mingw I can use OpenGL function within main.cpp. I tried to use OPenGL function in my sphere.cpp but link error occured When i compiled and linked. So, I moved draw() function into my main.cpp. Once sphere
object is made, then the object will can share and will draw many with different color and angle.
main.cpp>
void drawSphere(TSphere sphere)
{
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, sphere.modelvalue);
glNormalPointer(GL_FLOAT, 0, sphere.normalvalue);
glDrawArrays(GL_QUAD_STRIP, 0, sphere.VertexCount);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
}
sphere.h>
#ifndef __SPHERE_H__
#define __SPHERE_H__
#include
#include
#include
typedef struct {
float x, y, z;
} Vertex3D;
class TSphere {
public:
TSphere();
void SetModelValue(float radius, int slices, int stacks);
public:
int VertexCount;
Vertex3D *modelvalue;
Vertex3D *normalvalue;
};
#endif
sphere.cpp>
#include "sphere.h"
TSphere::TSphere()
{
//
}
void TSphere::SetModelValue(float radius, int slices, int stacks)
{
float lat0, z0, zr0, lat1, z1, zr1, x, y, lng;
int index = 0;
VertexCount = (slices+1) * (stacks+1) * 2;
modelvalue = new Vertex3D[VertexCount];
normalvalue = new Vertex3D[VertexCount];
for(int i = 0; i <= slices; i++) {
lat0 = M_PI * (-0.5 + (i - 1) / (float)slices);
z0 = sin(lat0) * radius;
zr0 = cos(lat0) * radius;
lat1 = M_PI * (-0.5 + i / (float)slices);
z1 = sin(lat1) * radius;
zr1 = cos(lat1) * radius;
for(int j = 0; j <= stacks; j++) {
lng = 2 * M_PI * (j - 1) / stacks;
x = cos(lng);
y = sin(lng);
modelvalue[index].x = x * zr0;
modelvalue[index].y = y * zr0;
modelvalue[index].z = z0;
normalvalue[index].x = x * zr0;
normalvalue[index].y = y * zr0;
normalvalue[index].z = z0;
index++;
modelvalue[index].x = x * zr1;
modelvalue[index].y = y * zr1;
modelvalue[index].z = z1;
normalvalue[index].x = x * zr1;
normalvalue[index].y = y * zr1;
normalvalue[index].z = z1;
index++;
}
}
}
Drawing sphere without glut...
Finally, I got a picture which is about drawing sphere. The routine does not contain glut function and neither glBegin() function. It is very simple to use. I would like to appreciate to http://ozark.hendrix.edu/~burch/cs/490/sched/feb8/. You can get c source code by visiting the url but u can see little bit different.
Probably, I will change this routine to c code and Android Java code ...
For example)
SPhere1 := TSPhere.Create;
SPhere1.SetModelValue(0.75, 8, 8);
in my render() routine...
begin
...
glLoadIdentity;
glTranslatef(-1.5, 0.0, -3.0);
glRotatef(Angle, 1.0, 1.0, -1.0);
glColor3f(0.9, 0.9, 0.9);
SPhere1.Draw();
glColor3f(1.0, 1.0, 1.0);
...
end;
type
TXCustomVertex = packed Record
fX, fY, fZ : single;
end;
TSphere = class
public
Constructor Create;
Procedure Draw();
procedure SetModelValue(r: single; lats, longs : Integer);
protected
private
clats, clongs, vertexCount : Integer;
ModelValue : Array of TXCustomVertex;
NormalValue : Array of TXCustomVertex;
end;
Constructor TSphere.Create;
Begin
//
end;
procedure TSphere.SetModelValue(r: single; lats, longs : Integer);
var
i, j, index : Integer;
lat0, z0, zr0, lat1,z1, zr1, lng, x, y : Single;
begin
clats := lats;
clongs := longs;
vertexCount := (lats+1) * (longs+1) * 2;
SetLength(ModelValue, (lats+1) * (longs+1) * 2);
SetLength(NormalValue, (lats+1) * (longs+1) * 2);
index := 0;
for i := 0 to lats do begin
lat0 := PI * (-0.5 + (i - 1) / lats);
z0 := sin(lat0) * r;
zr0 := cos(lat0) * r;
lat1 := PI * (-0.5 + i / lats);
z1 := sin(lat1) * r;
zr1 := cos(lat1) * r;
for j := 0 to longs do begin
lng := 2 * PI * (j - 1) / longs;
x := cos(lng);
y := sin(lng);
ModelValue[index].fX := x * zr0;
ModelValue[index].fY := y * zr0;
ModelValue[index].fZ := z0;
NormalValue[index].fX := x * zr0;
NormalValue[index].fY := y * zr0;
NormalValue[index].fZ := z0;
index := index + 1;
ModelValue[index].fX := x * zr1;
ModelValue[index].fY := y * zr1;
ModelValue[index].fZ := z1;
NormalValue[index].fX := x * zr1;
NormalValue[index].fY := y * zr1;
NormalValue[index].fZ := z1;
index := index + 1;
end;
end;
end;
Procedure TSphere.Draw();
Begin
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_Float, 0, ModelValue);
glNormalPointer(GL_Float, 0, NormalValue);
glDrawArrays(GL_QUAD_STRIP, 0, vertexCount);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
End;
5/27/2009
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/19/2009
5/14/2009
Clear screen shot of roulette under 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.
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.
5/01/2009
4/29/2009
4/28/2009
Installing SDL (Simple DirectMedia Layer), GLUT (OpenGL Utility Kit) under Mingw
All information can be found through their presented web site. Therefore candidates can directly visit by clicking this link. Candidates will find the appreciated library under the "Download" / "SDL 1.2" section. The library contains many files, however candidates do not need copy all of it. Copy inside files of bin, include and lib folders into your Mingw folder.
Compile method 1)
$ g++ “sourcefile.extension” –o “launching program name”-lsdl
Compile method 2 – include OpenGL lib)
$ g++ “sourcefile.extension” –o “launching program name”-lsdl –lglu32 –lglut32 –lopengl32
If candidates want to use glut library, please visit here . And will look appreciate method through the web site. Please check the shown above picture.
4/22/2009
Installation Mingw, MSYS and GTKmm on Windows XP
For a long time, I would install some softwares on my old laptop. Three weeks ago, I bought a 40giga hdd, then tried to install into my labtop computer. But, there had some problem and I spent some days to fix it. Finally I get a 30 giga hdd. It was good thing to me because previously I had a 10 giga hdd.
By the way, to install Mingw is quite simple. Candidates can find automated installation setup file from here . Please candidate version choose when you install. Next, candidates can find MSYS automated installation setup file from same URL . The default installation path of Mingw is “C:\Mingw” and MSYS is “C:\Mingw\Msys”. Give a path “C:/Mingw” when MSYS installer asks where Mingw was installed. After the Installation, Please add “C:\Mingw\bin;” to the environment variable called “Path”. There has some works should do under the MSys shell. Before doing it, let install the GTKmm which is stand for Graphic Tool kit … something like that. Go there , find and download the automated setup file for windows. Next, give a path “C:\Gtk” When Installer asks where does install you want. The setup will add something on your environment variable. So please relax instead of doing something. Under MSys shell, I could compile and execute any examples of GTKmm with `pkg-config`. Before compile with g++ and gcc, execute the MSys shell. If the MSys shell window is displayed, then go to root directory use “cd” instruction ([ex]cd ..). You can check your current folder by using “pwd” instruction. If you are in root folder, the “pwd” instruction will return “/”. Check file and directory by using “ls” instruction. If you can not see the “gtk” folder, make “gtk” folder by using “mkdir” instruction ([ex]mkdir gtk). Next, Candidate can link this path by editing ‘fstab’ file which is located in “/etc” folder. When you open it, you will know how to do it. Add like “c:/gtk /gtk”. To edit file under MSys shell, use vi editor. You can find a manual by searching Internet. Now close the MSys shell and execute again. Go to “/gtk” directory and check file and directory. If you have some files and directories, you get “gtk” under MSys shell. Now go to your working folder by “cd” instruction ([ex]cd). Make example file for compiling. Here is compiling example. Ex) $ gcc tutorial1.cc –o tutorial `pkg-config --cflags --libs gtkmm-2.4`.
4/19/2009
It's a tunning point to make my game application.
4/12/2009
Introduction of Android skin
I think many people already knew this article, however for some people's ignorance I would like to introduce one thing which is about the android skin, it can be downloaded through the suggested URL in this picture. I appreciate to the creator of those skins. The above shown picture is my favorite skin.
์๋๋ก์ด๋ ์คํจ ์๊ฐ
์ด๋ฏธ ์๋๋ก์ด๋๋ฅผ ์๊ณ ๊ณ์๋ ๋ถ์ ์ด๋ฏธ ์๊ณ ๊ณ์๋ฆฌ๋ผ ์๊ฐ๋์ง๋ง ํน์๋ ์์ง ๋ชจ๋ฅด์๋ ๋ถ์ ์ํ์ฌ ์ด๋ ๊ฒ ๋ณด๊ธฐ์ข์ ์๋ฎฌ๋ ์ดํฐ ์คํจ์ ์ฌ๋ฆฝ๋๋ค. ๊ทธ๋ฆผ์ ์ ์๋์ด์ง ์ฃผ์๋ฅผ ์ฐพ์ ๊ฐ์ ์ ์ ๋ง์ ๋ง๋ ์คํจ์ ์ฌ์ฉํด ๋ณด์์ญ์. ์ฌ๋ ค์ง ๊ทธ๋ฆผ์ ์ ๊ฐ ์ข์ํ๋ ์๋ฎฌ๋ ์ดํฐ ์คํจ์ ๋๋ค.
3/26/2009
์ดํด๋ฆฝ์ค ๊ทธ๋ฆฌ๊ณ ๋๋ฌ์ด๋ ์๊ฐ๋์...
์ดํด๋ฆฝ์ค๋ฅผ ์ ํ๊ฒ ๋๊ฒ์ ์๋ง๋ ๋๋ฌ์ ์ผ๋ก ๊ฑฐ์ฌ๋ฌ ์ฌ๋ผ๊ฐ๋๋ค. ์ฒ์์ ์ดํด๋ฆฝ์ค์ ๊ทธ๋ฅ ์๋ฐ ์คํ ๋ค๋ ํ๋ซํผ์ ์ด์ฉํ์ฌ ์ผ๋ฐ ๋ฐ์ดํ๋ฒ ์ด์ค ํด๋ผ์ด์ธํธ ์์ฉํ๋ก๊ทธ๋จ์ ์งํํ๋ค๊ฐ ์ด๋๋ ๋ฌธ๋ ๋ชจ๋ฐ์ผ์์ ๋์๊ฐ๋ ์์ฉ ํ๋ก๊ทธ๋จ์ ๋ง๋ค์ด ๋ณด๊ณ ์ถ๋ค๋ ์๊ฐ์ ๊ทธ๋ ๋ถํฐ ์ธํฐ๋ท์ ์ฐพ์๋ณด๋ฉฐ ์งํ์ ํ์ต๋๋ค. Net bean๋ ์ค์นํด ์ฌ์ฉํด ๋ณด์์ง๋ง ์ญ์ ๋ณธ์ธ์๊ฒ๋ ์ดํด๋ฆฝ์ค๊ฐ ๋ ์ข๋ค์. Nokia์ Carbide C++์ ํ๋ฒ ์๋ํด ๋ณด๊ณ ์ถ์๋ฐ ๊ฐ์ง๊ณ ์๋ ๋ ธํธ๋ถ์ด ์ ์ฌ์์ด๊ณ ์ ๋๋ก ์ฌ์ฉํ ๋ ค๋ฉด ์๋นํ ๋ง์ ์์ SDK๋ฅผ ํ์๋ก ํ๊ธฐ ๋๋ฌธ์ ์ผ๋จ ๋ค๋ก ๋ฏธ๋ฃจ๊ณ , ์ด์ ์ ์ฌ๋ฆฐ ๊ฒ์๋ฌผ์ ์ง์์ ์ป๊ธฐ ์ํ์ฌ ์ฌ๊ธฐ ์ ๊ธฐ ์ธํฐ๋ท์ ๋ง์ด ๋์ ๋ค๋ ์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ด์ชฝ๋ถ์ผ์ ์ง์์ ์๊ธฐ ์ํด์ ์ ํ๋ ํด๋ณด๊ณ ์ฌ๋๋ ๋ง๋๋ณด๊ณ ์ฒซ๋ฒ์งธ ์๋ฎฌ๋ ์ดํฐ์์ ๋์๊ฐ๋ ์์ฉํ๋ก๊ทธ๋จ ์คํฌ๋ฆฐ์ท์ ํจ๊ป ์ฌ๋ฆฝ๋๋ค. ์ด๋ฏธ ๊ตญ๋ด์ ์ผ์ฑ๊ณผ LG์ ์ ๊ฐ ๊ตฌ์ํ ์์ฉํ๋ก๊ทธ๋จ์ด ํ์ฌ๋ ์๊ธฐ์ ์๋ฏธ๊ฐ ์์ง๋ง ์ญ์ ๊ทธ๋๋ ๋ฐฐ์์ด ์์๊ธฐ์...
์ดํด๋ฆฝ์ค์ ๊ตฌ๊ธ์๋๋ก์ด๋ ํ๋ซํผ ๋ถ์ด๊ธฐ ๋๋ฒ์งธ
๊ทธ๋ฆผ์์ ๋ณด๋ฏ์ด Window > Preferences ๋ฉ๋ด๋ฅผ ํด๋ฆญํ ํ ์ผ์ชฝ์ Android ํญ๋ชฉ์ ํด๋ฆญํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋์ ์๋๋ก์ด๋ SDK๊ฐ ์ค์น๋ ๊ฒฝ๋ก๋ฅผ (์: C:\android-sdk-windows-1.1_r1) ์ค์ ํฉ๋๋ค. ๋๋จธ์ง ์ค์ ์ ๊ทธ๋ฅ ๋ํดํธ๋ก ๋์๋ฉด ๋ฉ๋๋ค. ์ดํด๋ฆฝ์ค์ Android Project ๋ฉ๋ด ์ถ๊ฐ๋ฅผ ์ํ์ฌ Windows > Customize Perspective... ๋ฅผ ํด๋ฆญํ์ ์ ๋ํ๋๋ ๋ค์ด์๋ก๊ทธ์์ Android์ ๊ด๋ จ๋ ํญ๋ชฉ์ ์ ํํ์๋ฉด Android Project๋ฅผ ์์ํ์ค์ ์์ต๋๋ค. ์ด๋ ๊ฒ ํจ์ผ๋ก์จ ์ดํด๋ฆฝ์ค์ ์๋ฐ๋ฅผ ์ด์ฉํ์ฌ ๋ชจ๋ฐ์ผ์์ ์คํ๋์ด์ง ์ ์๋ ๊ฒ์๊ฐ๋ฐ์ ํ๋ฐ์ง ๋ค๊ฐ๊ฐ ์ ์์ต๋๋ค.
3/25/2009
์ดํด๋ฆฝ์ค์ ๊ตฌ๊ธ์๋๋ก์ด๋ ํ๋ซํผ ๋ถ์ด๊ธฐ ์ฒซ๋ฒ์งธ
๊ตฌ๊ธ ์๋๋ก์ด๋ SDK๋ ์ฌ๊ธฐ๋ก ๊ฐ์
์ ๋ฐ์์ค ์ ์์ต๋๋ค. ๋ค์ด ๋ฐ์ผ์ ํ์ผ์ C:\์ ์์ถ์ ํ๋ฉด ๋ฉ๋๋ค. ์ดํด๋ฆฝ์ค ์ ๋กํ๋ ๊ฐ๋๋ฉ๋ฐ ๋ฒ์ ์์ ๋์๊ฐ๋ฉฐ OS๋ ์๋์ฐ์ ๊ฒฝ์ฐ Windows XP (32-bit) or Vista (32- or 64-bit) ๊ฐ ํ์ํฉ๋๋ค. ๋ง์ฐฌ๊ฐ์ง๊ณ ์ดํด๋ฆฝ์ค ํ๋ฌ๊ทธ(์ผ๋ช
ADT)์ธ์ด ํ์ํ๋ฉฐ ์ดํด๋ฆฝ์ค ๊ฐ๋๋ฉ๋ฐ ๋ฒ์ ์ ๊ฒฝ์ฐ ์๋์ ๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ์ค์นํฉ๋๋ค.
1. ์ดํด๋ฆฝ์ค๋ฅผ ์คํํ์ํ์ ํ, Help> Software Updates... ์์ผ๋ก ๋ฉ๋ด๋ฅผ ํด๋ฆญํฉ๋๋ค.
2. ๋ํ๋๋ ๋ค์ด์๋ก๊ทธ ์์์, Avaiable Software tab์ ํด๋ฆญํฉ๋๋ค.
3. Add Site...๋ฅผ ํด๋ฆญํ์ฌ plugin ๋ด๋ ค๋ฐ์ ์ฌ์ดํธ๋ฅผ ์ค์ ํฉ๋๋ค.
4. ๋ค์๊ณผ ๊ฐ์ด URL์ ์ ๋ ฅํฉ๋๋ค. "http://dl-ssl.google.com/android/eclipse/"
5. Android Devlopment Tools, Android Editors๋ฅผ ํด๋ฆญํ์ ํ Install ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
์ค์น๊ฐ ์๋ฃ๋๋ฉด Eclipse๋ฅผ ์ฌ๊ตฌ๋ํฉ๋๋ค. ADT์ ๊ด๋ จ๋ ์ค์ ์ ๋๋ฒ์งธ๋ฅผ ์ฐธ๊ณ ํ์ญ์์. ์๋ ๋์์์ ๋ณด๋คํฐ์ ์๋๋ก์ด๋ ํ๋ซํผ์ด ํ์ฌ๋ ๋์์ ์ ๋๋ค.
1. ์ดํด๋ฆฝ์ค๋ฅผ ์คํํ์ํ์ ํ, Help> Software Updates... ์์ผ๋ก ๋ฉ๋ด๋ฅผ ํด๋ฆญํฉ๋๋ค.
2. ๋ํ๋๋ ๋ค์ด์๋ก๊ทธ ์์์, Avaiable Software tab์ ํด๋ฆญํฉ๋๋ค.
3. Add Site...๋ฅผ ํด๋ฆญํ์ฌ plugin ๋ด๋ ค๋ฐ์ ์ฌ์ดํธ๋ฅผ ์ค์ ํฉ๋๋ค.
4. ๋ค์๊ณผ ๊ฐ์ด URL์ ์ ๋ ฅํฉ๋๋ค. "http://dl-ssl.google.com/android/eclipse/"
5. Android Devlopment Tools, Android Editors๋ฅผ ํด๋ฆญํ์ ํ Install ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
์ค์น๊ฐ ์๋ฃ๋๋ฉด Eclipse๋ฅผ ์ฌ๊ตฌ๋ํฉ๋๋ค. ADT์ ๊ด๋ จ๋ ์ค์ ์ ๋๋ฒ์งธ๋ฅผ ์ฐธ๊ณ ํ์ญ์์. ์๋ ๋์์์ ๋ณด๋คํฐ์ ์๋๋ก์ด๋ ํ๋ซํผ์ด ํ์ฌ๋ ๋์์ ์ ๋๋ค.
์ดํด๋ฆฝ์ค์ SK-VM ํ๋ซํผ ์ ์ฉํ๊ธฐ ์ธ๋ฒ์งธ
์ดํด๋ฆฝ์ค์ SK-VM ํ๋ซํผ ์ ์ฉํ๊ธฐ ๋๋ฒ์งธ
SK-VM์ ์ค์นํ์ ํ ๋ง์ฐฌ๊ฐ์ง๋ก ์ค์ ์ด ํ์ํฉ๋๋ค. Eclipse์ Windows > Preferences ๋ฅผ ํด๋ฆญํ์ ํ ์ผ์ชฝ์ ์๋กญ๊ฒ ๋ํ๋ XVM์ ์ ํํฉ๋๋ค. ์๋ฎฌ๋ ์ดํฐ์ ์คํํ์ผ ์์น์ ์๋ฎฌ๋ ์ดํฐ ์ฅ์น(์คํจ)์ ์ค์ ํฉ๋๋ค. ๋ฉ๋ชจ๋ฆฌ ์์ 512 ๋๋ 1024๋ผ๊ณ ์ ๋ ฅํ์ ํ ์ค์ ์ ๋ง์นฉ๋๋ค. ๊ทธ๋ฆผ์ ์ฐธ๊ณ ํ์ญ์์...
์ดํด๋ฆฝ์ค์ SK-VM ํ๋ซํผ ์ ์ฉํ๊ธฐ ์ฒซ๋ฒ์งธ
SK-VM์ SK Telecom์์ clean room ๊ธฐ๋ฐ์ผ๋ก ์์ฒด ๊ฐ๋ฐํ J2ME(Java 2 Micro Eidtion) ์๋ฐ ์คํ ํ๊ฒฝ์ผ๋ก ๊ฐ์๋จธ์ ๋ฐ ๋จ๋ง ํ์ฅ UI, ๋คํธ์ํฌ, IO๋ฅผ ํฌํจํ๋ ํด๋์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ๊ตฌ์ฑ๋์ด ์์ผ๋ฉฐ, ๋ฌด์ ์ด๋๋จ๋ง๊ธฐ์์ ์์ฉํ๋ก๊ทธ๋จ์ ๋ค์ด๋ก๋ ๋ฐ ์คํ์ํฌ ์ ์๋ ํ๊ฒฝ์ ์ ๊ณตํ๋ค.(SK Telecom, XCE)
SK-VM์ http://developer.xce.co.kr /๋ก ๊ฐ์ ์ ํ์๊ฐ์ ์ ํ์ ํ์ ์ฌ๊ธฐ์ ๋ค์ด์ ๋ฐ๊ณ ์ค์นํ์๋ฉด ๋ฉ๋๋ค. ์ค์น๊ฐ ์๋ฃ๋์ ํ ์ดํด๋ฆฝ์ค์ ๋ฉ๋ด๋ถ๋ถ์ ํ์ธํ์ญ์์.
์ฐธ๊ณ
1. SK Telecom, XCE, 2009.03.25,
view http://www.javastudy.co.kr/docs/lec_j2me/mobilejava/n-top/2.htm
MTJ์ค์ ํ Eclipse ์ถ๊ฐ์ ์ผ๋ก ํ ์ผ๋ค...
MTJ์ Antenna ๊ฐ ์ค์น๊ฐ ์๋ฃ๋์ด ์ก๋ค๋ฉด ์ดํด๋ฆฝ์ค๋ก ์ฐ๋ฆฌ๋ ํธ๋ํฐ์ฉ ๊ฒ์ ๋๋ ์์ฉ ํ๋ก๊ทธ๋จ ๊ฐ๋ฐ(์ผ๋ช CLDC, MIDP)์ ์์ํ ์ ์์ผ๋ฉฐ Windows -> Customize Perspective... ๋ฉ๋ด๋ฅผ ์ด์ฉํ์ฌ Java ME ํญ๋ชฉ๊ณผ ๊ด๋ จ๋ ๋๊ฐ์ ๋ฉ๋ด๋ฅผ ์ถ๊ฐํจ์ผ๋ก์จ Eclipse ์ฌ์ฉ์๋ค์ Midlet ํ๋ก์ ํธ๋ฅผ ์ฝ๊ฒ ์์ํ ์ ์์ต๋๋ค. ์ด์ ์ดํด๋ฆฝ์ค์์ ์๋ฐ๋ฅผ ์ด์ฉํ์ฌ ๋ชจ๋ฐ์ผ ๊ฒ์์ ์์ํ ์ ์์ต๋๋ค. ๋จ ์ธ๊ตญ๋ชจ๋ฐ์ผ ํฐ์ ํ์์...
Antenna์ MTJ...
Antenna๋๋ ์ํ์น์ Ant์ ํ์ฅ์ด๋ผ๊ณ ํฉ๋๋ค. Ant๋ ์์ํ ์๋ฐ ํด์ด๋ฉฐ, GNU make ๋ณด๋ค ๋จ์ํ๊ณ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์๋ค๊ณ ํ๋ค์. ์ด์จ๊ฑฐ๋ ์ค์น๋ antenna-bin-1.0.2.jar ํ์ผ์ ์ฌ๊ธฐ์ ๋ฐ์ผํ ํ antenna-bin-1.0.2.jar ํ์ผ์ ํธ์์ eclipse์ plugin ํด๋์ ๋ณต์ฌ ํฉ๋๋ค. ์ค์ ์ ๋ง์ฐฌ๊ฐ์ง๋ก eclipse๋ฅผ ๊ตฌ๋ํ์ ํ Window -> Preferences ๋ฅผ ํด๋ฆญํ ํ ์ผ์ชฝ์ Java ME ํญ๋ชฉ์ ์ ํํ์ ํ C:\eclipse\plugins\antenna-bin-1.0.2.jar๋ผ๊ณ Antenna jar ๊ฒฝ๋ก๋ฅผ ์ค์ ํฉ๋๋ค. Java ME ํญ๋ชฉ > Preprocessor > Symbol Set Definitions์ด ์ถ๊ฐ๋๋ค์... MTJ ์ฌ์ฉ์๋ค์ Antenna ํ์์ ๋ง๊ฒ ์ด๋ฏธ ์ ์๋์ด์ง ์ฌ๋ณผ์ ์ํฌํธ ํ ์ ์๋ค๊ณ ํฉ๋๋ค.
์ดํด๋ฆฝ์ค์ MTJ๋ฅผ ๋ถ์ด๊ธฐ...
์ฌ๊ธฐ์ MTJ๋ Mobile Tools for Java๋ผ๊ณ ํ๊ธฐ ๋์ด์ง ์ ์์ผ๋ฉฐ ์ดํด๋ฆฝ์ค์์ ์๋ฐ ๋ชจ๋ฐ์ผ ์์ฉ ํ๋ก๊ทธ๋จ์ ์ข๋ ์ฝ๊ฒ ๊ฐ๋ฐํ ์ ์๋๋ก ํด์ฃผ๋ ํ๋ฌ๊ทธ์ธ ์
๋๋ค. MTJ์ Misssion Statement๋ ์๋์ ๊ฐ์ต๋๋ค.
The goal of the Mobile Tools for JavaTM (MTJ) project is to extend existing Eclipse frameworks to support mobile device Java application development.
์ ๋ง์ฐฌ๊ฐ์ง๋ก ๋ค์ด๋ก๋๋ฅผ ๋ฐ์ผ๋ฌ ๊ฐ์ผ๋ฉ๋๋ค. ๊ฒฝ๋ก๋ ์ฌ๊ธฐ๋ก ๊ฐ์ ์ Latest Release๋ฅผ ๋ฐ์ผ์๋ฉด ๋ฉ๋๋ค. zip format์ ์์ถ ํ์ผ์ ํ๋ฉด features ํด๋์ plugins์ธ ํด๋๋ก ๋์ฐ์ด์ ธ ์๋๋ฐ ์ค์น๋ eclipse ํด๋ ์์ ์ด๋ฏธ ์กด์ฌ ํฉ๋๋ค. ๊ทธ๋ฌ๋ฏ๋ก ๋ฎ์ด์ฐ๊ธฐ ํํ๋ก ํ๋ฉด ํ๋ฌ๊ทธ์ธ์ด ์ค์น๋๋ฉฐ eclipse๊ฐ ๊ตฌ๋์ค์ด๋ผ๋ฉด ์ฌ ๊ตฌ๋์ ํตํ์ฌ ํ๋ฌ๊ทธ์ธ์ด ์ ๋๋ก ์ค์น๋์๋์ง ์ฌ๋ถ๋ฅผ ๊ฐ๋ ํ ์ ์์ต๋๋ค.
์ผ๋จ MTJ๋ฅผ ์ค์นํ ํ MTJ๊ฐ ์ ๋๋ก ์๋ํ๊ธฐ ์ํ์ฌ ์ค์ ์ด ํ์ํฉ๋๋ค. eclipse๋ฅผ ๊ตฌ๋ํ์๋ฉด ์์ฃผ ์ ๋ง๋ค์ด์ง IDE๊ฐ ๋ณด์ผ ๊ฒ์ ๋๋ค. ๋ฉ๋ด๋ File, Edit, Navigate ๋ฑ๋ฑ์ด ์๋๋ฐ ์ด์ค์์ ์ค์ ์ ํ๊ธฐ ์ํ์ฌ Windows ๋ฉ๋ด๋ฅผ ํด๋ฆญํฉ๋๋ค. ์ฌ๋ฌ๊ฐ์ Submenu์ค์ Preferences๋ฅผ ํด๋ฆญํ์๋ฉด Preferences ํ์ดํ์ ๊ฐ์ง ๋ค์ด์ผ๋ก๊ทธ๊ฐ ํ๋ฉด์ ๋ํ๋ฉ๋๋ค. ์์ชฝ์ ํญ๋ชฉ์์ Java ME๋ฅผ ํด๋ฆญํ์ ํ WTK Root ๊ฒฝ๋ก๋ฅผ ์ก์์ค์ผ ํฉ๋๋ค. WTK๋ Wireless Tookit for CLDC๋ผ๊ณ ํ๊ธฐ ๋์ด์ง ์ ์์ผ๋ฉฐ ์ด๋ฏธ ์์์ ์ค์นํ์์ผ๋ฏ๋ก ๊ฒฝ๋ก๊ฐ ์ด๋์ธ์ง๋ ์์ค๊ฒ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก C:\WTK2.5.2_01 ์ด๊ณณ์ ์ค์น๋ฉ๋๋ค. ๋ค์์ Java ME์ ํญ๋ชฉ์์ Device Management๋ฅผ ์ ํํ ํ Import ๋ฒํผ์ ํด๋ฆญํ์ฌ ๋ง์ฐฌ๊ฐ์ง๋ก C:\WTK2.5.2_01 ๊ฒฝ๋ก๋ฅผ ์ ํํฉ๋๋ค. Device Management๋ ์๋ฎฌ๋ ์ดํฐ ์คํจ์ด๋ผ๊ณ ํ ์ ์์ผ๋ฉฐ ์ดํด๋ฆฝ์ค์ ์ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค๋๋ง๋ค ์ฌ๊ธฐ์ ์ ํํ ๋ํดํธ ๋๋ฐ์ด์ค(MediaControlSkin)๊ฐ ์ ํ๋ฉ๋๋ค. ํ๋ก์ ํธ๋ฅผ ๋ง๋ค๊ณ ๋ ์ดํ์๋ ๊ฒฐ๊ณผ ์คํ์ ์๋ฎฌ๋ ์ดํฐ ์คํจ์ ๋ณ๊ฒฝ์ด ๊ฐ๋ฅํฉ๋๋ค. ๋ค์์ผ๋ก Antenna๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค
The goal of the Mobile Tools for JavaTM (MTJ) project is to extend existing Eclipse frameworks to support mobile device Java application development.
์ ๋ง์ฐฌ๊ฐ์ง๋ก ๋ค์ด๋ก๋๋ฅผ ๋ฐ์ผ๋ฌ ๊ฐ์ผ๋ฉ๋๋ค. ๊ฒฝ๋ก๋ ์ฌ๊ธฐ๋ก ๊ฐ์ ์ Latest Release๋ฅผ ๋ฐ์ผ์๋ฉด ๋ฉ๋๋ค. zip format์ ์์ถ ํ์ผ์ ํ๋ฉด features ํด๋์ plugins์ธ ํด๋๋ก ๋์ฐ์ด์ ธ ์๋๋ฐ ์ค์น๋ eclipse ํด๋ ์์ ์ด๋ฏธ ์กด์ฌ ํฉ๋๋ค. ๊ทธ๋ฌ๋ฏ๋ก ๋ฎ์ด์ฐ๊ธฐ ํํ๋ก ํ๋ฉด ํ๋ฌ๊ทธ์ธ์ด ์ค์น๋๋ฉฐ eclipse๊ฐ ๊ตฌ๋์ค์ด๋ผ๋ฉด ์ฌ ๊ตฌ๋์ ํตํ์ฌ ํ๋ฌ๊ทธ์ธ์ด ์ ๋๋ก ์ค์น๋์๋์ง ์ฌ๋ถ๋ฅผ ๊ฐ๋ ํ ์ ์์ต๋๋ค.
์ผ๋จ MTJ๋ฅผ ์ค์นํ ํ MTJ๊ฐ ์ ๋๋ก ์๋ํ๊ธฐ ์ํ์ฌ ์ค์ ์ด ํ์ํฉ๋๋ค. eclipse๋ฅผ ๊ตฌ๋ํ์๋ฉด ์์ฃผ ์ ๋ง๋ค์ด์ง IDE๊ฐ ๋ณด์ผ ๊ฒ์ ๋๋ค. ๋ฉ๋ด๋ File, Edit, Navigate ๋ฑ๋ฑ์ด ์๋๋ฐ ์ด์ค์์ ์ค์ ์ ํ๊ธฐ ์ํ์ฌ Windows ๋ฉ๋ด๋ฅผ ํด๋ฆญํฉ๋๋ค. ์ฌ๋ฌ๊ฐ์ Submenu์ค์ Preferences๋ฅผ ํด๋ฆญํ์๋ฉด Preferences ํ์ดํ์ ๊ฐ์ง ๋ค์ด์ผ๋ก๊ทธ๊ฐ ํ๋ฉด์ ๋ํ๋ฉ๋๋ค. ์์ชฝ์ ํญ๋ชฉ์์ Java ME๋ฅผ ํด๋ฆญํ์ ํ WTK Root ๊ฒฝ๋ก๋ฅผ ์ก์์ค์ผ ํฉ๋๋ค. WTK๋ Wireless Tookit for CLDC๋ผ๊ณ ํ๊ธฐ ๋์ด์ง ์ ์์ผ๋ฉฐ ์ด๋ฏธ ์์์ ์ค์นํ์์ผ๋ฏ๋ก ๊ฒฝ๋ก๊ฐ ์ด๋์ธ์ง๋ ์์ค๊ฒ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก C:\WTK2.5.2_01 ์ด๊ณณ์ ์ค์น๋ฉ๋๋ค. ๋ค์์ Java ME์ ํญ๋ชฉ์์ Device Management๋ฅผ ์ ํํ ํ Import ๋ฒํผ์ ํด๋ฆญํ์ฌ ๋ง์ฐฌ๊ฐ์ง๋ก C:\WTK2.5.2_01 ๊ฒฝ๋ก๋ฅผ ์ ํํฉ๋๋ค. Device Management๋ ์๋ฎฌ๋ ์ดํฐ ์คํจ์ด๋ผ๊ณ ํ ์ ์์ผ๋ฉฐ ์ดํด๋ฆฝ์ค์ ์ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค๋๋ง๋ค ์ฌ๊ธฐ์ ์ ํํ ๋ํดํธ ๋๋ฐ์ด์ค(MediaControlSkin)๊ฐ ์ ํ๋ฉ๋๋ค. ํ๋ก์ ํธ๋ฅผ ๋ง๋ค๊ณ ๋ ์ดํ์๋ ๊ฒฐ๊ณผ ์คํ์ ์๋ฎฌ๋ ์ดํฐ ์คํจ์ ๋ณ๊ฒฝ์ด ๊ฐ๋ฅํฉ๋๋ค. ๋ค์์ผ๋ก Antenna๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค
์ดํด๋ฆฝ์ค ์ค์น๋ ์ด๋ ๊ฒ ...
์ดํด๋ฆฝ์ค ๊ตฌ๋์ ์ต์ ์ถฉ๋ถ ์กฐ๊ฑด์ผ๋ก ์๋ฐ ๋ฐํ์ ๋ชจ๋ ์ต์ ๋ฒ์ ์ด ํ์ ํฉ๋๋ค. JRE ์ต์ ๋ฒ์ ์ Sun ์์ JRE 6 ๋ฐ์ด๋๋ฆฌ ์ค์น ๋ชจ๋์ ๋ค์ด๋ฐ์์ ์ค์นํ์๋ฉด ๋ฉ๋๋ค. ์๋ฐ ๋ฐํ์ ๋ชจ๋ ์ค์น๊ฐ ์๋ฃ๋๋ฉด ์ ์ดํ์์ ํ์ธ์ด ๊ฐ๋ฅํ๋ฉฐ ์ดํด๋ฆฝ์ค ๋ด๋ถ์ ๋ฐ๋ก JRE ํด๋์ ํ์ผ์ด ์กด์ฌ ํ์ง๋ง ์ด๋ ์ ์์ ์ผ๋ก ์ค์ ๋์ง ์์ผ๋ฏ๋ก ์ง์ JRE๋ฅผ ์ค์นํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
์๋ฐ ๋ฐํ์ ๋ชจ๋ ์ค์น์ธ์ ์๋ฐ ๊ฐ๋ฐ ํด (์ผ๋ช JDK) ์ค์น๋ ์ํฉ์ ๋ฐ๋ผ ํ์ํ๋ฐ ์๋ฅผ ๋ค์๋ฉด ๊ตฌ๊ธ์์ ์ต๊ทผ์ ๊ฐ๋ฐ ์ค์ธ ์๋๋ก์ด๋ ํ๋ซํผ์ ๊ตฌ๋ํ๊ณ ์ถ๋ค๋ฉด JDK ๋ํ Sun ์์ ๋ค์ด ๋ฐ์์ ์ค์น ํฉ๋๋ค. ์ค์น๋ ์ธ์คํจ๋ฌ๊ฐ ์ ์ํ๋ ๋ฐ๋ก ์งํํ๋ฉด ๋ฉ๋๋ค.
๋ค์์ ์ดํด๋ฆฝ์ค์ ์๋ฐ ๋ง์ดํฌ๋ก ์๋์ ์ ์ด์ฉํ์ฌ ๋ชจ๋ฐ์ผ ์์ฉํ๋ก๊ทธ๋จ์ ๊ฐ๋ฐํ ์ ์๋๋ก Sun ์์ ์ ๊ณตํ๋ Wireless Toolkit์ ์ค์นํด์ผ ํฉ๋๋ค. ํ์ฌ 3.0 ๋ฒ์ ๊ณผ 2.5.2 ๋ฒ์ ๋๊ฐ์ง์ค ํ์๋ ๊ฐ์ง๊ณ ์๋ ๋ ธํธ๋ถ์ด ์ ์ฌ์์ด๊ธฐ ๋๋ฌธ์ 2.5.2 ๋ฒ์ ์ ์ฌ์ฉํฉ๋๋ค. ๋ค์ด๋ก๋๊ฐ ๊ฐ๋ฅํ URL์ ์ฌ๊ธฐ๋ก ๊ฐ์ ๋ค์ด ๋ฐ์ผ์๋ฉด ๋ฉ๋๋ค.
์ด๋ ๊ฒ ํ์ฌ ์ดํด๋ฆฝ์ค๋ฅผ ๊ตฌ๋ํ๊ธฐ ์ํ ํ์ ์ถฉ๋ถ ์กฐ๊ฑด์ด ๊ฐ์ถ์ด์ก์ผ๋ฏ๋ก ์ด์ ์ดํด๋ฆฝ์ค๋ฅผ ๋ค์ด๋ฐ์ผ๋ฌ ๊ฐ์ผ ๊ฒ ์ง์ ๋ค์ด๋ก๋๊ฐ ๊ฐ๋ฅํ ์ฃผ์๋ ์ฌ๊ธฐ๋ก ๊ฐ์ ์ ์ํ๋ ํ์ผ์ ๋ค์ด๋ฐ์ผ์๋ฉด ๋ฉ๋๋ค. ๋ค์ด๋ก๋๋ ๊ตญ๋ด์ ๊ฒฝ์ฐ ๋ค์์ ํตํ์ฌ ๋ฐ์ผ๋ฏ๋ก ์๋นํ ๋น ๋ฆ ๋๋ค. ์ค์น๋ ๊ทธ๋ฅ ์์ถ์ C:\์ ํ๋ฉด c:\eclipse ๊ฒฝ๋ก์ ํ๋ฆฌ๊ฒ ๋ฉ๋๋ค. ์ด์ ์๋์ฐ ํ์๊ธฐ๋ฅผ ์ด์ฉํ์ฌ C:\eclipse\eclipse.exe ํ์ผ์ ์คํํ์๋ฉด ์ฐ๋ฆฌ์ ์ดํด๋ฆฝ์ค๋ ๋ฉ์ง๊ฒ ์คํ์ด ๋ฉ๋๋ค. ์คํ์์๋ ์์ ๊ฒฝ๋ก๋ฅผ ์ค์ ํ์ฌ์ผ ํฉ๋๋ค.
Subscribe to:
Posts (Atom)