Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <nds.h>
- #include <math.h>
- #include "Vector2D.cpp"
- #define PI 3.14159265
- #ifndef GRAPHICS_CPP
- #define GRAPHICS_CPP
- class Graphics {
- private:
- u16* videoRam;
- public:
- Graphics() {
- videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);
- vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
- REG_BG3CNT = BG_BMP16_256x256 | BG_BMP_BASE(0);
- REG_BG3PA = 1 << 8;
- REG_BG3PB = 0;
- REG_BG3PC = 0;
- REG_BG3PD = 1 << 8;
- videoRam = BG_BMP_RAM(0);
- }
- void drawPixel(int x, int y) {
- videoRam[y * SCREEN_WIDTH + x] = RGB15(0,31,0) | (1<<15);
- }
- // Extremely basic and inefficient implementation to draw a circle:
- void drawCircle(int x, int y, int radius) {
- for(int i = 0; i < 360; ++i) {
- int tmpX = x + round(cos(i * PI / 180) * radius);
- int tmpY = y + round(sin(i * PI / 180) * radius);
- drawPixel(tmpX, tmpY);
- }
- }
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment