What element can I use to draw Conway's Game of Life logic on?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Brynjar Harðarson
:warning: Old Version Published before Godot 3 was released.

I’m very new to Godot and thought I’d start by making Conway’s Game of Life.

I’m wondering though where to draw the pixels, unless I can draw directly on to the window I reckon I need something like Node2D or Sprite element, the problem with them though is that their size can only be set using the Scale field, which I’m not sure I can use to make it pixel perfectly fill the window (it would be easier if they had something like Width and Height fields (e.g. w: 1024, h: 600) rather than Scale), and I suspect that scale may just scale a limited set of pixels rather than give me a pixel for every pixel on the window.

So what element can I use, how can I make it fill the window pixel perfectly (have access to 1024x600 pixels for drawing), or do I perhaps not need an element?

I’ll figure out the draw commands later (my guess is I just use draw_rect for every pixel)

:bust_in_silhouette: Reply From: mateusak

You’re getting this wrong.

A Sprite isn’t a Texture.
A Sprite holds a Texture.

You can get this Texture using Sprite.get_texture(). This Texture has its own functions, which include everything you need. You can also get the size of the window using OS.get_window_size().

Personally, I would go for a TileMap, which will simplify the logic, but do what you must.

:bust_in_silhouette: Reply From: aozasori

Node2D don’t have a size in any meaningful way. The bounding box in the editor is only really useful to let you see where one is. You can draw outside of it, as far as i know.

But if you need a basic node that has a size you can set, you can use Control.