Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PCopy in UGL
#1
How do I do PCopy? I don't really want to use SWAP all the time in my program...
earn.
Reply
#2
Okay fine Blitz, I'm switching to RelLib Smile
earn.
Reply
#3
Rel! I wanna find a newer copy of your library RelLib cause this one doesn't cover circles (I'm using 1.1) and I need circles damnit!
earn.
Reply
#4
circles are for wimps
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#5
Quote:circles are for wimps

agree. The perfect lib for me would be putsprite, putpixel, newbuffer, blitbuffer.

lol
Reply
#6
ehh?
You can either create dc to use as a backbuffer or have several pages and do

uglSetVisPage page
page = (page + 1) mod PAGESALLOCATED
uglSetWrkPage page
oship me and i will give you lots of guurrls and beeea
Reply
#7
Okay I like EVERY SINGLE THING about UGL so far! One problem, Blitz... When I uglClear my edit DC, it takes forever, making my program run too slow! What I do is I draw all my background DCs first. As the program runs, it does this:

- uglClear the edit DC for editting on...
- uglPut the background onto the edit DC.
- Redraw my objects and then uglPut them onto the edit DC.
- uglPut the edit DC onto the video DC.

Why does this take so long for it all to work? Is one of your UGL functions not meant to be run over and over in my program?
earn.
Reply
#8
your qb45.exe is broken..
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#9
Agamemnus, you're stupid!!!! But only IF stupid = awesome.in.spanish.or.something Smile

Code:
DECLARE SUB ExitProgram ()
DECLARE SUB ExitError (msg AS STRING)
DEFINT A-Z
'$INCLUDE: 'ugl/bi/ugl.bi'
'$INCLUDE: 'ugl/bi/tmr.bi'
'$INCLUDE: 'ugl/bi/kbd.bi'

CONST xRes = 800
CONST yRes = 600
CONST cRes = UGL.32BIT

tmrInit
DIM throbtimer AS TMR
tmrNew throbtimer, TMR.ONESHOT, tmrMs2Freq(240)

IF NOT uglInit THEN
    PRINT "Error!: Could not initialize library!"
    END
END IF

' ====== VIDEO ======
DIM video AS LONG
video = uglSetVideoDC(cRes, xRes, yRes, 1)
IF video = 0 THEN ExitError "Can't set screen mode!"
' ====== VIDEO ======

' ====== BLUEBALL ======
DIM blueball(0 TO 1) AS LONG
IF uglNewMult(blueball(), 2, UGL.EMS, cRes, 30, 30) = 0 THEN ExitError "Can't allocate blueball DC"

DIM blueballBMP AS LONG
blueballBMP = uglNewBMP(UGL.EMS, cRes, "blueball.bmp")
IF blueballBMP = 0 THEN ExitError "Could not allocate blueball page"

uglGet blueballBMP, 0, 0, blueball(0)
uglGet blueballBMP, 30, 0, blueball(1)

uglDel blueballBMP
' ====== BLUEBALL ======

' ====== EDIT ======
DIM pageEDIT AS LONG
pageEDIT = uglNew(UGL.EMS, cRes, xRes, yRes)
IF pageEDIT = 0 THEN ExitError "Can't allocate edit DC"
' ====== EDIT ======

' ====== BG ======
DIM pageBG AS LONG
pageBG = uglNew(UGL.EMS, cRes, xRes, yRes)
IF pageBG = 0 THEN ExitError "Can't allocate background DC"

'IF uglPutBMP(pageBG, 0, 0, "bg.bmp") = 0 THEN ExitError "Can't load BG.BMP"
uglClear pageBG, uglColor(cRes, 100, 200, 255)
' ====== BG ======

DIM keys AS TKBD
kbdInit keys

colors& = uglColors(cRes)

x% = 50
y% = 50

size% = 30
inc% = 12
throb% = 0

DO
    IF throbtimer.state = 0 THEN
        tmrNew throbtimer, TMR.ONESHOT, tmrMs2Freq(240)
        throb% = 1 - throb%
    END IF

    IF keys.up THEN IF y% >= 0 THEN y% = y% - inc%
    IF keys.down THEN IF y% <= yRes - size% THEN y% = y% + inc%
    IF keys.left THEN IF x% >= 0 THEN x% = x% - inc%
    IF keys.right THEN IF x% <= xRes - size% THEN x% = x% + inc%

    uglPut pageEDIT, 0, 0, pageBG
    uglPutMsk pageEDIT, x%, y%, blueball(throb%)
    uglPut video, 0, 0, pageEDIT
LOOP UNTIL keys.esc

uglDel pageEDIT
uglDel pageBG
uglDelMult blueball()
tmrDel throbtimer

ExitProgram

SUB ExitError (msg AS STRING)
    uglRestore
    kbdEnd
    tmrEnd
    uglEnd
    PRINT "ERROR! "; msg
    SYSTEM
END SUB

SUB ExitProgram
    kbdEnd
    tmrEnd
    uglRestore
    uglEnd
    SYSTEM
END SUB
earn.
Reply
#10
Well, that's not strange. Each time you clear that dc you're clearing 1.83 MB of memory. As if that wasn't bad enough, all of it is in EMS. Where you can only map 16 kb at a time and each map taking around 2000 clock cycles. Then you have to once again copy all that 1.83 MBs of mem to video ram which is 10 times slower then sysram and is split into 16-64kb banks which has to be mapped and each map taking quite sometime, and you're copying this from EMS. Get my point? For any resolution higher then 320x240x16 i'd use paging. Never use an EMS backbuffer, that defies the whole point of using a backbuffer.

Oh and if i were you i'd put each sprite in it's own bmp and load them with uglNewBMP. They way you're doing it now framengts memory. And be sure to check out archives in ugl. All the loaders load directly from archives as well.

Btw, build 0.21 will have a custom library builder and sound.
oship me and i will give you lots of guurrls and beeea
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)