Skip to content

MT2D Basics

ibm5155 edited this page Sep 3, 2018 · 3 revisions

MT2D_Terminal_Define

This file defines how MT2D is going to be compiled, some of those settings are user configured, those are:

  • SDL_USE_AUDIO: Enables the SDL Audio code to use the SDL Layer as an áudio processing.
  • MT2D_USING_CONTAINER: Enable the Container code if defined, else you'll lose the Container Functionality.
  • MT2D_WINDOWED_MODE: Tells the Engine to start in windowed mode instead of full screen (SDL only for now)
  • SDL_USE: Tells the Engine to use SDL for rendering (plus you gain graphic sprites support for rendering), this mode is required if you plan to use MT2D for Android or Windows Phone/UWP, it's not required for Linux, BUT, Linux terminal support for now is a bit limited.
  • MT2D_SCREEN_RESIZE: Allows MT2D to resize the terminal in case of using a graphics rendering.
  • MT2D_SDL_GPU: Enables the use of the SDL_GPU render, you must include the SDL_GPU libs and, to be honest, was never finished nor tested.
  • MT2D_SDL_USING_DIRECTX_RENDER: Force SDL to ouse Directx instead of OpenGL

<!> FUTURE DEFINITIONS WIP

  • MSDOS_USE_GRAPHICS: Sets MT2D To use the VGA mode instead of the Terminal mode under MS-DOS, it'll cost you worst font size for reading, alot more slower compared to the terminal and also the cost of extra system ram used for the engine (129KB max, ~3KB min), BUT, you'll have sprites support.
  • MSDOS_USE_DOUBLE_BUFFER: (MSDOS_USE_GRAPHICS must be defined) Sets MT2D to create a graphics buffer under the system ram so you get less latency by rendering a full block to the graphics card (uses 64KB of system ram)
  • MSDOS_USE_SPRITE_TILE_RENDER: (MSDOS_USE_GRAPHICS must be defined) (can be used with the double buffer), sets MT2D to create a screen map so it avoids to drawn the same elements again on screen, giving some extra performance at the cost of (10~64KB of ram)

MT2D

This file contains the core functions needed for MT2D to work, the following functions are:

MT2D_Init insert_string_on_display insert_number_on_display transfer_window1_to_window2 transfer_window2_to_window1

There's also the following definitions:

MAX_HOR: the definition of the maximun number of chars under the column MAX_VER: the definition of the maximun number of chars under the line DISPLAY_WINDOW1: the representation of the main char buffer DISPLAY_WINDOW2: the representation of the temporary char buffer

MT2D_Display

This file contains the basics of display interaction, with that, you get a function to render a screen buffer and to clear the main buffer.

MT2D_Clear_Main_Window: Clears the screen buffer, but doesn't clear the display MT2D_Draw_Window: Draws everything that's into the screen buffer on top of the terminal or Display Buffer.

MT2D_Keyboard

This function contains the basics of Keyboard interaction, the following functions are defined here:

MT2D_Keyboard_touched: Return the pressed key (or a part of a pressed key) MT2D_Keyboard_keytouched: Return if there's a given key that was pressed and wasn't readed

NOTE: Some Keys requires two Keys input, check MT2D_Keyboard_touched for more info.

MT2D_Layout

Creates a customized window layout, there's only one function inside of this file.

MT2D_Create_Window_Layout: Creates a window and plot it on a screen buffer.

MT2D_System_Calls

This File deals to System Calls, the implemented functions are:

MT2D_System_Delay: Freeze the given thread by a given millisecond time MT2D_System_Beep: Freeze the given thread by a given second and also makes a Beep with a given frequency (may not work well under certain os)

Clone this wiki locally