Graphics library hints

Greetings,
ii come out of a long period of experience with c++ terminal restricted coding and Game Maker graphical applications. Then i clashed with GM's system limitations, and i decided to extend my c++ to graphical interfaces.
I tried out SFML, it being suggested by various sources, and yeah it has many similarities with GML, and that together with my previous c++ experience was of great help for a fast switch.
But both SFML and GML are not particularly made with general applications development in mind (mainly both use a step system with a queue which contains all inputs that can be pop-ed out)
Now, since i'm working on some non-game applications, i'm wondering if there's something else i can use.
All i need is to draw transparent sprites, texts and rectangles, with transparency and decent font quality, but mainly without much of the useless overhead caused by GML and SFML. I need something really basic.
Also i'd prefer to capture input interrupts rather then popping them out of a queue a fixed amount of times per second.

One example of application i'd like to develop is a simple "notepad", but implementing the whole textbox by myself rather than importing already existing ones. I already implemented textboxes in gamemaker so i know what i'm doing, i know the "reuse code is better" stuff, but that's just the base i'll work on.

Also a note: i don't care a fluff about portability, i don't care about Linux compatibility and even less about mo bile compatibility.
Hence i prefer A LOT something which has better performance on Windows only, and lower resources usage on Windows only, rather than something which would perform a little less on Windows but with the "advantage" of being portable which i really don't need.
I'm specifying that last part because every time i see this kind of questions people answering keeps supposing the world needs cross-system compatibility even when one doesn't really care about it.

So, any lightweight and performing gaphics library suggestion?

p.s. i'm asking because i noticed the SFML version of a previous GML program i made, with the only purpose of being lightweight on the system, requires even more resources than the GML version, while i honestly expected c++ SFML to be better performing.
Graphics as in GUI or general graphics? The difference is huge.
General graphics; as i said, i don't want to put a textbox there, i want to implement the textbox by myself, just as example.

May GDI be what i'm looking for?
Last edited on
I know how to "draw transparent sprites, texts and rectangles, with transparency and decent font quality" with python/pygame (though I never use fonts much, I assume they're ok), but am unfamiliar with the c++ library which should be called SDL, which pygame is based on, so should be similar. SDL is supposedly best for 2d stuff whereas opengl is best for 3d stuff (I guess but am no expert).

for whatever it's worth this makes a transparent text box in pygame (sdl based)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import pygame,time,copy,math,random,sys,traceback

def getbox(width,height,transparentPercent,text):
    box=pygame.Surface((width,height)
    box.set_alpha(128) #transparency from 0 to 255
    box.fill((0,0,0)) #fill with black, easy way to make a black border
    box.fill((0,255,0), (2,2,width-4,height-4)) #fill inside of border with green
    pygame.font.init()
    f=pygame.font.Font(None,24)
    mytext=f.render(text,True,(0,0,0))
    box.blit(mytext,(8,8))
    return box

def stripe(surf,c1,c2,stripeheight):
    flip=0
    for y in range(0,surf.get_height(),stripeheight):
        if flip==0:
            surf.fill(c1,(0,y,surf.get_width(),stripeheight))
        else:
            surf.fill(c2,(0,y,surf.get_width(),stripeheight))
        flip=(flip+1)%2

sw=512
sh=512
screen=pygame.display.set_mode((sw,sh))

box=getbox(256,128,128,"hello")

try:
    cc=0
    running=True
    while running:
        for e in pygame.event.get():
            if e.type==pygame.QUIT:
                running=False
            if e.type==pygame.KEYDOWN and e.key==pygame.K_SPACE:
                pass
            elif e.type==pygame.MOUSEBUTTONDOWN:
                pass

        
        #screen.fill((255,0,0))
        stripe(screen,(255,0,0),(0,0,255),50)
        screen.blit(box,(0,0))
        
        pygame.display.flip()
        time.sleep(0.1)
except Exception, e:
    tb = sys.exc_info()[2]
    traceback.print_exception(e.__class__, e, tb)
pygame.quit()
Topic archived. No new replies allowed.