📄 pf.cs.svn-base
字号:
using System;
using System.Runtime.InteropServices;
namespace Aspecto.PocketFrog
{
/// <summary>
/// Summary description for PF.
/// </summary>
public class PF
{
//**********************************
// P/Invoke Test
//*********************************
//POCKETFROGCWRAPPER_API int __stdcall increment(int num){return num++;}
[DllImport("PocketFrogCWrapper.dll")]
public static extern int increment(int num);
//POCKETFROGCWRAPPER_API int __stdcall decrement(int num){return num--;}
[DllImport("PocketFrogCWrapper.dll")]
public static extern int decrement(int num);
//POCKETFROGCWRAPPER_API int __stdcall seven(){return 7;}
[DllImport("PocketFrogCWrapper.dll")]
public static extern int seven();
//POCKETFROGCWRAPPER_API int __stdcall blonde(int num){return num;}
[DllImport("PocketFrogCWrapper.dll")]
public static extern int blonde(int num);
//**********************************
// Display object
//*********************************
//POCKETFROGCWRAPPER_API Display* __stdcall display_createdefault(HWND hWnd);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr display_createdefault(IntPtr hWnd);
//POCKETFROGCWRAPPER_API Display* __stdcall display_createwidthheight(HWND hWnd,unsigned width, unsigned height);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr display_createwidthheight(IntPtr hWnd, int width, int height);
//TODO: another create with an orientation param.
//POCKETFROGCWRAPPER_API Display* __stdcall display_create(HWND hWnd,PHAL::DisplayParameters* params);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr display_create(IntPtr hWnd,ref DisplayParameters dparams);//TODO: figure out PHAL crap.
//POCKETFROGCWRAPPER_API void __stdcall display_destroy(Display* display);
[DllImport("PocketFrogCWrapper.dll")]
public static extern void display_destroy(IntPtr display);
//POCKETFROGCWRAPPER_API Surface* __stdcall display_getbackbuffer(Display* display);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr display_getbackbuffer(IntPtr display);
//POCKETFROGCWRAPPER_API Orientation __stdcall display_getorientation(Display* display);
[DllImport("PocketFrogCWrapper.dll")]
public static extern uint display_getorientation(IntPtr display);
//POCKETFROGCWRAPPER_API int __stdcall display_getwidth(Display* display);
[DllImport("PocketFrogCWrapper.dll")]
public static extern int display_getwidth(IntPtr display);
//POCKETFROGCWRAPPER_API int __stdcall display_getheight(Display* display);
[DllImport("PocketFrogCWrapper.dll")]
public static extern int display_getheight(IntPtr display);
//POCKETFROGCWRAPPER_API Surface* __stdcall display_setrendertarget(Display* display, Surface* target);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr display_setrendertarget(IntPtr display, IntPtr target);
//POCKETFROGCWRAPPER_API void __stdcall display_update(Display* display, const Rect* rect = 0);
[DllImport("PocketFrogCWrapper.dll")]
public static extern void display_update(IntPtr display, IntPtr rect);
//TODO: add rasterizer methods as well or will it work itself out in the .net object hierarchy?
//**********************************
// PocketPC functions
//*********************************
//TODO: May be able to replace these with .net funtionality
//pocketpc_getfullpathname is on hold until I get more info on size_t
//POCKETFROGCWRAPPER_API size_t __stdcall getfullpathname(LPCTSTR filename, TCHAR pathname[MAX_PATH]);
//POCKETFROGCWRAPPER_API uint_t __stdcall gettickcount();
[DllImport("PocketFrogCWrapper.dll")]
public static extern uint gettickcount();
//**********************************
// Image functions
//*********************************
//POCKETFROGCWRAPPER_API Surface* __stdcall image_loadimagefromfile(const TCHAR* filename);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr image_loadimagefromfile(string filename);
//POCKETFROGCWRAPPER_API Surface* __stdcall image_loadimagefromresource(unsigned resourceID, const TCHAR* resclass = _T("image"), HINSTANCE hModule = 0);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr image_loadimagefromresource(uint resourceID, string resclass, IntPtr hModule);
//POCKETFROGCWRAPPER_API Surface* __stdcall image_loadimagefrommem(const uint8_t* pBegin, const uint8_t* pEnd);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr image_loadimagefrommem(IntPtr pBegin, IntPtr pEnd);
//POCKETFROGCWRAPPER_API bool __stdcall image_saveimage(const Surface* surface, const TCHAR* filename);
[DllImport("PocketFrogCWrapper.dll")]
public static extern bool image_saveimage( IntPtr surface, string filename);
//**********************************
// Surface object
//*********************************
//POCKETFROGCWRAPPER_API Surface* __stdcall surface_create(unsigned width, unsigned height);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr surface_create(int width, int height);
//POCKETFROGCWRAPPER_API void __stdcall surface_destroy(Surface* surface);
[DllImport("PocketFrogCWrapper.dll")]
public static extern void surface_destroy(IntPtr surface);
//POCKETFROGCWRAPPER_API Surface* __stdcall surface_clone(Surface* surface);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr surface_clone(IntPtr surface);
//POCKETFROGCWRAPPER_API unsigned __stdcall surface_getwidth(Surface* surface);
[DllImport("PocketFrogCWrapper.dll")]
public static extern uint surface_getwidth(IntPtr surface);
//POCKETFROGCWRAPPER_API unsigned __stdcall surface_getheight(Surface* surface);
[DllImport("PocketFrogCWrapper.dll")]
public static extern uint surface_getheight(IntPtr surface);
//POCKETFROGCWRAPPER_API void __stdcall surface_setcolormask(Surface* surface, int mask);
[DllImport("PocketFrogCWrapper.dll")]
public static extern void surface_setcolormask(IntPtr surface, int mask);
//POCKETFROGCWRAPPER_API int __stdcall surface_getcolormask(Surface* surface);
[DllImport("PocketFrogCWrapper.dll")]
public static extern int surface_getcolormask(IntPtr surface);
//POCKETFROGCWRAPPER_API bool __stdcall surface_lock(Surface* surface, Surface::LockInfo* lockinfo, bool bDiscard = false, const Rect* rect = 0);
[DllImport("PocketFrogCWrapper.dll")]
public static extern bool surface_lock(IntPtr surface,ref LockInfo lockinfo, bool bDiscard, IntPtr rect);
//POCKETFROGCWRAPPER_API bool __stdcall surface_unlock(Surface* surface, bool bDiscard = false);
[DllImport("PocketFrogCWrapper.dll")]
public static extern bool surface_unlock(IntPtr surface, bool bDiscard);
//POCKETFROGCWRAPPER_API HDC __stdcall surface_getdc(Surface* surface, bool bDiscard = false);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr surface_getdc(IntPtr surface, bool bDiscard);
//POCKETFROGCWRAPPER_API bool __stdcall surface_releasedc(Surface* surface, HDC hdc);
[DllImport("PocketFrogCWrapper.dll")]
public static extern bool surface_releasedc(IntPtr surface, IntPtr hdc);
//**********************************
// Point object
//*********************************
//POCKETFROGCWRAPPER_API Point* __stdcall point_create();
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr point_create();
//POCKETFROGCWRAPPER_API Point* __stdcall point_createfromcoords(int ax, int ay);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr point_createfromcoords(int ax, int ay);
//TODO: still on hold for POINT
////POCKETFROGCWRAPPER_API Point* __stdcall point_create(const POINT* p);
//POCKETFROGCWRAPPER_API void __stdcall point_set(Point* pPoint, int ax, int ay);
[DllImport("PocketFrogCWrapper.dll")]
public static extern void point_set(IntPtr pPoint, int ax, int ay);
//POCKETFROGCWRAPPER_API void __stdcall point_translate(Point* pPoint, int dx, int dy);
[DllImport("PocketFrogCWrapper.dll")]
public static extern void point_translate(IntPtr pPoint, int dx, int dy);
//TODO: think of how to implement operator overrides.
//POCKETFROGCWRAPPER_API Point* __stdcall point_opoverrideplus(Point* pPoint, Point* pPointArg);
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr point_opoverrideplus(IntPtr pPoint, IntPtr pPointArg);
//**********************************
// Rect object
//*********************************
//POCKETFROGCWRAPPER_API Rect* __stdcall rect_create();
[DllImport("PocketFrogCWrapper.dll")]
public static extern IntPtr rect_create();
//POCKETFROGCWRAPPER_API Rect* __stdcall rect_createfromcoords(int l, int t, int r, int b);
[DllImport("PocketFrogCWrapper.dll")]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -