본문 바로가기

Programming/C#/Xna/Kinect/WPF

[C#] Cross Thread 처리방법 에러내용 : "Cross-thread operation not valid: Control 'rtb_console' accessed from a thread other than the thread it was created on." 최근에 소켓프로그램을 개발하던 중에도 Cross Thread 문제를 겪었다. 서버에서 Thread을 생성하여 데이터 수신을 기다리고, 수신된 데이터의 내용을 RichTextBox에출력하려는 작업중에 Cross-thread operation not valid: Control 'rtb_console' accessed from a thread other than the thread it was created on. 이러한 메세지를 내뿜고 뻗어버렸다. 이런 문제를 포스팅하기 위해 샘플.. 더보기
[XNA] Framework의 기본 Logic흐름도 XNA로 게임을 만들때 기본적으로 상속을 받는 Game클래스다. 이 안에 기본적인 함수들이 모두 정의되어 있다.이 함수들의 동작 체계를 좀 더 세부적으로 쪼개서 보도록 하자. 1. Main 시작점에서 using문안에 있는 게임의 생성자를 호출.2. 게임의 생성자가 각 게임에 필요한 컴포넌트들을 생성.3. 각각의 생성된 컴포넌트들의 생성자 호출.4. 게임의 Initialize() 메소드 호출.5. 각 Drawable게임컴포넌트들의 LoadGraphicContet(), LoadContent() 메소드 호출.6. 게임의 LoadGraphicContet(), LoadContent() 호출.7. 게임의 Update() 메소드 호출.8. 각 게임 컴포넌트들의 Update() 메소드 호출9. 게임의 Draw() 메소.. 더보기
[C#] Dictionary (Map) 예제 using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace DictionaryExample{ class Program { static void Main(string[] args) { Dictionary d = new Dictionary(); d.Add("cat", 2); d.Add("dog", 1); d.Add("llama", 0); d.Add("iguana", -1); Console.WriteLine(d.Count); Console.WriteLine(d["cat"]); foreach (KeyValuePair kvp in d) { Console.WriteLine("Key: " + kvp.Key); .. 더보기
[Luainterface] C#에서 루아 사용하기 사용법을 정리해보려고 했지만 너무 쉬워서 의미가 없어 보임. (그리고 인터넷에 다 있음.) 간단히 레퍼런스 링크들만 정리해본다.http://www.serious-code.net/moin.cgi/LuaCSharpBinding 간단한 사용법. 연동하기 정말 쉽다.http://luaforge.net/projects/luainterface/ 프로젝트 메인페이지. 도큐먼트와 dll을 다운받을 수 있다. 2011년 7월 15일 현재 최신 버전은 2.0.3http://www.gamedev.net/page/resources/_/reference/programming/sweet-snippets/using-lua-with-c-r2275 예전에 트위터에 공유했던 페이지인데, 역시나 간단한 소개와 샘플코드가 있다.http:/.. 더보기