pub mod utl;
pub mod wm;
pub mod unwind;
pub use utl::*;
pub use wm::*;
pub use unwind::*;
use crate::core::*;
use std::{result::Result, error::Error, ptr::null_mut};
use windows::{
core::*,
Win32::Graphics::Gdi::*,
Win32::{Foundation::*}
};
pub fn test_app() -> Result<i32, Box<dyn Error>> {
unsafe {
initLog(LOGFILE);
}
let appname = "Dx9 Test App";
let sz: [i32; 2] = [32 * 32, 32 * 24];
let (w, h) = (sz[0], sz[1]);
let eps = [
[0.0f32, 3.0f32, -2.5f32, 0.0f32], [0.0f32, 0.0f32, -2.5f32, 0.0f32],
[0.0f32, -3.0f32, -2.5f32, 0.0f32],
[3.0f32, 0.0f32, -2.5f32, 0.0f32]];
let tss = eps.into_iter().enumerate().map(|(u, ep)| {
let i = u as i32;
let la = [0.0f32, 0.0f32, 0.0f32, 0.0f32];
let top = [0.0f32, 1.0f32, 0.0f32, 0.0f32]; let (x, y) = (512 - 40 + w * (i % 2), (h - 60) * (i / 2));
let owner = HWND(null_mut());
let wnd = HWND(null_mut());
let mdc = HDC(null_mut());
let bmp = HBITMAP(null_mut());
let buf = l(format!("{}_{:04}", appname, i).as_str());
let winname = PCWSTR(buf.as_ptr());
TransScreen{ep, la, top, winname, x, y, w, h, owner, wnd, mdc, bmp, buf}
}).collect::<Vec<_>>();
let spc = Space{obj: vec![]};
let sa: Vec<usize> = vec![4, 32, 4, 4, 4, 4, 32, 4];
let result = create_window(Dx9::new(sz, &sa).expect("Dx9"), tss, spc,
wndproc, w!("Dx9 Class"), PCWSTR(l(appname).as_ptr()), w!(""))?;
Ok(result)
}