XHXIAIEIN's Recent Forum Activity

  • Use @import url(). this works for me.

    CSS
    @import url("https://fonts.googleapis.com/css?family=Amatic+SC:400,700");
    body { font-family: 'Amatic SC', sans-serif; font-size: 2em; }
  • It may be related to your browser Version or computer hardware configuration. You can post your computer hardware information. This can help you find a problem better

    Or you can try to turn off the UI animation and Effect in the settings, which can also reduce the use of memory.

  • Icons in text example: #open=icons-in-text

    Animation Tag [icon=piggy]
    Animation Frame [icon=1] same as [icon=monster]
     
    BBCode Set Size: 
    [size=32][icon=piggy][/size]
    [size=64][icon=piggy][/size]
    
    BBCode Adjusting vertical alignment: 
    [icon=piggy]
    [iconoffsety=0][icon=piggy][/iconoffsety]
    [iconoffsety=50%][icon=piggy][/iconoffsety]
    
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Tom The Steam deck desktop mode comes with an app store called discover. I found that there are several game engines in it, but Construct is not on the list. In fact, Recently my laptop broke and I have been using steamdeck to run Construct for 2 weeks and everything is fine. I think we can put a version on discover, maybe it can attract some new users.

    apps.kde.org/discover

  • Thanks! it can works.

    This function gets the color value from 0-1, which needs to be converted to 0~255.

    function convertTo255(value) {
     return Math.round(value * 255);
    }
    
    const ALPHAEX_SHIFT = 1024;
    const ALPHAEX_MAX = 1023;
    const RGBEX_SHIFT = 16384;
    const RGBEX_MAX = 8191;
    
    const RGB_MASK = [255, 65280, 16711680];
    const RGB_SHIFT = [0, 8, 16];
    const RGB_FACTOR = [RGBEX_SHIFT * RGBEX_SHIFT * ALPHAEX_SHIFT, RGBEX_SHIFT * ALPHAEX_SHIFT, ALPHAEX_SHIFT]; 
    
    function getColorValue(rgb, index) {
     if (rgb >= 0) {
     return (rgb & RGB_MASK[index]) >> RGB_SHIFT[index];
     } else {
     let v = Math.floor(-rgb % RGB_FACTOR[index] / RGB_FACTOR[index] / ALPHAEX_SHIFT);
     if (v > RGBEX_MAX) v -= RGBEX_SHIFT;
     return v / 1024;
     }
    }
    
    function GetRValue(rgb) {
     return getColorValue(rgb, 0) / 255;
    };
    
    function GetGValue(rgb) {
     return getColorValue(rgb, 1) / 255;
    };
    
    function GetBValue(rgb) {
     return getColorValue(rgb, 2) / 255;
    };
    
    function isNegativeZero(n) {
     return Object.is(n, -0);
    }
    
    function GetAValue(rgb) {
     if (isNegativeZero(rgb))
     return 0;
     else if (rgb >= 0)
     return 1;
     else {
     const v = Math.floor(-rgb % ALPHAEX_SHIFT);
     return v / ALPHAEX_MAX;
     }
    };
    
    function convertTo255(value) {
     return Math.round(value * 255);
    }
    

    Use:

    //------------------------------------------------
    // Set Global Var
    //------------------------------------------------
    const colorValue = runtime.globalVars.colorValue;
    runtime.globalVars.r = convertTo255(C3.GetRValue(colorValue));
    runtime.globalVars.g = convertTo255(C3.GetGValue(colorValue));
    runtime.globalVars.b = convertTo255(C3.GetBValue(colorValue));
    
  • Converting a colorValue back to RGB 255:

    R = int((-colorValue / 2^38) % 1025 * 255 / 1023)

    G = int((-colorValue / 2^24) % 1025 * 255 / 1023)

    B = int((-colorValue / 2^10) % 1025 * 255 / 1023)

    A = int((-colorValue) % 1025 * 255 / 1023)

    I tested using some colors but the formula didn't give the expected results

    -> System: Set colorValue to Sprite.ColorValue

    const colorValue = runtime.globalVars.colorValue;
    runtime.globalVars.r = Math.round((-colorValue / Math.pow(2, 38)) % 1025 * 255 / 1023);
    runtime.globalVars.g = Math.round((-colorValue / Math.pow(2, 24)) % 1025 * 255 / 1023);
    runtime.globalVars.b = Math.round((-colorValue / Math.pow(2, 10)) % 1025 * 255 / 1023);
    runtime.globalVars.a = Math.round((-colorValue) % 1025 * 255 / 1023);
    
    White (255, 255, 255)	// -281492157629439 -> (255,4,196,60)
    Dark(10, 20, 30)		// -10996458578943 -> (10,116,220,36)
    Grey(128, 128, 128)		// -141295868185599 -> (128,122,218,37)
    Red(255, 0, 0)			// -281474976711679 -> (255,4,192,63)
    Green(0, 255, 0)		// -17179870207 -> (0,255,4,251)
    Blue(70, 59, 222)		// -77244652187647 -> (70,216,94,161)
    
  • Ashley I'm confused about the ColorValue expression, which returns an integer that contains negative numbers. Is there a way to convert it to a regular color value?

    For example, Allow expression input parameters:

    ColorValue("R")

    ColorValue("G")

    ColorValue("B")

    ColorValue("A")

  • Maybe the Timer behavior could add an "exact calculation" property that is enabled by default. People who are more performance-critical can disable it to get a limited version of a timer?

  • I often use Timer instead of Function because it provides a delayed execution solution.

  • > There is also a developer who improved this weapp-adapter: github.com/finscn/weapp-adapter/blob/master/README_EN.md

    That link lists 5 known bugs in the WeChat game library, some look really nasty and difficult to work around, and I bet if we ported Construct we'd find a lot more. So I think my intuition was correct - supporting it would be a nightmare!

    I also tried to contact the mini games team but there was no news. They simply ignored my request because I was just a small user. But Other HTML 5 engines have already provided corresponding solutions, many of which are open source.(I linked to their code base in my previous post). Maybe Construct can reduce a lot of troubles on this road.

    But considering the current situation, I will not insist on this topic, because taking up too much energy in there may cause other plans behind C3 to be postponed indefinitely.

    I will continue to try to contact the mini games team to see if they can provide some technical support or support webview.

  • > The running environment of the mini game on iOS is JavaScriptCore, V8 on Android, they are all running environments without BOM and DOM, and there are no global document and window objects. Therefore, when you want to use the DOM API to create elements such as Canvas and Image, an error will occur.

    Yes, it doesn't support webview so they provide an 'adapter' to simulate a browser environment. Convert the DOM into their environment via the WXAPI provided by the adapter.

    There is also a developer who improved this weapp-adapter: github.com/finscn/weapp-adapter/blob/master/README_EN.md

XHXIAIEIN's avatar

XHXIAIEIN

Member since 26 Mar, 2016

Twitter
XHXIAIEIN has 11 followers

Trophy Case

  • 8-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • RTFM Read the fabulous manual
  • x46
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x10
    Lightning Draw First person to up-vote a new Construct 3 release
  • x9
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

20/44
How to earn trophies