Skip to content

Commit 60ba449

Browse files
committed
switch to pygame-ce;
force antialiasing
1 parent 88f2548 commit 60ba449

3 files changed

Lines changed: 12 additions & 26 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Also available online at: [https://bntr.itch.io/visual-lambda](https://bntr.itch
2424

2525
## Dependencies
2626
- python 3
27-
- pygame 2.4.0
27+
- pygame-ce 2.5.6
2828

29-
## Running
29+
## Runningpython
3030
python main.py
3131

3232
## Controls

main.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
import pygame
77
from pygame.locals import *
88

9-
# Issue https://github.com/pygame/pygame/issues/3778 (fixed in pygame 2.4.0)
10-
USE_GFXDRAW = 0 # set for pygame < 2.4.0; gfxdraw allows negative circle positions, but fill and stroke are not match for small circles
11-
if USE_GFXDRAW:
12-
import pygame.gfxdraw
13-
149
import cursors
1510
import toolbar
1611

@@ -265,7 +260,8 @@ def __init__( self, caption ):
265260
fontsize = fontsize * 3//2 #!!! fixing pygbag
266261
toolbar.ToolbarItem.fontsize = fontsize
267262
toolbar.ToolbarItem.font = pygame.font.SysFont( 'lucidaconsole', fontsize )
268-
toolbar.ToolbarItem.fontAntialias = config.IS_WEB_PLATFORM #!!! fixing pygbag
263+
#toolbar.ToolbarItem.fontAntialias = config.IS_WEB_PLATFORM #!!! fixing pygbag
264+
toolbar.ToolbarItem.fontAntialias = True
269265

270266
left = toolbar.Toolbar( toolbar.LEFT )
271267
if config.ALLOW_SYSTEM_CONSOLE:
@@ -361,25 +357,14 @@ def checkRanges( pos,r, size ):
361357
-r < pos[1] < size[1]+r
362358

363359

364-
def circle( self, surface, pos, r, col=None, width=1 ):
365-
366-
r = toInt( r )
367-
368-
if r < 1:
369-
debug( 1, "Error: circle radius < 1" )
370-
return
371-
372-
pos = tuple(map( toInt, pos ))
360+
def circle( self, surface, pos, r, col=None, width=1, aa=True ):
373361

374362
col = self.getColor( col )
375363

376-
if USE_GFXDRAW:
377-
if width == 0:
378-
pygame.gfxdraw.filled_circle( surface, pos[0], pos[1], r, col )
379-
else:
380-
pygame.gfxdraw.circle( surface, pos[0], pos[1], r, col )
381-
if width > 1:
382-
pygame.gfxdraw.circle( surface, pos[0], pos[1], r-1, col )
364+
if aa:
365+
if width > 1 and r < 50: # avoid small bold circles
366+
width = 1
367+
pygame.draw.aacircle( surface, col, pos, r, width )
383368
else:
384369
pygame.draw.circle( surface, col, pos, r, width )
385370

@@ -530,7 +515,7 @@ def drawHole( self, figure, noke, fill, r ):
530515
mask = pygame.Surface( size )
531516
mask.fill( colorMask1 )
532517
r = toInt(r)
533-
self.circle( mask, (r,r), r, colorMask2, width=0 )
518+
self.circle( mask, (r,r), r, colorMask2, width=0, aa=False )
534519
mask.set_colorkey( colorMask2, RLEACCEL )
535520
surface.blit( mask, (0,0) )
536521
surface.set_colorkey( colorMask1, RLEACCEL )

window.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def __init__( self, caption, size ):
2828
if config.IS_WEB_PLATFORM:
2929
fontsize = fontsize * 2 #!!! fixing pygbag
3030
self.font = pygame.font.SysFont( 'lucidaconsole', fontsize )
31-
self.fontAntialias = config.IS_WEB_PLATFORM #!!! fixing pygbag
31+
#self.fontAntialias = config.IS_WEB_PLATFORM #!!! fixing pygbag
32+
self.fontAntialias = True
3233

3334
# Invalidation
3435
self.paintEvent = pygame.event.Event( events.ONPAINTEVENT )

0 commit comments

Comments
 (0)