Qbasicnews.com
February 28, 2020, 02:51:22 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: PCopy in UGL  (Read 3366 times)
seph
Na_th_an
*****
Posts: 1915



« on: June 13, 2003, 02:17:15 AM »

How do I do PCopy? I don't really want to use SWAP all the time in my program...
Logged

earn.
seph
Na_th_an
*****
Posts: 1915



« Reply #1 on: June 13, 2003, 01:44:42 PM »

Okay fine Blitz, I'm switching to RelLib Smiley
Logged

earn.
seph
Na_th_an
*****
Posts: 1915



« Reply #2 on: June 13, 2003, 02:09:20 PM »

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!
Logged

earn.
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #3 on: June 13, 2003, 03:17:52 PM »

circles are for wimps
Logged

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.
wizardlife
Na_th_an
*****
Posts: 1456


WWW
« Reply #4 on: June 13, 2003, 04:40:04 PM »

Quote from: "Agamemnus"
circles are for wimps


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

lol
Logged

Blitz
I hold this place together
*****
Posts: 853



WWW
« Reply #5 on: June 13, 2003, 11:42:41 PM »

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
Logged

oship me and i will give you lots of guurrls and beeea
seph
Na_th_an
*****
Posts: 1915



« Reply #6 on: June 14, 2003, 02:07:15 PM »

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?
Logged

earn.
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #7 on: June 14, 2003, 07:23:38 PM »

your qb45.exe is broken..
Logged

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.
seph
Na_th_an
*****
Posts: 1915



« Reply #8 on: June 14, 2003, 08:17:27 PM »

Agamemnus, you're stupid!!!! But only IF stupid = awesome.in.spanish.or.something Smiley

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
Logged

earn.
Blitz
I hold this place together
*****
Posts: 853



WWW
« Reply #9 on: June 15, 2003, 01:00:59 AM »

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.
Logged

oship me and i will give you lots of guurrls and beeea
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #10 on: June 15, 2003, 11:32:41 AM »

I thought that the way you set up DCs and all, one shouldn't have to use paging. Argh....
Logged

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.
ak00ma
Ancient Guru
****
Posts: 669



« Reply #11 on: June 15, 2003, 02:37:49 PM »

When you use resolutions higher than 320x240 copying of DCs takes too much time because the DCs need more memory of EMS...so page switching is in that resolutions the better choice of doing
Logged

B 4 EVER
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #12 on: June 15, 2003, 04:06:42 PM »

i don't get it.
Logged

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.
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #13 on: June 15, 2003, 05:29:36 PM »

It's simple: If you do page flipping you don't have to copy memory. So it is faster.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!