Categories
Development

Most efficient way of storing objects with corresponding indices

I want to store a collection of Points, which are objects of the class Point. (Point contains properties as positionX, positionY, electricalPotential, etc.) Each of them should have an index i, but the don’t need to be ordered in any way. This is why I used a dictionary Dictionary<int, Point> meshpoints in the first place. […]

Categories
Development

Most efficient way of storing objects with corresponding indices

I want to store a collection of Points, which are objects of the class Point. (Point contains properties as positionX, positionY, electricalPotential, etc.) Each of them should have an index i, but the don’t need to be ordered in any way. This is why I used a dictionary Dictionary<int, Point> meshpoints in the first place. […]

Categories
Development

I’m trying to make the canvas element move with keyboard

I know this question has been answered like a q2i3648123648 times but I’m trying to make the red square move with the keyboard for some reason the code worked with mouse event but doesn’t seem to work with keyboard input this is the javascript code let canvas; let canvasContext; let playerPositionX = 10; let playerPositionY […]

Categories
Development

Getting the screen pixels as byte array

I need to change my screen capture code to get a pixel array instead of a Bitmap. I change the code to this: BitBlt > Image.FromHbitmap(pointer) > LockBits > pixel array But, I’m checking if it’s possible to cut some middle man, and have something like this: BitBlt > Marshal.Copy > pixel array Or even: […]

Categories
Development

Canvas problem whe i open file by index.html

`So, I’m confused. when I open this project by running a live server everything is good, but when I open this using index.html file it shows a lot of errors. What’s the problem? const heartCanvas = document.querySelector(“.gameField .heart canvas”); const heartContx = heartCanvas.getContext(“2d”); //canvas size heartCanvas.width = 1000; heartCanvas.height = 500; const heartCanvasHeight = heartCanvas.height; […]