ゲーム画面をブラウン管風の画面にしたいと思い、MakeScreenで作ったグラフィックに描画したものからGetPixel2でRGBを取得し、各色成分ごとに縦に並べるというプログラムを組みました。
下記のようなものです。
#include "DxLib.h"
#include "c_select.h"
#include "key_input.h"
#include "pad_input.h"
#include "effect.h"
static unsigned int sgc;//スポイト用
static int gcr = 0;//色成分
static int gcg = 0;//色成分
static int gcb = 0;//色成分
// プログラムは WinMain から始まります
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
SetGraphMode(960, 772, 16);
ChangeWindowMode(TRUE);
SetWindowSizeExtendRate(1);
SetWindowSizeChangeEnableFlag(TRUE);
int scene = 1;//シーン
if (DxLib_Init() == -1) // DXライブラリ初期化処理
{
return -1; // エラーが起きたら直ちに終了
}
C_S_Set();
effect_set();
while (ProcessMessage() == 0 ) {
SetDrawScreen(DX_SCREEN_BACK);
ClearDrawScreen();
key_update();
pad_update();
fade_update();
int handle;
handle = MakeScreen(320, 224, TRUE);
int handle2;
handle2 = MakeScreen(960, 772, TRUE);
SetDrawScreen(handle);
switch (scene) {
case 1:
C_S__Update();
C_S__Draw();
break;
}
//エフェクト
fade_update();
fade_draw();
//変換
if (int i = 0 == 0 {
for (int x = 0; x < 64; x++) {
for (int y = 0; y < 64; y++) {
SetDrawScreen(handle);
sgc = GetPixel(x, y);
GetColor2(sgc, &gcr, &gcg, &gcb);
SetDrawScreen(handle2);
DrawLine(x * 3, y * 3, x * 3, y * 3 + 2, GetColor(gcr, 0, 0));
DrawLine(x * 3 + 1, y * 3, x * 3, y * 3 + 2, GetColor(0, gcg, 0));
DrawLine(x * 3 + 2, y * 3, x * 3, y * 3 + 2, GetColor(0, 0, gcb));
}
}
}
// 描画対象を裏画面にする
SetDrawScreen(DX_SCREEN_BACK);
//DrawGraph(0, 0, handle2, TRUE);
DeleteGraph(handle);
DeleteGraph(handle2);
ScreenFlip();
}
DxLib_End(); // DXライブラリ使用の終了処理
return 0; // ソフトの終了
}
ここで皆さんにお聞きしたいのは、
①GetPixelよりも動作が軽い色を取得する方法
②ブラウン管風の画面を描画する他の方法
です。
私も考えているところですが、皆さまからの助言を頂ければと考えています。
わかりにくい文章でしたら、申し訳ございません。何卒、よろしくお願いします。