크리에이티브 커먼즈 라이선스
Creative Commons License

그동안 올렸던 포스트가 제목 때문에 구글 검색이 잘 안되길래...다시 올림. -_-;;

readme.txt
ape_ruby is ruby port of APE. APE(Actionscript Physics Engine) is a free 
AS3 open source 2D physics engine, released under the MIT License. 

ape_ruby supports all features of original Actionsciprt version, and 
slightly modified for support serveral rendering methods. It is released 
under MIT License. 

Because of my lack of English writing skill, there is no documents for 
ape_ruby. But, you can use the documents for original version.

Have a fun.

-- DMW(filepang@lycos.co.kr, http://www.filepang.co.kr) --

Copyright notice
Copyright (c) 2010 DMW 

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

download link
저작자 표시 비영리 동일 조건 변경 허락
Posted by DMW

댓글을 달아 주세요

크리에이티브 커먼즈 라이선스
Creative Commons License
일단 ruby랑 gem까지 다 설치를 하자. 원래는 그러구나서

sudo gem install rubysdl

명령으로 한방에 설치가 되야 되는데...뭐라고 에러를 막 토해내면서 안된다.
아래처럼 설치하자

sudo apt-get install libruby1.9
sudo apt-get install libsdl-ruby

이러면 된다 -_-;;

원래 ruby/sdl gem이 문제가 좀 많은거 같다. 윈도우에서도 설치가 잘 안된고..암튼 웃기다


고침

gem으로 설치가 왜 안되는지 알았다능. sdl 라이브러리가 설치가 되 있어야 된다능.

sudo apt-get install libsdl1.2-dev libsdl1.2debian

일캐하구

sudo gem install rubysdl

일캐하면 될꺼심. gem으로 깔면 최신버젼이 깔린다능. 위에 써놓은 대로 하면 1.3.1이 깔림.
구식임. 꼬랐다능.

또고침
sudo aptitude install gnome-devel

sudo apt-get install libsdl1.2-dev libsdl1.2debian
sudo apt-get install libsdl-image1.2-dev
sudo apt-get install libsdl-mixer1.2-dev
sudo apt-get install libsdl-ttf2.0-dev
sudo apt-get install libsmpeg-dev

wget http://shinh.skr.jp/sdlkanji/SDL_kanji-0.0.3.tar.gz
    configure
    make
    sudo make install
 
위에 처럼 모든 의존성이 있는 라이브러리를 다 설치하고 gem으로 설치하면 된다. 이게 가장 쉽고 확실한 방법임.
저작자 표시 비영리 동일 조건 변경 허락

'리눅스' 카테고리의 다른 글

Ubuntu 8.10에 Ruby/SDL 설치하기  (4) 2010/08/21
플러그인 만들어보기  (4) 2010/07/24
How to install Boost Library in Ubuntu 9.04  (2) 2009/10/22
The Linux Kernel - 2.0.33  (0) 2009/08/13
내 vimrc  (0) 2009/05/19
ubuntu 설치  (7) 2008/08/17
Posted by DMW
TAG ruby, SDL, ubuntu

댓글을 달아 주세요

  1. BlogIcon progr_ 2009/02/27 01:11  댓글주소  수정/삭제  댓글쓰기

    우왕- sdl이면 저번에 나무그릴떄쓰던 그거죠? 'ㅅ'

  2. BlogIcon ∫2tdt=t²+c 2009/02/27 23:49  댓글주소  수정/삭제  댓글쓰기

    루비 실망이쿤효 그럴줄 몰랐는데ㅋㅋㅋ

크리에이티브 커먼즈 라이선스
Creative Commons License
회사에서 쓰는 키보드가 맘에 안들어서 보름전에 하나 질렀다능. 해패해킹 라이트를 질렀음 ^^. 조용한 탠키레스 키보드를 찾다보니까 해피해킹이 눈에 들어오더라능. 아무튼 전에 쓰던건 이건데......마소꺼 답지않게 존니스트, 킹왕짱 꼬랐음.
 

새로 산거는 요러캐 생겼다능. 딱 코딩할 때 쓰는 키만 있고 다른 키들은 업ㅂ다능. 그러면서 키 하나하나의 크기는 일반 키보드랑 똑같음.


영문 화이트를 사고 싶었는데...매물이 없어서 못샀음 -_-. 해피해킹 프로가 키감이 무척 좋다고 하는데...너무 비싸서 살 수가 없었다능. 저것도 7만원이니까 싼편은 아닌데 멤브레인 방식임. 그래도 멤브레인 치고는 무척 키감이 좋음.

멤브레인 중에는 최상급인거 같다능.

\랑 `, backspace 위치가 맘에 안들어서 사진에 보이는 배열에서 딱 반시계 방향으로 한칸 돌려서 쓰고 있다능. 키 위치를 바꾸는건 레지스트리를 고치면 되는데...대신 해주는 프로그램이 있더라능. KeyTweak 이라는 프로그램을 쓰면 됨. 쉽다능.

세줄요약
해피해킹 라이트 질렀다.
멤브레인 치고는 키감이 무척 조타.
코딩할 때는 편한데..딴거 할 때는 불편하다.
저작자 표시 비영리 동일 조건 변경 허락
Posted by DMW

댓글을 달아 주세요

크리에이티브 커먼즈 라이선스
Creative Commons License
리눅스에서는 Shared Object 라고 부르는 DLL을 로드해서 사용하는걸 플러그인이라구 불르는거 같더라능. 윈도우라면 DLL을 불러오면 될태고.....아무튼 플러그인과 메인 프로그램 사이의 인터페이스를 잘 정의하는게 관건있거 같더라능.

뭐...어짜피 난 잘모르구 -_-;;;; 리눅스에서 Shared Object를 불러다 쓰는건  dl 라이브러리를 사용하면 된다능. dlopen() 으로 .so를 연 다음, dlsym() 으로 써서 잘 사용하구 나서 dlclose() 를 해주면 된다능. 자세한 사용법은 man page를 보는게 훨 좋을태니 아래 링크를 눌르라능

헬로우 월드 문자열을 플러그인을 불러다 적당히 변형해서 출력하는 프로그램을 싸봤다능. 소스코드 전체를 올려놓을태니 궁금하면 이걸 받아서 보라능. make 한담에 아래 처럼 켜보면 된다능. downcase.so를 아규먼트로 넣어주면 소문자로 출력해준다능. 끵.

dmw@dmw-desktop:~/works/linux_plugin_example$ ./hello_plugin upcase.so
ORIGINAL MESSAGE : HelLO wOrLD

LOAD PLUG-IN ... success!
        converting message using plug-in

CONVERTED MESSAGE : HELLO WORLD


메인 프로그램은 아래처럼 생겼고....

#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

typedef int(*p2func)(char*);

int open_plugin(void** plugin_handle, char* plugin_name);
int close_plugin(void* plugin_handle);
p2func import_function(void* plugin_handle, const char** error);

int main(int argc, char** argv) {
	int res;
	void* plugin_handle;
	const char* error;
	char hello_message[] = "HelLO wOrLD\n";
	p2func converter;
	
	if(argc == 1) {
		printf("hello_plugin upcase.so or downcase.so\n");
		return 1;
	}

	printf("ORIGINAL MESSAGE : %s\n", hello_message);
	
	printf("LOAD PLUG-IN ... ");
	res = open_plugin(&plugin_handle, argv[1]);
	if(res) {
		fprintf(stderr, "\nplug-in load error : %s\n", dlerror());
		return 1;
	}

	converter = import_function(plugin_handle, &error);
	if(error) {
		fprintf(stderr, "\nplug-in load error : %s\n", error);
		close_plugin(plugin_handle);
		return 1;
	} else {
		printf("success!\n");
	}

	printf("\tconverting message using plug-in\n");
	converter(hello_message);
		
	printf("\nCONVERTED MESSAGE : %s\n", hello_message);

	close_plugin(plugin_handle);
	return 0;
}

int open_plugin(void** plugin_handle, char* plugin_name) {
	*plugin_handle = dlopen(plugin_name, RTLD_NOW);

	if(*plugin_handle == NULL) {
		return 1;
	}

	return 0;
}

p2func import_function(void* plugin_handle, const char** error) {
	p2func func;

	// dlsym() is return NULL if there is no symbol in DL library.
	// If symbol has a NULL as it's value. We can not determine calling dlsym()
	// is success or not. So, We are using dlerror()
	*error = dlerror();						// clear error code

	func = dlsym(plugin_handle, "conv");
	*error = dlerror();
	if(*error) {
		return NULL;
	}

	return func;
}

int close_plugin(void* plugin_handle) {
	return dlclose(plugin_handle);
}

 플러그인이랍시고 만들어본건 저러캐 생겼다능.

1
2
3
4
5
6
7
8
9
10
11
int conv(char* str) {
	char *ptr;

	ptr = str;
	while(*ptr != '\0') {
		*ptr = toupper(*ptr);
		ptr++;	
	}

	return 0;
}


전체 소스코드

빌드 방법은 그리 어렵지 않으니 Makefile을 보시라능.

끵?!
저작자 표시 비영리 동일 조건 변경 허락

'리눅스' 카테고리의 다른 글

Ubuntu 8.10에 Ruby/SDL 설치하기  (4) 2010/08/21
플러그인 만들어보기  (4) 2010/07/24
How to install Boost Library in Ubuntu 9.04  (2) 2009/10/22
The Linux Kernel - 2.0.33  (0) 2009/08/13
내 vimrc  (0) 2009/05/19
ubuntu 설치  (7) 2008/08/17
Posted by DMW

댓글을 달아 주세요

  1. BlogIcon LazyGyu 2010/08/02 10:04  댓글주소  수정/삭제  댓글쓰기

    으, 음난한 리눅스 프로그래밍이근염

  2. BlogIcon DMW 2010/08/02 21:07  댓글주소  수정/삭제  댓글쓰기

    으...음란하다니...불건전하다!

  3. BlogIcon 정기 2010/08/06 15:43  댓글주소  수정/삭제  댓글쓰기

    dlopen -> dlsym -> dlclose
    LoadLibrary -> GetProcAddress -> FreeLibrary
    이렇게 대응되는 거냐능