Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
NdsPaint is a tool
to draw images on an NDS.
Downloads
Technical facts
Operating system(s) or programming environment(s)
IDE(s):
Project type:
C++ standard:
Compiler(s):
Libraries used:
Qt: version 5.2.1 (32 bit)
STL: GNU ISO C++ Library, version 4.8.2
Qt project file: ./ToolNdsPaint/ToolNdsPaint.pro
#-------------------------------------------------
#
# Project created by QtCreator 2010-10-13T17:10:22
#
#-------------------------------------------------
QT += core
QT -= gui
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
#Define this flag for NDS
#NDS development (must make from command line, however)
INCLUDEPATH += /opt/devkitpro/libnds-1.4.7/include
INCLUDEPATH += /opt/devkitpro/libnds-src-1.4.7/include/nds
INCLUDEPATH += /opt/devkitpro/devkitARM/arm-eabi/include
LIBS += -L/opt/devkitpro/libnds-1.4.7/lib -lnds9
LIBS += -L/opt/devkitpro/devkitARM/arm-eabi/lib -lstdc++
DEFINES += ARM9
CONFIG += console
CONFIG -= qt
CONFIG -= app_bundle
TEMPLATE = app
QMAKE_CC = /opt/devkitpro/devkitARM/bin/arm-eabi-g++
QMAKE_CXX = /opt/devkitpro/devkitARM/bin/arm-eabi-g++
QMAKE_LINK = /opt/devkitpro/devkitARM/bin/arm-eabi-g++
QMAKE_LFLAGS = -T/opt/devkitpro/devkitARM/arm-eabi/lib/ds_arm9.ld
|
./ToolNdsPaint/main.cpp
#include <cstdlib>
#include <iostream>
#include <nds.h>
int main()
{
videoSetMode(MODE_FB0);
vramSetBankA(VRAM_A_LCD);
//notice we make sure the main graphics engine renders
//to the lower lcd screen as it would be hard to draw if the
//pixels did not show up directly beneath the pen
//lcdMainOnBottom();
int x = 0;
int y = 0;
int z = 0;
while(1)
{
++x;
if (x == SCREEN_WIDTH )
{
x = 0; ++y;
if (y == SCREEN_HEIGHT)
{
y = 0; z+=4;
if (z == 32) z = 0;
}
}
//VRAM_A[x + y * SCREEN_WIDTH] = RGB15(z,z,z);
scanKeys();
const int keys = keysHeld();
//if(keys & KEY_TOUCH)
{
//z = 0;
// write the touchscreen coordinates in the touch variable
touchPosition pos;
touchRead(&pos);
VRAM_A[pos.px + (pos.py * 256)] = rand();
//VRAM_A[ std::rand() % (SCREEN_WIDTH * SCREEN_HEIGHT) ] = std::rand();
}
}
return 0;
}
|
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.

This page has been created by the tool CodeToHtml