Friday, March 9, 2012
Friday, March 2, 2012
Books
UDK:
Unreal Development Kit Game Programming with UnrealScript: Beginner's GuideISBN-13: 978-1849691925
http://www.amazon.com/dp/1849691924/?tag=packtpubli-20
Kinect:
Beginning Kinect Programming with the Microsoft Kinect SDK (Paperback)ISBN: 1430241047
Chinese
半路叛逃-App 遊戲製作人的 1000 日告白 - Taiwan Indie Game Developer's BookISBN: 9861993649 出版日期: 2012-09-29
Wednesday, February 29, 2012
XNA-The snapshot is out of date and can not be used anymore because the binder has been updated
Solution-
Here is my problem.When i was using Team Foundation Server(Source Controller) with my window phone's project(XNA),It's don't happen.
After i install a plugin "Productivity Power Tools" the problem is appear.I google it and found there is a solution and it's solve my problem:
Turn Off the "Automatic Brace Completion" at Tools->Options->Productivity Power Tools
Maybe turn off some plugin you could found the problem.
Here is my problem.When i was using Team Foundation Server(Source Controller) with my window phone's project(XNA),It's don't happen.
After i install a plugin "Productivity Power Tools" the problem is appear.I google it and found there is a solution and it's solve my problem:
Turn Off the "Automatic Brace Completion" at Tools->Options->Productivity Power Tools
Maybe turn off some plugin you could found the problem.
Tuesday, February 28, 2012
C#-Note: Internal
| 成員所屬型別 | 成員預設存取範圍 | 成員允許的宣告存取範圍 |
|---|---|---|
| enum | public | 無 |
| class | private | public protected internal private protected internal |
| interface | public | 無 |
| struct | private | public internal private |
MSDN範例:
internal class BaseClass
{
public static int intM = 0;
}
class TestAccess
{
static void Main()
{
BaseClass myBase = new BaseClass(); // CS0122
}
}
如果在第二個檔案中嘗試產生BaseClass,將會產生錯誤。
將BaseClass 存取級別變為Public
將成員intM 存取級別變為Internal
public class BaseClass
{
internal static int intM = 0;
}
public class TestAccess
{
static void Main()
{
BaseClass myBase = new BaseClass(); // Ok.
BaseClass.intM = 444; // CS0117 Error
}
}
如此一來您可以將類別具現化,但無法存取內部成員。
Sunday, February 12, 2012
Team Foundation Server - Installation Note
1. Installation OS
Window 7
Window Server 2008 (recommend)
2.IIS service
控制台->程式和功能->開啟或關閉Windows功能
Check Internet Information Services
Internet Information Services Web核心
3.Installation Window SQL Server 2008 R2
Add administrator and password
4.Installation Team Foundation Server 2010
5.Installation Visual studio 2010
Done
-----------------------------------------------------------------------------
Team Foundation Server Basic
Check-in:Upload your code to Server
Shelve And UnShelve:程式碼完成一半,暫時擱置,同時其他人也可以取得Shelve的程式碼並修改。
Branch(分支):將已完成的版本,建立新的分支,同時開發舊的版本與新的版本。
PS.After Branch you need Check-in again
Merge(合併):將舊版與新版合併
衝突發生:
也可先使用Shelve
Lable:標記程式碼版本
-----------------------------------------------------------------------------
Team Foundation Server Basic
Check-in:Upload your code to Server
Shelve And UnShelve:程式碼完成一半,暫時擱置,同時其他人也可以取得Shelve的程式碼並修改。
Branch(分支):將已完成的版本,建立新的分支,同時開發舊的版本與新的版本。
PS.After Branch you need Check-in again
衝突發生:
也可先使用Shelve
Lable:標記程式碼版本
-----------------------------------------------------------------------------
Visual Studio 2010 hotkey Note
alt + shift :多行同時輸入
alt + mouse Left Drag:一次編輯多行
-----------------------------------------------------------------------------
Reference:
Wednesday, January 4, 2012
Note - helper for inspire Game Designer
Play Like Designer part1 :http://penny-arcade.com/patv/episode/playing-like-a-designer-pt.-1
Play Like Designer part2:http://penny-arcade.com/patv/episode/playing-like-a-designer-pt.-2
Don't Know what is mechanics :http://penny-arcade.com/patv/episode/narrative-mechanics
All reference and link from: Penny Arcade - Extra Credits
Play Like Designer part2:http://penny-arcade.com/patv/episode/playing-like-a-designer-pt.-2
Don't Know what is mechanics :http://penny-arcade.com/patv/episode/narrative-mechanics
All reference and link from: Penny Arcade - Extra Credits
Wednesday, November 30, 2011
DirectX-Draw Triangle Note
There three main function need to be use.
Its do :
1.Loaded And Compiled with two shader
2.Create Object for each one
3.Set the two object
2.
Global
It do:
1.Create three vertex with both position
2.Create vertex buffer object
3.Copied the vertexs into vertex buffer by mapping it
At EnterFrame
void InitPipeline()
{
// load and compile the two shaders
ID3D10Blob *VS,*PS;
D3DX11CompileFromFile("shaders.hlsl",0,0,"VShader","vs_4_0",0,0,0,&VS,0,0);
D3DX11CompileFromFile("shaders.hlsl",0,0,"PShader","ps_4_0",0,0,0,&PS,0,0);
// encapsulate both shaders into shader objects
dev->CreateVertexShader(VS->GetBufferPointer(),VS->GetBufferSize(),NULL,&pVS);
dev->CreatePixelShader(PS->GetBufferPointer(),PS->GetBufferSize(),NULL,&pPS);
// set the shader objects
devcon->VSSetShader(pVS,0,0);
devcon->PSSetShader(pPS,0,0);
//Create Input layout object,Created input element descriptions for the position and the color.
D3D11_INPUT_ELEMENT_DESC ied[] =
{
{"POSITION",0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,D3D11_INPUT_PER_VERTEX_DATA,0},
{"COLOR",0,DXGI_FORMAT_R32G32B32A32_FLOAT,0,12,D3D11_INPUT_PER_VERTEX_DATA,0},
};
//Created an input layout object using the shader information.
dev->CreateInputLayout(ied,2,VS->GetBufferPointer(),VS->GetBufferSize(),&pLayout);
//Set the input layout object.
devcon->IASetInputLayout(pLayout);
}
Its do :
1.Loaded And Compiled with two shader
2.Create Object for each one
3.Set the two object
2.
Global
struct VERTEX{FLOAT X,Y,Z;D3DXCOLOR Color;};
ID3D11Buffer *pVBuffer;
void InitGraphics()
{
// create a triangle using the VERTEX struct
VERTEX OurVertices[] =
{
{0.0f,0.5f,0.0f,D3DXCOLOR(1.0f,0.0f,0.0f,1.0f)},
{0.45f,-0.5f,0.0f,D3DXCOLOR(0.0f,1.0f,0.0f,1.0f)},
{-0.45f,-0.5f,0.0f,D3DXCOLOR(0.0f,0.0f,1.0f,1.0f)}
};
//Created a vertex buffer object.
D3D11_BUFFER_DESC bd;
ZeroMemory(&bd,sizeof(bd));
bd.Usage = D3D11_USAGE_DYNAMIC;// access by CPU and GPU
bd.ByteWidth = sizeof(VERTEX) *3;//size is the vertex struct * 3
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;//use as vertex buffer
bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;// allow CPU to write in buffer
dev->CreateBuffer(&bd,NULL,&pVBuffer);
//vertices into a buffer ,copy the vertices into the buffer
D3D11_MAPPED_SUBRESOURCE ms;
devcon->Map(pVBuffer,NULL,D3D11_MAP_WRITE_DISCARD,NULL,&ms);
memcpy(ms.pData,OurVertices,sizeof(OurVertices));
devcon->Unmap(pVBuffer,NULL);
}
It do:
1.Create three vertex with both position
2.Create vertex buffer object
3.Copied the vertexs into vertex buffer by mapping it
At EnterFrame
void RenderFrame(void)
{
............
//select which vertex buffer to display,Set which vertex buffer to use
UINT stride = sizeof(VERTEX);
UINT offset = 0;
devcon->IASetVertexBuffers(0,1,&pVBuffer,&stride,&offset);
//select which primtive type we are using
devcon->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
//draw the vertex buffer to the back buffer,Draw the triangle.
devcon->Draw(3,0);
//swtich the back buffer and front buffer
swapchain->Present(0,0);
}
void UnLoad3D()
{
swapchain->SetFullscreenState(FALSE,NULL);
pLayout->Release();
pVS->Release();
pPS->Release();
pVBuffer->Release();
swapchain -> Release();
backbuffer->Release();
dev ->Release();
devcon->Release();
}
Monday, November 28, 2011
DirextX -Begin D3D
The DirectX Begin
IDXGISwapChain: The swap chain is the series of buffers which take turns being rendered on.
ID3D11Device:This variable is a pointer to a device.
ID3D11DeviceContext:A device context is similar to a device, but it is responsible for managing the GPU and the rendering pipeline (the device mostly handles video memory).
Initialize D3D
UnLoad3D
Program Main
Window Program
1scd.Flags:Three property
1.DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
2.DXGI_SWAP_CHAIN_FLAG_NONPREROTATED
3.DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
2.scd.SampleDesc.Count: Max Number is 4 Min Number is 1 ,Setting Multisample anti-aliased
----------------------- Using Back Buffer with Deep Blue
1.Setting RenderTarget
2.Setting ViewPort
3.RenderFrame
In header i add
InitD3D(HWND hWnd)
Add Render Target &ViewPort
In game Logical Add
RenderFrame And done
#include windows.h
#include windowsx.h
#include d3d11.h
#include d3d10.h
#include d3d11.h
#include d3dx10.h
#include d3dx11.h
#include windows.h
#pragma comment(lib,"d3d11.lib")
#pragma comment(lib,"d3dx11.lib")
#pragma comment(lib,"d3dx10.lib")
IDXGISwapChain *swapchain;
ID3D11Device *dev;
ID3D11DeviceContext *devcon;
void InitD3D(HWND hWnd);
void CleanD3D(void);
LRESULT CALLBACK WindowProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lPram);
IDXGISwapChain: The swap chain is the series of buffers which take turns being rendered on.
ID3D11Device:This variable is a pointer to a device.
ID3D11DeviceContext:A device context is similar to a device, but it is responsible for managing the GPU and the rendering pipeline (the device mostly handles video memory).
Initialize D3D
void InitD3D(HWND hWnd)
{
DXGI_SWAP_CHAIN_DESC scd;
ZeroMemory(&scd,sizeof(DXGI_SWAP_CHAIN_DESC));
//Swap chain struct
scd.BufferCount = 1;//BackBuffer
scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;//32bit-buffer
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; //how swap chain is to be used
scd.OutputWindow = hWnd;//window to be use
scd.SampleDesc.Count = 2;//How many multisample anti-aliased
scd.Windowed = TRUE;//Screen Full or not
//scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;//use alt + enter DXGI_SWAP_CHAIN_FLAG_NONPREROTATED moniter rotation
D3D11CreateDeviceAndSwapChain(NULL,D3D_DRIVER_TYPE_HARDWARE,NULL,NULL,NULL,NULL,D3D11_SDK_VERSION,&scd,&swapchain,&dev,NULL,&devcon);
}
UnLoad3D
void Clean3D()
{
swapchain -> Release();
dev ->Release();
devcon->Release();
}
Program Main
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
HWND hWnd;
WNDCLASSEX wc;
ZeroMemory(&wc,sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.lpszClassName = "WindowClass";
RegisterClassEx(&wc);
RECT wr = {0,0,1280,720};
AdjustWindowRect(&wr,WS_OVERLAPPEDWINDOW,FALSE);
hWnd = CreateWindowEx(NULL,"WindowClass","RealDirectX",WS_OVERLAPPEDWINDOW,300,300,wr.right - wr.left,wr.bottom - wr.top,NULL,NULL,hInstance,NULL);
ShowWindow(hWnd,nCmdShow);
InitD3D(hWnd);
MSG msg;
while(TRUE)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if(msg.message == WM_QUIT)
break;
}
else
{
}
}
Clean3D();
return msg.wParam;
}
Window Program
LRESULT CALLBACK WindowProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}break;
}
return DefWindowProc(hWnd,message,wParam,lParam);
}
1scd.Flags:Three property
1.DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
2.DXGI_SWAP_CHAIN_FLAG_NONPREROTATED
3.DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
2.scd.SampleDesc.Count: Max Number is 4 Min Number is 1 ,Setting Multisample anti-aliased
----------------------- Using Back Buffer with Deep Blue
1.Setting RenderTarget
2.Setting ViewPort
3.RenderFrame
In header i add
ID3D11RenderTargetView *backbuffer;
void RenderFrame(void);
InitD3D(HWND hWnd)
Add Render Target &ViewPort
void InitD3D(HWND hWnd)
{
//........
//Setting Render Target
ID3D11Texture2D *pBackBuffer;
swapchain->GetBuffer(0,__uuidof(ID3D11Texture2D),(LPVOID*)&pBackBuffer);
dev->CreateRenderTargetView(pBackBuffer,NULL,&backbuffer);
pBackBuffer->Release();
devcon->OMSetRenderTargets(1,&backbuffer,NULL);
//Setting ViewPort
D3D11_VIEWPORT viewport;
ZeroMemory(&viewport,sizeof(D3D11_VIEWPORT));
viewport.MaxDepth = 1.0f;
viewport.MinDepth = 0.0f;
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
viewport.Width = 1280;
viewport.Height = 720;
devcon->RSSetViewports(1,&viewport);
}
void RenderFrame(void)
{
//Clear the back buffer in deep blue
devcon->ClearRenderTargetView(backbuffer,D3DXCOLOR(0.0f,0.2f,0.4f,1.0f));
//swtich the back buffer and front buffer
swapchain->Present(0,0);
}
In game Logical Add
RenderFrame And done
Saturday, November 26, 2011
Friday, November 4, 2011
C# Interface & abstract Difference
以Tower Defend遊戲中的房屋:
Interface:
定義不同種類的物件中,針對某種特性,所需要具備的相同功能。
介面是對行為的抽象:任何類別若繼承介面並且實做後,皆具有此功能。
1.All the Mothod , property , event must be public。
2. 繼承Interface 物件,New 出一個interface 物件,Interface 內的method property 一定要被實做出來。
3.多重繼承
Abstract:
介面是對行為的抽象:任何類別若繼承介面並且實做後,皆具有此功能。
1. abstract class can be private or protected
2.you can new a abstract class but not doing anything
----------------------------------------------Edit Continue
Interface:
定義不同種類的物件中,針對某種特性,所需要具備的相同功能。
介面是對行為的抽象:任何類別若繼承介面並且實做後,皆具有此功能。
1.All the Mothod , property , event must be public。
2. 繼承Interface 物件,New 出一個interface 物件,Interface 內的method property 一定要被實做出來。
3.多重繼承
Abstract:
介面是對行為的抽象:任何類別若繼承介面並且實做後,皆具有此功能。
1. abstract class can be private or protected
2.you can new a abstract class but not doing anything
----------------------------------------------Edit Continue
Subscribe to:
Posts (Atom)



