usermode/axwin4 - Blit to screen planned
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / video.cpp
1 /*
2  * Acess2 GUI v4
3  * - By John Hodge (thePowersGang)
4  *
5  * video.cpp
6  * - Graphics output
7  */
8 #include <cstddef>
9 #include <video.hpp>
10 #include <common.hpp>
11
12 extern "C" {
13 #include <acess/sys.h>
14 #include <acess/devices/pty.h>
15 }
16
17 namespace AxWin {
18
19 CVideo::CVideo(const CConfigVideo& config):
20         m_fd(0)
21 {
22         {
23                 if( _SysIOCtl(m_fd, DRV_IOCTL_TYPE, NULL) != DRV_TYPE_TERMINAL )
24                         throw AxWin::InitFailure("stdin isn't a terminal");
25                 struct ptydims  dims;
26                 if( _SysIOCtl(m_fd, PTY_IOCTL_GETDIMS, &dims) == -1 )
27                         throw AxWin::InitFailure("Failed to get dimensions from stdin");
28                 m_width = dims.PW;
29                 m_height = dims.PH;
30                 if( m_width == 0 || m_height == 0 )
31                         throw AxWin::InitFailure("Terminal not capable of graphics");
32         }
33 }
34
35 void CVideo::BlitLine(const uint32_t* src, unsigned int dst_y, unsigned int dst_x, unsigned int width)
36 {
37         //_SysWriteAt(m_fd, (dst_y * m_width + dst_x) * 4, width * 4, src);
38         _SysSeek(m_fd, (dst_y * m_width + dst_x) * 4, SEEK_SET);
39         _SysWrite(m_fd, src, width * 4);
40 }
41
42 };      // namespace AxWin
43

UCC git Repository :: git.ucc.asn.au