小编Ale*_*ger的帖子

接口中的C#静态功能

有没有办法在C#中模拟接口中的静态函数?

我想将它用于工厂,其中每个对象都继承自ICreateAble静态函数'Create',然后在工厂类中可以调用Factory.Create(Type t, string fromFile)哪个调用t.Create()

c# directx

7
推荐指数
2
解决办法
3631
查看次数

C++如何获取png文件的图像大小(在目录中)

有没有办法在特定路径中获取png文件的尺寸?我不需要加载文件,我只需要在directx中加载纹理的宽度和高度.

(我不想使用任何第三方库)

c++ png image

7
推荐指数
2
解决办法
1万
查看次数

DirectX设置单个像素的颜色

我在另一个线程读取,我可以读取Texture.Lock /解锁单个像素,但我需要阅读它们之后的像素写回的质感,这是我到目前为止的代码

unsigned int readPixel(LPDIRECT3DTEXTURE9 pTexture, UINT x, UINT y)
{
    D3DLOCKED_RECT rect;
    ZeroMemory(&rect, sizeof(D3DLOCKED_RECT));
    pTexture->LockRect(0, &rect, NULL, D3DLOCK_READONLY);
    unsigned char *bits = (unsigned char *)rect.pBits;
    unsigned int pixel = (unsigned int)&bits[rect.Pitch * y + 4 * x];
    pTexture->UnlockRect(0);
    return pixel;
}
Run Code Online (Sandbox Code Playgroud)

所以我的问题是:

- How to write the pixels back to the texture?  
- How to get the ARGB values from this unsigned int? 
Run Code Online (Sandbox Code Playgroud)

((BYTE)x >> 8/16/24)对我没用(函数的返回值是688)

directx

6
推荐指数
1
解决办法
3968
查看次数

C函数**ntohl**给出链接器错误(未解析的外部)

函数ntohl为我提供了一个链接器错误:

error LNK2001: unresolved external symbol _ntohl@4
fatal error LNK1120: 1 unresolved externals
Run Code Online (Sandbox Code Playgroud)

我已经包括在内

#include <winsock.h>
Run Code Online (Sandbox Code Playgroud)

有具体原因吗?(或者可以手动轻松完成此功能吗?)

c++ windows linker winsock

2
推荐指数
1
解决办法
4333
查看次数

标签 统计

c++ ×2

directx ×2

c# ×1

image ×1

linker ×1

png ×1

windows ×1

winsock ×1