This is the unofficial home of simulator for the time being

In this category, we will try to get people setup and using the Pokitto Simulator

Before we do that, let me explain what is the Simulator and what it is used for.

#1. What the simulator is used for

The Pokitto Simulator allows you to test ideas and create programs and games on a PC. You do not need to have the actual device to program. A picture of Pokitto will pop up on your screen and you can play the games with arrow keys and z,x,c = a,b,c

This is what the simulator looks like:

#2. Is it really useful?

Yes. Very. I use the Pokitto simulator to create new games and applications. All of the Pokitto games and demos you have seen were first created in the simulator and put on the actual Pokitto hardware later.

#3. I am a beginner. Do I HAVE to use / learn the simulator?

No. The Simulator is a nice feature that you can use & learn but it is not really part of the core Pokitto toolset. You can program the Pokitto completely without ever even looking at the simulator.

I am releasing the simulator only because we have such an active community already. I don’t think its fair to keep you all waiting for the Pokitto hardware when it is so clear that you already want to begin creating programs.

At this moment I recommend that only people who are confident to start on the simulator on their own install the software. We are still very busy with the Kickstarter campaign, we do not have the resources to start helping everyone with the simulator. Sorry.

#4. What is the simulator based on, how does it work?

Pokitto Simulator is an API-level simulator. This means that all the graphics, sound, disk, button, etc functions that you use are simulated on the PC as faithfully as possible. But what you are actually running is a real Windows program - not a real Pokitto program. The Simulator uses SDL2 libraries to create graphics and sounds.

#5. But if its not a real Pokitto emulator running a real Pokitto program, its not an emulator?!

Correct. It is a simulator.

#6. In that case it does not have exactly the same hardware limitations? Doesn’t that cause problems?

The Simulator does not have the same limitations as the Pokitto. You will have to be careful with this. Do not make huge pictures that take 2Gb of memory - you will never get it to run on the real hardware.

#7. Why didn’t you make a real emulator?

Emulators are very complicated to make. I did not have time for it. With the simulator, you get most of the benefits: you can create games and solve problems in your code very fast. Tiny hardware tweaking can be completed once you transform the program to Pokitto. Most of the time my code created on the simulator works straight away on the hardware - as long as I have not created huge buffers or other silly thing.

**I am going to be adding the necessary information for setting up things & repositories bit by bit. Please be patient! **

3 Likes

Is the simulator going to be open too?

This is pretty much how the “simulator” for the HP Prime Calculator works too. I think it is quite convenient. HP even published the calculator in Android in other platforms thanks to this model.

1 Like

The simulator will be open source. The question is when. Before units ship, that is for sure, but not necessarily right now.

The simulator is the single biggest body of work involved in the Pokitto (1-1,5 yrs worth of code). I want to proceed with a little bit of caution.

1 Like

I will be posting the obligatory “Will it work on Linux?” comment. =)

3 Likes

@Drakker I have not tried but since it is Code::Blocks & SDL2 I dont see why not

@jonne well its more about what other library’s you used, example windows.h is windows specific, (you used that in the image converter)

1 Like

true… I need to check. I have been making good progress today, will start testing the standalone package now

Made good progress on this last night. Won’t be long now. The sim is cleaned up and I’m testing and writing instructions

2 Likes

#bug report
trying out some of the functions i noticed that rotation is not working
drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t rotation, uint8_t flip);
i tried NOROT, ROT180, ROTCCW, ROTCW

1 Like

@adekto Added to bug list thanks!

Bug report.
I am trying out the drawbitmap functions on the simulator.
I found the following problems:

  1. Horizontally clipped bitmaps that start on an odd pixel are one pixel horizontally shorter than they should be.
    2, Horizontally flipped bitmaps that star on an odd pixel are skewed.
  2. Horizontally flipped bitmaps that start on an even pixel are clippped on the right edge if the left edge goes off screen.

Here is the code that shows the problems:

#include "Pokitto.h"
Pokitto::Core game;
/*
	In this tutorial we are using fast screen mode.
	It means screen resolution is 110x88

*/
//setting variables
// upper left coordinates of rectangles
int16_t ulx = 0;
int16_t uly = 0;

uint16_t color = 0;
int16_t current_zero = 15; // remember where color zero is so we can redraw the last rectangle
                            // otherwise it flashes a lot.
uint16_t width;             // width of rectangle
uint16_t height;            // height of the rectangle



char screenW = 110;
char screenH = 88;
#define step (2)

uint8_t grid[] = { 16,16,
0x44,0x44,0x44,0x44, 0x44,0x44,0x44,0x44,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,

0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,

0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,

0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x45,0x55,0x55,0x55, 0x55,0x55,0x55,0x54,
0x44,0x44,0x44,0x44, 0x44,0x44,0x44,0x44,
};

uint8_t onetwo[] = { 16,16,
0x33,0x33,0x33,0x33, 0x33,0x33,0x33,0x33,
0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,
0x30,0x11,0x00,0x00, 0x00,0x22,0x20,0x03,
0x30,0x01,0x00,0x00, 0x00,0x00,0x20,0x03,

0x30,0x01,0x00,0x00, 0x00,0x22,0x20,0x03,
0x30,0x01,0x00,0x00, 0x00,0x20,0x00,0x03,
0x30,0x01,0x00,0x00, 0x00,0x22,0x20,0x03,
0x30,0x11,0x10,0x00, 0x00,0x00,0x00,0x03,

0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,
0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,
0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,
0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,

0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,
0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,
0x30,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,
0x33,0x33,0x33,0x33, 0x33,0x33,0x33,0x33,
};


int main(){
	game.begin();
	game.display.width = screenW;
	game.display.height = screenH;
	game.setFrameRate(60);
	game.display.persistence = 0 ;
	game.display.invisiblecolor = 0 ;



	while (game.isRunning()) {
    	if (game.update()) {
            // there is no logic to this program
            // draw
            game.display.fillScreen(14);
           game.display.drawBitmap(ulx,uly, grid);
           if (game.buttons.repeat(BTN_A,0)) ulx =   (ulx + 2) & 0xfffe; else ulx++ ;
           ulx += 2; // was 1
           if (ulx > screenW) ulx = -16 ;
             uly++;
           if (uly > screenH) uly = -16 ;
           game.display.drawBitmap(screenW - ulx - 16,screenH - uly - 16, onetwo);
             game.display.drawBitmap(10,10, onetwo);
             game.display.drawBitmapXFlipped(ulx,screenH - uly - 16, onetwo);
             game.display.drawBitmap(30,30, onetwo,0,0);
                          game.display.drawBitmap(40,40, onetwo,0,1);
                          game.display.drawBitmap(50,50, onetwo,1,0);
    	}
	}
	return(1);
}

Catsfolly

1 Like

Thanks! Excellent work. Added to bugs list

I don’t know if anyone wants this, but it’s a replacement background image for the simulator.

http://socoder.net/uploads/124/Background.zip

just extract it to POKITTO_SIM/Bin/Debug/

Here is a preview, but you must use the zip file above containing the background.bmp.

3 Likes

15 posts were split to a new topic: Flip and rotate arguments to drawing functions?

A post was merged into an existing topic: Flip and rotate arguments to drawing functions?