Advertisement
Kitomas

video.hpp as of 2023-01-05

Jan 5th, 2024
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.28 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "_video/window.hpp"
  4.  
  5. #include <stdint.h>
  6.  
  7.  
  8. namespace kit {
  9.  
  10.  
  11.  
  12.  
  13. namespace color {
  14.  
  15.   //what GDI uses (save for the alpha channel)
  16.   union ARGB { //4B; 0xAARRGGBB
  17.     uint32_t v; //entire color [v]alue
  18.     struct {
  19.       uint8_t b;
  20.       uint8_t g;
  21.       uint8_t r;
  22.       uint8_t a;
  23.     };
  24.  
  25.     ARGB() : v(0) {}
  26.     ARGB(uint32_t _v) : v(_v) {}
  27.     ARGB(uint8_t _r, uint8_t _g,
  28.          uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {}
  29.   };
  30.  
  31.  
  32.   union ABGR { //4B; 0xAABBGGRR
  33.     uint32_t v; //entire color [v]alue
  34.     struct {
  35.       uint8_t r;
  36.       uint8_t g;
  37.       uint8_t b;
  38.       uint8_t a;
  39.     };
  40.  
  41.     ABGR() : v(0) {}
  42.     ABGR(uint32_t _v) : v(_v) {}
  43.     ABGR(uint8_t _r, uint8_t _g,
  44.          uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {}
  45.   };
  46.  
  47. };
  48.  
  49.  
  50.  
  51.  
  52. namespace shape {
  53.  
  54.   struct point { //8B
  55.     int32_t x, y;
  56.     point() : x(0), y(0) {}
  57.     point(int32_t _x, int32_t _y) : x(_x), y(_y) {}
  58.   };
  59.  
  60.   struct rect { //16B
  61.     int32_t x, y; //x & y position of the rectangle's top-left corner
  62.     int32_t w, h; //the rectangle's width & height
  63.     point() : x(0), y(0), w(0), h(0) {}
  64.     point(int32_t _x, int32_t _y) : x(_x), y(_y) {}
  65.     point(int32_t _x, int32_t _y,
  66.           int32_t _w, int32_t _h) : x(_x), y(_y), w(_w), h(_h) {}
  67.   };
  68.  
  69.  
  70.  
  71.   struct fpoint { //8B
  72.     float x, y;
  73.     point() : x(0.0f), y(0.0f) {}
  74.     point(float _x, float _y) : x(_x), y(_y) {}
  75.   };
  76.  
  77.   struct frect { //16B
  78.     float x, y; //x & y position of rectangle's top-left corner
  79.     float w, h; //the rectangle's width & height
  80.     point() : x(0.0f), y(0.0f), w(0.0f), h(0.0f) {}
  81.     point(float _x, float _y) : x(_x), y(_y) {}
  82.     point(float _x, float _y,
  83.           float _w, float _h) : x(_x), y(_y), w(_w), h(_h) {}
  84.   };
  85.  
  86.  
  87.  
  88.   struct dpoint { //16B
  89.     double x, y;
  90.     point() : x(0.0), y(0.0) {}
  91.     point(double _x, double _y) : x(_x), y(_y) {}
  92.   };
  93.  
  94.   struct drect { //32B
  95.     double x, y; //x & y position of rectangle's top-left corner
  96.     double w, h; //the rectangle's width & height
  97.     point() : x(0.0), y(0.0), w(0.0), h(0.0) {}
  98.     point(double _x, double _y) : x(_x), y(_y) {}
  99.     point(double _x, double _y,
  100.           double _w, double _h) : x(_x), y(_y), w(_w), h(_h) {}
  101.   };
  102.  
  103. };
  104.  
  105.  
  106.  
  107.  
  108. };
  109.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement