Mintoris
Apr 28, 2017, 12:47 PM *
Welcome, Guest.

login

register

Did you miss your activation email?


Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 10
 1 
 on: Apr 20, 2017, 08:58 PM 
Started Chuck - Last post by Chuck
Can you guess what SetDrawingBufferOffest offsetX, offsetY does?

Code:
' ********************
' ** Analoge Clock  **
' **    (C) 2011    **
' ** Thomas Krueger **
' ********************

GRAPHICS ON
SETSCALE 479,799
StrokeWidth 3
DEGREE

tx=SCREENX()/2
ty=SCREENY()/2

COLOR 75,0,0

DrawingBuffer on

color 0,0,0
cls

FOR w=0 TO 360 STEP 6
  COLOR 75,0,0
  x=SIN(w)*180+tx
  y=COS(w)*180+ty
  LINE x,y,SIN(w)*20+x,COS(w)*20+y
  IF (w%30)=0 THEN
    COLOR 0,0,75
    x=SIN(w)*160+tx
    y=COS(w)*160+ty
    LINE x,y,SIN(w)*40+x,COS(w)*40+y
  ENDIF
NEXT w

DrawingBuffer off

ox = 0
oy = 0

DO
  t$=FORMATTIME$(TIME(),"hhmmss")
  s=VAL(MID$(t$,5,2))
  IF so<>s THEN
    so=s

    cls
    COLOR 0,100,0
    m=VAL(MID$(t$,3,2))
    LINE tx,ty,SIN(180-(m*6))*155+tx,COS(180-(m*6))*155+ty
    w=VAL(MID$(t$,1,2))
    LINE tx,ty,SIN(180-(w*30)-(m*0.5))*120+tx,COS(180-(w*30)-(m*0.5))

*120+ty
    COLOR 0,25,0
    LINE tx,ty,SIN(180-(s*6))*155+tx,COS(180-(s*6))*155+ty
    CIRCLE SIN(180-(s*6))*140+tx,COS(180-(s*6))*140+ty,10,1
  ENDIF

  setDrawingBufferOffset ox, oy
  ox += 2
  oy += 2
  render

LOOP

 2 
 on: Apr 17, 2017, 06:26 PM 
Started Chuck - Last post by Chuck
I just finished adding a new graphics command which will allow you to buffer drawing commands to be drawn automatically right after a cls (clear screen). This is for the regular graphics mode.

Code:
Graphics on

DrawingBuffer on
color 0,0,100,100
cls
color 100,0,0,100
line 0,0,screenX(), screenY()

DrawingBuffer off

Now whenever you clear the screen the buffered drawing commands are automatically drawn in for you at high speed.

Then you can enter your draw loop and do animation or whatever over the pre-drawn background.

Expect this in Version 8.

 3 
 on: Apr 17, 2017, 07:52 AM 
Started dstmartin - Last post by mjcoon
I'm doing an overhaul on Basic atm or I would have got it done by now. I'll keep it at the top of my list.

Could you email ( support@mintoris.com ) me one of your xml files for testing. Nothing with sensitive data. I've still got a ton of work planned before I'll get to it, but if I have your file and kinda know how you will be using it, you will get just want you need. I expect you will say something like:

Open 1, "my.xml", "r"
ReadXml 1, hashtable
Close 1

and you get a hashtable filled by the xml file. Easy.

I suppose we also need a write command:

WriteXml n, hashtable
I think I'd need more of a hint how this might work. IIRC XML allows container objects potentially with a list of subordinates. In KML, such as a "path" with multiple co-ordinates making up the path. But a hashtable does not seem to fit...

Mike.

 4 
 on: Apr 13, 2017, 07:49 AM 
Started gianfry56 - Last post by gianfry56
Sorry Chuck, maybe I explained  wrong.
Only a function to inform me if the device has a keyboard soft or hard...

How do you determine if the graphics area is of 2560 or of 2392 pixels for screenY() function?

 5 
 on: Apr 13, 2017, 07:32 AM 
Started gianfry56 - Last post by Chuck
Android doesn't provide a way to intercept characters from the soft keyboard. Also it's not possible to bring up the soft keyboard unless an input field has focus on the screen.

 6 
 on: Apr 12, 2017, 10:34 PM 
Started gianfry56 - Last post by gianfry56
Last question about this arguments  Smiley
is possible to get, maybe in new version 8, a function IsSoftKeys() which returns:
- True in case of soft keys
- False in case of hard keys
this would help programming.

good job Chuck

 7 
 on: Apr 12, 2017, 09:51 AM 
Started gianfry56 - Last post by Chuck
I've found the problem. Bitmaps are using the diagonal ratio like it was a circle. If I change it so bitmaps are scaled using the setscale x and y ratios bitmaps will then be skewed when displayed on different ratios. The advantage of using a single diagonal ratio is that bitmaps are not skewed.

Below are the scale calculations and the source code for the method that draws the bitmap.

Code:
_scaleX = actual width / scaled width
_scaleY = actual height / scaled height
_scaleRadius = actual diagonal length / scaled diagonal length

public static void drawBitmap(Bitmap bitmap, float x, float y, float degRot, float scaleX, float scaleY) {

if(!isGraphicsReady())
return;

float cx = scaleX(x);
float cy = scaleY(y);

Matrix matrix = new Matrix();
matrix.reset();
matrix.postTranslate(cx - (float) bitmap.getWidth()/2, cy - (float) bitmap.getHeight()/2);
matrix.postScale(scaleX * _scaleRadius, scaleY * _scaleRadius, cx, cy);
matrix.postRotate(degRot, cx, cy);

drawingCanvas.drawBitmap(bitmap, matrix, drawingPaint);

}


Check out the post below.

SetScale in combination w/ Circle and bitmaps


 8 
 on: Apr 12, 2017, 08:20 AM 
Started gianfry56 - Last post by Chuck
I've been looking at your images more closely and now I'm not sure what is going on. I will test it shortly.

 9 
 on: Apr 12, 2017, 08:17 AM 
Started gianfry56 - Last post by Chuck
1440x2392 is the drawable area. It's correct because you can't draw on the soft buttons.

This is a problem with Basic. It needs to subtract the soft button area to get the right scaling ratio. As soon as I get off work I will work on it. This is a new problem since Android didn't have soft buttons when I added the setscale command.

 10 
 on: Apr 12, 2017, 08:11 AM 
Started gianfry56 - Last post by gianfry56
I have to understand something fundamental to continue:
on my phone with resolution 1440x2560, ScreenY() return 2392: this is correct  or not?


Pages: [1] 2 3 ... 10
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.078 seconds with 15 queries.