question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pyxel.cls(0) is not clearing the screen properly for some resolutions

See original GitHub issue

Some pixels do not get overwriten(/overdrawn) on some resolutions.

import pyxel

class MyGame:
    def __init__(self):
        pyxel.init(100,100)
        self.x = 0
        pyxel.run(self.update, self.draw)

    def update(self):
        self.x = (self.x + 1) % pyxel.width

    def draw(self):
        pyxel.cls(0)
        pyxel.rect(self.x,0,self.x+7,7,9)

MyGame()

this code leads to this result: 100x100

but if I change the pyxel.init() to

pyxel.init(100,101)

the result is fine: 100x101

This code shows how the bottom and right border aren’t drawn properly

import pyxel

class MyGame:
    def __init__(self):
        pyxel.init(100,100)
        self.x = 0
        pyxel.run(self.update, self.draw)

    def update(self):
        self.x = (self.x + 1) % pyxel.width

    def draw(self):
        pyxel.cls(13)
        pyxel.rect(self.x,0,self.x+7,7,9)

MyGame()

pyxel-180803-203905

  • Win10,
  • Python 3.6.2
  • pyxel 0.7.4

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kitaocommented, Aug 4, 2018

Now I understood the cause. It’s the limitation of the point sprite size of OpenGL. It’s limited to 256 and Pyxel uses OpenGL point sprite to draw elements. So any element its size if over 256 is limited to 256. And cls is the same implementation as rect. So this problem happens.

It isn’t easy to remove this limitation on the current implementation. So please let this limitation as a specification of Pyxel for a while.

0reactions
kitaocommented, Jul 2, 2019

Hi, On SDL2 version of Pyxel, clipping is processed with pure software (not using OpenGL feature). So I don’t think this issue happen again on the latest version.

2019年7月2日(火) 12:06 Derek McCammond notifications@github.com:

Hey @kitao https://github.com/kitao, now that Pyxel has moved to SDL2, does that mean that this could potentially get reopened? The reason I ask is because I’m trying to write some stuff specifically for the GPi case and that thing is 320x240. I can live with 256x240, but it doesn’t hurt to ask!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kitao/pyxel/issues/26?email_source=notifications&email_token=AAFFXEU4V6LQXVV77C2EP2LP5LA4HA5CNFSM4FNZYAIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY75KOY#issuecomment-507499835, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFFXEV7HTC6Y4RDJMU64TTP5LA4HANCNFSM4FNZYAIA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

tkinter not recognizing screen resolution correctly
I believe the default DPI for Tkinter is 72, my screen being 15.6 inch would have 282 DPI. Most probably you have some...
Read more >
BRL.Max2D - BlitzMax
Clears the graphics buffer to the current cls color as determined by SetClsColor. ... Not drawing the last pixel can be useful if...
Read more >
Leica Application Suite - LAS User Manual - STLCC.edu
When the Leica Application Suite is first installed on the computer, all of the Optional Modules are also installed but not enabled. Selecting...
Read more >
CHIP-8 in Common Lisp: Graphics - Steve Losh
Video Memory and Performance; Fonts; Clearing the Screen: CLS ... The CHIP-8 has a 64x32 pixel display, and each pixel has only two...
Read more >
PICO-8 manual - Lexaloffle Games
If a pixel-wise selection is not present, many operations are instead ... not specified, the current colour is set to 6 cls [col]...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found