home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
MEDIT.LZH
/
DINPUT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-18
|
6KB
|
186 lines
/* Project medit
Project Team DoGA
Copyright (c) 1995. All Rights Reserved.
サブシステム: medit.apx Application
ファイル: dinput.cpp
作成者: Taka2
概要
====
TDDirectInput (TDialog) のインプリメンテーション用のソースファイル
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include <stdio.h>
#include <owl\edit.h>
#include "dinput.h"
#include "matrix.h"
#include "anim.h"
#include "parts.h"
//
// このアプリケーションで処理するすべてのメッセージ/コマンドの
// 応答テーブルを作成する
//
DEFINE_RESPONSE_TABLE1(TDDirectInput, TDialog)
//{{TDDirectInputRSP_TBL_BEGIN}}
EV_BN_CLICKED(IDOK, CmOK),
//{{TDDirectInputRSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TDDirectInput Implementation}}
TDDirectInput::TDDirectInput (TWindow* parent, AnimationData *a, int initialpos, TResId resId, TModule* module):
TDialog(parent, resId, module)
{
// INSERT>> コンストラクタ用のコードはここに
// SetBkgndColor(TColor::LtGray);
m1 = new TStatic(this, IDC_DIRECT_M1);
m2 = new TStatic(this, IDC_DIRECT_M2);
m3 = new TStatic(this, IDC_DIRECT_M3);
m4 = new TStatic(this, IDC_DIRECT_M4);
m5 = new TStatic(this, IDC_DIRECT_M5);
tsx = new TStatic(this, IDC_DIRECT_TEXT_SX);
tsy = new TStatic(this, IDC_DIRECT_TEXT_SY);
tsz = new TStatic(this, IDC_DIRECT_TEXT_SZ);
px = new TEdit(this, IDC_DIRECT_PX);
py = new TEdit(this, IDC_DIRECT_PY);
pz = new TEdit(this, IDC_DIRECT_PZ);
rx = new TEdit(this, IDC_DIRECT_RX);
ry = new TEdit(this, IDC_DIRECT_RY);
rz = new TEdit(this, IDC_DIRECT_RZ);
sx = new TEdit(this, IDC_DIRECT_SX);
sy = new TEdit(this, IDC_DIRECT_SY);
sz = new TEdit(this, IDC_DIRECT_SZ);
bf = new TEdit(this, IDC_DIRECT_BEGIN);
ef = new TEdit(this, IDC_DIRECT_END);
anim = a;
ipos = initialpos;
}
TDDirectInput::~TDDirectInput ()
{
Destroy();
// INSERT>> デストラクタ用のコードはここに
}
void TDDirectInput::SetupWindow ()
{
TDialog::SetupWindow();
// INSERT>> 追加のコードはここに
if (anim->select != NULL) {
Motion *m = anim->select;
char str[16];
if (anim->select == anim->camera || anim->select == anim->camera->target) {
m = anim->camera;
Motion *t = anim->camera->target;
sprintf(str, "%5.0lf", m->position.x); px->SetText(str);
sprintf(str, "%5.0lf", m->position.y); py->SetText(str);
sprintf(str, "%5.0lf", m->position.z); pz->SetText(str);
sprintf(str, "%5.0lf", t->position.x); rx->SetText(str);
sprintf(str, "%5.0lf", t->position.y); ry->SetText(str);
sprintf(str, "%5.0lf", t->position.z); rz->SetText(str);
m1->SetText("カメラ");
m2->SetText("ターゲット");
// rx->Show(SW_HIDE);
// ry->Show(SW_HIDE);
// rz->Show(SW_HIDE);
m3->Show(SW_HIDE);
sx->Show(SW_HIDE);
sy->Show(SW_HIDE);
sz->Show(SW_HIDE);
tsx->Show(SW_HIDE);
tsy->Show(SW_HIDE);
tsz->Show(SW_HIDE);
m4->Show(SW_HIDE);
m5->Show(SW_HIDE);
bf->Show(SW_HIDE);
ef->Show(SW_HIDE);
} else {
sprintf(str, "%5.0lf", m->position.x); px->SetText(str);
sprintf(str, "%5.0lf", m->position.y); py->SetText(str);
sprintf(str, "%5.0lf", m->position.z); pz->SetText(str);
sprintf(str, "%4.0lf", rad(m->rotation.x)); rx->SetText(str);
sprintf(str, "%4.0lf", rad(m->rotation.y)); ry->SetText(str);
sprintf(str, "%4.0lf", rad(m->rotation.z)); rz->SetText(str);
sprintf(str, "%5.3lf", m->scale.x); sx->SetText(str);
sprintf(str, "%5.3lf", m->scale.y); sy->SetText(str);
sprintf(str, "%5.3lf", m->scale.z); sz->SetText(str);
sprintf(str, "%d", m->beginframe); bf->SetText(str);
sprintf(str, "%d", m->endframe); ef->SetText(str);
}
}
}
static void limit(Vector& v)
{
if (v.x > limitdim) v.x = limitdim;
if (v.x < -limitdim) v.x = -limitdim;
if (v.y > limitdim) v.y = limitdim;
if (v.y < -limitdim) v.y = -limitdim;
if (v.z > limitdim) v.z = limitdim;
if (v.z < -limitdim) v.z = -limitdim;
}
void TDDirectInput::CmOK ()
{
// INSERT>> 追加コードはここに
char str[16];
Motion *m = anim->select;
if (m != NULL) {
if (anim->select == anim->camera || anim->select == anim->camera->target) {
m = anim->camera;
px->GetText(str,16); m->position.x = atof(str);
py->GetText(str,16); m->position.y = atof(str);
pz->GetText(str,16); m->position.z = atof(str);
limit(m->position);
Motion *t = anim->camera->target;
rx->GetText(str,16); t->position.x = atof(str);
ry->GetText(str,16); t->position.y = atof(str);
rz->GetText(str,16); t->position.z = atof(str);
limit(t->position);
} else {
px->GetText(str,16); m->position.x = atof(str);
py->GetText(str,16); m->position.y = atof(str);
pz->GetText(str,16); m->position.z = atof(str);
limit(m->position);
rx->GetText(str,16); m->rotation.x = deg(atof(str));
ry->GetText(str,16); m->rotation.y = deg(atof(str));
rz->GetText(str,16); m->rotation.z = deg(atof(str));
m->rotation = Matrix::m_rot(m->rotation).GetRotation();
sx->GetText(str,16); m->scale.x = atof(str);
sy->GetText(str,16); m->scale.y = atof(str);
sz->GetText(str,16); m->scale.z = atof(str);
int b, e;
bf->GetText(str,16); b = atoi(str);
ef->GetText(str,16); e = atoi(str);
if (BEGIN <= b && b <= e && e <= anim->maxframe
&& (m->motiondata == NULL || b < e)) {
m->beginframe = b;
m->endframe = e;
}
}
}
CloseWindow(IDOK);
}