티스토리 뷰

언어별/WIPI

Jlet 클래스 모음

지에고 2009. 7. 8. 20:48

import org.kwis.msp.lcdui.*;
public class IGRP
{
 int m_nImageCount;
 Image m_Image[];
 public void IGRP()
 {
  m_nImageCount = 0;
  m_Image = null;
 }
 boolean load(String dicName, int imagenumber)
 {  
  m_nImageCount = imagenumber;
  m_Image = new Image[m_nImageCount];
  try
  {
   for(int i=0; i<m_nImageCount; i++)
   {
    m_Image[i] = Image.createImage("/img/" + dicName + "/" + i + ".png");
   }
  }catch(Exception e)
  {
   return false;
  }
  return true;
 }
 int nGetImgHeight(int no)
 {
  return m_Image[no].getHeight();
 }
}

 void close()//클로즈 널처리 하는 부분
 {
  for(int i = 0; i < m_nImageCount; i++)
   m_Image[i] = null;

  m_Image = null;
  m_nImageCount = 0;
  System.gc();
 }

이미지 로드해두는 클래스 - _- 다음에 또 작성하기 귀찮아서용 ㅎ
아 적절하게 로드한 후 필요없다면 해제 시켜줘야한다 -_ -당연한거지만 난 ...피시게임만 만들다보니
메모리관리를 생각도안하고있었거든- _- ...다로드시킨다음에 하나씩 불러내는형식이였으니 ㅎㄷㄷ ...


public class VScreen
{
 GameCanvas m_canvas;
 
 int m_nScrWidth;
 int m_nScrHeight;
 
 public VScreen()
 {
 }
  void VS_PutIGRP(int x, int y, IGRP img, int no)
 {
 // System.out.println("이미지 번호 no : "+no);
  if(no < 0)
  {
   return;
  }
  if(img == null)
  {
   System.out.println("이미지가 없습니다. " + no +"   ::  " +img);
   return;
  }
  GameCanvas.m_grp.setClip(0,0,m_nScrWidth , m_nScrHeight ) ;
  GameCanvas.m_grp.drawImage(img.m_Image[no], x, y, 0);//의심부분
  //int t = img.m_Image.length;
  //////System.outprintln("이미지 길이 : t. " + t);
  //////System.outprintln("이미지 출력. " + no);
 }
}

이미지 출력 클래스

기본적인거라서-_-좀 적어두고 붙여넣기해야겠닥 ㅎㅎ

댓글