[514] | 1 | // Copyright (C) 2016-2016 ChaosForge Ltd
|
---|
| 2 | // http://chaosforge.org/
|
---|
| 3 | //
|
---|
| 4 | // This file is part of Nova libraries.
|
---|
| 5 | // For conditions of distribution and use, see copying.txt file in root folder.
|
---|
| 6 | /**
|
---|
| 7 | * @file curses_terminal.hh
|
---|
| 8 | * @author Kornel Kisielewicz epyon@chaosforge.org
|
---|
| 9 | * @brief curses terminal interface
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | #ifndef NV_GFX_TERMINAL_HH
|
---|
| 13 | #define NV_GFX_TERMINAL_HH
|
---|
| 14 |
|
---|
| 15 | #include <nv/common.hh>
|
---|
| 16 | #include <nv/interface/terminal.hh>
|
---|
| 17 | #include <nv/interface/context.hh>
|
---|
| 18 |
|
---|
| 19 | namespace nv
|
---|
| 20 | {
|
---|
| 21 | struct gfx_terminal_data;
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | struct gfx_terminal_draw_call
|
---|
| 25 | {
|
---|
| 26 | vertex_array va;
|
---|
| 27 | uint32 va_count;
|
---|
| 28 | texture image;
|
---|
| 29 | program p;
|
---|
| 30 | };
|
---|
| 31 |
|
---|
| 32 | class gfx_terminal : public terminal
|
---|
| 33 | {
|
---|
| 34 | public:
|
---|
| 35 | /**
|
---|
| 36 | * Constructor
|
---|
| 37 | */
|
---|
| 38 | gfx_terminal( context* ctx, texture t, dimension tsize, dimension psize );
|
---|
| 39 |
|
---|
| 40 | /**
|
---|
| 41 | * Update the screen
|
---|
| 42 | */
|
---|
| 43 | virtual void update();
|
---|
| 44 |
|
---|
| 45 | /**
|
---|
| 46 | * Print a character of the given color to the screen memory
|
---|
| 47 | */
|
---|
| 48 | virtual void print( position p, term_color fgcolor, term_color bgcolor, char ch );
|
---|
| 49 |
|
---|
| 50 | /**
|
---|
| 51 | * Clear screen memory
|
---|
| 52 | */
|
---|
| 53 | virtual void clear( rectangle r, term_color fgcolor, term_color bgcolor );
|
---|
| 54 |
|
---|
| 55 | /**
|
---|
| 56 | * Clear screen memory
|
---|
| 57 | */
|
---|
| 58 | virtual void clear();
|
---|
| 59 |
|
---|
| 60 | /**
|
---|
| 61 | * Polls event
|
---|
| 62 | */
|
---|
| 63 | virtual bool poll( io_event& kevent );
|
---|
| 64 |
|
---|
| 65 | /**
|
---|
| 66 | * Set cursor position
|
---|
| 67 | */
|
---|
| 68 | virtual void set_cursor( position p );
|
---|
| 69 |
|
---|
| 70 | /**
|
---|
| 71 | * Show cursor
|
---|
| 72 | */
|
---|
| 73 | virtual void show_cursor();
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * Hide cursor
|
---|
| 77 | */
|
---|
| 78 | virtual void hide_cursor();
|
---|
| 79 |
|
---|
| 80 | /**
|
---|
| 81 | * Virtual destructor
|
---|
| 82 | */
|
---|
| 83 | virtual ~gfx_terminal();
|
---|
| 84 |
|
---|
| 85 | gfx_terminal_draw_call& temp_dc()
|
---|
| 86 | {
|
---|
| 87 | return m_dc;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | protected:
|
---|
| 91 | context* m_context;
|
---|
| 92 | gfx_terminal_draw_call m_dc;
|
---|
| 93 | gfx_terminal_data* m_data;
|
---|
| 94 | bool m_update_needed;
|
---|
| 95 | };
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | #endif // NV_GFX_TERMINAL_HH
|
---|